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

Commit 120aee8e authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

PackageManager: Let system-defined permissions take precedence over settings

If a permission was already present in the device's settings due to having
no prior system definition, and the system tried to take it over
(after a version upgrade, for example), it'd fail, since the saved
value would clobber the one previously read from the permissions XML.

This breaks system-behavior changes (gid grants, in particular) unless
the user performs a factory reset after upgrading, which isn't acceptable.

Change-Id: If2e44110f6db735ad29cdf1086e814bd1299e290
parent 01cbf807
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1997,6 +1997,12 @@ final class Settings {
                final String name = parser.getAttributeValue(null, ATTR_NAME);
                final String sourcePackage = parser.getAttributeValue(null, "package");
                final String ptype = parser.getAttributeValue(null, "type");
                BasePermission tp = mPermissions.get(name);
                if (tp != null) {
                    Log.v(PackageManagerService.TAG, "Permission " + name + " became a builtin " +
                          "since configuration was generated, skipping it");
                    continue;
                }
                if (name != null && sourcePackage != null) {
                    final boolean dynamic = "dynamic".equals(ptype);
                    final BasePermission bp = new BasePermission(name, sourcePackage,