Revert "Update show system experiment behavior."
This reverts commit 321b621ee0e48efd6edff25b361aa7118a90e770.
Reason for revert: Experiment is completed and we do not want to leave the code in place as we would not want to accidentally run it on the public.
Change-Id: I24769b669a38ffafeb10e927e2785caa369faa90
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 48fa06a..5bd77ab 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -7229,13 +7229,6 @@
*/
public static final String LOCATION_SHOW_SYSTEM_OPS = "locationShowSystemOps";
-
- /**
- * Whether or not an indicator experiment has started.
- * @hide
- */
- public static final String LOCATION_INDICATOR_EXPERIMENT_STARTED =
- "locationIndicatorExperimentStarted";
/**
* A flag containing settings used for biometric weak
* @hide
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
index 3e50acb..f52c6ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
@@ -86,7 +86,6 @@
private boolean mShouldDisplayAllAccesses;
private boolean mShowSystemAccessesFlag;
private boolean mShowSystemAccessesSetting;
- private boolean mExperimentStarted;
@Inject
public LocationControllerImpl(Context context, AppOpsController appOpsController,
@@ -108,9 +107,6 @@
mShouldDisplayAllAccesses = getAllAccessesSetting();
mShowSystemAccessesFlag = getShowSystemFlag();
mShowSystemAccessesSetting = getShowSystemSetting();
- mExperimentStarted = getExperimentStarted();
- toggleSystemSettingIfExperimentJustStarted();
-
mContentObserver = new ContentObserver(mBackgroundHandler) {
@Override
public void onChange(boolean selfChange) {
@@ -127,15 +123,8 @@
DeviceConfig.NAMESPACE_PRIVACY,
backgroundHandler::post,
properties -> {
- // Update the Device Config flag which controls the experiment to display
- // location accesses.
mShouldDisplayAllAccesses = getAllAccessesSetting();
- // Update the Device Config flag which controls the experiment to display
- // system location accesses.
- mShowSystemAccessesFlag = getShowSystemFlag();
- // Update the local flag for the system accesses experiment and potentially
- // update the behavior based on the flag value.
- toggleSystemSettingIfExperimentJustStarted();
+ mShowSystemAccessesFlag = getShowSystemSetting();
updateActiveLocationRequests();
});
@@ -233,33 +222,6 @@
return mSecureSettings.getInt(Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
}
- private boolean getExperimentStarted() {
- return mSecureSettings
- .getInt(Settings.Secure.LOCATION_INDICATOR_EXPERIMENT_STARTED, 0) == 1;
- }
-
- private void toggleSystemSettingIfExperimentJustStarted() {
- // mShowSystemAccessesFlag indicates whether the Device Config flag is flipped
- // by an experiment. mExperimentStarted is the local device value which indicates the last
- // value the device has seen for the Device Config flag.
- // The local device value is needed to determine that the Device Config flag was just
- // flipped, as the experiment behavior should only happen once after the experiment is
- // enabled.
- if (mShowSystemAccessesFlag && !mExperimentStarted) {
- // If the Device Config flag is enabled, but the local device setting is not then the
- // experiment just started. Update the local flag to match and enable the experiment
- // behavior by flipping the show system setting value.
- mSecureSettings.putInt(Settings.Secure.LOCATION_INDICATOR_EXPERIMENT_STARTED, 1);
- mSecureSettings.putInt(Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 1);
- mExperimentStarted = true;
- } else if (!mShowSystemAccessesFlag && mExperimentStarted) {
- // If the Device Config flag is disabled, but the local device flag is enabled then
- // update the local device flag to match.
- mSecureSettings.putInt(Settings.Secure.LOCATION_INDICATOR_EXPERIMENT_STARTED, 0);
- mExperimentStarted = false;
- }
- }
-
/**
* Returns true if there currently exist active high power location requests.
*/
@@ -287,6 +249,7 @@
}
boolean hadActiveLocationRequests = mAreActiveLocationRequests;
boolean shouldDisplay = false;
+ boolean showSystem = mShowSystemAccessesFlag || mShowSystemAccessesSetting;
boolean systemAppOp = false;
boolean nonSystemAppOp = false;
boolean isSystemApp;
@@ -304,7 +267,7 @@
nonSystemAppOp = true;
}
- shouldDisplay = mShowSystemAccessesSetting || shouldDisplay || !isSystemApp;
+ shouldDisplay = showSystem || shouldDisplay || !isSystemApp;
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java
index 14e0878..9c7dc6b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java
@@ -365,46 +365,4 @@
// No new callbacks
verify(callback).onLocationSettingsChanged(anyBoolean());
}
-
- @Test
- public void testExperimentFlipsSystemFlag() throws Exception {
- mSecureSettings.putInt(Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0);
- mDeviceConfigProxy.setProperty(
- DeviceConfig.NAMESPACE_PRIVACY,
- SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_SMALL_ENABLED,
- "true",
- true);
- // Show system experiment not running
- mDeviceConfigProxy.setProperty(
- DeviceConfig.NAMESPACE_PRIVACY,
- SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_SHOW_SYSTEM,
- "false",
- false);
- mTestableLooper.processAllMessages();
-
- // Flip experiment on
- mDeviceConfigProxy.setProperty(
- DeviceConfig.NAMESPACE_PRIVACY,
- SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_SHOW_SYSTEM,
- "true",
- true);
- mTestableLooper.processAllMessages();
-
- // Verify settings were flipped
- assertThat(mSecureSettings.getInt(Settings.Secure.LOCATION_SHOW_SYSTEM_OPS))
- .isEqualTo(1);
- assertThat(mSecureSettings.getInt(Settings.Secure.LOCATION_INDICATOR_EXPERIMENT_STARTED))
- .isEqualTo(1);
-
- // Flip experiment off
- mDeviceConfigProxy.setProperty(
- DeviceConfig.NAMESPACE_PRIVACY,
- SystemUiDeviceConfigFlags.PROPERTY_LOCATION_INDICATORS_SHOW_SYSTEM,
- "false",
- false);
- mTestableLooper.processAllMessages();
-
- assertThat(mSecureSettings.getInt(Settings.Secure.LOCATION_INDICATOR_EXPERIMENT_STARTED))
- .isEqualTo(0);
- }
}
\ No newline at end of file