Loading packages/SystemUI/src/com/android/systemui/privacy/AppOpsPrivacyItemMonitor.kt +16 −4 Original line number Diff line number Diff line Loading @@ -137,6 +137,18 @@ constructor( code in USER_INDEPENDENT_OPS ) { logger.logUpdatedItemFromAppOps(code, uid, packageName, active) val procInfo = (activityManager.runningAppProcesses ?: emptyList()).find { it.uid == uid } val importance = procInfo?.importance ?: -1 // Use -1 if process not found logger.logLocationAppOps( uid, packageName, importance, !isBackgroundApp(uid) ) dispatchOnPrivacyItemsChanged() } } Loading Loading @@ -255,7 +267,7 @@ constructor( .filter { item -> item.code == AppOpsManager.OP_FINE_LOCATION } .distinct() val locationOpBySystem = locationOp.any { item -> isSystemApp(item) } val locationOpByBackground = locationOp.any { item -> isBackgroundApp(item) } val locationOpByBackground = locationOp.any { item -> isBackgroundApp(item.uid) } synchronized(lock) { lastLocationIndicator = items.any { it.privacyType == PrivacyType.TYPE_LOCATION } lastLocationIndicatorWithSystem = lastLocationIndicator || locationOpBySystem Loading Loading @@ -378,7 +390,7 @@ constructor( if (item.code == AppOpsManager.OP_FINE_LOCATION) { val isSystem = isSystemApp(item) val isBackground = isBackgroundApp(item) val isBackground = isBackgroundApp(item.uid) if (isSystem) { synchronized(lock) { hasSystemLocationAccess = true } } Loading Loading @@ -444,9 +456,9 @@ constructor( * <p>TODO(b/422799135): refactor isSystemApp() and isBackgroundApp(). Before this is fixed, * make sure to update PermissionUsageHelper when changing this method. */ private fun isBackgroundApp(item: AppOpItem): Boolean { private fun isBackgroundApp(uid: Int): Boolean { for (processInfo in activityManager.runningAppProcesses) { if (processInfo.uid == item.uid) { if (processInfo.uid == uid) { return (processInfo.importance > ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE) } Loading packages/SystemUI/src/com/android/systemui/privacy/logging/PrivacyLogger.kt +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.privacy.logging import android.app.ActivityManager import android.content.Context import android.icu.text.SimpleDateFormat import android.permission.PermissionGroupUsage import com.android.systemui.log.LogBuffer Loading Loading @@ -45,6 +47,19 @@ class PrivacyLogger @Inject constructor( }) } fun logLocationAppOps(uid: Int, packageName: String, importance: Int, isForeground: Boolean) { log( LogLevel.INFO, { int1 = uid int2 = importance str1 = packageName bool1 = isForeground }, { "Location Op: $str1($int1) importance=$int2 isFg=$bool1" }) } fun logUpdatedItemFromMediaProjection(uid: Int, packageName: String, active: Boolean) { log(LogLevel.INFO, { int1 = uid Loading Loading
packages/SystemUI/src/com/android/systemui/privacy/AppOpsPrivacyItemMonitor.kt +16 −4 Original line number Diff line number Diff line Loading @@ -137,6 +137,18 @@ constructor( code in USER_INDEPENDENT_OPS ) { logger.logUpdatedItemFromAppOps(code, uid, packageName, active) val procInfo = (activityManager.runningAppProcesses ?: emptyList()).find { it.uid == uid } val importance = procInfo?.importance ?: -1 // Use -1 if process not found logger.logLocationAppOps( uid, packageName, importance, !isBackgroundApp(uid) ) dispatchOnPrivacyItemsChanged() } } Loading Loading @@ -255,7 +267,7 @@ constructor( .filter { item -> item.code == AppOpsManager.OP_FINE_LOCATION } .distinct() val locationOpBySystem = locationOp.any { item -> isSystemApp(item) } val locationOpByBackground = locationOp.any { item -> isBackgroundApp(item) } val locationOpByBackground = locationOp.any { item -> isBackgroundApp(item.uid) } synchronized(lock) { lastLocationIndicator = items.any { it.privacyType == PrivacyType.TYPE_LOCATION } lastLocationIndicatorWithSystem = lastLocationIndicator || locationOpBySystem Loading Loading @@ -378,7 +390,7 @@ constructor( if (item.code == AppOpsManager.OP_FINE_LOCATION) { val isSystem = isSystemApp(item) val isBackground = isBackgroundApp(item) val isBackground = isBackgroundApp(item.uid) if (isSystem) { synchronized(lock) { hasSystemLocationAccess = true } } Loading Loading @@ -444,9 +456,9 @@ constructor( * <p>TODO(b/422799135): refactor isSystemApp() and isBackgroundApp(). Before this is fixed, * make sure to update PermissionUsageHelper when changing this method. */ private fun isBackgroundApp(item: AppOpItem): Boolean { private fun isBackgroundApp(uid: Int): Boolean { for (processInfo in activityManager.runningAppProcesses) { if (processInfo.uid == item.uid) { if (processInfo.uid == uid) { return (processInfo.importance > ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE) } Loading
packages/SystemUI/src/com/android/systemui/privacy/logging/PrivacyLogger.kt +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.privacy.logging import android.app.ActivityManager import android.content.Context import android.icu.text.SimpleDateFormat import android.permission.PermissionGroupUsage import com.android.systemui.log.LogBuffer Loading Loading @@ -45,6 +47,19 @@ class PrivacyLogger @Inject constructor( }) } fun logLocationAppOps(uid: Int, packageName: String, importance: Int, isForeground: Boolean) { log( LogLevel.INFO, { int1 = uid int2 = importance str1 = packageName bool1 = isForeground }, { "Location Op: $str1($int1) importance=$int2 isFg=$bool1" }) } fun logUpdatedItemFromMediaProjection(uid: Int, packageName: String, active: Boolean) { log(LogLevel.INFO, { int1 = uid Loading