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
This commit is contained in:
@@ -123,7 +123,6 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
private boolean mMassStorageActive;
|
private boolean mMassStorageActive;
|
||||||
|
|
||||||
private boolean mBluetoothEnableForTether;
|
private boolean mBluetoothEnableForTether;
|
||||||
private boolean mUnavailable;
|
|
||||||
|
|
||||||
private DataSaverBackend mDataSaverBackend;
|
private DataSaverBackend mDataSaverBackend;
|
||||||
private boolean mDataSaverEnabled;
|
private boolean mDataSaverEnabled;
|
||||||
@@ -168,7 +167,6 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
setIfOnlyAvailableForAdmins(true);
|
setIfOnlyAvailableForAdmins(true);
|
||||||
if (isUiRestricted()) {
|
if (isUiRestricted()) {
|
||||||
mUnavailable = true;
|
|
||||||
getPreferenceScreen().removeAll();
|
getPreferenceScreen().removeAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -360,7 +358,7 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
if (mUnavailable) {
|
if (isUiRestricted()) {
|
||||||
if (!isUiRestrictedByOnlyAdmin()) {
|
if (!isUiRestrictedByOnlyAdmin()) {
|
||||||
getEmptyTextView().setText(R.string.tethering_settings_not_available);
|
getEmptyTextView().setText(R.string.tethering_settings_not_available);
|
||||||
}
|
}
|
||||||
@@ -388,7 +386,7 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
|
||||||
if (mUnavailable) {
|
if (isUiRestricted()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getActivity().unregisterReceiver(mTetherChangeReceiver);
|
getActivity().unregisterReceiver(mTetherChangeReceiver);
|
||||||
|
|||||||
Reference in New Issue
Block a user