Change privacy setting string

Change privacy setting (mac randomized) string

Test: manual and robotests
Change-Id: I264c89e0b8ccaeff0a057ff7d791d006a5e7d7cd
This commit is contained in:
cosmohsieh
2018-12-19 16:25:02 +08:00
parent 8bc04efd1a
commit a83b304670
4 changed files with 18 additions and 9 deletions

View File

@@ -1105,8 +1105,8 @@
</string-array> </string-array>
<string-array name="wifi_privacy_entries"> <string-array name="wifi_privacy_entries">
<item>Default (use randomized MAC)</item> <item>Use device MAC</item>
<item>Trusted</item> <item>Use randomized MAC (default)</item>
</string-array> </string-array>
<string-array name="wifi_hidden_entries"> <string-array name="wifi_hidden_entries">

View File

@@ -10338,9 +10338,9 @@
<string name="see_less">See less</string> <string name="see_less">See less</string>
<!-- Title for Network connection request Dialog [CHAR LIMIT=30] --> <!-- Title for Network connection request Dialog [CHAR LIMIT=30] -->
<string name="network_connection_request_dialog_title">Choose device</string> <string name="network_connection_request_dialog_title">Choose a device</string>
<!-- Message for Network connection timeout Dialog [CHAR LIMIT=NONE] --> <!-- Message for Network connection timeout Dialog [CHAR LIMIT=NONE] -->
<string name="network_connection_timeout_dialog_message">No devices found. Make sure the device is turned on and available to connect.</string> <string name="network_connection_timeout_dialog_message">No devices found. Make sure devices are turned on and available to connect.</string>
<!-- OK button for Network connection timeout Dialog [CHAR LIMIT=30] --> <!-- OK button for Network connection timeout Dialog [CHAR LIMIT=30] -->
<string name="network_connection_timeout_dialog_ok">Try again</string> <string name="network_connection_timeout_dialog_ok">Try again</string>
<!-- Message for Network connection error state Dialog [CHAR LIMIT=NONE] --> <!-- Message for Network connection error state Dialog [CHAR LIMIT=NONE] -->

View File

@@ -16,6 +16,7 @@
package com.android.settings.wifi; package com.android.settings.wifi;
import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@@ -328,8 +329,12 @@ public class NetworkRequestDialogFragment extends InstrumentedDialogFragment imp
@Override @Override
public void onUserSelectionConnectSuccess(WifiConfiguration wificonfiguration) { public void onUserSelectionConnectSuccess(WifiConfiguration wificonfiguration) {
// Dismisses current dialog, since connection is success. // Dismisses current dialog and finishes Activity, since connection is success.
dismiss(); dismiss();
final Activity activity = getActivity();
if (activity != null) {
activity.finish();
}
} }
@Override @Override

View File

@@ -38,8 +38,8 @@ import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
public class WifiPrivacyPreferenceControllerTest { public class WifiPrivacyPreferenceControllerTest {
private static final int PRIVACY_RANDOMIZED = 0; private static final int PRIVACY_RANDOMIZED = WifiConfiguration.RANDOMIZATION_PERSISTENT;
private static final int PRIVACY_TRUSTED = 1; private static final int PRIVACY_TRUSTED = WifiConfiguration.RANDOMIZATION_NONE;
@Mock @Mock
private WifiConfiguration mWifiConfiguration; private WifiConfiguration mWifiConfiguration;
@@ -47,6 +47,7 @@ public class WifiPrivacyPreferenceControllerTest {
private WifiPrivacyPreferenceController mPreferenceController; private WifiPrivacyPreferenceController mPreferenceController;
private Context mContext; private Context mContext;
private DropDownPreference mDropDownPreference; private DropDownPreference mDropDownPreference;
private String[] perferenceString;
@Before @Before
public void setUp() { public void setUp() {
@@ -59,6 +60,8 @@ public class WifiPrivacyPreferenceControllerTest {
mDropDownPreference = new DropDownPreference(mContext); mDropDownPreference = new DropDownPreference(mContext);
mDropDownPreference.setEntries(R.array.wifi_privacy_entries); mDropDownPreference.setEntries(R.array.wifi_privacy_entries);
mDropDownPreference.setEntryValues(R.array.wifi_privacy_values); mDropDownPreference.setEntryValues(R.array.wifi_privacy_values);
perferenceString = mContext.getResources().getStringArray(R.array.wifi_privacy_entries);
} }
@Test @Test
@@ -67,7 +70,8 @@ public class WifiPrivacyPreferenceControllerTest {
mPreferenceController.updateState(mDropDownPreference); mPreferenceController.updateState(mDropDownPreference);
assertThat(mDropDownPreference.getEntry()).isEqualTo("Trusted");
assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[PRIVACY_TRUSTED]);
} }
@Test @Test
@@ -76,7 +80,7 @@ public class WifiPrivacyPreferenceControllerTest {
mPreferenceController.updateState(mDropDownPreference); mPreferenceController.updateState(mDropDownPreference);
assertThat(mDropDownPreference.getEntry()).isEqualTo("Default (use randomized MAC)"); assertThat(mDropDownPreference.getEntry()).isEqualTo(perferenceString[PRIVACY_RANDOMIZED]);
} }
@Test @Test