[automerger skipped] DO NOT MERGE - Mark RQ3A.210410.001 as merged am: 91cade0cf6 -s ours

am skip reason: Merged-In I58f4cd524010ea13d2437abb6bf37cbea0b9f528 with SHA-1 1983e95fa7 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/hardware/interfaces/+/15023955

Change-Id: Ia9298b79bca6d7b25cdfc6e2718dd997d4ef84b6
diff --git a/automotive/OWNERS b/automotive/OWNERS
index e5a11e8..e34575b 100644
--- a/automotive/OWNERS
+++ b/automotive/OWNERS
@@ -1,3 +1,3 @@
-haoxiangl@google.com
-swan@google.com
-changyeon@google.com
+gurunagarajan@google.com
+keunyoung@google.com
+sgurun@google.com
diff --git a/automotive/display/1.0/vts/functional/VtsHalAutomotiveDisplayV1_0TargetTest.cpp b/automotive/display/1.0/vts/functional/VtsHalAutomotiveDisplayV1_0TargetTest.cpp
index 8ca20a0..d18d60c 100644
--- a/automotive/display/1.0/vts/functional/VtsHalAutomotiveDisplayV1_0TargetTest.cpp
+++ b/automotive/display/1.0/vts/functional/VtsHalAutomotiveDisplayV1_0TargetTest.cpp
@@ -19,7 +19,7 @@
 
 #include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
 #include <android/hardware/graphics/bufferqueue/2.0/IGraphicBufferProducer.h>
-#include <ui/DisplayConfig.h>
+#include <ui/DisplayMode.h>
 #include <ui/DisplayState.h>
 #include <utils/Log.h>
 
@@ -59,7 +59,7 @@
     for (const auto& id : displayIdList) {
         // Get a display info
         mDisplayProxy->getDisplayInfo(id, [](const auto& cfg, const auto& /*state*/) {
-            android::DisplayConfig* pConfig = (android::DisplayConfig*)cfg.data();
+            android::ui::DisplayMode* pConfig = (android::ui::DisplayMode*)cfg.data();
             ASSERT_GT(pConfig->resolution.getWidth(), 0);
             ASSERT_GT(pConfig->resolution.getHeight(), 0);
         });
@@ -101,6 +101,7 @@
     }
 }
 
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AutomotiveDisplayHidlTest);
 INSTANTIATE_TEST_SUITE_P(
     PerInstance,
     AutomotiveDisplayHidlTest,
diff --git a/automotive/display/OWNERS b/automotive/display/OWNERS
new file mode 100644
index 0000000..e5a11e8
--- /dev/null
+++ b/automotive/display/OWNERS
@@ -0,0 +1,3 @@
+haoxiangl@google.com
+swan@google.com
+changyeon@google.com
diff --git a/automotive/powerpolicy/OWNERS b/automotive/powerpolicy/OWNERS
new file mode 100644
index 0000000..a2f1610
--- /dev/null
+++ b/automotive/powerpolicy/OWNERS
@@ -0,0 +1,2 @@
+keunyoung@google.com
+ericjeong@google.com
diff --git a/automotive/powerpolicy/aidl/Android.bp b/automotive/powerpolicy/aidl/Android.bp
new file mode 100644
index 0000000..197aac4
--- /dev/null
+++ b/automotive/powerpolicy/aidl/Android.bp
@@ -0,0 +1,53 @@
+// 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.
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+    name: "android.frameworks.automotive.powerpolicy",
+    vendor_available: true,
+    srcs: [
+        "android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl",
+        "android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl",
+        "android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl",
+        "android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl",
+        "android/frameworks/automotive/powerpolicy/PowerComponent.aidl",
+    ],
+    stability: "vintf",
+    backend: {
+        java: {
+            platform_apis: true,
+            enabled: true,
+        },
+    },
+    versions: ["1"],
+}
+
+aidl_interface {
+    name: "android.frameworks.automotive.powerpolicy.internal",
+    unstable: true,
+    vendor_available: false,
+    srcs: [
+        "android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl",
+        "android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl",
+    ],
+    backend: {
+        java: {
+            platform_apis: true,
+            enabled: true,
+        },
+    },
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/.hash b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/.hash
new file mode 100644
index 0000000..a523e9d
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/.hash
@@ -0,0 +1 @@
+a7e74b911f6461cdc000ba2e227bb01c5a51a564
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
new file mode 100644
index 0000000..abd28f0
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+parcelable CarPowerPolicy {
+  @utf8InCpp String policyId;
+  android.frameworks.automotive.powerpolicy.PowerComponent[] enabledComponents;
+  android.frameworks.automotive.powerpolicy.PowerComponent[] disabledComponents;
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
new file mode 100644
index 0000000..8200566
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+parcelable CarPowerPolicyFilter {
+  android.frameworks.automotive.powerpolicy.PowerComponent[] components;
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
new file mode 100644
index 0000000..c5574a1
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+interface ICarPowerPolicyChangeCallback {
+  oneway void onPolicyChanged(in android.frameworks.automotive.powerpolicy.CarPowerPolicy policy);
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
new file mode 100644
index 0000000..6372fa3
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+interface ICarPowerPolicyServer {
+  android.frameworks.automotive.powerpolicy.CarPowerPolicy getCurrentPowerPolicy();
+  boolean getPowerComponentState(in android.frameworks.automotive.powerpolicy.PowerComponent componentId);
+  void registerPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback, in android.frameworks.automotive.powerpolicy.CarPowerPolicyFilter filter);
+  void unregisterPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback);
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/PowerComponent.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
new file mode 100644
index 0000000..255c1b1
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/1/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@Backing(type="int") @VintfStability
+enum PowerComponent {
+  AUDIO = 1,
+  MEDIA = 2,
+  DISPLAY = 3,
+  BLUETOOTH = 4,
+  WIFI = 5,
+  CELLULAR = 6,
+  ETHERNET = 7,
+  PROJECTION = 8,
+  NFC = 9,
+  INPUT = 10,
+  VOICE_INTERACTION = 11,
+  VISUAL_INTERACTION = 12,
+  TRUSTED_DEVICE_DETECTION = 13,
+  LOCATION = 14,
+  MICROPHONE = 15,
+  CPU = 16,
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
new file mode 100644
index 0000000..3750dbb
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ *////////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+parcelable CarPowerPolicy {
+  @utf8InCpp String policyId;
+  android.frameworks.automotive.powerpolicy.PowerComponent[] enabledComponents;
+  android.frameworks.automotive.powerpolicy.PowerComponent[] disabledComponents;
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
new file mode 100644
index 0000000..45792a6
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *////////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+parcelable CarPowerPolicyFilter {
+  android.frameworks.automotive.powerpolicy.PowerComponent[] components;
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
new file mode 100644
index 0000000..aa6777e
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *////////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+interface ICarPowerPolicyChangeCallback {
+  oneway void onPolicyChanged(in android.frameworks.automotive.powerpolicy.CarPowerPolicy policy);
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
new file mode 100644
index 0000000..e75bfd0
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ *////////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+interface ICarPowerPolicyServer {
+  android.frameworks.automotive.powerpolicy.CarPowerPolicy getCurrentPowerPolicy();
+  boolean getPowerComponentState(in android.frameworks.automotive.powerpolicy.PowerComponent componentId);
+  void registerPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback, in android.frameworks.automotive.powerpolicy.CarPowerPolicyFilter filter);
+  void unregisterPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback);
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
new file mode 100644
index 0000000..2b289f6
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ *////////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@Backing(type="int") @VintfStability
+enum PowerComponent {
+  AUDIO = 1,
+  MEDIA = 2,
+  DISPLAY = 3,
+  BLUETOOTH = 4,
+  WIFI = 5,
+  CELLULAR = 6,
+  ETHERNET = 7,
+  PROJECTION = 8,
+  NFC = 9,
+  INPUT = 10,
+  VOICE_INTERACTION = 11,
+  VISUAL_INTERACTION = 12,
+  TRUSTED_DEVICE_DETECTION = 13,
+  LOCATION = 14,
+  MICROPHONE = 15,
+  CPU = 16,
+}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
new file mode 100644
index 0000000..80267e6
--- /dev/null
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.automotive.powerpolicy;
+
+import android.frameworks.automotive.powerpolicy.PowerComponent;
+
+/**
+ * Description of car power policy.
+ * Components which are not specified in the CarPowerPolicy will remain unchanged.
+ */
+@VintfStability
+parcelable CarPowerPolicy {
+  /**
+   * Unique ID representing power policy.
+   */
+  @utf8InCpp String policyId;
+
+  /**
+   * List of power components to be enabled.
+   */
+  PowerComponent[] enabledComponents;
+
+  /**
+   * List of power components to be disabled.
+   */
+  PowerComponent[] disabledComponents;
+}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
new file mode 100644
index 0000000..86289cd
--- /dev/null
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.automotive.powerpolicy;
+
+import android.frameworks.automotive.powerpolicy.PowerComponent;
+
+/**
+ * A set of power components which ICarPowerPolicyChangeCallbacks are interested in.
+ * By specifying this filter, the callbacks are notified only by power policy changes which contain
+ * the power components of interest.
+ */
+@VintfStability
+parcelable CarPowerPolicyFilter {
+  /**
+   * List of power components of interest.
+   */
+  PowerComponent[] components;
+}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
new file mode 100644
index 0000000..df0455b
--- /dev/null
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.automotive.powerpolicy;
+
+import android.frameworks.automotive.powerpolicy.CarPowerPolicy;
+
+/**
+ * ICarPowerPolicyChangeCallback is notified when a power policy changes.
+ */
+
+@VintfStability
+oneway interface ICarPowerPolicyChangeCallback {
+  /**
+   * Called when a power policy is fully changed.
+   *
+   * @param policy The current policy.
+   */
+  void onPolicyChanged(in CarPowerPolicy policy);
+}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
new file mode 100644
index 0000000..27b18f7
--- /dev/null
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.automotive.powerpolicy;
+
+import android.frameworks.automotive.powerpolicy.CarPowerPolicy;
+import android.frameworks.automotive.powerpolicy.CarPowerPolicyFilter;
+import android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback;
+import android.frameworks.automotive.powerpolicy.PowerComponent;
+
+/**
+ * ICarPowerPolicyServer is an interface implemented by the power policy daemon.
+ * VHAL changes the power policy and the power policy daemon notifies the change to registered
+ * subscribers. When subscribing to policy changes, a filter can be specified so that the registered
+ * callbacks can listen only to a specific power component's change.
+ */
+
+@VintfStability
+interface ICarPowerPolicyServer {
+  /**
+   * Gets the current power policy.
+   * @throws IllegalStateException if the current policy is not set.
+   */
+  CarPowerPolicy getCurrentPowerPolicy();
+
+  /**
+   * Gets whether the power component is turned on or off.
+   *
+   * @param componentId Power component ID defined in PowerComponent.aidl to check power state.
+   * @return True if the component's power state is on.
+   * @throws IllegalArgumentException if the componentId is invalid.
+   */
+  boolean getPowerComponentState(in PowerComponent componentId);
+
+  /**
+   * Subscribes to power policy change.
+   * Notification is sent to the registered callback when the power policy changes and the power
+   * state of the components which the callback is interested in changes.
+   *
+   * @param callback Callback that is invoked when the power policy changes.
+   * @param filter The list of components which the callback is interested in.
+   * @throws IllegalArgumentException if the callback is already registered.
+   * @throws IllegalStateException if the callback is dead.
+   */
+  void registerPowerPolicyChangeCallback(in ICarPowerPolicyChangeCallback callback,
+      in CarPowerPolicyFilter filter);
+
+  /**
+   * Unsubscribes from power policy change.
+   *
+   * @param callback Callback that doesn't want to receive power policy change.
+   * @throws IllegalArgumentException if the callback is not registered.
+   */
+  void unregisterPowerPolicyChangeCallback(in ICarPowerPolicyChangeCallback callback);
+}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
new file mode 100644
index 0000000..d92cdaf
--- /dev/null
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.automotive.powerpolicy;
+
+/**
+ * List of power component ID.
+ */
+@VintfStability
+@Backing(type="int")
+enum PowerComponent {
+  /**
+   * This is used to turn on/off audio through power policy.
+   */
+  AUDIO = 1,
+
+  /**
+   * This is used to turn on/off media playing/recording through power policy.
+   */
+  MEDIA = 2,
+
+  /**
+   * This is used to turn on/off display through power policy.
+   */
+  DISPLAY = 3,
+
+  /**
+   * This is used to turn on/off bluetooth through power policy.
+   */
+  BLUETOOTH = 4,
+
+  /**
+   * This is used to turn on/off WiFi network through power policy.
+   */
+  WIFI = 5,
+
+  /**
+   * This is used to turn on/off cellular network through power policy.
+   */
+  CELLULAR = 6,
+
+  /**
+   * This is used to turn on/off ethernet through power policy.
+   */
+  ETHERNET = 7,
+
+  /**
+   * This is used to turn on/off projection from other devices through power policy.
+   */
+  PROJECTION = 8,
+
+  /**
+   * This is used to turn on/off NFC through power policy.
+   */
+  NFC = 9,
+
+  /**
+   * This is used to turn on/off all inputs from users through power policy.
+   */
+  INPUT = 10,
+
+  /**
+   * This is used to turn on/off voice interaction through power policy.
+   */
+  VOICE_INTERACTION = 11,
+
+  /**
+   * This is used to turn on/off visual interaction through power policy.
+   */
+  VISUAL_INTERACTION = 12,
+
+  /**
+   * This is used to turn on/off trusted device detection through power policy.
+   */
+  TRUSTED_DEVICE_DETECTION = 13,
+
+  /**
+   * This is used to turn on/off location through power policy.
+   */
+  LOCATION = 14,
+
+  /**
+   * This is used to turn on/off microphone through power policy.
+   */
+  MICROPHONE = 15,
+
+  /**
+   * This is used to turn on/off CPU through power policy.
+   * It will turn into off state when system goes into sleep state. It will be restored to on
+   * state when system gets out of sleep state.
+   */
+  CPU = 16,
+}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl
new file mode 100644
index 0000000..08078f0
--- /dev/null
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.automotive.powerpolicy.internal;
+
+import android.frameworks.automotive.powerpolicy.internal.PolicyState;
+
+/**
+ * ICarPowerPolicyServer is an interface implemented by the power policy daemon.
+ * VHAL changes the power policy and the power policy daemon notifies the change to registered
+ * subscribers. When subscribing to policy changes, a filter can be specified so that the registered
+ * callbacks can listen only to a specific power component's change.
+ */
+
+interface ICarPowerPolicySystemNotification {
+  /**
+   * CarService uses this method to tell that CarService is ready for taking over power policy
+   * management.
+   * Once this method is called, car power policy daemon stops serving for the requests from vehicle
+   * HAL. CarService starts serving power policy management based on the current power policy ID and
+   * power policy group ID returned from the call.
+   *
+   * System private API for CarService.
+   *
+   * @return The current power policy ID and power policy group ID.
+   * @throws SecurityException if the caller doesn't have sufficient permissions.
+   */
+  PolicyState notifyCarServiceReady();
+
+  /**
+   * CarService uses this method to tell that the current power policy is changed.
+   * Then, car power policy daemon propagates the change to registered callbacks.
+   *
+   * System private API for CarService.
+   *
+   * @param policyId The current policy ID.
+   * @throws IllegalStateException if it fails to notify power policy change.
+   * @throws SecurityException if the caller doesn't have sufficient permissions.
+   */
+  void notifyPowerPolicyChange(in @utf8InCpp String policyId);
+
+  /**
+   * CarService uses this method to tell that there is a newly defined power policy.
+   * When a new power policy is defined on the fly through "define-power-policy" in
+   * {@code CarShellCommand}, CarService makes sure that car power policy daemon maintains the same
+   * power policies.
+   *
+   * System private API for CarService.
+   *
+   * @param policyId The new policy ID.
+   * @param enabledComponents List of components to be enabled.
+   * @param disabledComponents List of components to be disabled.
+   * @throws IllegalStateException if it fails to notify power policy definition.
+   * @throws SecurityException if the caller doesn't have sufficient permissions.
+   */
+  void notifyPowerPolicyDefinition(in @utf8InCpp String policyId,
+      in @utf8InCpp String[] enabledComponents, in @utf8InCpp String[] disabledComponents);
+}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl
new file mode 100644
index 0000000..e993592
--- /dev/null
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.automotive.powerpolicy.internal;
+
+/**
+ * Structure to store the current policy state.
+ */
+parcelable PolicyState {
+  /**
+   * The current power policy ID.
+   */
+  @utf8InCpp String policyId;
+
+  /**
+   * The current power policy group ID.
+   */
+  @utf8InCpp String policyGroupId;
+}
diff --git a/automotive/powerpolicy/aidl/vts/Android.bp b/automotive/powerpolicy/aidl/vts/Android.bp
new file mode 100644
index 0000000..06b165d
--- /dev/null
+++ b/automotive/powerpolicy/aidl/vts/Android.bp
@@ -0,0 +1,41 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_test {
+    name: "VtsAidlPowerPolicyTargetTest",
+    defaults: [
+        "VtsHalTargetTestDefaults",
+        "use_libaidlvintf_gtest_helper_static",
+    ],
+    srcs: [
+        "VtsAidlPowerPolicyTargetTest.cpp",
+    ],
+    shared_libs: [
+        "libbinder",
+    ],
+    static_libs: [
+        "android.frameworks.automotive.powerpolicy-V1-cpp",
+        "libgmock",
+    ],
+    test_suites: [
+        "general-tests",
+        "vts",
+    ],
+}
\ No newline at end of file
diff --git a/automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp b/automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp
new file mode 100644
index 0000000..7a04efd
--- /dev/null
+++ b/automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <android/frameworks/automotive/powerpolicy/CarPowerPolicy.h>
+#include <android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.h>
+#include <android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.h>
+#include <android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.h>
+#include <android/frameworks/automotive/powerpolicy/PowerComponent.h>
+#include <binder/IBinder.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+#include <gmock/gmock.h>
+#include <utils/StrongPointer.h>
+
+namespace {
+
+using ::android::BBinder;
+using ::android::IBinder;
+using ::android::OK;
+using ::android::ProcessState;
+using ::android::sp;
+using ::android::status_t;
+using ::android::String16;
+using ::android::wp;
+using ::android::binder::Status;
+using ::android::frameworks::automotive::powerpolicy::CarPowerPolicy;
+using ::android::frameworks::automotive::powerpolicy::CarPowerPolicyFilter;
+using ::android::frameworks::automotive::powerpolicy::ICarPowerPolicyChangeCallbackDefault;
+using ::android::frameworks::automotive::powerpolicy::ICarPowerPolicyServer;
+using ::android::frameworks::automotive::powerpolicy::PowerComponent;
+using ::testing::_;
+using ::testing::Return;
+
+class MockBinder : public BBinder {
+   public:
+    MOCK_METHOD(status_t, linkToDeath,
+                (const sp<DeathRecipient>& recipient, void* cookie, uint32_t flags), (override));
+    MOCK_METHOD(status_t, unlinkToDeath,
+                (const wp<DeathRecipient>& recipient, void* cookie, uint32_t flags,
+                 wp<DeathRecipient>* outRecipient),
+                (override));
+};
+
+class MockPowerPolicyChangeCallback : public ICarPowerPolicyChangeCallbackDefault {
+   public:
+    MockPowerPolicyChangeCallback() { mBinder = new MockBinder(); }
+
+    MOCK_METHOD(IBinder*, onAsBinder, (), (override));
+
+    void expectNormalBinder() {
+        EXPECT_CALL(*mBinder, linkToDeath(_, nullptr, 0)).WillRepeatedly(Return(OK));
+        EXPECT_CALL(*mBinder, unlinkToDeath(_, nullptr, 0, nullptr)).WillRepeatedly(Return(OK));
+        EXPECT_CALL(*this, onAsBinder()).WillRepeatedly(Return(mBinder.get()));
+    }
+
+   private:
+    sp<MockBinder> mBinder;
+};
+
+}  // namespace
+
+class PowerPolicyAidlTest : public ::testing::TestWithParam<std::string> {
+   public:
+    virtual void SetUp() override {
+        powerPolicyServer =
+            android::waitForDeclaredService<ICarPowerPolicyServer>(String16(GetParam().c_str()));
+        ASSERT_NE(powerPolicyServer.get(), nullptr);
+    }
+
+    sp<ICarPowerPolicyServer> powerPolicyServer;
+};
+
+TEST_P(PowerPolicyAidlTest, TestGetCurrentPowerPolicy) {
+    CarPowerPolicy policy;
+
+    Status status = powerPolicyServer->getCurrentPowerPolicy(&policy);
+
+    ASSERT_TRUE(status.isOk() || status.exceptionCode() == Status::EX_ILLEGAL_STATE);
+}
+
+TEST_P(PowerPolicyAidlTest, TestGetPowerComponentState) {
+    bool state;
+    for (const auto componentId : android::enum_range<PowerComponent>()) {
+        Status status = powerPolicyServer->getPowerComponentState(componentId, &state);
+
+        ASSERT_TRUE(status.isOk());
+    }
+}
+
+TEST_P(PowerPolicyAidlTest, TestGetPowerComponentState_invalidComponent) {
+    bool state;
+    PowerComponent invalidComponent = (PowerComponent)-1;
+
+    Status status = powerPolicyServer->getPowerComponentState(invalidComponent, &state);
+
+    ASSERT_FALSE(status.isOk());
+}
+
+TEST_P(PowerPolicyAidlTest, TestRegisterCallback) {
+    sp<MockPowerPolicyChangeCallback> callback = new MockPowerPolicyChangeCallback();
+    callback->expectNormalBinder();
+    CarPowerPolicyFilter filter;
+    filter.components.push_back(PowerComponent::AUDIO);
+
+    Status status = powerPolicyServer->registerPowerPolicyChangeCallback(callback, filter);
+
+    ASSERT_TRUE(status.isOk());
+
+    status = powerPolicyServer->unregisterPowerPolicyChangeCallback(callback.get());
+
+    ASSERT_TRUE(status.isOk());
+}
+
+TEST_P(PowerPolicyAidlTest, TestRegisterCallback_doubleRegistering) {
+    sp<MockPowerPolicyChangeCallback> callback = new MockPowerPolicyChangeCallback();
+    callback->expectNormalBinder();
+    CarPowerPolicyFilter filter;
+    filter.components.push_back(PowerComponent::AUDIO);
+
+    Status status = powerPolicyServer->registerPowerPolicyChangeCallback(callback, filter);
+
+    ASSERT_TRUE(status.isOk());
+
+    status = powerPolicyServer->registerPowerPolicyChangeCallback(callback, filter);
+
+    ASSERT_FALSE(status.isOk());
+    ASSERT_EQ(status.exceptionCode(), Status::EX_ILLEGAL_ARGUMENT);
+}
+
+TEST_P(PowerPolicyAidlTest, TestUnegisterNotRegisteredCallback) {
+    sp<MockPowerPolicyChangeCallback> callback = new MockPowerPolicyChangeCallback();
+
+    Status status = powerPolicyServer->unregisterPowerPolicyChangeCallback(callback);
+
+    ASSERT_FALSE(status.isOk());
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PowerPolicyAidlTest);
+INSTANTIATE_TEST_SUITE_P(
+    CarPowerPolicyServer, PowerPolicyAidlTest,
+    ::testing::ValuesIn(android::getAidlHalInstanceNames(ICarPowerPolicyServer::descriptor)),
+    android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    ProcessState::self()->setThreadPoolMaxThreadCount(1);
+    ProcessState::self()->startThreadPool();
+    return RUN_ALL_TESTS();
+}
diff --git a/automotive/telemetry/OWNERS b/automotive/telemetry/OWNERS
new file mode 100644
index 0000000..80794e1
--- /dev/null
+++ b/automotive/telemetry/OWNERS
@@ -0,0 +1,3 @@
+sgurun@google.com
+zhomart@google.com
+mdashouk@google.com
diff --git a/automotive/telemetry/aidl/Android.bp b/automotive/telemetry/aidl/Android.bp
new file mode 100644
index 0000000..cfb04f5
--- /dev/null
+++ b/automotive/telemetry/aidl/Android.bp
@@ -0,0 +1,46 @@
+// Copyright (C) 2021 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.
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+// Audomotive Telemetry interfaces.
+//
+// Depend on "android.frameworks.automotive.telemetry-V1-ndk". Change "V1" to desired version (it
+// must be always provided), and "ndk" to a desired AIDL back-end.
+aidl_interface {
+    name: "android.frameworks.automotive.telemetry",
+    srcs: [
+        "android/frameworks/automotive/telemetry/*.aidl",
+    ],
+    vendor_available: true,
+    stability: "vintf",
+    backend: {
+        cpp: {
+            enabled: true,
+        },
+        java: {
+            enabled: false,
+        },
+        ndk: {
+            enabled: true,
+        },
+    },
+    // Run "m android.frameworks.automotive.telemetry-freeze-api" to bump the version. Freeze the
+    // version only during the release.
+    // Run "m android.frameworks.automotive.telemetry-update-api" to update the
+    // "aidl_api/.../current/" dir.
+    versions: ["1"],
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/.hash b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/.hash
new file mode 100644
index 0000000..b0481d7
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/.hash
@@ -0,0 +1 @@
+8f06f70c4b251c81941f12b8d0dc08e9b56fe2b7
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/android/frameworks/automotive/telemetry/CarData.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/android/frameworks/automotive/telemetry/CarData.aidl
new file mode 100644
index 0000000..4e400b1
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/android/frameworks/automotive/telemetry/CarData.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+parcelable CarData {
+  int id;
+  byte[] content;
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/android/frameworks/automotive/telemetry/ICarTelemetry.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
new file mode 100644
index 0000000..bdf5631
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/1/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+interface ICarTelemetry {
+  void write(in android.frameworks.automotive.telemetry.CarData[] dataList);
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/CarData.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/CarData.aidl
new file mode 100644
index 0000000..4e400b1
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/CarData.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+parcelable CarData {
+  int id;
+  byte[] content;
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
new file mode 100644
index 0000000..bdf5631
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+interface ICarTelemetry {
+  void write(in android.frameworks.automotive.telemetry.CarData[] dataList);
+}
diff --git a/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/CarData.aidl b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/CarData.aidl
new file mode 100644
index 0000000..e1f9b81
--- /dev/null
+++ b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/CarData.aidl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+
+package android.frameworks.automotive.telemetry;
+
+/**
+ * ICarTelemetry data.
+ *
+ * <p>Contents of this object should not be parsed by Android framework.
+ *
+ * <p>Please see packages/services/Car/cpp/telemetry/README.md to learn more.
+ */
+@VintfStability
+parcelable CarData {
+  /**
+   * Must be a valid id. Scripts subscribe to data using this id.
+   */
+  int id;
+
+  /**
+   * Content corresponding to the schema defined by the id.
+   */
+  byte[] content;
+}
diff --git a/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
new file mode 100644
index 0000000..daf2d77
--- /dev/null
+++ b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+
+package android.frameworks.automotive.telemetry;
+
+import android.frameworks.automotive.telemetry.CarData;
+
+/**
+ * This service collects data from varios other services, buffers them, and delivers to the
+ * listening scripts running in CarTelemetryService.
+ */
+@VintfStability
+interface ICarTelemetry {
+  /**
+   * Sends a list of CarData to CarTelemetry.
+   *
+   * <p>Total `dataList` size is limited to 10KB, if it's larger than that, all the data is dropped.
+   * Note that Binder has 1MB data limit from all the clients combined, please keep that in
+   * mind when writing frequent data.
+   *
+   * @throws {@code Parcel#EX_ILLEGAL_ARGUMENT} if {@code dataList} is too large.
+   */
+  void write(in CarData[] dataList);
+}
diff --git a/cameraservice/device/2.1/Android.bp b/cameraservice/device/2.1/Android.bp
new file mode 100644
index 0000000..dd819c9
--- /dev/null
+++ b/cameraservice/device/2.1/Android.bp
@@ -0,0 +1,19 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+hidl_interface {
+    name: "android.frameworks.cameraservice.device@2.1",
+    root: "android.frameworks",
+    srcs: [
+        "ICameraDeviceUser.hal",
+    ],
+    interfaces: [
+        "android.frameworks.cameraservice.common@2.0",
+        "android.frameworks.cameraservice.device@2.0",
+        "android.hidl.base@1.0",
+    ],
+    gen_java: false,
+}
diff --git a/cameraservice/device/2.1/ICameraDeviceUser.hal b/cameraservice/device/2.1/ICameraDeviceUser.hal
new file mode 100644
index 0000000..c99c027
--- /dev/null
+++ b/cameraservice/device/2.1/ICameraDeviceUser.hal
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.cameraservice.device@2.1;
+
+import android.frameworks.cameraservice.common@2.0::Status;
+import android.frameworks.cameraservice.device@2.0::ICameraDeviceUser;
+import android.frameworks.cameraservice.device@2.0::StreamConfigurationMode;
+import android.frameworks.cameraservice.device@2.0::CameraMetadata;
+
+interface ICameraDeviceUser extends @2.0::ICameraDeviceUser {
+
+    /**
+     * endConfigure_2_1:
+     *
+     * Identical to @2.0::ICameraDeviceUser::endConfigure(), except that
+     * it takes an extra startTimeNs parameter to indicate the timestamp when
+     * session configuration starts.
+     *
+     */
+    endConfigure_2_1(StreamConfigurationMode operatingMode,
+                 CameraMetadata sessionParams, int64_t startTimeNs) generates (Status status);
+};
diff --git a/cameraservice/service/2.2/Android.bp b/cameraservice/service/2.2/Android.bp
new file mode 100644
index 0000000..e2482bf
--- /dev/null
+++ b/cameraservice/service/2.2/Android.bp
@@ -0,0 +1,22 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+hidl_interface {
+    name: "android.frameworks.cameraservice.service@2.2",
+    root: "android.frameworks",
+    srcs: [
+	"ICameraService.hal",
+    ],
+    interfaces: [
+        "android.frameworks.cameraservice.common@2.0",
+        "android.frameworks.cameraservice.device@2.0",
+        "android.frameworks.cameraservice.device@2.1",
+        "android.frameworks.cameraservice.service@2.0",
+        "android.frameworks.cameraservice.service@2.1",
+        "android.hidl.base@1.0",
+    ],
+    gen_java: false,
+}
diff --git a/cameraservice/service/2.2/ICameraService.hal b/cameraservice/service/2.2/ICameraService.hal
new file mode 100644
index 0000000..87ec225
--- /dev/null
+++ b/cameraservice/service/2.2/ICameraService.hal
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+package android.frameworks.cameraservice.service@2.2;
+
+import android.frameworks.cameraservice.service@2.1::ICameraService;
+
+interface ICameraService extends @2.1::ICameraService {
+};
diff --git a/cameraservice/vts/functional/Android.bp b/cameraservice/vts/functional/Android.bp
index 32189bf..26c09ec 100644
--- a/cameraservice/vts/functional/Android.bp
+++ b/cameraservice/vts/functional/Android.bp
@@ -26,8 +26,10 @@
     static_libs: [
         "android.hardware.camera.common@1.0-helper",
         "android.frameworks.cameraservice.device@2.0",
+        "android.frameworks.cameraservice.device@2.1",
         "android.frameworks.cameraservice.service@2.0",
         "android.frameworks.cameraservice.service@2.1",
+        "android.frameworks.cameraservice.service@2.2",
         "android.frameworks.cameraservice.common@2.0",
         "libfmq",
     ],
diff --git a/cameraservice/vts/functional/VtsHalCameraServiceV2_0TargetTest.cpp b/cameraservice/vts/functional/VtsHalCameraServiceV2_0TargetTest.cpp
index 3ca7d75..b93cc70 100644
--- a/cameraservice/vts/functional/VtsHalCameraServiceV2_0TargetTest.cpp
+++ b/cameraservice/vts/functional/VtsHalCameraServiceV2_0TargetTest.cpp
@@ -18,6 +18,7 @@
 //#define LOG_NDEBUG 0
 
 #include <android/frameworks/cameraservice/device/2.0/ICameraDeviceUser.h>
+#include <android/frameworks/cameraservice/device/2.1/ICameraDeviceUser.h>
 #include <android/frameworks/cameraservice/service/2.0/ICameraService.h>
 #include <android/frameworks/cameraservice/service/2.1/ICameraService.h>
 #include <system/camera_metadata.h>
@@ -536,6 +537,33 @@
         statusRet = deviceRemote->deleteStream(streamId);
         EXPECT_TRUE(statusRet.isOk() && statusRet == Status::NO_ERROR);
 
+        /**
+         * For camera device V2.1, test newly added functions.
+         * TODO: Refactor the device 2.1 test into a separate test for service 2.2.
+         */
+        auto castResult =
+            android::frameworks::cameraservice::device::V2_1::ICameraDeviceUser::castFrom(
+                deviceRemote);
+        sp<android::frameworks::cameraservice::device::V2_1::ICameraDeviceUser> deviceRemote2_1;
+        if (castResult.isOk()) {
+            deviceRemote2_1 = castResult;
+        }
+        if (deviceRemote2_1 != nullptr) {
+            // Reconfigure a capture session using v2.1 version of the device
+            ret = deviceRemote2_1->beginConfigure();
+            EXPECT_TRUE(ret.isOk() && ret == Status::NO_ERROR);
+            remoteRet =
+                deviceRemote2_1->createStream(output, [&status, &streamId](Status s, auto sId) {
+                    status = s;
+                    streamId = sId;
+                });
+            EXPECT_TRUE(remoteRet.isOk() && status == Status::NO_ERROR);
+            EXPECT_TRUE(streamId >= 0);
+            ret = deviceRemote2_1->endConfigure_2_1(StreamConfigurationMode::NORMAL_MODE,
+                                                    hidlParams, systemTime());
+            EXPECT_TRUE(ret.isOk() && ret == Status::NO_ERROR);
+        }
+
         remoteRet = deviceRemote->disconnect();
         EXPECT_TRUE(remoteRet.isOk());
     }
@@ -603,6 +631,7 @@
     EXPECT_TRUE(remoteStatus.isOk() && remoteStatus == Status::NO_ERROR);
 }
 
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalCameraServiceV2_0TargetTest);
 INSTANTIATE_TEST_SUITE_P(
         PerInstance, VtsHalCameraServiceV2_0TargetTest,
         testing::ValuesIn(android::hardware::getAllHalInstanceNames(ICameraService::descriptor)),
diff --git a/current.txt b/current.txt
index 5a450a6..e106135 100644
--- a/current.txt
+++ b/current.txt
@@ -39,3 +39,9 @@
 392d98ed528ebd5ee14c9e65ef633cbbeeb33c74e5ab1be2cfd8a865ac4c9c86 android.frameworks.cameraservice.service@2.1::ICameraServiceListener
 aedecd4d47697f0cc2d62e46ff7442bab2c4571237719f44b222bfdfcbd30d92 android.frameworks.cameraservice.service@2.1::types
 fefd24d57da1924188e377073e9714dc03b6df181d581da1dab3651d45ebc3c9 android.frameworks.vr.composer@2.0::IVrComposerClient
+
+# HALs released in Android S
+3f47c629bee4057bd76e408bd335088b90f1f088c7ae73c703a75b812738d19e android.frameworks.cameraservice.device@2.1::ICameraDeviceUser
+2959b6f2b54e75c6965f6ddc90d4c8a0673d5585fa9aad2ab03f01f1b76b1945 android.frameworks.cameraservice.service@2.2::ICameraService
+
+# There should be no more HIDL HALs - please use AIDL instead.
diff --git a/displayservice/1.0/vts/functional/VtsFwkDisplayServiceV1_0TargetTest.cpp b/displayservice/1.0/vts/functional/VtsFwkDisplayServiceV1_0TargetTest.cpp
index e993882..da1fa34 100644
--- a/displayservice/1.0/vts/functional/VtsFwkDisplayServiceV1_0TargetTest.cpp
+++ b/displayservice/1.0/vts/functional/VtsFwkDisplayServiceV1_0TargetTest.cpp
@@ -162,6 +162,7 @@
     EXPECT_BAD_VALUE(receiver->setVsyncRate(-1000));
 }
 
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DisplayServiceTest);
 INSTANTIATE_TEST_SUITE_P(
     PerInstance, DisplayServiceTest,
     testing::ValuesIn(android::hardware::getAllHalInstanceNames(IDisplayService::descriptor)),
diff --git a/sensorservice/1.0/vts/functional/VtsHalSensorManagerV1_0TargetTest.cpp b/sensorservice/1.0/vts/functional/VtsHalSensorManagerV1_0TargetTest.cpp
index 02c0fc2..cd91647 100644
--- a/sensorservice/1.0/vts/functional/VtsHalSensorManagerV1_0TargetTest.cpp
+++ b/sensorservice/1.0/vts/functional/VtsHalSensorManagerV1_0TargetTest.cpp
@@ -289,6 +289,7 @@
   }
 }
 
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SensorManagerTest);
 INSTANTIATE_TEST_SUITE_P(
         PerInstance, SensorManagerTest,
         testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISensorManager::descriptor)),
diff --git a/sensorservice/libsensorndkbridge/ALooper.h b/sensorservice/libsensorndkbridge/ALooper.h
index aa14e03..5fa2b62 100644
--- a/sensorservice/libsensorndkbridge/ALooper.h
+++ b/sensorservice/libsensorndkbridge/ALooper.h
@@ -37,7 +37,7 @@
 
     void invalidateSensorQueue(android::wp<ASensorEventQueue> queue);
 
-private:
+   private:
     android::Mutex mLock;
     android::Condition mCondition;
 
diff --git a/stats/1.0/test_client/README b/stats/1.0/test_client/README
index 73c9016..c50b34c 100644
--- a/stats/1.0/test_client/README
+++ b/stats/1.0/test_client/README
@@ -1,2 +1,18 @@
 This client can be installed on the device to test accesses of the service as
 it would be called from other clients.
+
+To install copy binary to /data/local/tmp
+
+Supported command line arguments:
+
+    -h or --help - shows help information
+    -S or --SpeakerImpedance
+    -f or --HardwareFailed
+    -p or --PhysicalDropDetected
+    -y or --ChargeCycles
+    -n or --BatteryHealthSnapshot
+    -i or --SlowIo
+    -s or --BatteryCausedShutdown
+    -u or --UsbPortOverheatEvent
+    -d or --SpeechDspStat
+    -v or --VendorAtom
diff --git a/stats/1.0/test_client/StatsClient.cpp b/stats/1.0/test_client/StatsClient.cpp
index b564161..5abaac0 100644
--- a/stats/1.0/test_client/StatsClient.cpp
+++ b/stats/1.0/test_client/StatsClient.cpp
@@ -42,6 +42,7 @@
 void show_help() {
     std::cout << "Stats HAL client\n";
     std::cout << " arguments:\n";
+    std::cout << " -h or --help - shows help information\n";
     std::cout << " -S or --SpeakerImpedance\n";
     std::cout << " -f or --HardwareFailed\n";
     std::cout << " -p or --PhysicalDropDetected\n";
@@ -74,12 +75,17 @@
         {"UsbPortOverheatEvent", no_argument, 0, 'u'},
         {"SpeechDspStat", no_argument, 0, 'd'},
         {"VendorAtom", no_argument, 0, 'v'},
+        {"help", no_argument, 0, 'h'},
     };
 
     int c;
     int hal_calls = 0;
-    while ((c = getopt_long(argc, argv, "Sfpynisudv", opts, nullptr)) != -1) {
+    while ((c = getopt_long(argc, argv, "hSfpynisudv", opts, nullptr)) != -1) {
         switch (c) {
+            case 'h': {
+                show_help();
+                break;
+            }
             case 'S': {
                 SpeakerImpedance left_obj = {.speakerLocation = 0,
                                              .milliOhms = static_cast<int32_t>(1234 * 1000)};
@@ -180,12 +186,14 @@
                 ++hal_calls;
                 break;
             }
+            default: {
+                show_help();
+                return 1;
+            }
         }
     }
 
-    if (hal_calls == 0) {
-        show_help();
-    } else {
+    if (hal_calls > 0) {
         std::cout << hal_calls << " HAL methods called.\n";
         std::cout << "try: logcat | grep \"statsd.*0x1000\"\n";
     }
diff --git a/stats/1.0/vts/functional/VtsHalStatsV1_0TargetTest.cpp b/stats/1.0/vts/functional/VtsHalStatsV1_0TargetTest.cpp
index b1a0cd2..8a57955 100644
--- a/stats/1.0/vts/functional/VtsHalStatsV1_0TargetTest.cpp
+++ b/stats/1.0/vts/functional/VtsHalStatsV1_0TargetTest.cpp
@@ -147,6 +147,7 @@
     ASSERT_TRUE(ret.isOk());
 }
 
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(StatsHidlTest);
 INSTANTIATE_TEST_SUITE_P(
         PerInstance, StatsHidlTest,
         testing::ValuesIn(android::hardware::getAllHalInstanceNames(IStats::descriptor)),
diff --git a/stats/aidl/Android.bp b/stats/aidl/Android.bp
new file mode 100644
index 0000000..364e1f2
--- /dev/null
+++ b/stats/aidl/Android.bp
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2021 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.
+//
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+    name: "android.frameworks.stats",
+    vendor_available: true,
+    srcs: ["android/frameworks/stats/*.aidl"],
+    stability: "vintf",
+    backend: {
+        cpp: {
+            enabled: false,
+        },
+        java: {
+            enabled: true,
+            platform_apis: true,
+        },
+        ndk: {
+            enabled: true,
+        },
+    },
+    versions: ["1"],
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/1/.hash b/stats/aidl/aidl_api/android.frameworks.stats/1/.hash
new file mode 100644
index 0000000..2291282
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/1/.hash
@@ -0,0 +1 @@
+ee0b303cae7889e83a6a198c9b33781ad74ae633
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/IStats.aidl b/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/IStats.aidl
new file mode 100644
index 0000000..5be1d2f
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/IStats.aidl
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+interface IStats {
+  oneway void reportVendorAtom(in android.frameworks.stats.VendorAtom vendorAtom);
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/VendorAtom.aidl b/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/VendorAtom.aidl
new file mode 100644
index 0000000..c91e4e0
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/VendorAtom.aidl
@@ -0,0 +1,40 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+parcelable VendorAtom {
+  String reverseDomainName;
+  int atomId;
+  android.frameworks.stats.VendorAtomValue[] values;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/VendorAtomValue.aidl b/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/VendorAtomValue.aidl
new file mode 100644
index 0000000..31f26f7
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/1/android/frameworks/stats/VendorAtomValue.aidl
@@ -0,0 +1,41 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+union VendorAtomValue {
+  int intValue;
+  long longValue;
+  float floatValue;
+  String stringValue;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/IStats.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/IStats.aidl
new file mode 100644
index 0000000..5be1d2f
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/IStats.aidl
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+interface IStats {
+  oneway void reportVendorAtom(in android.frameworks.stats.VendorAtom vendorAtom);
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl
new file mode 100644
index 0000000..c91e4e0
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl
@@ -0,0 +1,40 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+parcelable VendorAtom {
+  String reverseDomainName;
+  int atomId;
+  android.frameworks.stats.VendorAtomValue[] values;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl
new file mode 100644
index 0000000..31f26f7
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl
@@ -0,0 +1,41 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+union VendorAtomValue {
+  int intValue;
+  long longValue;
+  float floatValue;
+  String stringValue;
+}
diff --git a/stats/aidl/android/frameworks/stats/IStats.aidl b/stats/aidl/android/frameworks/stats/IStats.aidl
new file mode 100644
index 0000000..8ccd41d
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/IStats.aidl
@@ -0,0 +1,35 @@
+//
+// Copyright (C) 2021 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.
+//
+package android.frameworks.stats;
+
+import android.frameworks.stats.VendorAtom;
+
+/**
+ * IStats is an interface that allows clients to report specific hardware
+ * reliability events, which are translated into calls for the client to accept.
+ */
+@VintfStability
+interface IStats {
+    /**
+     * Report a custom vendor atom.
+     *
+     * @param VendorAtom A VendorAtom struct that specifies the atom ID, field
+     *        types, and data from the client that must be logged in statsd.
+     *        Whether or not the atom is uploaded must be determined by the
+     *        atom ID and server-side configs.
+     */
+    oneway void reportVendorAtom(in VendorAtom vendorAtom);
+}
diff --git a/stats/aidl/android/frameworks/stats/VendorAtom.aidl b/stats/aidl/android/frameworks/stats/VendorAtom.aidl
new file mode 100644
index 0000000..9f34395
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/VendorAtom.aidl
@@ -0,0 +1,54 @@
+//
+// Copyright (C) 2021 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.
+//
+package android.frameworks.stats;
+
+import android.frameworks.stats.VendorAtomValue;
+
+/*
+ * Generic vendor atom that allows dynamically allocated atoms to be uploaded
+ * through statsd.
+ *
+ * Here's an example that uses this struct:
+ *     VendorAtom atom = {
+ *         .atomId  = 100000,
+ *         .values  = {2, 70000, 5.2, 4, "a"}
+ *     };
+ *
+ * The resulting LogEvent must have the following fields:
+ *     Index    Value
+ *     0x1      2
+ *     0x2      70000
+ *     0x3      5.2
+ *     0x4      4
+ *     0x5      "a"
+ */
+@VintfStability
+parcelable VendorAtom {
+    /**
+     * Vendor or OEM reverse domain name. Must be less than 50 characters.
+     * Ex. "com.google.pixel"
+     */
+    String reverseDomainName;
+    /*
+     * Atom ID. Must be between 100,000 - 199,999 to indicate non-AOSP field.
+     */
+    int atomId;
+    /*
+     * Vector of fields in the order that the LogEvent should be filled.
+     */
+    VendorAtomValue[] values;
+}
+
diff --git a/stats/aidl/android/frameworks/stats/VendorAtomValue.aidl b/stats/aidl/android/frameworks/stats/VendorAtomValue.aidl
new file mode 100644
index 0000000..9ae0372
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/VendorAtomValue.aidl
@@ -0,0 +1,27 @@
+//
+// Copyright (C) 2021 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.
+//
+package android.frameworks.stats;
+
+/*
+ * Supported field types for this struct.
+ */
+@VintfStability
+union VendorAtomValue {
+    int intValue;
+    long longValue;
+    float floatValue;
+    String stringValue;
+}
diff --git a/stats/aidl/test_client/AidlStatsClient.cpp b/stats/aidl/test_client/AidlStatsClient.cpp
new file mode 100644
index 0000000..2f8cd89
--- /dev/null
+++ b/stats/aidl/test_client/AidlStatsClient.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+#include <aidl/android/frameworks/stats/IStats.h>
+
+#include <android/binder_manager.h>
+
+#include <statslog.h>
+
+#include <getopt.h>
+#include <iostream>
+
+using aidl::android::frameworks::stats::IStats;
+using aidl::android::frameworks::stats::VendorAtom;
+using aidl::android::frameworks::stats::VendorAtomValue;
+
+void expect_message(int32_t action) {
+    std::cout << "expect the following log in logcat:\n";
+    std::cout << "statsd.*(" << action << ")0x10000->\n";
+}
+
+void show_help() {
+    std::cout << "AIDL Stats HAL client\n";
+    std::cout << " arguments:\n";
+    std::cout << " -h or --help - shows help information\n";
+    std::cout << " -v or --VendorAtom - tests report reportVendorAtom API\n";
+    std::cout << "Please enable statsd logging using 'cmd stats print-logs'";
+    std::cout << "\n\n you can use multiple arguments to trigger multiple events.\n";
+}
+
+int main(int argc, char* argv[]) {
+    // get instance of the aidl version
+    const std::string instance = std::string() + IStats::descriptor + "/default";
+    std::shared_ptr<IStats> service =
+        IStats::fromBinder(ndk::SpAIBinder(AServiceManager_getService(instance.c_str())));
+    if (!service) {
+        std::cerr << "No Stats aidl HAL";
+        return 1;
+    }
+
+    std::cout << "Service instance obtained : " << instance << std::endl;
+
+    static struct option opts[] = {
+        {"VendorAtom", no_argument, 0, 'v'},
+        {"help", no_argument, 0, 'h'},
+    };
+
+    int c;
+    int hal_calls = 0;
+    int failed_calls = 0;
+    while ((c = getopt_long(argc, argv, "vh", opts, nullptr)) != -1) {
+        switch (c) {
+            case 'h': {
+                show_help();
+                break;
+            }
+            case 'v': {
+                std::vector<VendorAtomValue> values;
+                VendorAtomValue tmp;
+                tmp.set<VendorAtomValue::longValue>(70000);
+                values.push_back(tmp);
+                tmp.set<VendorAtomValue::intValue>(7);
+                values.push_back(tmp);
+                tmp.set<VendorAtomValue::floatValue>(8.5);
+                values.push_back(tmp);
+                tmp.set<VendorAtomValue::stringValue>("test");
+                values.push_back(tmp);
+                tmp.set<VendorAtomValue::intValue>(3);
+                values.push_back(tmp);
+                VendorAtom atom = {
+                    .reverseDomainName = "com.google.pixel", .atomId = 100001, .values = values};
+                const ndk::ScopedAStatus ret = service->reportVendorAtom(atom);
+                if (!ret.isOk()) {
+                    std::cout << "reportVendorAtom failed: " << ret.getServiceSpecificError()
+                              << ". Message: " << ret.getMessage() << std::endl;
+                    ++failed_calls;
+                }
+                ++hal_calls;
+                break;
+            }
+            default: {
+                show_help();
+                return 1;
+            }
+        }
+    }
+
+    if (hal_calls > 0) {
+        std::cout << hal_calls << " HAL methods called.\n";
+        std::cout << "try: logcat | grep \"statsd.*0x1000\"\n";
+    }
+
+    return failed_calls;
+}
diff --git a/stats/aidl/test_client/Android.bp b/stats/aidl/test_client/Android.bp
new file mode 100644
index 0000000..c2afd6f
--- /dev/null
+++ b/stats/aidl/test_client/Android.bp
@@ -0,0 +1,40 @@
+//
+// Copyright (C) 2021 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.
+//
+// This client can be installed on the device to test accesses of the AIDL service as
+// it would be called from other clients.
+// To install copy binary to /data/local/tmp
+//
+// Supported command line arguments:
+//     -h or --help - shows help information
+//     -v or --VendorAtom - tests report reportVendorAtom API
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_binary {
+    name: "aidl_stats_client",
+    srcs: [
+        "AidlStatsClient.cpp",
+    ],
+    shared_libs: [
+        "android.frameworks.stats-V1-ndk_platform",
+        "libbase",
+        "libbinder_ndk",
+        "libutils",
+        "libstatslog",
+    ],
+}
diff --git a/stats/aidl/test_client/README b/stats/aidl/test_client/README
new file mode 100644
index 0000000..27e8c72
--- /dev/null
+++ b/stats/aidl/test_client/README
@@ -0,0 +1,8 @@
+This client can be installed on the device to test accesses of the AIDL service as
+it would be called from other clients.
+
+To install copy binary to /data/local/tmp
+
+Supported command line arguments:
+    -h or --help - shows help information
+    -v or --VendorAtom - tests report reportVendorAtom API
diff --git a/stats/aidl/vts/functional/Android.bp b/stats/aidl/vts/functional/Android.bp
new file mode 100644
index 0000000..e0663bd
--- /dev/null
+++ b/stats/aidl/vts/functional/Android.bp
@@ -0,0 +1,41 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_test {
+    name: "VtsAidlHalStatsTargetTest",
+    defaults: [
+        "VtsHalTargetTestDefaults",
+        "use_libaidlvintf_gtest_helper_static",
+    ],
+    srcs: [
+        "VtsHalStatsTargetTest.cpp"
+    ],
+    shared_libs: [
+        "libbinder_ndk",
+        "libvndksupport",
+    ],
+    static_libs: [
+        "android.frameworks.stats-V1-ndk_platform",
+    ],
+    test_suites: [
+        "general-tests",
+        "vts"
+    ],
+}
diff --git a/stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp b/stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp
new file mode 100644
index 0000000..ac46f49
--- /dev/null
+++ b/stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#define LOG_TAG "VtsAidlHalStatsTest"
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+
+#include <aidl/android/frameworks/stats/IStats.h>
+#include <android/binder_manager.h>
+#include <android/log.h>
+
+using aidl::android::frameworks::stats::IStats;
+using aidl::android::frameworks::stats::VendorAtom;
+using aidl::android::frameworks::stats::VendorAtomValue;
+
+class StatsAidlTest : public ::testing::TestWithParam<std::string> {
+   public:
+    virtual void SetUp() override {
+        ndk::SpAIBinder binder(AServiceManager_getService(GetParam().c_str()));
+        client = IStats::fromBinder(binder);
+        ASSERT_NE(client, nullptr);
+    }
+
+    virtual void TearDown() override {}
+
+    std::shared_ptr<IStats> client;
+};
+
+// Validate IStats::reportVendorAtom.
+TEST_P(StatsAidlTest, reportVendorAtom) {
+    std::vector<VendorAtomValue> values;
+    VendorAtomValue tmp;
+    tmp.set<VendorAtomValue::longValue>(70000);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(7);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::floatValue>(8.5);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::stringValue>("test");
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(3);
+    values.push_back(tmp);
+    VendorAtom atom = {.reverseDomainName = "com.google.pixel", .atomId = 100001, .values = values};
+    const ndk::ScopedAStatus ret = client->reportVendorAtom(atom);
+
+    ASSERT_TRUE(ret.isOk());
+}
+
+// Validate IStats::reportVendorAtom - this is a negative test - the error is dumped to logcat
+// Due to the AIDL reportVendorAtom is oneway API - the return code is not returned to the client
+TEST_P(StatsAidlTest, reportVendorAtomInvalidAtomIdLow) {
+    std::vector<VendorAtomValue> values;
+    VendorAtomValue tmp;
+    tmp.set<VendorAtomValue::longValue>(70000);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(7);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::floatValue>(8.5);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::stringValue>("test");
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(3);
+    values.push_back(tmp);
+    VendorAtom atom = {.reverseDomainName = "com.google.pixel", .atomId = 1000, .values = values};
+    const ndk::ScopedAStatus ret = client->reportVendorAtom(atom);
+
+    ASSERT_TRUE(ret.isOk());
+}
+
+// Validate IStats::reportVendorAtom - this is a negative test - the error is dumped to logcat
+// Due to the AIDL reportVendorAtom is oneway API - the return code is not returned to the client
+TEST_P(StatsAidlTest, reportVendorAtomInvalidAtomIdHigh) {
+    std::vector<VendorAtomValue> values;
+    VendorAtomValue tmp;
+    tmp.set<VendorAtomValue::longValue>(70000);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(7);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::floatValue>(8.5);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::stringValue>("test");
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(3);
+    values.push_back(tmp);
+    VendorAtom atom = {.reverseDomainName = "com.google.pixel", .atomId = 300001, .values = values};
+    const ndk::ScopedAStatus ret = client->reportVendorAtom(atom);
+
+    ASSERT_TRUE(ret.isOk());
+}
+
+// Validate IStats::reportVendorAtom - this is a negative test - the error is dumped to logcat
+// Due to the AIDL reportVendorAtom is oneway API - the return code is not returned to the client
+TEST_P(StatsAidlTest, reportVendorAtomInvalidDomainNameTooLong) {
+    std::vector<VendorAtomValue> values;
+    VendorAtomValue tmp;
+    tmp.set<VendorAtomValue::longValue>(70000);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(7);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::floatValue>(8.5);
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::stringValue>("test");
+    values.push_back(tmp);
+    tmp.set<VendorAtomValue::intValue>(3);
+    values.push_back(tmp);
+    VendorAtom atom = {.reverseDomainName = "com.google.pixel.SubDomainName.SubDomainName.Domain",
+                       .atomId = 100001,
+                       .values = values};
+    const ndk::ScopedAStatus ret = client->reportVendorAtom(atom);
+
+    ASSERT_TRUE(ret.isOk());
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(StatsAidlTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance, StatsAidlTest,
+                         testing::ValuesIn(android::getAidlHalInstanceNames(IStats::descriptor)),
+                         android::PrintInstanceNameToString);