diff options
| author | 2022-03-31 17:49:30 +0000 | |
|---|---|---|
| committer | 2022-03-31 18:26:38 +0000 | |
| commit | 62785504f6c1944bfa88bc114c7e5d54d7207d93 (patch) | |
| tree | 811c13d3da89a8f8533c35a825c620418af8407e | |
| parent | 5af77f167236708e82792269b339b87e69cad382 (diff) | |
Update LogcatManagerService to call getUidProcessState to retrieve
process state
Bug fix to retrieve process state by calling getUidProcessState() rather
than calling getUidImportance()
This codebase is the continuity of the implementation ag/16618162 to
obtain user consent.
Bug: 193708292
Test: CtsVerifier
Ignore-AOSP-First: pending fix for logcat privacy issue
Change-Id: I55afc2a11744eeb5da83222b953b539c1bc60b05
| -rw-r--r-- | services/core/java/com/android/server/logcat/LogcatManagerService.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/logcat/LogcatManagerService.java b/services/core/java/com/android/server/logcat/LogcatManagerService.java index 7b63fa24088b..0aa384cedbf1 100644 --- a/services/core/java/com/android/server/logcat/LogcatManagerService.java +++ b/services/core/java/com/android/server/logcat/LogcatManagerService.java @@ -23,7 +23,6 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.os.Binder; import android.os.ILogd; import android.os.RemoteException; import android.os.ServiceManager; @@ -76,6 +75,7 @@ public final class LogcatManagerService extends SystemService { @Override public void approve(int uid, int gid, int pid, int fd) { try { + Slog.d(TAG, "Allow logd access for uid: " + uid); getLogdService().approve(uid, gid, pid, fd); } catch (RemoteException e) { Slog.e(TAG, "Fails to call remote functions", e); @@ -85,6 +85,7 @@ public final class LogcatManagerService extends SystemService { @Override public void decline(int uid, int gid, int pid, int fd) { try { + Slog.d(TAG, "Decline logd access for uid: " + uid); getLogdService().decline(uid, gid, pid, fd); } catch (RemoteException e) { Slog.e(TAG, "Fails to call remote functions", e); @@ -194,8 +195,9 @@ public final class LogcatManagerService extends SystemService { return; } - final int procState = mActivityManager.getUidImportance(Binder.getCallingUid()); - // If the process is foreground, send a notification for user consent + final int procState = LocalServices.getService(ActivityManagerInternal.class) + .getUidProcessState(mUid); + // If the process is foreground, show a dialog for user consent if (procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE) { showDialog(mUid, mGid, mPid, mFd); } else { |