diff options
| author | 2016-12-08 16:26:03 +0000 | |
|---|---|---|
| committer | 2016-12-08 16:26:03 +0000 | |
| commit | 077396733aa323930d0de86c5161024bf49cd52b (patch) | |
| tree | f9d3bca5f8bb1039d87477fd33ace87fc23a8490 | |
| parent | d1002aede054123049f63aed484a53b4f5be7d67 (diff) | |
| parent | 889c64a30bb3e41974d0dd2e0b629ed3ff1d8055 (diff) | |
EmergencyCryptkeeperText: Make sure we update if airplane mode changes am: 72abcdaec7
am: 889c64a30b
Change-Id: Ied9deb2409509dcdee09f34afb02c4fed21772ce
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java index 8abfb89b3f69..a2d1baf96da8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.policy; import android.annotation.Nullable; +import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; @@ -41,12 +42,20 @@ import java.util.List; public class EmergencyCryptkeeperText extends TextView { private KeyguardUpdateMonitor mKeyguardUpdateMonitor; - private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { + private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override public void onPhoneStateChanged(int phoneState) { update(); } }; + private final BroadcastReceiver mReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())) { + update(); + } + } + }; public EmergencyCryptkeeperText(Context context, @Nullable AttributeSet attrs) { super(context, attrs); @@ -58,6 +67,8 @@ public class EmergencyCryptkeeperText extends TextView { super.onAttachedToWindow(); mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext); mKeyguardUpdateMonitor.registerCallback(mCallback); + getContext().registerReceiver(mReceiver, + new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED)); update(); } @@ -67,6 +78,7 @@ public class EmergencyCryptkeeperText extends TextView { if (mKeyguardUpdateMonitor != null) { mKeyguardUpdateMonitor.removeCallback(mCallback); } + getContext().unregisterReceiver(mReceiver); } public void update() { |