From 6132dbbca811a43a9b8960a42945c0e5d7fce44f Mon Sep 17 00:00:00 2001 From: Gaurav Sarode Date: Tue, 1 Aug 2017 18:13:10 -0700 Subject: Enable Vendor image for emulator builds bug:63744464 Test: Local build Change-Id: I4e6f8ed67664cd9a9d05dfdd69b5d636f9bcf836 --- car-arm64/BoardConfig.mk | 5 +++++ car-armv7-a-neon/BoardConfig.mk | 5 +++++ car-x86/BoardConfig.mk | 5 +++++ car-x86_64/BoardConfig.mk | 5 +++++ common/product/emulator.mk | 2 +- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/car-arm64/BoardConfig.mk b/car-arm64/BoardConfig.mk index e1a8a86..b6dbbce 100644 --- a/car-arm64/BoardConfig.mk +++ b/car-arm64/BoardConfig.mk @@ -18,6 +18,11 @@ BOARD_FLASH_BLOCK_SIZE := 512 TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true TARGET_USES_CAR_FUTURE_FEATURES := true +# Enable Vendor Image +TARGET_COPY_OUT_VENDOR := vendor +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 + BOARD_SEPOLICY_DIRS += \ packages/services/Car/car_product/sepolicy \ device/generic/car/common/sepolicy diff --git a/car-armv7-a-neon/BoardConfig.mk b/car-armv7-a-neon/BoardConfig.mk index be11136..2c93039 100644 --- a/car-armv7-a-neon/BoardConfig.mk +++ b/car-armv7-a-neon/BoardConfig.mk @@ -37,6 +37,11 @@ BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 BOARD_FLASH_BLOCK_SIZE := 512 TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true +# Enable Vendor Image +TARGET_COPY_OUT_VENDOR := vendor +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 + BOARD_SEPOLICY_DIRS += \ packages/services/Car/car_product/sepolicy \ device/generic/car/common/sepolicy diff --git a/car-x86/BoardConfig.mk b/car-x86/BoardConfig.mk index 0c3d3b4..c0439a4 100644 --- a/car-x86/BoardConfig.mk +++ b/car-x86/BoardConfig.mk @@ -26,6 +26,11 @@ BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 BOARD_FLASH_BLOCK_SIZE := 512 TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true +# Enable Vendor Image +TARGET_COPY_OUT_VENDOR := vendor +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 + BOARD_SEPOLICY_DIRS += \ packages/services/Car/car_product/sepolicy \ device/generic/car/common/sepolicy diff --git a/car-x86_64/BoardConfig.mk b/car-x86_64/BoardConfig.mk index 939ddea..eb112bc 100644 --- a/car-x86_64/BoardConfig.mk +++ b/car-x86_64/BoardConfig.mk @@ -19,6 +19,11 @@ BOARD_FLASH_BLOCK_SIZE := 512 TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true TARGET_USES_CAR_FUTURE_FEATURES := true +# Enable Vendor Image +TARGET_COPY_OUT_VENDOR := vendor +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 + BOARD_SEPOLICY_DIRS += \ packages/services/Car/car_product/sepolicy \ device/generic/car/common/sepolicy diff --git a/common/product/emulator.mk b/common/product/emulator.mk index 356dbb1..fe9a2f3 100644 --- a/common/product/emulator.mk +++ b/common/product/emulator.mk @@ -67,7 +67,7 @@ PRODUCT_PACKAGE_OVERLAYS := device/generic/goldfish/overlay # Vendor Interface Manifest PRODUCT_COPY_FILES += \ - device/generic/car/common/product/manifest.xml:system/vendor/manifest.xml + device/generic/car/common/product/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml # Graphics HAL PRODUCT_PACKAGES += \ -- cgit v1.2.3 From 096606fb7d6935e334952d468d044dff6c088bac Mon Sep 17 00:00:00 2001 From: Roozbeh Pournader Date: Wed, 9 Aug 2017 12:52:19 -0700 Subject: Replace locales_full.mk with languages_full.mk locales_full.mk is removed. Bug: 64527460 Test: none Change-Id: If717f4717c23fdfbe24f8e4b3c9605cfdb5eb21f --- common/product/full_base.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/product/full_base.mk b/common/product/full_base.mk index 929e5d8..74bacbb 100644 --- a/common/product/full_base.mk +++ b/common/product/full_base.mk @@ -47,7 +47,7 @@ $(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk) $(call inherit-product-if-exists, external/svox/pico/lang/all_pico_languages.mk) # Get a list of languages. -$(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk) # Get everything else from the parent package $(call inherit-product, device/generic/car/common/product/generic_no_telephony.mk) -- cgit v1.2.3 From a1069c33a05d4993e7fbcbad57e9863cfedbfa8b Mon Sep 17 00:00:00 2001 From: Nicholas Sauer Date: Wed, 13 Sep 2017 20:33:28 -0700 Subject: Cleanup AAE Emulator configs bug: 65801015 Test: lunch aosp_car_emu_x86-userdebug && m -j emulator -verbose -show-kernel -selinux permissive Change-Id: I6976a249c78311deafc99292e2ead4025f756973 --- AndroidProducts.mk | 8 +- aosp_car_emu_arm.mk | 22 +++ aosp_car_emu_arm64.mk | 22 +++ aosp_car_emu_x86.mk | 22 +++ aosp_car_emu_x86_64.mk | 22 +++ car-arm64/BoardConfig.mk | 36 ----- car-arm64/aosp_car_emu_arm64.mk | 24 --- car-armv7-a-neon/BoardConfig.mk | 36 ----- car-armv7-a-neon/aosp_car_emu_arm.mk | 23 --- car-x86/BoardConfig.mk | 37 ----- car-x86/aosp_car_emu_x86.mk | 23 --- car-x86_64/BoardConfig.mk | 36 ----- car-x86_64/aosp_car_emu_x86_64.mk | 23 --- common/android.hardware.dummy.xml | 2 +- common/car.mk | 60 +++++++ common/car_core_hardware.xml | 88 ++++++++++ common/config.ini | 8 + common/manifest.xml | 196 +++++++++++++++++++++++ common/preloaded-classes-car | 1 - common/product/aosp_arm.mk | 18 --- common/product/aosp_arm64.mk | 35 ---- common/product/aosp_base.mk | 16 -- common/product/aosp_base_telephony.mk | 16 -- common/product/aosp_x86.mk | 18 --- common/product/aosp_x86_64.mk | 49 ------ common/product/car.mk | 39 ----- common/product/core.mk | 63 -------- common/product/emulator.mk | 112 ------------- common/product/full.mk | 31 ---- common/product/full_base.mk | 58 ------- common/product/full_base_telephony.mk | 31 ---- common/product/full_x86.mk | 44 ----- common/product/generic_no_telephony.mk | 69 -------- common/sepolicy/bootanim.te | 4 - common/sepolicy/device.te | 6 - common/sepolicy/domain.te | 9 -- common/sepolicy/file.te | 2 - common/sepolicy/file_contexts | 19 +-- common/sepolicy/goldfish_setup.te | 29 ---- common/sepolicy/hal_gnss_default.te | 3 - common/sepolicy/hal_graphics_composer_default.te | 3 - common/sepolicy/init.te | 1 - common/sepolicy/logpersist.te | 13 -- common/sepolicy/netd.te | 1 - common/sepolicy/property.te | 8 - common/sepolicy/property_contexts | 6 - common/sepolicy/qemu_props.te | 12 -- common/sepolicy/qemud.te | 8 - common/sepolicy/rild.te | 1 - common/sepolicy/shell.te | 1 - common/sepolicy/surfaceflinger.te | 4 - common/sepolicy/system_app.te | 1 - common/sepolicy/system_server.te | 6 - common/sepolicy/zygote.te | 1 - manifest.xml | 63 -------- 55 files changed, 446 insertions(+), 1043 deletions(-) create mode 100644 aosp_car_emu_arm.mk create mode 100644 aosp_car_emu_arm64.mk create mode 100644 aosp_car_emu_x86.mk create mode 100644 aosp_car_emu_x86_64.mk delete mode 100644 car-arm64/BoardConfig.mk delete mode 100644 car-arm64/aosp_car_emu_arm64.mk delete mode 100644 car-armv7-a-neon/BoardConfig.mk delete mode 100644 car-armv7-a-neon/aosp_car_emu_arm.mk delete mode 100644 car-x86/BoardConfig.mk delete mode 100644 car-x86/aosp_car_emu_x86.mk delete mode 100644 car-x86_64/BoardConfig.mk delete mode 100644 car-x86_64/aosp_car_emu_x86_64.mk create mode 100644 common/car.mk create mode 100644 common/car_core_hardware.xml create mode 100644 common/config.ini create mode 100644 common/manifest.xml delete mode 100644 common/preloaded-classes-car delete mode 100644 common/product/aosp_arm.mk delete mode 100644 common/product/aosp_arm64.mk delete mode 100644 common/product/aosp_base.mk delete mode 100644 common/product/aosp_base_telephony.mk delete mode 100644 common/product/aosp_x86.mk delete mode 100644 common/product/aosp_x86_64.mk delete mode 100644 common/product/car.mk delete mode 100644 common/product/core.mk delete mode 100644 common/product/emulator.mk delete mode 100644 common/product/full.mk delete mode 100644 common/product/full_base.mk delete mode 100644 common/product/full_base_telephony.mk delete mode 100644 common/product/full_x86.mk delete mode 100644 common/product/generic_no_telephony.mk delete mode 100644 common/sepolicy/bootanim.te delete mode 100644 common/sepolicy/device.te delete mode 100644 common/sepolicy/domain.te delete mode 100644 common/sepolicy/file.te delete mode 100644 common/sepolicy/goldfish_setup.te delete mode 100644 common/sepolicy/hal_gnss_default.te delete mode 100644 common/sepolicy/hal_graphics_composer_default.te delete mode 100644 common/sepolicy/init.te delete mode 100644 common/sepolicy/logpersist.te delete mode 100644 common/sepolicy/netd.te delete mode 100644 common/sepolicy/property.te delete mode 100644 common/sepolicy/property_contexts delete mode 100644 common/sepolicy/qemu_props.te delete mode 100644 common/sepolicy/qemud.te delete mode 100644 common/sepolicy/rild.te delete mode 100644 common/sepolicy/shell.te delete mode 100644 common/sepolicy/surfaceflinger.te delete mode 100644 common/sepolicy/system_server.te delete mode 100644 common/sepolicy/zygote.te delete mode 100644 manifest.xml diff --git a/AndroidProducts.mk b/AndroidProducts.mk index b926b87..fdc9d4f 100644 --- a/AndroidProducts.mk +++ b/AndroidProducts.mk @@ -15,7 +15,7 @@ # PRODUCT_MAKEFILES := \ - $(LOCAL_DIR)/car-arm64/aosp_car_emu_arm64.mk \ - $(LOCAL_DIR)/car-armv7-a-neon/aosp_car_emu_arm.mk \ - $(LOCAL_DIR)/car-x86/aosp_car_emu_x86.mk \ - $(LOCAL_DIR)/car-x86_64/aosp_car_emu_x86_64.mk \ + $(LOCAL_DIR)/aosp_car_emu_arm64.mk \ + $(LOCAL_DIR)/aosp_car_emu_arm.mk \ + $(LOCAL_DIR)/aosp_car_emu_x86.mk \ + $(LOCAL_DIR)/aosp_car_emu_x86_64.mk \ diff --git a/aosp_car_emu_arm.mk b/aosp_car_emu_arm.mk new file mode 100644 index 0000000..b7ba7bb --- /dev/null +++ b/aosp_car_emu_arm.mk @@ -0,0 +1,22 @@ +# +# Copyright (C) 2016 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. + +$(call inherit-product, device/generic/car/common/car.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm.mk) + +PRODUCT_NAME := aosp_car_emu_arm +PRODUCT_DEVICE := generic +PRODUCT_BRAND := Android +PRODUCT_MODEL := Car on arm64 emulator diff --git a/aosp_car_emu_arm64.mk b/aosp_car_emu_arm64.mk new file mode 100644 index 0000000..5b5a54a --- /dev/null +++ b/aosp_car_emu_arm64.mk @@ -0,0 +1,22 @@ +# +# Copyright (C) 2017 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. + +$(call inherit-product, device/generic/car/common/car.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm64.mk) + +PRODUCT_NAME := aosp_car_emu_arm64 +PRODUCT_DEVICE := generic_arm64 +PRODUCT_BRAND := Android +PRODUCT_MODEL := Car on ARM emulator diff --git a/aosp_car_emu_x86.mk b/aosp_car_emu_x86.mk new file mode 100644 index 0000000..94c4f87 --- /dev/null +++ b/aosp_car_emu_x86.mk @@ -0,0 +1,22 @@ +# +# Copyright (C) 2017 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. + +$(call inherit-product, device/generic/car/common/car.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86.mk) + +PRODUCT_NAME := aosp_car_emu_x86 +PRODUCT_DEVICE := generic_x86 +PRODUCT_BRAND := Android +PRODUCT_MODEL := Car on x86 emulator diff --git a/aosp_car_emu_x86_64.mk b/aosp_car_emu_x86_64.mk new file mode 100644 index 0000000..2c9d6d5 --- /dev/null +++ b/aosp_car_emu_x86_64.mk @@ -0,0 +1,22 @@ +# +# Copyright (C) 2017 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. + +$(call inherit-product, device/generic/car/common/car.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86_64.mk) + +PRODUCT_NAME := aosp_car_emu_x86_64 +PRODUCT_DEVICE := generic_x86_64 +PRODUCT_BRAND := Android +PRODUCT_MODEL := Car on x86_64 emulator diff --git a/car-arm64/BoardConfig.mk b/car-arm64/BoardConfig.mk deleted file mode 100644 index e326eb9..0000000 --- a/car-arm64/BoardConfig.mk +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (C) 2017 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 $(SRC_TARGET_DIR)/board/generic_arm64/BoardConfig.mk - -TARGET_USES_CAR_FUTURE_FEATURES := true - -# Enable Vendor Image -TARGET_COPY_OUT_VENDOR := vendor -BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 -BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472 -BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 -BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016 - -# Use generic car (instead of build/target/board/generic/sepolicy) -# and car_product policy. -# TODO This is only necessary because car_product defines opengl as well. -# When that is removed, remove this BoardConfig and switch the device in the mk -# to generic_x86. -BOARD_SEPOLICY_DIRS := \ - device/generic/car/common/sepolicy \ - packages/services/Car/car_product/sepolicy diff --git a/car-arm64/aosp_car_emu_arm64.mk b/car-arm64/aosp_car_emu_arm64.mk deleted file mode 100644 index 061e950..0000000 --- a/car-arm64/aosp_car_emu_arm64.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2017 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. -# - -$(call inherit-product, device/generic/car/common/product/aosp_arm64.mk) - -$(call inherit-product, device/generic/car/common/product/car.mk) - -PRODUCT_NAME := aosp_car_emu_arm64 -PRODUCT_DEVICE := car-arm64 -PRODUCT_BRAND := Android -PRODUCT_MODEL := Car on ARM emulator diff --git a/car-armv7-a-neon/BoardConfig.mk b/car-armv7-a-neon/BoardConfig.mk deleted file mode 100644 index 9a9be7a..0000000 --- a/car-armv7-a-neon/BoardConfig.mk +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (C) 2017 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 $(SRC_TARGET_DIR)/board/generic/BoardConfig.mk - -TARGET_USES_CAR_FUTURE_FEATURES := true - -# Enable Vendor Image -TARGET_COPY_OUT_VENDOR := vendor -BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 -BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472 -BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 -BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016 - -# Use generic car (instead of build/target/board/generic/sepolicy) -# and car_product policy. -# TODO This is only necessary because car_product defines opengl as well. -# When that is removed, remove this BoardConfig and switch the device in the mk -# to generic_x86. -BOARD_SEPOLICY_DIRS := \ - device/generic/car/common/sepolicy \ - packages/services/Car/car_product/sepolicy diff --git a/car-armv7-a-neon/aosp_car_emu_arm.mk b/car-armv7-a-neon/aosp_car_emu_arm.mk deleted file mode 100644 index 765991a..0000000 --- a/car-armv7-a-neon/aosp_car_emu_arm.mk +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2016 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. - -$(call inherit-product, device/generic/car/common/product/aosp_arm.mk) - -$(call inherit-product, device/generic/car/common/product/car.mk) - -PRODUCT_NAME := aosp_car_emu_arm -PRODUCT_DEVICE := car-armv7-a-neon -PRODUCT_BRAND := Android -PRODUCT_MODEL := Car on arm64 emulator diff --git a/car-x86/BoardConfig.mk b/car-x86/BoardConfig.mk deleted file mode 100644 index 974bd04..0000000 --- a/car-x86/BoardConfig.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (C) 2017 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 $(SRC_TARGET_DIR)/board/generic_x86/BoardConfig.mk - -TARGET_USES_CAR_FUTURE_FEATURES := true - -# Enable Vendor Image -TARGET_COPY_OUT_VENDOR := vendor -BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 -BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472 -BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 -BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016 - -# Use generic car (instead of build/target/board/generic/sepolicy) -# and car_product policy. -# TODO This is only necessary because car_product defines opengl as well. -# When that is removed, remove this BoardConfig and switch the device in the mk -# to generic_x86. -BOARD_SEPOLICY_DIRS := \ - build/target/board/generic_x86/sepolicy \ - device/generic/car/common/sepolicy \ - packages/services/Car/car_product/sepolicy diff --git a/car-x86/aosp_car_emu_x86.mk b/car-x86/aosp_car_emu_x86.mk deleted file mode 100644 index 58e04c8..0000000 --- a/car-x86/aosp_car_emu_x86.mk +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2017 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. - -$(call inherit-product, device/generic/car/common/product/aosp_x86.mk) - -$(call inherit-product, device/generic/car/common/product/car.mk) - -PRODUCT_NAME := aosp_car_emu_x86 -PRODUCT_DEVICE := car-x86 -PRODUCT_BRAND := Android -PRODUCT_MODEL := Car on x86 emulator diff --git a/car-x86_64/BoardConfig.mk b/car-x86_64/BoardConfig.mk deleted file mode 100644 index a4d3c67..0000000 --- a/car-x86_64/BoardConfig.mk +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (C) 2017 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 $(SRC_TARGET_DIR)/board/generic_x86_64/BoardConfig.mk - -TARGET_USES_CAR_FUTURE_FEATURES := true - -# Enable Vendor Image -TARGET_COPY_OUT_VENDOR := vendor -BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 -BOARD_VENDORIMAGE_PARTITION_SIZE := 1610612736 -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472 -BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 -BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016 - -# Use generic car (instead of build/target/board/generic/sepolicy) -# and car_product policy. -# TODO This is only necessary because car_product defines opengl as well. -# When that is removed, remove this BoardConfig and switch the device in the mk -# to generic_x86. -BOARD_SEPOLICY_DIRS := \ - device/generic/car/common/sepolicy \ - packages/services/Car/car_product/sepolicy diff --git a/car-x86_64/aosp_car_emu_x86_64.mk b/car-x86_64/aosp_car_emu_x86_64.mk deleted file mode 100644 index f381a05..0000000 --- a/car-x86_64/aosp_car_emu_x86_64.mk +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2017 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. - -$(call inherit-product, device/generic/car/common/product/aosp_x86_64.mk) - -$(call inherit-product, device/generic/car/common/product/car.mk) - -PRODUCT_NAME := aosp_car_emu_x86_64 -PRODUCT_DEVICE := car-x86_64 -PRODUCT_BRAND := Android -PRODUCT_MODEL := Car on x86_64 emulator diff --git a/common/android.hardware.dummy.xml b/common/android.hardware.dummy.xml index d66fd14..5c882e0 100644 --- a/common/android.hardware.dummy.xml +++ b/common/android.hardware.dummy.xml @@ -13,6 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. --> - + diff --git a/common/car.mk b/common/car.mk new file mode 100644 index 0000000..b908292 --- /dev/null +++ b/common/car.mk @@ -0,0 +1,60 @@ +# +# Copyright (C) 2017 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. +# + +# TODO Remove this when AAE is fully treble ready +PRODUCT_FULL_TREBLE_OVERRIDE := false + +# Auto modules +PRODUCT_PACKAGES += \ + android.hardware.automotive.vehicle@2.0-service + +# Emulator configuration +PRODUCT_COPY_FILES += \ + device/generic/car/common/config.ini:config.ini + +# Car init.rc +PRODUCT_COPY_FILES += \ + packages/services/Car/car_product/init/init.bootstat.rc:root/init.bootstat.rc \ + packages/services/Car/car_product/init/init.car.rc:root/init.car.rc + +# Enable landscape +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.screen.landscape.xml:system/etc/permissions/android.hardware.screen.landscape.xml + +# Overwrite handheld_core_hardware.xml with a dummy config. +PRODUCT_COPY_FILES += \ + device/generic/car/common/android.hardware.dummy.xml:system/etc/permissions/handheld_core_hardware.xml \ + device/generic/car/common/car_core_hardware.xml:system/etc/permissions/car_core_hardware.xml \ + frameworks/native/data/etc/android.hardware.type.automotive.xml:system/etc/permissions/android.hardware.type.automotive.xml + +# Vendor Interface Manifest +PRODUCT_COPY_FILES += \ + device/generic/car/common/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml + +PRODUCT_PROPERTY_OVERRIDES += \ + android.car.drawer.unlimited=true \ + android.car.hvac.demo=true \ + com.android.car.radio.demo=true \ + com.android.car.radio.demo.dual=true + +TARGET_USES_CAR_FUTURE_FEATURES := true + +# Add car related sepolicy. +BOARD_SEPOLICY_DIRS += \ + device/google/generic/car/common/sepolicy \ + packages/services/Car/car_product/sepolicy + +$(call inherit-product, packages/services/Car/car_product/build/car.mk) diff --git a/common/car_core_hardware.xml b/common/car_core_hardware.xml new file mode 100644 index 0000000..9c9f4c5 --- /dev/null +++ b/common/car_core_hardware.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/config.ini b/common/config.ini new file mode 100644 index 0000000..621b581 --- /dev/null +++ b/common/config.ini @@ -0,0 +1,8 @@ +hw.lcd.density=120 +hw.gpu.enabled=yes +hw.camera.back=none +hw.camera.front=none +hw.mainKeys=no +skin.dynamic=yes +skin.name=800x480 +skin.path=800x480 diff --git a/common/manifest.xml b/common/manifest.xml new file mode 100644 index 0000000..0eed84e --- /dev/null +++ b/common/manifest.xml @@ -0,0 +1,196 @@ + + + + android.hardware.drm + hwbinder + 1.0 + + ICryptoFactory + default + widevine + + + IDrmFactory + default + widevine + + + + android.hardware.soundtrigger + hwbinder + 2.0 + + ISoundTriggerHw + default + + + + android.hardware.audio.effect + hwbinder + 2.0 + + IEffectsFactory + default + + + + android.hardware.biometrics.fingerprint + hwbinder + 2.1 + + IBiometricsFingerprint + default + + + + android.hardware.configstore + hwbinder + 1.0 + + ISurfaceFlingerConfigs + default + + + + android.hardware.audio + hwbinder + 2.0 + + IDevicesFactory + default + + + + android.hardware.keymaster + hwbinder + 3.0 + + IKeymasterDevice + default + + + + android.hardware.graphics.allocator + hwbinder + 2.0 + + IAllocator + default + + + + android.hardware.graphics.mapper + passthrough + 2.0 + + IMapper + default + + + + android.hardware.graphics.composer + hwbinder + 2.1 + + IComposer + default + + + + android.hardware.power + hwbinder + 1.0 + + IPower + default + + + + android.hardware.broadcastradio + hwbinder + 1.0 + + IBroadcastRadioFactory + default + + + + android.hardware.camera.provider + hwbinder + 2.4 + + ICameraProvider + legacy/0 + + + + android.hardware.sensors + hwbinder + 1.0 + + ISensors + default + + + + android.hardware.gatekeeper + hwbinder + 1.0 + + IGatekeeper + default + + + + android.hardware.gnss + hwbinder + 1.0 + + IGnss + default + + + + android.hardware.media.omx + hwbinder + 1.0 + + IOmx + default + + + IOmxStore + default + + + + android.hardware.radio.deprecated + hwbinder + 1.0 + + IOemHook + slot1 + + + + android.hardware.radio + hwbinder + 1.0 + + IRadio + slot1 + + + + android.hardware.automotive.vehicle + hwbinder + 2.0 + + IVehicle + default + + + + 27.0 + + diff --git a/common/preloaded-classes-car b/common/preloaded-classes-car deleted file mode 100644 index 962099f..0000000 --- a/common/preloaded-classes-car +++ /dev/null @@ -1 +0,0 @@ -# Classes which are preloaded by com.android.internal.os.ZygoteInit. diff --git a/common/product/aosp_arm.mk b/common/product/aosp_arm.mk deleted file mode 100644 index 1dd5e89..0000000 --- a/common/product/aosp_arm.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2016 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 device/generic/car/common/product/full.mk - -PRODUCT_NAME := aosp_arm diff --git a/common/product/aosp_arm64.mk b/common/product/aosp_arm64.mk deleted file mode 100644 index 41ec6ac..0000000 --- a/common/product/aosp_arm64.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2016 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 is a build configuration for a full-featured build of the -# Open-Source part of the tree. It's geared toward a US-centric -# build quite specifically for the emulator, and might not be -# entirely appropriate to inherit from for on-device configurations. - -# This is for enabling ethernet support for ranchu. -# Consider removing this after RIL support is provided in ranchu. -PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml - -$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) -$(call inherit-product, device/generic/car/common/product/aosp_base_telephony.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) - -include device/generic/car/common/product/emulator.mk - -PRODUCT_NAME := aosp_arm64 -PRODUCT_DEVICE := generic_arm64 -PRODUCT_BRAND := Android -PRODUCT_MODEL := AOSP on ARM arm64 Emulator diff --git a/common/product/aosp_base.mk b/common/product/aosp_base.mk deleted file mode 100644 index d3be4e4..0000000 --- a/common/product/aosp_base.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright 2016 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. -# -$(call inherit-product, device/generic/car/common/product/full_base.mk) diff --git a/common/product/aosp_base_telephony.mk b/common/product/aosp_base_telephony.mk deleted file mode 100644 index 4d9fee2..0000000 --- a/common/product/aosp_base_telephony.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright 2016 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. -# -$(call inherit-product, device/generic/car/common/product/full_base_telephony.mk) diff --git a/common/product/aosp_x86.mk b/common/product/aosp_x86.mk deleted file mode 100644 index 376d072..0000000 --- a/common/product/aosp_x86.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2017 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 device/generic/car/common/product/full_x86.mk - -PRODUCT_NAME := aosp_x86 diff --git a/common/product/aosp_x86_64.mk b/common/product/aosp_x86_64.mk deleted file mode 100644 index 690c23e..0000000 --- a/common/product/aosp_x86_64.mk +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright 2016 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 is a build configuration for a full-featured build of the -# Open-Source part of the tree. It's geared toward a US-centric -# build quite specifically for the emulator, and might not be -# entirely appropriate to inherit from for on-device configurations. - -# If running on an emulator or some other device that has a LAN connection -# that isn't a wifi connection. This will instruct init.rc to enable the -# network connection so that you can use it with ADB - -# This is for enabling ethernet support for ranchu. -# Consider removing this after RIL support is provided in ranchu. -PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml - -$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) -$(call inherit-product, device/generic/car/common/product/aosp_base_telephony.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk) - -include device/generic/car/common/product/emulator.mk - -ifdef NET_ETH0_STARTONBOOT - PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1 -endif - -# Ensure we package the BIOS files too. -PRODUCT_PACKAGES += \ - bios.bin \ - vgabios-cirrus.bin \ - -# Overrides -PRODUCT_NAME := aosp_x86_64 -PRODUCT_DEVICE := generic_x86_64 -PRODUCT_BRAND := Android -PRODUCT_MODEL := AOSP on IA x86_64 Emulator diff --git a/common/product/car.mk b/common/product/car.mk deleted file mode 100644 index 848d73d..0000000 --- a/common/product/car.mk +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (C) 2017 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. -# - -# Common Car -PRODUCT_RESTRICT_VENDOR_FILES := false - -# Auto modules -PRODUCT_PACKAGES += \ - android.hardware.automotive.vehicle@2.0-service - -# Replace framework versions with dummy one, which is essentially -# the same as removing the xml. Needs this as there is no easy -# way to remove PRODUCT_COPY_FILES from inherited products. -PRODUCT_COPY_FILES += \ - device/generic/car/common/android.hardware.dummy.xml:system/etc/permissions/handheld_core_hardware.xml \ - frameworks/native/data/etc/android.hardware.screen.landscape.xml:system/etc/permissions/android.hardware.screen.landscape.xml \ - packages/services/Car/car_product/init/init.bootstat.rc:root/init.bootstat.rc \ - packages/services/Car/car_product/init/init.car.rc:root/init.car.rc \ - -PRODUCT_PROPERTY_OVERRIDES += \ - android.car.drawer.unlimited=true \ - android.car.hvac.demo=true \ - com.android.car.radio.demo=true \ - com.android.car.radio.demo.dual=true - -$(call inherit-product, packages/services/Car/car_product/build/car.mk) diff --git a/common/product/core.mk b/common/product/core.mk deleted file mode 100644 index 748ae7e..0000000 --- a/common/product/core.mk +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright (C) 2016 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. -# - -# Base configuration for communication-oriented android devices -# (phones, tablets, etc.). If you want a change to apply to ALMOST ALL -# devices (including non-phones and non-tablets), modify -# core_minimal.mk instead. If you care about wearables, you need to modify -# core_tiny.mk in addition to core_minimal.mk. - -PRODUCT_PACKAGES += \ - BasicDreams \ - BlockedNumberProvider \ - CaptivePortalLogin \ - CertInstaller \ - Contacts \ - DocumentsUI \ - DownloadProviderUi \ - ExternalStorageProvider \ - FusedLocation \ - InputDevices \ - KeyChain \ - Keyguard \ - LatinIME \ - Launcher2 \ - ManagedProvisioning \ - MtpDocumentsProvider \ - PicoTts \ - PacProcessor \ - libpac \ - PrintSpooler \ - ProxyHandler \ - QuickSearchBox \ - Settings \ - SharedStorageBackup \ - Telecom \ - TeleService \ - VpnDialogs \ - MmsService - -# The set of packages whose code can be loaded by the system server. -PRODUCT_SYSTEM_SERVER_APPS += \ - FusedLocation \ - InputDevices \ - KeyChain \ - Telecom \ - -# The set of packages we want to force 'speed' compilation on. -PRODUCT_DEXPREOPT_SPEED_APPS += \ - -$(call inherit-product, $(SRC_TARGET_DIR)/product/core_base.mk) diff --git a/common/product/emulator.mk b/common/product/emulator.mk deleted file mode 100644 index 8309a1a..0000000 --- a/common/product/emulator.mk +++ /dev/null @@ -1,112 +0,0 @@ -# -# Copyright (C) 2012 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 included by other product makefiles to add all the -# emulator-related modules to PRODUCT_PACKAGES. -# - -# Host modules -PRODUCT_PACKAGES += \ - - -# Device modules -PRODUCT_PACKAGES += \ - egl.cfg \ - gralloc.goldfish \ - gralloc.ranchu \ - libGLESv1_CM_emulation \ - lib_renderControl_enc \ - libEGL_emulation \ - libGLES_android \ - libGLESv2_enc \ - libOpenglSystemCommon \ - libGLESv2_emulation \ - libGLESv1_enc \ - qemu-props \ - qemud \ - camera.goldfish \ - camera.goldfish.jpeg \ - camera.ranchu \ - camera.ranchu.jpeg \ - lights.goldfish \ - gps.goldfish \ - gps.ranchu \ - fingerprint.goldfish \ - sensors.goldfish \ - audio.primary.goldfish \ - audio.primary.goldfish_legacy \ - android.hardware.audio@2.0-service \ - vibrator.goldfish \ - power.goldfish \ - power.ranchu \ - fingerprint.ranchu \ - android.hardware.biometrics.fingerprint@2.1-service \ - sensors.ranchu \ - android.hardware.graphics.composer@2.1-impl \ - android.hardware.graphics.composer@2.1-service \ - android.hardware.graphics.allocator@2.0-service \ - android.hardware.graphics.allocator@2.0-impl \ - android.hardware.graphics.mapper@2.0-impl \ - hwcomposer.goldfish \ - hwcomposer.ranchu \ - vintf \ - CarrierConfig - -PRODUCT_PACKAGES += \ - android.hardware.audio@2.0-impl \ - android.hardware.audio.effect@2.0-impl \ - android.hardware.broadcastradio@1.0-impl \ - android.hardware.soundtrigger@2.0-impl - -PRODUCT_PACKAGES += \ - android.hardware.keymaster@3.0-impl \ - android.hardware.keymaster@3.0-service - -PRODUCT_PACKAGES += \ - android.hardware.gnss@1.0-service \ - android.hardware.gnss@1.0-impl - -PRODUCT_PACKAGES += \ - android.hardware.sensors@1.0-impl \ - android.hardware.sensors@1.0-service - -PRODUCT_PACKAGES += \ - android.hardware.power@1.0-service \ - android.hardware.power@1.0-impl - -# camera service treble disable until all backwards compat is complete -PRODUCT_PROPERTY_OVERRIDES += \ - camera.disable_treble=1 - -# Changed manifest to use device/generic/car/common/product/manifest.xml -PRODUCT_COPY_FILES += \ - device/generic/goldfish/fstab.goldfish:root/fstab.goldfish \ - device/generic/goldfish/init.goldfish.rc:root/init.goldfish.rc \ - device/generic/goldfish/init.goldfish.sh:system/etc/init.goldfish.sh \ - device/generic/goldfish/init.ranchu-core.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.ranchu-core.sh \ - device/generic/goldfish/init.ranchu-net.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.ranchu-net.sh \ - device/generic/goldfish/init.ranchu.rc:root/init.ranchu.rc \ - device/generic/goldfish/ueventd.goldfish.rc:root/ueventd.goldfish.rc \ - device/generic/goldfish/init.ranchu.rc:root/init.ranchu.rc \ - device/generic/goldfish/fstab.ranchu:root/fstab.ranchu \ - device/generic/goldfish/ueventd.ranchu.rc:root/ueventd.ranchu.rc \ - device/generic/car/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml \ - device/generic/goldfish/input/goldfish_rotary.idc:system/usr/idc/goldfish_rotary.idc \ - frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml - -PRODUCT_PACKAGE_OVERLAYS := device/generic/goldfish/overlay - -PRODUCT_CHARACTERISTICS := emulator diff --git a/common/product/full.mk b/common/product/full.mk deleted file mode 100644 index 9c3b071..0000000 --- a/common/product/full.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2016 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 is a build configuration for a full-featured build of the -# Open-Source part of the tree. It's geared toward a US-centric -# build quite specifically for the emulator, and might not be -# entirely appropriate to inherit from for on-device configurations. - -$(call inherit-product, device/generic/car/common/product/aosp_base_telephony.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk) - -include device/generic/car/common/product/emulator.mk - -# Overrides -PRODUCT_NAME := full -PRODUCT_DEVICE := generic -PRODUCT_BRAND := Android -PRODUCT_MODEL := AOSP on ARM Emulator diff --git a/common/product/full_base.mk b/common/product/full_base.mk deleted file mode 100644 index 86fd01a..0000000 --- a/common/product/full_base.mk +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (C) 2016 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 is a build configuration for a full-featured build of the -# Open-Source part of the tree. It's geared toward a US-centric -# build of the emulator, but all those aspects can be overridden -# in inherited configurations. - -PRODUCT_PACKAGES := \ - libfwdlockengine \ - OpenWnn \ - libWnnEngDic \ - libWnnJpnDic \ - libwnndict \ - WAPPushManager - -PRODUCT_PACKAGES += \ - Galaxy4 \ - HoloSpiralWallpaper \ - LiveWallpapers \ - LiveWallpapersPicker \ - MagicSmokeWallpapers \ - NoiseField \ - PhaseBeam \ - PhotoTable - -# Additional settings used in all AOSP builds -PRODUCT_PROPERTY_OVERRIDES := \ - ro.config.ringtone=Ring_Synth_04.ogg \ - ro.config.notification_sound=pixiedust.ogg - -# Put en_US first in the list, so make it default. -PRODUCT_LOCALES := en_US - -# Get some sounds -$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk) - -# Get the TTS language packs -$(call inherit-product-if-exists, external/svox/pico/lang/all_pico_languages.mk) - -# Get a list of languages. -$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk) - -# Get everything else from the parent package -$(call inherit-product, device/generic/car/common/product/generic_no_telephony.mk) diff --git a/common/product/full_base_telephony.mk b/common/product/full_base_telephony.mk deleted file mode 100644 index 69a7286..0000000 --- a/common/product/full_base_telephony.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2016 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 is a build configuration for a full-featured build of the -# Open-Source part of the tree. It's geared toward a US-centric -# build quite specifically for the emulator, and might not be -# entirely appropriate to inherit from for on-device configurations. - -PRODUCT_PROPERTY_OVERRIDES := \ - keyguard.no_require_sim=true \ - ro.com.android.dataroaming=true - -PRODUCT_COPY_FILES := \ - device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \ - frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml - -$(call inherit-product, device/generic/car/common/product/aosp_base.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk) diff --git a/common/product/full_x86.mk b/common/product/full_x86.mk deleted file mode 100644 index 4c21816..0000000 --- a/common/product/full_x86.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright (C) 2009 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 is a build configuration for a full-featured build of the -# Open-Source part of the tree. It's geared toward a US-centric -# build quite specifically for the emulator, and might not be -# entirely appropriate to inherit from for on-device configurations. - -# If running on an emulator or some other device that has a LAN connection -# that isn't a wifi connection. This will instruct init.rc to enable the -# network connection so that you can use it with ADB - -$(call inherit-product, device/generic/car/common/product/aosp_base_telephony.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk) - -include device/generic/car/common/product/emulator.mk - -ifdef NET_ETH0_STARTONBOOT - PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1 -endif - -# Ensure we package the BIOS files too. -PRODUCT_PACKAGES += \ - bios.bin \ - vgabios-cirrus.bin \ - -# Overrides -PRODUCT_NAME := full_x86 -PRODUCT_DEVICE := generic_x86 -PRODUCT_BRAND := Android -PRODUCT_MODEL := AOSP on IA Emulator diff --git a/common/product/generic_no_telephony.mk b/common/product/generic_no_telephony.mk deleted file mode 100644 index 3e2bcf6..0000000 --- a/common/product/generic_no_telephony.mk +++ /dev/null @@ -1,69 +0,0 @@ -# -# Copyright (C) 2016 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 is a generic phone product that isn't specialized for a specific device. -# It includes the base Android platform. - -PRODUCT_PACKAGES := \ - Bluetooth \ - MusicFX \ - OneTimeInitializer \ - Provision \ - SystemUI \ - WallpaperCropper - -PRODUCT_PACKAGES += \ - clatd \ - clatd.conf \ - pppd \ - screenrecord - -PRODUCT_PACKAGES += \ - librs_jni \ - libvideoeditor_jni \ - libvideoeditor_core \ - libvideoeditor_osal \ - libvideoeditor_videofilters \ - libvideoeditorplayer \ - -PRODUCT_PACKAGES += \ - audio.primary.default \ - local_time.default \ - vibrator.default \ - power.default - -PRODUCT_COPY_FILES := \ - frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf - -PRODUCT_PROPERTY_OVERRIDES += \ - ro.carrier=unknown - -$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk) -$(call inherit-product-if-exists, external/google-fonts/dancing-script/fonts.mk) -$(call inherit-product-if-exists, external/google-fonts/carrois-gothic-sc/fonts.mk) -$(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk) -$(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk) -$(call inherit-product-if-exists, external/noto-fonts/fonts.mk) -$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk) -$(call inherit-product-if-exists, external/hyphenation-patterns/patterns.mk) -$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk) -$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk) -$(call inherit-product, device/generic/car/common/product/core.mk) - -# Overrides -PRODUCT_BRAND := generic -PRODUCT_DEVICE := generic -PRODUCT_NAME := generic_no_telephony diff --git a/common/sepolicy/bootanim.te b/common/sepolicy/bootanim.te deleted file mode 100644 index b4b1eef..0000000 --- a/common/sepolicy/bootanim.te +++ /dev/null @@ -1,4 +0,0 @@ -allow bootanim self:process execmem; -allow bootanim ashmem_device:chr_file execute; - -set_prop(bootanim, qemu_prop) diff --git a/common/sepolicy/device.te b/common/sepolicy/device.te deleted file mode 100644 index 1fef2c2..0000000 --- a/common/sepolicy/device.te +++ /dev/null @@ -1,6 +0,0 @@ -type qemu_device, dev_type, mlstrustedobject; - -#device type for gss device nodes, ie /dev/gss -type gss_device, dev_type; -type persist_block_device, dev_type; -type sw_sync_device, dev_type; diff --git a/common/sepolicy/domain.te b/common/sepolicy/domain.te deleted file mode 100644 index c5bb959..0000000 --- a/common/sepolicy/domain.te +++ /dev/null @@ -1,9 +0,0 @@ -# Ignore personality-8 denials. -dontaudit domain kernel:system module_request; - -# For /sys/qemu_trace files in the emulator. -allow domain sysfs_writable:dir search; -allow domain sysfs_writable:file rw_file_perms; -allow domain qemu_device:chr_file rw_file_perms; - -get_prop(domain, qemu_prop) diff --git a/common/sepolicy/file.te b/common/sepolicy/file.te deleted file mode 100644 index 9227f80..0000000 --- a/common/sepolicy/file.te +++ /dev/null @@ -1,2 +0,0 @@ -type qemud_socket, file_type; -type sysfs_writable, fs_type, sysfs_type, mlstrustedobject; diff --git a/common/sepolicy/file_contexts b/common/sepolicy/file_contexts index 37eb40d..dbb988b 100644 --- a/common/sepolicy/file_contexts +++ b/common/sepolicy/file_contexts @@ -1,18 +1 @@ - - -# goldfish -/dev/block/mtdblock0 u:object_r:system_block_device:s0 -/dev/block/mtdblock1 u:object_r:userdata_block_device:s0 -/dev/block/mtdblock2 u:object_r:cache_block_device:s0 - -# ranchu -/dev/block/vda u:object_r:system_block_device:s0 -/dev/block/vdb u:object_r:cache_block_device:s0 -/dev/block/vdc u:object_r:userdata_block_device:s0 - -/dev/goldfish_pipe u:object_r:qemu_device:s0 -/dev/qemu_.* u:object_r:qemu_device:s0 -/dev/socket/qemud u:object_r:qemud_socket:s0 -/dev/ttyGF[0-9]* u:object_r:serial_device:s0 -/dev/ttyS2 u:object_r:console_device:s0 -/system/bin/qemud u:object_r:qemud_exec:s0 +/(vendor|system/vendor)/bin/hw/android.hardware.automotive.vehicle@2.0-service u:object_r:hal_vehicle_default_exec:s0 diff --git a/common/sepolicy/goldfish_setup.te b/common/sepolicy/goldfish_setup.te deleted file mode 100644 index 78d20fc..0000000 --- a/common/sepolicy/goldfish_setup.te +++ /dev/null @@ -1,29 +0,0 @@ -# goldfish-setup service: runs init.goldfish.sh script -type goldfish_setup, domain; -type goldfish_setup_exec, exec_type, file_type; - -init_daemon_domain(goldfish_setup) - -# Inherit open file to shell (interpreter) for script. -allow goldfish_setup shell_exec:file rx_file_perms; - -# Run ifconfig, route commands to configure interfaces and routes. -allow goldfish_setup system_file:file execute_no_trans; -allow goldfish_setup toolbox_exec:file rx_file_perms; -allow goldfish_setup self:capability { net_admin net_raw }; -allow goldfish_setup self:udp_socket create_socket_perms; -allowxperm goldfish_setup self:udp_socket ioctl priv_sock_ioctls; - -wakelock_use(goldfish_setup) -net_domain(goldfish_setup) - -# Set net.eth0.dns*, debug.sf.nobootanimation -set_prop(goldfish_setup, system_prop) -set_prop(goldfish_setup, debug_prop) - -# Set ro.radio.noril -set_prop(goldfish_setup, radio_noril_prop) - -# Stop ril-daemon service (by setting ctl.stop to ril-daemon, which -# transforms to a permission check on ctl.ril-daemon). -set_prop(goldfish_setup, ctl_rildaemon_prop) diff --git a/common/sepolicy/hal_gnss_default.te b/common/sepolicy/hal_gnss_default.te deleted file mode 100644 index 0dd3d03..0000000 --- a/common/sepolicy/hal_gnss_default.te +++ /dev/null @@ -1,3 +0,0 @@ -#============= hal_gnss_default ============== -allow hal_gnss_default vndbinder_device:chr_file { ioctl open read write }; - diff --git a/common/sepolicy/hal_graphics_composer_default.te b/common/sepolicy/hal_graphics_composer_default.te deleted file mode 100644 index 034bdef..0000000 --- a/common/sepolicy/hal_graphics_composer_default.te +++ /dev/null @@ -1,3 +0,0 @@ -#============= hal_graphics_composer_default ============== -allow hal_graphics_composer_default vndbinder_device:chr_file { ioctl open read write }; - diff --git a/common/sepolicy/init.te b/common/sepolicy/init.te deleted file mode 100644 index 3aa81d1..0000000 --- a/common/sepolicy/init.te +++ /dev/null @@ -1 +0,0 @@ -allow init tmpfs:lnk_file create_file_perms; diff --git a/common/sepolicy/logpersist.te b/common/sepolicy/logpersist.te deleted file mode 100644 index 3fc0250..0000000 --- a/common/sepolicy/logpersist.te +++ /dev/null @@ -1,13 +0,0 @@ -# goldfish logcat service: runs logcat -Q in logpersist domain - -# See global logcat.te/logpersist.te, only set for eng & userdebug, -# allow for all builds in a non-conflicting manner. - -domain_auto_trans(init, logcat_exec, logpersist) - -# Read from logd. -unix_socket_connect(logpersist, logdr, logd) - -# Write to /dev/ttyS2 and /dev/ttyGF2. -allow logpersist serial_device:chr_file { write open }; -get_prop(logpersist, qemu_cmdline) diff --git a/common/sepolicy/netd.te b/common/sepolicy/netd.te deleted file mode 100644 index 2b002ec..0000000 --- a/common/sepolicy/netd.te +++ /dev/null @@ -1 +0,0 @@ -dontaudit netd self:capability sys_module; diff --git a/common/sepolicy/property.te b/common/sepolicy/property.te deleted file mode 100644 index 04c5bc1..0000000 --- a/common/sepolicy/property.te +++ /dev/null @@ -1,8 +0,0 @@ -type qemu_prop, property_type; -type qemu_cmdline, property_type; -type radio_noril_prop, property_type; - -# opengles_prop is removed because it conflicts with car_product -# TODO If this is resolved, then most of the copied sepolicy can be removed -# in favor of using device/goldfish/sepolicy. -# type opengles_prop, property_type; diff --git a/common/sepolicy/property_contexts b/common/sepolicy/property_contexts deleted file mode 100644 index c66a85f..0000000 --- a/common/sepolicy/property_contexts +++ /dev/null @@ -1,6 +0,0 @@ -qemu. u:object_r:qemu_prop:s0 -qemu.cmdline u:object_r:qemu_cmdline:s0 -ro.emu. u:object_r:qemu_prop:s0 -ro.emulator. u:object_r:qemu_prop:s0 -ro.radio.noril u:object_r:radio_noril_prop:s0 -ro.opengles. u:object_r:opengles_prop:s0 diff --git a/common/sepolicy/qemu_props.te b/common/sepolicy/qemu_props.te deleted file mode 100644 index d5571fd..0000000 --- a/common/sepolicy/qemu_props.te +++ /dev/null @@ -1,12 +0,0 @@ -# qemu-props service: Sets system properties on boot. -type qemu_props, domain; -type qemu_props_exec, exec_type, file_type; - -init_daemon_domain(qemu_props) - -# Set properties. -set_prop(qemu_props, qemu_prop) -set_prop(qemu_props, dalvik_prop) -set_prop(qemu_props, config_prop) -set_prop(qemu_props, opengles_prop) -set_prop(qemu_props, qemu_cmdline) diff --git a/common/sepolicy/qemud.te b/common/sepolicy/qemud.te deleted file mode 100644 index eee21c4..0000000 --- a/common/sepolicy/qemud.te +++ /dev/null @@ -1,8 +0,0 @@ -# qemu support daemon -type qemud, domain; -type qemud_exec, exec_type, file_type; - -init_daemon_domain(qemud) - -# Access /dev/ttyS1 and /dev/ttyGF1. -allow qemud serial_device:chr_file rw_file_perms; diff --git a/common/sepolicy/rild.te b/common/sepolicy/rild.te deleted file mode 100644 index e148b6c..0000000 --- a/common/sepolicy/rild.te +++ /dev/null @@ -1 +0,0 @@ -unix_socket_connect(rild, qemud, qemud) diff --git a/common/sepolicy/shell.te b/common/sepolicy/shell.te deleted file mode 100644 index b246d7e..0000000 --- a/common/sepolicy/shell.te +++ /dev/null @@ -1 +0,0 @@ -allow shell serial_device:chr_file rw_file_perms; diff --git a/common/sepolicy/surfaceflinger.te b/common/sepolicy/surfaceflinger.te deleted file mode 100644 index e03d07e..0000000 --- a/common/sepolicy/surfaceflinger.te +++ /dev/null @@ -1,4 +0,0 @@ -allow surfaceflinger self:process execmem; -allow surfaceflinger ashmem_device:chr_file execute; - -set_prop(surfaceflinger, qemu_prop) diff --git a/common/sepolicy/system_app.te b/common/sepolicy/system_app.te index 9b861d6..b09239c 100644 --- a/common/sepolicy/system_app.te +++ b/common/sepolicy/system_app.te @@ -1,2 +1 @@ allow system_app hal_vehicle_hwservice:hwservice_manager find; -allow system_app proc_stat:file {read open}; diff --git a/common/sepolicy/system_server.te b/common/sepolicy/system_server.te deleted file mode 100644 index 7aab33e..0000000 --- a/common/sepolicy/system_server.te +++ /dev/null @@ -1,6 +0,0 @@ -unix_socket_connect(system_server, qemud, qemud) -get_prop(system_server, opengles_prop) -get_prop(system_server, radio_noril_prop) - -# For gss -allow system_server gss_device:chr_file rw_file_perms; diff --git a/common/sepolicy/zygote.te b/common/sepolicy/zygote.te deleted file mode 100644 index a90f02b..0000000 --- a/common/sepolicy/zygote.te +++ /dev/null @@ -1 +0,0 @@ -set_prop(zygote, qemu_prop) diff --git a/manifest.xml b/manifest.xml deleted file mode 100644 index e51590f..0000000 --- a/manifest.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - android.hardware.drm - passthrough - - 1.0 - - - ICryptoFactory - crypto - - - IDrmFactory - drm - - - - android.hardware.graphics.mapper - passthrough - 2.0 - - IMapper - default - - - - android.hardware.configstore - hwbinder - 1.0 - - ISurfaceFlingerConfigs - default - - - - android.hardware.graphics.allocator - hwbinder - 2.0 - - IAllocator - default - - - - android.hardware.power - hwbinder - 1.0 - - IPower - default - - - - - android.hardware.automotive.vehicle - hwbinder - 2.1 - - IVehicle - default - - - -- cgit v1.2.3 -- cgit v1.2.3 -- cgit v1.2.3 From a2bfcf906e3667d2c932aba4179b7bd298392573 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Mon, 27 Nov 2017 14:33:44 -0800 Subject: Config config_useFixedVolume to be true in Car emulator. By setting config_useFixedVolume to be true, the AudioManager.setStreamVolume or similar calls based on stream_type would be a no-op. Bug: 65751827 Test: m -j && launch car emulator Change-Id: I70821dfe65fbca5a7122379049357bec07a5a30b --- common/car.mk | 2 ++ overlay/frameworks/base/core/res/res/values/config.xml | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 overlay/frameworks/base/core/res/res/values/config.xml diff --git a/common/car.mk b/common/car.mk index 0663773..d55c177 100644 --- a/common/car.mk +++ b/common/car.mk @@ -17,6 +17,8 @@ # TODO Remove this when AAE is fully treble ready PRODUCT_FULL_TREBLE_OVERRIDE := false +DEVICE_PACKAGE_OVERLAYS =: device/generic/car/overlay + # Auto modules PRODUCT_PACKAGES += \ android.hardware.automotive.vehicle@2.0-service diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml new file mode 100644 index 0000000..76fcd52 --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -0,0 +1,4 @@ + + + true + -- cgit v1.2.3 From f2cfc352913b026283753b6285a0142c8e9f725c Mon Sep 17 00:00:00 2001 From: Steve Austin Date: Fri, 22 Dec 2017 14:55:27 -0800 Subject: remove 'emu_' from lunch target to correspond to .mk file names Test: tested by running 'lunch aosp_car_x86-userdebug' and 'lunch 46' Change-Id: I554d585bd2160868584c1f0a18d9e4f36891d0ec --- vendorsetup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendorsetup.sh b/vendorsetup.sh index 1bec9aa..4e87161 100644 --- a/vendorsetup.sh +++ b/vendorsetup.sh @@ -20,7 +20,7 @@ # In particular, you can add lunch options with the add_lunch_combo # function: add_lunch_combo generic-eng -add_lunch_combo aosp_car_emu_arm-userdebug -add_lunch_combo aosp_car_emu_arm64-userdebug -add_lunch_combo aosp_car_emu_x86-userdebug -add_lunch_combo aosp_car_emu_x86_64-userdebug +add_lunch_combo aosp_car_arm-userdebug +add_lunch_combo aosp_car_arm64-userdebug +add_lunch_combo aosp_car_x86-userdebug +add_lunch_combo aosp_car_x86_64-userdebug -- cgit v1.2.3 From c8ccc697904fa0572e362b92ead7ad1e8aecfed7 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 23 Jan 2018 15:01:34 -0800 Subject: Upodates selinux policy for audio control HAL The sepolicy is updated and aligned with vehicl hal in the same directory Bug: 72409268 Test: adb shell lshal Change-Id: I560ac89c2071e213615b6b191a4fe938570949e3 --- common/sepolicy/file_contexts | 1 + common/sepolicy/hal_audiocontrol_hwservice.te | 1 + common/sepolicy/hwservice.te | 1 + common/sepolicy/hwservice_contexts | 1 + 4 files changed, 4 insertions(+) create mode 100644 common/sepolicy/hal_audiocontrol_hwservice.te diff --git a/common/sepolicy/file_contexts b/common/sepolicy/file_contexts index dbb988b..ac02aab 100644 --- a/common/sepolicy/file_contexts +++ b/common/sepolicy/file_contexts @@ -1 +1,2 @@ +/(vendor|system/vendor)/bin/hw/android.hardware.automotive.audiocontrol@1.0-service u:object_r:hal_audiocontrol_default_exec:s0 /(vendor|system/vendor)/bin/hw/android.hardware.automotive.vehicle@2.0-service u:object_r:hal_vehicle_default_exec:s0 diff --git a/common/sepolicy/hal_audiocontrol_hwservice.te b/common/sepolicy/hal_audiocontrol_hwservice.te new file mode 100644 index 0000000..b8082a4 --- /dev/null +++ b/common/sepolicy/hal_audiocontrol_hwservice.te @@ -0,0 +1 @@ +add_hwservice(hal_audiocontrol_default, hal_audiocontrol_hwservice) diff --git a/common/sepolicy/hwservice.te b/common/sepolicy/hwservice.te index 0333a3c..fb8b372 100644 --- a/common/sepolicy/hwservice.te +++ b/common/sepolicy/hwservice.te @@ -1 +1,2 @@ +type hal_audiocontrol_hwservice, hwservice_manager_type; type hal_vehicle_hwservice, hwservice_manager_type; diff --git a/common/sepolicy/hwservice_contexts b/common/sepolicy/hwservice_contexts index d5fda9f..2c0ef53 100644 --- a/common/sepolicy/hwservice_contexts +++ b/common/sepolicy/hwservice_contexts @@ -1 +1,2 @@ +android.hardware.automotive.vehicle::IAudioControl u:object_r:hal_audiocontrol_hwservice:s0 android.hardware.automotive.vehicle::IVehicle u:object_r:hal_vehicle_hwservice:s0 -- cgit v1.2.3 From 8a36a4d254c1709b9cd0921a04fdf8b2b0959f39 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Mon, 29 Jan 2018 14:37:03 -0800 Subject: Remove the bus based audio overlays from common/car The overlays are moved to vendor/auto/embedded, make it for emulator only for now. Bug: 72554906 Test: None Change-Id: I5e87af0dee6d045f6c339d8d07aa3d2ebff1a78e --- common/car.mk | 2 -- overlay/frameworks/base/core/res/res/values/config.xml | 4 ---- 2 files changed, 6 deletions(-) delete mode 100644 overlay/frameworks/base/core/res/res/values/config.xml diff --git a/common/car.mk b/common/car.mk index d55c177..0663773 100644 --- a/common/car.mk +++ b/common/car.mk @@ -17,8 +17,6 @@ # TODO Remove this when AAE is fully treble ready PRODUCT_FULL_TREBLE_OVERRIDE := false -DEVICE_PACKAGE_OVERLAYS =: device/generic/car/overlay - # Auto modules PRODUCT_PACKAGES += \ android.hardware.automotive.vehicle@2.0-service diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml deleted file mode 100644 index 76fcd52..0000000 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - true - -- cgit v1.2.3 From e5962f17ab577d1bd7ccbd1bcfbcfefd069a6621 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Mon, 26 Feb 2018 17:23:23 -0800 Subject: Makes car emulator audio driver AOSP - Grouped all emulator related work in emulator folder - Moved also the default hal implementation here - Deprecated the Android.mk in favor of Android.bp Bug: 68940567 Test: lunch gcar_emu_x86-userdebug && m -j Change-Id: I284d8b60301fcb9c7c65aed3c8a08e7e6c0ac0f2 --- emulator/audio/audio_policy_configuration.xml | 234 +++ emulator/audio/car_emulator_audio.mk | 29 + emulator/audio/driver/Android.bp | 41 + emulator/audio/driver/audio_hw.c | 1520 ++++++++++++++++++++ .../frameworks/base/core/res/res/values/config.xml | 8 + .../services/Car/service/res/values/config.xml | 26 + emulator/hal/car_emulator_hal.mk | 24 + emulator/hal/car_emulator_manifest.xml | 205 +++ 8 files changed, 2087 insertions(+) create mode 100644 emulator/audio/audio_policy_configuration.xml create mode 100644 emulator/audio/car_emulator_audio.mk create mode 100644 emulator/audio/driver/Android.bp create mode 100644 emulator/audio/driver/audio_hw.c create mode 100644 emulator/audio/overlay/frameworks/base/core/res/res/values/config.xml create mode 100644 emulator/audio/overlay/packages/services/Car/service/res/values/config.xml create mode 100644 emulator/hal/car_emulator_hal.mk create mode 100644 emulator/hal/car_emulator_manifest.xml diff --git a/emulator/audio/audio_policy_configuration.xml b/emulator/audio/audio_policy_configuration.xml new file mode 100644 index 0000000..2bc3172 --- /dev/null +++ b/emulator/audio/audio_policy_configuration.xml @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + bus0_media_out + bus1_navigation_out + bus2_voice_command_out + bus3_call_ring_out + bus4_call_out + bus5_alarm_out + bus6_notification_out + bus7_system_sound_out + bus0_mic1_in + + bus0_media_out + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/emulator/audio/car_emulator_audio.mk b/emulator/audio/car_emulator_audio.mk new file mode 100644 index 0000000..a716538 --- /dev/null +++ b/emulator/audio/car_emulator_audio.mk @@ -0,0 +1,29 @@ +# +# Copyright (C) 2017 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. + +USE_XML_AUDIO_POLICY_CONF := 1 + +PRODUCT_PACKAGES += audio.primary.caremu +PRODUCT_PROPERTY_OVERRIDES += ro.hardware.audio.primary=caremu + +PRODUCT_COPY_FILES += \ + frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration.xml:system/etc/a2dp_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:system/etc/usb_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:system/etc/r_submix_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:system/etc/audio_policy_volumes.xml \ + frameworks/av/services/audiopolicy/config/default_volume_tables.xml:system/etc/default_volume_tables.xml \ + device/generic/car/emulator/audio/audio_policy_configuration.xml:system/etc/audio_policy_configuration.xml + +DEVICE_PACKAGE_OVERLAYS += device/generic/car/emulator/audio/overlay diff --git a/emulator/audio/driver/Android.bp b/emulator/audio/driver/Android.bp new file mode 100644 index 0000000..24aa96d --- /dev/null +++ b/emulator/audio/driver/Android.bp @@ -0,0 +1,41 @@ +// +// Copyright (C) 2017 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. + +// Derived from device/generic/goldfish/audio/Android.mk + +cc_library_shared { + + vendor: true, + name: "audio.primary.caremu", + relative_install_path: "hw", + + srcs: ["audio_hw.c"], + + include_dirs: ["external/tinyalsa/include"], + + shared_libs: [ + "libcutils", + "liblog", + "libdl", + "libtinyalsa", + ], + + cflags: ["-Wno-unused-parameter"], + header_libs: [ + "libhardware_headers", + "libcutils_headers", + ], + +} diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c new file mode 100644 index 0000000..24294ca --- /dev/null +++ b/emulator/audio/driver/audio_hw.c @@ -0,0 +1,1520 @@ +/* + * Copyright (C) 2017 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. + */ + +/** + * Derived from goldfish/audio/audio_hw.c + * Changes made to adding support of AUDIO_DEVICE_OUT_BUS + */ + +#define LOG_TAG "audio_hw_generic" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#define PCM_CARD 0 +#define PCM_DEVICE 0 + +#define OUT_PERIOD_MS 15 +#define OUT_PERIOD_COUNT 4 + +#define IN_PERIOD_MS 15 +#define IN_PERIOD_COUNT 4 + +struct generic_audio_device { + struct audio_hw_device device; // Constant after init + pthread_mutex_t lock; + bool mic_mute; // Proteced by this->lock + struct mixer *mixer; // Proteced by this->lock + Hashmap *out_bus_stream_map; // Extended field. Constant after init +}; + +static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state); + +typedef struct audio_vbuffer { + pthread_mutex_t lock; + uint8_t *data; + size_t frame_size; + size_t frame_count; + size_t head; + size_t tail; + size_t live; +} audio_vbuffer_t; + +static int audio_vbuffer_init(audio_vbuffer_t *audio_vbuffer, size_t frame_count, + size_t frame_size) { + if (!audio_vbuffer) { + return -EINVAL; + } + audio_vbuffer->frame_size = frame_size; + audio_vbuffer->frame_count = frame_count; + size_t bytes = frame_count * frame_size; + audio_vbuffer->data = calloc(bytes, 1); + if (!audio_vbuffer->data) { + return -ENOMEM; + } + audio_vbuffer->head = 0; + audio_vbuffer->tail = 0; + audio_vbuffer->live = 0; + pthread_mutex_init(&audio_vbuffer->lock, (const pthread_mutexattr_t *) NULL); + return 0; +} + +static int audio_vbuffer_destroy(audio_vbuffer_t *audio_vbuffer) { + if (!audio_vbuffer) { + return -EINVAL; + } + free(audio_vbuffer->data); + pthread_mutex_destroy(&audio_vbuffer->lock); + return 0; +} + +static int audio_vbuffer_live(audio_vbuffer_t *audio_vbuffer) { + if (!audio_vbuffer) { + return -EINVAL; + } + pthread_mutex_lock(&audio_vbuffer->lock); + int live = audio_vbuffer->live; + pthread_mutex_unlock(&audio_vbuffer->lock); + return live; +} + +static int audio_vbuffer_dead(audio_vbuffer_t *audio_vbuffer) { + if (!audio_vbuffer) { + return -EINVAL; + } + pthread_mutex_lock(&audio_vbuffer->lock); + int dead = audio_vbuffer->frame_count - audio_vbuffer->live; + pthread_mutex_unlock(&audio_vbuffer->lock); + return dead; +} + +#define MIN(a,b) (((a)<(b))?(a):(b)) +static size_t audio_vbuffer_write(audio_vbuffer_t *audio_vbuffer, const void *buffer, + size_t frame_count) { + size_t frames_written = 0; + pthread_mutex_lock(&audio_vbuffer->lock); + + while (frame_count != 0) { + int frames = 0; + if (audio_vbuffer->live == 0 || audio_vbuffer->head > audio_vbuffer->tail) { + frames = MIN(frame_count, audio_vbuffer->frame_count - audio_vbuffer->head); + } else if (audio_vbuffer->head < audio_vbuffer->tail) { + frames = MIN(frame_count, audio_vbuffer->tail - (audio_vbuffer->head)); + } else { + ALOGD("%s audio_vbuffer is full", __func__); + break; + } + memcpy(&audio_vbuffer->data[audio_vbuffer->head*audio_vbuffer->frame_size], + &((uint8_t*)buffer)[frames_written*audio_vbuffer->frame_size], + frames*audio_vbuffer->frame_size); + audio_vbuffer->live += frames; + frames_written += frames; + frame_count -= frames; + audio_vbuffer->head = (audio_vbuffer->head + frames) % audio_vbuffer->frame_count; + } + + pthread_mutex_unlock(&audio_vbuffer->lock); + return frames_written; +} + +static size_t audio_vbuffer_read(audio_vbuffer_t *audio_vbuffer, void *buffer, + size_t frame_count) { + size_t frames_read = 0; + pthread_mutex_lock(&audio_vbuffer->lock); + + while (frame_count != 0) { + int frames = 0; + if (audio_vbuffer->live == audio_vbuffer->frame_count || + audio_vbuffer->tail > audio_vbuffer->head) { + frames = MIN(frame_count, audio_vbuffer->frame_count - audio_vbuffer->tail); + } else if (audio_vbuffer->tail < audio_vbuffer->head) { + frames = MIN(frame_count, audio_vbuffer->head - audio_vbuffer->tail); + } else { + break; + } + memcpy(&((uint8_t*)buffer)[frames_read*audio_vbuffer->frame_size], + &audio_vbuffer->data[audio_vbuffer->tail*audio_vbuffer->frame_size], + frames*audio_vbuffer->frame_size); + audio_vbuffer->live -= frames; + frames_read += frames; + frame_count -= frames; + audio_vbuffer->tail = (audio_vbuffer->tail + frames) % audio_vbuffer->frame_count; + } + + pthread_mutex_unlock(&audio_vbuffer->lock); + return frames_read; +} + +struct generic_stream_out { + struct audio_stream_out stream; // Constant after init + pthread_mutex_t lock; + struct generic_audio_device *dev; // Constant after init + audio_devices_t device; // Protected by this->lock + struct audio_config req_config; // Constant after init + struct pcm_config pcm_config; // Constant after init + audio_vbuffer_t buffer; // Constant after init + const char *bus_address; // Extended field. Constant after init + + // Time & Position Keeping + bool standby; // Protected by this->lock + uint64_t underrun_position; // Protected by this->lock + struct timespec underrun_time; // Protected by this->lock + uint64_t last_write_time_us; // Protected by this->lock + uint64_t frames_total_buffered; // Protected by this->lock + uint64_t frames_written; // Protected by this->lock + uint64_t frames_rendered; // Protected by this->lock + + // Worker + pthread_t worker_thread; // Constant after init + pthread_cond_t worker_wake; // Protected by this->lock + bool worker_standby; // Protected by this->lock + bool worker_exit; // Protected by this->lock +}; + +struct generic_stream_in { + struct audio_stream_in stream; // Constant after init + pthread_mutex_t lock; + struct generic_audio_device *dev; // Constant after init + audio_devices_t device; // Protected by this->lock + struct audio_config req_config; // Constant after init + struct pcm *pcm; // Protected by this->lock + struct pcm_config pcm_config; // Constant after init + int16_t *stereo_to_mono_buf; // Protected by this->lock + size_t stereo_to_mono_buf_size; // Protected by this->lock + audio_vbuffer_t buffer; // Protected by this->lock + const char *bus_address; // Extended field. Constant after init + + // Time & Position Keeping + bool standby; // Protected by this->lock + int64_t standby_position; // Protected by this->lock + struct timespec standby_exit_time;// Protected by this->lock + int64_t standby_frames_read; // Protected by this->lock + + // Worker + pthread_t worker_thread; // Constant after init + pthread_cond_t worker_wake; // Protected by this->lock + bool worker_standby; // Protected by this->lock + bool worker_exit; // Protected by this->lock +}; + +static struct pcm_config pcm_config_out = { + .channels = 2, + .rate = 0, + .period_size = 0, + .period_count = OUT_PERIOD_COUNT, + .format = PCM_FORMAT_S16_LE, + .start_threshold = 0, +}; + +static struct pcm_config pcm_config_in = { + .channels = 2, + .rate = 0, + .period_size = 0, + .period_count = IN_PERIOD_COUNT, + .format = PCM_FORMAT_S16_LE, + .start_threshold = 0, + .stop_threshold = INT_MAX, +}; + +static pthread_mutex_t adev_init_lock = PTHREAD_MUTEX_INITIALIZER; +static unsigned int audio_device_ref_count = 0; + +static uint32_t out_get_sample_rate(const struct audio_stream *stream) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + return out->req_config.sample_rate; +} + +static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate) { + return -ENOSYS; +} + +static size_t out_get_buffer_size(const struct audio_stream *stream) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + int size = out->pcm_config.period_size * + audio_stream_out_frame_size(&out->stream); + + return size; +} + +static audio_channel_mask_t out_get_channels(const struct audio_stream *stream) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + return out->req_config.channel_mask; +} + +static audio_format_t out_get_format(const struct audio_stream *stream) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + return out->req_config.format; +} + +static int out_set_format(struct audio_stream *stream, audio_format_t format) { + return -ENOSYS; +} + +static int out_dump(const struct audio_stream *stream, int fd) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + pthread_mutex_lock(&out->lock); + dprintf(fd, "\tout_dump:\n" + "\t\taddress: %s\n" + "\t\tsample rate: %u\n" + "\t\tbuffer size: %zu\n" + "\t\tchannel mask: %08x\n" + "\t\tformat: %d\n" + "\t\tdevice: %08x\n" + "\t\taudio dev: %p\n\n", + out->bus_address, + out_get_sample_rate(stream), + out_get_buffer_size(stream), + out_get_channels(stream), + out_get_format(stream), + out->device, + out->dev); + pthread_mutex_unlock(&out->lock); + return 0; +} + +static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + struct str_parms *parms; + char value[32]; + int ret; + long val; + char *end; + + pthread_mutex_lock(&out->lock); + if (!out->standby) { + //Do not support changing params while stream running + ret = -ENOSYS; + } else { + parms = str_parms_create_str(kvpairs); + ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, + value, sizeof(value)); + if (ret >= 0) { + errno = 0; + val = strtol(value, &end, 10); + if (errno == 0 && (end != NULL) && (*end == '\0') && ((int)val == val)) { + out->device = (int)val; + ret = 0; + } else { + ret = -EINVAL; + } + } + str_parms_destroy(parms); + } + pthread_mutex_unlock(&out->lock); + return ret; +} + +static char *out_get_parameters(const struct audio_stream *stream, const char *keys) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + struct str_parms *query = str_parms_create_str(keys); + char *str; + char value[256]; + struct str_parms *reply = str_parms_create(); + int ret; + + ret = str_parms_get_str(query, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value)); + if (ret >= 0) { + pthread_mutex_lock(&out->lock); + str_parms_add_int(reply, AUDIO_PARAMETER_STREAM_ROUTING, out->device); + pthread_mutex_unlock(&out->lock); + str = strdup(str_parms_to_str(reply)); + } else { + str = strdup(keys); + } + + str_parms_destroy(query); + str_parms_destroy(reply); + return str; +} + +static uint32_t out_get_latency(const struct audio_stream_out *stream) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + return (out->pcm_config.period_size * 1000) / out->pcm_config.rate; +} + +static int out_set_volume(struct audio_stream_out *stream, + float left, float right) { + return -ENOSYS; +} + +static void *out_write_worker(void *args) { + struct generic_stream_out *out = (struct generic_stream_out *)args; + struct pcm *pcm = NULL; + uint8_t *buffer = NULL; + int buffer_frames; + int buffer_size; + bool restart = false; + bool shutdown = false; + while (true) { + pthread_mutex_lock(&out->lock); + while (out->worker_standby || restart) { + restart = false; + if (pcm) { + pcm_close(pcm); // Frees pcm + pcm = NULL; + free(buffer); + buffer=NULL; + } + if (out->worker_exit) { + break; + } + pthread_cond_wait(&out->worker_wake, &out->lock); + } + + if (out->worker_exit) { + if (!out->worker_standby) { + ALOGE("Out worker:%s not in standby before exiting", out->bus_address); + } + shutdown = true; + } + + while (!shutdown && audio_vbuffer_live(&out->buffer) == 0) { + pthread_cond_wait(&out->worker_wake, &out->lock); + } + + if (shutdown) { + pthread_mutex_unlock(&out->lock); + break; + } + + if (!pcm) { + pcm = pcm_open(PCM_CARD, PCM_DEVICE, + PCM_OUT | PCM_MONOTONIC, &out->pcm_config); + if (!pcm_is_ready(pcm)) { + ALOGE("pcm_open(out) failed: %s: address %s channels %d format %d rate %d", + pcm_get_error(pcm), + out->bus_address, + out->pcm_config.channels, + out->pcm_config.format, + out->pcm_config.rate); + pthread_mutex_unlock(&out->lock); + break; + } + buffer_frames = out->pcm_config.period_size; + buffer_size = pcm_frames_to_bytes(pcm, buffer_frames); + buffer = malloc(buffer_size); + if (!buffer) { + ALOGE("could not allocate write buffer"); + pthread_mutex_unlock(&out->lock); + break; + } + } + int frames = audio_vbuffer_read(&out->buffer, buffer, buffer_frames); + pthread_mutex_unlock(&out->lock); + int write_error = pcm_write(pcm, buffer, pcm_frames_to_bytes(pcm, frames)); + if (write_error) { + ALOGE("pcm_write failed %s address %s", pcm_get_error(pcm), out->bus_address); + restart = true; + } else { + ALOGD("pcm_write succeed address %s", out->bus_address); + } + } + if (buffer) { + free(buffer); + } + + return NULL; +} + +// Call with in->lock held +static void get_current_output_position(struct generic_stream_out *out, + uint64_t *position, struct timespec * timestamp) { + struct timespec curtime = { .tv_sec = 0, .tv_nsec = 0 }; + clock_gettime(CLOCK_MONOTONIC, &curtime); + const int64_t now_us = (curtime.tv_sec * 1000000000LL + curtime.tv_nsec) / 1000; + if (timestamp) { + *timestamp = curtime; + } + int64_t position_since_underrun; + if (out->standby) { + position_since_underrun = 0; + } else { + const int64_t first_us = (out->underrun_time.tv_sec * 1000000000LL + + out->underrun_time.tv_nsec) / 1000; + position_since_underrun = (now_us - first_us) * + out_get_sample_rate(&out->stream.common) / + 1000000; + if (position_since_underrun < 0) { + position_since_underrun = 0; + } + } + *position = out->underrun_position + position_since_underrun; + + // The device will reuse the same output stream leading to periods of + // underrun. + if (*position > out->frames_written) { + ALOGW("Not supplying enough data to HAL, expected position %" PRIu64 " , only wrote " + "%" PRIu64, + *position, out->frames_written); + + *position = out->frames_written; + out->underrun_position = *position; + out->underrun_time = curtime; + out->frames_total_buffered = 0; + } +} + +static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, size_t bytes) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + const size_t frames = bytes / audio_stream_out_frame_size(stream); + + pthread_mutex_lock(&out->lock); + + if (out->worker_standby) { + out->worker_standby = false; + } + + uint64_t current_position; + struct timespec current_time; + + get_current_output_position(out, ¤t_position, ¤t_time); + const uint64_t now_us = (current_time.tv_sec * 1000000000LL + + current_time.tv_nsec) / 1000; + if (out->standby) { + out->standby = false; + out->underrun_time = current_time; + out->frames_rendered = 0; + out->frames_total_buffered = 0; + } + + size_t frames_written = audio_vbuffer_write(&out->buffer, buffer, frames); + pthread_cond_signal(&out->worker_wake); + + /* Implementation just consumes bytes if we start getting backed up */ + out->frames_written += frames; + out->frames_rendered += frames; + out->frames_total_buffered += frames; + + // We simulate the audio device blocking when it's write buffers become + // full. + + // At the beginning or after an underrun, try to fill up the vbuffer. + // This will be throttled by the PlaybackThread + int frames_sleep = out->frames_total_buffered < out->buffer.frame_count ? 0 : frames; + + uint64_t sleep_time_us = frames_sleep * 1000000LL / + out_get_sample_rate(&stream->common); + + // If the write calls are delayed, subtract time off of the sleep to + // compensate + uint64_t time_since_last_write_us = now_us - out->last_write_time_us; + if (time_since_last_write_us < sleep_time_us) { + sleep_time_us -= time_since_last_write_us; + } else { + sleep_time_us = 0; + } + out->last_write_time_us = now_us + sleep_time_us; + + pthread_mutex_unlock(&out->lock); + + if (sleep_time_us > 0) { + usleep(sleep_time_us); + } + + if (frames_written < frames) { + ALOGW("Hardware backing HAL too slow, could only write %zu of %zu frames", + frames_written, frames); + } + + /* Always consume all bytes */ + return bytes; +} + +static int out_get_presentation_position(const struct audio_stream_out *stream, + uint64_t *frames, struct timespec *timestamp) { + int ret = -EINVAL; + if (stream == NULL || frames == NULL || timestamp == NULL) { + return -EINVAL; + } + struct generic_stream_out *out = (struct generic_stream_out *)stream; + + pthread_mutex_lock(&out->lock); + get_current_output_position(out, frames, timestamp); + pthread_mutex_unlock(&out->lock); + + return 0; +} + +static int out_get_render_position(const struct audio_stream_out *stream, uint32_t *dsp_frames) { + if (stream == NULL || dsp_frames == NULL) { + return -EINVAL; + } + struct generic_stream_out *out = (struct generic_stream_out *)stream; + pthread_mutex_lock(&out->lock); + *dsp_frames = out->frames_rendered; + pthread_mutex_unlock(&out->lock); + return 0; +} + +// Must be called with out->lock held +static void do_out_standby(struct generic_stream_out *out) { + int frames_sleep = 0; + uint64_t sleep_time_us = 0; + if (out->standby) { + return; + } + while (true) { + get_current_output_position(out, &out->underrun_position, NULL); + frames_sleep = out->frames_written - out->underrun_position; + + if (frames_sleep == 0) { + break; + } + + sleep_time_us = frames_sleep * 1000000LL / + out_get_sample_rate(&out->stream.common); + + pthread_mutex_unlock(&out->lock); + usleep(sleep_time_us); + pthread_mutex_lock(&out->lock); + } + out->worker_standby = true; + out->standby = true; +} + +static int out_standby(struct audio_stream *stream) { + struct generic_stream_out *out = (struct generic_stream_out *)stream; + pthread_mutex_lock(&out->lock); + do_out_standby(out); + pthread_mutex_unlock(&out->lock); + return 0; +} + +static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect) { + // out_add_audio_effect is a no op + return 0; +} + +static int out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect) { + // out_remove_audio_effect is a no op + return 0; +} + +static int out_get_next_write_timestamp(const struct audio_stream_out *stream, + int64_t *timestamp) { + return -ENOSYS; +} + +static uint32_t in_get_sample_rate(const struct audio_stream *stream) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + return in->req_config.sample_rate; +} + +static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate) { + return -ENOSYS; +} + +static int refine_output_parameters(uint32_t *sample_rate, audio_format_t *format, + audio_channel_mask_t *channel_mask) { + static const uint32_t sample_rates [] = { + 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 + }; + static const int sample_rates_count = sizeof(sample_rates)/sizeof(uint32_t); + bool inval = false; + if (*format != AUDIO_FORMAT_PCM_16_BIT) { + *format = AUDIO_FORMAT_PCM_16_BIT; + inval = true; + } + + int channel_count = popcount(*channel_mask); + if (channel_count != 1 && channel_count != 2) { + *channel_mask = AUDIO_CHANNEL_IN_STEREO; + inval = true; + } + + int i; + for (i = 0; i < sample_rates_count; i++) { + if (*sample_rate < sample_rates[i]) { + *sample_rate = sample_rates[i]; + inval=true; + break; + } + else if (*sample_rate == sample_rates[i]) { + break; + } + else if (i == sample_rates_count-1) { + // Cap it to the highest rate we support + *sample_rate = sample_rates[i]; + inval=true; + } + } + + if (inval) { + return -EINVAL; + } + return 0; +} + +static int refine_input_parameters(uint32_t *sample_rate, audio_format_t *format, + audio_channel_mask_t *channel_mask) { + static const uint32_t sample_rates [] = {8000, 11025, 16000, 22050, 44100, 48000}; + static const int sample_rates_count = sizeof(sample_rates)/sizeof(uint32_t); + bool inval = false; + // Only PCM_16_bit is supported. If this is changed, stereo to mono drop + // must be fixed in in_read + if (*format != AUDIO_FORMAT_PCM_16_BIT) { + *format = AUDIO_FORMAT_PCM_16_BIT; + inval = true; + } + + int channel_count = popcount(*channel_mask); + if (channel_count != 1 && channel_count != 2) { + *channel_mask = AUDIO_CHANNEL_IN_STEREO; + inval = true; + } + + int i; + for (i = 0; i < sample_rates_count; i++) { + if (*sample_rate < sample_rates[i]) { + *sample_rate = sample_rates[i]; + inval=true; + break; + } + else if (*sample_rate == sample_rates[i]) { + break; + } + else if (i == sample_rates_count-1) { + // Cap it to the highest rate we support + *sample_rate = sample_rates[i]; + inval=true; + } + } + + if (inval) { + return -EINVAL; + } + return 0; +} + +static size_t get_input_buffer_size(uint32_t sample_rate, audio_format_t format, + audio_channel_mask_t channel_mask) { + size_t size; + size_t device_rate; + int channel_count = popcount(channel_mask); + if (refine_input_parameters(&sample_rate, &format, &channel_mask) != 0) + return 0; + + size = sample_rate*IN_PERIOD_MS/1000; + // Audioflinger expects audio buffers to be multiple of 16 frames + size = ((size + 15) / 16) * 16; + size *= sizeof(short) * channel_count; + + return size; +} + +static size_t in_get_buffer_size(const struct audio_stream *stream) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + int size = get_input_buffer_size(in->req_config.sample_rate, + in->req_config.format, + in->req_config.channel_mask); + + return size; +} + +static audio_channel_mask_t in_get_channels(const struct audio_stream *stream) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + return in->req_config.channel_mask; +} + +static audio_format_t in_get_format(const struct audio_stream *stream) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + return in->req_config.format; +} + +static int in_set_format(struct audio_stream *stream, audio_format_t format) { + return -ENOSYS; +} + +static int in_dump(const struct audio_stream *stream, int fd) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + + pthread_mutex_lock(&in->lock); + dprintf(fd, "\tin_dump:\n" + "\t\tsample rate: %u\n" + "\t\tbuffer size: %zu\n" + "\t\tchannel mask: %08x\n" + "\t\tformat: %d\n" + "\t\tdevice: %08x\n" + "\t\taudio dev: %p\n\n", + in_get_sample_rate(stream), + in_get_buffer_size(stream), + in_get_channels(stream), + in_get_format(stream), + in->device, + in->dev); + pthread_mutex_unlock(&in->lock); + return 0; +} + +static int in_set_parameters(struct audio_stream *stream, const char *kvpairs) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + struct str_parms *parms; + char value[32]; + int ret; + long val; + char *end; + + pthread_mutex_lock(&in->lock); + if (!in->standby) { + ret = -ENOSYS; + } else { + parms = str_parms_create_str(kvpairs); + + ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, + value, sizeof(value)); + if (ret >= 0) { + errno = 0; + val = strtol(value, &end, 10); + if ((errno == 0) && (end != NULL) && (*end == '\0') && ((int)val == val)) { + in->device = (int)val; + ret = 0; + } else { + ret = -EINVAL; + } + } + + str_parms_destroy(parms); + } + pthread_mutex_unlock(&in->lock); + return ret; +} + +static char *in_get_parameters(const struct audio_stream *stream, const char *keys) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + struct str_parms *query = str_parms_create_str(keys); + char *str; + char value[256]; + struct str_parms *reply = str_parms_create(); + int ret; + + ret = str_parms_get_str(query, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value)); + if (ret >= 0) { + str_parms_add_int(reply, AUDIO_PARAMETER_STREAM_ROUTING, in->device); + str = strdup(str_parms_to_str(reply)); + } else { + str = strdup(keys); + } + + str_parms_destroy(query); + str_parms_destroy(reply); + return str; +} + +static int in_set_gain(struct audio_stream_in *stream, float gain) { + // TODO(hwwang): support adjusting input gain + return 0; +} + +// Call with in->lock held +static void get_current_input_position(struct generic_stream_in *in, + int64_t * position, struct timespec * timestamp) { + struct timespec t = { .tv_sec = 0, .tv_nsec = 0 }; + clock_gettime(CLOCK_MONOTONIC, &t); + const int64_t now_us = (t.tv_sec * 1000000000LL + t.tv_nsec) / 1000; + if (timestamp) { + *timestamp = t; + } + int64_t position_since_standby; + if (in->standby) { + position_since_standby = 0; + } else { + const int64_t first_us = (in->standby_exit_time.tv_sec * 1000000000LL + + in->standby_exit_time.tv_nsec) / 1000; + position_since_standby = (now_us - first_us) * + in_get_sample_rate(&in->stream.common) / + 1000000; + if (position_since_standby < 0) { + position_since_standby = 0; + } + } + *position = in->standby_position + position_since_standby; +} + +// Must be called with in->lock held +static void do_in_standby(struct generic_stream_in *in) { + if (in->standby) { + return; + } + in->worker_standby = true; + get_current_input_position(in, &in->standby_position, NULL); + in->standby = true; +} + +static int in_standby(struct audio_stream *stream) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + pthread_mutex_lock(&in->lock); + do_in_standby(in); + pthread_mutex_unlock(&in->lock); + return 0; +} + +static void *in_read_worker(void *args) { + struct generic_stream_in *in = (struct generic_stream_in *)args; + struct pcm *pcm = NULL; + uint8_t *buffer = NULL; + size_t buffer_frames; + int buffer_size; + + bool restart = false; + bool shutdown = false; + while (true) { + pthread_mutex_lock(&in->lock); + while (in->worker_standby || restart) { + restart = false; + if (pcm) { + pcm_close(pcm); // Frees pcm + pcm = NULL; + free(buffer); + buffer=NULL; + } + if (in->worker_exit) { + break; + } + pthread_cond_wait(&in->worker_wake, &in->lock); + } + + if (in->worker_exit) { + if (!in->worker_standby) { + ALOGE("In worker not in standby before exiting"); + } + shutdown = true; + } + if (shutdown) { + pthread_mutex_unlock(&in->lock); + break; + } + if (!pcm) { + pcm = pcm_open(PCM_CARD, PCM_DEVICE, + PCM_IN | PCM_MONOTONIC, &in->pcm_config); + if (!pcm_is_ready(pcm)) { + ALOGE("pcm_open(in) failed: %s: channels %d format %d rate %d", + pcm_get_error(pcm), + in->pcm_config.channels, + in->pcm_config.format, + in->pcm_config.rate); + pthread_mutex_unlock(&in->lock); + break; + } + buffer_frames = in->pcm_config.period_size; + buffer_size = pcm_frames_to_bytes(pcm, buffer_frames); + buffer = malloc(buffer_size); + if (!buffer) { + ALOGE("could not allocate worker read buffer"); + pthread_mutex_unlock(&in->lock); + break; + } + } + pthread_mutex_unlock(&in->lock); + int ret = pcm_read(pcm, buffer, pcm_frames_to_bytes(pcm, buffer_frames)); + if (ret != 0) { + ALOGW("pcm_read failed %s", pcm_get_error(pcm)); + restart = true; + } + + pthread_mutex_lock(&in->lock); + size_t frames_written = audio_vbuffer_write(&in->buffer, buffer, buffer_frames); + pthread_mutex_unlock(&in->lock); + + if (frames_written != buffer_frames) { + ALOGW("in_read_worker only could write %zu / %zu frames", + frames_written, buffer_frames); + } + } + if (buffer) { + free(buffer); + } + return NULL; +} + +static ssize_t in_read(struct audio_stream_in *stream, void *buffer, size_t bytes) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + struct generic_audio_device *adev = in->dev; + const size_t frames = bytes / audio_stream_in_frame_size(stream); + int ret = 0; + bool mic_mute = false; + size_t read_bytes = 0; + + adev_get_mic_mute(&adev->device, &mic_mute); + pthread_mutex_lock(&in->lock); + + if (in->worker_standby) { + in->worker_standby = false; + } + pthread_cond_signal(&in->worker_wake); + + int64_t current_position; + struct timespec current_time; + + get_current_input_position(in, ¤t_position, ¤t_time); + if (in->standby) { + in->standby = false; + in->standby_exit_time = current_time; + in->standby_frames_read = 0; + } + + const int64_t frames_available = + current_position - in->standby_position - in->standby_frames_read; + assert(frames_available >= 0); + + const size_t frames_wait = + ((uint64_t)frames_available > frames) ? 0 : frames - frames_available; + + int64_t sleep_time_us = frames_wait * 1000000LL / in_get_sample_rate(&stream->common); + + pthread_mutex_unlock(&in->lock); + + if (sleep_time_us > 0) { + usleep(sleep_time_us); + } + + pthread_mutex_lock(&in->lock); + int read_frames = 0; + if (in->standby) { + ALOGW("Input put to sleep while read in progress"); + goto exit; + } + in->standby_frames_read += frames; + + if (popcount(in->req_config.channel_mask) == 1 && + in->pcm_config.channels == 2) { + // Need to resample to mono + if (in->stereo_to_mono_buf_size < bytes*2) { + in->stereo_to_mono_buf = realloc(in->stereo_to_mono_buf, bytes*2); + if (!in->stereo_to_mono_buf) { + ALOGE("Failed to allocate stereo_to_mono_buff"); + goto exit; + } + } + + read_frames = audio_vbuffer_read(&in->buffer, in->stereo_to_mono_buf, frames); + + // Currently only pcm 16 is supported. + uint16_t *src = (uint16_t *)in->stereo_to_mono_buf; + uint16_t *dst = (uint16_t *)buffer; + size_t i; + // Resample stereo 16 to mono 16 by dropping one channel. + // The stereo stream is interleaved L-R-L-R + for (i = 0; i < frames; i++) { + *dst = *src; + src += 2; + dst += 1; + } + } else { + read_frames = audio_vbuffer_read(&in->buffer, buffer, frames); + } + +exit: + read_bytes = read_frames*audio_stream_in_frame_size(stream); + + if (mic_mute) { + read_bytes = 0; + } + + if (read_bytes < bytes) { + memset (&((uint8_t *)buffer)[read_bytes], 0, bytes-read_bytes); + } + + pthread_mutex_unlock(&in->lock); + + return bytes; +} + +static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream) { + return 0; +} + +static int in_get_capture_position(const struct audio_stream_in *stream, + int64_t *frames, int64_t *time) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + pthread_mutex_lock(&in->lock); + struct timespec current_time; + get_current_input_position(in, frames, ¤t_time); + *time = (current_time.tv_sec * 1000000000LL + current_time.tv_nsec); + pthread_mutex_unlock(&in->lock); + return 0; +} + +static int in_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect) { + // in_add_audio_effect is a no op + return 0; +} + +static int in_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect) { + // in_add_audio_effect is a no op + return 0; +} + +static int adev_open_output_stream(struct audio_hw_device *dev, + audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, + struct audio_config *config, struct audio_stream_out **stream_out, const char *address) { + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + struct generic_stream_out *out; + int ret = 0; + + if (refine_output_parameters(&config->sample_rate, &config->format, &config->channel_mask)) { + ALOGE("Error opening output stream format %d, channel_mask %04x, sample_rate %u", + config->format, config->channel_mask, config->sample_rate); + ret = -EINVAL; + goto error; + } + + out = (struct generic_stream_out *)calloc(1, sizeof(struct generic_stream_out)); + + if (!out) + return -ENOMEM; + + out->stream.common.get_sample_rate = out_get_sample_rate; + out->stream.common.set_sample_rate = out_set_sample_rate; + out->stream.common.get_buffer_size = out_get_buffer_size; + out->stream.common.get_channels = out_get_channels; + out->stream.common.get_format = out_get_format; + out->stream.common.set_format = out_set_format; + out->stream.common.standby = out_standby; + out->stream.common.dump = out_dump; + out->stream.common.set_parameters = out_set_parameters; + out->stream.common.get_parameters = out_get_parameters; + out->stream.common.add_audio_effect = out_add_audio_effect; + out->stream.common.remove_audio_effect = out_remove_audio_effect; + out->stream.get_latency = out_get_latency; + out->stream.set_volume = out_set_volume; + out->stream.write = out_write; + out->stream.get_render_position = out_get_render_position; + out->stream.get_presentation_position = out_get_presentation_position; + out->stream.get_next_write_timestamp = out_get_next_write_timestamp; + + pthread_mutex_init(&out->lock, (const pthread_mutexattr_t *) NULL); + out->dev = adev; + out->device = devices; + memcpy(&out->req_config, config, sizeof(struct audio_config)); + memcpy(&out->pcm_config, &pcm_config_out, sizeof(struct pcm_config)); + out->pcm_config.rate = config->sample_rate; + out->pcm_config.period_size = out->pcm_config.rate*OUT_PERIOD_MS/1000; + + out->standby = true; + out->underrun_position = 0; + out->underrun_time.tv_sec = 0; + out->underrun_time.tv_nsec = 0; + out->last_write_time_us = 0; + out->frames_total_buffered = 0; + out->frames_written = 0; + out->frames_rendered = 0; + + ret = audio_vbuffer_init(&out->buffer, + out->pcm_config.period_size*out->pcm_config.period_count, + out->pcm_config.channels * + pcm_format_to_bits(out->pcm_config.format) >> 3); + if (ret == 0) { + pthread_cond_init(&out->worker_wake, NULL); + out->worker_standby = true; + out->worker_exit = false; + pthread_create(&out->worker_thread, NULL, out_write_worker, out); + } + + if (address) { + out->bus_address = calloc(strlen(address) + 1, sizeof(char)); + strncpy(out->bus_address, address, strlen(address)); + hashmapPut(adev->out_bus_stream_map, out->bus_address, out); + } + *stream_out = &out->stream; + ALOGD("%s bus:%s", __func__, out->bus_address); + +error: + return ret; +} + +static void adev_close_output_stream(struct audio_hw_device *dev, + struct audio_stream_out *stream) { + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + struct generic_stream_out *out = (struct generic_stream_out *)stream; + ALOGD("%s bus:%s", __func__, out->bus_address); + pthread_mutex_lock(&out->lock); + do_out_standby(out); + + out->worker_exit = true; + pthread_cond_signal(&out->worker_wake); + pthread_mutex_unlock(&out->lock); + + pthread_join(out->worker_thread, NULL); + pthread_mutex_destroy(&out->lock); + audio_vbuffer_destroy(&out->buffer); + + if (out->bus_address) { + hashmapRemove(adev->out_bus_stream_map, out->bus_address); + free(out->bus_address); + } + free(stream); +} + +static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) { + return 0; +} + +static char *adev_get_parameters(const struct audio_hw_device *dev, const char *keys) { + return NULL; +} + +static int adev_init_check(const struct audio_hw_device *dev) { + return 0; +} + +static int adev_set_voice_volume(struct audio_hw_device *dev, float volume) { + // adev_set_voice_volume is a no op (simulates phones) + return 0; +} + +static int adev_set_master_volume(struct audio_hw_device *dev, float volume) { + return -ENOSYS; +} + +static int adev_get_master_volume(struct audio_hw_device *dev, float *volume) { + return -ENOSYS; +} + +static int adev_set_master_mute(struct audio_hw_device *dev, bool muted) { + return -ENOSYS; +} + +static int adev_get_master_mute(struct audio_hw_device *dev, bool *muted) { + return -ENOSYS; +} + +static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) { + // adev_set_mode is a no op (simulates phones) + return 0; +} + +static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + pthread_mutex_lock(&adev->lock); + adev->mic_mute = state; + pthread_mutex_unlock(&adev->lock); + return 0; +} + +static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state) { + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + pthread_mutex_lock(&adev->lock); + *state = adev->mic_mute; + pthread_mutex_unlock(&adev->lock); + return 0; +} + +static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev, + const struct audio_config *config) { + return get_input_buffer_size(config->sample_rate, config->format, config->channel_mask); +} + +static void adev_close_input_stream(struct audio_hw_device *dev, + struct audio_stream_in *stream) { + struct generic_stream_in *in = (struct generic_stream_in *)stream; + pthread_mutex_lock(&in->lock); + do_in_standby(in); + + in->worker_exit = true; + pthread_cond_signal(&in->worker_wake); + pthread_mutex_unlock(&in->lock); + pthread_join(in->worker_thread, NULL); + + if (in->stereo_to_mono_buf != NULL) { + free(in->stereo_to_mono_buf); + in->stereo_to_mono_buf_size = 0; + } + + if (in->bus_address) { + free(in->bus_address); + } + + pthread_mutex_destroy(&in->lock); + audio_vbuffer_destroy(&in->buffer); + free(stream); +} + +static int adev_open_input_stream(struct audio_hw_device *dev, + audio_io_handle_t handle, audio_devices_t devices, struct audio_config *config, + struct audio_stream_in **stream_in, audio_input_flags_t flags __unused, const char *address, + audio_source_t source __unused) { + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + struct generic_stream_in *in; + int ret = 0; + if (refine_input_parameters(&config->sample_rate, &config->format, &config->channel_mask)) { + ALOGE("Error opening input stream format %d, channel_mask %04x, sample_rate %u", + config->format, config->channel_mask, config->sample_rate); + ret = -EINVAL; + goto error; + } + + in = (struct generic_stream_in *)calloc(1, sizeof(struct generic_stream_in)); + if (!in) { + ret = -ENOMEM; + goto error; + } + + in->stream.common.get_sample_rate = in_get_sample_rate; + in->stream.common.set_sample_rate = in_set_sample_rate; // no op + in->stream.common.get_buffer_size = in_get_buffer_size; + in->stream.common.get_channels = in_get_channels; + in->stream.common.get_format = in_get_format; + in->stream.common.set_format = in_set_format; // no op + in->stream.common.standby = in_standby; + in->stream.common.dump = in_dump; + in->stream.common.set_parameters = in_set_parameters; + in->stream.common.get_parameters = in_get_parameters; + in->stream.common.add_audio_effect = in_add_audio_effect; // no op + in->stream.common.remove_audio_effect = in_remove_audio_effect; // no op + in->stream.set_gain = in_set_gain; // no op + in->stream.read = in_read; + in->stream.get_input_frames_lost = in_get_input_frames_lost; // no op + in->stream.get_capture_position = in_get_capture_position; + + pthread_mutex_init(&in->lock, (const pthread_mutexattr_t *) NULL); + in->dev = adev; + in->device = devices; + memcpy(&in->req_config, config, sizeof(struct audio_config)); + memcpy(&in->pcm_config, &pcm_config_in, sizeof(struct pcm_config)); + in->pcm_config.rate = config->sample_rate; + in->pcm_config.period_size = in->pcm_config.rate*IN_PERIOD_MS/1000; + + in->stereo_to_mono_buf = NULL; + in->stereo_to_mono_buf_size = 0; + + in->standby = true; + in->standby_position = 0; + in->standby_exit_time.tv_sec = 0; + in->standby_exit_time.tv_nsec = 0; + in->standby_frames_read = 0; + + ret = audio_vbuffer_init(&in->buffer, + in->pcm_config.period_size*in->pcm_config.period_count, + in->pcm_config.channels * + pcm_format_to_bits(in->pcm_config.format) >> 3); + if (ret == 0) { + pthread_cond_init(&in->worker_wake, NULL); + in->worker_standby = true; + in->worker_exit = false; + pthread_create(&in->worker_thread, NULL, in_read_worker, in); + } + + if (address) { + in->bus_address = calloc(strlen(address) + 1, sizeof(char)); + strncpy(in->bus_address, address, strlen(address)); + } + + *stream_in = &in->stream; + +error: + return ret; +} + +static int adev_dump(const audio_hw_device_t *dev, int fd) { + return 0; +} + +static int adev_set_audio_port_config(struct audio_hw_device *dev, + const struct audio_port_config *config) { + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + const char *bus_address = config->ext.device.address; + struct generic_stream_out *out = hashmapGet(adev->out_bus_stream_map, bus_address); + if (out) { + // TODO set the actual audio port gain on physical bus + ALOGD("%s: set audio gain: %d on bus_address:%s", + __func__, config->gain.values[0], bus_address); + } else { + ALOGE("%s: can not find output stream by bus_address:%s", __func__, bus_address); + } + return 0; +} + +static int adev_create_audio_patch(struct audio_hw_device *dev, + unsigned int num_sources, + const struct audio_port_config *sources, + unsigned int num_sinks, + const struct audio_port_config *sinks, + audio_patch_handle_t *handle) { + return 0; +} + +static int adev_release_audio_patch(struct audio_hw_device *dev, + audio_patch_handle_t handle) { + return 0; +} + +static int adev_close(hw_device_t *dev) { + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + int ret = 0; + if (!adev) + return 0; + + pthread_mutex_lock(&adev_init_lock); + + if (audio_device_ref_count == 0) { + ALOGE("adev_close called when ref_count 0"); + ret = -EINVAL; + goto error; + } + + if ((--audio_device_ref_count) == 0) { + if (adev->mixer) { + mixer_close(adev->mixer); + } + if (adev->out_bus_stream_map) { + hashmapFree(adev->out_bus_stream_map); + } + free(adev); + } + +error: + pthread_mutex_unlock(&adev_init_lock); + return ret; +} + +/* copied from libcutils/str_parms.c */ +static bool str_eq(void *key_a, void *key_b) { + return !strcmp((const char *)key_a, (const char *)key_b); +} + +/** + * use djb hash unless we find it inadequate. + * copied from libcutils/str_parms.c + */ +#ifdef __clang__ +__attribute__((no_sanitize("integer"))) +#endif +static int str_hash_fn(void *str) { + uint32_t hash = 5381; + char *p; + for (p = str; p && *p; p++) { + hash = ((hash << 5) + hash) + *p; + } + return (int)hash; +} + +static int adev_open(const hw_module_t *module, + const char *name, hw_device_t **device) { + static struct generic_audio_device *adev; + + if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0) + return -EINVAL; + + pthread_mutex_lock(&adev_init_lock); + if (audio_device_ref_count != 0) { + *device = &adev->device.common; + audio_device_ref_count++; + ALOGV("%s: returning existing instance of adev", __func__); + ALOGV("%s: exit", __func__); + goto unlock; + } + adev = calloc(1, sizeof(struct generic_audio_device)); + + pthread_mutex_init(&adev->lock, (const pthread_mutexattr_t *) NULL); + + adev->device.common.tag = HARDWARE_DEVICE_TAG; + adev->device.common.version = AUDIO_DEVICE_API_VERSION_3_0; + adev->device.common.module = (struct hw_module_t *) module; + adev->device.common.close = adev_close; + + adev->device.init_check = adev_init_check; // no op + adev->device.set_voice_volume = adev_set_voice_volume; // no op + adev->device.set_master_volume = adev_set_master_volume; // no op + adev->device.get_master_volume = adev_get_master_volume; // no op + adev->device.set_master_mute = adev_set_master_mute; // no op + adev->device.get_master_mute = adev_get_master_mute; // no op + adev->device.set_mode = adev_set_mode; // no op + adev->device.set_mic_mute = adev_set_mic_mute; + adev->device.get_mic_mute = adev_get_mic_mute; + adev->device.set_parameters = adev_set_parameters; // no op + adev->device.get_parameters = adev_get_parameters; // no op + adev->device.get_input_buffer_size = adev_get_input_buffer_size; + adev->device.open_output_stream = adev_open_output_stream; + adev->device.close_output_stream = adev_close_output_stream; + adev->device.open_input_stream = adev_open_input_stream; + adev->device.close_input_stream = adev_close_input_stream; + adev->device.dump = adev_dump; + + // New in AUDIO_DEVICE_API_VERSION_3_0 + adev->device.set_audio_port_config = adev_set_audio_port_config; + adev->device.create_audio_patch = adev_create_audio_patch; + adev->device.release_audio_patch = adev_release_audio_patch; + + *device = &adev->device.common; + + adev->mixer = mixer_open(PCM_CARD); + struct mixer_ctl *ctl; + + // Set default mixer ctls + // Enable channels and set volume + for (int i = 0; i < (int)mixer_get_num_ctls(adev->mixer); i++) { + ctl = mixer_get_ctl(adev->mixer, i); + ALOGD("mixer %d name %s", i, mixer_ctl_get_name(ctl)); + if (!strcmp(mixer_ctl_get_name(ctl), "Master Playback Volume") || + !strcmp(mixer_ctl_get_name(ctl), "Capture Volume")) { + for (int z = 0; z < (int)mixer_ctl_get_num_values(ctl); z++) { + ALOGD("set ctl %d to %d", z, 100); + mixer_ctl_set_percent(ctl, z, 100); + } + continue; + } + if (!strcmp(mixer_ctl_get_name(ctl), "Master Playback Switch") || + !strcmp(mixer_ctl_get_name(ctl), "Capture Switch")) { + for (int z = 0; z < (int)mixer_ctl_get_num_values(ctl); z++) { + ALOGD("set ctl %d to %d", z, 1); + mixer_ctl_set_value(ctl, z, 1); + } + continue; + } + } + + // Initialize the bus address to output stream map + adev->out_bus_stream_map = hashmapCreate(5, str_hash_fn, str_eq); + + audio_device_ref_count++; + +unlock: + pthread_mutex_unlock(&adev_init_lock); + return 0; +} + +static struct hw_module_methods_t hal_module_methods = { + .open = adev_open, +}; + +struct audio_module HAL_MODULE_INFO_SYM = { + .common = { + .tag = HARDWARE_MODULE_TAG, + .module_api_version = AUDIO_MODULE_API_VERSION_0_1, + .hal_api_version = HARDWARE_HAL_API_VERSION, + .id = AUDIO_HARDWARE_MODULE_ID, + .name = "Generic car audio HW HAL", + .author = "The Android Open Source Project", + .methods = &hal_module_methods, + }, +}; diff --git a/emulator/audio/overlay/frameworks/base/core/res/res/values/config.xml b/emulator/audio/overlay/frameworks/base/core/res/res/values/config.xml new file mode 100644 index 0000000..b256c8b --- /dev/null +++ b/emulator/audio/overlay/frameworks/base/core/res/res/values/config.xml @@ -0,0 +1,8 @@ + + + true + + true + diff --git a/emulator/audio/overlay/packages/services/Car/service/res/values/config.xml b/emulator/audio/overlay/packages/services/Car/service/res/values/config.xml new file mode 100644 index 0000000..28857b3 --- /dev/null +++ b/emulator/audio/overlay/packages/services/Car/service/res/values/config.xml @@ -0,0 +1,26 @@ + + + + + + true + diff --git a/emulator/hal/car_emulator_hal.mk b/emulator/hal/car_emulator_hal.mk new file mode 100644 index 0000000..86139a7 --- /dev/null +++ b/emulator/hal/car_emulator_hal.mk @@ -0,0 +1,24 @@ +# +# Copyright (C) 2018 Google Inc. +# +# 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. +# + +# Default HAL implementations for automotive +PRODUCT_PACKAGES += \ + android.hardware.automotive.audiocontrol@1.0-service \ + android.hardware.automotive.vehicle@2.0-service + +# Vendor Interface Manifest +PRODUCT_COPY_FILES += \ + device/generic/car/emulator/hal/car_emulator_manifest.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml diff --git a/emulator/hal/car_emulator_manifest.xml b/emulator/hal/car_emulator_manifest.xml new file mode 100644 index 0000000..0e09a8f --- /dev/null +++ b/emulator/hal/car_emulator_manifest.xml @@ -0,0 +1,205 @@ + + + + android.hardware.drm + hwbinder + 1.0 + + ICryptoFactory + default + widevine + + + IDrmFactory + default + widevine + + + + android.hardware.audio.effect + hwbinder + 2.0 + + IEffectsFactory + default + + + + android.hardware.biometrics.fingerprint + hwbinder + 2.1 + + IBiometricsFingerprint + default + + + + android.hardware.configstore + hwbinder + 1.0 + + ISurfaceFlingerConfigs + default + + + + android.hardware.audio + hwbinder + 2.0 + + IDevicesFactory + default + + + + android.hardware.keymaster + hwbinder + 3.0 + + IKeymasterDevice + default + + + + android.hardware.keymaster + hwbinder + 4.0 + + IKeymasterDevice + strongbox + + + + android.hardware.graphics.allocator + hwbinder + 2.0 + + IAllocator + default + + + + android.hardware.graphics.mapper + passthrough + 2.0 + + IMapper + default + + + + android.hardware.graphics.composer + hwbinder + 2.1 + + IComposer + default + + + + android.hardware.power + hwbinder + 1.0 + + IPower + default + + + + android.hardware.broadcastradio + hwbinder + 1.0 + + IBroadcastRadioFactory + default + + + + android.hardware.camera.provider + hwbinder + 2.4 + + ICameraProvider + legacy/0 + + + + android.hardware.sensors + hwbinder + 1.0 + + ISensors + default + + + + android.hardware.gatekeeper + hwbinder + 1.0 + + IGatekeeper + default + + + + android.hardware.gnss + hwbinder + 1.0 + + IGnss + default + + + + android.hardware.media.omx + hwbinder + 1.0 + + IOmx + default + + + IOmxStore + default + + + + android.hardware.radio.deprecated + hwbinder + 1.0 + + IOemHook + slot1 + + + + android.hardware.radio + hwbinder + 1.0 + + IRadio + slot1 + + + + android.hardware.automotive.audiocontrol + hwbinder + 1.0 + + IAudioControl + default + + + + android.hardware.automotive.vehicle + hwbinder + 2.0 + + IVehicle + default + + + + 10000.0 + + -- cgit v1.2.3 From e22a253797c82d48a6a48fec7bd96776b8521b46 Mon Sep 17 00:00:00 2001 From: bohu Date: Sat, 10 Mar 2018 21:55:12 -0800 Subject: car-emulator: fix networking emulator needs specical apns-conf.xml files BUG: 74390188 Change-Id: I0a221799d3760948400afb1c452bb686b766b61a --- common/car.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/car.mk b/common/car.mk index 0663773..7391808 100644 --- a/common/car.mk +++ b/common/car.mk @@ -37,6 +37,8 @@ PRODUCT_COPY_FILES += \ # Overwrite handheld_core_hardware.xml with a dummy config. PRODUCT_COPY_FILES += \ device/generic/car/common/android.hardware.dummy.xml:system/etc/permissions/handheld_core_hardware.xml \ + device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \ + device/sample/etc/old-apns-conf.xml:system/etc/old-apns-conf.xml \ device/generic/car/common/car_core_hardware.xml:system/etc/permissions/car_core_hardware.xml \ frameworks/native/data/etc/android.hardware.type.automotive.xml:system/etc/permissions/android.hardware.type.automotive.xml -- cgit v1.2.3 From 2d5d7ed29b9f77c2ffebc7199331ab72d8d3427b Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Wed, 21 Mar 2018 18:32:35 -0700 Subject: Fixed the typo in hwservice_contexts Bug: 76117372 Test: run on emulator Change-Id: Icaf723569e9f477231ddb06316e5a0d642f6a597 --- common/sepolicy/hwservice_contexts | 2 +- common/sepolicy/system_app.te | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/sepolicy/hwservice_contexts b/common/sepolicy/hwservice_contexts index 2c0ef53..d46c4c3 100644 --- a/common/sepolicy/hwservice_contexts +++ b/common/sepolicy/hwservice_contexts @@ -1,2 +1,2 @@ -android.hardware.automotive.vehicle::IAudioControl u:object_r:hal_audiocontrol_hwservice:s0 +android.hardware.automotive.audiocontrol::IAudioControl u:object_r:hal_audiocontrol_hwservice:s0 android.hardware.automotive.vehicle::IVehicle u:object_r:hal_vehicle_hwservice:s0 diff --git a/common/sepolicy/system_app.te b/common/sepolicy/system_app.te index b09239c..102f77f 100644 --- a/common/sepolicy/system_app.te +++ b/common/sepolicy/system_app.te @@ -1 +1,2 @@ +allow system_app hal_audiocontrol_hwservice:hwservice_manager find; allow system_app hal_vehicle_hwservice:hwservice_manager find; -- cgit v1.2.3 From 9d7f5ea53419e5100d59057c5d5c01c9f2df6233 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 3 Apr 2018 10:49:52 -0700 Subject: Clean up Broadcast Radio demo mode settings. While we're here, also clean up android.car.drawer.unlimited setting that's gone now. Bug: 73950974 Test: some other target builds Change-Id: I5843dbedb347e867285de514cf6cf354840e80cd --- common/car.mk | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/car.mk b/common/car.mk index 7391808..fb00657 100644 --- a/common/car.mk +++ b/common/car.mk @@ -47,10 +47,7 @@ PRODUCT_COPY_FILES += \ device/generic/car/common/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml PRODUCT_PROPERTY_OVERRIDES += \ - android.car.drawer.unlimited=true \ - android.car.hvac.demo=true \ - com.android.car.radio.demo=true \ - com.android.car.radio.demo.dual=true + android.car.hvac.demo=true TARGET_USES_CAR_FUTURE_FEATURES := true -- cgit v1.2.3 From 6f315dbfb2288f1c309367efe70bec1628841207 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Thu, 29 Mar 2018 14:27:51 -0700 Subject: Adds audio patch test audio_hw.c is formatted via clang-format and more debug information for audio patch is added Bug: 77147937 Test: releaseAudioPatch(createAudioPatch(String, int, int)) Change-Id: I5cb02557cc5df31a3d33337905601630c5bd525e --- emulator/audio/audio_policy_configuration.xml | 30 +++++++++++++++++++++++++++ emulator/audio/driver/audio_hw.c | 20 ++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/emulator/audio/audio_policy_configuration.xml b/emulator/audio/audio_policy_configuration.xml index 2bc3172..30d20f0 100644 --- a/emulator/audio/audio_policy_configuration.xml +++ b/emulator/audio/audio_policy_configuration.xml @@ -60,6 +60,8 @@ bus6_notification_out bus7_system_sound_out bus0_mic1_in + + bus1_audio_patch_test_in bus0_media_out @@ -116,6 +118,15 @@ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_STEREO"/> + + + + + + + + + + + + + + @@ -207,6 +232,11 @@ + + diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c index 24294ca..83d4858 100644 --- a/emulator/audio/driver/audio_hw.c +++ b/emulator/audio/driver/audio_hw.c @@ -1360,11 +1360,31 @@ static int adev_create_audio_patch(struct audio_hw_device *dev, unsigned int num_sinks, const struct audio_port_config *sinks, audio_patch_handle_t *handle) { + // Logging only, no real work is done here + for (int i = 0; i < num_sources; i++) { + ALOGD("%s: source[%d] type=%d address=%s", __func__, i, sources[i].type, + sources[i].type == AUDIO_PORT_TYPE_DEVICE + ? sources[i].ext.device.address + : ""); + } + for (int i = 0; i < num_sinks; i++) { + ALOGD("%s: sink[%d] type=%d address=%s", __func__, i, sinks[i].type, + sinks[i].type == AUDIO_PORT_TYPE_DEVICE ? sinks[i].ext.device.address + : "N/A"); + } + if (num_sources == 1 && num_sinks == 1 && + sources[0].type == AUDIO_PORT_TYPE_DEVICE && + sinks[0].type == AUDIO_PORT_TYPE_DEVICE) { + // The same audio_patch_handle_t will be passed to release_audio_patch + *handle = 42; + ALOGD("%s: handle: %d", __func__, *handle); + } return 0; } static int adev_release_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t handle) { + ALOGD("%s: handle: %d", __func__, handle); return 0; } -- cgit v1.2.3 From 462e1f1b5fe5c356c0b63aebc7dae4b8d102f72a Mon Sep 17 00:00:00 2001 From: Pavel Maltsev Date: Tue, 10 Apr 2018 14:17:55 -0700 Subject: Split automotive HALs sepolicies Spliting automotive policies between private/public/vendor similar to policies defined in system/sepolicy Bug: 70637118 Test: build, flash and boot bat_land, owl and emulator automotive builds Change-Id: I1dc56b073328a6ee185c59c6754eccda179ff4af --- common/car.mk | 1 - common/sepolicy/file_contexts | 2 -- common/sepolicy/hal_audiocontrol_hwservice.te | 1 - common/sepolicy/hal_vehicle_hwservice.te | 1 - common/sepolicy/hwservice.te | 2 -- common/sepolicy/hwservice_contexts | 2 -- common/sepolicy/system_app.te | 1 + 7 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 common/sepolicy/file_contexts delete mode 100644 common/sepolicy/hal_audiocontrol_hwservice.te delete mode 100644 common/sepolicy/hal_vehicle_hwservice.te delete mode 100644 common/sepolicy/hwservice.te delete mode 100644 common/sepolicy/hwservice_contexts diff --git a/common/car.mk b/common/car.mk index fb00657..72df605 100644 --- a/common/car.mk +++ b/common/car.mk @@ -54,6 +54,5 @@ TARGET_USES_CAR_FUTURE_FEATURES := true # Add car related sepolicy. BOARD_SEPOLICY_DIRS += \ device/generic/car/common/sepolicy \ - packages/services/Car/car_product/sepolicy $(call inherit-product, packages/services/Car/car_product/build/car.mk) diff --git a/common/sepolicy/file_contexts b/common/sepolicy/file_contexts deleted file mode 100644 index ac02aab..0000000 --- a/common/sepolicy/file_contexts +++ /dev/null @@ -1,2 +0,0 @@ -/(vendor|system/vendor)/bin/hw/android.hardware.automotive.audiocontrol@1.0-service u:object_r:hal_audiocontrol_default_exec:s0 -/(vendor|system/vendor)/bin/hw/android.hardware.automotive.vehicle@2.0-service u:object_r:hal_vehicle_default_exec:s0 diff --git a/common/sepolicy/hal_audiocontrol_hwservice.te b/common/sepolicy/hal_audiocontrol_hwservice.te deleted file mode 100644 index b8082a4..0000000 --- a/common/sepolicy/hal_audiocontrol_hwservice.te +++ /dev/null @@ -1 +0,0 @@ -add_hwservice(hal_audiocontrol_default, hal_audiocontrol_hwservice) diff --git a/common/sepolicy/hal_vehicle_hwservice.te b/common/sepolicy/hal_vehicle_hwservice.te deleted file mode 100644 index 836d21f..0000000 --- a/common/sepolicy/hal_vehicle_hwservice.te +++ /dev/null @@ -1 +0,0 @@ -add_hwservice(hal_vehicle_default, hal_vehicle_hwservice) \ No newline at end of file diff --git a/common/sepolicy/hwservice.te b/common/sepolicy/hwservice.te deleted file mode 100644 index fb8b372..0000000 --- a/common/sepolicy/hwservice.te +++ /dev/null @@ -1,2 +0,0 @@ -type hal_audiocontrol_hwservice, hwservice_manager_type; -type hal_vehicle_hwservice, hwservice_manager_type; diff --git a/common/sepolicy/hwservice_contexts b/common/sepolicy/hwservice_contexts deleted file mode 100644 index d46c4c3..0000000 --- a/common/sepolicy/hwservice_contexts +++ /dev/null @@ -1,2 +0,0 @@ -android.hardware.automotive.audiocontrol::IAudioControl u:object_r:hal_audiocontrol_hwservice:s0 -android.hardware.automotive.vehicle::IVehicle u:object_r:hal_vehicle_hwservice:s0 diff --git a/common/sepolicy/system_app.te b/common/sepolicy/system_app.te index 102f77f..9bc5ba3 100644 --- a/common/sepolicy/system_app.te +++ b/common/sepolicy/system_app.te @@ -1,2 +1,3 @@ allow system_app hal_audiocontrol_hwservice:hwservice_manager find; allow system_app hal_vehicle_hwservice:hwservice_manager find; + -- cgit v1.2.3 From 3e1ad75f59272efad0a46d8a456a3ce1987c8564 Mon Sep 17 00:00:00 2001 From: Pavel Maltsev Date: Sun, 29 Apr 2018 12:54:34 -0700 Subject: Move Car Service to its own security domain Bug: 70637118 Test: m && emulator ; also verified on bat_land Change-Id: Ia776022d77b7e24ea8d1e3d60d82bccc4b219652 --- common/car.mk | 4 ---- common/sepolicy/system_app.te | 3 --- 2 files changed, 7 deletions(-) delete mode 100644 common/sepolicy/system_app.te diff --git a/common/car.mk b/common/car.mk index 72df605..51f6ca5 100644 --- a/common/car.mk +++ b/common/car.mk @@ -51,8 +51,4 @@ PRODUCT_PROPERTY_OVERRIDES += \ TARGET_USES_CAR_FUTURE_FEATURES := true -# Add car related sepolicy. -BOARD_SEPOLICY_DIRS += \ - device/generic/car/common/sepolicy \ - $(call inherit-product, packages/services/Car/car_product/build/car.mk) diff --git a/common/sepolicy/system_app.te b/common/sepolicy/system_app.te deleted file mode 100644 index 9bc5ba3..0000000 --- a/common/sepolicy/system_app.te +++ /dev/null @@ -1,3 +0,0 @@ -allow system_app hal_audiocontrol_hwservice:hwservice_manager find; -allow system_app hal_vehicle_hwservice:hwservice_manager find; - -- cgit v1.2.3 From 2d7c2514828d2d8134aa92999f12545866e6d800 Mon Sep 17 00:00:00 2001 From: Pavel Maltsev Date: Tue, 1 May 2018 20:05:17 +0000 Subject: Revert "Move Car Service to its own security domain" This reverts commit 3e1ad75f59272efad0a46d8a456a3ce1987c8564. Reason for revert: broken build Change-Id: Ifa6c93df6064820cea104a3400310cbe048b7344 --- common/car.mk | 4 ++++ common/sepolicy/system_app.te | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 common/sepolicy/system_app.te diff --git a/common/car.mk b/common/car.mk index 51f6ca5..72df605 100644 --- a/common/car.mk +++ b/common/car.mk @@ -51,4 +51,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ TARGET_USES_CAR_FUTURE_FEATURES := true +# Add car related sepolicy. +BOARD_SEPOLICY_DIRS += \ + device/generic/car/common/sepolicy \ + $(call inherit-product, packages/services/Car/car_product/build/car.mk) diff --git a/common/sepolicy/system_app.te b/common/sepolicy/system_app.te new file mode 100644 index 0000000..9bc5ba3 --- /dev/null +++ b/common/sepolicy/system_app.te @@ -0,0 +1,3 @@ +allow system_app hal_audiocontrol_hwservice:hwservice_manager find; +allow system_app hal_vehicle_hwservice:hwservice_manager find; + -- cgit v1.2.3 From bfe527417fdc672fea914c77cbbdaf306b38dd65 Mon Sep 17 00:00:00 2001 From: Pavel Maltsev Date: Wed, 2 May 2018 10:08:39 -0700 Subject: Move Car Service to its own security domain Bug: 70637118 Test: m && emulator ; also verified on bat_land Change-Id: Ie206ec8b8f9e300dfff607045fa3550b9e024918 --- common/car.mk | 4 ---- common/sepolicy/system_app.te | 3 --- 2 files changed, 7 deletions(-) delete mode 100644 common/sepolicy/system_app.te diff --git a/common/car.mk b/common/car.mk index 72df605..51f6ca5 100644 --- a/common/car.mk +++ b/common/car.mk @@ -51,8 +51,4 @@ PRODUCT_PROPERTY_OVERRIDES += \ TARGET_USES_CAR_FUTURE_FEATURES := true -# Add car related sepolicy. -BOARD_SEPOLICY_DIRS += \ - device/generic/car/common/sepolicy \ - $(call inherit-product, packages/services/Car/car_product/build/car.mk) diff --git a/common/sepolicy/system_app.te b/common/sepolicy/system_app.te deleted file mode 100644 index 9bc5ba3..0000000 --- a/common/sepolicy/system_app.te +++ /dev/null @@ -1,3 +0,0 @@ -allow system_app hal_audiocontrol_hwservice:hwservice_manager find; -allow system_app hal_vehicle_hwservice:hwservice_manager find; - -- cgit v1.2.3 From 33f10c646595b0ef08c68965cb204c758ce1c4b1 Mon Sep 17 00:00:00 2001 From: Pavel Maltsev Date: Mon, 7 May 2018 12:51:20 -0700 Subject: Flip full treble complient flag for car emulator Bug: 70637118 Test: lunch aosp_car_x86-userdebug && m Test: verified boots and works Change-Id: I3af82c17e604397d09a2df8cf3dbd54ab74c0590 --- common/car.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/common/car.mk b/common/car.mk index 51f6ca5..27860b3 100644 --- a/common/car.mk +++ b/common/car.mk @@ -14,9 +14,6 @@ # limitations under the License. # -# TODO Remove this when AAE is fully treble ready -PRODUCT_FULL_TREBLE_OVERRIDE := false - # Auto modules PRODUCT_PACKAGES += \ android.hardware.automotive.vehicle@2.0-service -- cgit v1.2.3 From 3b214bb09477b50626312ff4cba773fdc201fc77 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Mon, 7 May 2018 12:38:29 -0700 Subject: Adds back default Built-in Mic for emulator Bug: 78604377 Test: manually Change-Id: I61cddb081ab38c1c97cb2ee6646cb2768b48e626 --- common/config.ini | 1 + emulator/audio/audio_policy_configuration.xml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/common/config.ini b/common/config.ini index 621b581..d126122 100644 --- a/common/config.ini +++ b/common/config.ini @@ -1,3 +1,4 @@ +hw.audioInput=yes hw.lcd.density=120 hw.gpu.enabled=yes hw.camera.back=none diff --git a/emulator/audio/audio_policy_configuration.xml b/emulator/audio/audio_policy_configuration.xml index 30d20f0..eade9ab 100644 --- a/emulator/audio/audio_policy_configuration.xml +++ b/emulator/audio/audio_policy_configuration.xml @@ -59,6 +59,8 @@ bus5_alarm_out bus6_notification_out bus7_system_sound_out + Built-In Mic + Built-In Back Mic bus0_mic1_in bus1_audio_patch_test_in @@ -113,6 +115,11 @@ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + + + + + + + + + + @@ -234,7 +234,7 @@ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_STEREO"/> + minValueMB="-3200" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/> diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c index 7737955..f210569 100644 --- a/emulator/audio/driver/audio_hw.c +++ b/emulator/audio/driver/audio_hw.c @@ -987,8 +987,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev, hashmapPut(adev->out_bus_stream_map, out->bus_address, out); /* TODO: read struct audio_gain from audio_policy_configuration */ out->gain_stage = (struct audio_gain) { - .min_value = -8400, - .max_value = 4000, + .min_value = -3200, + .max_value = 600, .step_value = 100, }; out->amplitude_ratio = 1.0; -- cgit v1.2.3 From da9dc8837ef43c89910bf0ca1f4544889a98f391 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Mon, 14 May 2018 14:00:22 -0700 Subject: Fixes crash from in_read_worker on car emulator Bug: 79696410 Test: audio recording on car emulator Change-Id: I51b4ebef2dd2c074b360307a99bc498eee9eb1ea --- emulator/audio/driver/audio_hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c index 7737955..75aa2c2 100644 --- a/emulator/audio/driver/audio_hw.c +++ b/emulator/audio/driver/audio_hw.c @@ -767,7 +767,7 @@ static void *in_read_worker(void *args) { break; } buffer_frames = in->pcm_config.period_size; - buffer_size = ext_pcm_frames_to_bytes(pcm, buffer_frames); + buffer_size = pcm_frames_to_bytes(pcm, buffer_frames); buffer = malloc(buffer_size); if (!buffer) { ALOGE("could not allocate worker read buffer"); @@ -776,7 +776,7 @@ static void *in_read_worker(void *args) { } } pthread_mutex_unlock(&in->lock); - int ret = pcm_read(pcm, buffer, ext_pcm_frames_to_bytes(pcm, buffer_frames)); + int ret = pcm_read(pcm, buffer, pcm_frames_to_bytes(pcm, buffer_frames)); if (ret != 0) { ALOGW("pcm_read failed %s", pcm_get_error(pcm)); restart = true; -- cgit v1.2.3 From 3c1c2ba566df1d0797ed69b79d14765450239ac9 Mon Sep 17 00:00:00 2001 From: Pavel Maltsev Date: Wed, 16 May 2018 16:31:13 -0700 Subject: Register IAudioControl hal Test: m && emulator Bug: 79878753 Change-Id: Ia02452b9f812fa6649aa6664e91104fc614abdca --- common/manifest.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/manifest.xml b/common/manifest.xml index 0eed84e..c2c7abc 100644 --- a/common/manifest.xml +++ b/common/manifest.xml @@ -190,6 +190,15 @@ default + + android.hardware.automotive.audiocontrol + hwbinder + 1.0 + + IAudioControl + default + + 27.0 -- cgit v1.2.3 From de54002de5f011df9c6f89619bdbcbb942cec459 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Wed, 16 May 2018 16:54:10 -0700 Subject: Adds IWifi to car emulator Bug: 79884302 Test: Settings and WebView shell on car emulator Change-Id: I10e8e9e9bb4c7449243d696936fffb97cfbc15f6 --- common/manifest.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/manifest.xml b/common/manifest.xml index 0eed84e..a4af2a2 100644 --- a/common/manifest.xml +++ b/common/manifest.xml @@ -181,6 +181,24 @@ slot1 + + android.hardware.wifi + hwbinder + 1.0 + + IWifi + default + + + + android.hardware.wifi.supplicant + hwbinder + 1.0 + + ISupplicant + default + + android.hardware.automotive.vehicle hwbinder -- cgit v1.2.3 From 6f3ae29a9d8be05b812cbfde5b04c15d9356bf4d Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 29 May 2018 13:11:45 -0700 Subject: Demonstrates master mute implementation in car emulator Bug: 80474559 Test: adb shell input keyevent 164 Change-Id: I75710257050d97ee1e6d637ee6fef0efecb9e39f --- emulator/audio/driver/audio_hw.c | 33 +++++++++++++++++++++++++-------- emulator/audio/driver/audio_hw.h | 1 + 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c index c2eff7e..807cc15 100644 --- a/emulator/audio/driver/audio_hw.c +++ b/emulator/audio/driver/audio_hw.c @@ -50,6 +50,8 @@ #define IN_PERIOD_MS 15 #define IN_PERIOD_COUNT 4 +#define _bool_str(x) ((x)?"true":"false") + static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state); static struct pcm_config pcm_config_out = { @@ -264,7 +266,7 @@ static void *out_write_worker(void *args) { ALOGE("pcm_write failed %s address %s", ext_pcm_get_error(ext_pcm), out->bus_address); restart = true; } else { - ALOGD("pcm_write succeed address %s", out->bus_address); + ALOGV("pcm_write succeed address %s", out->bus_address); } } if (buffer) { @@ -347,9 +349,14 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, si out->frames_total_buffered = 0; } - out_apply_gain(out, buffer, bytes); - size_t frames_written = audio_vbuffer_write(&out->buffer, buffer, frames); - pthread_cond_signal(&out->worker_wake); + size_t frames_written = frames; + if (out->dev->master_mute) { + ALOGV("%s: ignored due to master mute", __func__); + } else { + out_apply_gain(out, buffer, bytes); + frames_written = audio_vbuffer_write(&out->buffer, buffer, frames); + pthread_cond_signal(&out->worker_wake); + } /* Implementation just consumes bytes if we start getting backed up */ out->frames_written += frames; @@ -1049,11 +1056,21 @@ static int adev_get_master_volume(struct audio_hw_device *dev, float *volume) { } static int adev_set_master_mute(struct audio_hw_device *dev, bool muted) { - return -ENOSYS; + ALOGD("%s: %s", __func__, _bool_str(muted)); + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + pthread_mutex_lock(&adev->lock); + adev->master_mute = muted; + pthread_mutex_unlock(&adev->lock); + return 0; } static int adev_get_master_mute(struct audio_hw_device *dev, bool *muted) { - return -ENOSYS; + struct generic_audio_device *adev = (struct generic_audio_device *)dev; + pthread_mutex_lock(&adev->lock); + *muted = adev->master_mute; + pthread_mutex_unlock(&adev->lock); + ALOGD("%s: %s", __func__, _bool_str(*muted)); + return 0; } static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) { @@ -1326,8 +1343,8 @@ static int adev_open(const hw_module_t *module, adev->device.set_voice_volume = adev_set_voice_volume; // no op adev->device.set_master_volume = adev_set_master_volume; // no op adev->device.get_master_volume = adev_get_master_volume; // no op - adev->device.set_master_mute = adev_set_master_mute; // no op - adev->device.get_master_mute = adev_get_master_mute; // no op + adev->device.set_master_mute = adev_set_master_mute; + adev->device.get_master_mute = adev_get_master_mute; adev->device.set_mode = adev_set_mode; // no op adev->device.set_mic_mute = adev_set_mic_mute; adev->device.get_mic_mute = adev_get_mic_mute; diff --git a/emulator/audio/driver/audio_hw.h b/emulator/audio/driver/audio_hw.h index 9ad7990..41217ad 100644 --- a/emulator/audio/driver/audio_hw.h +++ b/emulator/audio/driver/audio_hw.h @@ -28,6 +28,7 @@ struct generic_audio_device { struct audio_hw_device device; // Constant after init pthread_mutex_t lock; + bool master_mute; // Proteced by this->lock bool mic_mute; // Proteced by this->lock struct mixer *mixer; // Proteced by this->lock Hashmap *out_bus_stream_map; // Extended field. Constant after init -- cgit v1.2.3