Enable BugReportApp in AOSP

- Handle no permission and no metabugreport properly
    (From b/159917933)

Test: emulator
Bug: 159662565
Change-Id: Ie16341559b3edad9c43aff382bde05e1f123be59
diff --git a/car_product/build/car.mk b/car_product/build/car.mk
index f602d3a..657bad9 100644
--- a/car_product/build/car.mk
+++ b/car_product/build/car.mk
@@ -44,7 +44,7 @@
     GarageModeTestApp \
     ExperimentalCarService \
     RotaryPlayground \
-
+    BugReportApp \
 
 # SEPolicy for test apps / services
 BOARD_SEPOLICY_DIRS += packages/services/Car/car_product/sepolicy/test
diff --git a/tests/BugReportApp/src/com/android/car/bugreport/BugReportActivity.java b/tests/BugReportApp/src/com/android/car/bugreport/BugReportActivity.java
index 67ae314..ba9e59e 100644
--- a/tests/BugReportApp/src/com/android/car/bugreport/BugReportActivity.java
+++ b/tests/BugReportApp/src/com/android/car/bugreport/BugReportActivity.java
@@ -519,6 +519,10 @@
                 + Arrays.toString(permissions);
         Log.w(TAG, text);
         Toast.makeText(this, text, Toast.LENGTH_LONG).show();
+        if (mMetaBugReport == null) {
+            finish();
+            return;
+        }
         if (mIsNewBugReport) {
             BugStorageUtils.setBugReportStatus(this, mMetaBugReport,
                     Status.STATUS_USER_CANCELLED, text);