Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resetprop option to avoid triggering system_property_wait() #8675

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion native/src/core/resetprop/resetprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ struct PropFlags {
void setContext() { flags |= (1 << 2); }
void setPersistOnly() { flags |= (1 << 3); setPersist(); }
void setWait() { flags |= (1 << 4); }
void setSkipWait() { flags |= (1 << 5); }
bool isSkipSvc() const { return flags & 1; }
bool isPersist() const { return flags & (1 << 1); }
bool isContext() const { return flags & (1 << 2); }
bool isPersistOnly() const { return flags & (1 << 3); }
bool isWait() const { return flags & (1 << 4); }
bool isSkipWait() const { return flags & (1 << 5); }
private:
uint32_t flags = 0;
};
Expand Down Expand Up @@ -77,6 +79,8 @@ Read mode flags:

Write mode flags:
-n set properties bypassing property_service
-s set properties bypassing property_service and avoid triggering
system_property_wait
-p always write persistent prop changes to storage

)EOF", arg0);
Expand Down Expand Up @@ -165,7 +169,9 @@ static int set_prop(const char *name, const char *value, PropFlags flags) {

int ret;
if (pi != nullptr) {
if (flags.isSkipSvc()) {
if (flags.isSkipWait()) {
ret = __system_property_update(pi, value, strlen(value), true);
} else if (flags.isSkipSvc()) {
ret = __system_property_update(pi, value, strlen(value));
} else {
ret = system_property_set(name, value);
Expand Down Expand Up @@ -358,6 +364,9 @@ int resetprop_main(int argc, char *argv[]) {
case 'P':
flags.setPersistOnly();
continue;
case 's':
flags.setSkipWait();
continue;
case 'v':
set_log_level_state(LogLevel::Debug, true);
continue;
Expand Down
Loading