Fix crash on Storage and Privacy page

The implementation in PreferenceGroup is changed,
contentEquals doesn't accept null value.

So, we won't call findPreference when key of controller
is null.

Test: robotest, maunal test
Fixes: 122805831

Change-Id: Ia6df5c536ca5a32448f66b5308e7ec2334f1fe7b
(cherry picked from commit 3314cd05d5b97368e7c8f7ea7470f7321fbcdf95)
This commit is contained in:
tmfang
2019-01-14 16:47:11 +08:00
committed by android-build-team Robot
parent a9d8b8e475
commit b429213e00

View File

@@ -369,6 +369,11 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
mPreferenceControllers.values()) {
for (AbstractPreferenceController controller : controllerList) {
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) {
preference.setVisible(visible && controller.isAvailable());