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

Commit 2d549764 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: fbf395c2

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

        public static final String AUTHORITY = "downloads";

        /**
         * The permission to access the download manager
         */
+7 −0
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ import android.os.SystemProperties;
import android.os.UpdateLock;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Downloads;
import android.provider.Settings;
import android.telecom.TelecomManager;
import android.text.format.DateUtils;
@@ -7890,6 +7891,12 @@ public final class ActivityManagerService extends ActivityManagerNative
                    // Only inspect grants matching package
                    if (packageName == null || perm.sourcePkg.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
                                ? ~0 : ~Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, true);