Fix some pages crash after importing AndroidX from build 5175906

- Settings crash while entering Storage, Privacy, and Accounts page,
  because PreferenceGroup changed the API use from String#equals to
  String#contentEquals which doesn't support null keys.
- add a null check before calling findPreference

Test: robotest
Change-Id: I121cd9e4249fbdafbc67be65a09d770603e01044
Fixes: 121116425
This commit is contained in:
Jason Chiu
2018-12-18 18:27:50 +08:00
parent 45e9c56036
commit a42a93bbfe

View File

@@ -295,7 +295,13 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
if (!controller.isAvailable()) {
continue;
}
final String key = controller.getPreferenceKey();
if (TextUtils.isEmpty(key)) {
Log.d(TAG, String.format("Preference key is %s in Controller %s",
key, controller.getClass().getSimpleName()));
continue;
}
final Preference preference = screen.findPreference(key);
if (preference == null) {