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

Commit 62211f9e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove legacy WRITE_EXTERNAL_STORAGE permission check for Installers"...

Merge "Remove legacy WRITE_EXTERNAL_STORAGE permission check for Installers" into tm-dev am: 2f510081

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19815899



Change-Id: I3088df345377f8f0c541a7a69fdeae90eed707f2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7f6087b8 2f510081
Loading
Loading
Loading
Loading
+2 −8
Original line number Original line Diff line number Diff line
@@ -19,12 +19,10 @@ package com.android.server;
import static android.Manifest.permission.ACCESS_MTP;
import static android.Manifest.permission.ACCESS_MTP;
import static android.Manifest.permission.INSTALL_PACKAGES;
import static android.Manifest.permission.INSTALL_PACKAGES;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.OP_LEGACY_STORAGE;
import static android.app.AppOpsManager.OP_LEGACY_STORAGE;
import static android.app.AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE;
import static android.app.AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE;
import static android.app.AppOpsManager.OP_REQUEST_INSTALL_PACKAGES;
import static android.app.AppOpsManager.OP_REQUEST_INSTALL_PACKAGES;
import static android.app.AppOpsManager.OP_WRITE_EXTERNAL_STORAGE;
import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
import static android.app.PendingIntent.FLAG_IMMUTABLE;
import static android.app.PendingIntent.FLAG_IMMUTABLE;
import static android.app.PendingIntent.FLAG_ONE_SHOT;
import static android.app.PendingIntent.FLAG_ONE_SHOT;
@@ -4512,11 +4510,7 @@ class StorageManagerService extends IStorageManager.Stub
                }
                }
            }
            }


            // Determine if caller is holding runtime permission
            // We're only willing to give out installer access if they hold
            final boolean hasWrite = StorageManager.checkPermissionAndCheckOp(mContext, false, 0,
                    uid, packageName, WRITE_EXTERNAL_STORAGE, OP_WRITE_EXTERNAL_STORAGE);

            // We're only willing to give out installer access if they also hold
            // runtime permission; this is a firm CDD requirement
            // runtime permission; this is a firm CDD requirement
            final boolean hasInstall = mIPackageManager.checkUidPermission(INSTALL_PACKAGES,
            final boolean hasInstall = mIPackageManager.checkUidPermission(INSTALL_PACKAGES,
                    uid) == PERMISSION_GRANTED;
                    uid) == PERMISSION_GRANTED;
@@ -4532,7 +4526,7 @@ class StorageManagerService extends IStorageManager.Stub
                    break;
                    break;
                }
                }
            }
            }
            if ((hasInstall || hasInstallOp) && hasWrite) {
            if (hasInstall || hasInstallOp) {
                return StorageManager.MOUNT_MODE_EXTERNAL_INSTALLER;
                return StorageManager.MOUNT_MODE_EXTERNAL_INSTALLER;
            }
            }
            return StorageManager.MOUNT_MODE_EXTERNAL_DEFAULT;
            return StorageManager.MOUNT_MODE_EXTERNAL_DEFAULT;