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

Commit 7f04dacc authored by David Anderson's avatar David Anderson Committed by Android (Google) Code Review
Browse files

Merge "Allow ITradeInMode to be used on ro.debuggable builds." into main

parents 1302e8c5 1dc105ef
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -137,12 +137,13 @@ public final class TradeInModeService extends SystemService {
                Slog.i(TAG, "Not starting trade-in mode, device is setup.");
                return false;
            }
            if (SystemProperties.getInt("ro.debuggable", 0) == 1) {
            if (isDebuggable()) {
                if (!isForceEnabledForTesting()) {
                    // We don't want to force adbd into TIM on debug builds.
                    Slog.e(TAG, "Not starting trade-in mode, device is debuggable.");
                    return false;
                }
            if (isAdbEnabled()) {
            } else if (isAdbEnabled()) {
                Slog.e(TAG, "Not starting trade-in mode, adb is already enabled.");
                return false;
            }
@@ -234,6 +235,10 @@ public final class TradeInModeService extends SystemService {
        return SystemProperties.getInt("ro.debuggable", 0) == 1;
    }

    private boolean isForceEnabledForTesting() {
        return SystemProperties.getInt("persist.adb.test_tradeinmode", 0) == 1;
    }

    private boolean isAdbEnabled() {
        final ContentResolver cr = mContext.getContentResolver();
        return Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0) == 1;