diff options
author | William Escande <wescande@google.com> | 2022-02-23 15:35:33 +0100 |
---|---|---|
committer | William Escande <wescande@google.com> | 2022-02-23 16:29:48 +0100 |
commit | 1893a9c7da5b51704e9e79e6c89cb486fe9d877e (patch) | |
tree | 305c1cde8767f6792559b5e9a54555176db0678c /service/java/com/android/server/bluetooth/BluetoothManagerService.java | |
parent | daa7c0ef033c2cb11a96996fa150feb79157bf8b (diff) |
Add BluetoothShellCommand
This is deprecating the svc command for mainline
Fix: 216233593
Tag: #refactor
Test: manual: adb shell cmd bluetooth_manager enable
Test: manual: adb shell cmd bluetooth_manager disable
Merged-In: I19f71fbf689d8551b20359f577fbffd999806273
Change-Id: I19f71fbf689d8551b20359f577fbffd999806273
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r-- | service/java/com/android/server/bluetooth/BluetoothManagerService.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java index a103e49e29..d6052aae95 100644 --- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java +++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java @@ -69,6 +69,7 @@ import android.os.HandlerThread; import android.os.IBinder; import android.os.Looper; import android.os.Message; +import android.os.ParcelFileDescriptor; import android.os.PowerExemptionManager; import android.os.Process; import android.os.RemoteCallbackList; @@ -1029,7 +1030,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { // Check if packageName belongs to callingUid final int callingUid = Binder.getCallingUid(); final boolean isCallerSystem = UserHandle.getAppId(callingUid) == Process.SYSTEM_UID; - if (!isCallerSystem) { + if (!isCallerSystem && callingUid != Process.SHELL_UID) { checkPackage(callingUid, attributionSource.getPackageName()); if (requireForeground && !checkIfCallerIsForegroundUser()) { @@ -3053,6 +3054,14 @@ class BluetoothManagerService extends IBluetoothManager.Stub { attributionSource, message); } + @Override + public int handleShellCommand(@NonNull ParcelFileDescriptor in, + @NonNull ParcelFileDescriptor out, @NonNull ParcelFileDescriptor err, + @NonNull String[] args) { + return new BluetoothShellCommand(this, mContext).exec(this, in.getFileDescriptor(), + out.getFileDescriptor(), err.getFileDescriptor(), args); + } + static @NonNull Bundle getTempAllowlistBroadcastOptions() { final long duration = 10_000; final BroadcastOptions bOptions = BroadcastOptions.makeBasic(); |