Merge "ActivityManager: add API for wifi bug report"

This commit is contained in:
TreeHugger Robot
2018-01-24 23:36:19 +00:00
committed by Android (Google) Code Review
3 changed files with 53 additions and 5 deletions

View File

@@ -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;
/**
* <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

View File

@@ -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);

View File

@@ -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;
}