Merge "Fix potential NPE in DevelopmentSettingsDashboardFragment" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
a9c090df87
@@ -198,8 +198,12 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
|||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange, Uri uri) {
|
public void onChange(boolean selfChange, Uri uri) {
|
||||||
super.onChange(selfChange, uri);
|
super.onChange(selfChange, uri);
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final boolean developmentEnabledState =
|
final boolean developmentEnabledState =
|
||||||
DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(getContext());
|
DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(activity);
|
||||||
final boolean switchState = mSwitchBar.isChecked();
|
final boolean switchState = mSwitchBar.isChecked();
|
||||||
|
|
||||||
// when developer options is enabled, but it is disabled by other privilege apps like:
|
// when developer options is enabled, but it is disabled by other privilege apps like:
|
||||||
@@ -209,7 +213,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
disableDeveloperOptions();
|
disableDeveloperOptions();
|
||||||
getActivity().runOnUiThread(() -> finishFragment());
|
activity.runOnUiThread(() -> finishFragment());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user