mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-14 18:34:30 -05:00
39a015c55a
Signed-off-by: Tavi <tavi@divested.dev>
62 lines
2.8 KiB
Diff
62 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Guojing Yuan <guojing@google.com>
|
|
Date: Thu, 14 Dec 2023 19:30:04 +0000
|
|
Subject: [PATCH] Check permissions for CDM shell commands
|
|
|
|
Override handleShellCommand instead of onShellCommand because
|
|
Binder.onShellCommand checks the necessary permissions of the caller.
|
|
|
|
Bug: 313428840
|
|
|
|
Test: manually tested CDM shell commands
|
|
(cherry picked from commit 1761a0fee9c2cd9787bbb7fbdbe30b4c2b03396e)
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8d008c61451dba86aa9f14c6bcd661db2cea4856)
|
|
Merged-In: I5539b3594feb5544c458c0fd1061b51a0a808900
|
|
Change-Id: I5539b3594feb5544c458c0fd1061b51a0a808900
|
|
---
|
|
.../companion/CompanionDeviceManagerService.java | 14 ++++++++------
|
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
|
|
index 91c2abc02430..275f31f1b6eb 100644
|
|
--- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
|
|
+++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
|
|
@@ -28,6 +28,7 @@ import static com.android.internal.util.function.pooled.PooledLambda.obtainRunna
|
|
import static java.util.concurrent.TimeUnit.MINUTES;
|
|
|
|
import android.annotation.CheckResult;
|
|
+import android.annotation.NonNull;
|
|
import android.annotation.Nullable;
|
|
import android.app.AppOpsManager;
|
|
import android.app.PendingIntent;
|
|
@@ -52,11 +53,10 @@ import android.os.IBinder;
|
|
import android.os.IDeviceIdleController;
|
|
import android.os.IInterface;
|
|
import android.os.Parcel;
|
|
+import android.os.ParcelFileDescriptor;
|
|
import android.os.Process;
|
|
import android.os.RemoteException;
|
|
-import android.os.ResultReceiver;
|
|
import android.os.ServiceManager;
|
|
-import android.os.ShellCallback;
|
|
import android.os.ShellCommand;
|
|
import android.os.UserHandle;
|
|
import android.os.UserManagerInternal;
|
|
@@ -455,10 +455,12 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
|
|
}
|
|
|
|
@Override
|
|
- public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
|
|
- String[] args, ShellCallback callback, ResultReceiver resultReceiver)
|
|
- throws RemoteException {
|
|
- new ShellCmd().exec(this, in, out, err, args, callback, resultReceiver);
|
|
+ public int handleShellCommand(@NonNull ParcelFileDescriptor in,
|
|
+ @NonNull ParcelFileDescriptor out, @NonNull ParcelFileDescriptor err,
|
|
+ @NonNull String[] args) {
|
|
+ return new ShellCmd()
|
|
+ .exec(this, in.getFileDescriptor(), out.getFileDescriptor(),
|
|
+ err.getFileDescriptor(), args);
|
|
}
|
|
}
|
|
|