From 319b13bfff474d661c595a21381f082bbd3440a3 Mon Sep 17 00:00:00 2001 From: Paul Chang Date: Tue, 24 Mar 2020 15:08:13 +0000 Subject: [PATCH] Revert "Let bug report shortcut handle the case that bug report handler app is not available" This reverts commit 14a4cc57ed60a850ff64b047872175ab4ac0de98. Reason for revert: b/152205774 Bug: b/152205774 Change-Id: I96034c7a3b175ec2c0bac67584179033f39fb117 --- .../server/am/BugReportHandlerUtil.java | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/services/core/java/com/android/server/am/BugReportHandlerUtil.java b/services/core/java/com/android/server/am/BugReportHandlerUtil.java index 03f4a54086a8a..ba89fce0b3f8c 100644 --- a/services/core/java/com/android/server/am/BugReportHandlerUtil.java +++ b/services/core/java/com/android/server/am/BugReportHandlerUtil.java @@ -16,20 +16,15 @@ package com.android.server.am; -import static android.app.AppOpsManager.OP_NONE; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; -import android.app.Activity; import android.app.BroadcastOptions; -import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Binder; -import android.os.BugreportManager; -import android.os.BugreportParams; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; @@ -115,17 +110,9 @@ public final class BugReportHandlerUtil { options.setBackgroundActivityStartsAllowed(true); final long identity = Binder.clearCallingIdentity(); try { - // Handler app's BroadcastReceiver should call setResultCode(Activity.RESULT_OK) to - // let ResultBroadcastReceiver know the handler app is available. - context.sendOrderedBroadcastAsUser(intent, - UserHandle.of(handlerUser), + context.sendBroadcastAsUser(intent, UserHandle.of(handlerUser), android.Manifest.permission.DUMP, - OP_NONE, options.toBundle(), - new ResultBroadcastReceiver(), - /* scheduler= */ null, - Activity.RESULT_CANCELED, - /* initialData= */ null, - /* initialExtras= */ null); + options.toBundle()); } catch (RuntimeException e) { Slog.e(TAG, "Error while trying to launch bugreport handler app.", e); return false; @@ -189,19 +176,4 @@ public final class BugReportHandlerUtil { Binder.restoreCallingIdentity(identity); } } - - private static class ResultBroadcastReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - if (getResultCode() == Activity.RESULT_OK) { - return; - } - - Slog.w(TAG, "Request bug report because handler app seems to be not available."); - BugreportManager bugreportManager = context.getSystemService(BugreportManager.class); - bugreportManager.requestBugreport( - new BugreportParams(BugreportParams.BUGREPORT_MODE_INTERACTIVE), - /* shareTitle= */null, /* shareDescription= */ null); - } - } }