Mark ab/7061308 as merged in stage.

Bug: 180401296
Merged-In: I6b99e5e590504bda7f681ae6cdd7557f74402378
Change-Id: I95c93d049f84bb0b88d87533ade5f7cf715e074f
diff --git a/Android.bp b/Android.bp
index 3ac123e..ebdd254 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,35 @@
 // Copyright 2006 The Android Open Source Project
 
+package {
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+// See: http://go/android-license-faq
+license {
+    name: "hardware_libhardware_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+        "SPDX-license-identifier-BSD",
+    ],
+    license_text: [
+        "NOTICE",
+    ],
+}
+
 cc_library_headers {
     name: "libhardware_headers",
     header_libs: [
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 69b0b9c..adec3da 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -233,6 +233,20 @@
     struct record_track_metadata* tracks;
 } sink_metadata_t;
 
+/* HAL version 3.2 and higher only. */
+typedef struct source_metadata_v7 {
+    size_t track_count;
+    /** Array of metadata of each track connected to this source. */
+    struct playback_track_metadata_v7* tracks;
+} source_metadata_v7_t;
+
+/* HAL version 3.2 and higher only. */
+typedef struct sink_metadata_v7 {
+    size_t track_count;
+    /** Array of metadata of each track connected to this sink. */
+    struct record_track_metadata_v7* tracks;
+} sink_metadata_v7_t;
+
 /**
  * audio_stream_out is the abstraction interface for the audio output hardware.
  *
@@ -437,6 +451,88 @@
     int (*set_event_callback)(struct audio_stream_out *stream,
                               stream_event_callback_t callback,
                               void *cookie);
+
+    /**
+     * Called when the metadata of the stream's source has been changed.
+     * HAL version 3.2 and higher only.
+     * @param source_metadata Description of the audio that is played by the clients.
+     */
+    void (*update_source_metadata_v7)(struct audio_stream_out *stream,
+                                      const struct source_metadata_v7* source_metadata);
+
+    /**
+     * Returns the Dual Mono mode presentation setting.
+     *
+     * \param[in] stream the stream object.
+     * \param[out] mode current setting of Dual Mono mode.
+     *
+     * \return 0 if the position is successfully returned.
+     *         -EINVAL if the arguments are invalid
+     *         -ENOSYS if the function is not available
+     */
+    int (*get_dual_mono_mode)(struct audio_stream_out *stream, audio_dual_mono_mode_t *mode);
+
+    /**
+     * Sets the Dual Mono mode presentation on the output device.
+     *
+     * \param[in] stream the stream object.
+     * \param[in] mode selected Dual Mono mode.
+     *
+     * \return 0 in case of success.
+     *         -EINVAL if the arguments are invalid
+     *         -ENOSYS if the function is not available
+     */
+    int (*set_dual_mono_mode)(struct audio_stream_out *stream, const audio_dual_mono_mode_t mode);
+
+    /**
+     * Returns the Audio Description Mix level in dB.
+     *
+     * \param[in] stream the stream object.
+     * \param[out] leveldB the current Audio Description Mix Level in dB.
+     *
+     * \return 0 in case of success.
+     *         -EINVAL if the arguments are invalid
+     *         -ENOSYS if the function is not available
+     */
+    int (*get_audio_description_mix_level)(struct audio_stream_out *stream, float *leveldB);
+
+    /**
+     * Sets the Audio Description Mix level in dB.
+     *
+     * \param[in] stream the stream object.
+     * \param[in] leveldB Audio Description Mix Level in dB.
+     *
+     * \return 0 in case of success.
+     *         -EINVAL if the arguments are invalid
+     *         -ENOSYS if the function is not available
+     */
+    int (*set_audio_description_mix_level)(struct audio_stream_out *stream, const float leveldB);
+
+    /**
+     * Retrieves current playback rate parameters.
+     *
+     * \param[in] stream the stream object.
+     * \param[out] playbackRate current playback parameters.
+     *
+     * \return 0 in case of success.
+     *         -EINVAL if the arguments are invalid
+     *         -ENOSYS if the function is not available
+     */
+    int (*get_playback_rate_parameters)(struct audio_stream_out *stream,
+                                        audio_playback_rate_t *playbackRate);
+
+    /**
+     * Sets the playback rate parameters that control playback behavior.
+     *
+     * \param[in] stream the stream object.
+     * \param[in] playbackRate playback parameters.
+     *
+     * \return 0 in case of success.
+     *         -EINVAL if the arguments are invalid
+     *         -ENOSYS if the function is not available
+     */
+    int (*set_playback_rate_parameters)(struct audio_stream_out *stream,
+                                        const audio_playback_rate_t *playbackRate);
 };
 typedef struct audio_stream_out audio_stream_out_t;
 
@@ -601,6 +697,14 @@
      */
     void (*update_sink_metadata)(struct audio_stream_in *stream,
                                  const struct sink_metadata* sink_metadata);
+
+    /**
+     * Called when the metadata of the stream's sink has been changed.
+     * HAL version 3.2 and higher only.
+     * @param sink_metadata Description of the audio that is recorded by the clients.
+     */
+    void (*update_sink_metadata_v7)(struct audio_stream_in *stream,
+                                    const struct sink_metadata_v7* sink_metadata);
 };
 typedef struct audio_stream_in audio_stream_in_t;
 
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index f4bed73..49f65a9 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -71,6 +71,7 @@
     KM_TAG_INCLUDE_UNIQUE_ID = KM_BOOL | 202,      /* If true, attestation certificates for this key
                                                     * will contain an application-scoped and
                                                     * time-bounded device-unique ID. (keymaster2) */
+    KM_TAG_RSA_OAEP_MGF_DIGEST = KM_ENUM_REP | 203, /* keymaster_digest_t. */
 
     /* Other hardware-enforced. */
     KM_TAG_BLOB_USAGE_REQUIREMENTS = KM_ENUM | 301, /* keymaster_key_blob_usage_requirements_t */
@@ -94,6 +95,8 @@
                                                            cryptographic operations with the key. */
     KM_TAG_MAX_USES_PER_BOOT = KM_UINT | 404,           /* Number of times the key can be used per
                                                            boot. */
+    KM_TAG_USAGE_COUNT_LIMIT = KM_UINT | 405,           /* Number of cryptographic operations left
+                                                           with the key.*/
 
     /* User authentication */
     KM_TAG_ALL_USERS = KM_BOOL | 500,           /* Reserved for future use -- ignore */
@@ -190,7 +193,7 @@
                                                         proving that the user confirmed a signing
                                                         request. */
 
-    KM_TAG_CERTIFICATE_SERIAL = KM_UINT | 1006,      /* The serial number that should be
+    KM_TAG_CERTIFICATE_SERIAL = KM_BIGNUM | 1006,      /* The serial number that should be
                                                         set in the attestation certificate
                                                         to be generated. */
 
@@ -198,6 +201,18 @@
                                                         set in the attestation certificate
                                                         to be generated. */
 
+    KM_TAG_CERTIFICATE_NOT_BEFORE = KM_DATE | 1008,  /* Epoch time in milliseconds of the start of
+                                                        the to be generated certificate's validity.
+                                                        The value should interpreted as too's
+                                                        complement signed integer. Negative values
+                                                        indicate dates before Jan 1970 */
+
+    KM_TAG_CERTIFICATE_NOT_AFTER = KM_DATE | 1009,  /*  Epoch time in milliseconds of the end of
+                                                        the to be generated certificate's validity.
+                                                        The value should interpreted as too's
+                                                        complement signed integer. Negative values
+                                                        indicate dates before Jan 1970 */
+
 
 } keymaster_tag_t;
 
@@ -329,7 +344,8 @@
     KM_PURPOSE_VERIFY = 3,     /* Usable with RSA, EC and HMAC keys. */
     KM_PURPOSE_DERIVE_KEY = 4, /* Usable with EC keys. */
     KM_PURPOSE_WRAP = 5,       /* Usable with wrapped keys. */
-
+    KM_PURPOSE_AGREE_KEY = 6,  /* Usable with EC keys. */
+    KM_PURPOSE_ATTEST_KEY = 7  /* Usabe with RSA and EC keys */
 } keymaster_purpose_t;
 
 typedef struct {
@@ -490,6 +506,12 @@
     KM_ERROR_EARLY_BOOT_ENDED = -73,
     KM_ERROR_ATTESTATION_KEYS_NOT_PROVISIONED = -74,
     KM_ERROR_ATTESTATION_IDS_NOT_PROVISIONED = -75,
+    KM_ERROR_INCOMPATIBLE_MGF_DIGEST = -78,
+    KM_ERROR_UNSUPPORTED_MGF_DIGEST = -79,
+    KM_ERROR_MISSING_NOT_BEFORE = -80,
+    KM_ERROR_MISSING_NOT_AFTER = -81,
+    KM_ERROR_MISSING_ISSUER_SUBJECT = -82,
+    KM_ERROR_INVALID_ISSUER_SUBJECT = -83,
 
     KM_ERROR_UNIMPLEMENTED = -100,
     KM_ERROR_VERSION_MISMATCH = -101,
diff --git a/modules/audio/Android.bp b/modules/audio/Android.bp
index a7467c2..1b34336 100644
--- a/modules/audio/Android.bp
+++ b/modules/audio/Android.bp
@@ -18,6 +18,15 @@
 //
 // The format of the name is audio.<type>.<hardware/etc>.so where the only
 // required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "audio.primary.default",
     relative_install_path: "hw",
diff --git a/modules/audio_remote_submix/Android.bp b/modules/audio_remote_submix/Android.bp
index 9523438..53555f5 100644
--- a/modules/audio_remote_submix/Android.bp
+++ b/modules/audio_remote_submix/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "audio.r_submix.default",
     relative_install_path: "hw",
diff --git a/modules/audio_remote_submix/tests/Android.bp b/modules/audio_remote_submix/tests/Android.bp
index 8e4d42d..490a402 100644
--- a/modules/audio_remote_submix/tests/Android.bp
+++ b/modules/audio_remote_submix/tests/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_test {
     name: "r_submix_tests",
 
diff --git a/modules/camera/3_0/Android.bp b/modules/camera/3_0/Android.bp
index 6d6d1d7..d8aac4f 100644
--- a/modules/camera/3_0/Android.bp
+++ b/modules/camera/3_0/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "camera.default",
     relative_install_path: "hw",
diff --git a/modules/camera/3_4/Android.mk b/modules/camera/3_4/Android.mk
index 0a11f68..7c8eee1 100644
--- a/modules/camera/3_4/Android.mk
+++ b/modules/camera/3_4/Android.mk
@@ -88,6 +88,9 @@
 # ==============================================================================
 include $(CLEAR_VARS)
 LOCAL_MODULE := camera.v4l2
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_CFLAGS += $(v4l2_cflags)
 LOCAL_SHARED_LIBRARIES := $(v4l2_shared_libs)
@@ -103,6 +106,9 @@
 # ==============================================================================
 include $(CLEAR_VARS)
 LOCAL_MODULE := camera.v4l2_test
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
 LOCAL_CFLAGS += $(v4l2_cflags)
 LOCAL_SHARED_LIBRARIES := $(v4l2_shared_libs)
 LOCAL_STATIC_LIBRARIES := \
diff --git a/modules/consumerir/Android.bp b/modules/consumerir/Android.bp
index 4f700c2..f33e4e5 100644
--- a/modules/consumerir/Android.bp
+++ b/modules/consumerir/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "consumerir.default",
     relative_install_path: "hw",
diff --git a/modules/fingerprint/Android.bp b/modules/fingerprint/Android.bp
index 22648b1..5c95374 100644
--- a/modules/fingerprint/Android.bp
+++ b/modules/fingerprint/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "fingerprint.default",
     relative_install_path: "hw",
diff --git a/modules/gralloc/Android.mk b/modules/gralloc/Android.mk
index ff5808d..439c95d 100644
--- a/modules/gralloc/Android.mk
+++ b/modules/gralloc/Android.mk
@@ -31,6 +31,9 @@
 LOCAL_HEADER_LIBRARIES := libhardware_headers
 
 LOCAL_MODULE := gralloc.default
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE
 LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -Wno-missing-field-initializers
 ifeq ($(TARGET_USE_PAN_DISPLAY),true)
 LOCAL_CFLAGS += -DUSE_PAN_DISPLAY=1
diff --git a/modules/hwcomposer/Android.bp b/modules/hwcomposer/Android.bp
index 4f429be..6a864c8 100644
--- a/modules/hwcomposer/Android.bp
+++ b/modules/hwcomposer/Android.bp
@@ -14,6 +14,15 @@
 
 // HAL module implemenation stored in
 // hw/<OVERLAY_HARDWARE_MODULE_ID>.<ro.product.board>.so
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "hwcomposer.default",
     relative_install_path: "hw",
diff --git a/modules/input/evdev/Android.bp b/modules/input/evdev/Android.bp
index bcd563f..9817c73 100644
--- a/modules/input/evdev/Android.bp
+++ b/modules/input/evdev/Android.bp
@@ -13,6 +13,15 @@
 // limitations under the License.
 
 // Evdev module implementation
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "libinput_evdev",
 
diff --git a/modules/local_time/Android.bp b/modules/local_time/Android.bp
index 9f140b3..a4101c0 100644
--- a/modules/local_time/Android.bp
+++ b/modules/local_time/Android.bp
@@ -21,6 +21,15 @@
 // seen in libhardware/hardware.c
 //
 // The format of the name is local_time.<hardware>.so
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "local_time.default",
     relative_install_path: "hw",
diff --git a/modules/nfc-nci/Android.bp b/modules/nfc-nci/Android.bp
index 282e925..31d89aa 100644
--- a/modules/nfc-nci/Android.bp
+++ b/modules/nfc-nci/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "nfc_nci.default",
     relative_install_path: "hw",
diff --git a/modules/nfc/Android.bp b/modules/nfc/Android.bp
index 7c69f11..61fe1b8 100644
--- a/modules/nfc/Android.bp
+++ b/modules/nfc/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "nfc.default",
     relative_install_path: "hw",
diff --git a/modules/power/Android.bp b/modules/power/Android.bp
index 6b0b31f..4abcf37 100644
--- a/modules/power/Android.bp
+++ b/modules/power/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "power.default",
     relative_install_path: "hw",
diff --git a/modules/radio/Android.bp b/modules/radio/Android.bp
index 7f98f0d..7240869 100644
--- a/modules/radio/Android.bp
+++ b/modules/radio/Android.bp
@@ -13,6 +13,15 @@
 // limitations under the License.
 
 // Stub radio HAL module, used for tests
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "radio.fm.default",
     relative_install_path: "hw",
diff --git a/modules/sensors/Android.bp b/modules/sensors/Android.bp
index 3d14bdf..61590a5 100644
--- a/modules/sensors/Android.bp
+++ b/modules/sensors/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_static {
     name: "multihal",
     vendor: true,
diff --git a/modules/sensors/Android.mk b/modules/sensors/Android.mk
index 2becc97..69889de 100644
--- a/modules/sensors/Android.mk
+++ b/modules/sensors/Android.mk
@@ -21,6 +21,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := sensors.$(TARGET_DEVICE)
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE
 
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_PROPRIETARY_MODULE := true
diff --git a/modules/sensors/dynamic_sensor/Android.bp b/modules/sensors/dynamic_sensor/Android.bp
index 214d97c..1ebc04d 100644
--- a/modules/sensors/dynamic_sensor/Android.bp
+++ b/modules/sensors/dynamic_sensor/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_defaults {
     name: "dynamic_sensor_defaults",
 
diff --git a/modules/sensors/dynamic_sensor/HidUtils/Android.bp b/modules/sensors/dynamic_sensor/HidUtils/Android.bp
index 0eb43f8..bbed032 100644
--- a/modules/sensors/dynamic_sensor/HidUtils/Android.bp
+++ b/modules/sensors/dynamic_sensor/HidUtils/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_defaults {
     name: "hid_defaults",
     cflags: [
diff --git a/modules/soundtrigger/Android.bp b/modules/soundtrigger/Android.bp
index aa5e804..86cc593 100644
--- a/modules/soundtrigger/Android.bp
+++ b/modules/soundtrigger/Android.bp
@@ -13,6 +13,15 @@
 // limitations under the License.
 
 // Stub sound_trigger HAL module, used for tests
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "sound_trigger.stub.default",
     relative_install_path: "hw",
diff --git a/modules/thermal/Android.bp b/modules/thermal/Android.bp
index ab5c408..9ac84d7 100644
--- a/modules/thermal/Android.bp
+++ b/modules/thermal/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "thermal.default",
     relative_install_path: "hw",
diff --git a/modules/tv_input/Android.bp b/modules/tv_input/Android.bp
index b9d8afa..13dd301 100644
--- a/modules/tv_input/Android.bp
+++ b/modules/tv_input/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "tv_input.default",
     relative_install_path: "hw",
diff --git a/modules/usbaudio/Android.bp b/modules/usbaudio/Android.bp
index c7d403f..0be27c3 100644
--- a/modules/usbaudio/Android.bp
+++ b/modules/usbaudio/Android.bp
@@ -12,18 +12,43 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-cc_library_shared {
-    name: "audio.usb.default",
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
+cc_defaults {
+    name: "audio.usb_defaults",
     relative_install_path: "hw",
     vendor: true,
     srcs: ["audio_hal.c"],
     shared_libs: [
         "liblog",
         "libcutils",
-        "libtinyalsa",
         "libaudioutils",
-        "libalsautils",
     ],
     cflags: ["-Wno-unused-parameter"],
     header_libs: ["libhardware_headers"],
 }
+
+cc_library_shared {
+    name: "audio.usb.default",
+    defaults: ["audio.usb_defaults"],
+    shared_libs: [
+        "libtinyalsa",
+        "libalsautils",
+    ],
+}
+
+cc_library_shared {
+    name: "audio.usbv2.default",
+    defaults: ["audio.usb_defaults"],
+    shared_libs: [
+        "libtinyalsav2",
+        "libalsautilsv2",
+    ],
+}
diff --git a/modules/usbcamera/Android.bp b/modules/usbcamera/Android.bp
index 5e44d3c..07eb85b 100644
--- a/modules/usbcamera/Android.bp
+++ b/modules/usbcamera/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "camera.usb.default",
     relative_install_path: "hw",
diff --git a/modules/vibrator/Android.bp b/modules/vibrator/Android.bp
index 13ffc83..2412d4d 100644
--- a/modules/vibrator/Android.bp
+++ b/modules/vibrator/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "vibrator.default",
 
diff --git a/modules/vr/Android.bp b/modules/vr/Android.bp
index 40f4510..121939b 100644
--- a/modules/vr/Android.bp
+++ b/modules/vr/Android.bp
@@ -12,6 +12,15 @@
 // 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_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_shared {
     name: "vr.default",
     relative_install_path: "hw",
diff --git a/tests/camera3/Android.bp b/tests/camera3/Android.bp
index 55486ba..6d43066 100644
--- a/tests/camera3/Android.bp
+++ b/tests/camera3/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_test {
     name: "camera3_tests",
     srcs: ["camera3tests.cpp"],
diff --git a/tests/fingerprint/Android.bp b/tests/fingerprint/Android.bp
index 9524b7b..9827e89 100644
--- a/tests/fingerprint/Android.bp
+++ b/tests/fingerprint/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_test {
     name: "fingerprint_tests",
     srcs: ["fingerprint_tests.cpp"],
diff --git a/tests/hardware/Android.bp b/tests/hardware/Android.bp
index 2f5db12..b137684 100644
--- a/tests/hardware/Android.bp
+++ b/tests/hardware/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_static {
     name: "static-hal-check",
     srcs: [
diff --git a/tests/hwc/Android.bp b/tests/hwc/Android.bp
index 782a314..82a00e4 100644
--- a/tests/hwc/Android.bp
+++ b/tests/hwc/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_library_static {
     name: "libcnativewindow",
     srcs: [
diff --git a/tests/input/evdev/Android.bp b/tests/input/evdev/Android.bp
index fa03a00..10fa146 100644
--- a/tests/input/evdev/Android.bp
+++ b/tests/input/evdev/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_test {
     name: "libinput_evdevtests",
 
diff --git a/tests/nusensors/Android.bp b/tests/nusensors/Android.bp
index 8b267db..f06cf7a 100644
--- a/tests/nusensors/Android.bp
+++ b/tests/nusensors/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_libhardware_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_libhardware_license"],
+}
+
 cc_binary {
     name: "test-nusensors",