Merge "Fix Vts drawLayers function for async renderengine change"
diff --git a/cas/1.0/vts/functional/OWNERS b/cas/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..aec93b0
--- /dev/null
+++ b/cas/1.0/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 1344
+quxiangfang@google.com
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 72cb2bc..62067bf 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -194,6 +194,13 @@
             <instance>default</instance>
         </interface>
     </hal>
+    <hal format="aidl" optional="true">
+        <name>android.hardware.contexthub</name>
+        <interface>
+            <name>IContextHub</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.contexthub</name>
         <version>1.2</version>
diff --git a/contexthub/aidl/Android.bp b/contexthub/aidl/Android.bp
new file mode 100644
index 0000000..2086508
--- /dev/null
+++ b/contexthub/aidl/Android.bp
@@ -0,0 +1,28 @@
+// Copyright 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.
+
+aidl_interface {
+    name: "android.hardware.contexthub",
+    vendor_available: true,
+    srcs: ["android/hardware/contexthub/*.aidl"],
+    stability: "vintf",
+    backend: {
+        java: {
+            sdk_version: "module_current",
+        },
+        ndk: {
+            apps_enabled: false,
+        },
+    },
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl
new file mode 100644
index 0000000..8e0ff89
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.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.hardware.contexthub;
+@Backing(type="int") @VintfStability
+enum AsyncEventType {
+  RESTARTED = 1,
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl
new file mode 100644
index 0000000..e573556
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl
@@ -0,0 +1,48 @@
+/*
+ * 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.hardware.contexthub;
+@VintfStability
+parcelable ContextHubInfo {
+  String name;
+  String vendor;
+  String toolchain;
+  int id;
+  float peakMips;
+  int maxSupportedMessageLengthBytes;
+  long chrePlatformId;
+  byte chreApiMajorVersion;
+  byte chreApiMinorVersion;
+  char chrePatchVersion;
+  String[] supportedPermissions;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl
new file mode 100644
index 0000000..e38c251
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl
@@ -0,0 +1,42 @@
+/*
+ * 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.hardware.contexthub;
+@VintfStability
+parcelable ContextHubMessage {
+  long nanoappId;
+  char hostEndPoint;
+  int messageType;
+  byte[] messageBody;
+  String[] permissions;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
new file mode 100644
index 0000000..cb31c84
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
@@ -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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// 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.hardware.contexthub;
+@VintfStability
+interface IContextHub {
+  List<android.hardware.contexthub.ContextHubInfo> getContextHubs();
+  boolean loadNanoapp(in int contextHubId, in android.hardware.contexthub.NanoappBinary appBinary, in int transactionId);
+  boolean unloadNanoapp(in int contextHubId, in long appId, in int transactionId);
+  boolean disableNanoapp(in int contextHubId, in long appId, in int transactionId);
+  boolean enableNanoapp(in int contextHubId, in long appId, in int transactionId);
+  void onSettingChanged(in android.hardware.contexthub.Setting setting, in boolean enabled);
+  boolean queryNanoapps(in int contextHubId);
+  boolean registerCallback(in int contextHubId, in android.hardware.contexthub.IContextHubCallback cb);
+  boolean sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message);
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
new file mode 100644
index 0000000..f81f7cf
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.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.hardware.contexthub;
+@VintfStability
+interface IContextHubCallback {
+  void handleNanoappInfo(in android.hardware.contexthub.NanoappInfo[] appInfo);
+  void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms);
+  void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt);
+  void handleTransactionResult(in int transactionId, in boolean success);
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
new file mode 100644
index 0000000..d53b28f
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
@@ -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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// 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.hardware.contexthub;
+@VintfStability
+parcelable NanoappBinary {
+  long nanoappId;
+  int nanoappVersion;
+  int flags;
+  byte targetChreApiMajorVersion;
+  byte targetChreApiMinorVersion;
+  byte[] customBinary;
+  const int FLAG_SIGNED = 1;
+  const int FLAG_ENCRYPTED = 2;
+  const int FLAG_TCM_CAPABLE = 4;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl
new file mode 100644
index 0000000..ea7825a
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.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.hardware.contexthub;
+@VintfStability
+parcelable NanoappInfo {
+  long nanoappId;
+  int nanoappVersion;
+  boolean enabled;
+  String[] permissions;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl
new file mode 100644
index 0000000..41bc9ae
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl
@@ -0,0 +1,42 @@
+/*
+ * 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.hardware.contexthub;
+@Backing(type="byte") @VintfStability
+enum Setting {
+  LOCATION = 1,
+  WIFI_MAIN = 2,
+  WIFI_SCANNING = 3,
+  AIRPLANE_MODE = 4,
+  MICROPHONE = 5,
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl
new file mode 100644
index 0000000..d884c9c
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl
@@ -0,0 +1,24 @@
+/*
+ * 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.hardware.contexthub;
+
+@VintfStability
+@Backing(type="int")
+enum AsyncEventType {
+    /** An event where the Context Hub has restarted (e.g. due to a crash). */
+    RESTARTED = 1,
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl
new file mode 100644
index 0000000..c0fa702
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl
@@ -0,0 +1,64 @@
+/*
+ * 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.hardware.contexthub;
+
+@VintfStability
+parcelable ContextHubInfo {
+    /** Descriptive name of the Context Hub */
+    String name;
+
+    /** The vendor e.g. "Google" */
+    String vendor;
+
+    /** Toolchain that describes the binary architecture eg: "gcc ARM" */
+    String toolchain;
+
+    /** A unique ID for this Context Hub */
+    int id;
+
+    /** Peak MIPs this platform can deliver */
+    float peakMips;
+
+    /** The maximum length in bytes of the message that can be sent to the Context Hub. */
+    int maxSupportedMessageLengthBytes;
+
+    /**
+     * Machine-readable CHRE platform ID, returned to nanoapps in the CHRE API
+     * function call chreGetPlatformId(). This field pairs with
+     * chreApiMajorVersion, chreApiMinorVersion, and chrePatchVersion to fully
+     * specify the CHRE implementation version. See also the CHRE API header
+     * file chre/version.h.
+     */
+    long chrePlatformId;
+
+    /**
+     * The version of the CHRE implementation returned to nanoApps in the CHRE
+     *  API function call chreGetVersion(). The major and minor version specify
+     * the implemented version of the CHRE API, while the patch version
+     * describes the implementation version within the scope of the platform
+     * ID. See also the CHRE API header file chre/version.h.
+     */
+    byte chreApiMajorVersion;
+    byte chreApiMinorVersion;
+    char chrePatchVersion;
+
+    /**
+     * A list of Android permissions this Context Hub support for nanoapps to enforce host endpoints
+     * are granted in order to communicate with them.
+     */
+    String[] supportedPermissions;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl
new file mode 100644
index 0000000..867da2f
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl
@@ -0,0 +1,49 @@
+/*
+ * 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.hardware.contexthub;
+
+@VintfStability
+parcelable ContextHubMessage {
+    /** The unique identifier of the nanoapp. */
+    long nanoappId;
+
+    /**
+     * The identifier of the host client that is sending/receiving this message.
+     *
+     * There are two reserved values of the host endpoint that has a specific meaning:
+     * 1) BROADCAST = 0xFFFF: see CHRE_HOST_ENDPOINT_BROADCAST in
+     *    system/chre/chre_api/include/chre_api/chre/event.h for details.
+     * 2) UNSPECIFIED = 0xFFFE: see CHRE_HOST_ENDPOINT_UNSPECIFIED in
+     *    system/chre/chre_api/include/chre_api/chre/event.h for details.
+     */
+    char hostEndPoint;
+
+    /** The type of this message */
+    int messageType;
+
+    /** The payload containing the message */
+    byte[] messageBody;
+
+    /**
+     * The list of Android permissions held by the sending nanoapp at the time
+     * the message was sent.
+     *
+     * The framework MUST drop messages to host apps that don't have a superset
+     * of the permissions that the sending nanoapp is using.
+     */
+    String[] permissions;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
new file mode 100644
index 0000000..e820cbf
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
@@ -0,0 +1,154 @@
+/*
+ * 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.hardware.contexthub;
+
+import android.hardware.contexthub.ContextHubInfo;
+import android.hardware.contexthub.ContextHubMessage;
+import android.hardware.contexthub.IContextHubCallback;
+import android.hardware.contexthub.NanoappBinary;
+import android.hardware.contexthub.Setting;
+
+@VintfStability
+interface IContextHub {
+    /**
+     * Enumerates all available Context Hubs.
+     *
+     * @return A list of ContextHubInfo describing all Context Hubs.
+     */
+    List<ContextHubInfo> getContextHubs();
+
+    /**
+     * Loads a nanoapp, and invokes the nanoapp's initialization "start()" entrypoint.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Depending on the implementation, nanoapp loaded via this API may or may
+     * not persist across reboots of the hub. If they do persist, the
+     * implementation must initially place nanoapp in the disabled state upon a
+     * reboot, and not start them until a call is made to enableNanoapp(). In
+     * this case, the app must also be unloaded upon a factory reset of the
+     * device.
+     *
+     * Loading a nanoapp must not take more than 30 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appBinary The nanoapp binary with header
+     * @param transactionId The transaction ID associated with this request
+     *
+     * @return The return code
+     */
+    boolean loadNanoapp(in int contextHubId, in NanoappBinary appBinary, in int transactionId);
+
+    /**
+     * Invokes the nanoapp's deinitialization "end()" entrypoint, and unloads the nanoapp.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Unloading a nanoapp must not take more than 5 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appId The unique ID of the nanoapp
+     * @param transactionId The transaction ID associated with this request
+     *
+     * @return The return code
+     */
+    boolean unloadNanoapp(in int contextHubId, in long appId, in int transactionId);
+
+    /**
+     * Disables a nanoapp by invoking the nanoapp's "end()" entrypoint, but does not unload the
+     * nanoapp.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Disabling a nanoapp must not take more than 5 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appId The unique ID of the nanoapp
+     * @param transactionId The transaction ID associated with this request
+     *
+     * @return The return code
+     */
+    boolean disableNanoapp(in int contextHubId, in long appId, in int transactionId);
+
+    /**
+     * Enables a nanoapp by invoking the nanoapp's initialization "start()" entrypoint.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Enabling a nanoapp must not take more than 5 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appId appIdentifier returned by the HAL
+     * @param message   message to be sent
+     *
+     * @return true on success
+     */
+    boolean enableNanoapp(in int contextHubId, in long appId, in int transactionId);
+
+    /**
+     * Notification sent by the framework to indicate that the user has changed a setting.
+     *
+     * @param setting User setting that has been modified
+     * @param enabled true if the setting has been enabled, false otherwise
+     */
+    void onSettingChanged(in Setting setting, in boolean enabled);
+
+    /**
+     * Queries for a list of loaded nanoapps on a Context Hub.
+     *
+     * If this method succeeds, the result of the query must be delivered through the
+     * handleNanoappInfo() callback.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     *
+     * @return true on success
+     */
+    boolean queryNanoapps(in int contextHubId);
+
+    /**
+     * Register a callback for the HAL implementation to send asynchronous messages to the service
+     * from a Context hub. There can only be one callback registered for a single Context Hub ID.
+     *
+     * A call to this function when a callback has already been registered must override the
+     * previous registration.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param callback an implementation of the IContextHubCallbacks
+     *
+     * @return true on success
+     *
+     */
+    boolean registerCallback(in int contextHubId, in IContextHubCallback cb);
+
+    /**
+     * Sends a message targeted to a nanoapp to the Context Hub.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param message The message to be sent
+     *
+     * @return true on success
+     */
+    boolean sendMessageToHub(in int contextHubId, in ContextHubMessage message);
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
new file mode 100644
index 0000000..e385d48
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
@@ -0,0 +1,77 @@
+/*
+ * 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.hardware.contexthub;
+
+import android.hardware.contexthub.AsyncEventType;
+import android.hardware.contexthub.ContextHubMessage;
+import android.hardware.contexthub.NanoappInfo;
+
+@VintfStability
+interface IContextHubCallback {
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send information about the
+     * currently loaded and active nanoapps on the hub.
+     *
+     * @param appInfo vector of HubAppinfo structure for each nanoApp
+     *                on the hub that can be enabled, disabled and
+     *                unloaded by the service. Any nanoApps that cannot
+     *                be controlled by the service must not be reported.
+     *                All nanoApps that can be controlled by the service
+     *                must be reported.
+     */
+    void handleNanoappInfo(in NanoappInfo[] appInfo);
+
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send asynchronous messages back
+     * to the service and registered clients of the ContextHub service.
+     *
+     * @param msg             message that should be delivered to host app
+     *                        clients
+     * @param msgContentPerms list of Android permissions that cover the
+     *                        contents of the message being sent from the app.
+     *                        This is different from the permissions stored
+     *                        inside of ContextHubMsg in that these must be a
+     *                        subset of those permissions and are meant to
+     *                        assist in properly attributing the message
+     *                        contents when delivering to a ContextHub service
+     *                        client.
+     */
+    void handleContextHubMessage(in ContextHubMessage msg, in String[] msgContentPerms);
+
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send an asynchronous event
+     * to the ContextHub service.
+     *
+     * @param evt event being sent from the contexthub
+     *
+     */
+    void handleContextHubAsyncEvent(in AsyncEventType evt);
+
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send the response for a
+     * transaction.
+     *
+     * @param transactionId The ID of the transaction associated with this callback
+     * @param success true if the transaction succeeded, false otherwise
+     *
+     */
+    void handleTransactionResult(in int transactionId, in boolean success);
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl
new file mode 100644
index 0000000..c677ca6
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl
@@ -0,0 +1,55 @@
+/*
+ * 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.hardware.contexthub;
+
+@VintfStability
+parcelable NanoappBinary {
+    /** Indicates that the nanoapp is securely signed (e.g. for production) */
+    const int FLAG_SIGNED = 1 << 0;
+    const int FLAG_ENCRYPTED = 1 << 1;
+    /** Indicates that the nanoapp can run on a Context Hub's TCM memory region */
+    const int FLAG_TCM_CAPABLE = 1 << 2;
+
+    /**
+     * The unique identifier of the nanoapp for the entire system. See chreNanoappInfo in
+     * system/chre/chre_api/include/chre_api/chre/event.h for the convention for choosing
+     * this ID.
+     */
+    long nanoappId;
+
+    /** The version of the nanoapp. */
+    int nanoappVersion;
+
+    /** The nanoapp flags, comprised of the bitmasks defined in FLAG_* constants above. */
+    int flags;
+
+    /**
+     * The version of the CHRE API that this nanoapp was compiled against. See
+     * the CHRE API header file chre/version.h for more information. The hub
+     * implementation must use this to confirm compatibility before loading
+     * this nanoapp.
+     */
+    byte targetChreApiMajorVersion;
+    byte targetChreApiMinorVersion;
+
+    /**
+     * Implementation-specific binary nanoapp data. This does not include the
+     * common nanoapp header that contains the app ID, etc., as this data is
+     * explicitly passed through the other fields in this struct.
+     */
+    byte[] customBinary;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl
new file mode 100644
index 0000000..9991dc8
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl
@@ -0,0 +1,42 @@
+/*
+ * 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.hardware.contexthub;
+
+@VintfStability
+parcelable NanoappInfo {
+    /** The unique identifier of the nanoapp. */
+    long nanoappId;
+
+    /** The version of the nanoapp */
+    int nanoappVersion;
+
+    /** True if this nanoapp is in a running state, false otherwise */
+    boolean enabled;
+
+    /**
+     * The list of Android permissions used by this nanoapp. This list MUST
+     * correspond to the permissions required for an equivalent Android app to
+     * sample similar signals through the Android framework.
+     *
+     * For example, if a nanoapp used location-based signals, the permissions
+     * list MUST contains android.permission.ACCESS_FINE_LOCATION and
+     * android.permission.ACCESS_BACKGROUND_LOCATION. If it were to also use
+     * audio data, it would require adding android.permission.RECORD_AUDIO to
+     * this list.
+     */
+    String[] permissions;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/android/hardware/contexthub/Setting.aidl
new file mode 100644
index 0000000..f2e55db
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/Setting.aidl
@@ -0,0 +1,42 @@
+/*
+ * 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.hardware.contexthub;
+
+/**
+ * Used to indicate the type of user setting that has changed.
+ */
+@VintfStability
+@Backing(type="byte")
+enum Setting {
+    LOCATION = 1,
+    /**
+     * The main WiFi toggle in the Android settings for WiFi connectivity.
+     */
+    WIFI_MAIN,
+    /**
+     * The "Wi-Fi scanning" setting for location scans.
+     */
+    WIFI_SCANNING,
+    AIRPLANE_MODE,
+    /**
+     * Indicates if the microphone access is available for CHRE. Microphone
+     * access is disabled if the user has turned off the microphone as a
+     * privacy setting, in which case audio data cannot be used and propagated
+     * by CHRE.
+     */
+    MICROPHONE,
+}
diff --git a/contexthub/aidl/default/Android.bp b/contexthub/aidl/default/Android.bp
new file mode 100644
index 0000000..269057a
--- /dev/null
+++ b/contexthub/aidl/default/Android.bp
@@ -0,0 +1,59 @@
+/*
+ * 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 {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_interfaces_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_library_static {
+    name: "libcontexthubexampleimpl",
+    vendor: true,
+    shared_libs: [
+        "libbase",
+        "libbinder_ndk",
+        "android.hardware.contexthub-V1-ndk",
+    ],
+    export_include_dirs: ["include"],
+    srcs: [
+        "ContextHub.cpp",
+    ],
+    visibility: [
+        ":__subpackages__",
+        "//hardware/interfaces/tests/extension/contexthub:__subpackages__",
+    ],
+}
+
+cc_binary {
+    name: "android.hardware.contexthub-service.example",
+    relative_install_path: "hw",
+    init_rc: ["contexthub-default.rc"],
+    vintf_fragments: ["contexthub-default.xml"],
+    vendor: true,
+    shared_libs: [
+        "libbase",
+        "libbinder_ndk",
+        "android.hardware.contexthub-V1-ndk",
+    ],
+    static_libs: [
+        "libcontexthubexampleimpl",
+    ],
+    srcs: ["main.cpp"],
+}
diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp
new file mode 100644
index 0000000..1b56608
--- /dev/null
+++ b/contexthub/aidl/default/ContextHub.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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 "contexthub-impl/ContextHub.h"
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace contexthub {
+
+// TODO(b/194285834): Implement AIDL HAL
+
+::ndk::ScopedAStatus ContextHub::getContextHubs(
+        std::vector<ContextHubInfo>* /* out_contextHubInfos */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::loadNanoapp(int32_t /* in_contextHubId */,
+                                             const NanoappBinary& /* in_appBinary */,
+                                             int32_t /* in_transactionId */,
+                                             bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::unloadNanoapp(int32_t /* in_contextHubId */,
+                                               int64_t /* in_appId */,
+                                               int32_t /* in_transactionId */,
+                                               bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::disableNanoapp(int32_t /* in_contextHubId */,
+                                                int64_t /* in_appId */,
+                                                int32_t /* in_transactionId */,
+                                                bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::enableNanoapp(int32_t /* in_contextHubId */,
+                                               int64_t /* in_appId */,
+                                               int32_t /* in_transactionId */,
+                                               bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::onSettingChanged(Setting /* in_setting */, bool /*in_enabled */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::queryNanoapps(int32_t /* in_contextHubId */,
+                                               bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::registerCallback(
+        int32_t /* in_contextHubId */, const std::shared_ptr<IContextHubCallback>& /* in_cb */,
+        bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::sendMessageToHub(int32_t /* in_contextHubId */,
+                                                  const ContextHubMessage& /* in_message */,
+                                                  bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+}  // namespace contexthub
+}  // namespace hardware
+}  // namespace android
+}  // namespace aidl
diff --git a/contexthub/aidl/default/contexthub-default.rc b/contexthub/aidl/default/contexthub-default.rc
new file mode 100644
index 0000000..a6a6d2a
--- /dev/null
+++ b/contexthub/aidl/default/contexthub-default.rc
@@ -0,0 +1,4 @@
+service vendor.contexthub-default /vendor/bin/hw/android.hardware.contexthub-service.example
+    class hal
+    user context_hub
+    group context_hub
diff --git a/contexthub/aidl/default/contexthub-default.xml b/contexthub/aidl/default/contexthub-default.xml
new file mode 100644
index 0000000..e383c50
--- /dev/null
+++ b/contexthub/aidl/default/contexthub-default.xml
@@ -0,0 +1,7 @@
+<manifest version="1.0" type="device">
+    <hal format="aidl">
+        <name>android.hardware.contexthub</name>
+        <version>1</version>
+        <fqname>IContextHub/default</fqname>
+    </hal>
+</manifest>
diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
new file mode 100644
index 0000000..980cee5
--- /dev/null
+++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/contexthub/BnContextHub.h>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace contexthub {
+
+class ContextHub : public BnContextHub {
+    ::ndk::ScopedAStatus getContextHubs(std::vector<ContextHubInfo>* out_contextHubInfos) override;
+    ::ndk::ScopedAStatus loadNanoapp(int32_t in_contextHubId, const NanoappBinary& in_appBinary,
+                                     int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus unloadNanoapp(int32_t in_contextHubId, int64_t in_appId,
+                                       int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus disableNanoapp(int32_t in_contextHubId, int64_t in_appId,
+                                        int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus enableNanoapp(int32_t in_contextHubId, int64_t in_appId,
+                                       int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override;
+    ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus registerCallback(int32_t in_contextHubId,
+                                          const std::shared_ptr<IContextHubCallback>& in_cb,
+                                          bool* _aidl_return) override;
+    ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId,
+                                          const ContextHubMessage& in_message,
+                                          bool* _aidl_return) override;
+};
+
+}  // namespace contexthub
+}  // namespace hardware
+}  // namespace android
+}  // namespace aidl
diff --git a/contexthub/aidl/default/main.cpp b/contexthub/aidl/default/main.cpp
new file mode 100644
index 0000000..dc9035f
--- /dev/null
+++ b/contexthub/aidl/default/main.cpp
@@ -0,0 +1,36 @@
+/*
+ * 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 "contexthub-impl/ContextHub.h"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+using aidl::android::hardware::contexthub::ContextHub;
+
+int main() {
+    ABinderProcess_setThreadPoolMaxThreadCount(0);
+
+    // Make a default contexthub service
+    auto vib = ndk::SharedRefBase::make<ContextHub>();
+    const std::string vibName = std::string() + ContextHub::descriptor + "/default";
+    binder_status_t status = AServiceManager_addService(vib->asBinder().get(), vibName.c_str());
+    CHECK(status == STATUS_OK);
+
+    ABinderProcess_joinThreadPool();
+    return EXIT_FAILURE;  // should not reach
+}
diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
index d326334..d0ad433 100644
--- a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
+++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
@@ -21,7 +21,6 @@
 
 #include <android-base/logging.h>
 #include <android/hidl/manager/1.0/IServiceManager.h>
-#include <cutils/properties.h>
 
 #include <keymasterV4_0/key_param_output.h>
 #include <keymasterV4_0/keymaster_utils.h>
@@ -686,9 +685,6 @@
             case Algorithm::EC:
                 return {224, 384, 521};
             case Algorithm::AES:
-                // The HAL language was clarified to exclude AES key sizes of 192 for StrongBox
-                // instances on devices launched on API Level 31 and above.
-                if (property_get_int32("ro.board.first_api_level", 0) < 31) return {};
                 return {192};
             default:
                 return {};
diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
index e73196c..8699de3 100644
--- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
+++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
@@ -264,11 +264,13 @@
 
         // Make sure role name follows expected format based on type and
         // isEncoder
-        const std::string role_name(
-                ::android::GetComponentRole(role.isEncoder, role.type.c_str()));
-        EXPECT_EQ(role_name, role.role) << "Role \"" << role.role << "\" does not match "
-                                        << (role.isEncoder ? "an encoder " : "a decoder ")
-                                        << "for mime type \"" << role.type << ".";
+        const char* role_name = ::android::GetComponentRole(role.isEncoder, role.type.c_str());
+        if (role_name != nullptr) {
+            EXPECT_EQ(std::string(role_name), role.role)
+                    << "Role \"" << role.role << "\" does not match "
+                    << (role.isEncoder ? "an encoder " : "a decoder ") << "for media type \""
+                    << role.type << ".";
+        }
 
         // Check the nodes for this role
         std::set<const std::string> nodeKeys;
diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
index cd8cfc5..1849723 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
@@ -96,8 +96,7 @@
  *
  * o   AES
  *
- *      - TRUSTED_ENVIRONMENT IKeyMintDevices must support 128, 192 and 256-bit keys.
- *        STRONGBOX IKeyMintDevices must only support 128 and 256-bit keys.
+ *      - 128 and 256-bit keys
  *      - CBC, CTR, ECB and GCM modes.  The GCM mode must not allow the use of tags smaller than 96
  *        bits or nonce lengths other than 96 bits.
  *      - CBC and ECB modes must support unpadded and PKCS7 padding modes.  With no padding CBC and
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index 931317f..651b21f 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -1843,12 +1843,13 @@
     if (SecLevel() == SecurityLevel::STRONGBOX) return;
 
     auto result = GenerateKey(AuthorizationSetBuilder()
+                                      .Authorization(TAG_ALGORITHM, Algorithm::EC)
                                       .Authorization(TAG_KEY_SIZE, 224)
                                       .Authorization(TAG_EC_CURVE, EcCurve::P_256)
+                                      .SigningKey()
                                       .Digest(Digest::NONE)
                                       .SetDefaultValidity());
-    ASSERT_TRUE(result == ErrorCode::INVALID_ARGUMENT ||
-                result == ErrorCode::UNSUPPORTED_ALGORITHM);
+    ASSERT_TRUE(result == ErrorCode::INVALID_ARGUMENT);
 }
 
 /*
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioExtraMetaData.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioExtraMetaData.aidl
index 20c6e5f..9db9609 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioExtraMetaData.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioExtraMetaData.aidl
@@ -37,7 +37,7 @@
 parcelable AudioExtraMetaData {
   byte adFade;
   byte adPan;
-  byte versionTextTag;
+  char versionTextTag;
   byte adGainCenter;
   byte adGainFront;
   byte adGainSurround;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl
index ee8db8f..91a04a4 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl
@@ -35,7 +35,7 @@
 /* @hide */
 @VintfStability
 parcelable DemuxAlpFilterSettings {
-  byte packetType;
+  int packetType;
   android.hardware.tv.tuner.DemuxAlpLengthType lengthType = android.hardware.tv.tuner.DemuxAlpLengthType.UNDEFINED;
   android.hardware.tv.tuner.DemuxAlpFilterSettingsFilterSettings filterSettings;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxCapabilities.aidl
index 729b797..49afb94 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxCapabilities.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxCapabilities.aidl
@@ -44,7 +44,7 @@
   int numVideoFilter;
   int numPesFilter;
   int numPcrFilter;
-  int numBytesInSectionFilter;
+  long numBytesInSectionFilter;
   int filterCaps;
   int[] linkCaps;
   boolean bTimeFilter;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl
index a9e7b7c..b51e633 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl
@@ -39,5 +39,5 @@
   int mpuSequenceNumber;
   int itemFragmentIndex;
   int lastItemFragmentIndex;
-  char dataLength;
+  int dataLength;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl
index 0d20f8e..9134df3 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl
@@ -35,5 +35,5 @@
 /* @hide */
 @VintfStability
 parcelable DemuxFilterIpPayloadEvent {
-  char dataLength;
+  int dataLength;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
index 351a340..a463d68 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
@@ -35,11 +35,11 @@
 /* @hide */
 @VintfStability
 parcelable DemuxFilterMediaEvent {
-  char streamId;
+  int streamId;
   boolean isPtsPresent;
   long pts;
-  int dataLength;
-  int offset;
+  long dataLength;
+  long offset;
   android.hardware.common.NativeHandle avMemory;
   boolean isSecureMemory;
   long avDataId;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl
index ac7f8a5..2420142 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl
@@ -35,6 +35,6 @@
 /* @hide */
 @VintfStability
 parcelable DemuxFilterPesDataSettings {
-  char streamId;
+  int streamId;
   boolean isRaw;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl
index a4593b4..3ddd5e0 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl
@@ -35,7 +35,7 @@
 /* @hide */
 @VintfStability
 parcelable DemuxFilterPesEvent {
-  char streamId;
-  char dataLength;
+  int streamId;
+  int dataLength;
   int mpuSequenceNumber;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl
index 114d1eb..01b8a77 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable DemuxFilterSectionEvent {
-  char tableId;
-  char version;
-  char sectionNum;
-  char dataLength;
+  int tableId;
+  int version;
+  int sectionNum;
+  int dataLength;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl
index be25137..82d30cb 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl
@@ -35,6 +35,6 @@
 /* @hide */
 @VintfStability
 parcelable DemuxFilterSectionSettingsConditionTableInfo {
-  char tableId;
-  char version;
+  int tableId;
+  int version;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpAddress.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpAddress.aidl
index 935476a..a044a19 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpAddress.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpAddress.aidl
@@ -37,6 +37,6 @@
 parcelable DemuxIpAddress {
   android.hardware.tv.tuner.DemuxIpAddressIpAddress srcIpAddress;
   android.hardware.tv.tuner.DemuxIpAddressIpAddress dstIpAddress;
-  char srcPort;
-  char dstPort;
+  int srcPort;
+  int dstPort;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl
index b0fad65..b22c564 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl
@@ -35,6 +35,6 @@
 /* @hide */
 @VintfStability
 parcelable DemuxMmtpFilterSettings {
-  char mmtpPid;
+  int mmtpPid;
   android.hardware.tv.tuner.DemuxMmtpFilterSettingsFilterSettings filterSettings;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxPid.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxPid.aidl
index 0a29f93..c452f35 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxPid.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxPid.aidl
@@ -35,6 +35,6 @@
 /* @hide */
 @VintfStability
 union DemuxPid {
-  char tPid;
-  char mmtpPid;
+  int tPid;
+  int mmtpPid;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl
index dd94980..ddb61ce 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl
@@ -35,7 +35,7 @@
 /* @hide */
 @VintfStability
 parcelable DemuxTlvFilterSettings {
-  byte packetType;
+  int packetType;
   boolean isCompressedIpPacket;
   android.hardware.tv.tuner.DemuxTlvFilterSettingsFilterSettings filterSettings;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl
index 131cab0..d8d424f 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl
@@ -35,6 +35,6 @@
 /* @hide */
 @VintfStability
 parcelable DemuxTsFilterSettings {
-  char tpid;
+  int tpid;
   android.hardware.tv.tuner.DemuxTsFilterSettingsFilterSettings filterSettings;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSettings.aidl
index efb91ca..33e9347 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSettings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendAnalogSettings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED;
   android.hardware.tv.tuner.FrontendAnalogType type = android.hardware.tv.tuner.FrontendAnalogType.UNDEFINED;
   android.hardware.tv.tuner.FrontendAnalogAftFlag aftFlag = android.hardware.tv.tuner.FrontendAnalogAftFlag.UNDEFINED;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl
index b569c21..6301f96 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl
@@ -35,7 +35,7 @@
 /* @hide */
 @VintfStability
 parcelable FrontendAtsc3PlpSettings {
-  byte plpId;
+  int plpId;
   android.hardware.tv.tuner.FrontendAtsc3Modulation modulation = android.hardware.tv.tuner.FrontendAtsc3Modulation.UNDEFINED;
   android.hardware.tv.tuner.FrontendAtsc3TimeInterleaveMode interleaveMode = android.hardware.tv.tuner.FrontendAtsc3TimeInterleaveMode.UNDEFINED;
   android.hardware.tv.tuner.FrontendAtsc3CodeRate codeRate = android.hardware.tv.tuner.FrontendAtsc3CodeRate.UNDEFINED;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl
index bd96d14..3cbb0d0 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendAtsc3Settings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendAtsc3Bandwidth bandwidth = android.hardware.tv.tuner.FrontendAtsc3Bandwidth.UNDEFINED;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED;
   android.hardware.tv.tuner.FrontendAtsc3DemodOutputFormat demodOutputFormat = android.hardware.tv.tuner.FrontendAtsc3DemodOutputFormat.UNDEFINED;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscSettings.aidl
index 5ccdb85..9121c12 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscSettings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendAtscSettings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED;
   android.hardware.tv.tuner.FrontendAtscModulation modulation = android.hardware.tv.tuner.FrontendAtscModulation.UNDEFINED;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbSettings.aidl
index 9a2e341..5f9b775 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbSettings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendDtmbSettings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED;
   android.hardware.tv.tuner.FrontendDtmbTransmissionMode transmissionMode = android.hardware.tv.tuner.FrontendDtmbTransmissionMode.UNDEFINED;
   android.hardware.tv.tuner.FrontendDtmbBandwidth bandwidth = android.hardware.tv.tuner.FrontendDtmbBandwidth.UNDEFINED;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcSettings.aidl
index 55f0402..6b2caed 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcSettings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendDvbcSettings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendDvbcModulation modulation = android.hardware.tv.tuner.FrontendDvbcModulation.UNDEFINED;
   android.hardware.tv.tuner.FrontendInnerFec fec = android.hardware.tv.tuner.FrontendInnerFec.FEC_UNDEFINED;
   int symbolRate;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsSettings.aidl
index 8a8c76f..dab8888 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsSettings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendDvbsSettings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED;
   android.hardware.tv.tuner.FrontendDvbsModulation modulation = android.hardware.tv.tuner.FrontendDvbsModulation.UNDEFINED;
   android.hardware.tv.tuner.FrontendDvbsCodeRate coderate;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtSettings.aidl
index cc64549..ec1277a 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtSettings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendDvbtSettings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED;
   android.hardware.tv.tuner.FrontendDvbtTransmissionMode transmissionMode = android.hardware.tv.tuner.FrontendDvbtTransmissionMode.UNDEFINED;
   android.hardware.tv.tuner.FrontendDvbtBandwidth bandwidth = android.hardware.tv.tuner.FrontendDvbtBandwidth.UNDEFINED;
@@ -49,6 +49,6 @@
   android.hardware.tv.tuner.FrontendDvbtStandard standard = android.hardware.tv.tuner.FrontendDvbtStandard.UNDEFINED;
   boolean isMiso;
   android.hardware.tv.tuner.FrontendDvbtPlpMode plpMode = android.hardware.tv.tuner.FrontendDvbtPlpMode.UNDEFINED;
-  byte plpId;
-  byte plpGroupId;
+  int plpId;
+  int plpGroupId;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInfo.aidl
index 2f8e6e5..d5bdd58 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInfo.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInfo.aidl
@@ -36,11 +36,11 @@
 @VintfStability
 parcelable FrontendInfo {
   android.hardware.tv.tuner.FrontendType type = android.hardware.tv.tuner.FrontendType.UNDEFINED;
-  int minFrequency;
-  int maxFrequency;
+  long minFrequency;
+  long maxFrequency;
   int minSymbolRate;
   int maxSymbolRate;
-  int acquireRange;
+  long acquireRange;
   int exclusiveGroupId;
   android.hardware.tv.tuner.FrontendStatusType[] statusCaps;
   android.hardware.tv.tuner.FrontendCapabilities frontendCaps;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl
index b96bf32..8c491d6 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl
@@ -35,9 +35,9 @@
 /* @hide */
 @VintfStability
 parcelable FrontendIsdbs3Settings {
-  int frequency;
-  int endFrequency;
-  char streamId;
+  long frequency;
+  long endFrequency;
+  int streamId;
   android.hardware.tv.tuner.FrontendIsdbsStreamIdType streamIdType = android.hardware.tv.tuner.FrontendIsdbsStreamIdType.UNDEFINED;
   android.hardware.tv.tuner.FrontendIsdbs3Modulation modulation = android.hardware.tv.tuner.FrontendIsdbs3Modulation.UNDEFINED;
   android.hardware.tv.tuner.FrontendIsdbs3Coderate coderate = android.hardware.tv.tuner.FrontendIsdbs3Coderate.UNDEFINED;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl
index 0b48ac5..324fb6f 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl
@@ -35,9 +35,9 @@
 /* @hide */
 @VintfStability
 parcelable FrontendIsdbsSettings {
-  int frequency;
-  int endFrequency;
-  char streamId;
+  long frequency;
+  long endFrequency;
+  int streamId;
   android.hardware.tv.tuner.FrontendIsdbsStreamIdType streamIdType = android.hardware.tv.tuner.FrontendIsdbsStreamIdType.UNDEFINED;
   android.hardware.tv.tuner.FrontendIsdbsModulation modulation = android.hardware.tv.tuner.FrontendIsdbsModulation.UNDEFINED;
   android.hardware.tv.tuner.FrontendIsdbsCoderate coderate = android.hardware.tv.tuner.FrontendIsdbsCoderate.UNDEFINED;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl
index ffd30ef..6249097 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl
@@ -35,8 +35,8 @@
 /* @hide */
 @VintfStability
 parcelable FrontendIsdbtSettings {
-  int frequency;
-  int endFrequency;
+  long frequency;
+  long endFrequency;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED;
   android.hardware.tv.tuner.FrontendIsdbtModulation modulation = android.hardware.tv.tuner.FrontendIsdbtModulation.UNDEFINED;
   android.hardware.tv.tuner.FrontendIsdbtBandwidth bandwidth = android.hardware.tv.tuner.FrontendIsdbtBandwidth.UNDEFINED;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl
index 4e217ef..56ef3e3 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl
@@ -35,6 +35,6 @@
 /* @hide */
 @VintfStability
 parcelable FrontendScanAtsc3PlpInfo {
-  byte plpId;
+  int plpId;
   boolean bLlsFlag;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl
index 882bdad..2c6cc00 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl
@@ -37,14 +37,14 @@
 union FrontendScanMessage {
   boolean isLocked;
   boolean isEnd;
-  byte progressPercent;
-  int[] frequencies;
+  int progressPercent;
+  long[] frequencies;
   int[] symbolRates;
   android.hardware.tv.tuner.FrontendDvbtHierarchy hierarchy;
   android.hardware.tv.tuner.FrontendAnalogType analogType;
-  byte[] plpIds;
-  byte[] groupIds;
-  char[] inputStreamIds;
+  int[] plpIds;
+  int[] groupIds;
+  int[] inputStreamIds;
   android.hardware.tv.tuner.FrontendScanMessageStandard std;
   android.hardware.tv.tuner.FrontendScanAtsc3PlpInfo[] atsc3PlpInfos;
   android.hardware.tv.tuner.FrontendModulation modulation;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
index 114b72f..6296cfc 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
@@ -47,13 +47,13 @@
   android.hardware.tv.tuner.FrontendModulationStatus modulationStatus;
   android.hardware.tv.tuner.FrontendSpectralInversion inversion;
   android.hardware.tv.tuner.LnbVoltage lnbVoltage;
-  byte plpId;
+  int plpId;
   boolean isEWBS;
-  byte agc;
+  int agc;
   boolean isLnaOn;
   boolean[] isLayerError;
   int mer;
-  int freqOffset;
+  long freqOffset;
   android.hardware.tv.tuner.FrontendDvbtHierarchy hierarchy;
   boolean isRfLocked;
   android.hardware.tv.tuner.FrontendStatusAtsc3PlpInfo[] plpInfo;
@@ -64,9 +64,9 @@
   android.hardware.tv.tuner.FrontendGuardInterval interval;
   android.hardware.tv.tuner.FrontendTransmissionMode transmissionMode;
   int uec;
-  char systemId;
+  int systemId;
   android.hardware.tv.tuner.FrontendInterleaveMode[] interleaving;
-  byte[] isdbtSegment;
+  int[] isdbtSegment;
   int[] tsDataRate;
   android.hardware.tv.tuner.FrontendRollOff rollOff;
   boolean isMiso;
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl
index 9cd1b8a..8f65925 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl
@@ -35,7 +35,7 @@
 /* @hide */
 @VintfStability
 parcelable FrontendStatusAtsc3PlpInfo {
-  byte plpId;
+  int plpId;
   boolean isLocked;
   int uec;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackSettings.aidl
index ff459e2..e0dd5db 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackSettings.aidl
@@ -36,8 +36,8 @@
 @VintfStability
 parcelable PlaybackSettings {
   int statusMask;
-  int lowThreshold;
-  int highThreshold;
+  long lowThreshold;
+  long highThreshold;
   android.hardware.tv.tuner.DataFormat dataFormat = android.hardware.tv.tuner.DataFormat.UNDEFINED;
-  byte packetSize;
+  long packetSize;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordSettings.aidl
index 447de98..de693cd 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordSettings.aidl
@@ -36,8 +36,8 @@
 @VintfStability
 parcelable RecordSettings {
   int statusMask;
-  int lowThreshold;
-  int highThreshold;
+  long lowThreshold;
+  long highThreshold;
   android.hardware.tv.tuner.DataFormat dataFormat = android.hardware.tv.tuner.DataFormat.UNDEFINED;
-  byte packetSize;
+  long packetSize;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/AudioExtraMetaData.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/AudioExtraMetaData.aidl
index b5adb7d..ea2ef4f 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/AudioExtraMetaData.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/AudioExtraMetaData.aidl
@@ -27,7 +27,7 @@
 
     byte adPan;
 
-    byte versionTextTag;
+    char  versionTextTag;
 
     byte adGainCenter;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl
index 397002d..95bcf65 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl
@@ -33,7 +33,7 @@
      * 6: Packet Type Extension
      * 8: MPEG-2 Transport Stream
      */
-    byte packetType;
+    int packetType;
 
     DemuxAlpLengthType lengthType = DemuxAlpLengthType.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxCapabilities.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxCapabilities.aidl
index 49fa08d..6d61c97 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxCapabilities.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxCapabilities.aidl
@@ -70,7 +70,7 @@
     /**
      * The maximum number of bytes is supported in the mask of Section Filter.
      */
-    int numBytesInSectionFilter;
+    long numBytesInSectionFilter;
 
     /**
      * Filter Main Types defined by DemuxFilterMainType. The DemuxFilterMainTypes
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl
index d59dd2e..cf88928 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl
@@ -39,5 +39,5 @@
     /**
      * Data size in bytes of filtered data
      */
-    char dataLength;
+    int dataLength;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl
index 0619b45..4d6c6e2 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl
@@ -25,5 +25,5 @@
     /**
      * Data size in bytes of IP data
      */
-    char dataLength;
+    int dataLength;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
index 754708c..ec7bbf1 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
@@ -26,7 +26,7 @@
  */
 @VintfStability
 parcelable DemuxFilterMediaEvent {
-    char streamId;
+    int streamId;
 
     /**
      * true if PTS is present in PES header.
@@ -42,13 +42,13 @@
     /**
      * Data size in bytes of audio or video frame
      */
-    int dataLength;
+    long dataLength;
 
     /**
      *  The offset in the memory block which is shared among multiple
      *  MediaEvents.
      */
-    int offset;
+    long offset;
 
     /**
      * A handle associated to the memory where audio or video data stays.
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl
index 9780f40..56fbbfc 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl
@@ -22,7 +22,7 @@
  */
 @VintfStability
 parcelable DemuxFilterPesDataSettings {
-    char streamId;
+    int streamId;
 
     /**
      * true if the filter send onFilterStatus instead of onFilterEvent.
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl
index 2b24cd9..0767c02 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl
@@ -22,12 +22,12 @@
  */
 @VintfStability
 parcelable DemuxFilterPesEvent {
-    char streamId;
+    int streamId;
 
     /**
      * Data size in bytes of PES data
      */
-    char dataLength;
+    int dataLength;
 
     /**
      * MPU sequence number of filtered data (only for MMTP)
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl
index 1a327f3..d666316 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl
@@ -25,20 +25,20 @@
     /**
      * Table ID of filtered data
      */
-    char tableId;
+    int tableId;
 
     /**
      * Version number of filtered data
      */
-    char version;
+    int version;
 
     /**
      * Section number of filtered data
      */
-    char sectionNum;
+    int sectionNum;
 
     /**
      * Data size in bytes of filtered data
      */
-    char dataLength;
+    int dataLength;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl
index c76d84c..898b9cc 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl
@@ -25,10 +25,10 @@
     /**
      * Table ID for Section Filter
      */
-    char tableId;
+    int tableId;
 
     /**
      * Version number for Section Filter
      */
-    char version;
+    int version;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxIpAddress.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxIpAddress.aidl
index 9c704a3..c088cdc 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxIpAddress.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxIpAddress.aidl
@@ -31,10 +31,10 @@
     /**
      * 0 is invalid. should be ignored.
      */
-    char srcPort;
+    int srcPort;
 
     /**
      * 0 is invalid. should be ignored.
      */
-    char dstPort;
+    int dstPort;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl
index 3759ce0..8093d63 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl
@@ -24,7 +24,7 @@
  */
 @VintfStability
 parcelable DemuxMmtpFilterSettings {
-    char mmtpPid;
+    int mmtpPid;
 
     DemuxMmtpFilterSettingsFilterSettings filterSettings;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxPid.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxPid.aidl
index a76d208..7513454 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxPid.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxPid.aidl
@@ -25,10 +25,10 @@
     /**
      * Packet ID is used to specify packets in transport stream.
      */
-    char tPid;
+    int tPid;
 
     /**
      * Packet ID is used to specify packets in MMTP.
      */
-    char mmtpPid;
+    int mmtpPid;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl
index fd1289d..7a215e7 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl
@@ -32,7 +32,7 @@
      * 0xFE: Signaling packet
      * 0xFF: NULL packet
      */
-    byte packetType;
+    int packetType;
 
     /**
      * true if the filtered data is commpressed ip packet
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl
index 1345831..0fc40d6 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl
@@ -27,7 +27,7 @@
     /**
      * Packet ID is used to specify packets in transport stream.
      */
-    char tpid;
+    int tpid;
 
     DemuxTsFilterSettingsFilterSettings filterSettings;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAnalogSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAnalogSettings.aidl
index 926929f..0a3646d 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAnalogSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAnalogSettings.aidl
@@ -30,12 +30,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     FrontendSpectralInversion inversion = FrontendSpectralInversion.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl
index 5678dd3..b7e2295 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl
@@ -27,7 +27,7 @@
  */
 @VintfStability
 parcelable FrontendAtsc3PlpSettings {
-    byte plpId;
+    int plpId;
 
     FrontendAtsc3Modulation modulation = FrontendAtsc3Modulation.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl
index dc1e520..981adc5 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl
@@ -30,12 +30,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     /**
      * Bandwidth of tuning band.
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtscSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtscSettings.aidl
index 1279b14..f9d267e 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtscSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendAtscSettings.aidl
@@ -28,12 +28,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     FrontendSpectralInversion inversion = FrontendSpectralInversion.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDtmbSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDtmbSettings.aidl
index ccac650..095d0b5 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDtmbSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDtmbSettings.aidl
@@ -33,12 +33,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     FrontendSpectralInversion inversion = FrontendSpectralInversion.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbcSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbcSettings.aidl
index d18d373..51be57f 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbcSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbcSettings.aidl
@@ -33,12 +33,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     FrontendDvbcModulation modulation = FrontendDvbcModulation.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbsSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbsSettings.aidl
index d285ac1..785046b 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbsSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbsSettings.aidl
@@ -34,12 +34,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     FrontendSpectralInversion inversion = FrontendSpectralInversion.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbtSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbtSettings.aidl
index 4af0d10..238f071 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbtSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendDvbtSettings.aidl
@@ -35,12 +35,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     FrontendSpectralInversion inversion = FrontendSpectralInversion.UNDEFINED;
 
@@ -75,10 +75,10 @@
     /**
      * Physical Layer Pipe (PLP) Id
      */
-    byte plpId;
+    int plpId;
 
     /**
      * Group Id for Physical Layer Pipe (PLP)
      */
-    byte plpGroupId;
+    int plpGroupId;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendInfo.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendInfo.aidl
index 9f178db..6168fc1 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendInfo.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendInfo.aidl
@@ -31,12 +31,12 @@
     /**
      * Frequency in Hertz
      */
-    int minFrequency;
+    long minFrequency;
 
     /**
      * Frequency in Hertz
      */
-    int maxFrequency;
+    long maxFrequency;
 
     /**
      * Minimum symbols per second
@@ -51,7 +51,7 @@
     /**
      * Range in Hertz
      */
-    int acquireRange;
+    long acquireRange;
 
     /**
      * Frontends are assigned with the same exclusiveGroupId if they can't
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl
index a7c85ac..9b38a59 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl
@@ -30,14 +30,14 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
-    char streamId;
+    int streamId;
 
     FrontendIsdbsStreamIdType streamIdType = FrontendIsdbsStreamIdType.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl
index dde3002..d5b90b7 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl
@@ -30,14 +30,14 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
-    char streamId;
+    int streamId;
 
     FrontendIsdbsStreamIdType streamIdType = FrontendIsdbsStreamIdType.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl
index ffa8845..08f6130 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl
@@ -32,12 +32,12 @@
     /**
      * Signal frequency in Hertz
      */
-    int frequency;
+    long frequency;
 
     /**
      * Signal end frequency in Hertz used by scan
      */
-    int endFrequency;
+    long endFrequency;
 
     FrontendSpectralInversion inversion = FrontendSpectralInversion.UNDEFINED;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl
index 1fe2b1f..ac0c287 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl
@@ -22,7 +22,7 @@
  */
 @VintfStability
 parcelable FrontendScanAtsc3PlpInfo {
-    byte plpId;
+    int plpId;
 
     boolean bLlsFlag;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl
index d89e9b1..19c6766 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl
@@ -36,12 +36,12 @@
     /**
      * scan progress percent (0..100)
      */
-    byte progressPercent;
+    int progressPercent;
 
     /**
      * Signal frequencies in Hertz
      */
-    int[] frequencies;
+    long[] frequencies;
 
     /**
      * Symbols per second
@@ -52,11 +52,11 @@
 
     FrontendAnalogType analogType;
 
-    byte[] plpIds;
+    int[] plpIds;
 
-    byte[] groupIds;
+    int[] groupIds;
 
-    char[] inputStreamIds;
+    int[] inputStreamIds;
 
     FrontendScanMessageStandard std;
 
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
index b9f73ad..ddbd0f8 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
@@ -83,14 +83,14 @@
 
     LnbVoltage lnbVoltage;
 
-    byte plpId;
+    int plpId;
 
     boolean isEWBS;
 
     /**
      * AGC value is normalized from 0 to 255.
      */
-    byte agc;
+    int agc;
 
     boolean isLnaOn;
 
@@ -104,7 +104,7 @@
     /**
      * Frequency difference in Hertz.
      */
-    int freqOffset;
+    long freqOffset;
 
     FrontendDvbtHierarchy hierarchy;
 
@@ -154,7 +154,7 @@
     /**
      * The current DVB-T2 system id status.
      */
-    char systemId;
+    int systemId;
 
     /**
      * Frontend Interleaving Modes.
@@ -164,7 +164,7 @@
     /**
      * Segments in ISDB-T Specification of all the channels.
      */
-    byte[] isdbtSegment;
+    int[] isdbtSegment;
 
     /**
      * Transport Stream Data Rate in BPS of the current channel.
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl
index c10a08c..6b44bc0 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl
@@ -25,7 +25,7 @@
     /**
      * PLP Id value.
      */
-    byte plpId;
+    int plpId;
 
     /**
      * Demod Lock/Unlock status of this particular PLP.
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/PlaybackSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/PlaybackSettings.aidl
index 47d3db6..fc5cf63 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/PlaybackSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/PlaybackSettings.aidl
@@ -34,13 +34,13 @@
      * Unused space size in bytes in the playback. The HAL uses it to trigger
      * InputStatus::SPACE_ALMOST_EMPTY.
      */
-    int lowThreshold;
+    long lowThreshold;
 
     /**
      * Unused space size in bytes in the playback. The HAL uses it to trigger
      * InputStatus::SPACE_ALMOST_FULL.
      */
-    int highThreshold;
+    long highThreshold;
 
     /**
      * The data format in the playback.
@@ -50,5 +50,5 @@
     /**
      * The packet size in bytes in the playback.
      */
-    byte packetSize;
+    long packetSize;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/RecordSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/RecordSettings.aidl
index 94370d6..ac851c6 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/RecordSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/RecordSettings.aidl
@@ -34,13 +34,13 @@
      * Unconsumed data size in bytes in the record. The HAL uses it to trigger
      * OutputStatus::LOW_WATER.
      */
-    int lowThreshold;
+    long lowThreshold;
 
     /**
      * Unconsumed data size in bytes in the record. The HAL uses it to trigger
      * OutputStatus::High_WATER.
      */
-    int highThreshold;
+    long highThreshold;
 
     /**
      * The data format in the record.
@@ -50,5 +50,5 @@
     /**
      * The packet size in bytes in the record.
      */
-    byte packetSize;
+    long packetSize;
 }
diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp
index 9eadb8c..4f34b8e 100644
--- a/tv/tuner/aidl/default/Dvr.cpp
+++ b/tv/tuner/aidl/default/Dvr.cpp
@@ -237,7 +237,7 @@
 }
 
 PlaybackStatus Dvr::checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
-                                              uint32_t highThreshold, uint32_t lowThreshold) {
+                                              int64_t highThreshold, int64_t lowThreshold) {
     if (availableToWrite == 0) {
         return PlaybackStatus::SPACE_FULL;
     } else if (availableToRead > highThreshold) {
@@ -252,9 +252,8 @@
 
 bool Dvr::readPlaybackFMQ(bool isVirtualFrontend, bool isRecording) {
     // Read playback data from the input FMQ
-    int size = mDvrMQ->availableToRead();
-    uint8_t playbackPacketSize =
-            static_cast<uint8_t>(mDvrSettings.get<DvrSettings::Tag::playback>().packetSize);
+    size_t size = mDvrMQ->availableToRead();
+    int64_t playbackPacketSize = mDvrSettings.get<DvrSettings::Tag::playback>().packetSize;
     vector<int8_t> dataOutputBuffer;
     dataOutputBuffer.resize(playbackPacketSize);
     // Dispatch the packet to the PID matching filter output buffer
@@ -461,7 +460,7 @@
 }
 
 RecordStatus Dvr::checkRecordStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
-                                          uint32_t highThreshold, uint32_t lowThreshold) {
+                                          int64_t highThreshold, int64_t lowThreshold) {
     if (availableToWrite == 0) {
         return RecordStatus::OVERFLOW;
     } else if (availableToRead > highThreshold) {
diff --git a/tv/tuner/aidl/default/Dvr.h b/tv/tuner/aidl/default/Dvr.h
index 68933ae..586f885 100644
--- a/tv/tuner/aidl/default/Dvr.h
+++ b/tv/tuner/aidl/default/Dvr.h
@@ -101,9 +101,9 @@
     void maySendPlaybackStatusCallback();
     void maySendRecordStatusCallback();
     PlaybackStatus checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
-                                             uint32_t highThreshold, uint32_t lowThreshold);
+                                             int64_t highThreshold, int64_t lowThreshold);
     RecordStatus checkRecordStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
-                                         uint32_t highThreshold, uint32_t lowThreshold);
+                                         int64_t highThreshold, int64_t lowThreshold);
     /**
      * A dispatcher to read and dispatch input data to all the started filters.
      * Each filter handler handles the data filtering/output writing/filterEvent updating.
diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp
index 77ca2ee..9755e39 100644
--- a/tv/tuner/aidl/default/Filter.cpp
+++ b/tv/tuner/aidl/default/Filter.cpp
@@ -646,8 +646,8 @@
         DemuxFilterPesEvent pesEvent;
         pesEvent = {
                 // temp dump meta data
-                .streamId = static_cast<char16_t>(mPesOutput[3]),
-                .dataLength = static_cast<char16_t>(mPesOutput.size()),
+                .streamId = static_cast<int32_t>(mPesOutput[3]),
+                .dataLength = static_cast<int32_t>(mPesOutput.size()),
         };
         if (DEBUG_FILTER) {
             ALOGD("[Filter] assembled pes data length %d", pesEvent.dataLength);
@@ -793,7 +793,7 @@
             .tableId = 0,
             .version = 1,
             .sectionNum = 1,
-            .dataLength = static_cast<char16_t>(data.size()),
+            .dataLength = static_cast<int32_t>(data.size()),
     };
     mFilterEvents[size].set<DemuxFilterEvent::Tag::section>(secEvent);
     return true;
@@ -891,7 +891,7 @@
     mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().avMemory =
             ::android::dupToAidl(nativeHandle);
     mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().dataLength =
-            static_cast<int32_t>(output.size());
+            static_cast<int64_t>(output.size());
     mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().avDataId = static_cast<int64_t>(dataId);
     if (mPts) {
         mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().pts = mPts;
@@ -932,10 +932,9 @@
     mFilterEvents[size] = DemuxFilterEvent::make<DemuxFilterEvent::Tag::media>();
     mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().avMemory =
             ::android::dupToAidl(nativeHandle);
-    mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().offset =
-            static_cast<int32_t>(mSharedAvMemOffset);
+    mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().offset = mSharedAvMemOffset;
     mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().dataLength =
-            static_cast<int32_t>(output.size());
+            static_cast<int64_t>(output.size());
     if (mPts) {
         mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().pts = mPts;
         mPts = 0;
diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h
index 30eb24b..3f40256 100644
--- a/tv/tuner/aidl/default/Filter.h
+++ b/tv/tuner/aidl/default/Filter.h
@@ -221,7 +221,7 @@
     // Shared A/V memory handle
     native_handle_t* mSharedAvMemHandle = nullptr;
     bool mUsingSharedAvMem = false;
-    uint32_t mSharedAvMemOffset = 0;
+    int64_t mSharedAvMemOffset = 0;
 
     uint32_t mAudioStreamType;
     uint32_t mVideoStreamType;
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index 438f897..660d0bb 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -94,7 +94,7 @@
         return ::ndk::ScopedAStatus::ok();
     }
 
-    int32_t frequency = 0;
+    int64_t frequency = 0;
     switch (in_settings.getTag()) {
         case FrontendSettings::Tag::analog:
             frequency = in_settings.get<FrontendSettings::Tag::analog>().frequency;
@@ -133,7 +133,7 @@
 
     {
         FrontendScanMessage msg;
-        vector<int32_t> frequencies = {frequency};
+        vector<int64_t> frequencies = {frequency};
         msg.set<FrontendScanMessage::Tag::frequencies>(frequencies);
         mCallback->onScanMessage(FrontendScanMessageType::FREQUENCY, msg);
     }
@@ -165,21 +165,21 @@
 
     {
         FrontendScanMessage msg;
-        vector<uint8_t> plpIds = {2};
+        vector<int32_t> plpIds = {2};
         msg.set<FrontendScanMessage::Tag::plpIds>(plpIds);
         mCallback->onScanMessage(FrontendScanMessageType::PLP_IDS, msg);
     }
 
     {
         FrontendScanMessage msg;
-        vector<uint8_t> groupIds = {3};
+        vector<int32_t> groupIds = {3};
         msg.set<FrontendScanMessage::Tag::groupIds>(groupIds);
         mCallback->onScanMessage(FrontendScanMessageType::GROUP_IDS, msg);
     }
 
     {
         FrontendScanMessage msg;
-        vector<char16_t> inputStreamIds = {1};
+        vector<int32_t> inputStreamIds = {1};
         msg.set<FrontendScanMessage::Tag::inputStreamIds>(inputStreamIds);
         mCallback->onScanMessage(FrontendScanMessageType::INPUT_STREAM_IDS, msg);
     }
@@ -350,7 +350,7 @@
                 break;
             }
             case FrontendStatusType::PLP_ID: {
-                status.set<FrontendStatus::plpId>(101);  // type uint8_t
+                status.set<FrontendStatus::plpId>(101);
                 break;
             }
             case FrontendStatusType::EWBS: {
@@ -613,7 +613,7 @@
                 break;
             }
             case FrontendStatusType::ISDBT_SEGMENTS: {
-                vector<uint8_t> segments = {2, 3};
+                vector<int32_t> segments = {2, 3};
                 status.set<FrontendStatus::isdbtSegment>(segments);
                 break;
             }
diff --git a/tv/tuner/aidl/vts/functional/FilterTests.cpp b/tv/tuner/aidl/vts/functional/FilterTests.cpp
index 381475a..c53adb2 100644
--- a/tv/tuner/aidl/vts/functional/FilterTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FilterTests.cpp
@@ -118,8 +118,8 @@
 }
 
 bool FilterCallback::dumpAvData(const DemuxFilterMediaEvent& event) {
-    int32_t length = event.dataLength;
-    int32_t offset = event.offset;
+    int64_t length = event.dataLength;
+    int64_t offset = event.offset;
     int av_fd;
     // read data from buffer pointed by a handle
     if (event.avMemory.fds.size() == 0) {
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
index 93b7976..7dce4fb 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -120,7 +120,7 @@
 
 void FrontendCallback::scanTest(std::shared_ptr<IFrontend>& frontend, FrontendConfig config,
                                 FrontendScanType type) {
-    int32_t targetFrequency = getTargetFrequency(config.settings);
+    int64_t targetFrequency = getTargetFrequency(config.settings);
     if (type == FrontendScanType::SCAN_BLIND) {
         // reset the frequency in the scan configuration to test blind scan. The settings param of
         // passed in means the real input config on the transponder connected to the DUT.
@@ -176,7 +176,7 @@
     mScanMsgProcessed = true;
 }
 
-int32_t FrontendCallback::getTargetFrequency(FrontendSettings& settings) {
+int64_t FrontendCallback::getTargetFrequency(FrontendSettings& settings) {
     switch (settings.getTag()) {
         case FrontendSettings::Tag::analog:
             return settings.get<FrontendSettings::Tag::analog>().frequency;
@@ -202,7 +202,7 @@
 }
 
 void FrontendCallback::resetBlindScanStartingFrequency(FrontendConfig& config,
-                                                       int32_t resetingFreq) {
+                                                       int64_t resetingFreq) {
     switch (config.settings.getTag()) {
         case FrontendSettings::Tag::analog:
             config.settings.get<FrontendSettings::Tag::analog>().frequency = resetingFreq;
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.h b/tv/tuner/aidl/vts/functional/FrontendTests.h
index b65704f..e5a9cd3 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.h
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.h
@@ -53,8 +53,8 @@
                   FrontendScanType type);
 
     // Helper methods
-    int32_t getTargetFrequency(FrontendSettings& settings);
-    void resetBlindScanStartingFrequency(FrontendConfig& config, int32_t resetingFreq);
+    int64_t getTargetFrequency(FrontendSettings& settings);
+    void resetBlindScanStartingFrequency(FrontendConfig& config, int64_t resetingFreq);
 
   private:
     void readFrontendScanMessage_Modulation(FrontendModulation modulation);
@@ -113,7 +113,7 @@
                 .lowThreshold = 0x1000,
                 .highThreshold = 0x07fff,
                 .dataFormat = DataFormat::ES,
-                .packetSize = static_cast<int8_t>(188),
+                .packetSize = static_cast<int64_t>(188),
         };
         dvrConfig.type = DvrType::PLAYBACK;
         dvrConfig.playbackInputFile = "/data/local/tmp/test.es";
diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
index 2d7be9e..b411011 100644
--- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
+++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
@@ -334,7 +334,7 @@
                 filterMap[id].settings = settings;
 
                 if (filterConfig.hasMonitorEventTypes()) {
-                    filterMap[id].monitorEventTypes = (uint32_t)filterConfig.getMonitorEventTypes();
+                    filterMap[id].monitorEventTypes = (int32_t)filterConfig.getMonitorEventTypes();
                 }
                 if (filterConfig.hasAvFilterSettings_optional()) {
                     auto av = filterConfig.getFirstAvFilterSettings_optional();
@@ -380,7 +380,7 @@
                         return;
                 }
                 dvrMap[id].type = type;
-                dvrMap[id].bufferSize = static_cast<uint32_t>(dvrConfig.getBufferSize());
+                dvrMap[id].bufferSize = static_cast<int32_t>(dvrConfig.getBufferSize());
                 if (dvrConfig.hasInputFilePath()) {
                     dvrMap[id].playbackInputFile = dvrConfig.getInputFilePath();
                 }
@@ -413,7 +413,7 @@
             for (auto descramblerConfig : descramblers.getDescrambler()) {
                 string id = descramblerConfig.getId();
                 descramblerMap[id].casSystemId =
-                        static_cast<uint32_t>(descramblerConfig.getCasSystemId());
+                        static_cast<int32_t>(descramblerConfig.getCasSystemId());
                 if (descramblerConfig.hasProvisionStr()) {
                     descramblerMap[id].provisionStr = descramblerConfig.getProvisionStr();
                 } else {
@@ -450,8 +450,7 @@
             auto timeFilters = *hardwareConfig.getFirstTimeFilters();
             for (auto timeFilterConfig : timeFilters.getTimeFilter()) {
                 string id = timeFilterConfig.getId();
-                timeFilterMap[id].timeStamp =
-                        static_cast<uint64_t>(timeFilterConfig.getTimeStamp());
+                timeFilterMap[id].timeStamp = static_cast<int64_t>(timeFilterConfig.getTimeStamp());
             }
         }
     }
@@ -625,14 +624,17 @@
     static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) {
         ALOGW("[ConfigReader] fe type is dvbt");
         FrontendDvbtSettings dvbtSettings{
-                .frequency = (int32_t)feConfig.getFrequency(),
+                .frequency = (int64_t)feConfig.getFrequency(),
         };
+        if (feConfig.hasEndFrequency()) {
+            dvbtSettings.endFrequency = (int64_t)feConfig.getEndFrequency();
+        }
         if (!feConfig.hasDvbtFrontendSettings_optional()) {
             ALOGW("[ConfigReader] no more dvbt settings");
             return dvbtSettings;
         }
         auto dvbt = feConfig.getFirstDvbtFrontendSettings_optional();
-        uint32_t trans = static_cast<uint32_t>(dvbt->getTransmissionMode());
+        int32_t trans = static_cast<int32_t>(dvbt->getTransmissionMode());
         dvbtSettings.transmissionMode = static_cast<FrontendDvbtTransmissionMode>(trans);
         dvbtSettings.bandwidth = static_cast<FrontendDvbtBandwidth>(dvbt->getBandwidth());
         dvbtSettings.isHighPriority = dvbt->getIsHighPriority();
@@ -656,15 +658,18 @@
     static FrontendDvbsSettings readDvbsFrontendSettings(Frontend feConfig) {
         ALOGW("[ConfigReader] fe type is dvbs");
         FrontendDvbsSettings dvbsSettings{
-                .frequency = (int32_t)feConfig.getFrequency(),
+                .frequency = (int64_t)feConfig.getFrequency(),
         };
+        if (feConfig.hasEndFrequency()) {
+            dvbsSettings.endFrequency = (int64_t)feConfig.getEndFrequency();
+        }
         if (!feConfig.hasDvbsFrontendSettings_optional()) {
             ALOGW("[ConfigReader] no more dvbs settings");
             return dvbsSettings;
         }
-        dvbsSettings.symbolRate = static_cast<uint32_t>(
+        dvbsSettings.symbolRate = static_cast<int32_t>(
                 feConfig.getFirstDvbsFrontendSettings_optional()->getSymbolRate());
-        dvbsSettings.inputStreamId = static_cast<uint32_t>(
+        dvbsSettings.inputStreamId = static_cast<int32_t>(
                 feConfig.getFirstDvbsFrontendSettings_optional()->getInputStreamId());
         auto dvbs = feConfig.getFirstDvbsFrontendSettings_optional();
         if (dvbs->hasScanType()) {
@@ -968,11 +973,11 @@
     static PlaybackSettings readPlaybackSettings(Dvr dvrConfig) {
         ALOGW("[ConfigReader] dvr type is playback");
         PlaybackSettings playbackSettings{
-                .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()),
-                .lowThreshold = static_cast<int32_t>(dvrConfig.getLowThreshold()),
-                .highThreshold = static_cast<int32_t>(dvrConfig.getHighThreshold()),
+                .statusMask = static_cast<int8_t>(dvrConfig.getStatusMask()),
+                .lowThreshold = static_cast<int64_t>(dvrConfig.getLowThreshold()),
+                .highThreshold = static_cast<int64_t>(dvrConfig.getHighThreshold()),
                 .dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()),
-                .packetSize = static_cast<int8_t>(dvrConfig.getPacketSize()),
+                .packetSize = static_cast<int64_t>(dvrConfig.getPacketSize()),
         };
         return playbackSettings;
     }
@@ -980,11 +985,11 @@
     static RecordSettings readRecordSettings(Dvr dvrConfig) {
         ALOGW("[ConfigReader] dvr type is record");
         RecordSettings recordSettings{
-                .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()),
-                .lowThreshold = static_cast<int32_t>(dvrConfig.getLowThreshold()),
-                .highThreshold = static_cast<int32_t>(dvrConfig.getHighThreshold()),
+                .statusMask = static_cast<int8_t>(dvrConfig.getStatusMask()),
+                .lowThreshold = static_cast<int64_t>(dvrConfig.getLowThreshold()),
+                .highThreshold = static_cast<int64_t>(dvrConfig.getHighThreshold()),
                 .dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()),
-                .packetSize = static_cast<int8_t>(dvrConfig.getPacketSize()),
+                .packetSize = static_cast<int64_t>(dvrConfig.getPacketSize()),
         };
         return recordSettings;
     }