summaryrefslogtreecommitdiff
path: root/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java')
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
index b2874f250..5664e5736 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
@@ -25,10 +25,12 @@ import android.app.NotificationManager;
import android.app.StatusBarManager;
import android.app.PendingIntent;
import android.app.RemoteAction;
+import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -161,6 +163,18 @@ public class CellBroadcastAlertDialog extends Activity {
// Show the opt-out dialog
private AlertDialog mOptOutDialog;
+ /** BroadcastReceiver for screen off events. When screen was off, remove FLAG_TURN_SCREEN_ON to
+ * start from a clean state. Otherwise, the window flags from the first alert will be
+ * automatically applied to the following alerts handled at onNewIntent.
+ */
+ private BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent){
+ Log.d(TAG, "onSreenOff: remove FLAG_TURN_SCREEN_ON flag");
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+ }
+ };
+
/**
* Animation handler for the flashing warning icon (emergency alerts only).
*/
@@ -360,6 +374,8 @@ public class CellBroadcastAlertDialog extends Activity {
clearNotification(intent);
}
+ registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
+
if (mMessageList == null || mMessageList.size() == 0) {
Log.e(TAG, "onCreate failed as message list is null or empty");
finish();
@@ -976,6 +992,7 @@ public class CellBroadcastAlertDialog extends Activity {
@Override
public void onDestroy() {
+ unregisterReceiver(mScreenOffReceiver);
super.onDestroy();
}