summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/os/BugreportManager.java25
-rw-r--r--services/core/java/com/android/server/incident/IncidentCompanionService.java9
-rw-r--r--services/core/java/com/android/server/os/BugreportManagerServiceImpl.java6
3 files changed, 31 insertions, 9 deletions
diff --git a/core/java/android/os/BugreportManager.java b/core/java/android/os/BugreportManager.java
index fab906b9e122..9e996d15fa84 100644
--- a/core/java/android/os/BugreportManager.java
+++ b/core/java/android/os/BugreportManager.java
@@ -27,6 +27,7 @@ import android.annotation.SystemService;
import android.annotation.TestApi;
import android.app.ActivityManager;
import android.content.Context;
+import android.content.Intent;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
@@ -52,6 +53,8 @@ import java.util.concurrent.Executor;
public final class BugreportManager {
private static final String TAG = "BugreportManager";
+ private static final String INTENT_UI_INTENSIVE_BUGREPORT_DUMPS_FINISHED =
+ "com.android.internal.intent.action.UI_INTENSIVE_BUGREPORT_DUMPS_FINISHED";
private final Context mContext;
private final IDumpstate mBinder;
@@ -284,5 +287,27 @@ public final class BugreportManager {
Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
});
}
+
+ @Override
+ public void onUiIntensiveBugreportDumpsFinished(String callingPackage)
+ throws RemoteException {
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mExecutor.execute(() -> {
+ // Send intent to let calling app to show UI safely without interfering with
+ // the bugreport/screenshot generation.
+ // TODO(b/154298410): When S is ready for API change, add a method in
+ // BugreportCallback so we can just call the callback instead of using
+ // broadcast.
+ Intent intent = new Intent(INTENT_UI_INTENSIVE_BUGREPORT_DUMPS_FINISHED);
+ intent.setPackage(callingPackage);
+ intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
+ mContext.sendBroadcast(intent, android.Manifest.permission.DUMP);
+ });
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
}
}
diff --git a/services/core/java/com/android/server/incident/IncidentCompanionService.java b/services/core/java/com/android/server/incident/IncidentCompanionService.java
index ad08663a7d76..87fe785ca614 100644
--- a/services/core/java/com/android/server/incident/IncidentCompanionService.java
+++ b/services/core/java/com/android/server/incident/IncidentCompanionService.java
@@ -50,9 +50,6 @@ import java.util.List;
*/
public class IncidentCompanionService extends SystemService {
static final String TAG = "IncidentCompanionService";
- // TODO(b/152289743): Expose below intent.
- private static final String INTENT_CHECK_USER_CONSENT =
- "com.android.internal.intent.action.CHECK_USER_CONSENT";
/**
* Dump argument for proxying restricted image dumps to the services
@@ -92,12 +89,6 @@ public class IncidentCompanionService extends SystemService {
final long ident = Binder.clearCallingIdentity();
try {
- Intent intent = new Intent(INTENT_CHECK_USER_CONSENT);
- intent.setPackage(callingPackage);
- intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
- intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
- getContext().sendBroadcast(intent, android.Manifest.permission.DUMP);
-
mPendingReports.authorizeReport(callingUid, callingPackage,
receiverClass, reportId, flags, listener);
} finally {
diff --git a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
index fce488da87d5..47fcc0872029 100644
--- a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
+++ b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
@@ -297,6 +297,12 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub {
}
@Override
+ public void onUiIntensiveBugreportDumpsFinished(String callingPackage)
+ throws RemoteException {
+ mListener.onUiIntensiveBugreportDumpsFinished(callingPackage);
+ }
+
+ @Override
public void binderDied() {
synchronized (mLock) {
if (!mDone) {