Skip to content
Snippets Groups Projects
Commit fee42b3a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "LatinIME: Fix Implicit PendingIntent Vulnerability" into main am: 1b3568f9

parents 97cb6d0b 1b3568f9
No related branches found
No related tags found
No related merge requests found
......@@ -229,8 +229,14 @@ public final class DictionaryService extends Service {
final long now = System.currentTimeMillis();
final long alarmTime = now + new Random().nextInt(MAX_ALARM_DELAY_MILLIS);
final Intent updateIntent = new Intent(DictionaryPackConstants.UPDATE_NOW_INTENT_ACTION);
// Set the package name to ensure the PendingIntent is only delivered to trusted components
updateIntent.setPackage(context.getPackageName());
int pendingIntentFlags = PendingIntent.FLAG_CANCEL_CURRENT;
if (android.os.Build.VERSION.SDK_INT >= 23) {
pendingIntentFlags |= PendingIntent.FLAG_IMMUTABLE;
}
final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0,
updateIntent, PendingIntent.FLAG_CANCEL_CURRENT);
updateIntent, pendingIntentFlags);
// We set the alarm in the type that doesn't forcefully wake the device
// from sleep, but fires the next time the device actually wakes for any
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment