Add CarShell package

- This is an empty package with only permissions declared.
- This shares shell uid and used to add car specific permission to shell.
- Each permission added here should get separate review as what can be
  allowed to end-user after shell access should be reviewed in terms of
  safety.

Bug: 162346055
Test: $ adb shell pm dump com.android.shell, check permissions for
      the shell user.
Change-Id: I79caf70fb15d37c086f052a206c0b6b1875899e2
Merged-In: I79caf70fb15d37c086f052a206c0b6b1875899e2
diff --git a/car_product/build/car.mk b/car_product/build/car.mk
index 657bad9..de75761 100644
--- a/car_product/build/car.mk
+++ b/car_product/build/car.mk
@@ -86,6 +86,7 @@
 PRODUCT_PACKAGES += \
     CarFrameworkPackageStubs \
     CarService \
+    CarShell \
     CarDialerApp \
     CarRadioApp \
     OverviewApp \
diff --git a/car_product/build/preinstalled-packages-product-car-base.xml b/car_product/build/preinstalled-packages-product-car-base.xml
index 0ed7b7f..14b16ec 100644
--- a/car_product/build/preinstalled-packages-product-car-base.xml
+++ b/car_product/build/preinstalled-packages-product-car-base.xml
@@ -42,6 +42,10 @@
         <install-in user-type="FULL" />
         <install-in user-type="SYSTEM" />
     </install-in-user-type>
+        <install-in-user-type package="com.android.car.shell">
+        <install-in user-type="FULL" />
+        <install-in user-type="SYSTEM" />
+    </install-in-user-type>
     <install-in-user-type package="com.android.car.frameworkpackagestubs">
         <install-in user-type="FULL" />
         <install-in user-type="SYSTEM" />
diff --git a/packages/CarShell/Android.bp b/packages/CarShell/Android.bp
new file mode 100644
index 0000000..545a2c5
--- /dev/null
+++ b/packages/CarShell/Android.bp
@@ -0,0 +1,7 @@
+android_app {
+    name: "CarShell",
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+    certificate: "platform",
+    privileged: true,
+}
diff --git a/packages/CarShell/AndroidManifest.xml b/packages/CarShell/AndroidManifest.xml
new file mode 100644
index 0000000..d9bdace
--- /dev/null
+++ b/packages/CarShell/AndroidManifest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.car.shell"
+        coreApp="true"
+        android:sharedUserId="android.uid.shell"
+        >
+    <!-- Permission required for ATS tests - AtsCarHostTestCases, AtsCarDeviceApp -->
+    <uses-permission android:name="android.car.permission.CAR_DRIVING_STATE" />
+    <!-- Permission required for ATS tests - AtsDeviceInfo, AtsAudioDeviceTestCases -->
+    <uses-permission android:name="android.car.permission.CAR_CONTROL_AUDIO_VOLUME" />
+</manifest>