summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Abhijeet Kaur <abkaur@google.com> 2019-08-23 16:39:54 +0100
committer Abhijeet Kaur <abkaur@google.com> 2019-08-27 16:55:40 +0100
commite9998513db50487b4e92b9d5b7d420e48b619ca0 (patch)
treebb3f149a37265ec88216f888d63ed0c50b722c26
parent05c94cec637c7701b8b838a11f5455dc2f801de3 (diff)
Add wrapper functions to eventually remove enum logic from callers.
The bugreport API uses newly added enum for bugreport options (example: BugreportParams.BUGREPORT_MODE_FULL). So, now we need to maintain and keep in sync both of these enums as requestBugreport will use the bugreport API; Need to move towards one enum for bugreport options. Currently, the caller of requestBugReport(int bugreport) needs to know the underlying enum for the bugreport it is requesting. Instead of changing the enum logic at the caller of requestBugreport(), create wrapper functions for specific bugreports. Bug: 137825297 Test: Builds Change-Id: I62a58511867624f9662287ee39f78a31ff9cd765
-rw-r--r--core/java/android/app/IActivityManager.aidl14
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java54
2 files changed, 57 insertions, 11 deletions
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index 48ca71690a1b..356e0da37cae 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -350,11 +350,13 @@ interface IActivityManager {
// Request a heap dump for the system server.
void requestSystemServerHeapDump();
- // 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).
+ // Deprecated - This method is only used by a few internal components and it will soon start
+ // using bug report API (which will be restricted to a few, pre-defined apps).
// No new code should be calling it.
@UnsupportedAppUsage
void requestBugReport(int bugreportType);
+ void requestBugReportWithDescription(in @nullable String shareTitle,
+ in @nullable String shareDescription, int bugreportType);
/**
* Takes a telephony bug report and notifies the user with the title and description
@@ -369,7 +371,7 @@ 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
+ * Deprecated - This method is only used by Wifi, and it will soon start using
* bug report API.
*
* Takes a minimal bugreport of Wifi-related state.
@@ -381,6 +383,12 @@ interface IActivityManager {
* parameters cannot be encoding to an UTF-8 charset.
*/
void requestWifiBugReport(in String shareTitle, in String shareDescription);
+ void requestInteractiveBugReportWithDescription(in String shareTitle,
+ in String shareDescription);
+
+ void requestInteractiveBugReport();
+ void requestFullBugReport();
+ void requestRemoteBugReport();
@UnsupportedAppUsage
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 5c0fe4e8bcc2..35441d265e28 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -8203,10 +8203,12 @@ public class ActivityManagerService extends IActivityManager.Stub
}
/**
- * @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).
+ * @deprecated This method is only used by a few internal components and it will soon start
+ * using bug report API (which will be restricted to a few, pre-defined apps).
* No new code should be calling it.
*/
+ // TODO(b/137825297): Remove deprecated annotation and rephrase comments for all
+ // requestBugreport functions below.
@Deprecated
@Override
public void requestBugReport(int bugreportType) {
@@ -8214,11 +8216,12 @@ public class ActivityManagerService extends IActivityManager.Stub
}
/**
- * @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).
+ * @deprecated This method is only used by a few internal components and it will soon start
+ * using bug report API (which will be restricted to a few, pre-defined apps).
* No new code should be calling it.
*/
@Deprecated
+ @Override
public void requestBugReportWithDescription(@Nullable String shareTitle,
@Nullable String shareDescription, int bugreportType) {
String type = null;
@@ -8294,8 +8297,8 @@ public class ActivityManagerService extends IActivityManager.Stub
}
/**
- * @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).
+ * @deprecated This method is only used by a few internal components and it will soon start
+ * using bug report API (which will be restricted to a few, pre-defined apps).
* No new code should be calling it.
*/
@Deprecated
@@ -8306,8 +8309,8 @@ public class ActivityManagerService extends IActivityManager.Stub
}
/**
- * @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).
+ * @deprecated This method is only used by a few internal components and it will soon start
+ * using bug report API (which will be restricted to a few, pre-defined apps).
* No new code should be calling it.
*/
@Deprecated
@@ -8317,6 +8320,41 @@ public class ActivityManagerService extends IActivityManager.Stub
ActivityManager.BUGREPORT_OPTION_WIFI);
}
+ /**
+ * Takes an interactive bugreport with a progress notification
+ */
+ @Override
+ public void requestInteractiveBugReport() {
+ requestBugReportWithDescription(null, null, ActivityManager.BUGREPORT_OPTION_INTERACTIVE);
+ }
+
+ /**
+ * Takes an interactive bugreport with a progress notification. Also, shows the given title and
+ * description on the final share notification
+ */
+ @Override
+ public void requestInteractiveBugReportWithDescription(String shareTitle,
+ String shareDescription) {
+ requestBugReportWithDescription(shareTitle, shareDescription,
+ ActivityManager.BUGREPORT_OPTION_INTERACTIVE);
+ }
+
+ /**
+ * Takes a bugreport with minimal user interference
+ */
+ @Override
+ public void requestFullBugReport() {
+ requestBugReportWithDescription(null, null, ActivityManager.BUGREPORT_OPTION_FULL);
+ }
+
+ /**
+ * Takes a bugreport remotely
+ */
+ @Override
+ public void requestRemoteBugReport() {
+ requestBugReportWithDescription(null, null, ActivityManager.BUGREPORT_OPTION_REMOTE);
+ }
+
public void registerProcessObserver(IProcessObserver observer) {
enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER,
"registerProcessObserver()");