init: Allow matching empty property values
When we have a property match along with an event trigger, we currently don't allow matching empty property values, in other words, properties that are unset. For example, the below trigger would never be run: on zygote-start && property:persist.sys.fuse="" That doesn't make sense though, it should be possible to match an empty property value, so this change allows that trigger to match when persist.sys.fuse is either empty or not set. This continues to not match a '*' to an empty property, so on zygote-start && property:persist.sys.fuse=* will not run if persist.sys.fuse is empty or unset. Test: the above triggers run appropriately Change-Id: Ia57de7b96ad352590d0c82ff4ae95060b7361976
This commit is contained in:
parent
4b8e6b673f
commit
6fd8d3bb1b
|
@ -195,10 +195,11 @@ bool Action::CheckPropertyTriggers(const std::string& name,
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::string prop_val = android::base::GetProperty(trigger_name, "");
|
std::string prop_value = android::base::GetProperty(trigger_name, "");
|
||||||
if (prop_val.empty() || (trigger_value != "*" && trigger_value != prop_val)) {
|
if (trigger_value == "*" && !prop_value.empty()) {
|
||||||
return false;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (trigger_value != prop_value) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
|
|
Loading…
Reference in New Issue