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

Commit fbd689e9 authored by Thomas Vannet's avatar Thomas Vannet Committed by Android (Google) Code Review
Browse files

Merge changes from topics "otpsessionkilleddelay", "selfrevokeperperm"

* changes:
  Update self-revocation doc: revoke by permission, not group
  Add killed delay param to startOneTimePermissionSession
parents 1ff3c313 8b2f6ecf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9948,7 +9948,8 @@ package android.permission {
    method @IntRange(from=0) @RequiresPermission(anyOf={android.Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY, android.Manifest.permission.UPGRADE_RUNTIME_PERMISSIONS}) public int getRuntimePermissionsVersion();
    method @NonNull public java.util.List<android.permission.PermissionManager.SplitPermissionInfo> getSplitPermissions();
    method @RequiresPermission(anyOf={android.Manifest.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY, android.Manifest.permission.UPGRADE_RUNTIME_PERMISSIONS}) public void setRuntimePermissionsVersion(@IntRange(from=0) int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS) public void startOneTimePermissionSession(@NonNull String, long, int, int);
    method @Deprecated @RequiresPermission(android.Manifest.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS) public void startOneTimePermissionSession(@NonNull String, long, int, int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS) public void startOneTimePermissionSession(@NonNull String, long, long, int, int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS) public void stopOneTimePermissionSession(@NonNull String);
    field @RequiresPermission(android.Manifest.permission.START_REVIEW_PERMISSION_DECISIONS) public static final String ACTION_REVIEW_PERMISSION_DECISIONS = "android.permission.action.REVIEW_PERMISSION_DECISIONS";
    field public static final int PERMISSION_GRANTED = 0; // 0x0
+16 −5
Original line number Diff line number Diff line
@@ -6504,15 +6504,26 @@ public abstract class Context {
     * <li>Each permission in {@code permissions} must be a runtime permission.
     * </ul>
     * <p>
     * For every permission in {@code permissions}, the entire permission group it belongs to will
     * be revoked. The revocation happens asynchronously and kills all processes running in the
     * calling UID. It will be triggered once it is safe to do so. In particular, it will not be
     * triggered as long as the package remains in the foreground, or has any active manifest
     * components (e.g. when another app is accessing a content provider in the package).
     * Background permissions which have no corresponding foreground permission still granted once
     * the revocation is effective will also be revoked.
     * <p>
     * The revocation happens asynchronously and kills all processes running in the calling UID. It
     * will be triggered once it is safe to do so. In particular, it will not be triggered as long
     * as the package remains in the foreground, or has any active manifest components (e.g. when
     * another app is accessing a content provider in the package).
     * <p>
     * If you want to revoke the permissions right away, you could call {@code System.exit()}, but
     * this could affect other apps that are accessing your app at the moment. For example, apps
     * accessing a content provider in your app will all crash.
     * <p>
     * Note that the settings UI shows a permission group as granted as long as at least one
     * permission in the group is granted. If you want the user to observe the revocation in the
     * settings, you should revoke every permission in the target group. To learn the current list
     * of permissions in a group, you may use
     * {@link PackageManager#getGroupOfPlatformPermission(String, Executor, Consumer)} and
     * {@link PackageManager#getPlatformPermissionsForGroup(String, Executor, Consumer)}. This list
     * of permissions may evolve over time, so it is recommended to check whether it contains any
     * permission you wish to retain before trying to revoke an entire group.
     *
     * @param permissions Collection of permissions to be revoked.
     * @see PackageManager#getGroupOfPlatformPermission(String, Executor, Consumer)
+2 −1
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ interface IPermissionManager {
    void revokeOwnPermissionsOnKill(String packageName, in List<String> permissions);

    void startOneTimePermissionSession(String packageName, int userId, long timeout,
            int importanceToResetTimer, int importanceToKeepSessionAlive);
            long revokeAfterKilledDelay, int importanceToResetTimer,
            int importanceToKeepSessionAlive);

    void stopOneTimePermissionSession(String packageName, int userId);

+8 −6
Original line number Diff line number Diff line
@@ -907,21 +907,23 @@ public final class PermissionControllerManager {
     * <li>Each permission in {@code permissions} must be a runtime permission.
     * </ul>
     * <p>
     * For every permission in {@code permissions}, the entire permission group it belongs to will
     * be revoked. This revocation happens asynchronously and kills all processes running in the
     * same UID as {@code packageName}. It will be triggered once it is safe to do so.
     * Background permissions which have no corresponding foreground permission still granted once
     * the revocation is effective will also be revoked.
     * <p>
     * This revocation happens asynchronously and kills all processes running in the same UID as
     * {@code packageName}. It will be triggered once it is safe to do so.
     *
     * @param packageName The name of the package for which the permissions will be revoked.
     * @param permissions List of permissions to be revoked.
     * @param callback Callback called when the revocation request has been completed.
     *
     * @see Context#revokeOwnPermissionsOnKill(Collection)
     * @see Context#revokeOwnPermissionsOnKill(java.util.Collection)
     *
     * @hide
     */
    public void revokeOwnPermissionsOnKill(@NonNull String packageName,
            @NonNull List<String> permissions, AndroidFuture<Void> callback) {
            @NonNull List<String> permissions) {
        mRemoteService.postAsync(service -> {
            AndroidFuture<Void> callback = new AndroidFuture<>();
            service.revokeOwnPermissionsOnKill(packageName, permissions, callback);
            return callback;
        }).whenComplete((result, err) -> {
+6 −4
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ public abstract class PermissionControllerService extends Service {

    /**
     * Called when a package is considered inactive based on the criteria given by
     * {@link PermissionManager#startOneTimePermissionSession(String, long, int, int)}.
     * {@link PermissionManager#startOneTimePermissionSession(String, long, long, int, int)}.
     * This method is called at the end of a one-time permission session
     *
     * @param packageName The package that has been inactive
@@ -329,9 +329,11 @@ public abstract class PermissionControllerService extends Service {
     * Triggers the revocation of one or more permissions for a package. This should only be called
     * at the request of {@code packageName}.
     * <p>
     * For every permission in {@code permissions}, the entire permission group it belongs to will
     * be revoked. This revocation happens asynchronously and kills all processes running in the
     * same UID as {@code packageName}. It will be triggered once it is safe to do so.
     * Background permissions which have no corresponding foreground permission still granted once
     * the revocation is effective will also be revoked.
     * <p>
     * This revocation happens asynchronously and kills all processes running in the same UID as
     * {@code packageName}. It will be triggered once it is safe to do so.
     *
     * @param packageName The name of the package for which the permissions will be revoked.
     * @param permissions List of permissions to be revoked.
Loading