Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6448d247 authored by Wenhao Wang's avatar Wenhao Wang
Browse files

LogcatManagerService: Allow instrumentation tests

This CL exempts the instrumentation tests from per-use user consent
check.

Bug: 193708292
Bug: 217482811
Bug: 217495147
Test: atest PlatformRuleTests -- --abi x86_64
Test: atest FrameworksServicesTests -- --abi x86_64
Ignore-AOSP-First: pending fix for logcat privacy issue
Change-Id: I223ffd913918103c6d86e84f79a27bc7cda16dc0
parent 38e0ef45
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -329,6 +329,20 @@ public final class LogcatManagerService extends SystemService {

            if (mStart) {

                ActivityManagerInternal ami = LocalServices.getService(
                        ActivityManagerInternal.class);
                boolean isCallerInstrumented = ami.isUidCurrentlyInstrumented(mUid);

                // The instrumented apks only run for testing, so we don't check user permission.
                if (isCallerInstrumented) {
                    try {
                        getLogdService().approve(mUid, mGid, mPid, mFd);
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    }
                    return;
                }

                // TODO Temporarily approve all the requests to unblock testing failures.
                try {
                    getLogdService().approve(mUid, mGid, mPid, mFd);