Move car-bugreports under cpp/bugreport

This CL just to organize the Car package.

Test: m -j
Test: flash and executed the bugreport app
Bug: 181892683
Change-Id: I527ddd434f57d74d403b912ef9b508e83a0e0baa
diff --git a/car_product/build/car_base.mk b/car_product/build/car_base.mk
index ce9572e..d3e22cb 100644
--- a/car_product/build/car_base.mk
+++ b/car_product/build/car_base.mk
@@ -60,7 +60,7 @@
     libvariablespeed \
     A2dpSinkService \
     PackageInstaller \
-    car-bugreportd \
+    carbugreportd \
 
 # EVS service
 include packages/services/Car/cpp/evs/manager/evsmanager.mk
diff --git a/car_product/sepolicy/private/file_contexts b/car_product/sepolicy/private/file_contexts
index 9666f70..4e0591e 100644
--- a/car_product/sepolicy/private/file_contexts
+++ b/car_product/sepolicy/private/file_contexts
@@ -3,7 +3,8 @@
 
 /data/system/car(/.*)? u:object_r:system_car_data_file:s0
 
-/system/bin/car-bugreportd  u:object_r:dumpstate_exec:s0
+# Rules for carbugreportd binary located in //p/s/Car/cpp/bugreport
+/system/bin/carbugreportd  u:object_r:dumpstate_exec:s0
 /dev/socket/car_br_progress_socket  u:object_r:dumpstate_socket:s0
 /dev/socket/car_br_output_socket  u:object_r:dumpstate_socket:s0
 /dev/socket/car_br_extra_output_socket u:object_r:dumpstate_socket:s0
diff --git a/car-bugreportd/Android.bp b/cpp/bugreport/Android.bp
similarity index 93%
rename from car-bugreportd/Android.bp
rename to cpp/bugreport/Android.bp
index 79f7e2b..75df447 100644
--- a/car-bugreportd/Android.bp
+++ b/cpp/bugreport/Android.bp
@@ -19,8 +19,8 @@
 }
 
 cc_binary {
-    name: "car-bugreportd",
-    init_rc: ["car-bugreportd.rc"],
+    name: "carbugreportd",
+    init_rc: ["carbugreportd.rc"],
     srcs: [
         "main.cpp",
     ],
diff --git a/car-bugreportd/OWNERS b/cpp/bugreport/OWNERS
similarity index 100%
rename from car-bugreportd/OWNERS
rename to cpp/bugreport/OWNERS
diff --git a/car-bugreportd/README.md b/cpp/bugreport/README.md
similarity index 72%
rename from car-bugreportd/README.md
rename to cpp/bugreport/README.md
index c6fae4c..239dfb7 100644
--- a/car-bugreportd/README.md
+++ b/cpp/bugreport/README.md
@@ -1,9 +1,9 @@
-# car-bugreportd
+# carbugreportd
 
 Android Automotive OS only service. Please use `CarBugreportManager` API.
 
 It takes bugreport, appends car specific files and then proxies them to
 `CarBugreportManagerService`.
 
-To start, set the value of the system property `ctl.start` to `car-bugreportd`,
-e.g. `SystemProperties.set("ctl.start", "car-bugreportd");`
+To start, set the value of the system property `ctl.start` to `carbugreportd`,
+e.g. `SystemProperties.set("ctl.start", "carbugreportd");`
diff --git a/car-bugreportd/car-bugreportd.rc b/cpp/bugreport/carbugreportd.rc
similarity index 62%
rename from car-bugreportd/car-bugreportd.rc
rename to cpp/bugreport/carbugreportd.rc
index e994859..530fd8a 100644
--- a/car-bugreportd/car-bugreportd.rc
+++ b/cpp/bugreport/carbugreportd.rc
@@ -1,4 +1,4 @@
-service car-bugreportd /system/bin/car-bugreportd
+service carbugreportd /system/bin/carbugreportd
     socket car_br_progress_socket stream 0660 shell log
     socket car_br_output_socket stream 0660 shell log
     socket car_br_extra_output_socket stream 0660 shell log
@@ -8,10 +8,10 @@
     disabled
     oneshot
 
-# car-dumpstatez generates a zipped bugreport but also uses a socket to print the file location once
+# cardumpstatez generates a zipped bugreport but also uses a socket to print the file location once
 # it is finished.
-service car-dumpstatez /system/bin/dumpstate -S -d -z
+service cardumpstatez /system/bin/dumpstate -S -d -z
     socket dumpstate stream 0660 shell log
     class main
     disabled
-    oneshot
\ No newline at end of file
+    oneshot
diff --git a/car-bugreportd/main.cpp b/cpp/bugreport/main.cpp
similarity index 96%
rename from car-bugreportd/main.cpp
rename to cpp/bugreport/main.cpp
index 6e13db1..783eaa8 100644
--- a/car-bugreportd/main.cpp
+++ b/cpp/bugreport/main.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "car-bugreportd"
+#define LOG_TAG "carbugreportd"
 
 #include <android-base/errors.h>
 #include <android-base/file.h>
@@ -235,8 +235,8 @@
 
     // Set a timeout so that if nothing is read by the timeout, stop reading and quit
     struct timeval tv = {
-        .tv_sec = kDumpstateTimeoutInSec,
-        .tv_usec = 0,
+            .tv_sec = kDumpstateTimeoutInSec,
+            .tv_usec = 0,
     };
     if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) != 0) {
         ALOGW("Cannot set socket timeout (%s)", strerror(errno));
@@ -379,10 +379,10 @@
 }
 
 void takeScreenshotForDisplayId(PhysicalDisplayId id, const char* tmp_dir,
-        std::vector<std::string>* extra_files) {
+                                std::vector<std::string>* extra_files) {
     std::string id_as_string = to_string(id);
     std::string filename = std::string(tmp_dir) + kScreenshotPrefix + id_as_string + ".png";
-    std::vector<const char*> args { "-p", "-d", id_as_string.c_str(), filename.c_str(), nullptr };
+    std::vector<const char*> args{"-p", "-d", id_as_string.c_str(), filename.c_str(), nullptr};
     ALOGI("capturing screen for display (%s) as %s", id_as_string.c_str(), filename.c_str());
     int status = runCommand(10, "/system/bin/screencap", args);
     if (status == 0) {
@@ -460,7 +460,7 @@
     }
 
     // Start the dumpstatez service.
-    android::base::SetProperty("ctl.start", "car-dumpstatez");
+    android::base::SetProperty("ctl.start", "cardumpstatez");
 
     size_t bytes_written = 0;
 
@@ -468,7 +468,7 @@
     int progress_socket = openSocket(kCarBrProgressSocket);
     if (progress_socket < 0) {
         // early out. in this case we will not print the final message, but that is ok.
-        android::base::SetProperty("ctl.stop", "car-dumpstatez");
+        android::base::SetProperty("ctl.stop", "cardumpstatez");
         return EXIT_FAILURE;
     }
     bool is_success = doBugreport(progress_socket, &bytes_written, &zip_path);
@@ -498,8 +498,8 @@
     recursiveRemoveDir(kTempDirectory);
 
     // No matter how doBugreport() finished, let's try to explicitly stop
-    // car-dumpstatez in case it stalled.
-    android::base::SetProperty("ctl.stop", "car-dumpstatez");
+    // cardumpstatez in case it stalled.
+    android::base::SetProperty("ctl.stop", "cardumpstatez");
 
     return is_success ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/service/src/com/android/car/CarBugreportManagerService.java b/service/src/com/android/car/CarBugreportManagerService.java
index 6a9101d..db59d1f 100644
--- a/service/src/com/android/car/CarBugreportManagerService.java
+++ b/service/src/com/android/car/CarBugreportManagerService.java
@@ -71,10 +71,10 @@
     private static final String FAIL_PREFIX = "FAIL:";
 
     /**
-     * The services are defined in {@code packages/services/Car/car-bugreportd/car-bugreportd.rc}.
+     * The services are defined in {@code packages/services/Car/cpp/bugreport/carbugreportd.rc}.
      */
-    private static final String BUGREPORTD_SERVICE = "car-bugreportd";
-    private static final String DUMPSTATEZ_SERVICE = "car-dumpstatez";
+    private static final String BUGREPORTD_SERVICE = "carbugreportd";
+    private static final String DUMPSTATEZ_SERVICE = "cardumpstatez";
 
     // The socket definitions must match the actual socket names defined in car_bugreportd service
     // definition.
@@ -346,7 +346,7 @@
         while (true) {
             // There are a few factors impacting the socket delay:
             // 1. potential system slowness
-            // 2. car-bugreportd takes the screenshots early (before starting dumpstate). This
+            // 2. carbugreportd takes the screenshots early (before starting dumpstate). This
             //    should be taken into account as the socket opens after screenshots are
             //    captured.
             // Therefore we are generous in setting the timeout. Most cases should not even