Update summary for WifiTetherDisablePreference accordingly
The summary of this preference is depenent on other two preferences for USB tether and Bluetooth tether. The summary is updated accordingly. Bug: 146818850 Test: CodeInspectionTest, WifiTetherDisablePreferenceControllerTest, manually test. Change-Id: I366d10a43814ea0d7def466b1976928f17875029
This commit is contained in:
@@ -3744,6 +3744,14 @@
|
||||
<!-- Tethering controls, footer note displayed when tethering is disabled because Data Saver mode is on [CHAR LIMIT=none]-->
|
||||
<string name="tether_settings_disabled_on_data_saver">"Can\u2019t tether or use portable hotspots while Data Saver is on"</string>
|
||||
|
||||
<!-- Disable Wifi Hotspot option-->
|
||||
<!-- Don't use Wi-Fi hotspot summary when USB tethering is chosen [CHAR LIMIT=NONE]-->
|
||||
<string name="disable_wifi_hotspot_when_usb_on">Only share internet via USB</string>
|
||||
<!-- Don't use Wi-Fi hotspot summary when Bluetooth tethering is chosen [CHAR LIMIT=NONE]-->
|
||||
<string name="disable_wifi_hotspot_when_bluetooth_on">Only share internet via Bluetooth</string>
|
||||
<!-- Don't use Wi-Fi hotspot summary when USB tethering and Bluetooth tethering are chosen [CHAR LIMIT=NONE]-->
|
||||
<string name="disable_wifi_hotspot_when_usb_and_bluetooth_on">Only share internet via USB and Bluetooth</string>
|
||||
|
||||
<!-- USB Tethering options -->
|
||||
<string name="usb_title">USB</string>
|
||||
<string name="usb_tethering_button_text">USB tethering</string>
|
||||
|
@@ -74,6 +74,7 @@
|
||||
<SwitchPreference
|
||||
android:key="disable_wifi_tethering"
|
||||
android:title="Don't use Wi-Fi hotspot"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:controller="com.android.settings.network.WifiTetherDisablePreferenceController"
|
||||
settings:keywords="@string/keywords_hotspot_tethering" />
|
||||
</PreferenceCategory>
|
||||
|
@@ -30,6 +30,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settingslib.TetherUtil;
|
||||
|
||||
@@ -95,8 +96,14 @@ public final class WifiTetherDisablePreferenceController extends BasePreferenceC
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
// TODO(b/146818850): Update summary accordingly.
|
||||
return super.getSummary();
|
||||
if (mUSBTetherEnabled && mBluetoothTetherEnabled) {
|
||||
return mContext.getString(R.string.disable_wifi_hotspot_when_usb_and_bluetooth_on);
|
||||
} else if (mUSBTetherEnabled) {
|
||||
return mContext.getString(R.string.disable_wifi_hotspot_when_usb_on);
|
||||
} else if (mBluetoothTetherEnabled) {
|
||||
return mContext.getString(R.string.disable_wifi_hotspot_when_bluetooth_on);
|
||||
}
|
||||
return mContext.getString(R.string.summary_placeholder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user