summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java6
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java11
-rw-r--r--tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java10
3 files changed, 13 insertions, 14 deletions
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
index 5664e5736..015bd90d4 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
@@ -91,9 +91,9 @@ public class CellBroadcastAlertDialog extends Activity {
private static final String TAG = "CellBroadcastAlertDialog";
- /** Intent extra for non-emergency alerts sent when user selects the notification. */
+ /** Intent extra indicate this intent should not dismiss the notification */
@VisibleForTesting
- public static final String FROM_NOTIFICATION_EXTRA = "from_notification";
+ public static final String DISMISS_NOTIFICATION_EXTRA = "dismiss_notification";
// Intent extra to identify if notification was sent while trying to move away from the dialog
// without acknowledging the dialog
@@ -872,7 +872,7 @@ public class CellBroadcastAlertDialog extends Activity {
* @param intent Intent containing extras used to identify if notification needs to be cleared
*/
private void clearNotification(Intent intent) {
- if (intent.getBooleanExtra(FROM_NOTIFICATION_EXTRA, false)) {
+ if (intent.getBooleanExtra(DISMISS_NOTIFICATION_EXTRA, false)) {
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(CellBroadcastAlertService.NOTIFICATION_ID);
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
index 0c953e747..c841a1e25 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
@@ -697,7 +697,10 @@ public class CellBroadcastAlertService extends Service {
messageList);
}
- intent.putExtra(CellBroadcastAlertDialog.FROM_NOTIFICATION_EXTRA, true);
+ // if this is an notification from on-going alert alert, do not clear the notification when
+ // tap the notification. the notification should be gone either when users swipe away or
+ // when the foreground dialog dismissed.
+ intent.putExtra(CellBroadcastAlertDialog.DISMISS_NOTIFICATION_EXTRA, !fromDialog);
intent.putExtra(CellBroadcastAlertDialog.FROM_SAVE_STATE_NOTIFICATION_EXTRA, fromSaveState);
PendingIntent pi;
@@ -753,12 +756,8 @@ public class CellBroadcastAlertService extends Service {
deleteIntent, PendingIntent.FLAG_ONE_SHOT
| PendingIntent.FLAG_UPDATE_CURRENT
| PendingIntent.FLAG_IMMUTABLE));
- if (!fromDialog) {
- // If this is a notification from the foreground dialog, no need to set
- // contentIntent to reopen the dialog again.
- builder.setContentIntent(pi);
- }
+ builder.setContentIntent(pi);
// This will break vibration on FEATURE_WATCH, so use it for anything else
builder.setDefaults(Notification.DEFAULT_ALL);
}
diff --git a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
index ba665287d..dda561023 100644
--- a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
+++ b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
@@ -190,7 +190,7 @@ public class CellBroadcastAlertDialogTest extends
public void testOnNewIntent() throws Throwable {
Intent intent = createActivityIntent();
- intent.putExtra(CellBroadcastAlertDialog.FROM_NOTIFICATION_EXTRA, true);
+ intent.putExtra(CellBroadcastAlertDialog.DISMISS_NOTIFICATION_EXTRA, true);
Looper.prepare();
CellBroadcastAlertDialog activity = startActivity(intent, null, null);
@@ -254,7 +254,7 @@ public class CellBroadcastAlertDialogTest extends
public void testOnResume() throws Throwable {
Intent intent = createActivityIntent();
- intent.putExtra(CellBroadcastAlertDialog.FROM_NOTIFICATION_EXTRA, true);
+ intent.putExtra(CellBroadcastAlertDialog.DISMISS_NOTIFICATION_EXTRA, true);
Looper.prepare();
CellBroadcastAlertDialog activity = startActivity(intent, null, null);
@@ -269,7 +269,7 @@ public class CellBroadcastAlertDialogTest extends
public void testOnPause() throws Throwable {
Intent intent = createActivityIntent();
- intent.putExtra(CellBroadcastAlertDialog.FROM_NOTIFICATION_EXTRA, true);
+ intent.putExtra(CellBroadcastAlertDialog.DISMISS_NOTIFICATION_EXTRA, true);
Looper.prepare();
CellBroadcastAlertDialog activity = startActivity(intent, null, null);
@@ -284,7 +284,7 @@ public class CellBroadcastAlertDialogTest extends
public void testOnKeyDown() throws Throwable {
Intent intent = createActivityIntent();
- intent.putExtra(CellBroadcastAlertDialog.FROM_NOTIFICATION_EXTRA, true);
+ intent.putExtra(CellBroadcastAlertDialog.DISMISS_NOTIFICATION_EXTRA, true);
Looper.prepare();
CellBroadcastAlertDialog activity = startActivity(intent, null, null);
@@ -329,7 +329,7 @@ public class CellBroadcastAlertDialogTest extends
CellBroadcastAlertDialog.class);
intent.putParcelableArrayListExtra(CellBroadcastAlertService.SMS_CB_MESSAGE_EXTRA,
mMessageList);
- intent.putExtra(CellBroadcastAlertDialog.FROM_NOTIFICATION_EXTRA, true);
+ intent.putExtra(CellBroadcastAlertDialog.DISMISS_NOTIFICATION_EXTRA, true);
Looper.prepare();
CellBroadcastAlertDialog activity = startActivity(intent, null, null);