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
This commit is contained in:
Jackal Guo
2022-11-03 16:29:11 +08:00
parent 484149d214
commit abd1cc3a7c

View File

@@ -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.