summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michal Olech <molech@google.com> 2019-12-18 14:50:05 +0100
committer Michal Olech <molech@google.com> 2020-01-06 16:19:59 +0100
commit88376e68c113cbe0479be2b3a442bd9bc14b3cc3 (patch)
treebd88981e7ba8957f5b8c6b2d2657194740b94400
parentf472e23be5bdb04d2e4c78b9decaca443190b362 (diff)
Introduce config_customBugreport option
This adds support for a custom bugreport handler. When the option is enabled instead of immediately triggering the full bugreport, only a CUSTOM_BUGREPORT_REQUESTED broadcast is sent. Bug: 146052311 Test: built and tested locally Change-Id: Ifea9906c15e0bc1281192a90b4dbdb0ad1ecfbdd
-rw-r--r--core/java/android/view/WindowManagerPolicyConstants.java6
-rw-r--r--core/res/AndroidManifest.xml1
-rw-r--r--core/res/res/values/config.xml5
-rw-r--r--core/res/res/values/symbols.xml2
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java11
5 files changed, 23 insertions, 2 deletions
diff --git a/core/java/android/view/WindowManagerPolicyConstants.java b/core/java/android/view/WindowManagerPolicyConstants.java
index a22f5a576ab6..f8bcb0010b48 100644
--- a/core/java/android/view/WindowManagerPolicyConstants.java
+++ b/core/java/android/view/WindowManagerPolicyConstants.java
@@ -72,6 +72,12 @@ public interface WindowManagerPolicyConstants {
"android.intent.action.USER_ACTIVITY_NOTIFICATION";
/**
+ * Broadcast sent when a (custom) bugreport is requested.
+ */
+ String ACTION_CUSTOM_BUGREPORT_REQUESTED =
+ "android.intent.action.CUSTOM_BUGREPORT_REQUESTED";
+
+ /**
* Sticky broadcast of the current HDMI plugged state.
*/
String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED";
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 405f3daff829..fff7192fbbc3 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -96,6 +96,7 @@
<protected-broadcast android:name="android.intent.action.USER_ACTIVITY_NOTIFICATION" />
<protected-broadcast android:name="android.intent.action.MY_PACKAGE_SUSPENDED" />
<protected-broadcast android:name="android.intent.action.MY_PACKAGE_UNSUSPENDED" />
+ <protected-broadcast android:name="android.intent.action.CUSTOM_BUGREPORT_REQUESTED" />
<protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGED" />
<protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGING" />
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 9073a02e72d3..57f99a97a97e 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4287,4 +4287,9 @@
<!-- Whether or not to use assistant stream volume separately from music volume -->
<bool name="config_useAssistantVolume">false</bool>
+
+ <!-- Whether to use a custom Bugreport handling. When true, ACTION_CUSTOM_BUGREPORT_REQUESTED
+ intent is broadcasted on bugreporting chord (instead of the default full bugreport
+ generation). -->
+ <bool name="config_customBugreport">false</bool>
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 356ec2bb4f34..2a175486663c 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3800,5 +3800,5 @@
<!-- Assistant handles -->
<java-symbol type="dimen" name="assist_handle_shadow_radius" />
-
+ <java-symbol type="bool" name="config_customBugreport" />
</resources>
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 0d8f25766e1f..e4ce3df7bf55 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -712,7 +712,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
accessibilityShortcutActivated();
break;
case MSG_BUGREPORT_TV:
- requestFullBugreport();
+ boolean customBugreport = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_customBugreport);
+ if (customBugreport) {
+ Log.i(TAG, "Triggering a custom bugreport!");
+ Intent intent = new Intent(ACTION_CUSTOM_BUGREPORT_REQUESTED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
+ } else {
+ requestFullBugreport();
+ }
break;
case MSG_ACCESSIBILITY_TV:
if (mAccessibilityShortcutController.isAccessibilityShortcutAvailable(false)) {