Merge "Remove calls to remountUid()."
This commit is contained in:
committed by
Android (Google) Code Review
commit
3988cce368
@@ -69,13 +69,6 @@ public abstract class StorageManagerInternal {
|
||||
*/
|
||||
public abstract void addExternalStoragePolicy(ExternalStorageMountPolicy policy);
|
||||
|
||||
/**
|
||||
* Notify the mount service that the mount policy for a UID changed.
|
||||
* @param uid The UID for which policy changed.
|
||||
* @param packageName The package in the UID for making the call.
|
||||
*/
|
||||
public abstract void onExternalStoragePolicyChanged(int uid, String packageName);
|
||||
|
||||
/**
|
||||
* Gets the mount mode to use for a given UID as determined by consultin all
|
||||
* policies.
|
||||
|
||||
@@ -19,11 +19,9 @@ package com.android.server;
|
||||
import static android.Manifest.permission.ACCESS_MTP;
|
||||
import static android.Manifest.permission.INSTALL_PACKAGES;
|
||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
|
||||
import static android.app.AppOpsManager.MODE_ALLOWED;
|
||||
import static android.app.AppOpsManager.OP_LEGACY_STORAGE;
|
||||
import static android.app.AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE;
|
||||
import static android.app.AppOpsManager.OP_READ_EXTERNAL_STORAGE;
|
||||
import static android.app.AppOpsManager.OP_REQUEST_INSTALL_PACKAGES;
|
||||
import static android.app.AppOpsManager.OP_WRITE_EXTERNAL_STORAGE;
|
||||
import static android.content.pm.PackageManager.MATCH_ANY_USER;
|
||||
@@ -135,7 +133,6 @@ import android.util.TimeUtils;
|
||||
import android.util.Xml;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.app.IAppOpsCallback;
|
||||
import com.android.internal.app.IAppOpsService;
|
||||
import com.android.internal.content.PackageMonitor;
|
||||
import com.android.internal.os.AppFuseMount;
|
||||
@@ -151,7 +148,6 @@ import com.android.internal.util.HexDump;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.server.SystemService.TargetUser;
|
||||
import com.android.server.pm.Installer;
|
||||
import com.android.server.storage.AppFuseBridge;
|
||||
import com.android.server.storage.StorageSessionController;
|
||||
@@ -2521,19 +2517,6 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
abortIdleMaint(null);
|
||||
}
|
||||
|
||||
private void remountUidExternalStorage(int uid, int mode) {
|
||||
if (uid == Process.SYSTEM_UID) {
|
||||
// No need to remount uid for system because it has all access anyways
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
mVold.remountUid(uid, mode);
|
||||
} catch (Exception e) {
|
||||
Slog.wtf(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugFlags(int flags, int mask) {
|
||||
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
|
||||
@@ -3845,21 +3828,6 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private IAppOpsCallback.Stub mAppOpsCallback = new IAppOpsCallback.Stub() {
|
||||
@Override
|
||||
public void opChanged(int op, int uid, String packageName) throws RemoteException {
|
||||
if (!ENABLE_ISOLATED_STORAGE) return;
|
||||
|
||||
int mountMode = getMountMode(uid, packageName);
|
||||
boolean isUidActive = LocalServices.getService(ActivityManagerInternal.class)
|
||||
.getUidProcessState(uid) != PROCESS_STATE_NONEXISTENT;
|
||||
|
||||
if (isUidActive) {
|
||||
remountUidExternalStorage(uid, mountMode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void addObbStateLocked(ObbState obbState) throws RemoteException {
|
||||
final IBinder binder = obbState.getBinder();
|
||||
List<ObbState> obbStates = mObbMounts.get(binder);
|
||||
@@ -4545,12 +4513,6 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExternalStoragePolicyChanged(int uid, String packageName) {
|
||||
final int mountMode = getExternalStorageMountMode(uid, packageName);
|
||||
remountUidExternalStorage(uid, mountMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExternalStorageMountMode(int uid, String packageName) {
|
||||
if (ENABLE_ISOLATED_STORAGE) {
|
||||
@@ -4696,16 +4658,6 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
updateLegacyStorageApps(packageName, uid, mode == MODE_ALLOWED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == MODE_ALLOWED && (code == OP_READ_EXTERNAL_STORAGE
|
||||
|| code == OP_WRITE_EXTERNAL_STORAGE
|
||||
|| code == OP_REQUEST_INSTALL_PACKAGES)) {
|
||||
final UserManagerInternal userManagerInternal =
|
||||
LocalServices.getService(UserManagerInternal.class);
|
||||
if (userManagerInternal.isUserInitialized(UserHandle.getUserId(uid))) {
|
||||
onExternalStoragePolicyChanged(uid, packageName);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.UserManagerInternal;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.StorageManagerInternal;
|
||||
import android.permission.IOnPermissionsChangeListener;
|
||||
import android.permission.IPermissionManager;
|
||||
import android.permission.PermissionControllerManager;
|
||||
@@ -1554,24 +1553,6 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
||||
if (bp.isRuntime()) {
|
||||
notifyRuntimePermissionStateChanged(packageName, userId);
|
||||
}
|
||||
|
||||
// Only need to do this if user is initialized. Otherwise it's a new user
|
||||
// and there are no processes running as the user yet and there's no need
|
||||
// to make an expensive call to remount processes for the changed permissions.
|
||||
if (READ_EXTERNAL_STORAGE.equals(permName)
|
||||
|| WRITE_EXTERNAL_STORAGE.equals(permName)) {
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
if (mUserManagerInt.isUserInitialized(userId)) {
|
||||
StorageManagerInternal storageManagerInternal = LocalServices.getService(
|
||||
StorageManagerInternal.class);
|
||||
storageManagerInternal.onExternalStoragePolicyChanged(uid, packageName);
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user