Loading core/java/Android.bp +17 −0 Original line number Diff line number Diff line Loading @@ -285,6 +285,23 @@ aidl_interface { }, } aidl_interface { name: "android.debug_aidl", unstable: true, srcs: [ "android/debug/AdbTransportType.aidl", "android/debug/FingerprintAndPairDevice.aidl", "android/debug/IAdbCallback.aidl", "android/debug/IAdbManager.aidl", "android/debug/PairDevice.aidl", ], backend: { cpp: { enabled: true, }, }, } // Avoid including Parcelable classes as we don't want to have two copies of // Parcelable cross the libraries. This is used by telephony-common (frameworks/opt/telephony) // and TeleService app (packages/services/Telephony). Loading core/java/android/debug/IAdbCallback.aidl 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.debug; import android.debug.AdbTransportType; /** * Callback interface of {@link android.debug.IAdbCallbackManager}. * * @hide */ oneway interface IAdbCallback { /** * On debugging enabled, service providing IAdbManager calls this function. */ void onDebuggingChanged(boolean enabled, AdbTransportType type); } core/java/android/debug/IAdbManager.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.debug; import android.debug.FingerprintAndPairDevice; import android.debug.IAdbCallback; /** * Interface to communicate remotely with the {@code AdbService} in the system server. Loading Loading @@ -111,4 +112,14 @@ interface IAdbManager { * QR code. */ boolean isAdbWifiQrSupported(); /** * Register callback for ADB debugging changed notification. */ void registerCallback(IAdbCallback callback); /** * Unregister callback for ADB debugging changed notification. */ void unregisterCallback(IAdbCallback callback); } services/core/java/com/android/server/adb/AdbService.java +35 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.debug.AdbManager; import android.debug.AdbManagerInternal; import android.debug.AdbTransportType; import android.debug.FingerprintAndPairDevice; import android.debug.IAdbCallback; import android.debug.IAdbManager; import android.debug.IAdbTransport; import android.debug.PairDevice; Loading @@ -36,6 +37,7 @@ import android.net.Uri; import android.os.Binder; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; Loading Loading @@ -88,6 +90,7 @@ public class AdbService extends IAdbManager.Stub { private final AdbConnectionPortListener mPortListener = new AdbConnectionPortListener(); private AdbDebuggingManager.AdbConnectionPortPoller mConnectionPortPoller; private final RemoteCallbackList<IAdbCallback> mCallbacks = new RemoteCallbackList<>(); /** * Manages the service lifecycle for {@code AdbService} in {@code SystemServer}. */ Loading Loading @@ -411,6 +414,21 @@ public class AdbService extends IAdbManager.Stub { return mConnectionPort.get(); } @Override public void registerCallback(IAdbCallback callback) throws RemoteException { if (DEBUG) { Slog.d(TAG, "Registering callback " + callback); } mCallbacks.register(callback); } @Override public void unregisterCallback(IAdbCallback callback) throws RemoteException { if (DEBUG) { Slog.d(TAG, "Unregistering callback " + callback); } mCallbacks.unregister(callback); } /** * This listener is only used when ro.adb.secure=0. Otherwise, AdbDebuggingManager will * do this. Loading Loading @@ -517,6 +535,23 @@ public class AdbService extends IAdbManager.Stub { if (mDebuggingManager != null) { mDebuggingManager.setAdbEnabled(enable, transportType); } if (DEBUG) { Slog.d(TAG, "Broadcasting enable = " + enable + ", type = " + transportType); } mCallbacks.broadcast((callback) -> { if (DEBUG) { Slog.d(TAG, "Sending enable = " + enable + ", type = " + transportType + " to " + callback); } try { callback.onDebuggingChanged(enable, transportType); } catch (RemoteException ex) { if (DEBUG) { Slog.d(TAG, "Unable to send onDebuggingChanged:", ex); } } }); } @Override Loading Loading
core/java/Android.bp +17 −0 Original line number Diff line number Diff line Loading @@ -285,6 +285,23 @@ aidl_interface { }, } aidl_interface { name: "android.debug_aidl", unstable: true, srcs: [ "android/debug/AdbTransportType.aidl", "android/debug/FingerprintAndPairDevice.aidl", "android/debug/IAdbCallback.aidl", "android/debug/IAdbManager.aidl", "android/debug/PairDevice.aidl", ], backend: { cpp: { enabled: true, }, }, } // Avoid including Parcelable classes as we don't want to have two copies of // Parcelable cross the libraries. This is used by telephony-common (frameworks/opt/telephony) // and TeleService app (packages/services/Telephony). Loading
core/java/android/debug/IAdbCallback.aidl 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.debug; import android.debug.AdbTransportType; /** * Callback interface of {@link android.debug.IAdbCallbackManager}. * * @hide */ oneway interface IAdbCallback { /** * On debugging enabled, service providing IAdbManager calls this function. */ void onDebuggingChanged(boolean enabled, AdbTransportType type); }
core/java/android/debug/IAdbManager.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.debug; import android.debug.FingerprintAndPairDevice; import android.debug.IAdbCallback; /** * Interface to communicate remotely with the {@code AdbService} in the system server. Loading Loading @@ -111,4 +112,14 @@ interface IAdbManager { * QR code. */ boolean isAdbWifiQrSupported(); /** * Register callback for ADB debugging changed notification. */ void registerCallback(IAdbCallback callback); /** * Unregister callback for ADB debugging changed notification. */ void unregisterCallback(IAdbCallback callback); }
services/core/java/com/android/server/adb/AdbService.java +35 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.debug.AdbManager; import android.debug.AdbManagerInternal; import android.debug.AdbTransportType; import android.debug.FingerprintAndPairDevice; import android.debug.IAdbCallback; import android.debug.IAdbManager; import android.debug.IAdbTransport; import android.debug.PairDevice; Loading @@ -36,6 +37,7 @@ import android.net.Uri; import android.os.Binder; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; Loading Loading @@ -88,6 +90,7 @@ public class AdbService extends IAdbManager.Stub { private final AdbConnectionPortListener mPortListener = new AdbConnectionPortListener(); private AdbDebuggingManager.AdbConnectionPortPoller mConnectionPortPoller; private final RemoteCallbackList<IAdbCallback> mCallbacks = new RemoteCallbackList<>(); /** * Manages the service lifecycle for {@code AdbService} in {@code SystemServer}. */ Loading Loading @@ -411,6 +414,21 @@ public class AdbService extends IAdbManager.Stub { return mConnectionPort.get(); } @Override public void registerCallback(IAdbCallback callback) throws RemoteException { if (DEBUG) { Slog.d(TAG, "Registering callback " + callback); } mCallbacks.register(callback); } @Override public void unregisterCallback(IAdbCallback callback) throws RemoteException { if (DEBUG) { Slog.d(TAG, "Unregistering callback " + callback); } mCallbacks.unregister(callback); } /** * This listener is only used when ro.adb.secure=0. Otherwise, AdbDebuggingManager will * do this. Loading Loading @@ -517,6 +535,23 @@ public class AdbService extends IAdbManager.Stub { if (mDebuggingManager != null) { mDebuggingManager.setAdbEnabled(enable, transportType); } if (DEBUG) { Slog.d(TAG, "Broadcasting enable = " + enable + ", type = " + transportType); } mCallbacks.broadcast((callback) -> { if (DEBUG) { Slog.d(TAG, "Sending enable = " + enable + ", type = " + transportType + " to " + callback); } try { callback.onDebuggingChanged(enable, transportType); } catch (RemoteException ex) { if (DEBUG) { Slog.d(TAG, "Unable to send onDebuggingChanged:", ex); } } }); } @Override Loading