OSDN Git Service

LocaleChangeReceiver: check intent action
authorAlexander Martinz <amartinz@shiftphones.com>
Thu, 31 Jan 2019 17:13:35 +0000 (18:13 +0100)
committerAlexander Martinz <amartinz@shiftphones.com>
Thu, 31 Jan 2019 17:56:14 +0000 (18:56 +0100)
Without checking the intent action anyone could send spoofed intents with
empty or different action strings to trigger the BroadcastReceiver.

Change-Id: I4d78ed9d7466df47b17091e998cb67d46e98e612
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
src/org/lineageos/eleven/locale/LocaleChangeReceiver.java

index 7d30523..37902f0 100644 (file)
@@ -30,6 +30,9 @@ public class LocaleChangeReceiver extends BroadcastReceiver {
 
     @Override
     public void onReceive(Context context, Intent intent) {
-        LocalizedStore.getInstance(context).onLocaleChanged();
+        final String action = intent.getAction();
+        if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
+            LocalizedStore.getInstance(context).onLocaleChanged();
+        }
     }
 }