From 4fe5d002a2e5bf342ae4ee10e780ff62aa713cf4 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Thu, 1 Dec 2022 18:13:42 +0000 Subject: Refactor Bug report flow to work for all ADMIN users With the existing implementation only the primary user is allowed to take bug report and approve authorization for bug and inicdent reports to be taken. With hsum (Headlesss SYSTEM user mode) implementation primary user will always run in background. we need to refactor the bugreport flow so that it can be triggered by any admin user. The following components has been refactored to allow any ADMIN user to trigger the bugreport, see progress notification, pass user inputs in case of interactive bugreport and share the bugreport. Though the actual bugreport (dumpstate) will always run on user 0 only the user visible components and components responsible to trigger the bugreport and track progress ex- shell, any approved bundled app like betterbug will run on the current foreground admin user. 1. ActivityManagerService.requestBugReportWithDescription has been modified to send BUGREPORT_REQUESTED broadcast to the caller user. 2. BugReportManagerServiceImpl has been modified to enable any admin user to initiate the bug report. 3. BugReportProgressService has been modified to send BUGREPORT_FINISHED broadcast to the shell context user. 4. IncidentCompanionService and PendingReports has been modifed to let any admin user provide feedback and authorization for bug and inicdent reports to be taken. Bug: 256583570 Test: atest BugreportManagerTest Test: Manually tested that admin users are allowed to take bug report. Change-Id: Ib22775e7ad998369404cf15cdc220c9b4019b296 --- packages/Shell/src/com/android/shell/BugreportProgressService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages/Shell/src') diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index 68679c794c35..6f7d20a950d5 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -455,8 +455,7 @@ public class BugreportProgressService extends Service { intent.putExtra(DevicePolicyManager.EXTRA_REMOTE_BUGREPORT_HASH, bugreportHash); intent.putExtra(DevicePolicyManager.EXTRA_REMOTE_BUGREPORT_NONCE, nonce); intent.putExtra(EXTRA_BUGREPORT, bugreportFileName); - context.sendBroadcastAsUser(intent, UserHandle.SYSTEM, - android.Manifest.permission.DUMP); + context.sendBroadcast(intent, android.Manifest.permission.DUMP); } /** -- cgit v1.2.3-59-g8ed1b