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

Commit a14eb4c7 authored by Chaohui Wang's avatar Chaohui Wang
Browse files

UserHandle.getAppId() before check if system uid

Bug: 340413642
Flag: EXEMPT bug fix
Test: manual - special app access
Change-Id: If48fdc68ad92f2df0c30308b827e40ea8583ff7f
parent 93b1dadb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settingslib.spaprivileged.template.app
import android.content.Context
import android.content.pm.ApplicationInfo
import android.os.Process
import android.os.UserHandle
import androidx.compose.runtime.Composable
import com.android.settingslib.spa.framework.common.SettingsEntryBuilder
import com.android.settingslib.spa.framework.common.SettingsPageProvider
@@ -88,7 +89,8 @@ interface TogglePermissionAppListModel<T : AppRecord> {
 *
 * If true, the app gets all permissions, so the permission toggle always not changeable.
 */
fun AppRecord.isSystemOrRootUid(): Boolean = app.uid in listOf(Process.SYSTEM_UID, Process.ROOT_UID)
fun AppRecord.isSystemOrRootUid(): Boolean =
    UserHandle.getAppId(app.uid) in listOf(Process.SYSTEM_UID, Process.ROOT_UID)

/**
 * Gets whether the permission on / off is changeable for the given app.