Merge "Add necessary system APIs for moving role into module."
This commit is contained in:
@@ -40,6 +40,22 @@ package android.app.role {
|
||||
|
||||
}
|
||||
|
||||
package android.content {
|
||||
|
||||
public abstract class Context {
|
||||
method @NonNull public android.os.UserHandle getUser();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content.pm {
|
||||
|
||||
public abstract class PackageManager {
|
||||
method @NonNull public String getPermissionControllerPackageName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content.rollback {
|
||||
|
||||
public class RollbackManagerFrameworkInitializer {
|
||||
|
||||
@@ -630,7 +630,7 @@ package android.content {
|
||||
public abstract class Context {
|
||||
method @NonNull public java.io.File getCrateDir(@NonNull String);
|
||||
method public abstract int getDisplayId();
|
||||
method public android.os.UserHandle getUser();
|
||||
method @NonNull public android.os.UserHandle getUser();
|
||||
method public int getUserId();
|
||||
method public void setAutofillOptions(@Nullable android.content.AutofillOptions);
|
||||
method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions);
|
||||
@@ -685,7 +685,7 @@ package android.content.pm {
|
||||
method public abstract int getInstallReason(@NonNull String, @NonNull android.os.UserHandle);
|
||||
method @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
|
||||
method @Nullable public abstract String[] getNamesForUids(int[]);
|
||||
method @NonNull public abstract String getPermissionControllerPackageName();
|
||||
method @NonNull public String getPermissionControllerPackageName();
|
||||
method @NonNull public abstract String getServicesSystemSharedLibraryPackageName();
|
||||
method @NonNull public abstract String getSharedSystemSharedLibraryPackageName();
|
||||
method @Nullable public String getSystemTextClassifierPackageName();
|
||||
|
||||
@@ -5919,9 +5919,14 @@ public abstract class Context {
|
||||
throws PackageManager.NameNotFoundException;
|
||||
|
||||
/**
|
||||
* Get the user associated with this context
|
||||
* Get the user associated with this context.
|
||||
*
|
||||
* @return the user associated with this context
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
@TestApi
|
||||
public UserHandle getUser() {
|
||||
return android.os.Process.myUserHandle();
|
||||
|
||||
@@ -4829,15 +4829,17 @@ public abstract class PackageManager {
|
||||
/**
|
||||
* Gets the package name of the component controlling runtime permissions.
|
||||
*
|
||||
* @return The package name.
|
||||
* @return the package name of the component controlling runtime permissions
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SuppressWarnings("HiddenAbstractMethod")
|
||||
@UnsupportedAppUsage
|
||||
@NonNull
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
@TestApi
|
||||
public abstract String getPermissionControllerPackageName();
|
||||
@UnsupportedAppUsage
|
||||
public String getPermissionControllerPackageName() {
|
||||
throw new RuntimeException("Not implemented. Must override in a subclass.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new dynamic permission to the system. For this to work, your
|
||||
|
||||
@@ -8802,7 +8802,17 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
@Override
|
||||
public String getPermissionControllerPackageName() {
|
||||
synchronized (mLock) {
|
||||
return mRequiredPermissionControllerPackage;
|
||||
if (mRequiredPermissionControllerPackage != null) {
|
||||
final PackageSetting ps = getPackageSetting(mRequiredPermissionControllerPackage);
|
||||
if (ps != null) {
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
final int callingUserId = UserHandle.getUserId(callingUid);
|
||||
if (!shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
return mRequiredPermissionControllerPackage;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("PermissionController is not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ package android.test.mock {
|
||||
method public int getInstallReason(String, android.os.UserHandle);
|
||||
method public java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
|
||||
method public String[] getNamesForUids(int[]);
|
||||
method public String getPermissionControllerPackageName();
|
||||
method @NonNull public String getServicesSystemSharedLibraryPackageName();
|
||||
method @NonNull public String getSharedSystemSharedLibraryPackageName();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user