Merge "Rename Enhanced MAC Randomization to Non-Persistent"
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 104e1c2..7325358 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -279,9 +279,9 @@
android:summary="@string/wifi_scan_throttling_summary" />
<SwitchPreference
- android:key="wifi_enhanced_mac_randomization"
- android:title="@string/wifi_enhanced_mac_randomization"
- android:summary="@string/wifi_enhanced_mac_randomization_summary" />
+ android:key="wifi_non_persistent_mac_randomization"
+ android:title="@string/wifi_non_persistent_mac_randomization"
+ android:summary="@string/wifi_non_persistent_mac_randomization_summary" />
<SwitchPreference
android:key="mobile_data_always_on"
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 94b67aa..c02ae42 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -505,7 +505,7 @@
controllers.add(new WifiDisplayCertificationPreferenceController(context));
controllers.add(new WifiVerboseLoggingPreferenceController(context));
controllers.add(new WifiScanThrottlingPreferenceController(context));
- controllers.add(new WifiEnhancedMacRandomizationPreferenceController(context));
+ controllers.add(new WifiNonPersistentMacRandomizationPreferenceController(context));
controllers.add(new MobileDataAlwaysOnPreferenceController(context));
controllers.add(new TetheringHardwareAccelPreferenceController(context));
controllers.add(new BluetoothDeviceNoNamePreferenceController(context));
diff --git a/src/com/android/settings/development/WifiEnhancedMacRandomizationPreferenceController.java b/src/com/android/settings/development/WifiNonPersistentMacRandomizationPreferenceController.java
similarity index 71%
rename from src/com/android/settings/development/WifiEnhancedMacRandomizationPreferenceController.java
rename to src/com/android/settings/development/WifiNonPersistentMacRandomizationPreferenceController.java
index af44f5b..3f6d775 100644
--- a/src/com/android/settings/development/WifiEnhancedMacRandomizationPreferenceController.java
+++ b/src/com/android/settings/development/WifiNonPersistentMacRandomizationPreferenceController.java
@@ -26,30 +26,30 @@
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
/**
- * Developer option controller for enhanced MAC randomization.
+ * Developer option controller for non-persistent MAC randomization.
*/
-public class WifiEnhancedMacRandomizationPreferenceController
+public class WifiNonPersistentMacRandomizationPreferenceController
extends DeveloperOptionsPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
- private static final String WIFI_ENHANCED_MAC_RANDOMIZATION_KEY =
- "wifi_enhanced_mac_randomization";
- private static final String ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG =
- "enhanced_mac_randomization_force_enabled";
+ private static final String WIFI_NON_PERSISTENT_MAC_RANDOMIZATION_KEY =
+ "wifi_non_persistent_mac_randomization";
+ private static final String NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG =
+ "non_persistent_mac_randomization_force_enabled";
- public WifiEnhancedMacRandomizationPreferenceController(Context context) {
+ public WifiNonPersistentMacRandomizationPreferenceController(Context context) {
super(context);
}
@Override
public String getPreferenceKey() {
- return WIFI_ENHANCED_MAC_RANDOMIZATION_KEY;
+ return WIFI_NON_PERSISTENT_MAC_RANDOMIZATION_KEY;
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int isEnabledInt = ((Boolean) newValue) ? 1 : 0;
Settings.Global.putInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, isEnabledInt);
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, isEnabledInt);
return true;
}
@@ -57,7 +57,7 @@
public void updateState(Preference preference) {
boolean enabled = false;
if (Settings.Global.getInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0) == 1) {
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0) == 1) {
enabled = true;
}
((SwitchPreference) mPreference).setChecked(enabled);
@@ -67,7 +67,7 @@
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
Settings.Global.putInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
((SwitchPreference) mPreference).setChecked(false);
}
}
diff --git a/tests/robotests/src/com/android/settings/development/WifiEnhancedMacRandomizationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiNonPersistentMacRandomizationPreferenceControllerTest.java
similarity index 76%
rename from tests/robotests/src/com/android/settings/development/WifiEnhancedMacRandomizationPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/development/WifiNonPersistentMacRandomizationPreferenceControllerTest.java
index 25e5a22..b654387 100644
--- a/tests/robotests/src/com/android/settings/development/WifiEnhancedMacRandomizationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WifiNonPersistentMacRandomizationPreferenceControllerTest.java
@@ -36,48 +36,48 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
-public class WifiEnhancedMacRandomizationPreferenceControllerTest {
- private static final String ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG =
- "enhanced_mac_randomization_force_enabled";
+public class WifiNonPersistentMacRandomizationPreferenceControllerTest {
+ private static final String NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG =
+ "non_persistent_mac_randomization_force_enabled";
@Mock
private SwitchPreference mPreference;
@Mock
private PreferenceScreen mPreferenceScreen;
private Context mContext;
- private WifiEnhancedMacRandomizationPreferenceController mController;
+ private WifiNonPersistentMacRandomizationPreferenceController mController;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mController = new WifiEnhancedMacRandomizationPreferenceController(mContext);
+ mController = new WifiNonPersistentMacRandomizationPreferenceController(mContext);
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
.thenReturn(mPreference);
mController.displayPreference(mPreferenceScreen);
}
@Test
- public void onPreferenceChanged_enabled_shouldTurnOnEnhancedRandomization() {
+ public void onPreferenceChanged_enabled_shouldTurnOnNonPersistentRandomization() {
mController.onPreferenceChange(mPreference, true /* new value */);
int mode = Settings.Global.getInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
assertThat(mode).isEqualTo(1);
}
@Test
- public void onPreferenceChanged_disabled_shouldTurnOffEnhancedRandomization() {
+ public void onPreferenceChanged_disabled_shouldTurnOffNonPersistentRandomization() {
mController.onPreferenceChange(mPreference, false /* new value */);
int mode = Settings.Global.getInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
assertThat(mode).isEqualTo(0);
}
@Test
public void updateState_preferenceShouldBeChecked() {
Settings.Global.putInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 1);
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 1);
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
@@ -86,7 +86,7 @@
@Test
public void updateState_preferenceShouldNotBeChecked() {
Settings.Global.putInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
mController.updateState(mPreference);
verify(mPreference).setChecked(false);
@@ -97,7 +97,7 @@
mController.onDeveloperOptionsSwitchDisabled();
int mode = Settings.Global.getInt(mContext.getContentResolver(),
- ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
+ NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
assertThat(mode).isEqualTo(0);
assertThat(mPreference.isChecked()).isFalse();