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

Commit 33504d7d authored by Kenny Root's avatar Kenny Root
Browse files

Register USB as an ADB transport type

This doesn't do anything yet, but is needed to migrate functionality
from the USB service to the ADB service.

Bug: 63820489
Test: make
Change-Id: I402bb234a055cf0b199e0922bf92736aa659d46a
parent 61fd360f
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.debug.AdbManagerInternal;
import android.debug.IAdbTransport;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbConfiguration;
import android.hardware.usb.UsbConstants;
@@ -800,6 +802,14 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
            setEnabledFunctions(mScreenUnlockedFunctions, false);
        }

        private static class AdbTransport extends IAdbTransport.Stub {
            private final UsbHandler mHandler;

            AdbTransport(UsbHandler handler) {
                mHandler = handler;
            }
        }

        /**
         * Returns the functions that are passed down to the low level driver once adb and
         * charging are accounted for.
@@ -965,6 +975,9 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
                    mNotificationManager = (NotificationManager)
                            mContext.getSystemService(Context.NOTIFICATION_SERVICE);

                    LocalServices.getService(
                            AdbManagerInternal.class).registerTransport(new AdbTransport(this));

                    // Ensure that the notification channels are set up
                    if (isTv()) {
                        // TV-specific notification channel