Merge "Add docs for setting default car bugreport app." into qt-dev
am: 18eccd076f

Change-Id: I39a27a81438dc5bbdec7796d8dd8d453924a3ab1
diff --git a/car-lib/src/android/car/CarBugreportManager.java b/car-lib/src/android/car/CarBugreportManager.java
index b74c446..f5d3b1d 100644
--- a/car-lib/src/android/car/CarBugreportManager.java
+++ b/car-lib/src/android/car/CarBugreportManager.java
@@ -166,6 +166,11 @@
      *
      * <p>The file descriptor is closed when bugreport is written or if an exception happens.
      *
+     * <p>This method is enabled only for one bug reporting app. It can be configured using
+     * {@code config_car_bugreport_application} string that is defined in
+     * {@code packages/services/Car/service/res/values/config.xml}. To learn more please
+     * see {@code packages/services/Car/tests/BugReportApp/README.md}.
+     *
      * @param output the zipped bugreport file
      * @param extraOutput a zip file that contains extra files generated for automotive.
      * @param callback  the callback for reporting dump status
diff --git a/service/res/values/config.xml b/service/res/values/config.xml
index a81bed4..ef75d63 100644
--- a/service/res/values/config.xml
+++ b/service/res/values/config.xml
@@ -209,4 +209,8 @@
 
     <string name="token_handle_shared_preferences" translatable="false">com.android.car.trust.TOKEN_HANDLE</string>
 
+    <!-- The package name of the default bugreport application that can use CarBugreportServiceManager.
+         There is no default bugreporting app.-->
+    <string name="config_car_bugreport_application" translatable="false"></string>
+
 </resources>
diff --git a/service/res/values/strings.xml b/service/res/values/strings.xml
index 3d8a402..ad6149a 100644
--- a/service/res/values/strings.xml
+++ b/service/res/values/strings.xml
@@ -261,8 +261,5 @@
 
     <!-- The package name of the media application that will be selected as the default [CHAR LIMIT=NONE] -->
     <string name="default_media_application" translatable="false">com.android.bluetooth</string>
-    <!-- The package name of the default bugreport application that can use CarBugreportServiceManager.
-         There is no default bugreporting app.-->
-    <string name="default_car_bugreport_application" translatable="false"></string>
 
 </resources>
diff --git a/service/src/com/android/car/CarBugreportManagerService.java b/service/src/com/android/car/CarBugreportManagerService.java
index 52d0d33..b63822f 100644
--- a/service/src/com/android/car/CarBugreportManagerService.java
+++ b/service/src/com/android/car/CarBugreportManagerService.java
@@ -123,8 +123,8 @@
             throw new SecurityException("Caller " + pm.getNameForUid(callingUid)
                             + " does not have the right signature");
         }
-        // Check the caller is the default designated bugreport app
-        String defaultAppPkgName = mContext.getString(R.string.default_car_bugreport_application);
+        // Check if the caller is the designated bugreport app
+        String defaultAppPkgName = mContext.getString(R.string.config_car_bugreport_application);
         String[] packageNamesForCallerUid = pm.getPackagesForUid(callingUid);
         boolean found = false;
         if (packageNamesForCallerUid != null) {
diff --git a/tests/BugReportApp/AndroidManifest.xml b/tests/BugReportApp/AndroidManifest.xml
index ac27207..3356151 100644
--- a/tests/BugReportApp/AndroidManifest.xml
+++ b/tests/BugReportApp/AndroidManifest.xml
@@ -16,8 +16,8 @@
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.google.android.car.bugreport"
-          android:versionCode="6"
-          android:versionName="1.5.0">
+          android:versionCode="7"
+          android:versionName="1.5.1">
 
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.READ_LOGS"/>
diff --git a/tests/BugReportApp/README.md b/tests/BugReportApp/README.md
index cd0245d..b93126c 100644
--- a/tests/BugReportApp/README.md
+++ b/tests/BugReportApp/README.md
@@ -21,7 +21,17 @@
 Bug reports are zipped and uploaded to GCS. GCS enables creating Pub/Sub
 notifications that can be used to track when new  bug reports are uploaded.
 
-## Configuration
+## System configuration
+
+BugReport app uses `CarBugreportServiceManager` to collect bug reports and
+screenshots. `CarBugreportServiceManager` allows only one bug report app to
+use it's APIs, by default it's none.
+
+To allow AAE BugReport app to access the API, you need to overlay
+`config_car_bugreport_application` in `packages/services/Car/service/res/values/config.xml`
+with value `com.google.android.car.bugreport`.
+
+## App Configuration
 
 UI and upload configs are located in `res/` directory. Resources can be
 [overlayed](https://source.android.com/setup/develop/new-device#use-resource-overlays)