Always update the permissions being delegated as Shell.

Previously the logic was to reuse the same permission delegate,
however since we are moving to the new API, that reuse is no longer
possible. So just always set up the permission delegate again to avoid
delegated permissions not being updated in PermissionManagerService.

Bug: 158736025
Fixes: 175085645
Test: MultiUserRollbackTest
Change-Id: I58acefe7bd9053a032b3df24c0c793f4e2aacde1
This commit is contained in:
Hai Zhang
2020-12-08 21:38:49 -08:00
parent c43d935c42
commit 735aa04593

View File

@@ -17209,8 +17209,6 @@ public class ActivityManagerService extends IActivityManager.Stub
throw new SecurityException("Shell can delegate permissions only "
+ "to one instrumentation at a time");
}
delegate.setPermissions(permissions);
return;
}
final int instrCount = mActiveInstrumentation.size();
@@ -17253,7 +17251,8 @@ public class ActivityManagerService extends IActivityManager.Stub
private class ShellDelegate implements CheckOpsDelegate {
private final int mTargetUid;
private @Nullable String[] mPermissions;
@Nullable
private final String[] mPermissions;
ShellDelegate(int targetUid, @Nullable String[] permissions) {
mTargetUid = targetUid;
@@ -17264,11 +17263,6 @@ public class ActivityManagerService extends IActivityManager.Stub
return mTargetUid;
}
void setPermissions(@Nullable String[] permissions) {
mPermissions = permissions;
PackageManager.invalidatePackageInfoCache();
}
@Override
public int checkOperation(int code, int uid, String packageName, boolean raw,
QuadFunction<Integer, Integer, String, Boolean, Integer> superImpl) {