Loading services/core/java/com/android/server/pm/PackageManagerService.java +42 −26 Original line number Diff line number Diff line Loading @@ -2376,9 +2376,12 @@ public class PackageManagerService extends IPackageManager.Stub final int callingUserId = UserHandle.getUserId(callingUid); for (String packageName : packages) { PackageSetting setting = mSettings.mPackages.get(packageName); if (setting != null && !shouldFilterApplicationLocked(setting, callingUid, callingUserId)) { final boolean filterApp; synchronized (mLock) { final PackageSetting ps = mSettings.getPackageLPr(packageName); filterApp = shouldFilterApplicationLocked(ps, callingUid, callingUserId); } if (!filterApp) { notifyInstallObserver(packageName); } } Loading Loading @@ -8914,10 +8917,10 @@ public class PackageManagerService extends IPackageManager.Stub if (providerInfo == null) { return null; } synchronized (mLock) { if (!mSettings.isEnabledAndMatchLPr(providerInfo, flags, userId)) { return null; } synchronized (mLock) { final PackageSetting ps = mSettings.mPackages.get(providerInfo.packageName); final ComponentName component = new ComponentName(providerInfo.packageName, providerInfo.name); Loading Loading @@ -9004,10 +9007,12 @@ public class PackageManagerService extends IPackageManager.Stub String targetPackage, int flags) { final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getUserId(callingUid); final PackageSetting ps = mSettings.mPackages.get(targetPackage); synchronized (mLock) { final PackageSetting ps = mSettings.getPackageLPr(targetPackage); if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) { return ParceledListSlice.emptyList(); } } return new ParceledListSlice<>(queryInstrumentationInternal(targetPackage, flags, callingUserId)); } Loading Loading @@ -19356,9 +19361,11 @@ public class PackageManagerService extends IPackageManager.Stub mPermissionManager.enforceCrossUserPermission(callingUid, userId, true /* requireFullPermission */, false /* checkShell */, "clear application data"); final boolean filterApp; synchronized (mLock) { final PackageSetting ps = mSettings.getPackageLPr(packageName); final boolean filterApp = (ps != null && shouldFilterApplicationLocked(ps, callingUid, userId)); filterApp = shouldFilterApplicationLocked(ps, callingUid, userId); } if (!filterApp && mProtectedPackages.isPackageDataProtected(userId, packageName)) { throw new SecurityException("Cannot clear data for a protected package: " + packageName); Loading Loading @@ -19638,12 +19645,14 @@ public class PackageManagerService extends IPackageManager.Stub if (mContext.checkCallingOrSelfPermission( android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) { synchronized (mLock) { if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) { Slog.w(TAG, "Ignoring addPreferredActivity() from uid " + callingUid); return; } } mContext.enforceCallingOrSelfPermission( android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null); } Loading Loading @@ -19814,8 +19823,9 @@ public class PackageManagerService extends IPackageManager.Stub /** This method takes a specific user id as well as UserHandle.USER_ALL. */ private void clearPackagePreferredActivities(String packageName, int userId) { final SparseBooleanArray changedUsers = new SparseBooleanArray(); synchronized (mLock) { clearPackagePreferredActivitiesLPw(packageName, changedUsers, userId); } if (changedUsers.size() > 0) { updateDefaultHomeNotLocked(changedUsers); postPreferredActivityChangedBroadcast(userId); Loading Loading @@ -19937,7 +19947,9 @@ public class PackageManagerService extends IPackageManager.Stub // writer try { final SparseBooleanArray changedUsers = new SparseBooleanArray(); synchronized (mLock) { clearPackagePreferredActivitiesLPw(null, changedUsers, userId); } if (changedUsers.size() > 0) { postPreferredActivityChangedBroadcast(userId); } Loading Loading @@ -20942,8 +20954,12 @@ public class PackageManagerService extends IPackageManager.Stub // Limit who can change which apps if (!UserHandle.isSameApp(callingUid, pkgSetting.appId)) { // Don't allow apps that don't have permission to modify other apps if (!allowedByPermission || shouldFilterApplicationLocked(pkgSetting, callingUid, userId)) { final boolean filterApp; synchronized (mLock) { filterApp = (!allowedByPermission || shouldFilterApplicationLocked(pkgSetting, callingUid, userId)); } if (filterApp) { throw new SecurityException( "Attempt to change component state; " + "pid=" + Binder.getCallingPid() Loading
services/core/java/com/android/server/pm/PackageManagerService.java +42 −26 Original line number Diff line number Diff line Loading @@ -2376,9 +2376,12 @@ public class PackageManagerService extends IPackageManager.Stub final int callingUserId = UserHandle.getUserId(callingUid); for (String packageName : packages) { PackageSetting setting = mSettings.mPackages.get(packageName); if (setting != null && !shouldFilterApplicationLocked(setting, callingUid, callingUserId)) { final boolean filterApp; synchronized (mLock) { final PackageSetting ps = mSettings.getPackageLPr(packageName); filterApp = shouldFilterApplicationLocked(ps, callingUid, callingUserId); } if (!filterApp) { notifyInstallObserver(packageName); } } Loading Loading @@ -8914,10 +8917,10 @@ public class PackageManagerService extends IPackageManager.Stub if (providerInfo == null) { return null; } synchronized (mLock) { if (!mSettings.isEnabledAndMatchLPr(providerInfo, flags, userId)) { return null; } synchronized (mLock) { final PackageSetting ps = mSettings.mPackages.get(providerInfo.packageName); final ComponentName component = new ComponentName(providerInfo.packageName, providerInfo.name); Loading Loading @@ -9004,10 +9007,12 @@ public class PackageManagerService extends IPackageManager.Stub String targetPackage, int flags) { final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getUserId(callingUid); final PackageSetting ps = mSettings.mPackages.get(targetPackage); synchronized (mLock) { final PackageSetting ps = mSettings.getPackageLPr(targetPackage); if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) { return ParceledListSlice.emptyList(); } } return new ParceledListSlice<>(queryInstrumentationInternal(targetPackage, flags, callingUserId)); } Loading Loading @@ -19356,9 +19361,11 @@ public class PackageManagerService extends IPackageManager.Stub mPermissionManager.enforceCrossUserPermission(callingUid, userId, true /* requireFullPermission */, false /* checkShell */, "clear application data"); final boolean filterApp; synchronized (mLock) { final PackageSetting ps = mSettings.getPackageLPr(packageName); final boolean filterApp = (ps != null && shouldFilterApplicationLocked(ps, callingUid, userId)); filterApp = shouldFilterApplicationLocked(ps, callingUid, userId); } if (!filterApp && mProtectedPackages.isPackageDataProtected(userId, packageName)) { throw new SecurityException("Cannot clear data for a protected package: " + packageName); Loading Loading @@ -19638,12 +19645,14 @@ public class PackageManagerService extends IPackageManager.Stub if (mContext.checkCallingOrSelfPermission( android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) { synchronized (mLock) { if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) { Slog.w(TAG, "Ignoring addPreferredActivity() from uid " + callingUid); return; } } mContext.enforceCallingOrSelfPermission( android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null); } Loading Loading @@ -19814,8 +19823,9 @@ public class PackageManagerService extends IPackageManager.Stub /** This method takes a specific user id as well as UserHandle.USER_ALL. */ private void clearPackagePreferredActivities(String packageName, int userId) { final SparseBooleanArray changedUsers = new SparseBooleanArray(); synchronized (mLock) { clearPackagePreferredActivitiesLPw(packageName, changedUsers, userId); } if (changedUsers.size() > 0) { updateDefaultHomeNotLocked(changedUsers); postPreferredActivityChangedBroadcast(userId); Loading Loading @@ -19937,7 +19947,9 @@ public class PackageManagerService extends IPackageManager.Stub // writer try { final SparseBooleanArray changedUsers = new SparseBooleanArray(); synchronized (mLock) { clearPackagePreferredActivitiesLPw(null, changedUsers, userId); } if (changedUsers.size() > 0) { postPreferredActivityChangedBroadcast(userId); } Loading Loading @@ -20942,8 +20954,12 @@ public class PackageManagerService extends IPackageManager.Stub // Limit who can change which apps if (!UserHandle.isSameApp(callingUid, pkgSetting.appId)) { // Don't allow apps that don't have permission to modify other apps if (!allowedByPermission || shouldFilterApplicationLocked(pkgSetting, callingUid, userId)) { final boolean filterApp; synchronized (mLock) { filterApp = (!allowedByPermission || shouldFilterApplicationLocked(pkgSetting, callingUid, userId)); } if (filterApp) { throw new SecurityException( "Attempt to change component state; " + "pid=" + Binder.getCallingPid()