diff options
| author | 2019-08-22 15:05:38 +0100 | |
|---|---|---|
| committer | 2019-09-20 12:40:51 +0100 | |
| commit | 16207e333e8164cf4ae4e5ad1d38fa8c13b4cdf2 (patch) | |
| tree | e072fdb2eb80b47a6ad05e2af5dba378670254ec | |
| parent | 70f1945f172a9fa2550c344e29f791778edf5371 (diff) | |
Remove enum logic from callers of requestbugreport()
Make callers use wrapper functions in ActivityManagerService.java.
requestTelephonyBugReport and requestWifiBugreports have already
existing wrapper functions which take 2 string parameters for title and
description. Passing empty strings in the cases where no title and
description is set.
Bug: 141355059
Bug: 137825297
Test: * builds
* `adb shell am bug-report` takes full bugreport. Shows share
notification
* `adb shell am bug-report --progress` takes interactive
bugreport. Shows progress notification and share notification
* `adb shell am bug-report --telephony` takes telephony bugreport.
Shows share notification.
Change-Id: Ibe479f4335613bfbddc65607ba89ad1805fcba9e
5 files changed, 15 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index c9c6a0c6868b..8eeb6293ee6d 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -665,8 +665,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, // Take an "interactive" bugreport. MetricsLogger.action(mContext, MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_INTERACTIVE); - ActivityManager.getService().requestBugReport( - ActivityManager.BUGREPORT_OPTION_INTERACTIVE); + ActivityManager.getService().requestInteractiveBugReport(); } catch (RemoteException e) { } } @@ -683,8 +682,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, try { // Take a "full" bugreport. MetricsLogger.action(mContext, MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_FULL); - ActivityManager.getService().requestBugReport( - ActivityManager.BUGREPORT_OPTION_FULL); + ActivityManager.getService().requestFullBugReport(); } catch (RemoteException e) { } return false; diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java index d46c62662faf..058afd3b4d68 100644 --- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java +++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java @@ -1016,18 +1016,23 @@ final class ActivityManagerShellCommand extends ShellCommand { int runBugReport(PrintWriter pw) throws RemoteException { String opt; - int bugreportType = ActivityManager.BUGREPORT_OPTION_FULL; + boolean fullBugreport = true; while ((opt=getNextOption()) != null) { if (opt.equals("--progress")) { - bugreportType = ActivityManager.BUGREPORT_OPTION_INTERACTIVE; + fullBugreport = false; + mInterface.requestInteractiveBugReport(); } else if (opt.equals("--telephony")) { - bugreportType = ActivityManager.BUGREPORT_OPTION_TELEPHONY; + fullBugreport = false; + // no title and description specified + mInterface.requestTelephonyBugReport("" /* no title */, "" /* no descriptions */); } else { getErrPrintWriter().println("Error: Unknown option: " + opt); return -1; } } - mInterface.requestBugReport(bugreportType); + if (fullBugreport) { + mInterface.requestFullBugReport(); + } pw.println("Your lovely bug report is being created; please be patient."); return 0; } diff --git a/services/core/java/com/android/server/policy/LegacyGlobalActions.java b/services/core/java/com/android/server/policy/LegacyGlobalActions.java index 9cb2441d5662..bbee393bb98d 100644 --- a/services/core/java/com/android/server/policy/LegacyGlobalActions.java +++ b/services/core/java/com/android/server/policy/LegacyGlobalActions.java @@ -370,8 +370,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn // Take an "interactive" bugreport. MetricsLogger.action(mContext, MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_INTERACTIVE); - ActivityManager.getService().requestBugReport( - ActivityManager.BUGREPORT_OPTION_INTERACTIVE); + ActivityManager.getService().requestInteractiveBugReport(); } catch (RemoteException e) { } } @@ -388,8 +387,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn try { // Take a "full" bugreport. MetricsLogger.action(mContext, MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_FULL); - ActivityManager.getService().requestBugReport( - ActivityManager.BUGREPORT_OPTION_FULL); + ActivityManager.getService().requestFullBugReport(); } catch (RemoteException e) { } return false; diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index ab531899b496..72b29206af6e 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -3120,8 +3120,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { || Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) == 1) { try { - ActivityManager.getService() - .requestBugReport(ActivityManager.BUGREPORT_OPTION_FULL); + ActivityManager.getService().requestFullBugReport(); } catch (RemoteException e) { Slog.e(TAG, "Error taking bugreport", e); } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 478bc88fe815..42c85dbcdea1 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -7403,8 +7403,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final long callingIdentity = mInjector.binderClearCallingIdentity(); try { - mInjector.getIActivityManager().requestBugReport( - ActivityManager.BUGREPORT_OPTION_REMOTE); + mInjector.getIActivityManager().requestRemoteBugReport(); mRemoteBugreportServiceIsActive.set(true); mRemoteBugreportSharingAccepted.set(false); |