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

Commit 50e7f488 authored by Atneya Nair's avatar Atneya Nair
Browse files

[appops] Default MODE_FOREGROUND ops for listener

The current appop mode change listeners for foreground changes only
consider uid/packages who have a mode explicitly set to MODE_FOREGROUND.
While this assumption was valid in the past, we now have appops with
default modes set to MODE_FOREGROUND, and these ops need to be
considered within the set of ops whose state can be changed

Test: CtsMediaAudioPermissionTestCases
Bug: 376481063
Flag: EXEMPT bugfix
Change-Id: I197f224286815a35bf041fd39bf8cb12dbde6381
parent a484d236
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -119,6 +119,10 @@ class AppOpService(private val service: AccessCheckingService) : AppOpsCheckingS
        val permissions = service.getState { with(permissionPolicy) { getPermissions() } }

        for (appOpCode in 0 until AppOpsManager._NUM_OP) {
            // Ops that default to MODE_FOREGROUND are foregroundable.
            if (AppOpsManager.opToDefaultMode(appOpCode) == AppOpsManager.MODE_FOREGROUND) {
                foregroundableOps[appOpCode] = true
            }
            AppOpsManager.opToPermission(appOpCode)?.let { permissionName ->
                // Multiple ops might map to a single permission but only one is considered the
                // runtime appop calculations.