summaryrefslogtreecommitdiff
path: root/packages/Shell/tests
diff options
context:
space:
mode:
authorRhed Jao <rhedjao@google.com>2020-12-04 21:32:12 +0800
committerRhed Jao <rhedjao@google.com>2020-12-21 04:19:44 +0000
commite9a2038f8a2f2ece8de044e3ace57ac285391db7 (patch)
tree7673a5e5ea67a7bab0c4b6ea6bfa9bc44c9fa53e /packages/Shell/tests
parent2150ce56dba111c6ec87aabecb0c78e7c891219a (diff)
Fixes BugreportReceiverTest failed
Instead of sending INTENT_BUGREPORT_REQUESTED, invoke BugreportRequestedReceiver instance directly. Bug: 174832302 Bug: 175287931 Test: atest BugreportReceiverTest Change-Id: I99a052d74b71d503a655a769064a74246da150e5 Merged-In: I99a052d74b71d503a655a769064a74246da150e5
Diffstat (limited to 'packages/Shell/tests')
-rw-r--r--packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
index 3b02e3b46557..43147cdfc86d 100644
--- a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
+++ b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
@@ -576,9 +576,10 @@ public class BugreportReceiverTest {
*/
private void sendBugreportStarted() throws Exception {
Intent intent = new Intent(INTENT_BUGREPORT_REQUESTED);
- intent.setPackage("com.android.shell");
- intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
- mContext.sendBroadcast(intent);
+ // Ideally, we should invoke BugreportRequestedReceiver by sending
+ // INTENT_BUGREPORT_REQUESTED. But the intent has been protected broadcast by the system
+ // starting from S.
+ new BugreportRequestedReceiver().onReceive(mContext, intent);
ArgumentCaptor<IDumpstateListener> listenerCap = ArgumentCaptor.forClass(
IDumpstateListener.class);