Use if instead of switch for resources
Converting to Soong will move some code from directly compiled into the app to compiled into an Android library and then shared between the app and the tests. This will cause resource IDs in the library to become non-final, which means they can no longer be used in case statements. Convert affect case statements to if blocks. Test: m RunSettingsRoboTests Change-Id: I25742a374f06d3fa4decbfc0d223a350acc50881
This commit is contained in:
@@ -1086,21 +1086,18 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
public void onClick(View v) {
|
||||
if (v.getTag() instanceof UserPreference) {
|
||||
int userId = ((UserPreference) v.getTag()).getUserId();
|
||||
switch (v.getId()) {
|
||||
case UserPreference.DELETE_ID:
|
||||
final EnforcedAdmin removeDisallowedAdmin =
|
||||
RestrictedLockUtilsInternal.checkIfRestrictionEnforced(getContext(),
|
||||
UserManager.DISALLOW_REMOVE_USER, UserHandle.myUserId());
|
||||
if (removeDisallowedAdmin != null) {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(),
|
||||
removeDisallowedAdmin);
|
||||
} else {
|
||||
onRemoveUserClicked(userId);
|
||||
}
|
||||
break;
|
||||
case UserPreference.SETTINGS_ID:
|
||||
onManageUserClicked(userId, false);
|
||||
break;
|
||||
if (v.getId() == UserPreference.DELETE_ID) {
|
||||
final EnforcedAdmin removeDisallowedAdmin =
|
||||
RestrictedLockUtilsInternal.checkIfRestrictionEnforced(getContext(),
|
||||
UserManager.DISALLOW_REMOVE_USER, UserHandle.myUserId());
|
||||
if (removeDisallowedAdmin != null) {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(),
|
||||
removeDisallowedAdmin);
|
||||
} else {
|
||||
onRemoveUserClicked(userId);
|
||||
}
|
||||
} else if (v.getId() == UserPreference.SETTINGS_ID) {
|
||||
onManageUserClicked(userId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user