Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e42099a authored by Aaron Kling's avatar Aaron Kling
Browse files

init: Don't enable ADB by default on userdebug builds

This is to match the changes in post_process_props made in
I33ae5c6f2787017a62e679aa0c28d4b909d45935

Change-Id: If521a8abb4810f8b5d4e3164a06969af4fc12374
parent 711fa763
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -768,13 +768,13 @@ static void LoadPropertiesFromSecondStageRes(std::map<std::string, std::string>*
// So we need to apply the same rule of build/make/tools/post_process_props.py
// So we need to apply the same rule of build/make/tools/post_process_props.py
// on runtime.
// on runtime.
static void update_sys_usb_config() {
static void update_sys_usb_config() {
    bool is_debuggable = android::base::GetBoolProperty("ro.debuggable", false);
    bool is_eng = !android::base::GetBoolProperty("ro.adb.secure", true);
    std::string config = android::base::GetProperty("persist.sys.usb.config", "");
    std::string config = android::base::GetProperty("persist.sys.usb.config", "");
    // b/150130503, add (config == "none") condition here to prevent appending
    // b/150130503, add (config == "none") condition here to prevent appending
    // ",adb" if "none" is explicitly defined in default prop.
    // ",adb" if "none" is explicitly defined in default prop.
    if (config.empty() || config == "none") {
    if (config.empty() || config == "none") {
        InitPropertySet("persist.sys.usb.config", is_debuggable ? "adb" : "none");
        InitPropertySet("persist.sys.usb.config", is_eng ? "adb" : "none");
    } else if (is_debuggable && config.find("adb") == std::string::npos &&
    } else if (is_eng && config.find("adb") == std::string::npos &&
               config.length() + 4 < PROP_VALUE_MAX) {
               config.length() + 4 < PROP_VALUE_MAX) {
        config.append(",adb");
        config.append(",adb");
        InitPropertySet("persist.sys.usb.config", config);
        InitPropertySet("persist.sys.usb.config", config);