Loading packages/Shell/src/com/android/shell/BugreportProgressService.java +4 −2 Original line number Diff line number Diff line Loading @@ -737,18 +737,20 @@ public class BugreportProgressService extends Service { final Intent infoIntent = new Intent(mContext, BugreportProgressService.class); infoIntent.setAction(INTENT_BUGREPORT_INFO_LAUNCH); infoIntent.putExtra(EXTRA_ID, info.id); // Simple notification action button clicks are immutable final PendingIntent infoPendingIntent = PendingIntent.getService(mContext, info.id, infoIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final Action infoAction = new Action.Builder(null, mContext.getString(R.string.bugreport_info_action), infoPendingIntent).build(); final Intent screenshotIntent = new Intent(mContext, BugreportProgressService.class); screenshotIntent.setAction(INTENT_BUGREPORT_SCREENSHOT); screenshotIntent.putExtra(EXTRA_ID, info.id); // Simple notification action button clicks are immutable PendingIntent screenshotPendingIntent = mTakingScreenshot ? null : PendingIntent .getService(mContext, info.id, screenshotIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final Action screenshotAction = new Action.Builder(null, mContext.getString(R.string.bugreport_screenshot_action), screenshotPendingIntent).build(); Loading services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +8 −2 Original line number Diff line number Diff line Loading @@ -664,8 +664,12 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku if (targetWidget != null && targetWidget != widget) continue; PendingIntent intent = null; if (onClickIntent != null) { // Rare informational activity click is okay being // immutable; the tradeoff is more security in exchange for // losing bounds-based window animations intent = PendingIntent.getActivity(mContext, widget.appWidgetId, onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT); onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); } RemoteViews views = createMaskedWidgetRemoteViews(iconBitmap, showBadge, intent); if (widget.replaceWithMaskedViewsLocked(views)) { Loading Loading @@ -2409,8 +2413,10 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku intent.setComponent(provider.info.provider); final long token = Binder.clearCallingIdentity(); try { // Broadcast alarms sent by system are immutable provider.broadcast = PendingIntent.getBroadcastAsUser(mContext, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT, provider.info.getProfile()); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, provider.info.getProfile()); } finally { Binder.restoreCallingIdentity(token); } Loading services/core/java/com/android/server/NetworkTimeUpdateService.java +3 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,9 @@ public class NetworkTimeUpdateService extends Binder { mCM = mContext.getSystemService(ConnectivityManager.class); Intent pollIntent = new Intent(ACTION_POLL, null); mPendingPollIntent = PendingIntent.getBroadcast(mContext, POLL_REQUEST, pollIntent, 0); // Broadcast alarms sent by system are immutable mPendingPollIntent = PendingIntent.getBroadcast(mContext, POLL_REQUEST, pollIntent, PendingIntent.FLAG_IMMUTABLE); mPollingIntervalMs = mContext.getResources().getInteger( com.android.internal.R.integer.config_ntpPollingInterval); Loading services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java +3 −2 Original line number Diff line number Diff line Loading @@ -205,9 +205,10 @@ public class CertificateMonitor { dialogIntent.setComponent(targetInfo.getComponentName()); } // Simple notification clicks are immutable PendingIntent notifyIntent = mInjector.pendingIntentGetActivityAsUser(userContext, 0, dialogIntent, PendingIntent.FLAG_UPDATE_CURRENT, null, UserHandle.of(parentUserId)); dialogIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, UserHandle.of(parentUserId)); return new Notification.Builder(userContext, SystemNotificationChannels.SECURITY) .setSmallIcon(smallIconId) Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −6 Original line number Diff line number Diff line Loading @@ -2153,9 +2153,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mInjector.binderWithCleanCallingIdentity(() -> { int affectedUserHandle = parent ? getProfileParentId(userHandle) : userHandle; AlarmManager am = mInjector.getAlarmManager(); // Broadcast alarms sent by system are immutable PendingIntent pi = PendingIntent.getBroadcastAsUser(context, REQUEST_EXPIRE_PASSWORD, new Intent(ACTION_EXPIRED_PASSWORD_NOTIFICATION), PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, UserHandle.of(affectedUserHandle)); am.cancel(pi); if (alarmTime != 0) { Loading Loading @@ -10693,8 +10695,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Slog.wtf(LOG_TAG, "Failed to resolve intent for location settings"); } // Simple notification clicks are immutable PendingIntent locationSettingsIntent = mInjector.pendingIntentGetActivityAsUser(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT, null, user); intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, user); Notification notification = new Notification.Builder(mContext, SystemNotificationChannels.DEVICE_ADMIN) .setSmallIcon(R.drawable.ic_info_outline) Loading Loading @@ -13545,8 +13549,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); final Intent intent = new Intent(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); intent.setPackage(pm.getSystemUiServiceComponent().getPackageName()); final PendingIntent pendingIntent = PendingIntent.getBroadcastAsUser(mContext, 0, intent, 0, UserHandle.CURRENT); // Simple notification clicks are immutable final PendingIntent pendingIntent = PendingIntent.getBroadcastAsUser(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE, UserHandle.CURRENT); Notification notification = new Notification.Builder(mContext, SystemNotificationChannels.DEVICE_ADMIN) .setSmallIcon(R.drawable.ic_info_outline) Loading Loading @@ -14937,9 +14942,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final AlarmManager am = mInjector.getAlarmManager(); final Intent intent = new Intent(ACTION_PROFILE_OFF_DEADLINE); intent.setPackage(mContext.getPackageName()); // Broadcast alarms sent by system are immutable final PendingIntent pi = mInjector.pendingIntentGetBroadcast( mContext, REQUEST_PROFILE_OFF_DEADLINE, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); if (alarmTime == 0) { Slog.i(LOG_TAG, "Profile off deadline alarm is removed."); Loading Loading @@ -15000,8 +15007,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { intent.setPackage(mContext.getPackageName()); intent.putExtra(Intent.EXTRA_USER_HANDLE, profileUserId); // Simple notification action button clicks are immutable final PendingIntent pendingIntent = mInjector.pendingIntentGetBroadcast(mContext, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_CURRENT); 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final String buttonText = mContext.getString(R.string.personal_apps_suspended_turn_profile_on); Loading
packages/Shell/src/com/android/shell/BugreportProgressService.java +4 −2 Original line number Diff line number Diff line Loading @@ -737,18 +737,20 @@ public class BugreportProgressService extends Service { final Intent infoIntent = new Intent(mContext, BugreportProgressService.class); infoIntent.setAction(INTENT_BUGREPORT_INFO_LAUNCH); infoIntent.putExtra(EXTRA_ID, info.id); // Simple notification action button clicks are immutable final PendingIntent infoPendingIntent = PendingIntent.getService(mContext, info.id, infoIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final Action infoAction = new Action.Builder(null, mContext.getString(R.string.bugreport_info_action), infoPendingIntent).build(); final Intent screenshotIntent = new Intent(mContext, BugreportProgressService.class); screenshotIntent.setAction(INTENT_BUGREPORT_SCREENSHOT); screenshotIntent.putExtra(EXTRA_ID, info.id); // Simple notification action button clicks are immutable PendingIntent screenshotPendingIntent = mTakingScreenshot ? null : PendingIntent .getService(mContext, info.id, screenshotIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final Action screenshotAction = new Action.Builder(null, mContext.getString(R.string.bugreport_screenshot_action), screenshotPendingIntent).build(); Loading
services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +8 −2 Original line number Diff line number Diff line Loading @@ -664,8 +664,12 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku if (targetWidget != null && targetWidget != widget) continue; PendingIntent intent = null; if (onClickIntent != null) { // Rare informational activity click is okay being // immutable; the tradeoff is more security in exchange for // losing bounds-based window animations intent = PendingIntent.getActivity(mContext, widget.appWidgetId, onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT); onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); } RemoteViews views = createMaskedWidgetRemoteViews(iconBitmap, showBadge, intent); if (widget.replaceWithMaskedViewsLocked(views)) { Loading Loading @@ -2409,8 +2413,10 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku intent.setComponent(provider.info.provider); final long token = Binder.clearCallingIdentity(); try { // Broadcast alarms sent by system are immutable provider.broadcast = PendingIntent.getBroadcastAsUser(mContext, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT, provider.info.getProfile()); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, provider.info.getProfile()); } finally { Binder.restoreCallingIdentity(token); } Loading
services/core/java/com/android/server/NetworkTimeUpdateService.java +3 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,9 @@ public class NetworkTimeUpdateService extends Binder { mCM = mContext.getSystemService(ConnectivityManager.class); Intent pollIntent = new Intent(ACTION_POLL, null); mPendingPollIntent = PendingIntent.getBroadcast(mContext, POLL_REQUEST, pollIntent, 0); // Broadcast alarms sent by system are immutable mPendingPollIntent = PendingIntent.getBroadcast(mContext, POLL_REQUEST, pollIntent, PendingIntent.FLAG_IMMUTABLE); mPollingIntervalMs = mContext.getResources().getInteger( com.android.internal.R.integer.config_ntpPollingInterval); Loading
services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java +3 −2 Original line number Diff line number Diff line Loading @@ -205,9 +205,10 @@ public class CertificateMonitor { dialogIntent.setComponent(targetInfo.getComponentName()); } // Simple notification clicks are immutable PendingIntent notifyIntent = mInjector.pendingIntentGetActivityAsUser(userContext, 0, dialogIntent, PendingIntent.FLAG_UPDATE_CURRENT, null, UserHandle.of(parentUserId)); dialogIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, UserHandle.of(parentUserId)); return new Notification.Builder(userContext, SystemNotificationChannels.SECURITY) .setSmallIcon(smallIconId) Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −6 Original line number Diff line number Diff line Loading @@ -2153,9 +2153,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mInjector.binderWithCleanCallingIdentity(() -> { int affectedUserHandle = parent ? getProfileParentId(userHandle) : userHandle; AlarmManager am = mInjector.getAlarmManager(); // Broadcast alarms sent by system are immutable PendingIntent pi = PendingIntent.getBroadcastAsUser(context, REQUEST_EXPIRE_PASSWORD, new Intent(ACTION_EXPIRED_PASSWORD_NOTIFICATION), PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, UserHandle.of(affectedUserHandle)); am.cancel(pi); if (alarmTime != 0) { Loading Loading @@ -10693,8 +10695,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Slog.wtf(LOG_TAG, "Failed to resolve intent for location settings"); } // Simple notification clicks are immutable PendingIntent locationSettingsIntent = mInjector.pendingIntentGetActivityAsUser(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT, null, user); intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, user); Notification notification = new Notification.Builder(mContext, SystemNotificationChannels.DEVICE_ADMIN) .setSmallIcon(R.drawable.ic_info_outline) Loading Loading @@ -13545,8 +13549,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); final Intent intent = new Intent(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); intent.setPackage(pm.getSystemUiServiceComponent().getPackageName()); final PendingIntent pendingIntent = PendingIntent.getBroadcastAsUser(mContext, 0, intent, 0, UserHandle.CURRENT); // Simple notification clicks are immutable final PendingIntent pendingIntent = PendingIntent.getBroadcastAsUser(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE, UserHandle.CURRENT); Notification notification = new Notification.Builder(mContext, SystemNotificationChannels.DEVICE_ADMIN) .setSmallIcon(R.drawable.ic_info_outline) Loading Loading @@ -14937,9 +14942,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final AlarmManager am = mInjector.getAlarmManager(); final Intent intent = new Intent(ACTION_PROFILE_OFF_DEADLINE); intent.setPackage(mContext.getPackageName()); // Broadcast alarms sent by system are immutable final PendingIntent pi = mInjector.pendingIntentGetBroadcast( mContext, REQUEST_PROFILE_OFF_DEADLINE, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); if (alarmTime == 0) { Slog.i(LOG_TAG, "Profile off deadline alarm is removed."); Loading Loading @@ -15000,8 +15007,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { intent.setPackage(mContext.getPackageName()); intent.putExtra(Intent.EXTRA_USER_HANDLE, profileUserId); // Simple notification action button clicks are immutable final PendingIntent pendingIntent = mInjector.pendingIntentGetBroadcast(mContext, 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_CURRENT); 0 /* requestCode */, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final String buttonText = mContext.getString(R.string.personal_apps_suspended_turn_profile_on);