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

Commit cd4c26b1 authored by Kurt Dresner's avatar Kurt Dresner
Browse files

Check that the calling package is legitimate for both enabling and disabling car mode.

Bug:194402848
Change-Id: Ifb4b68db91bfd53c5b0ba26c17dc8f97a2365267
parent c16349a6
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -631,6 +631,8 @@ final class UiModeManagerService extends SystemService {
                        + "permission ENTER_CAR_MODE_PRIORITIZED");
            }

            assertLegit(callingPackage);

            final long ident = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
@@ -671,6 +673,9 @@ final class UiModeManagerService extends SystemService {
            // mode flag to be specified; this is so that the user can disable car mode at all
            // priorities using the persistent notification.
            boolean isSystemCaller = mInjector.getCallingUid() == Process.SYSTEM_UID;
            if (!isSystemCaller) {
                assertLegit(callingPackage);
            }
            final int carModeFlags =
                    isSystemCaller ? flags : flags & ~UiModeManager.DISABLE_CAR_MODE_ALL_PRIORITIES;