aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2019-02-24 21:34:10 +0100
committerMichael W <baddaemon87@gmail.com>2019-06-26 23:20:52 +0200
commit9a2567bf78570e905581ec8734f6f34075db0c8e (patch)
tree97ea36d0ea0061ab4a094d5555bad056a96b4755
parentf3b2904187cc949ed02843c39660fd685d9e3212 (diff)
downloadlineage-sdk-9a2567bf78570e905581ec8734f6f34075db0c8e.tar.gz
lineage-sdk-9a2567bf78570e905581ec8734f6f34075db0c8e.tar.bz2
lineage-sdk-9a2567bf78570e905581ec8734f6f34075db0c8e.zip
Trust: Onboarding: Listen for locale changes
* When SuW is not yet done, the notification is already posted * This results in an english notification text when the SuW is finished because the notification doesn't update when the locale changes -> Listen for locale changes and post the notification again (= update) Change-Id: I920a52c5c85c91adb7333a20d410a5464e80a812
-rw-r--r--lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java b/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java
index 2dcb9385..51e6d321 100644
--- a/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java
+++ b/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java
@@ -21,9 +21,11 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
+import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import android.os.IBinder;
@@ -98,6 +100,7 @@ public class TrustInterfaceService extends LineageSystemService {
// Onboard
if (!hasOnboardedUser()) {
postOnBoardingNotification();
+ registerLocaleChangedReceiver();
return;
}
@@ -354,6 +357,26 @@ public class TrustInterfaceService extends LineageSystemService {
LineageSettings.System.TRUST_INTERFACE_HINTED, 0) == 1;
}
+ private void registerLocaleChangedReceiver() {
+ IntentFilter filter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED);
+ mContext.registerReceiver(mReceiver, filter);
+ }
+
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction() == Intent.ACTION_LOCALE_CHANGED) {
+ if (!hasOnboardedUser()) {
+ // When are not onboarded, we want to change the language of the notification
+ postOnBoardingNotification();
+ } else {
+ // We don't care anymore about language changes
+ context.unregisterReceiver(this);
+ }
+ }
+ }
+ };
+
/* Service */
private final IBinder mService = new ITrustInterface.Stub() {