Merge "Add a switch for update ownership enforcement"

This commit is contained in:
Jackal Guo
2022-12-26 00:24:56 +00:00
committed by Android (Google) Code Review

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.