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

Commit 7c4e6619 authored by Kenny Root's avatar Kenny Root
Browse files

Rename to AdbDebuggingManager

Rename the UsbDebuggingManager to AdbDebuggingManager. It doesn't
technically depend on the USB stack, so rename to make the lack of
association more clear.

Bug: 63820489
Test: make
Change-Id: Ife83d3ec9701882781f5a9562ccc5435d51d246b
parent e0e84084
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@
            android:excludeFromRecents="true">
        </activity>

        <!-- started from UsbDebuggingManager -->
        <!-- started from AdbDebuggingManager -->
        <activity android:name=".usb.UsbDebuggingActivity"
            android:permission="android.permission.MANAGE_USB"
            android:theme="@style/Theme.SystemUI.Dialog.Alert"
+16 −16
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ import java.util.Arrays;
 * Provides communication to the Android Debug Bridge daemon to allow, deny, or clear public keysi
 * that are authorized to connect to the ADB service itself.
 */
public class UsbDebuggingManager {
    private static final String TAG = "UsbDebuggingManager";
public class AdbDebuggingManager {
    private static final String TAG = "AdbDebuggingManager";
    private static final boolean DEBUG = false;

    private static final String ADBD_SOCKET = "adbd";
@@ -68,22 +68,22 @@ public class UsbDebuggingManager {

    private final Context mContext;
    private final Handler mHandler;
    private UsbDebuggingThread mThread;
    private AdbDebuggingThread mThread;
    private boolean mAdbEnabled = false;
    private String mFingerprints;

    public UsbDebuggingManager(Context context) {
        mHandler = new UsbDebuggingHandler(FgThread.get().getLooper());
    public AdbDebuggingManager(Context context) {
        mHandler = new AdbDebuggingHandler(FgThread.get().getLooper());
        mContext = context;
    }

    class UsbDebuggingThread extends Thread {
    class AdbDebuggingThread extends Thread {
        private boolean mStopped;
        private LocalSocket mSocket;
        private OutputStream mOutputStream;
        private InputStream mInputStream;

        UsbDebuggingThread() {
        AdbDebuggingThread() {
            super(TAG);
        }

@@ -143,7 +143,7 @@ public class UsbDebuggingManager {
                        String key = new String(Arrays.copyOfRange(buffer, 2, count));
                        Slog.d(TAG, "Received public key: " + key);
                        Message msg = mHandler.obtainMessage(
                                UsbDebuggingHandler.MESSAGE_ADB_CONFIRM);
                                AdbDebuggingHandler.MESSAGE_ADB_CONFIRM);
                        msg.obj = key;
                        mHandler.sendMessage(msg);
                    } else {
@@ -201,7 +201,7 @@ public class UsbDebuggingManager {
        }
    }

    class UsbDebuggingHandler extends Handler {
    class AdbDebuggingHandler extends Handler {
        private static final int MESSAGE_ADB_ENABLED = 1;
        private static final int MESSAGE_ADB_DISABLED = 2;
        private static final int MESSAGE_ADB_ALLOW = 3;
@@ -209,7 +209,7 @@ public class UsbDebuggingManager {
        private static final int MESSAGE_ADB_CONFIRM = 5;
        private static final int MESSAGE_ADB_CLEAR = 6;

        UsbDebuggingHandler(Looper looper) {
        AdbDebuggingHandler(Looper looper) {
            super(looper);
        }

@@ -222,7 +222,7 @@ public class UsbDebuggingManager {

                    mAdbEnabled = true;

                    mThread = new UsbDebuggingThread();
                    mThread = new AdbDebuggingThread();
                    mThread.start();

                    break;
@@ -445,8 +445,8 @@ public class UsbDebuggingManager {
     * down the handler thread.
     */
    public void setAdbEnabled(boolean enabled) {
        mHandler.sendEmptyMessage(enabled ? UsbDebuggingHandler.MESSAGE_ADB_ENABLED
                                          : UsbDebuggingHandler.MESSAGE_ADB_DISABLED);
        mHandler.sendEmptyMessage(enabled ? AdbDebuggingHandler.MESSAGE_ADB_ENABLED
                                          : AdbDebuggingHandler.MESSAGE_ADB_DISABLED);
    }

    /**
@@ -454,7 +454,7 @@ public class UsbDebuggingManager {
     * always if {@code alwaysAllow} is {@code true}.
     */
    public void allowUsbDebugging(boolean alwaysAllow, String publicKey) {
        Message msg = mHandler.obtainMessage(UsbDebuggingHandler.MESSAGE_ADB_ALLOW);
        Message msg = mHandler.obtainMessage(AdbDebuggingHandler.MESSAGE_ADB_ALLOW);
        msg.arg1 = alwaysAllow ? 1 : 0;
        msg.obj = publicKey;
        mHandler.sendMessage(msg);
@@ -464,7 +464,7 @@ public class UsbDebuggingManager {
     * Denies debugging connection from the device that last requested to connect.
     */
    public void denyUsbDebugging() {
        mHandler.sendEmptyMessage(UsbDebuggingHandler.MESSAGE_ADB_DENY);
        mHandler.sendEmptyMessage(AdbDebuggingHandler.MESSAGE_ADB_DENY);
    }

    /**
@@ -472,7 +472,7 @@ public class UsbDebuggingManager {
     * to pass through {@link #allowUsbDebugging(boolean, String)} again.
     */
    public void clearUsbDebuggingKeys() {
        mHandler.sendEmptyMessage(UsbDebuggingHandler.MESSAGE_ADB_CLEAR);
        mHandler.sendEmptyMessage(AdbDebuggingHandler.MESSAGE_ADB_CLEAR);
    }

    /**
+8 −8
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ import com.android.internal.os.SomeArgs;
import com.android.internal.util.dump.DualDumpOutputStream;
import com.android.server.FgThread;
import com.android.server.LocalServices;
import com.android.server.adb.UsbDebuggingManager;
import com.android.server.adb.AdbDebuggingManager;
import com.android.server.wm.ActivityTaskManagerInternal;

import java.io.File;
@@ -179,7 +179,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
    private final boolean mHasUsbAccessory;
    @GuardedBy("mLock")
    private String[] mAccessoryStrings;
    private UsbDebuggingManager mDebuggingManager;
    private AdbDebuggingManager mDebuggingManager;
    private final UEventObserver mUEventObserver;

    private static Set<Integer> sBlackListedInterfaces;
@@ -288,7 +288,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
        boolean secureAdbEnabled = SystemProperties.getBoolean("ro.adb.secure", false);
        boolean dataEncrypted = "1".equals(SystemProperties.get("vold.decrypt"));
        if (secureAdbEnabled && !dataEncrypted) {
            mDebuggingManager = new UsbDebuggingManager(context);
            mDebuggingManager = new AdbDebuggingManager(context);
        }

        if (halNotPresent) {
@@ -483,7 +483,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
        private int mMidiDevice;

        private final Context mContext;
        private final UsbDebuggingManager mDebuggingManager;
        private final AdbDebuggingManager mDebuggingManager;
        private final UsbAlsaManager mUsbAlsaManager;
        private final UsbSettingsManager mSettingsManager;
        private NotificationManager mNotificationManager;
@@ -507,7 +507,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
        protected static final String USB_PERSISTENT_CONFIG_PROPERTY = "persist.sys.usb.config";

        UsbHandler(Looper looper, Context context, UsbDeviceManager deviceManager,
                UsbDebuggingManager debuggingManager, UsbAlsaManager alsaManager,
                AdbDebuggingManager debuggingManager, UsbAlsaManager alsaManager,
                UsbSettingsManager settingsManager) {
            super(looper);
            mContext = context;
@@ -1363,7 +1363,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
        private boolean mUsbDataUnlocked;

        UsbHandlerLegacy(Looper looper, Context context, UsbDeviceManager deviceManager,
                UsbDebuggingManager debuggingManager, UsbAlsaManager alsaManager,
                AdbDebuggingManager debuggingManager, UsbAlsaManager alsaManager,
                UsbSettingsManager settingsManager) {
            super(looper, context, deviceManager, debuggingManager, alsaManager, settingsManager);
            try {
@@ -1753,7 +1753,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
        protected boolean mCurrentUsbFunctionsRequested;

        UsbHandlerHal(Looper looper, Context context, UsbDeviceManager deviceManager,
                UsbDebuggingManager debuggingManager, UsbAlsaManager alsaManager,
                AdbDebuggingManager debuggingManager, UsbAlsaManager alsaManager,
                UsbSettingsManager settingsManager) {
            super(looper, context, deviceManager, debuggingManager, alsaManager, settingsManager);
            try {
@@ -2079,7 +2079,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
            mDebuggingManager.clearUsbDebuggingKeys();
        } else {
            throw new RuntimeException("Cannot clear Usb Debugging keys, "
                    + "UsbDebuggingManager not enabled");
                    + "AdbDebuggingManager not enabled");
        }
    }