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

Commit fa50e3ef authored by Roman Kiryanov's avatar Roman Kiryanov
Browse files

adb: move the FgThread details around setAdbEnabled



This change removes copypasta around setAdbEnables
which will help in the next change.

Bug: 402444824
Flag: EXEMPT cleanup
Test: presubmit
Change-Id: I605ce7195d874c67b4764b45cf6adcde9cc6c338
Signed-off-by: default avatarRoman Kiryanov <rkir@google.com>
parent 081c6821
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -190,15 +190,11 @@ public class AdbService extends IAdbManager.Stub {
            if (mAdbUsbUri.equals(uri)) {
                boolean shouldEnable = (Settings.Global.getInt(mContentResolver,
                        Settings.Global.ADB_ENABLED, 0) > 0);
                FgThread.getHandler().sendMessage(obtainMessage(
                        AdbService::setAdbEnabled, AdbService.this, shouldEnable,
                            AdbTransportType.USB));
                setAdbEnabled(shouldEnable, AdbTransportType.USB);
            } else if (mAdbWifiUri.equals(uri)) {
                boolean shouldEnable = (Settings.Global.getInt(mContentResolver,
                        Settings.Global.ADB_WIFI_ENABLED, 0) > 0);
                FgThread.getHandler().sendMessage(obtainMessage(
                        AdbService::setAdbEnabled, AdbService.this, shouldEnable,
                            AdbTransportType.WIFI));
                setAdbEnabled(shouldEnable, AdbTransportType.WIFI);
            }
        }
    }
@@ -427,6 +423,11 @@ public class AdbService extends IAdbManager.Stub {
    }

    private void setAdbEnabled(boolean enable, byte transportType) {
        FgThread.getHandler().sendMessage(obtainMessage(
                AdbService::setAdbEnabledDoNotCallDirectly, this, enable, transportType));
    }

    private void setAdbEnabledDoNotCallDirectly(boolean enable, byte transportType) {
        Slog.d(TAG, "setAdbEnabled(" + enable + "), mIsAdbUsbEnabled=" + mIsAdbUsbEnabled
                 + ", mIsAdbWifiEnabled=" + mIsAdbWifiEnabled + ", transportType=" + transportType);