diff options
| author | Paul Chang <changpa@google.com> | 2020-04-11 18:05:24 +0800 |
|---|---|---|
| committer | Paul Chang <changpa@google.com> | 2020-04-23 18:14:57 +0800 |
| commit | 6dcc04794015d605aeabc1ca4c0217d5aa7c8797 (patch) | |
| tree | eb5aeaeb15df8973d5d901e8f11862e8b643a019 /core/java/android | |
| parent | ce6aa16b8074a9ec1c11f5db045d8924f7ef9d35 (diff) | |
Send intent to let calling app show UI safely without interfering the bugreport/screenshot generation.
- Calling app needs the intent from platform to show UI safely without interfering the bugreport/screenshot generation.
- Currently IncidentCompanionService can only send the intent to app of personal profile when there is work profile.
- But calling app may be from work profile.
- So change to use BugreportManager to send the intent to calling app.
BUG: 153809412
Test: Flash, press bugreport shortcut and confirm calling app of work profile can receive the intent.
Change-Id: I45b2b7ab8e017ba93c1e71ad53f4aa3607af9106
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/os/BugreportManager.java | 25 |
1 files changed, 25 insertions, 0 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); + } + } } } |
