diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index b5a9412831849..80350584bce63 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -181,7 +181,8 @@ public class ActivityManager { BUGREPORT_OPTION_INTERACTIVE, BUGREPORT_OPTION_REMOTE, BUGREPORT_OPTION_WEAR, - BUGREPORT_OPTION_TELEPHONY + BUGREPORT_OPTION_TELEPHONY, + BUGREPORT_OPTION_WIFI }) public @interface BugreportMode {} /** @@ -215,6 +216,12 @@ public class ActivityManager { */ 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; + /** * {@code * } name for a 'home' Activity that declares a package that is to be diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index 5f5d834425b63..9c15562b58137 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -357,6 +357,20 @@ interface IActivityManager { */ void requestTelephonyBugReport(in String shareTitle, in String shareDescription); + /** + * Deprecated - This method is only used by Wifi, and it will soon be replaced by a proper + * bug report API. + * + * Takes a minimal bugreport of Wifi-related state. + * + * @param shareTitle should be a valid legible string less than 50 chars long + * @param shareDescription should be less than 91 bytes when encoded into UTF-8 format + * + * @throws IllegalArgumentException if shareTitle or shareDescription is too big or if the + * parameters cannot be encoding to an UTF-8 charset. + */ + void requestWifiBugReport(in String shareTitle, in String shareDescription); + long inputDispatchingTimedOut(int pid, boolean aboveSystem, in String reason); void clearPendingBackup(); Intent getIntentForIntentSender(in IIntentSender sender); diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index b9da6016acd68..fedd3d271be45 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -13268,6 +13268,9 @@ public class ActivityManagerService extends IActivityManager.Stub case ActivityManager.BUGREPORT_OPTION_TELEPHONY: extraOptions = "bugreporttelephony"; break; + case ActivityManager.BUGREPORT_OPTION_WIFI: + extraOptions = "bugreportwifi"; + break; default: throw new IllegalArgumentException("Provided bugreport type is not correct, value: " + bugreportType); @@ -13289,9 +13292,8 @@ public class ActivityManagerService extends IActivityManager.Stub * No new code should be calling it. */ @Deprecated - @Override - public void requestTelephonyBugReport(String shareTitle, String shareDescription) { - + private void requestBugReportWithDescription(String shareTitle, String shareDescription, + int bugreportType) { if (!TextUtils.isEmpty(shareTitle)) { if (shareTitle.length() > MAX_BUGREPORT_TITLE_SIZE) { String errorStr = "shareTitle should be less than " + @@ -13320,9 +13322,34 @@ public class ActivityManagerService extends IActivityManager.Stub Slog.d(TAG, "Bugreport notification title " + shareTitle + " description " + shareDescription); - requestBugReport(ActivityManager.BUGREPORT_OPTION_TELEPHONY); + requestBugReport(bugreportType); } + /** + * @deprecated This method is only used by a few internal components and it will soon be + * replaced by a proper bug report API (which will be restricted to a few, pre-defined apps). + * No new code should be calling it. + */ + @Deprecated + @Override + public void requestTelephonyBugReport(String shareTitle, String shareDescription) { + requestBugReportWithDescription(shareTitle, shareDescription, + ActivityManager.BUGREPORT_OPTION_TELEPHONY); + } + + /** + * @deprecated This method is only used by a few internal components and it will soon be + * replaced by a proper bug report API (which will be restricted to a few, pre-defined apps). + * No new code should be calling it. + */ + @Deprecated + @Override + public void requestWifiBugReport(String shareTitle, String shareDescription) { + requestBugReportWithDescription(shareTitle, shareDescription, + ActivityManager.BUGREPORT_OPTION_WIFI); + } + + public static long getInputDispatchingTimeoutLocked(ActivityRecord r) { return r != null ? getInputDispatchingTimeoutLocked(r.app) : KEY_DISPATCHING_TIMEOUT; }