Loading core/java/android/permission/PermissionUsageHelper.java +4 −5 Original line number Original line Diff line number Diff line Loading @@ -111,8 +111,7 @@ public class PermissionUsageHelper { private static boolean shouldShowLocationIndicator() { private static boolean shouldShowLocationIndicator() { return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, PROPERTY_LOCATION_INDICATORS_ENABLED, false) PROPERTY_LOCATION_INDICATORS_ENABLED, false); || shouldShowPermissionsHub(); } } private static long getRecentThreshold(Long now) { private static long getRecentThreshold(Long now) { Loading Loading @@ -326,10 +325,10 @@ public class PermissionUsageHelper { } } if (packageName.equals(SYSTEM_PKG) if (packageName.equals(SYSTEM_PKG) || (!isUserSensitive(packageName, user, op) || (!shouldShowPermissionsHub() && !isUserSensitive(packageName, user, op) && !isLocationProvider(packageName, user) && !isLocationProvider(packageName, user) && !isAppPredictor(packageName, user)) && !isSpeechRecognizerUsage(op, packageName))) { && !isSpeechRecognizerUsage(op, packageName)) { continue; continue; } } Loading packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java +6 −10 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.hardware.SensorPrivacyManager.Sensors.CAMERA; import static android.hardware.SensorPrivacyManager.Sensors.MICROPHONE; import static android.hardware.SensorPrivacyManager.Sensors.MICROPHONE; import static android.media.AudioManager.ACTION_MICROPHONE_MUTE_CHANGED; import static android.media.AudioManager.ACTION_MICROPHONE_MUTE_CHANGED; import android.Manifest; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; Loading @@ -43,6 +42,7 @@ import androidx.annotation.WorkerThread; import com.android.internal.R; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.systemui.Dumpable; import com.android.systemui.Dumpable; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton; Loading Loading @@ -370,13 +370,9 @@ public class AppOpsControllerImpl extends BroadcastReceiver implements AppOpsCon } } // TODO ntmyren: remove after teamfood is finished // TODO ntmyren: remove after teamfood is finished private boolean shouldShowAppPredictor(String pkgName) { private boolean showSystemApps() { if (!DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, "permissions_hub_2_enabled", return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, false)) { SystemUiDeviceConfigFlags.PROPERTY_PERMISSIONS_HUB_ENABLED, false); return false; } return mPackageManager.checkPermission(Manifest.permission.MANAGE_APP_PREDICTIONS, pkgName) == PackageManager.PERMISSION_GRANTED; } } /** /** Loading @@ -399,8 +395,8 @@ public class AppOpsControllerImpl extends BroadcastReceiver implements AppOpsCon return true; return true; } } // TODO ntmyren: Replace this with more robust check if this moves beyond teamfood // TODO ntmyren: Replace this with more robust check if this moves beyond teamfood if ((appOpCode == AppOpsManager.OP_CAMERA && isLocationProvider(packageName)) if (((showSystemApps() && !packageName.equals("android")) || shouldShowAppPredictor(packageName) || appOpCode == AppOpsManager.OP_CAMERA && isLocationProvider(packageName)) || isSpeechRecognizerUsage(appOpCode, packageName)) { || isSpeechRecognizerUsage(appOpCode, packageName)) { return true; return true; } } Loading packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogController.kt +1 −3 Original line number Original line Diff line number Diff line Loading @@ -214,9 +214,7 @@ class PrivacyDialogController( private fun filterType(type: PrivacyType?): PrivacyType? { private fun filterType(type: PrivacyType?): PrivacyType? { return type?.let { return type?.let { if (privacyItemController.allIndicatorsAvailable) { if ((it == PrivacyType.TYPE_CAMERA || it == PrivacyType.TYPE_MICROPHONE) && it } else if ((it == PrivacyType.TYPE_CAMERA || it == PrivacyType.TYPE_MICROPHONE) && privacyItemController.micCameraAvailable) { privacyItemController.micCameraAvailable) { it it } else if (it == PrivacyType.TYPE_LOCATION && privacyItemController.locationAvailable) { } else if (it == PrivacyType.TYPE_LOCATION && privacyItemController.locationAvailable) { Loading packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt +8 −21 Original line number Original line Diff line number Diff line Loading @@ -68,8 +68,6 @@ class PrivacyItemController @Inject constructor( addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE) addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE) } } const val TAG = "PrivacyItemController" const val TAG = "PrivacyItemController" private const val ALL_INDICATORS = SystemUiDeviceConfigFlags.PROPERTY_PERMISSIONS_HUB_ENABLED private const val MIC_CAMERA = SystemUiDeviceConfigFlags.PROPERTY_MIC_CAMERA_ENABLED private const val MIC_CAMERA = SystemUiDeviceConfigFlags.PROPERTY_MIC_CAMERA_ENABLED private const val LOCATION = SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_ENABLED private const val LOCATION = SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_ENABLED private const val DEFAULT_ALL_INDICATORS = false private const val DEFAULT_ALL_INDICATORS = false Loading @@ -83,11 +81,6 @@ class PrivacyItemController @Inject constructor( @Synchronized get() = field.toList() // Returns a shallow copy of the list @Synchronized get() = field.toList() // Returns a shallow copy of the list @Synchronized set @Synchronized set private fun isAllIndicatorsEnabled(): Boolean { return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, ALL_INDICATORS, DEFAULT_ALL_INDICATORS) } private fun isMicCameraEnabled(): Boolean { private fun isMicCameraEnabled(): Boolean { return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, MIC_CAMERA, DEFAULT_MIC_CAMERA) MIC_CAMERA, DEFAULT_MIC_CAMERA) Loading Loading @@ -120,34 +113,29 @@ class PrivacyItemController @Inject constructor( uiExecutor.execute(notifyChanges) uiExecutor.execute(notifyChanges) } } var allIndicatorsAvailable = isAllIndicatorsEnabled() private set var micCameraAvailable = isMicCameraEnabled() var micCameraAvailable = isMicCameraEnabled() private set private set var locationAvailable = isLocationEnabled() var locationAvailable = isLocationEnabled() var allIndicatorsAvailable = micCameraAvailable && locationAvailable private val devicePropertiesChangedListener = private val devicePropertiesChangedListener = object : DeviceConfig.OnPropertiesChangedListener { object : DeviceConfig.OnPropertiesChangedListener { override fun onPropertiesChanged(properties: DeviceConfig.Properties) { override fun onPropertiesChanged(properties: DeviceConfig.Properties) { if (DeviceConfig.NAMESPACE_PRIVACY.equals(properties.getNamespace()) && if (DeviceConfig.NAMESPACE_PRIVACY.equals(properties.getNamespace()) && (properties.keyset.contains(ALL_INDICATORS) || (properties.keyset.contains(MIC_CAMERA) || properties.keyset.contains(MIC_CAMERA) || properties.keyset.contains(LOCATION))) { properties.keyset.contains(LOCATION))) { // Running on the ui executor so can iterate on callbacks // Running on the ui executor so can iterate on callbacks if (properties.keyset.contains(ALL_INDICATORS)) { allIndicatorsAvailable = properties.getBoolean(ALL_INDICATORS, DEFAULT_ALL_INDICATORS) callbacks.forEach { it.get()?.onFlagAllChanged(allIndicatorsAvailable) } } if (properties.keyset.contains(MIC_CAMERA)) { if (properties.keyset.contains(MIC_CAMERA)) { micCameraAvailable = properties.getBoolean(MIC_CAMERA, DEFAULT_MIC_CAMERA) micCameraAvailable = properties.getBoolean(MIC_CAMERA, DEFAULT_MIC_CAMERA) allIndicatorsAvailable = micCameraAvailable && locationAvailable callbacks.forEach { it.get()?.onFlagMicCameraChanged(micCameraAvailable) } callbacks.forEach { it.get()?.onFlagMicCameraChanged(micCameraAvailable) } } } if (properties.keyset.contains(LOCATION)) { if (properties.keyset.contains(LOCATION)) { locationAvailable = properties.getBoolean(LOCATION, DEFAULT_LOCATION) locationAvailable = properties.getBoolean(LOCATION, DEFAULT_LOCATION) allIndicatorsAvailable = micCameraAvailable && locationAvailable callbacks.forEach { it.get()?.onFlagLocationChanged(locationAvailable) } callbacks.forEach { it.get()?.onFlagLocationChanged(locationAvailable) } } } internalUiExecutor.updateListeningState() internalUiExecutor.updateListeningState() Loading @@ -163,8 +151,7 @@ class PrivacyItemController @Inject constructor( active: Boolean active: Boolean ) { ) { // Check if we care about this code right now // Check if we care about this code right now if (!allIndicatorsAvailable && if (code in OPS_LOCATION && !locationAvailable) { (code in OPS_LOCATION && !locationAvailable)) { return return } } val userId = UserHandle.getUserId(uid) val userId = UserHandle.getUserId(uid) Loading Loading @@ -231,7 +218,7 @@ class PrivacyItemController @Inject constructor( */ */ private fun setListeningState() { private fun setListeningState() { val listen = !callbacks.isEmpty() and val listen = !callbacks.isEmpty() and (allIndicatorsAvailable || micCameraAvailable || locationAvailable) (micCameraAvailable || locationAvailable) if (listening == listen) return if (listening == listen) return listening = listen listening = listen if (listening) { if (listening) { Loading Loading @@ -338,7 +325,7 @@ class PrivacyItemController @Inject constructor( AppOpsManager.OP_RECORD_AUDIO -> PrivacyType.TYPE_MICROPHONE AppOpsManager.OP_RECORD_AUDIO -> PrivacyType.TYPE_MICROPHONE else -> return null else -> return null } } if (type == PrivacyType.TYPE_LOCATION && (!allIndicatorsAvailable && !locationAvailable)) { if (type == PrivacyType.TYPE_LOCATION && !locationAvailable) { return null return null } } val app = PrivacyApplication(appOpItem.packageName, appOpItem.uid) val app = PrivacyApplication(appOpItem.packageName, appOpItem.uid) Loading packages/SystemUI/src/com/android/systemui/privacy/television/TvOngoingPrivacyChip.java +2 −11 Original line number Original line Diff line number Diff line Loading @@ -88,7 +88,6 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl private boolean mViewAndWindowAdded; private boolean mViewAndWindowAdded; private ObjectAnimator mAnimator; private ObjectAnimator mAnimator; private boolean mAllIndicatorsFlagEnabled; private boolean mMicCameraIndicatorFlagEnabled; private boolean mMicCameraIndicatorFlagEnabled; private boolean mLocationIndicatorEnabled; private boolean mLocationIndicatorEnabled; private List<PrivacyItem> mPrivacyItems; private List<PrivacyItem> mPrivacyItems; Loading @@ -111,12 +110,10 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl mIconMarginStart = Math.round(res.getDimension(R.dimen.privacy_chip_icon_margin)); mIconMarginStart = Math.round(res.getDimension(R.dimen.privacy_chip_icon_margin)); mIconSize = res.getDimensionPixelSize(R.dimen.privacy_chip_icon_size); mIconSize = res.getDimensionPixelSize(R.dimen.privacy_chip_icon_size); mAllIndicatorsFlagEnabled = privacyItemController.getAllIndicatorsAvailable(); mMicCameraIndicatorFlagEnabled = privacyItemController.getMicCameraAvailable(); mMicCameraIndicatorFlagEnabled = privacyItemController.getMicCameraAvailable(); mLocationIndicatorEnabled = privacyItemController.getLocationAvailable(); mLocationIndicatorEnabled = privacyItemController.getLocationAvailable(); if (DEBUG) { if (DEBUG) { Log.d(TAG, "allIndicators: " + mAllIndicatorsFlagEnabled); Log.d(TAG, "micCameraIndicators: " + mMicCameraIndicatorFlagEnabled); Log.d(TAG, "micCameraIndicators: " + mMicCameraIndicatorFlagEnabled); Log.d(TAG, "locationIndicators: " + mLocationIndicatorEnabled); Log.d(TAG, "locationIndicators: " + mLocationIndicatorEnabled); } } Loading @@ -134,12 +131,6 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl updateUI(); updateUI(); } } @Override public void onFlagAllChanged(boolean flag) { if (DEBUG) Log.d(TAG, "all indicators enabled: " + flag); mAllIndicatorsFlagEnabled = flag; } @Override @Override public void onFlagMicCameraChanged(boolean flag) { public void onFlagMicCameraChanged(boolean flag) { if (DEBUG) Log.d(TAG, "mic/camera indicators enabled: " + flag); if (DEBUG) Log.d(TAG, "mic/camera indicators enabled: " + flag); Loading @@ -155,8 +146,8 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl private void updateUI() { private void updateUI() { if (DEBUG) Log.d(TAG, mPrivacyItems.size() + " privacy items"); if (DEBUG) Log.d(TAG, mPrivacyItems.size() + " privacy items"); if ((mMicCameraIndicatorFlagEnabled || mAllIndicatorsFlagEnabled if ((mMicCameraIndicatorFlagEnabled || mLocationIndicatorEnabled) || mLocationIndicatorEnabled) && !mPrivacyItems.isEmpty()) { && !mPrivacyItems.isEmpty()) { if (mState == STATE_NOT_SHOWN || mState == STATE_DISAPPEARING) { if (mState == STATE_NOT_SHOWN || mState == STATE_DISAPPEARING) { showIndicator(); showIndicator(); } else { } else { Loading Loading
core/java/android/permission/PermissionUsageHelper.java +4 −5 Original line number Original line Diff line number Diff line Loading @@ -111,8 +111,7 @@ public class PermissionUsageHelper { private static boolean shouldShowLocationIndicator() { private static boolean shouldShowLocationIndicator() { return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, PROPERTY_LOCATION_INDICATORS_ENABLED, false) PROPERTY_LOCATION_INDICATORS_ENABLED, false); || shouldShowPermissionsHub(); } } private static long getRecentThreshold(Long now) { private static long getRecentThreshold(Long now) { Loading Loading @@ -326,10 +325,10 @@ public class PermissionUsageHelper { } } if (packageName.equals(SYSTEM_PKG) if (packageName.equals(SYSTEM_PKG) || (!isUserSensitive(packageName, user, op) || (!shouldShowPermissionsHub() && !isUserSensitive(packageName, user, op) && !isLocationProvider(packageName, user) && !isLocationProvider(packageName, user) && !isAppPredictor(packageName, user)) && !isSpeechRecognizerUsage(op, packageName))) { && !isSpeechRecognizerUsage(op, packageName)) { continue; continue; } } Loading
packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java +6 −10 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.hardware.SensorPrivacyManager.Sensors.CAMERA; import static android.hardware.SensorPrivacyManager.Sensors.MICROPHONE; import static android.hardware.SensorPrivacyManager.Sensors.MICROPHONE; import static android.media.AudioManager.ACTION_MICROPHONE_MUTE_CHANGED; import static android.media.AudioManager.ACTION_MICROPHONE_MUTE_CHANGED; import android.Manifest; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; Loading @@ -43,6 +42,7 @@ import androidx.annotation.WorkerThread; import com.android.internal.R; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.systemui.Dumpable; import com.android.systemui.Dumpable; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton; Loading Loading @@ -370,13 +370,9 @@ public class AppOpsControllerImpl extends BroadcastReceiver implements AppOpsCon } } // TODO ntmyren: remove after teamfood is finished // TODO ntmyren: remove after teamfood is finished private boolean shouldShowAppPredictor(String pkgName) { private boolean showSystemApps() { if (!DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, "permissions_hub_2_enabled", return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, false)) { SystemUiDeviceConfigFlags.PROPERTY_PERMISSIONS_HUB_ENABLED, false); return false; } return mPackageManager.checkPermission(Manifest.permission.MANAGE_APP_PREDICTIONS, pkgName) == PackageManager.PERMISSION_GRANTED; } } /** /** Loading @@ -399,8 +395,8 @@ public class AppOpsControllerImpl extends BroadcastReceiver implements AppOpsCon return true; return true; } } // TODO ntmyren: Replace this with more robust check if this moves beyond teamfood // TODO ntmyren: Replace this with more robust check if this moves beyond teamfood if ((appOpCode == AppOpsManager.OP_CAMERA && isLocationProvider(packageName)) if (((showSystemApps() && !packageName.equals("android")) || shouldShowAppPredictor(packageName) || appOpCode == AppOpsManager.OP_CAMERA && isLocationProvider(packageName)) || isSpeechRecognizerUsage(appOpCode, packageName)) { || isSpeechRecognizerUsage(appOpCode, packageName)) { return true; return true; } } Loading
packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogController.kt +1 −3 Original line number Original line Diff line number Diff line Loading @@ -214,9 +214,7 @@ class PrivacyDialogController( private fun filterType(type: PrivacyType?): PrivacyType? { private fun filterType(type: PrivacyType?): PrivacyType? { return type?.let { return type?.let { if (privacyItemController.allIndicatorsAvailable) { if ((it == PrivacyType.TYPE_CAMERA || it == PrivacyType.TYPE_MICROPHONE) && it } else if ((it == PrivacyType.TYPE_CAMERA || it == PrivacyType.TYPE_MICROPHONE) && privacyItemController.micCameraAvailable) { privacyItemController.micCameraAvailable) { it it } else if (it == PrivacyType.TYPE_LOCATION && privacyItemController.locationAvailable) { } else if (it == PrivacyType.TYPE_LOCATION && privacyItemController.locationAvailable) { Loading
packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt +8 −21 Original line number Original line Diff line number Diff line Loading @@ -68,8 +68,6 @@ class PrivacyItemController @Inject constructor( addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE) addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE) } } const val TAG = "PrivacyItemController" const val TAG = "PrivacyItemController" private const val ALL_INDICATORS = SystemUiDeviceConfigFlags.PROPERTY_PERMISSIONS_HUB_ENABLED private const val MIC_CAMERA = SystemUiDeviceConfigFlags.PROPERTY_MIC_CAMERA_ENABLED private const val MIC_CAMERA = SystemUiDeviceConfigFlags.PROPERTY_MIC_CAMERA_ENABLED private const val LOCATION = SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_ENABLED private const val LOCATION = SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_ENABLED private const val DEFAULT_ALL_INDICATORS = false private const val DEFAULT_ALL_INDICATORS = false Loading @@ -83,11 +81,6 @@ class PrivacyItemController @Inject constructor( @Synchronized get() = field.toList() // Returns a shallow copy of the list @Synchronized get() = field.toList() // Returns a shallow copy of the list @Synchronized set @Synchronized set private fun isAllIndicatorsEnabled(): Boolean { return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, ALL_INDICATORS, DEFAULT_ALL_INDICATORS) } private fun isMicCameraEnabled(): Boolean { private fun isMicCameraEnabled(): Boolean { return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, MIC_CAMERA, DEFAULT_MIC_CAMERA) MIC_CAMERA, DEFAULT_MIC_CAMERA) Loading Loading @@ -120,34 +113,29 @@ class PrivacyItemController @Inject constructor( uiExecutor.execute(notifyChanges) uiExecutor.execute(notifyChanges) } } var allIndicatorsAvailable = isAllIndicatorsEnabled() private set var micCameraAvailable = isMicCameraEnabled() var micCameraAvailable = isMicCameraEnabled() private set private set var locationAvailable = isLocationEnabled() var locationAvailable = isLocationEnabled() var allIndicatorsAvailable = micCameraAvailable && locationAvailable private val devicePropertiesChangedListener = private val devicePropertiesChangedListener = object : DeviceConfig.OnPropertiesChangedListener { object : DeviceConfig.OnPropertiesChangedListener { override fun onPropertiesChanged(properties: DeviceConfig.Properties) { override fun onPropertiesChanged(properties: DeviceConfig.Properties) { if (DeviceConfig.NAMESPACE_PRIVACY.equals(properties.getNamespace()) && if (DeviceConfig.NAMESPACE_PRIVACY.equals(properties.getNamespace()) && (properties.keyset.contains(ALL_INDICATORS) || (properties.keyset.contains(MIC_CAMERA) || properties.keyset.contains(MIC_CAMERA) || properties.keyset.contains(LOCATION))) { properties.keyset.contains(LOCATION))) { // Running on the ui executor so can iterate on callbacks // Running on the ui executor so can iterate on callbacks if (properties.keyset.contains(ALL_INDICATORS)) { allIndicatorsAvailable = properties.getBoolean(ALL_INDICATORS, DEFAULT_ALL_INDICATORS) callbacks.forEach { it.get()?.onFlagAllChanged(allIndicatorsAvailable) } } if (properties.keyset.contains(MIC_CAMERA)) { if (properties.keyset.contains(MIC_CAMERA)) { micCameraAvailable = properties.getBoolean(MIC_CAMERA, DEFAULT_MIC_CAMERA) micCameraAvailable = properties.getBoolean(MIC_CAMERA, DEFAULT_MIC_CAMERA) allIndicatorsAvailable = micCameraAvailable && locationAvailable callbacks.forEach { it.get()?.onFlagMicCameraChanged(micCameraAvailable) } callbacks.forEach { it.get()?.onFlagMicCameraChanged(micCameraAvailable) } } } if (properties.keyset.contains(LOCATION)) { if (properties.keyset.contains(LOCATION)) { locationAvailable = properties.getBoolean(LOCATION, DEFAULT_LOCATION) locationAvailable = properties.getBoolean(LOCATION, DEFAULT_LOCATION) allIndicatorsAvailable = micCameraAvailable && locationAvailable callbacks.forEach { it.get()?.onFlagLocationChanged(locationAvailable) } callbacks.forEach { it.get()?.onFlagLocationChanged(locationAvailable) } } } internalUiExecutor.updateListeningState() internalUiExecutor.updateListeningState() Loading @@ -163,8 +151,7 @@ class PrivacyItemController @Inject constructor( active: Boolean active: Boolean ) { ) { // Check if we care about this code right now // Check if we care about this code right now if (!allIndicatorsAvailable && if (code in OPS_LOCATION && !locationAvailable) { (code in OPS_LOCATION && !locationAvailable)) { return return } } val userId = UserHandle.getUserId(uid) val userId = UserHandle.getUserId(uid) Loading Loading @@ -231,7 +218,7 @@ class PrivacyItemController @Inject constructor( */ */ private fun setListeningState() { private fun setListeningState() { val listen = !callbacks.isEmpty() and val listen = !callbacks.isEmpty() and (allIndicatorsAvailable || micCameraAvailable || locationAvailable) (micCameraAvailable || locationAvailable) if (listening == listen) return if (listening == listen) return listening = listen listening = listen if (listening) { if (listening) { Loading Loading @@ -338,7 +325,7 @@ class PrivacyItemController @Inject constructor( AppOpsManager.OP_RECORD_AUDIO -> PrivacyType.TYPE_MICROPHONE AppOpsManager.OP_RECORD_AUDIO -> PrivacyType.TYPE_MICROPHONE else -> return null else -> return null } } if (type == PrivacyType.TYPE_LOCATION && (!allIndicatorsAvailable && !locationAvailable)) { if (type == PrivacyType.TYPE_LOCATION && !locationAvailable) { return null return null } } val app = PrivacyApplication(appOpItem.packageName, appOpItem.uid) val app = PrivacyApplication(appOpItem.packageName, appOpItem.uid) Loading
packages/SystemUI/src/com/android/systemui/privacy/television/TvOngoingPrivacyChip.java +2 −11 Original line number Original line Diff line number Diff line Loading @@ -88,7 +88,6 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl private boolean mViewAndWindowAdded; private boolean mViewAndWindowAdded; private ObjectAnimator mAnimator; private ObjectAnimator mAnimator; private boolean mAllIndicatorsFlagEnabled; private boolean mMicCameraIndicatorFlagEnabled; private boolean mMicCameraIndicatorFlagEnabled; private boolean mLocationIndicatorEnabled; private boolean mLocationIndicatorEnabled; private List<PrivacyItem> mPrivacyItems; private List<PrivacyItem> mPrivacyItems; Loading @@ -111,12 +110,10 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl mIconMarginStart = Math.round(res.getDimension(R.dimen.privacy_chip_icon_margin)); mIconMarginStart = Math.round(res.getDimension(R.dimen.privacy_chip_icon_margin)); mIconSize = res.getDimensionPixelSize(R.dimen.privacy_chip_icon_size); mIconSize = res.getDimensionPixelSize(R.dimen.privacy_chip_icon_size); mAllIndicatorsFlagEnabled = privacyItemController.getAllIndicatorsAvailable(); mMicCameraIndicatorFlagEnabled = privacyItemController.getMicCameraAvailable(); mMicCameraIndicatorFlagEnabled = privacyItemController.getMicCameraAvailable(); mLocationIndicatorEnabled = privacyItemController.getLocationAvailable(); mLocationIndicatorEnabled = privacyItemController.getLocationAvailable(); if (DEBUG) { if (DEBUG) { Log.d(TAG, "allIndicators: " + mAllIndicatorsFlagEnabled); Log.d(TAG, "micCameraIndicators: " + mMicCameraIndicatorFlagEnabled); Log.d(TAG, "micCameraIndicators: " + mMicCameraIndicatorFlagEnabled); Log.d(TAG, "locationIndicators: " + mLocationIndicatorEnabled); Log.d(TAG, "locationIndicators: " + mLocationIndicatorEnabled); } } Loading @@ -134,12 +131,6 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl updateUI(); updateUI(); } } @Override public void onFlagAllChanged(boolean flag) { if (DEBUG) Log.d(TAG, "all indicators enabled: " + flag); mAllIndicatorsFlagEnabled = flag; } @Override @Override public void onFlagMicCameraChanged(boolean flag) { public void onFlagMicCameraChanged(boolean flag) { if (DEBUG) Log.d(TAG, "mic/camera indicators enabled: " + flag); if (DEBUG) Log.d(TAG, "mic/camera indicators enabled: " + flag); Loading @@ -155,8 +146,8 @@ public class TvOngoingPrivacyChip extends SystemUI implements PrivacyItemControl private void updateUI() { private void updateUI() { if (DEBUG) Log.d(TAG, mPrivacyItems.size() + " privacy items"); if (DEBUG) Log.d(TAG, mPrivacyItems.size() + " privacy items"); if ((mMicCameraIndicatorFlagEnabled || mAllIndicatorsFlagEnabled if ((mMicCameraIndicatorFlagEnabled || mLocationIndicatorEnabled) || mLocationIndicatorEnabled) && !mPrivacyItems.isEmpty()) { && !mPrivacyItems.isEmpty()) { if (mState == STATE_NOT_SHOWN || mState == STATE_DISAPPEARING) { if (mState == STATE_NOT_SHOWN || mState == STATE_DISAPPEARING) { showIndicator(); showIndicator(); } else { } else { Loading