diff options
| author | 2019-09-06 12:15:29 +0100 | |
|---|---|---|
| committer | 2019-09-27 11:05:21 +0100 | |
| commit | bcb384b95ad05a92e4a5e4a85c4c5326adb39cc8 (patch) | |
| tree | 760727d1574ca5a4bd02909e277eda4c58e90436 | |
| parent | b1c0a256f2de5dafc90f791328400ead96a40e15 (diff) | |
Use bugreport mode enums from BugreportParams
All callers of requestBugReport(enum) have been migrated to use
wrappers, so it's safe to switch the internal enum we use for bugreport
mode from ActivityManager constants to BugreportParams enum.
Note that in requestBugReport() we have been passing ActivityManager
constant enum for INTERACTIVE bugreport, when sending an intent to
Shell, where BugreportPramas enum was expected, but it worked fine
because they had the same value. We can stop relying on that.
Bug: 137825297
Bug: 141355059
Test: Interactive bugreports created successfully
Change-Id: I1ab5d471a6d5c70fcd201719eae90f820e17cb80
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 51 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 27 |
2 files changed, 14 insertions, 64 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index cb99a3aa11c6..7f597fef807a 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -188,57 +188,6 @@ public class ActivityManager { final ArrayMap<OnUidImportanceListener, UidObserver> mImportanceListeners = new ArrayMap<>(); /** - * Defines acceptable types of bugreports. - * @hide - */ - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = { "BUGREPORT_OPTION_" }, value = { - BUGREPORT_OPTION_FULL, - BUGREPORT_OPTION_INTERACTIVE, - BUGREPORT_OPTION_REMOTE, - BUGREPORT_OPTION_WEAR, - BUGREPORT_OPTION_TELEPHONY, - BUGREPORT_OPTION_WIFI - }) - public @interface BugreportMode {} - /** - * Takes a bugreport without user interference (and hence causing less - * interference to the system), but includes all sections. - * @hide - */ - public static final int BUGREPORT_OPTION_FULL = 0; - /** - * Allows user to monitor progress and enter additional data; might not include all - * sections. - * @hide - */ - public static final int BUGREPORT_OPTION_INTERACTIVE = 1; - /** - * Takes a bugreport requested remotely by administrator of the Device Owner app, - * not the device's user. - * @hide - */ - public static final int BUGREPORT_OPTION_REMOTE = 2; - /** - * Takes a bugreport on a wearable device. - * @hide - */ - public static final int BUGREPORT_OPTION_WEAR = 3; - - /** - * Takes a lightweight version of bugreport that only includes a few, urgent sections - * used to report telephony bugs. - * @hide - */ - public static final int BUGREPORT_OPTION_TELEPHONY = 4; - - /** - * Takes a lightweight bugreport that only includes a few sections related to Wifi. - * @hide - */ - public static final int BUGREPORT_OPTION_WIFI = 5; - - /** * <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code * <meta-data>}</a> name for a 'home' Activity that declares a package that is to be * uninstalled in lieu of the declaring one. The package named here must be diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 7b69bea6014b..1cb91d5acbe0 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -233,6 +233,7 @@ import android.os.AppZygote; import android.os.BatteryStats; import android.os.Binder; import android.os.BinderProxy; +import android.os.BugreportParams; import android.os.Build; import android.os.Bundle; import android.os.Debug; @@ -8255,22 +8256,22 @@ public class ActivityManagerService extends IActivityManager.Stub @Nullable String shareDescription, int bugreportType) { String type = null; switch (bugreportType) { - case ActivityManager.BUGREPORT_OPTION_FULL: + case BugreportParams.BUGREPORT_MODE_FULL: type = "bugreportfull"; break; - case ActivityManager.BUGREPORT_OPTION_INTERACTIVE: + case BugreportParams.BUGREPORT_MODE_INTERACTIVE: type = "bugreportplus"; break; - case ActivityManager.BUGREPORT_OPTION_REMOTE: + case BugreportParams.BUGREPORT_MODE_REMOTE: type = "bugreportremote"; break; - case ActivityManager.BUGREPORT_OPTION_WEAR: + case BugreportParams.BUGREPORT_MODE_WEAR: type = "bugreportwear"; break; - case ActivityManager.BUGREPORT_OPTION_TELEPHONY: + case BugreportParams.BUGREPORT_MODE_TELEPHONY: type = "bugreporttelephony"; break; - case ActivityManager.BUGREPORT_OPTION_WIFI: + case BugreportParams.BUGREPORT_MODE_WIFI: type = "bugreportwifi"; break; default: @@ -8305,7 +8306,7 @@ public class ActivityManagerService extends IActivityManager.Stub final boolean useApi = FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.USE_BUGREPORT_API); - if (useApi && bugreportType == ActivityManager.BUGREPORT_OPTION_INTERACTIVE) { + if (useApi && bugreportType == BugreportParams.BUGREPORT_MODE_INTERACTIVE) { // Create intent to trigger Bugreport API via Shell Intent triggerShellBugreport = new Intent(); triggerShellBugreport.setAction(INTENT_BUGREPORT_REQUESTED); @@ -8341,7 +8342,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void requestTelephonyBugReport(String shareTitle, String shareDescription) { requestBugReportWithDescription(shareTitle, shareDescription, - ActivityManager.BUGREPORT_OPTION_TELEPHONY); + BugreportParams.BUGREPORT_MODE_TELEPHONY); } /** @@ -8353,7 +8354,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void requestWifiBugReport(String shareTitle, String shareDescription) { requestBugReportWithDescription(shareTitle, shareDescription, - ActivityManager.BUGREPORT_OPTION_WIFI); + BugreportParams.BUGREPORT_MODE_WIFI); } /** @@ -8361,7 +8362,7 @@ public class ActivityManagerService extends IActivityManager.Stub */ @Override public void requestInteractiveBugReport() { - requestBugReportWithDescription(null, null, ActivityManager.BUGREPORT_OPTION_INTERACTIVE); + requestBugReportWithDescription(null, null, BugreportParams.BUGREPORT_MODE_INTERACTIVE); } /** @@ -8372,7 +8373,7 @@ public class ActivityManagerService extends IActivityManager.Stub public void requestInteractiveBugReportWithDescription(String shareTitle, String shareDescription) { requestBugReportWithDescription(shareTitle, shareDescription, - ActivityManager.BUGREPORT_OPTION_INTERACTIVE); + BugreportParams.BUGREPORT_MODE_INTERACTIVE); } /** @@ -8380,7 +8381,7 @@ public class ActivityManagerService extends IActivityManager.Stub */ @Override public void requestFullBugReport() { - requestBugReportWithDescription(null, null, ActivityManager.BUGREPORT_OPTION_FULL); + requestBugReportWithDescription(null, null, BugreportParams.BUGREPORT_MODE_FULL); } /** @@ -8388,7 +8389,7 @@ public class ActivityManagerService extends IActivityManager.Stub */ @Override public void requestRemoteBugReport() { - requestBugReportWithDescription(null, null, ActivityManager.BUGREPORT_OPTION_REMOTE); + requestBugReportWithDescription(null, null, BugreportParams.BUGREPORT_MODE_REMOTE); } public void registerProcessObserver(IProcessObserver observer) { |