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 name="wifi_privacy_entries">
<item>Default (use randomized MAC)</item>
<item>Trusted</item>
<item>Use device MAC</item>
<item>Use randomized MAC (default)</item>
</string-array>
<string-array name="wifi_hidden_entries">

View File

@@ -10338,9 +10338,9 @@
<string name="see_less">See less</string>
<!-- 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] -->
<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] -->
<string name="network_connection_timeout_dialog_ok">Try again</string>
<!-- Message for Network connection error state Dialog [CHAR LIMIT=NONE] -->

View File

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

View File

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