arc: Do not construct RestrictionSet with empty restrictions bundle
The legacy device_policy_restrictions tag can be empty and the code tries to construct a restriction set with the empty bundle which causes a crash. The newer device_policy_local_restrictions parses correctly with empty body because the parsing code avoids passing empty bundle to the set. In this fix we're adding a check on the bundle emptiness before constructing the restriction set with it. Bug: 213364202 Test: replace the new tag with the legacy tag and verify that app launches successfully Change-Id: Ib8dbbb4a550c4309e2243bf0611bb6c8565c0e96
This commit is contained in:
@@ -3402,8 +3402,11 @@ public class UserManagerService extends IUserManager.Stub {
|
||||
Slog.wtf(LOG_TAG, "Seeing both legacy and current local restrictions in xml");
|
||||
}
|
||||
} else if (legacyLocalRestrictions != null) {
|
||||
mDevicePolicyLocalUserRestrictions.put(id,
|
||||
new RestrictionsSet(id, legacyLocalRestrictions));
|
||||
RestrictionsSet legacyLocalRestrictionsSet =
|
||||
legacyLocalRestrictions.isEmpty()
|
||||
? new RestrictionsSet()
|
||||
: new RestrictionsSet(id, legacyLocalRestrictions);
|
||||
mDevicePolicyLocalUserRestrictions.put(id, legacyLocalRestrictionsSet);
|
||||
}
|
||||
if (globalRestrictions != null) {
|
||||
mDevicePolicyGlobalUserRestrictions.updateRestrictions(id,
|
||||
|
||||
Reference in New Issue
Block a user