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:
Zhen Zhang
2020-02-11 17:22:12 -08:00
parent ec966cb7a3
commit 15ec99114d
3 changed files with 18 additions and 2 deletions

View File

@@ -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