summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryoungtaecha <youngtaecha@google.com>2023-11-12 10:56:34 +0000
committeryoungtaecha <youngtaecha@google.com>2023-11-22 10:21:25 +0000
commit18e1ef3569cc2483bc6820dfaf1548b57eb5b150 (patch)
tree651f425a3e515b3646846208aa46454e91c24630
parentbc5aeaba76fa0e4bb86458e53d79b25d20581e0a (diff)
downloadCellBroadcastReceiver-18e1ef3569cc2483bc6820dfaf1548b57eb5b150.tar.gz
Apply configuration for the pictogram to show properly
Bug: 305169680 Test: Manual Test: atest CellBroadcastReceiverOemUnitTests Change-Id: Id24f5727a33d9778cf4451ff52741bb49e828567
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java6
-rw-r--r--tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java9
2 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
index 543651b6d..e78db5790 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java
@@ -922,8 +922,12 @@ public class CellBroadcastAlertDialog extends Activity {
((TextView) findViewById(R.id.dismissButton)).setText(dismissButtonText);
-
setPictogram(context, message);
+
+ if (this.hasWindowFocus()) {
+ Configuration config = res.getConfiguration();
+ setPictogramAreaLayout(config.orientation);
+ }
}
/**
diff --git a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
index ad1f3fa6a..63c124cae 100644
--- a/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
+++ b/tests/unit/src/com/android/cellbroadcastreceiver/unit/CellBroadcastAlertDialogTest.java
@@ -370,16 +370,21 @@ public class CellBroadcastAlertDialogTest extends
CellBroadcastAlertDialog activity = startActivity(intent, null, null);
waitForMs(100);
+ ImageView image = activity.findViewById(R.id.pictogramImage);
+ image.setVisibility(View.VISIBLE);
+ assertEquals(View.VISIBLE, image.getVisibility());
+
// add more messages to list
mMessageList.add(CellBroadcastAlertServiceTest.createMessageForCmasMessageClass(12413,
- SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY,
- SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY));
+ SmsCbConstants.MESSAGE_ID_ETWS_EARTHQUAKE_WARNING,
+ SmsCbConstants.MESSAGE_ID_ETWS_EARTHQUAKE_WARNING));
intent.putParcelableArrayListExtra(CellBroadcastAlertService.SMS_CB_MESSAGE_EXTRA,
new ArrayList<>(mMessageList));
activity.onNewIntent(intent);
verify(mMockedNotificationManager, atLeastOnce()).cancel(
eq(CellBroadcastAlertService.NOTIFICATION_ID));
+ assertNotNull(image.getLayoutParams());
}
public void testAnimationHandler() throws Throwable {