Merge "Disable touch sounds by default" into rvc-qpr-dev
diff --git a/car_product/build/car_base.mk b/car_product/build/car_base.mk
index d6b62bc..6fdd02a 100644
--- a/car_product/build/car_base.mk
+++ b/car_product/build/car_base.mk
@@ -17,7 +17,13 @@
# Base platform for car builds
# car packages should be added to car.mk instead of here
+ifeq ($(DISABLE_CAR_PRODUCT_CONFIG_OVERLAY),)
PRODUCT_PACKAGE_OVERLAYS += packages/services/Car/car_product/overlay
+endif
+
+ifeq ($(DISABLE_CAR_PRODUCT_VISUAL_OVERLAY),)
+PRODUCT_PACKAGE_OVERLAYS += packages/services/Car/car_product/overlay-visual
+endif
PRODUCT_COPY_FILES += \
packages/services/Car/car_product/build/component-overrides.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sysconfig/component-overrides.xml \
diff --git a/car_product/overlay/frameworks/base/core/res/res/anim/fade_in.xml b/car_product/overlay-visual/frameworks/base/core/res/res/anim/fade_in.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/anim/fade_in.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/anim/fade_in.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/anim/fade_out.xml b/car_product/overlay-visual/frameworks/base/core/res/res/anim/fade_out.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/anim/fade_out.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/anim/fade_out.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable-night-nodpi/default_wallpaper.png b/car_product/overlay-visual/frameworks/base/core/res/res/drawable-night-nodpi/default_wallpaper.png
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable-night-nodpi/default_wallpaper.png
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable-night-nodpi/default_wallpaper.png
Binary files differ
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png b/car_product/overlay-visual/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png
Binary files differ
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable-sw600dp-night/default_wallpaper.png b/car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw600dp-night/default_wallpaper.png
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable-sw600dp-night/default_wallpaper.png
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw600dp-night/default_wallpaper.png
Binary files differ
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.png b/car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.png
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.png
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.png
Binary files differ
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable-sw720dp-night/default_wallpaper.png b/car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw720dp-night/default_wallpaper.png
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable-sw720dp-night/default_wallpaper.png
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw720dp-night/default_wallpaper.png
Binary files differ
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable-sw720dp-nodpi/default_wallpaper.png b/car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw720dp-nodpi/default_wallpaper.png
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable-sw720dp-nodpi/default_wallpaper.png
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable-sw720dp-nodpi/default_wallpaper.png
Binary files differ
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable/ic_account_circle.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/ic_account_circle.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable/ic_account_circle.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable/ic_account_circle.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable/ic_collapse_notification.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/ic_collapse_notification.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable/ic_collapse_notification.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable/ic_collapse_notification.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable/ic_expand_notification.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/ic_expand_notification.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable/ic_expand_notification.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable/ic_expand_notification.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable/item_background.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/item_background.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable/item_background.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable/item_background.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/drawable/toast_frame.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/toast_frame.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/drawable/toast_frame.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/drawable/toast_frame.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/notification_template_right_icon.xml b/car_product/overlay-visual/frameworks/base/core/res/res/layout/notification_template_right_icon.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/layout/notification_template_right_icon.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/layout/notification_template_right_icon.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/resolve_list_item.xml b/car_product/overlay-visual/frameworks/base/core/res/res/layout/resolve_list_item.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/layout/resolve_list_item.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/layout/resolve_list_item.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/resolver_different_item_header.xml b/car_product/overlay-visual/frameworks/base/core/res/res/layout/resolver_different_item_header.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/layout/resolver_different_item_header.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/layout/resolver_different_item_header.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list.xml b/car_product/overlay-visual/frameworks/base/core/res/res/layout/resolver_list.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/layout/resolver_list.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/layout/resolver_list.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list_with_default.xml b/car_product/overlay-visual/frameworks/base/core/res/res/layout/resolver_list_with_default.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/layout/resolver_list_with_default.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/layout/resolver_list_with_default.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/transient_notification.xml b/car_product/overlay-visual/frameworks/base/core/res/res/layout/transient_notification.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/layout/transient_notification.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/layout/transient_notification.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-h1752dp/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-h1752dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-h1752dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-h1752dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-h600dp/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-h600dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-h600dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-h600dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-night/colors_car.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-night/colors_car.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-night/colors_car.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-night/colors_car.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-night/colors_device_defaults.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-night/colors_device_defaults.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-night/colors_device_defaults.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-night/colors_device_defaults.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-w1280dp/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-w1280dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-w1280dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-w1280dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-w1920dp/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-w1920dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-w1920dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-w1920dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-w690dp/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-w690dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-w690dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-w690dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values-w840dp/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values-w840dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values-w840dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values-w840dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/colors.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/colors.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values/colors.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values/colors.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/colors_device_defaults.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/colors_device_defaults.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values/colors_device_defaults.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values/colors_device_defaults.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values/dimens.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values/dimens.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/styles.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/styles.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values/styles.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values/styles.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/styles_device_default.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/styles_device_default.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values/styles_device_default.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values/styles_device_default.xml
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/themes_device_defaults.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/themes_device_defaults.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/core/res/res/values/themes_device_defaults.xml
rename to car_product/overlay-visual/frameworks/base/core/res/res/values/themes_device_defaults.xml
diff --git a/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-h600dp/dimens.xml b/car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-h600dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-h600dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-h600dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-sw600dp/dimens.xml b/car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-sw600dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-sw600dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-sw600dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-w1024dp/dimens.xml b/car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-w1024dp/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-w1024dp/dimens.xml
rename to car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-w1024dp/dimens.xml
diff --git a/car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-w550dp-land/dimens.xml b/car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-w550dp-land/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/packages/CarSystemUI/res/values-w550dp-land/dimens.xml
rename to car_product/overlay-visual/frameworks/base/packages/CarSystemUI/res/values-w550dp-land/dimens.xml
diff --git a/car_product/overlay/frameworks/base/packages/SettingsLib/res/values/dimens.xml b/car_product/overlay-visual/frameworks/base/packages/SettingsLib/res/values/dimens.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/packages/SettingsLib/res/values/dimens.xml
rename to car_product/overlay-visual/frameworks/base/packages/SettingsLib/res/values/dimens.xml
diff --git a/car_product/overlay/frameworks/base/packages/SettingsLib/res/values/styles.xml b/car_product/overlay-visual/frameworks/base/packages/SettingsLib/res/values/styles.xml
similarity index 100%
rename from car_product/overlay/frameworks/base/packages/SettingsLib/res/values/styles.xml
rename to car_product/overlay-visual/frameworks/base/packages/SettingsLib/res/values/styles.xml
diff --git a/car_product/sepolicy/private/carservice_app.te b/car_product/sepolicy/private/carservice_app.te
index 49a3c6f..2fd2095 100644
--- a/car_product/sepolicy/private/carservice_app.te
+++ b/car_product/sepolicy/private/carservice_app.te
@@ -66,8 +66,9 @@
allow carservice_app statsd:binder call;
# To access /sys/fs/<type>/<partition>/lifetime_write_kbytes
-r_dir_file(carservice_app, sysfs_fs_ext4)
-r_dir_file(carservice_app, sysfs_fs_f2fs)
+allow carservice_app sysfs:dir { open read search };
+allow carservice_app sysfs_fs_ext4_features:dir { open read search};
+allow carservice_app sysfs_fs_f2fs:dir { open read search };
set_prop(carservice_app, ctl_start_prop)
set_prop(carservice_app, ctl_stop_prop)
diff --git a/car_product/sepolicy/private/genfs_contexts b/car_product/sepolicy/private/genfs_contexts
deleted file mode 100644
index e8e6e9f..0000000
--- a/car_product/sepolicy/private/genfs_contexts
+++ /dev/null
@@ -1 +0,0 @@
-genfscon sysfs /fs/ext4 u:object_r:sysfs_fs_ext4:s0
diff --git a/car_product/sepolicy/public/file.te b/car_product/sepolicy/public/file.te
index 8703f35..11bf839 100644
--- a/car_product/sepolicy/public/file.te
+++ b/car_product/sepolicy/public/file.te
@@ -1,4 +1,8 @@
+# This type for lifetime_write_kbytes files which resides in
+# /sys/fs/<filesystem>/<partition>/lifetime_writes_kbytes
+# Vendors are supposed to extend genfs_contexts with the
+# partition names for their devices.
+type sysfs_fs_lifetime_write, sysfs_type, fs_type;
+
# /data/system/car
type system_car_data_file, file_type, data_file_type, core_data_file_type;
-# /sys/fs/ext4
-type sysfs_fs_ext4, sysfs_type, fs_type;
diff --git a/evs/manager/1.1/Android.bp b/evs/manager/1.1/Android.bp
index 891d615..d9c7d33 100644
--- a/evs/manager/1.1/Android.bp
+++ b/evs/manager/1.1/Android.bp
@@ -14,6 +14,65 @@
//
//
+cc_library {
+ name: "android.automotive.evs.manager.fuzzlib",
+
+ srcs: [
+ "Enumerator.cpp",
+ "HalCamera.cpp",
+ "HalDisplay.cpp",
+ "VirtualCamera.cpp",
+ "stats/CameraUsageStats.cpp",
+ "stats/LooperWrapper.cpp",
+ "stats/StatsCollector.cpp",
+ "sync/unique_fd.cpp",
+ "sync/unique_fence.cpp",
+ "sync/unique_timeline.cpp",
+ ],
+
+ shared_libs: [
+ "android.hardware.automotive.evs@1.0",
+ "android.hardware.automotive.evs@1.1",
+ "libbase",
+ "libcamera_metadata",
+ "libcutils",
+ "libhardware",
+ "libhidlbase",
+ "libprocessgroup",
+ "libstatslog",
+ "libsync",
+ "libui",
+ "libutils",
+ ],
+
+ cflags: ["-DLOG_TAG=\"EvsManagerFuzzlibV1_1\""] + [
+ "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
+ "-Wall",
+ "-Werror",
+ "-Wunused",
+ "-Wunreachable-code",
+ "-Wthread-safety",
+ ],
+
+ include_dirs: [
+ "system/core/libsync",
+ ],
+
+ export_include_dirs: [
+ "./",
+ "stats/",
+ "sync/",
+ ],
+
+ product_variables: {
+ debuggable: {
+ cflags: [
+ "-DEVS_DEBUG",
+ ]
+ }
+ },
+}
+
//#################################
cc_binary {
diff --git a/evs/manager/1.1/test/fuzzer/Android.bp b/evs/manager/1.1/test/fuzzer/Android.bp
new file mode 100644
index 0000000..dfe0203
--- /dev/null
+++ b/evs/manager/1.1/test/fuzzer/Android.bp
@@ -0,0 +1,61 @@
+// Copyright 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_defaults {
+ name: "evs_fuzz_default",
+ static_libs: [
+ "libgmock",
+ "libgtest",
+ ],
+
+ shared_libs: [
+ "android.automotive.evs.manager.fuzzlib",
+ "android.hardware.automotive.evs@1.0",
+ "android.hardware.automotive.evs@1.1",
+ "libbase",
+ "libcamera_metadata",
+ "libcutils",
+ "libhardware",
+ "libhidlbase",
+ "libprocessgroup",
+ "libstatslog",
+ "libsync",
+ "libui",
+ "libutils",
+ ],
+
+ cflags: [
+ "-Wno-unused-parameter",
+ ],
+
+ include_dirs: [
+ "system/core/libsync",
+ ],
+}
+
+cc_fuzz {
+ name: "evs_halcamera_fuzzer",
+ srcs: [
+ "HalCameraFuzzer.cpp",
+ ],
+ defaults: ["evs_fuzz_default"],
+}
+
+cc_fuzz {
+ name: "evs_virtual_camera_fuzzer",
+ srcs: [
+ "VirtualCameraFuzzer.cpp",
+ ],
+ defaults: ["evs_fuzz_default"],
+}
\ No newline at end of file
diff --git a/evs/manager/1.1/test/fuzzer/Common.h b/evs/manager/1.1/test/fuzzer/Common.h
new file mode 100644
index 0000000..b3b53a6
--- /dev/null
+++ b/evs/manager/1.1/test/fuzzer/Common.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EVS_MANAGER_1_1_TEST_FUZZER_COMMON_H_
+#define EVS_MANAGER_1_1_TEST_FUZZER_COMMON_H_
+
+namespace android {
+namespace automotive {
+namespace evs {
+namespace V1_1 {
+namespace implementation {
+
+#define EVS_FUZZ_BASE_ENUM \
+ EVS_FUZZ_NOTIFY, /*verify notify*/ \
+ EVS_FUZZ_GET_HW_CAMERA, /*verify getHalCameras*/ \
+ EVS_FUZZ_DELIVER_FRAME, /* verify deliverFrame */ \
+ EVS_FUZZ_DONE_WITH_FRAME_1_0, /* verify doneWithFrame */ \
+ EVS_FUZZ_DONE_WITH_FRAME_1_1, /* verify doneWithFrame_1_1 */ \
+ EVS_FUZZ_SET_PRIMARY, /* verify setPrimary */ \
+ EVS_FUZZ_FORCE_PRIMARY, /* verify forcePrimary */ \
+ EVS_FUZZ_UNSET_PRIMARY, /* verify unsetPrimary */ \
+ EVS_FUZZ_SET_PARAMETER, /* verify setIntParameter */ \
+ EVS_FUZZ_GET_PARAMETER, /* verify getIntParameter */ \
+ EVS_FUZZ_API_SUM
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace evs
+} // namespace automotive
+} // namespace android
+
+#endif // EVS_MANAGER_1_1_TEST_FUZZER_COMMON_H_
diff --git a/evs/manager/1.1/test/fuzzer/HalCameraFuzzer.cpp b/evs/manager/1.1/test/fuzzer/HalCameraFuzzer.cpp
new file mode 100644
index 0000000..4660182
--- /dev/null
+++ b/evs/manager/1.1/test/fuzzer/HalCameraFuzzer.cpp
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fuzzer/FuzzedDataProvider.h>
+#include <iostream>
+#include "Common.h"
+#include "Enumerator.h"
+#include "HalCamera.h"
+#include "MockHWCamera.h"
+
+namespace android {
+namespace automotive {
+namespace evs {
+namespace V1_1 {
+namespace implementation {
+
+namespace {
+
+enum EvsFuzzFuncs {
+ EVS_FUZZ_MAKE_VIRTUAL_CAMERA = 0, // verify makeVirtualCamera
+ EVS_FUZZ_OWN_VIRTUAL_CAMERA, // verify ownVirtualCamera
+ EVS_FUZZ_DISOWN_VIRTUAL_CAMERA, // verify disownVirtualCamera
+ EVS_FUZZ_GET_CLIENT_COUNT, // verify getClientCount
+ EVS_FUZZ_GET_ID, // verify getId
+ EVS_FUZZ_GET_STREAM_CONFIG, // verify getStreamConfig
+ EVS_FUZZ_CHANGE_FRAMES_IN_FLIGHT, // verify changeFramesInFlight
+ EVS_FUZZ_CHANGE_FRAMES_IN_FLIGHT_1, // verify overloaded changeFramesInFlight
+ EVS_FUZZ_REQUEST_NEW_FRAME, // verify requestNewFrame
+ EVS_FUZZ_CLIENT_STREAM_STARTING, // verify clientStreamStarting
+ EVS_FUZZ_CLIENT_STREAM_ENDING, // verify clientStreamEnding
+ EVS_FUZZ_GET_STATS, // verify getStats
+ EVS_FUZZ_GET_STREAM_CONFIGURATION, // verify getStreamConfiguration
+ EVS_FUZZ_DELIVER_FRAME_1_1, // verify deliverFrame_1_1
+ EVS_FUZZ_BASE_ENUM // verify common functions
+};
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ FuzzedDataProvider fdp(data, size);
+ sp<IEvsCamera_1_1> mockHWCamera = new MockHWCamera();
+ sp<HalCamera> halCamera = new HalCamera(mockHWCamera);
+ std::vector<sp<VirtualCamera>> virtualCameras;
+
+ while (fdp.remaining_bytes() > 4) {
+ switch (fdp.ConsumeIntegralInRange<uint32_t>(0, EVS_FUZZ_API_SUM)) {
+ case EVS_FUZZ_MAKE_VIRTUAL_CAMERA: {
+ sp<VirtualCamera> virtualCamera = halCamera->makeVirtualCamera();
+ virtualCameras.emplace_back(virtualCamera);
+ break;
+ }
+ case EVS_FUZZ_OWN_VIRTUAL_CAMERA: {
+ if (!virtualCameras.empty()) {
+ uint32_t whichCam =
+ fdp.ConsumeIntegralInRange<uint32_t>(0, virtualCameras.size() - 1);
+ halCamera->ownVirtualCamera(virtualCameras[whichCam]);
+ }
+ break;
+ }
+ case EVS_FUZZ_DISOWN_VIRTUAL_CAMERA: {
+ if (!virtualCameras.empty()) {
+ uint32_t whichCam =
+ fdp.ConsumeIntegralInRange<uint32_t>(0, virtualCameras.size() - 1);
+ halCamera->disownVirtualCamera(virtualCameras[whichCam]);
+ }
+ break;
+ }
+ case EVS_FUZZ_GET_HW_CAMERA: {
+ halCamera->getHwCamera();
+ break;
+ }
+ case EVS_FUZZ_GET_CLIENT_COUNT: {
+ halCamera->getClientCount();
+ break;
+ }
+ case EVS_FUZZ_GET_ID: {
+ halCamera->getId();
+ break;
+ }
+ case EVS_FUZZ_GET_STREAM_CONFIG: {
+ halCamera->getStreamConfig();
+ break;
+ }
+ case EVS_FUZZ_CHANGE_FRAMES_IN_FLIGHT: {
+ uint32_t delta = fdp.ConsumeIntegral<int32_t>();
+ halCamera->changeFramesInFlight(delta);
+ break;
+ }
+ default:
+ LOG(ERROR) << "Unexpected option, aborting...";
+ break;
+ }
+ }
+ return 0;
+}
+
+} // namespace
+} // namespace implementation
+} // namespace V1_1
+} // namespace evs
+} // namespace automotive
+} // namespace android
diff --git a/evs/manager/1.1/test/fuzzer/MockHWCamera.h b/evs/manager/1.1/test/fuzzer/MockHWCamera.h
new file mode 100644
index 0000000..a4e0638
--- /dev/null
+++ b/evs/manager/1.1/test/fuzzer/MockHWCamera.h
@@ -0,0 +1,109 @@
+// Copyright 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef EVS_MANAGER_1_1_TEST_FUZZER_MOCKHWCAMERA_H_
+#define EVS_MANAGER_1_1_TEST_FUZZER_MOCKHWCAMERA_H_
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+namespace android {
+namespace automotive {
+namespace evs {
+namespace V1_1 {
+namespace implementation {
+
+class MockHWCamera : public IEvsCamera_1_1 {
+public:
+ MockHWCamera() = default;
+
+ // v1.0 methods
+ Return<void> getCameraInfo(getCameraInfo_cb _hidl_cb) override { return {}; }
+ Return<EvsResult> setMaxFramesInFlight(uint32_t bufferCount) override {
+ if (bufferCount > 1024) {
+ return EvsResult::INVALID_ARG;
+ }
+ return EvsResult::OK;
+ }
+ Return<EvsResult> startVideoStream(const ::android::sp<IEvsCameraStream_1_0>& stream) override {
+ return EvsResult::OK;
+ }
+ Return<void> doneWithFrame(const BufferDesc_1_0& buffer) override { return {}; }
+ Return<void> stopVideoStream() override { return {}; }
+ Return<int32_t> getExtendedInfo(uint32_t opaqueIdentifier) override {
+ if (mExtendedInfo.find(opaqueIdentifier) != mExtendedInfo.end()) {
+ return mExtendedInfo[opaqueIdentifier];
+ }
+ return 0;
+ }
+ Return<EvsResult> setExtendedInfo(uint32_t opaqueIdentifier, int32_t opaqueValue) override {
+ mExtendedInfo[opaqueIdentifier] = opaqueValue;
+ return EvsResult::OK;
+ }
+
+ // v1.1 methods
+ Return<void> getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) override { return {}; }
+ MOCK_METHOD(Return<void>, getPhysicalCameraInfo,
+ (const hidl_string& deviceId, getPhysicalCameraInfo_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<EvsResult>, pauseVideoStream, (), (override));
+ MOCK_METHOD(Return<EvsResult>, resumeVideoStream, (), (override));
+ MOCK_METHOD(Return<EvsResult>, doneWithFrame_1_1,
+ (const hardware::hidl_vec<BufferDesc_1_1>& buffer), (override));
+ MOCK_METHOD(Return<EvsResult>, setMaster, (), (override));
+ MOCK_METHOD(Return<EvsResult>, forceMaster, (const sp<IEvsDisplay_1_0>& display), (override));
+ MOCK_METHOD(Return<EvsResult>, unsetMaster, (), (override));
+ Return<void> getParameterList(getParameterList_cb _hidl_cb) override { return {}; }
+ Return<void> getIntParameterRange(CameraParam id, getIntParameterRange_cb _hidl_cb) override {
+ return {};
+ }
+ Return<void> setIntParameter(CameraParam id, int32_t value,
+ setIntParameter_cb _hidl_cb) override {
+ // FIXME in default implementation, it's _hidl_cb(EvsResult::INVALID_ARG, 0); which will
+ // always cause a segfault what's the predefined behavior of _hidl_cb?
+ std::vector<int32_t> vec;
+ vec.push_back(0);
+ _hidl_cb(EvsResult::INVALID_ARG, vec);
+ return {};
+ }
+
+ Return<void> getIntParameter(CameraParam id, getIntParameter_cb _hidl_cb) {
+ _hidl_cb(EvsResult::INVALID_ARG, 0);
+ return {};
+ }
+
+ Return<void> getExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ getExtendedInfo_1_1_cb _hidl_cb) override {
+ return {};
+ }
+ Return<EvsResult> setExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ const hidl_vec<uint8_t>& opaqueValue) override {
+ return EvsResult::OK;
+ }
+ Return<void> importExternalBuffers(const hidl_vec<BufferDesc_1_1>& buffers,
+ importExternalBuffers_cb _hidl_cb) override {
+ return {};
+ }
+
+private:
+ std::map<uint32_t, int32_t> mExtendedInfo;
+ std::map<uint32_t, int32_t> mExtendedInfo_1_1;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace evs
+} // namespace automotive
+} // namespace android
+
+#endif // EVS_MANAGER_1_1_TEST_FUZZER_MOCKHWCAMERA_H_
diff --git a/evs/manager/1.1/test/fuzzer/VirtualCameraFuzzer.cpp b/evs/manager/1.1/test/fuzzer/VirtualCameraFuzzer.cpp
new file mode 100644
index 0000000..3776f4b
--- /dev/null
+++ b/evs/manager/1.1/test/fuzzer/VirtualCameraFuzzer.cpp
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fuzzer/FuzzedDataProvider.h>
+#include <iostream>
+#include "Common.h"
+#include "Enumerator.h"
+#include "MockHWCamera.h"
+#include "VirtualCamera.h"
+
+namespace android {
+namespace automotive {
+namespace evs {
+namespace V1_1 {
+namespace implementation {
+
+namespace {
+
+using CameraDesc_1_0 = ::android::hardware::automotive::evs::V1_0::CameraDesc;
+
+enum EvsFuzzFuncs {
+ EVS_FUZZ_GET_ALLOWED_BUFFERS, // verify getAllowedBuffers
+ EVS_FUZZ_IS_STREAMING, // verify isStreaming
+ EVS_FUZZ_GET_VERSION, // verify getVersion
+ EVS_FUZZ_SET_DESCRIPTOR, // verify setDescriptor
+ EVS_FUZZ_GET_CAMERA_INFO, // verify getCameraInfo
+ EVS_FUZZ_SETMAX_FRAMES_IN_FLIGHT, // verify setMaxFramesInFlight
+ EVS_FUZZ_START_VIDEO_STREAM, // verify startVideoStream
+ EVS_FUZZ_STOP_VIDEO_STREAM, // verify stopVideoStream
+ EVS_FUZZ_GET_EXTENDED_INFO, // verify getExtendedInfo
+ EVS_FUZZ_SET_EXTENDED_INFO, // verify setExtendedInfo
+ EVS_FUZZ_GET_CAMERA_INFO_1_1, // verify getCameraInfo_1_1
+ EVS_FUZZ_GET_PHYSICAL_CAMERA_INFO, // verify getPhysicalCameraInfo
+ EVS_FUZZ_PAUSE_VIDEO_STREAM, // verify pauseVideoStream
+ EVS_FUZZ_RESUME_VIDEO_STREAM, // verify resumeVideoStream
+ EVS_FUZZ_GET_PARAMETER_LIST, // verify getParameterList
+ EVS_FUZZ_GET_INT_PARAMETER_RANGE, // verify getIntParameterRange
+ EVS_FUZZ_SET_EXTENDED_INFO_1_1, // verify setExtendedInfo_1_1
+ EVS_FUZZ_GET_EXTENDED_INFO_1_1, // verify getExtendedInfo_1_1
+ EVS_FUZZ_IMPORT_EXTERNAL_BUFFERS, // verify importExternalBuffers
+ EVS_FUZZ_BASE_ENUM // verify common functions
+};
+
+const int kMaxFuzzerConsumedBytes = 12;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ FuzzedDataProvider fdp(data, size);
+ sp<IEvsCamera_1_1> mockHWCamera = new MockHWCamera();
+ sp<HalCamera> halCamera = new HalCamera(mockHWCamera);
+ sp<VirtualCamera> virtualCamera = halCamera->makeVirtualCamera();
+
+ std::vector<BufferDesc_1_0> vBufferDesc_1_0;
+ std::vector<BufferDesc_1_1> vBufferDesc_1_1;
+
+ bool videoStarted = false;
+
+ while (fdp.remaining_bytes() > kMaxFuzzerConsumedBytes) {
+ switch (fdp.ConsumeIntegralInRange<uint32_t>(0, EVS_FUZZ_API_SUM)) {
+ case EVS_FUZZ_GET_ALLOWED_BUFFERS: {
+ virtualCamera->getAllowedBuffers();
+ break;
+ }
+ case EVS_FUZZ_IS_STREAMING: {
+ virtualCamera->isStreaming();
+ break;
+ }
+ case EVS_FUZZ_GET_VERSION: {
+ virtualCamera->getVersion();
+ break;
+ }
+ case EVS_FUZZ_GET_HW_CAMERA: {
+ virtualCamera->getHalCameras();
+ break;
+ }
+ case EVS_FUZZ_SET_DESCRIPTOR: {
+ CameraDesc* desc = new CameraDesc();
+ virtualCamera->setDescriptor(desc);
+ break;
+ }
+ case EVS_FUZZ_NOTIFY: {
+ if (videoStarted) {
+ EvsEventDesc event;
+ uint32_t type = fdp.ConsumeIntegralInRange<
+ uint32_t>(0, static_cast<uint32_t>(EvsEventType::STREAM_ERROR));
+ event.aType = static_cast<EvsEventType>(type);
+ virtualCamera->notify(event);
+ }
+ break;
+ }
+ case EVS_FUZZ_DELIVER_FRAME: {
+ BufferDesc buffer;
+ buffer.bufferId = fdp.ConsumeIntegral<int32_t>();
+ virtualCamera->deliverFrame(buffer);
+ vBufferDesc_1_1.emplace_back(buffer);
+ break;
+ }
+ case EVS_FUZZ_GET_CAMERA_INFO: {
+ virtualCamera->getCameraInfo([](CameraDesc_1_0 desc) {});
+ break;
+ }
+ case EVS_FUZZ_SETMAX_FRAMES_IN_FLIGHT: {
+ uint32_t delta = fdp.ConsumeIntegral<uint32_t>();
+ virtualCamera->setMaxFramesInFlight(delta);
+ break;
+ }
+ case EVS_FUZZ_START_VIDEO_STREAM: {
+ if (!videoStarted) {
+ sp<IEvsCamera_1_1> mockHWCamera1 = new MockHWCamera();
+ sp<HalCamera> halCamera1 = new HalCamera(mockHWCamera1);
+ virtualCamera->startVideoStream(halCamera1);
+ videoStarted = true;
+ }
+ break;
+ }
+ case EVS_FUZZ_DONE_WITH_FRAME_1_0: {
+ if (!vBufferDesc_1_0.empty()) {
+ uint32_t whichBuffer =
+ fdp.ConsumeIntegralInRange<uint32_t>(0, vBufferDesc_1_0.size() - 1);
+ virtualCamera->doneWithFrame(vBufferDesc_1_0[whichBuffer]);
+ }
+ break;
+ }
+ case EVS_FUZZ_STOP_VIDEO_STREAM: {
+ virtualCamera->stopVideoStream();
+ videoStarted = false;
+ break;
+ }
+ case EVS_FUZZ_GET_EXTENDED_INFO: {
+ uint32_t opaqueIdentifier = fdp.ConsumeIntegral<uint32_t>();
+ virtualCamera->getExtendedInfo(opaqueIdentifier);
+ break;
+ }
+ case EVS_FUZZ_SET_EXTENDED_INFO: {
+ uint32_t opaqueIdentifier = fdp.ConsumeIntegral<uint32_t>();
+ int32_t opaqueValue = fdp.ConsumeIntegral<int32_t>();
+ virtualCamera->setExtendedInfo(opaqueIdentifier, opaqueValue);
+ break;
+ }
+ case EVS_FUZZ_GET_CAMERA_INFO_1_1: {
+ virtualCamera->getCameraInfo_1_1([](CameraDesc desc) {});
+ break;
+ }
+ case EVS_FUZZ_GET_PHYSICAL_CAMERA_INFO: {
+ hidl_string deviceId("");
+ virtualCamera->getPhysicalCameraInfo(deviceId, [](const CameraDesc& info) {});
+ break;
+ }
+ case EVS_FUZZ_DONE_WITH_FRAME_1_1: {
+ if (!vBufferDesc_1_1.empty()) {
+ hidl_vec<BufferDesc_1_1> buffers(vBufferDesc_1_1);
+ virtualCamera->doneWithFrame_1_1(buffers);
+ }
+ break;
+ }
+ case EVS_FUZZ_PAUSE_VIDEO_STREAM: {
+ virtualCamera->pauseVideoStream();
+ break;
+ }
+ case EVS_FUZZ_RESUME_VIDEO_STREAM: {
+ virtualCamera->resumeVideoStream();
+ break;
+ }
+ case EVS_FUZZ_SET_PRIMARY: {
+ virtualCamera->setMaster();
+ break;
+ }
+ case EVS_FUZZ_FORCE_PRIMARY: {
+ // TODO(161388489) skip this until we finished fuzzing evs display
+ break;
+ }
+ case EVS_FUZZ_UNSET_PRIMARY: {
+ virtualCamera->unsetMaster();
+ break;
+ }
+ case EVS_FUZZ_GET_PARAMETER_LIST: {
+ virtualCamera->getParameterList([](hidl_vec<CameraParam> cmdList) {});
+ break;
+ }
+ case EVS_FUZZ_GET_INT_PARAMETER_RANGE: {
+ uint32_t whichParam =
+ fdp.ConsumeIntegralInRange<uint32_t>(0,
+ static_cast<uint32_t>(
+ CameraParam::ABSOLUTE_ZOOM));
+ virtualCamera->getIntParameterRange(static_cast<CameraParam>(whichParam),
+ [](int32_t val0, int32_t val1, int32_t val2) {
+ });
+ break;
+ }
+ case EVS_FUZZ_SET_PARAMETER: {
+ uint32_t whichParam =
+ fdp.ConsumeIntegralInRange<uint32_t>(0,
+ static_cast<uint32_t>(
+ CameraParam::ABSOLUTE_ZOOM));
+ int32_t val = fdp.ConsumeIntegral<int32_t>();
+ virtualCamera->setIntParameter(static_cast<CameraParam>(whichParam), val,
+ [](auto status, auto effectiveValues) {});
+ break;
+ }
+ case EVS_FUZZ_GET_PARAMETER: {
+ uint32_t whichParam =
+ fdp.ConsumeIntegralInRange<uint32_t>(0,
+ static_cast<uint32_t>(
+ CameraParam::ABSOLUTE_ZOOM));
+ virtualCamera->getIntParameter(static_cast<CameraParam>(whichParam),
+ [](auto status, auto effectiveValues) {});
+ break;
+ }
+ case EVS_FUZZ_SET_EXTENDED_INFO_1_1: {
+ uint32_t opaqueIdentifier = fdp.ConsumeIntegral<uint32_t>();
+ uint8_t opaqueValue = fdp.ConsumeIntegral<uint8_t>();
+ vector<uint8_t> v;
+ v.push_back(opaqueValue);
+ hidl_vec<uint8_t> vec(v);
+ virtualCamera->setExtendedInfo_1_1(opaqueIdentifier, vec);
+ break;
+ }
+ case EVS_FUZZ_GET_EXTENDED_INFO_1_1: {
+ uint32_t opaqueIdentifier = fdp.ConsumeIntegral<uint32_t>();
+ virtualCamera->getExtendedInfo_1_1(opaqueIdentifier,
+ [](const auto& result, const auto& data) {});
+ break;
+ }
+ case EVS_FUZZ_IMPORT_EXTERNAL_BUFFERS: {
+ if (!vBufferDesc_1_1.empty()) {
+ hidl_vec<BufferDesc_1_1> buffers(vBufferDesc_1_1);
+ virtualCamera->importExternalBuffers(buffers, [](auto _result, auto _delta) {});
+ }
+ break;
+ }
+ default:
+ LOG(ERROR) << "Unexpected option, aborting...";
+ break;
+ }
+ }
+
+ if (videoStarted) {
+ // TODO(b/161762538) if we do not stop video stream manually here,
+ // there will be crash at VirtualCamera.cpp::pHwCamera->unsetMaster(this);
+ virtualCamera->stopVideoStream();
+ }
+ return 0;
+}
+
+} // namespace
+} // namespace implementation
+} // namespace V1_1
+} // namespace evs
+} // namespace automotive
+} // namespace android
diff --git a/service/src/com/android/car/am/FixedActivityService.java b/service/src/com/android/car/am/FixedActivityService.java
index 38e31d1..19d1f70 100644
--- a/service/src/com/android/car/am/FixedActivityService.java
+++ b/service/src/com/android/car/am/FixedActivityService.java
@@ -17,6 +17,7 @@
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.os.Process.INVALID_UID;
+import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
import static com.android.car.CarLog.TAG_AM;
@@ -444,6 +445,9 @@
}
mBlockingPresentations.append(displayIdForActivity, p);
}
+ // Change the window type, since we can't show the Presentation window
+ // in the internal display.
+ p.getWindow().setType(TYPE_SYSTEM_DIALOG);
p.show();
});
}
diff --git a/service/src/com/android/car/audio/CarAudioService.java b/service/src/com/android/car/audio/CarAudioService.java
index db081eb..bc67085 100644
--- a/service/src/com/android/car/audio/CarAudioService.java
+++ b/service/src/com/android/car/audio/CarAudioService.java
@@ -892,6 +892,10 @@
*
* @param zoneId The audio zone id
* @param uid The uid to map
+ *
+ * <p><b>Note:</b> Will throw if occupant zone mapping exist, as uid and occupant zone mapping
+ * do not work in conjunction.
+ *
* @return true if the device affinities, for devices in zone, are successfully set
*/
@Override
@@ -905,6 +909,9 @@
+ uid + " mapped to : "
+ zoneId);
+ // If occupant mapping exist uid routing can not be used
+ requiredOccupantZoneMappingDisabledLocked();
+
// Figure out if anything is currently holding focus,
// This will change the focus to transient loss while we are switching zones
Integer currentZoneId = mUidToZoneMap.get(uid);
@@ -985,6 +992,10 @@
/**
* Removes the current mapping of the uid, focus will be lost in zone
* @param uid The uid to remove
+ *
+ * <p><b>Note:</b> Will throw if occupant zone mapping exist, as uid and occupant zone mapping
+ * do not work in conjunction.
+ *
* return true if all the devices affinities currently
* mapped to uid are successfully removed
*/
@@ -993,6 +1004,10 @@
enforcePermission(Car.PERMISSION_CAR_CONTROL_AUDIO_SETTINGS);
requireDynamicRouting();
synchronized (mImplLock) {
+ // Throw so as to not set the wrong expectation,
+ // that routing will be changed if clearZoneIdForUid is called.
+ requiredOccupantZoneMappingDisabledLocked();
+
return checkAndRemoveUidLocked(uid);
}
}
@@ -1083,6 +1098,13 @@
Preconditions.checkState(mUseDynamicRouting, "Dynamic routing is required");
}
+ private void requiredOccupantZoneMappingDisabledLocked() {
+ if (isOccupantZoneMappingAvailableLocked()) {
+ throw new IllegalStateException(
+ "UID based routing is not supported while using occupant zone mapping");
+ }
+ }
+
/**
* @return {@link AudioDevicePort} that handles the given car audio usage.
* Multiple usages may share one {@link AudioDevicePort}
@@ -1123,7 +1145,7 @@
private void handleOccupantZoneUserChanged() {
int driverUserId = mOccupantZoneService.getDriverUserId();
synchronized (mImplLock) {
- if (!isOccupantZoneMappingAvailable()) {
+ if (!isOccupantZoneMappingAvailableLocked()) {
//No occupant zone to audio zone mapping, re-adjust to settings driver.
for (int index = 0; index < mCarAudioZones.length; index++) {
CarAudioZone zone = mCarAudioZones[index];
@@ -1142,7 +1164,7 @@
}
}
- private boolean isOccupantZoneMappingAvailable() {
+ private boolean isOccupantZoneMappingAvailableLocked() {
return mAudioZoneIdToOccupantZoneIdMapping.size() > 0;
}
diff --git a/tests/CarSecurityPermissionTest/Android.bp b/tests/CarSecurityPermissionTest/Android.bp
index 066ecc8..7be1d0b 100644
--- a/tests/CarSecurityPermissionTest/Android.bp
+++ b/tests/CarSecurityPermissionTest/Android.bp
@@ -21,6 +21,7 @@
libs: [
"android.car",
+ "android.hardware.automotive.vehicle-V2.0-java",
"android.test.runner",
"android.test.base",
"android.test.mock",
diff --git a/tests/EmbeddedKitchenSinkApp/res/layout/window_insets_fragment.xml b/tests/EmbeddedKitchenSinkApp/res/layout/window_insets_fragment.xml
new file mode 100644
index 0000000..5533668
--- /dev/null
+++ b/tests/EmbeddedKitchenSinkApp/res/layout/window_insets_fragment.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<ScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fadeScrollbars="false">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Control Status Bar Insets"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/show_status_bar_insets"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Show Status Bar Insets"
+ android:textSize="30sp"/>
+
+ <Button
+ android:id="@+id/hide_status_bar_insets"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Hide Status Bar Insets"
+ android:textSize="30sp"/>
+
+ </LinearLayout>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Control Navigation Bar Insets"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/show_nav_bar_insets"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Show Navigation Bar Insets"
+ android:textSize="30sp"/>
+
+ <Button
+ android:id="@+id/hide_nav_bar_insets"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Hide Navigation Bar Insets"
+ android:textSize="30sp"/>
+
+ </LinearLayout>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Control System Bar Insets (both Status and Navigation)"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/show_system_bar_insets"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Show System Bar Insets"
+ android:textSize="30sp"/>
+
+ <Button
+ android:id="@+id/hide_system_bar_insets"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Hide System Bar Insets"
+ android:textSize="30sp"/>
+
+ </LinearLayout>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Set System Bar Behavior"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/show_bars_by_touch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Show By Touch"
+ android:textSize="30sp"/>
+
+ <Button
+ android:id="@+id/show_bars_by_swipe"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Show By Swipe"
+ android:textSize="30sp"/>
+
+ <Button
+ android:id="@+id/show_transient_bars_by_swipe"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:text="Show Transient By Swipe"
+ android:textSize="30sp"/>
+
+ </LinearLayout>
+
+ </LinearLayout>
+</ScrollView>
\ No newline at end of file
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
index 20dd9fc..e883501 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
@@ -56,6 +56,7 @@
import com.google.android.car.kitchensink.displayinfo.DisplayInfoFragment;
import com.google.android.car.kitchensink.experimental.ExperimentalFeatureTestFragment;
import com.google.android.car.kitchensink.hvac.HvacTestFragment;
+import com.google.android.car.kitchensink.insets.WindowInsetsFragment;
import com.google.android.car.kitchensink.notification.NotificationFragment;
import com.google.android.car.kitchensink.orientation.OrientationTestFragment;
import com.google.android.car.kitchensink.packageinfo.PackageInfoFragment;
@@ -198,7 +199,8 @@
new FragmentMenuEntry("vehicle ctrl", VehicleCtrlFragment.class),
new FragmentMenuEntry("vehicle hal", VehicleHalFragment.class),
new FragmentMenuEntry("volume test", VolumeTestFragment.class),
- new FragmentMenuEntry("web links", WebLinksTestFragment.class));
+ new FragmentMenuEntry("web links", WebLinksTestFragment.class),
+ new FragmentMenuEntry("window insets", WindowInsetsFragment.class));
private Car mCarApi;
private CarHvacManager mHvacManager;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/insets/WindowInsetsFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/insets/WindowInsetsFragment.java
new file mode 100644
index 0000000..f4d52cf
--- /dev/null
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/insets/WindowInsetsFragment.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.android.car.kitchensink.insets;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowInsets;
+import android.view.WindowInsetsController;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+import com.google.android.car.kitchensink.R;
+
+/** Test fragment for controlling window insets. */
+public final class WindowInsetsFragment extends Fragment {
+
+ private WindowInsetsController mWindowInsetsController;
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.window_insets_fragment, container,
+ /* attachToRoot= */ false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ mWindowInsetsController = view.getWindowInsetsController();
+ initStatusBarInsetsButtons(view);
+ initNavigationBarInsetsButtons(view);
+ initSystemBarInsetsButtons(view);
+ initSystemBarBehaviorButtons(view);
+ }
+
+ private void initStatusBarInsetsButtons(View view) {
+ view.findViewById(R.id.show_status_bar_insets).setOnClickListener(
+ v -> mWindowInsetsController.show(WindowInsets.Type.statusBars()));
+ view.findViewById(R.id.hide_status_bar_insets).setOnClickListener(
+ v -> mWindowInsetsController.hide(WindowInsets.Type.statusBars()));
+ }
+
+ private void initNavigationBarInsetsButtons(View view) {
+ view.findViewById(R.id.show_nav_bar_insets).setOnClickListener(
+ v -> mWindowInsetsController.show(WindowInsets.Type.navigationBars()));
+ view.findViewById(R.id.hide_nav_bar_insets).setOnClickListener(
+ v -> mWindowInsetsController.hide(WindowInsets.Type.navigationBars()));
+ }
+
+ private void initSystemBarInsetsButtons(View view) {
+ view.findViewById(R.id.show_system_bar_insets).setOnClickListener(
+ v -> mWindowInsetsController.show(WindowInsets.Type.systemBars()));
+ view.findViewById(R.id.hide_system_bar_insets).setOnClickListener(
+ v -> mWindowInsetsController.hide(WindowInsets.Type.systemBars()));
+ }
+
+ private void initSystemBarBehaviorButtons(View view) {
+ view.findViewById(R.id.show_bars_by_touch).setOnClickListener(
+ v -> mWindowInsetsController.setSystemBarsBehavior(
+ WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_TOUCH));
+ view.findViewById(R.id.show_bars_by_swipe).setOnClickListener(
+ v -> mWindowInsetsController.setSystemBarsBehavior(
+ WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE));
+ view.findViewById(R.id.show_transient_bars_by_swipe).setOnClickListener(
+ v -> mWindowInsetsController.setSystemBarsBehavior(
+ WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE));
+ }
+}
diff --git a/user/car-user-lib/Android.bp b/user/car-user-lib/Android.bp
index 12bc950..940751a 100644
--- a/user/car-user-lib/Android.bp
+++ b/user/car-user-lib/Android.bp
@@ -17,9 +17,11 @@
srcs: [
"src/**/*.java",
],
+ libs: [
+ "android.hardware.automotive.vehicle-V2.0-java",
+ ],
static_libs: [
"android.car.settings",
- "android.hardware.automotive.vehicle-V2.0-java",
],
product_variables: {
pdk: {