diff options
author | 2024-07-03 12:51:18 +0000 | |
---|---|---|
committer | 2024-07-03 12:51:18 +0000 | |
commit | 5be036d5e33e174286f0f545ee4c4cd30d09c8d2 (patch) | |
tree | 6f66a652e5243a35e98b704a9bb6ef728a2a8fa5 | |
parent | ba40b2fea4f7407d7a61aeaafd256201e7707402 (diff) | |
parent | fee42b3a1a1f36866b80ffa883f0535a6987fd3f (diff) | |
download | latinime-5be036d5e33e174286f0f545ee4c4cd30d09c8d2.tar.gz latinime-5be036d5e33e174286f0f545ee4c4cd30d09c8d2.tar.xz latinime-5be036d5e33e174286f0f545ee4c4cd30d09c8d2.zip |
Merge "LatinIME: Fix Implicit PendingIntent Vulnerability" into main am: 1b3568f9c2 am: fee42b3a1a
Original change: https://android-review.googlesource.com/c/platform/packages/inputmethods/LatinIME/+/3019664
Change-Id: Ic393ce61210263a49384bbdd232a49e1ef10ae13
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/DictionaryService.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/DictionaryService.java b/java/src/com/android/inputmethod/dictionarypack/DictionaryService.java index fe988ac70..5ab55bc44 100644 --- a/java/src/com/android/inputmethod/dictionarypack/DictionaryService.java +++ b/java/src/com/android/inputmethod/dictionarypack/DictionaryService.java @@ -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 |