Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da5421c3 authored by Beverly's avatar Beverly Committed by android-build-merger
Browse files

Merge "Translate SystemUi NotifChannels on locale change" into pi-dev

am: 39e2366d

Change-Id: I90c1b6c29af869eb7cb27e74300277162e77410a
parents 6939c142 39e2366d
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -69,8 +69,8 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
        SystemUIFactory.createFromConfig(this);

        if (Process.myUserHandle().equals(UserHandle.SYSTEM)) {
            IntentFilter filter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
            filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
            IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
            bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
            registerReceiver(new BroadcastReceiver() {
                @Override
                public void onReceive(Context context, Intent intent) {
@@ -86,11 +86,21 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
                        }
                    }

                    IntentFilter localeChangedFilter = new IntentFilter(
                            Intent.ACTION_LOCALE_CHANGED);
                    registerReceiver(mLocaleChangeReceiver, localeChangedFilter);

                }
            }, bootCompletedFilter);

            IntentFilter localeChangedFilter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED);
            registerReceiver(new BroadcastReceiver() {
                @Override
                public void onReceive(Context context, Intent intent) {
                    if (Intent.ACTION_LOCALE_CHANGED.equals(intent.getAction())) {
                        if (!mBootCompleted) return;
                        // Update names of SystemUi notification channels
                        NotificationChannels.createAll(context);
                    }
            }, filter);
                }
            }, localeChangedFilter);
        } else {
            // We don't need to startServices for sub-process that is doing some tasks.
            // (screenshots, sweetsweetdesserts or tuner ..)
@@ -239,14 +249,4 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
    public SystemUI[] getServices() {
        return mServices;
    }

    private final BroadcastReceiver mLocaleChangeReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_LOCALE_CHANGED.equals(intent.getAction())) {
                // Update names of SystemUi notification channels
                NotificationChannels.createAll(context);
            }
        }
    };
}