Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3520557a authored by Muhammad Hasan Khan's avatar Muhammad Hasan Khan
Browse files

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
parent f7a327e8
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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,