Fix Account Settings crash
Bug: 17020198 Change-Id: I9d4a18381ebb0f57a0e9917c3b7579b0a7feeaf4
This commit is contained in:
@@ -137,7 +137,7 @@ public class AccountSettings extends SettingsPreferenceFragment
|
|||||||
currentProfile.getIdentifier()));
|
currentProfile.getIdentifier()));
|
||||||
menu.findItem(R.id.account_settings_menu_auto_sync_personal).setVisible(false);
|
menu.findItem(R.id.account_settings_menu_auto_sync_personal).setVisible(false);
|
||||||
menu.findItem(R.id.account_settings_menu_auto_sync_work).setVisible(false);
|
menu.findItem(R.id.account_settings_menu_auto_sync_work).setVisible(false);
|
||||||
} else {
|
} else if (mProfiles.size() > 1) {
|
||||||
// We assume there's only one managed profile, otherwise UI needs to change
|
// We assume there's only one managed profile, otherwise UI needs to change
|
||||||
final UserHandle managedProfile = mProfiles.valueAt(1).userInfo.getUserHandle();
|
final UserHandle managedProfile = mProfiles.valueAt(1).userInfo.getUserHandle();
|
||||||
|
|
||||||
@@ -152,6 +152,8 @@ public class AccountSettings extends SettingsPreferenceFragment
|
|||||||
.setChecked(ContentResolver.getMasterSyncAutomaticallyAsUser(
|
.setChecked(ContentResolver.getMasterSyncAutomaticallyAsUser(
|
||||||
managedProfile.getIdentifier()));
|
managedProfile.getIdentifier()));
|
||||||
menu.findItem(R.id.account_settings_menu_auto_sync).setVisible(false);
|
menu.findItem(R.id.account_settings_menu_auto_sync).setVisible(false);
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Method onPrepareOptionsMenu called before mProfiles was initialized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user