From fb9433915484e7c4c8cbbf9fc30e7d0b0e64cbc1 Mon Sep 17 00:00:00 2001 From: Jordan Liu Date: Wed, 22 Apr 2020 11:20:14 -0700 Subject: Add tests to CellBroadcastAlertDialogTest Bug: 148482334 Test: atest CellBroadcastAlertDialogTest Change-Id: Iba804e1e8f10461b06af280e158c5bc883ff7136 --- .../cellbroadcastreceiver/CellBroadcastAlertDialog.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/com/android') diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java index c4896ebf3..160d54cf0 100644 --- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java +++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java @@ -59,6 +59,8 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; +import com.android.internal.annotations.VisibleForTesting; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; @@ -76,7 +78,8 @@ public class CellBroadcastAlertDialog extends Activity { private static final String TAG = "CellBroadcastAlertDialog"; /** Intent extra for non-emergency alerts sent when user selects the notification. */ - static final String FROM_NOTIFICATION_EXTRA = "from_notification"; + @VisibleForTesting + public static final String FROM_NOTIFICATION_EXTRA = "from_notification"; // Intent extra to identify if notification was sent while trying to move away from the dialog // without acknowledging the dialog @@ -598,7 +601,8 @@ public class CellBroadcastAlertDialog extends Activity { * @param intent The new intent containing one or more {@link SmsCbMessage}. */ @Override - protected void onNewIntent(Intent intent) { + @VisibleForTesting + public void onNewIntent(Intent intent) { ArrayList newMessageList = intent.getParcelableArrayListExtra( CellBroadcastAlertService.SMS_CB_MESSAGE_EXTRA); if (newMessageList != null) { @@ -662,7 +666,8 @@ public class CellBroadcastAlertDialog extends Activity { * Stop animating warning icon and stop the {@link CellBroadcastAlertAudio} * service if necessary. */ - void dismiss() { + @VisibleForTesting + public void dismiss() { Log.d(TAG, "dismiss"); // Stop playing alert sound/vibration/speech (if started) stopService(new Intent(this, CellBroadcastAlertAudio.class)); -- cgit v1.2.3