Add a user id parameter to getProperty API
Starting from U, the PackageManager#getProperty API returns failed if the package does not installed on the calling user. This cl adds a user id parameter to the API for system modules to specify a correct user id when getting the package's property. Bug: 229684723 Test: atest PackageManagerGetPropertyTest Test: atest CtsCompanionDeviceManagerCoreTestCases:SelfPresenceReportingTest Test: atest BackupEligibilityRulesTest Test: atest ExternalStorageHostTest Change-Id: Id447c5ae62b0ead8fb706f541d8c71282a605a95
This commit is contained in:
@@ -795,7 +795,8 @@ interface IPackageManager {
|
||||
|
||||
void holdLock(in IBinder token, in int durationMs);
|
||||
|
||||
PackageManager.Property getProperty(String propertyName, String packageName, String className);
|
||||
PackageManager.Property getPropertyAsUser(String propertyName, String packageName,
|
||||
String className, int userId);
|
||||
ParceledListSlice queryProperty(String propertyName, int componentType);
|
||||
|
||||
void setKeepUninstalledPackages(in List<String> packageList);
|
||||
|
||||
@@ -10224,6 +10224,21 @@ public abstract class PackageManager {
|
||||
"getProperty not implemented in subclass");
|
||||
}
|
||||
|
||||
/**
|
||||
* If the provided className is {@code null}, returns the property defined on the application.
|
||||
* Otherwise, returns the property defined on the component.
|
||||
*
|
||||
* @throws NameNotFoundException if the given package is not installed on the calling user or
|
||||
* component does not exist or if the given property is not defined within the manifest.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Property getPropertyAsUser(@NonNull String propertyName, @NonNull String packageName,
|
||||
@Nullable String className, int userId) throws NameNotFoundException {
|
||||
throw new UnsupportedOperationException(
|
||||
"getPropertyAsUser not implemented in subclass");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the property definition for all <application> tags.
|
||||
* <p>If the property is not defined with any <application> tag,
|
||||
|
||||
Reference in New Issue
Block a user