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

Commit e2105047 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert "init: adding fallback paths for debug ramdisk"" am: 0d712ad3

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1697285

Change-Id: Ia3b01afbda44bc2295fdc6a8dcaf6d2ed9583701
parents ee88c37a 0d712ad3
Loading
Loading
Loading
Loading
+2 −15
Original line number Diff line number Diff line
@@ -329,23 +329,10 @@ int FirstStageMain(int argc, char** argv) {

    // If "/force_debuggable" is present, the second-stage init will use a userdebug
    // sepolicy and load adb_debug.prop to allow adb root, if the device is unlocked.
    bool found_debuggable = false;
    std::string adb_debug_prop("/adb_debug.prop");
    std::string userdebug_sepolicy("/userdebug_plat_sepolicy.cil");
    if (access("/force_debuggable", F_OK) == 0) {
        found_debuggable = true;
    } else if (access("/first_stage_ramdisk/force_debuggable", F_OK) == 0) {
        // Fallback to legacy debug resource paths.
        // TODO(b/186485355): removes the fallback path once it is not needed.
        found_debuggable = true;
        adb_debug_prop.insert(0, "/first_stage_ramdisk");
        userdebug_sepolicy.insert(0, "/first_stage_ramdisk");
    }

    if (found_debuggable) {
        std::error_code ec;  // to invoke the overloaded copy_file() that won't throw.
        if (!fs::copy_file(adb_debug_prop, kDebugRamdiskProp, ec) ||
            !fs::copy_file(userdebug_sepolicy, kDebugRamdiskSEPolicy, ec)) {
        if (!fs::copy_file("/adb_debug.prop", kDebugRamdiskProp, ec) ||
            !fs::copy_file("/userdebug_plat_sepolicy.cil", kDebugRamdiskSEPolicy, ec)) {
            LOG(ERROR) << "Failed to setup debug ramdisk";
        } else {
            // setenv for second-stage init to read above kDebugRamdisk* files.