Add the mutability flag for SettingsSliceProvider

Starting Android S, all PendingIntent should have the mutability flag
assigned to prevent from vulnerability.

Fixes: 172811605
Fixes: 172206649
Test: 1. Play on the slices in Settings search.
2. Make a permission request intent of Settings wifi slice in the
slice-viewer app, clicking on it and make sure it gets redirect to
Settings without crashes.

Change-Id: I86f915bc062a6e632b5ca9c74e232db1036f08de
This commit is contained in:
Yi-Ling Chuang
2021-01-07 15:47:19 +08:00
parent cfedc19ab9
commit 843616eb69
2 changed files with 3 additions and 2 deletions

View File

@@ -343,7 +343,7 @@ public class SettingsSliceProvider extends SliceProvider {
final Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS)
.setPackage(Utils.SETTINGS_PACKAGE_NAME);
final PendingIntent noOpIntent = PendingIntent.getActivity(getContext(),
0 /* requestCode */, settingsIntent, 0 /* flags */);
0 /* requestCode */, settingsIntent, PendingIntent.FLAG_IMMUTABLE);
return noOpIntent;
}