Merge "Update persist.sys.usb.config on runtime"
This commit is contained in:
commit
41346e553b
1 changed files with 19 additions and 0 deletions
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
|
#include <android-base/properties.h>
|
||||||
#include <android-base/stringprintf.h>
|
#include <android-base/stringprintf.h>
|
||||||
#include <android-base/strings.h>
|
#include <android-base/strings.h>
|
||||||
#include <bootimg.h>
|
#include <bootimg.h>
|
||||||
|
|
@ -573,10 +574,28 @@ static void load_persistent_properties() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// persist.sys.usb.config values can't be combined on build-time when property
|
||||||
|
// files are split into each partition.
|
||||||
|
// So we need to apply the same rule of build/make/tools/post_process_props.py
|
||||||
|
// on runtime.
|
||||||
|
static void update_sys_usb_config() {
|
||||||
|
bool is_debuggable = android::base::GetBoolProperty("ro.debuggable", false);
|
||||||
|
std::string config = android::base::GetProperty("persist.sys.usb.config", "");
|
||||||
|
if (config.empty()) {
|
||||||
|
property_set("persist.sys.usb.config", is_debuggable ? "adb" : "none");
|
||||||
|
} else if (is_debuggable && config.find("adb") == std::string::npos &&
|
||||||
|
config.length() + 4 < PROP_VALUE_MAX) {
|
||||||
|
config.append(",adb");
|
||||||
|
property_set("persist.sys.usb.config", config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void property_load_boot_defaults() {
|
void property_load_boot_defaults() {
|
||||||
load_properties_from_file("/default.prop", NULL);
|
load_properties_from_file("/default.prop", NULL);
|
||||||
load_properties_from_file("/odm/default.prop", NULL);
|
load_properties_from_file("/odm/default.prop", NULL);
|
||||||
load_properties_from_file("/vendor/default.prop", NULL);
|
load_properties_from_file("/vendor/default.prop", NULL);
|
||||||
|
|
||||||
|
update_sys_usb_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_override_properties() {
|
static void load_override_properties() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue