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

Commit ea372362 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

DO NOT MERGE. Retain DownloadManager Uri grants when clearing. am: 6eee8e37 am: 6795459a

am: ede3a784

Change-Id: Ia096688611ad3f30d7f32975a84ced573fa5961d
parents 29061d33 ede3a784
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,8 @@ public final class Downloads {
    public static final class Impl implements BaseColumns {
    public static final class Impl implements BaseColumns {
        private Impl() {}
        private Impl() {}


        public static final String AUTHORITY = "downloads";

        /**
        /**
         * The permission to access the download manager
         * The permission to access the download manager
         */
         */
+7 −0
Original line number Original line Diff line number Diff line
@@ -190,6 +190,7 @@ import android.os.UpdateLock;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.os.WorkSource;
import android.os.WorkSource;
import android.provider.Downloads;
import android.os.storage.IMountService;
import android.os.storage.IMountService;
import android.os.storage.MountServiceInternal;
import android.os.storage.MountServiceInternal;
import android.os.storage.StorageManager;
import android.os.storage.StorageManager;
@@ -8561,6 +8562,12 @@ public final class ActivityManagerService extends ActivityManagerNative
                    // Only inspect grants matching package
                    // Only inspect grants matching package
                    if (packageName == null || perm.sourcePkg.equals(packageName)
                    if (packageName == null || perm.sourcePkg.equals(packageName)
                            || perm.targetPkg.equals(packageName)) {
                            || perm.targetPkg.equals(packageName)) {
                        // Hacky solution as part of fixing a security bug; ignore
                        // grants associated with DownloadManager so we don't have
                        // to immediately launch it to regrant the permissions
                        if (Downloads.Impl.AUTHORITY.equals(perm.uri.uri.getAuthority())
                                && !persistable) continue;
                        persistChanged |= perm.revokeModes(persistable
                        persistChanged |= perm.revokeModes(persistable
                                ? ~0 : ~Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, true);
                                ? ~0 : ~Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, true);