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

Commit 75188808 authored by Andrei Onea's avatar Andrei Onea
Browse files

Don't check for changeid permissions in system server

Remove compat checks for LOG_COMPAT_CHANGE, READ_COMPAT_CHANGE_CONFIG
and OVERRIDE_COMPAT_CHANGE_CONFIG in PlatformCompat when the caller
is the system server itself.

Bug: 150674197
Test: boots without spammy messages
Change-Id: I16f9d5286eff950f68cf5b2c1101ccb987fc7afe
parent a027373f
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.Manifest.permission.LOG_COMPAT_CHANGE;
import static android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG;
import static android.Manifest.permission.READ_COMPAT_CHANGE_CONFIG;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.os.Process.SYSTEM_UID;

import android.annotation.UserIdInt;
import android.app.ActivityManager;
@@ -298,6 +299,10 @@ public class PlatformCompat extends IPlatformCompat.Stub {
    }

    private void checkCompatChangeLogPermission() throws SecurityException {
        // Don't check for permissions within the system process
        if (Binder.getCallingUid() == SYSTEM_UID) {
            return;
        }
        if (mContext.checkCallingOrSelfPermission(LOG_COMPAT_CHANGE)
                != PERMISSION_GRANTED) {
            throw new SecurityException("Cannot log compat change usage");
@@ -305,6 +310,10 @@ public class PlatformCompat extends IPlatformCompat.Stub {
    }

    private void checkCompatChangeReadPermission() throws SecurityException {
        // Don't check for permissions within the system process
        if (Binder.getCallingUid() == SYSTEM_UID) {
            return;
        }
        if (mContext.checkCallingOrSelfPermission(READ_COMPAT_CHANGE_CONFIG)
                != PERMISSION_GRANTED) {
            throw new SecurityException("Cannot read compat change");
@@ -312,6 +321,10 @@ public class PlatformCompat extends IPlatformCompat.Stub {
    }

    private void checkCompatChangeOverridePermission() throws SecurityException {
        // Don't check for permissions within the system process
        if (Binder.getCallingUid() == SYSTEM_UID) {
            return;
        }
        if (mContext.checkCallingOrSelfPermission(OVERRIDE_COMPAT_CHANGE_CONFIG)
                != PERMISSION_GRANTED) {
            throw new SecurityException("Cannot override compat change");