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

Commit 58d966ae authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure user is unlocked when auto revoking" into rvc-dev

parents 7dc8ceb0 8cbc5044
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -292,7 +292,12 @@ private suspend fun revokePermissionsOnUnusedApps(
            .getInitializedValue(staleOk = true).keys

    val revokedApps = mutableListOf<Pair<String, UserHandle>>()
    val userManager = context.getSystemService(UserManager::class.java)
    for ((user, userApps) in unusedApps) {
        if (userManager == null || !userManager.isUserUnlocked(user)) {
            DumpableLog.w(LOG_TAG, "Skipping $user - locked direct boot state")
            continue
        }
        userApps.forEachInParallel(Main) { pkg: LightPackageInfo ->
            if (pkg.grantedPermissions.isEmpty()) {
                return@forEachInParallel