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

Commit abd1cc3a authored by Jackal Guo's avatar Jackal Guo
Browse files

Add a switch for update ownership enforcement

In case we decide not to enforce the update ownership to installers
for some reason, add this feature flag accordingly.

Bug: 244413073
Test: build
Change-Id: I9928951c5753cb6810e65cf47fff452434ab472a
parent 484149d2
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -499,7 +499,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
    private static final String PROPERTY_KNOWN_DIGESTERS_LIST = "known_digesters_list";

    /**
     * Whether of not requesting the approval before committing sessions is available.
     * Whether or not requesting the approval before committing sessions is available.
     *
     * Flag type: {@code boolean}
     * Namespace: NAMESPACE_PACKAGE_MANAGER_SERVICE
@@ -507,6 +507,15 @@ public class PackageManagerService implements PackageSender, TestUtilityService
    private static final String PROPERTY_IS_PRE_APPROVAL_REQUEST_AVAILABLE =
            "is_preapproval_available";

    /**
     * Whether or not the update ownership enforcement is available.
     *
     * Flag type: {@code boolean}
     * Namespace: NAMESPACE_PACKAGE_MANAGER_SERVICE
     */
    private static final String PROPERTY_IS_UPDATE_OWNERSHIP_ENFORCEMENT_AVAILABLE =
            "is_update_ownership_enforcement_available";

    /**
     * The default response for package verification timeout.
     *
@@ -7074,6 +7083,16 @@ public class PackageManagerService implements PackageSender, TestUtilityService
        }
    }

    static boolean isUpdateOwnershipEnforcementAvailable() {
        final long token = Binder.clearCallingIdentity();
        try {
            return DeviceConfig.getBoolean(NAMESPACE_PACKAGE_MANAGER_SERVICE,
                    PROPERTY_IS_UPDATE_OWNERSHIP_ENFORCEMENT_AVAILABLE, false /* defaultValue */);
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    /**
     * Returns the array containing per-uid timeout configuration.
     * This is derived from DeviceConfig flags.