Merge "Show all system apps to hub teamfood, remove location indicator" into sc-dev
diff --git a/core/java/android/permission/PermissionUsageHelper.java b/core/java/android/permission/PermissionUsageHelper.java
index 4c9e77c..7e3a0f3 100644
--- a/core/java/android/permission/PermissionUsageHelper.java
+++ b/core/java/android/permission/PermissionUsageHelper.java
@@ -111,8 +111,7 @@
private static boolean shouldShowLocationIndicator() {
return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
- PROPERTY_LOCATION_INDICATORS_ENABLED, false)
- || shouldShowPermissionsHub();
+ PROPERTY_LOCATION_INDICATORS_ENABLED, false);
}
private static long getRecentThreshold(Long now) {
@@ -326,10 +325,10 @@
}
if (packageName.equals(SYSTEM_PKG)
- || (!isUserSensitive(packageName, user, op)
+ || (!shouldShowPermissionsHub()
+ && !isUserSensitive(packageName, user, op)
&& !isLocationProvider(packageName, user)
- && !isAppPredictor(packageName, user))
- && !isSpeechRecognizerUsage(op, packageName)) {
+ && !isSpeechRecognizerUsage(op, packageName))) {
continue;
}
diff --git a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
index 2040347..e53f5c9 100644
--- a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
@@ -20,7 +20,6 @@
import static android.hardware.SensorPrivacyManager.Sensors.MICROPHONE;
import static android.media.AudioManager.ACTION_MICROPHONE_MUTE_CHANGED;
-import android.Manifest;
import android.app.AppOpsManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -43,6 +42,7 @@
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.systemui.Dumpable;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.SysUISingleton;
@@ -370,13 +370,9 @@
}
// TODO ntmyren: remove after teamfood is finished
- private boolean shouldShowAppPredictor(String pkgName) {
- if (!DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, "permissions_hub_2_enabled",
- false)) {
- return false;
- }
- return mPackageManager.checkPermission(Manifest.permission.MANAGE_APP_PREDICTIONS, pkgName)
- == PackageManager.PERMISSION_GRANTED;
+ private boolean showSystemApps() {
+ return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
+ SystemUiDeviceConfigFlags.PROPERTY_PERMISSIONS_HUB_ENABLED, false);
}
/**
@@ -399,8 +395,8 @@
return true;
}
// TODO ntmyren: Replace this with more robust check if this moves beyond teamfood
- if ((appOpCode == AppOpsManager.OP_CAMERA && isLocationProvider(packageName))
- || shouldShowAppPredictor(packageName)
+ if (((showSystemApps() && !packageName.equals("android"))
+ || appOpCode == AppOpsManager.OP_CAMERA && isLocationProvider(packageName))
|| isSpeechRecognizerUsage(appOpCode, packageName)) {
return true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogController.kt
index 03c1843..f87ea7c 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogController.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogController.kt
@@ -214,9 +214,7 @@
private fun filterType(type: PrivacyType?): PrivacyType? {
return type?.let {
- if (privacyItemController.allIndicatorsAvailable) {
- it
- } else if ((it == PrivacyType.TYPE_CAMERA || it == PrivacyType.TYPE_MICROPHONE) &&
+ if ((it == PrivacyType.TYPE_CAMERA || it == PrivacyType.TYPE_MICROPHONE) &&
privacyItemController.micCameraAvailable) {
it
} else if (it == PrivacyType.TYPE_LOCATION && privacyItemController.locationAvailable) {
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
index 1e04516..03d6154 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
@@ -68,8 +68,6 @@
addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE)
}
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 LOCATION = SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_ENABLED
private const val DEFAULT_ALL_INDICATORS = false
@@ -83,11 +81,6 @@
@Synchronized get() = field.toList() // Returns a shallow copy of the list
@Synchronized set
- private fun isAllIndicatorsEnabled(): Boolean {
- return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
- ALL_INDICATORS, DEFAULT_ALL_INDICATORS)
- }
-
private fun isMicCameraEnabled(): Boolean {
return deviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
MIC_CAMERA, DEFAULT_MIC_CAMERA)
@@ -120,34 +113,29 @@
uiExecutor.execute(notifyChanges)
}
- var allIndicatorsAvailable = isAllIndicatorsEnabled()
- private set
var micCameraAvailable = isMicCameraEnabled()
private set
var locationAvailable = isLocationEnabled()
+ var allIndicatorsAvailable = micCameraAvailable && locationAvailable
+
private val devicePropertiesChangedListener =
object : DeviceConfig.OnPropertiesChangedListener {
override fun onPropertiesChanged(properties: DeviceConfig.Properties) {
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))) {
// 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)) {
micCameraAvailable = properties.getBoolean(MIC_CAMERA, DEFAULT_MIC_CAMERA)
+ allIndicatorsAvailable = micCameraAvailable && locationAvailable
callbacks.forEach { it.get()?.onFlagMicCameraChanged(micCameraAvailable) }
}
if (properties.keyset.contains(LOCATION)) {
locationAvailable = properties.getBoolean(LOCATION, DEFAULT_LOCATION)
+ allIndicatorsAvailable = micCameraAvailable && locationAvailable
callbacks.forEach { it.get()?.onFlagLocationChanged(locationAvailable) }
}
internalUiExecutor.updateListeningState()
@@ -163,8 +151,7 @@
active: Boolean
) {
// Check if we care about this code right now
- if (!allIndicatorsAvailable &&
- (code in OPS_LOCATION && !locationAvailable)) {
+ if (code in OPS_LOCATION && !locationAvailable) {
return
}
val userId = UserHandle.getUserId(uid)
@@ -231,7 +218,7 @@
*/
private fun setListeningState() {
val listen = !callbacks.isEmpty() and
- (allIndicatorsAvailable || micCameraAvailable || locationAvailable)
+ (micCameraAvailable || locationAvailable)
if (listening == listen) return
listening = listen
if (listening) {
@@ -338,7 +325,7 @@
AppOpsManager.OP_RECORD_AUDIO -> PrivacyType.TYPE_MICROPHONE
else -> return null
}
- if (type == PrivacyType.TYPE_LOCATION && (!allIndicatorsAvailable && !locationAvailable)) {
+ if (type == PrivacyType.TYPE_LOCATION && !locationAvailable) {
return null
}
val app = PrivacyApplication(appOpItem.packageName, appOpItem.uid)
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/television/TvOngoingPrivacyChip.java b/packages/SystemUI/src/com/android/systemui/privacy/television/TvOngoingPrivacyChip.java
index 0fa7b59..5ab7bd8 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/television/TvOngoingPrivacyChip.java
+++ b/packages/SystemUI/src/com/android/systemui/privacy/television/TvOngoingPrivacyChip.java
@@ -88,7 +88,6 @@
private boolean mViewAndWindowAdded;
private ObjectAnimator mAnimator;
- private boolean mAllIndicatorsFlagEnabled;
private boolean mMicCameraIndicatorFlagEnabled;
private boolean mLocationIndicatorEnabled;
private List<PrivacyItem> mPrivacyItems;
@@ -111,12 +110,10 @@
mIconMarginStart = Math.round(res.getDimension(R.dimen.privacy_chip_icon_margin));
mIconSize = res.getDimensionPixelSize(R.dimen.privacy_chip_icon_size);
- mAllIndicatorsFlagEnabled = privacyItemController.getAllIndicatorsAvailable();
mMicCameraIndicatorFlagEnabled = privacyItemController.getMicCameraAvailable();
mLocationIndicatorEnabled = privacyItemController.getLocationAvailable();
if (DEBUG) {
- Log.d(TAG, "allIndicators: " + mAllIndicatorsFlagEnabled);
Log.d(TAG, "micCameraIndicators: " + mMicCameraIndicatorFlagEnabled);
Log.d(TAG, "locationIndicators: " + mLocationIndicatorEnabled);
}
@@ -135,12 +132,6 @@
}
@Override
- public void onFlagAllChanged(boolean flag) {
- if (DEBUG) Log.d(TAG, "all indicators enabled: " + flag);
- mAllIndicatorsFlagEnabled = flag;
- }
-
- @Override
public void onFlagMicCameraChanged(boolean flag) {
if (DEBUG) Log.d(TAG, "mic/camera indicators enabled: " + flag);
mMicCameraIndicatorFlagEnabled = flag;
@@ -155,8 +146,8 @@
private void updateUI() {
if (DEBUG) Log.d(TAG, mPrivacyItems.size() + " privacy items");
- if ((mMicCameraIndicatorFlagEnabled || mAllIndicatorsFlagEnabled
- || mLocationIndicatorEnabled) && !mPrivacyItems.isEmpty()) {
+ if ((mMicCameraIndicatorFlagEnabled || mLocationIndicatorEnabled)
+ && !mPrivacyItems.isEmpty()) {
if (mState == STATE_NOT_SHOWN || mState == STATE_DISAPPEARING) {
showIndicator();
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java
index e3c39aa..eedcdab 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java
@@ -97,7 +97,6 @@
private boolean mListening;
private AlarmClockInfo mNextAlarm;
- private boolean mAllIndicatorsEnabled;
private boolean mMicCameraIndicatorsEnabled;
private boolean mLocationIndicatorsEnabled;
private boolean mPrivacyChipLogged;
@@ -151,14 +150,6 @@
}
@Override
- public void onFlagAllChanged(boolean flag) {
- if (mAllIndicatorsEnabled != flag) {
- mAllIndicatorsEnabled = flag;
- update();
- }
- }
-
- @Override
public void onFlagMicCameraChanged(boolean flag) {
if (mMicCameraIndicatorsEnabled != flag) {
mMicCameraIndicatorsEnabled = flag;
@@ -270,7 +261,6 @@
mRingerContainer.setOnClickListener(mOnClickListener);
mPrivacyChip.setOnClickListener(mOnClickListener);
- mAllIndicatorsEnabled = mPrivacyItemController.getAllIndicatorsAvailable();
mMicCameraIndicatorsEnabled = mPrivacyItemController.getMicCameraAvailable();
mLocationIndicatorsEnabled = mPrivacyItemController.getLocationAvailable();
@@ -321,7 +311,6 @@
mNextAlarmController.addCallback(mNextAlarmChangeCallback);
mLifecycle.setCurrentState(Lifecycle.State.RESUMED);
// Get the most up to date info
- mAllIndicatorsEnabled = mPrivacyItemController.getAllIndicatorsAvailable();
mMicCameraIndicatorsEnabled = mPrivacyItemController.getMicCameraAvailable();
mLocationIndicatorsEnabled = mPrivacyItemController.getLocationAvailable();
mPrivacyItemController.addCallback(mPICCallback);
@@ -353,13 +342,13 @@
private List<String> getIgnoredIconSlots() {
ArrayList<String> ignored = new ArrayList<>();
if (getChipEnabled()) {
- if (mAllIndicatorsEnabled || mMicCameraIndicatorsEnabled) {
+ if (mMicCameraIndicatorsEnabled) {
ignored.add(mView.getResources().getString(
com.android.internal.R.string.status_bar_camera));
ignored.add(mView.getResources().getString(
com.android.internal.R.string.status_bar_microphone));
}
- if (mAllIndicatorsEnabled || mLocationIndicatorsEnabled) {
+ if (mLocationIndicatorsEnabled) {
ignored.add(mView.getResources().getString(
com.android.internal.R.string.status_bar_location));
}
@@ -368,7 +357,7 @@
}
private boolean getChipEnabled() {
- return mMicCameraIndicatorsEnabled || mLocationIndicatorsEnabled || mAllIndicatorsEnabled;
+ return mMicCameraIndicatorsEnabled || mLocationIndicatorsEnabled;
}
private boolean isZenOverridingRinger() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index d537241..f1405de 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -675,8 +675,7 @@
mIconController.setIconVisibility(mSlotCamera, showCamera);
mIconController.setIconVisibility(mSlotMicrophone, showMicrophone);
- if (mPrivacyItemController.getAllIndicatorsAvailable()
- || mPrivacyItemController.getLocationAvailable()) {
+ if (mPrivacyItemController.getLocationAvailable()) {
mIconController.setIconVisibility(mSlotLocation, showLocation);
}
mPrivacyLogger.logStatusBarIconsVisible(showCamera, showMicrophone, showLocation);
@@ -684,8 +683,7 @@
@Override
public void onLocationActiveChanged(boolean active) {
- if (!mPrivacyItemController.getAllIndicatorsAvailable()
- && !mPrivacyItemController.getLocationAvailable()) {
+ if (!mPrivacyItemController.getLocationAvailable()) {
updateLocationFromController();
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogControllerTest.kt
index 072f7b8..791dd12 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogControllerTest.kt
@@ -395,9 +395,8 @@
`when`(permissionManager.indicatorAppOpUsageData).thenReturn(
listOf(usage_camera, usage_location, usage_microphone)
)
- `when`(privacyItemController.micCameraAvailable).thenReturn(false)
- `when`(privacyItemController.locationAvailable).thenReturn(false)
- `when`(privacyItemController.allIndicatorsAvailable).thenReturn(true)
+ `when`(privacyItemController.micCameraAvailable).thenReturn(true)
+ `when`(privacyItemController.locationAvailable).thenReturn(true)
controller.showDialog(context)
exhaustExecutors()
@@ -422,7 +421,6 @@
)
`when`(privacyItemController.micCameraAvailable).thenReturn(false)
`when`(privacyItemController.locationAvailable).thenReturn(false)
- `when`(privacyItemController.allIndicatorsAvailable).thenReturn(false)
controller.showDialog(context)
exhaustExecutors()
@@ -525,7 +523,6 @@
`when`(privacyItemController.locationAvailable).thenReturn(true)
`when`(privacyItemController.micCameraAvailable).thenReturn(true)
- `when`(privacyItemController.allIndicatorsAvailable).thenReturn(false)
`when`(userTracker.userProfiles).thenReturn(listOf(
UserInfo(USER_ID, "", 0),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerFlagsTest.kt b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerFlagsTest.kt
index 132bee0..f991e71 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerFlagsTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerFlagsTest.kt
@@ -37,7 +37,6 @@
import org.mockito.ArgumentCaptor
import org.mockito.Mock
import org.mockito.Mockito
-import org.mockito.Mockito.anyBoolean
import org.mockito.Mockito.atLeastOnce
import org.mockito.Mockito.never
import org.mockito.Mockito.verify
@@ -51,8 +50,6 @@
fun <T> eq(value: T): T = Mockito.eq(value) ?: value
fun <T> any(): T = Mockito.any<T>()
- private const val ALL_INDICATORS =
- SystemUiDeviceConfigFlags.PROPERTY_PERMISSIONS_HUB_ENABLED
private const val MIC_CAMERA = SystemUiDeviceConfigFlags.PROPERTY_MIC_CAMERA_ENABLED
private const val LOCATION = SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_ENABLED
}
@@ -96,11 +93,6 @@
}
@Test
- fun testNotListeningAllByDefault() {
- assertFalse(privacyItemController.allIndicatorsAvailable)
- }
-
- @Test
fun testMicCameraListeningByDefault() {
assertTrue(privacyItemController.micCameraAvailable)
}
@@ -111,10 +103,8 @@
executor.runAllReady()
verify(callback).onFlagMicCameraChanged(false)
- verify(callback, never()).onFlagAllChanged(anyBoolean())
assertFalse(privacyItemController.micCameraAvailable)
- assertFalse(privacyItemController.allIndicatorsAvailable)
}
@Test
@@ -127,26 +117,15 @@
}
@Test
- fun testAllChanged() {
- changeAll(true)
- executor.runAllReady()
-
- verify(callback).onFlagAllChanged(true)
- verify(callback, never()).onFlagMicCameraChanged(anyBoolean())
-
- assertTrue(privacyItemController.allIndicatorsAvailable)
- }
-
- @Test
fun testBothChanged() {
changeAll(true)
changeMicCamera(false)
executor.runAllReady()
- verify(callback, atLeastOnce()).onFlagAllChanged(true)
+ verify(callback, atLeastOnce()).onFlagLocationChanged(true)
verify(callback, atLeastOnce()).onFlagMicCameraChanged(false)
- assertTrue(privacyItemController.allIndicatorsAvailable)
+ assertTrue(privacyItemController.locationAvailable)
assertFalse(privacyItemController.micCameraAvailable)
}
@@ -186,28 +165,6 @@
}
@Test
- fun testSomeListening_stillListening() {
- // Mic and camera are true by default
- changeAll(true)
- executor.runAllReady()
- changeAll(false)
- executor.runAllReady()
-
- verify(appOpsController, never()).removeCallback(any(), any())
- }
-
- @Test
- fun testAllDeleted_micCameraFalse_stopListening() {
- changeMicCamera(false)
- changeAll(true)
- executor.runAllReady()
- changeAll(null)
- executor.runAllReady()
-
- verify(appOpsController).removeCallback(any(), any())
- }
-
- @Test
fun testMicDeleted_stillListening() {
changeMicCamera(true)
executor.runAllReady()
@@ -219,7 +176,10 @@
private fun changeMicCamera(value: Boolean?) = changeProperty(MIC_CAMERA, value)
private fun changeLocation(value: Boolean?) = changeProperty(LOCATION, value)
- private fun changeAll(value: Boolean?) = changeProperty(ALL_INDICATORS, value)
+ private fun changeAll(value: Boolean?) {
+ changeMicCamera(value)
+ changeLocation(value)
+ }
private fun changeProperty(name: String, value: Boolean?) {
deviceConfigProxy.setProperty(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt
index 7ca468e..b87c7a6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt
@@ -43,7 +43,6 @@
import org.junit.Assert.assertThat
import org.junit.Assert.assertTrue
import org.junit.Before
-import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentCaptor
@@ -72,8 +71,8 @@
val TEST_UID = CURRENT_USER_ID * UserHandle.PER_USER_RANGE
const val TEST_PACKAGE_NAME = "test"
- private const val ALL_INDICATORS =
- SystemUiDeviceConfigFlags.PROPERTY_PERMISSIONS_HUB_ENABLED
+ private const val LOCATION_INDICATOR =
+ SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_ENABLED
private const val MIC_CAMERA = SystemUiDeviceConfigFlags.PROPERTY_MIC_CAMERA_ENABLED
fun <T> capture(argumentCaptor: ArgumentCaptor<T>): T = argumentCaptor.capture()
fun <T> eq(value: T): T = Mockito.eq(value) ?: value
@@ -119,7 +118,8 @@
deviceConfigProxy = DeviceConfigProxyFake()
// Listen to everything by default
- changeAll(true)
+ changeMicCamera(true)
+ changeLocation(true)
`when`(userTracker.userProfiles).thenReturn(listOf(UserInfo(CURRENT_USER_ID, "", 0)))
@@ -259,9 +259,8 @@
}
@Test
- @Ignore // TODO(b/168209929)
fun testNotListeningWhenIndicatorsDisabled() {
- changeAll(false)
+ changeLocation(false)
changeMicCamera(false)
privacyItemController.addCallback(callback)
executor.runAllReady()
@@ -271,7 +270,7 @@
@Test
fun testNotSendingLocationWhenOnlyMicCamera() {
- changeAll(false)
+ changeLocation(false)
changeMicCamera(true)
executor.runAllReady()
@@ -294,7 +293,7 @@
.`when`(appOpsController).getActiveAppOpsForUser(anyInt())
privacyItemController.addCallback(callback)
- changeAll(false)
+ changeLocation(false)
changeMicCamera(true)
executor.runAllReady()
reset(callback) // Clean callback
@@ -521,7 +520,7 @@
}
private fun changeMicCamera(value: Boolean?) = changeProperty(MIC_CAMERA, value)
- private fun changeAll(value: Boolean?) = changeProperty(ALL_INDICATORS, value)
+ private fun changeLocation(value: Boolean?) = changeProperty(LOCATION_INDICATOR, value)
private fun changeProperty(name: String, value: Boolean?) {
deviceConfigProxy.setProperty(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QuickStatusBarHeaderControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/QuickStatusBarHeaderControllerTest.kt
index 97a8459..4948c2b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QuickStatusBarHeaderControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QuickStatusBarHeaderControllerTest.kt
@@ -148,7 +148,7 @@
@Test
fun testIgnoredSlotsOnAttached_noIndicators() {
- setPrivacyController(false, false, false)
+ setPrivacyController(micCamera = false, location = false)
controller.init()
@@ -160,7 +160,7 @@
@Test
fun testIgnoredSlotsOnAttached_onlyMicCamera() {
- setPrivacyController(false, true, false)
+ setPrivacyController(micCamera = true, location = false)
controller.init()
@@ -177,7 +177,7 @@
@Test
fun testIgnoredSlotsOnAttached_onlyLocation() {
- setPrivacyController(false, false, true)
+ setPrivacyController(micCamera = false, location = true)
controller.init()
@@ -192,26 +192,7 @@
@Test
fun testIgnoredSlotsOnAttached_locationMicCamera() {
- setPrivacyController(false, true, true)
-
- controller.init()
-
- val captor = argumentCaptor<List<String>>()
- verify(iconContainer).setIgnoredSlots(capture(captor))
-
- val cameraString = mContext.resources.getString(
- com.android.internal.R.string.status_bar_camera)
- val micString = mContext.resources.getString(
- com.android.internal.R.string.status_bar_microphone)
- val locationString = mContext.resources.getString(
- com.android.internal.R.string.status_bar_location)
-
- assertThat(captor.value).containsExactly(cameraString, micString, locationString)
- }
-
- @Test
- fun testIgnoredSlotsOnAttached_all() {
- setPrivacyController(true, false, false)
+ setPrivacyController(micCamera = true, location = true)
controller.init()
@@ -248,8 +229,7 @@
`when`(view.findViewById<Clock>(R.id.clock)).thenReturn(clock)
}
- private fun setPrivacyController(all: Boolean, micCamera: Boolean, location: Boolean) {
- `when`(privacyItemController.allIndicatorsAvailable).thenReturn(all)
+ private fun setPrivacyController(micCamera: Boolean, location: Boolean) {
`when`(privacyItemController.micCameraAvailable).thenReturn(micCamera)
`when`(privacyItemController.locationAvailable).thenReturn(location)
}