From b19cc07516a9f136e990019093b43d7fc9d2bdf1 Mon Sep 17 00:00:00 2001 From: eunjeongshin Date: Mon, 7 Feb 2022 19:55:27 +0000 Subject: [PATCH] Short term fix: Allow native processes for Logcat data access We allow native processes as a short term solution. Bug: 218293986 Test: CtsVerifier Ignore-AOSP-First: pending fix for logcat privacy issue Change-Id: Ib73305700349f98035a689ffcb4b1fa9e8728eb3 --- .../com/android/server/logcat/LogcatManagerService.java | 8 +++++--- 1 file 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 140c6d48b57b7..78322967ec15d 100644 --- a/services/core/java/com/android/server/logcat/LogcatManagerService.java +++ b/services/core/java/com/android/server/logcat/LogcatManagerService.java @@ -59,7 +59,7 @@ public final class LogcatManagerService extends SystemService { private ActivityManagerInternal mActivityManagerInternal; private static final int MAX_UID_IMPORTANCE_COUNT_LISTENER = 2; private static int sUidImportanceListenerCount = 0; - private static final int AID_SHELL_UID = 2000; + private static final int AID_APP_UID = 10000; // TODO This allowlist is just a temporary workaround for the tests: // FrameworksServicesTests @@ -339,8 +339,10 @@ public final class LogcatManagerService extends SystemService { return; } - // If the access request is coming from adb shell, approve the logd access - if (mUid == AID_SHELL_UID) { + // If the access request is coming from native apps, approve the logd access + // TODO: This is needed to make tooling to work. However, + // we intend to be stricter with respect to native processes in a follow-up CL + if (mUid < AID_APP_UID) { try { getLogdService().approve(mUid, mGid, mPid, mFd); } catch (RemoteException e) {