mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-13 05:17:37 -08:00
Add resetprop -w for waiting property change
It's very easy to wait for property change both in Java and C++, but it's not the case in shell script. With this patch, developers can now easily to wait for property change, just like what we have in `.rc` files, and to wait for boot complete.
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
#include <cxx.h>
|
||||
|
||||
struct prop_cb {
|
||||
virtual void exec(const char *name, const char *value) = 0;
|
||||
virtual void exec(const char *name, const char *value, uint32_t serial) = 0;
|
||||
};
|
||||
|
||||
using prop_list = std::map<std::string, std::string>;
|
||||
|
||||
struct prop_collector : prop_cb {
|
||||
explicit prop_collector(prop_list &list) : list(list) {}
|
||||
void exec(const char *name, const char *value) override {
|
||||
void exec(const char *name, const char *value, uint32_t) override {
|
||||
list.insert({name, value});
|
||||
}
|
||||
private:
|
||||
@@ -26,6 +26,6 @@ int delete_prop(const char *name, bool persist = false);
|
||||
int set_prop(const char *name, const char *value, bool skip_svc = false);
|
||||
void load_prop_file(const char *filename, bool skip_svc = false);
|
||||
|
||||
static inline void prop_cb_exec(prop_cb &cb, const char *name, const char *value) {
|
||||
cb.exec(name, value);
|
||||
static inline void prop_cb_exec(prop_cb &cb, const char *name, const char *value, uint32_t serial) {
|
||||
cb.exec(name, value, serial);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user