Merge "Maximize compatibility string update" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
437e7e7a04
@@ -2508,9 +2508,11 @@
|
|||||||
<!-- Summary for the toggle to turn off hotspot automatically [CHAR LIMIT=NONE]-->
|
<!-- Summary for the toggle to turn off hotspot automatically [CHAR LIMIT=NONE]-->
|
||||||
<string name="wifi_hotspot_auto_off_summary">When no devices are connected</string>
|
<string name="wifi_hotspot_auto_off_summary">When no devices are connected</string>
|
||||||
<!-- Title for the toggle to enable/disable the maximize compatibility [CHAR LIMIT=NONE]-->
|
<!-- Title for the toggle to enable/disable the maximize compatibility [CHAR LIMIT=NONE]-->
|
||||||
<string name="wifi_hotspot_maximize_compatibility">Maximize compatibility</string>
|
<string name="wifi_hotspot_maximize_compatibility">Extend compatibility</string>
|
||||||
<!-- Summary for the toggle to show the maximize compatibility warning message [CHAR LIMIT=NONE]-->
|
<!-- Summary for the toggle to show the maximize compatibility warning message in single AP device [CHAR LIMIT=NONE]-->
|
||||||
<string name="wifi_hotspot_maximize_compatibility_summary">This may reduce speed for devices connected to this hotspot and use more power</string>
|
<string name="wifi_hotspot_maximize_compatibility_single_ap_summary">Helps other devices find this hotspot. Reduces hotspot connection speed.</string>
|
||||||
|
<!-- Summary for the toggle to show the maximize compatibility warning message in dual AP device [CHAR LIMIT=NONE]-->
|
||||||
|
<string name="wifi_hotspot_maximize_compatibility_dual_ap_summary">Helps other devices find this hotspot. Increases battery usage.</string>
|
||||||
|
|
||||||
<!-- Summary text when turning hotspot on -->
|
<!-- Summary text when turning hotspot on -->
|
||||||
<string name="wifi_tether_starting">Turning hotspot on\u2026</string>
|
<string name="wifi_tether_starting">Turning hotspot on\u2026</string>
|
||||||
|
@@ -44,6 +44,5 @@
|
|||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="wifi_tether_maximize_compatibility"
|
android:key="wifi_tether_maximize_compatibility"
|
||||||
android:title="@string/wifi_hotspot_maximize_compatibility"
|
android:title="@string/wifi_hotspot_maximize_compatibility"/>
|
||||||
android:summary="@string/wifi_hotspot_maximize_compatibility_summary"/>
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -24,6 +24,8 @@ import androidx.annotation.VisibleForTesting;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller helps to manage the state of maximize compatibility switch preference.
|
* This controller helps to manage the state of maximize compatibility switch preference.
|
||||||
*/
|
*/
|
||||||
@@ -53,6 +55,9 @@ public class WifiTetherMaximizeCompatibilityPreferenceController extends
|
|||||||
}
|
}
|
||||||
mPreference.setEnabled(is5GhzBandSupported());
|
mPreference.setEnabled(is5GhzBandSupported());
|
||||||
((SwitchPreference) mPreference).setChecked(mIsChecked);
|
((SwitchPreference) mPreference).setChecked(mIsChecked);
|
||||||
|
mPreference.setSummary(mWifiManager.isBridgedApConcurrencySupported()
|
||||||
|
? R.string.wifi_hotspot_maximize_compatibility_dual_ap_summary
|
||||||
|
: R.string.wifi_hotspot_maximize_compatibility_single_ap_summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -34,6 +34,8 @@ import androidx.preference.SwitchPreference;
|
|||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import com.android.settings.testutils.ResourcesUtils;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -52,29 +54,30 @@ public class WifiTetherMaximizeCompatibilityPreferenceControllerTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private WifiTetherBasePreferenceController.OnTetherConfigUpdateListener mListener;
|
private WifiTetherBasePreferenceController.OnTetherConfigUpdateListener mListener;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
private WifiTetherMaximizeCompatibilityPreferenceController mController;
|
private WifiTetherMaximizeCompatibilityPreferenceController mController;
|
||||||
private SwitchPreference mPreference;
|
private SwitchPreference mPreference;
|
||||||
private SoftApConfiguration mConfig;
|
private SoftApConfiguration mConfig;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
final Context context = spy(ApplicationProvider.getApplicationContext());
|
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||||
mConfig = new SoftApConfiguration.Builder()
|
mConfig = new SoftApConfiguration.Builder()
|
||||||
.setSsid("test_Ssid")
|
.setSsid("test_Ssid")
|
||||||
.setPassphrase(null, SoftApConfiguration.SECURITY_TYPE_OPEN)
|
.setPassphrase(null, SoftApConfiguration.SECURITY_TYPE_OPEN)
|
||||||
.setBridgedModeOpportunisticShutdownEnabled(true)
|
.setBridgedModeOpportunisticShutdownEnabled(true)
|
||||||
.build();
|
.build();
|
||||||
doReturn(mWifiManager).when(context).getSystemService(Context.WIFI_SERVICE);
|
doReturn(mWifiManager).when(mContext).getSystemService(Context.WIFI_SERVICE);
|
||||||
doReturn(true).when(mWifiManager).isBridgedApConcurrencySupported();
|
doReturn(true).when(mWifiManager).isBridgedApConcurrencySupported();
|
||||||
doReturn(mConfig).when(mWifiManager).getSoftApConfiguration();
|
doReturn(mConfig).when(mWifiManager).getSoftApConfiguration();
|
||||||
|
|
||||||
mController = new WifiTetherMaximizeCompatibilityPreferenceController(context, mListener);
|
mController = new WifiTetherMaximizeCompatibilityPreferenceController(mContext, mListener);
|
||||||
if (Looper.myLooper() == null) {
|
if (Looper.myLooper() == null) {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
}
|
}
|
||||||
final PreferenceManager preferenceManager = new PreferenceManager(context);
|
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
||||||
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(context);
|
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
|
||||||
mPreference = new SwitchPreference(context);
|
mPreference = new SwitchPreference(mContext);
|
||||||
mPreference.setKey(WifiTetherMaximizeCompatibilityPreferenceController.PREF_KEY);
|
mPreference.setKey(WifiTetherMaximizeCompatibilityPreferenceController.PREF_KEY);
|
||||||
screen.addPreference(mPreference);
|
screen.addPreference(mPreference);
|
||||||
mController.displayPreference(screen);
|
mController.displayPreference(screen);
|
||||||
@@ -104,6 +107,26 @@ public class WifiTetherMaximizeCompatibilityPreferenceControllerTest {
|
|||||||
assertThat(mPreference.isEnabled()).isEqualTo(false);
|
assertThat(mPreference.isEnabled()).isEqualTo(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateDisplay_notSupportedBridgedApConcurrency_setSingleApSummary() {
|
||||||
|
doReturn(false).when(mWifiManager).isBridgedApConcurrencySupported();
|
||||||
|
|
||||||
|
mController.updateDisplay();
|
||||||
|
|
||||||
|
assertThat(mPreference.getSummary()).isEqualTo(ResourcesUtils.getResourcesString(mContext,
|
||||||
|
"wifi_hotspot_maximize_compatibility_single_ap_summary"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateDisplay_supportedBridgedApConcurrency_setDualApSummary() {
|
||||||
|
doReturn(true).when(mWifiManager).isBridgedApConcurrencySupported();
|
||||||
|
|
||||||
|
mController.updateDisplay();
|
||||||
|
|
||||||
|
assertThat(mPreference.getSummary()).isEqualTo(ResourcesUtils.getResourcesString(mContext,
|
||||||
|
"wifi_hotspot_maximize_compatibility_dual_ap_summary"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateDisplay_supported5GHzBandAndCountryCodeIsNotNull_setPreferenceEnabled() {
|
public void updateDisplay_supported5GHzBandAndCountryCodeIsNotNull_setPreferenceEnabled() {
|
||||||
doReturn(true).when(mWifiManager).is5GHzBandSupported();
|
doReturn(true).when(mWifiManager).is5GHzBandSupported();
|
||||||
|
Reference in New Issue
Block a user