Check availability on start for TetherSettings
mUnavailable variable is only assigned when creating the activity. This make the app crash when we disable tethering and then resume + toggle on the Bluetooth Tethering. This cl remove the variable and directly check whenever the app start.
Bug: 270285631
Test: manual
Change-Id: I0dff1d11cbcc06816a69985f96eee828bb83e87c
diff --git a/src/com/android/settings/network/tether/TetherSettings.java b/src/com/android/settings/network/tether/TetherSettings.java
index 68834fb..ba19d1c 100644
--- a/src/com/android/settings/network/tether/TetherSettings.java
+++ b/src/com/android/settings/network/tether/TetherSettings.java
@@ -123,7 +123,6 @@
private boolean mMassStorageActive;
private boolean mBluetoothEnableForTether;
- private boolean mUnavailable;
private DataSaverBackend mDataSaverBackend;
private boolean mDataSaverEnabled;
@@ -168,7 +167,6 @@
setIfOnlyAvailableForAdmins(true);
if (isUiRestricted()) {
- mUnavailable = true;
getPreferenceScreen().removeAll();
return;
}
@@ -360,7 +358,7 @@
public void onStart() {
super.onStart();
- if (mUnavailable) {
+ if (isUiRestricted()) {
if (!isUiRestrictedByOnlyAdmin()) {
getEmptyTextView().setText(R.string.tethering_settings_not_available);
}
@@ -388,7 +386,7 @@
public void onStop() {
super.onStop();
- if (mUnavailable) {
+ if (isUiRestricted()) {
return;
}
getActivity().unregisterReceiver(mTetherChangeReceiver);