Merge Android U (ab/10368041)
Bug: 291102124 Merged-In: I5af16ad9e32a62b0b4209cf9b810df1dbcb71ce4 Change-Id: I00dca12f8f3d2a0aab52035350b50f3c74efbdce
This commit is contained in:
commit
879ac86ee6
382 changed files with 19781 additions and 9 deletions
8
OWNERS
8
OWNERS
|
@ -13,10 +13,4 @@ pattjin@google.com
|
|||
bkhalife@google.com
|
||||
lokeshgoel@google.com
|
||||
jainne@google.com
|
||||
pscovanner@google.com
|
||||
|
||||
per-file *.te=file://sepolicy/OWNERS
|
||||
per-file *_contexts=file://sepolicy/OWNERS
|
||||
per-file te_macros=file://sepolicy/OWNERS
|
||||
per-file global_macros=file://sepolicy/OWNERS
|
||||
|
||||
pscovanner@google.com
|
19
aoc/Android.bp
Normal file
19
aoc/Android.bp
Normal file
|
@ -0,0 +1,19 @@
|
|||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "dump_aoc",
|
||||
srcs: ["dump_aoc.cpp"],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libdump",
|
||||
],
|
||||
vendor: true,
|
||||
relative_install_path: "dump",
|
||||
}
|
26
aoc/aoc.mk
Normal file
26
aoc/aoc.mk
Normal file
|
@ -0,0 +1,26 @@
|
|||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/aoc/sepolicy
|
||||
|
||||
PRODUCT_PACKAGES += dump_aoc \
|
||||
aocd
|
||||
|
||||
ifeq (,$(filter aosp_%,$(TARGET_PRODUCT)))
|
||||
# IAudioMetricExt HIDL
|
||||
PRODUCT_PACKAGES += \
|
||||
vendor.google.audiometricext@1.0-service-vendor
|
||||
endif
|
||||
|
||||
# If AoC Daemon is not present on this build, load firmware at boot via rc
|
||||
ifeq ($(wildcard vendor/google/whitechapel/aoc/aocd),)
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/google/gs-common/aoc/conf/init.aoc.nodaemon.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.aoc.rc
|
||||
else
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/google/gs-common/aoc/conf/init.aoc.daemon.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.aoc.rc
|
||||
endif
|
||||
|
||||
# AoC debug support
|
||||
PRODUCT_PACKAGES_DEBUG += \
|
||||
aocdump \
|
||||
aocutil \
|
||||
aoc_audio_cfg \
|
||||
vp_util
|
1
aoc/conf/init.aoc.daemon.rc
Normal file
1
aoc/conf/init.aoc.daemon.rc
Normal file
|
@ -0,0 +1 @@
|
|||
# AoC firmware will be loaded by Daemon
|
3
aoc/conf/init.aoc.nodaemon.rc
Normal file
3
aoc/conf/init.aoc.nodaemon.rc
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Load AoC firmware and boot
|
||||
on property:vendor.all.modules.ready=1
|
||||
write /sys/devices/platform/19000000.aoc/firmware aoc.bin
|
40
aoc/dump_aoc.cpp
Normal file
40
aoc/dump_aoc.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2022 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 <stdio.h>
|
||||
#include <dump/pixel_dump.h>
|
||||
|
||||
// Dump Aoc.
|
||||
int main() {
|
||||
setbuf(stdout, NULL);
|
||||
dumpFileContent("AoC Service Status", "/sys/devices/platform/19000000.aoc/services");
|
||||
dumpFileContent("AoC Restarts", "/sys/devices/platform/19000000.aoc/restart_count");
|
||||
dumpFileContent("AoC Coredumps", "/sys/devices/platform/19000000.aoc/coredump_count");
|
||||
dumpFileContent("AoC ring buf wake", "/sys/devices/platform/19000000.aoc/control/ring_buffer_wakeup");
|
||||
dumpFileContent("AoC host ipc wake", "/sys/devices/platform/19000000.aoc/control/host_ipc_wakeup");
|
||||
dumpFileContent("AoC usf wake", "/sys/devices/platform/19000000.aoc/control/usf_wakeup");
|
||||
dumpFileContent("AoC audio wake", "/sys/devices/platform/19000000.aoc/control/audio_wakeup");
|
||||
dumpFileContent("AoC logging wake", "/sys/devices/platform/19000000.aoc/control/logging_wakeup");
|
||||
dumpFileContent("AoC hotword wake", "/sys/devices/platform/19000000.aoc/control/hotword_wakeup");
|
||||
dumpFileContent("AoC memory exception wake", "/sys/devices/platform/19000000.aoc/control/memory_exception");
|
||||
dumpFileContent("AoC memory votes", "/sys/devices/platform/19000000.aoc/control/memory_votes_a32");
|
||||
dumpFileContent("AoC memory votes", "/sys/devices/platform/19000000.aoc/control/memory_votes_ff1");
|
||||
runCommand("clean AoC buffer","echo ' ' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
|
||||
runCommand("AoC Heap Stats (A32)", "echo 'dbg heap -c 1' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
|
||||
runCommand("AoC Heap Stats (F1)", "echo 'dbg heap -c 2' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
|
||||
runCommand("AoC Heap Stats (HF0)", "echo 'dbg heap -c 3' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
|
||||
runCommand("AoC Heap Stats (HF1)", "echo 'dbg heap -c 4' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
|
||||
return 0;
|
||||
}
|
21
aoc/sepolicy/aocd.te
Normal file
21
aoc/sepolicy/aocd.te
Normal file
|
@ -0,0 +1,21 @@
|
|||
type aocd, domain;
|
||||
type aocd_exec, vendor_file_type, exec_type, file_type;
|
||||
init_daemon_domain(aocd)
|
||||
|
||||
# access persist files
|
||||
allow aocd mnt_vendor_file:dir search;
|
||||
allow aocd persist_file:dir search;
|
||||
r_dir_file(aocd, persist_aoc_file);
|
||||
|
||||
# sysfs operations
|
||||
allow aocd sysfs_aoc:dir search;
|
||||
allow aocd sysfs_aoc_firmware:file w_file_perms;
|
||||
|
||||
# dev operations
|
||||
allow aocd aoc_device:chr_file rw_file_perms;
|
||||
|
||||
# allow inotify to watch for additions/removals from /dev
|
||||
allow aocd device:dir r_dir_perms;
|
||||
|
||||
# set properties
|
||||
set_prop(aocd, vendor_aoc_prop)
|
18
aoc/sepolicy/aocdump.te
Normal file
18
aoc/sepolicy/aocdump.te
Normal file
|
@ -0,0 +1,18 @@
|
|||
type aocdump, domain;
|
||||
type aocdump_exec, vendor_file_type, exec_type, file_type;
|
||||
init_daemon_domain(aocdump)
|
||||
|
||||
userdebug_or_eng(`
|
||||
# Permit communication with AoC
|
||||
allow aocdump aoc_device:chr_file rw_file_perms;
|
||||
|
||||
allow aocdump radio_vendor_data_file:dir rw_dir_perms;
|
||||
allow aocdump radio_vendor_data_file:file create_file_perms;
|
||||
allow aocdump wifi_logging_data_file:dir create_dir_perms;
|
||||
allow aocdump wifi_logging_data_file:file create_file_perms;
|
||||
set_prop(aocdump, vendor_audio_prop);
|
||||
r_dir_file(aocdump, proc_asound)
|
||||
|
||||
allow aocdump self:unix_stream_socket create_stream_socket_perms;
|
||||
allow aocdump audio_vendor_data_file:sock_file { create unlink };
|
||||
')
|
3
aoc/sepolicy/device.te
Normal file
3
aoc/sepolicy/device.te
Normal file
|
@ -0,0 +1,3 @@
|
|||
# AOC device
|
||||
type aoc_device, dev_type;
|
||||
|
7
aoc/sepolicy/dump_aoc.te
Normal file
7
aoc/sepolicy/dump_aoc.te
Normal file
|
@ -0,0 +1,7 @@
|
|||
pixel_bugreport(dump_aoc)
|
||||
allow dump_aoc sysfs_aoc:dir search;
|
||||
allow dump_aoc sysfs_aoc_dumpstate:file r_file_perms;
|
||||
allow dump_aoc aoc_device:chr_file rw_file_perms;
|
||||
allow dump_aoc vendor_shell_exec:file execute_no_trans;
|
||||
allow dump_aoc vendor_toolbox_exec:file execute_no_trans;
|
||||
|
12
aoc/sepolicy/file.te
Normal file
12
aoc/sepolicy/file.te
Normal file
|
@ -0,0 +1,12 @@
|
|||
# sysfs
|
||||
type sysfs_aoc_dumpstate, sysfs_type, fs_type;
|
||||
type sysfs_aoc_boottime, sysfs_type, fs_type;
|
||||
type sysfs_aoc_firmware, sysfs_type, fs_type;
|
||||
type sysfs_aoc, sysfs_type, fs_type;
|
||||
type sysfs_aoc_reset, sysfs_type, fs_type;
|
||||
|
||||
# persist
|
||||
type persist_aoc_file, file_type, vendor_persist_type;
|
||||
|
||||
# vendor
|
||||
type aoc_audio_file, file_type, vendor_file_type;
|
37
aoc/sepolicy/file_contexts
Normal file
37
aoc/sepolicy/file_contexts
Normal file
|
@ -0,0 +1,37 @@
|
|||
# AoC devices
|
||||
/dev/acd-audio_output_tuning u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_bulk_tx u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_bulk_rx u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_input_tuning u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_input_bulk_tx u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_input_bulk_rx u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_rtp_tx u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_rtp_rx u:object_r:aoc_device:s0
|
||||
/dev/acd-sound_trigger u:object_r:aoc_device:s0
|
||||
/dev/acd-hotword_notification u:object_r:aoc_device:s0
|
||||
/dev/acd-hotword_pcm u:object_r:aoc_device:s0
|
||||
/dev/acd-ambient_pcm u:object_r:aoc_device:s0
|
||||
/dev/acd-model_data u:object_r:aoc_device:s0
|
||||
/dev/acd-debug u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_tap[0-9]* u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_dcdoff_ref u:object_r:aoc_device:s0
|
||||
/dev/acd-com.google.umfw_stat u:object_r:aoc_device:s0
|
||||
/dev/acd-com.google.usf u:object_r:aoc_device:s0
|
||||
/dev/acd-com.google.usf.non_wake_up u:object_r:aoc_device:s0
|
||||
/dev/acd-logging u:object_r:aoc_device:s0
|
||||
/dev/aoc u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_ap_offload_rx u:object_r:aoc_device:s0
|
||||
/dev/acd-audio_ap_offload_tx u:object_r:aoc_device:s0
|
||||
/dev/acd-mel_processor u:object_r:aoc_device:s0
|
||||
|
||||
# AoC vendor binaries
|
||||
/vendor/bin/aocd u:object_r:aocd_exec:s0
|
||||
/vendor/bin/aocdump u:object_r:aocdump_exec:s0
|
||||
/vendor/bin/dump/dump_aoc u:object_r:dump_aoc_exec:s0
|
||||
|
||||
# AoC audio files
|
||||
/vendor/etc/aoc(/.*)? u:object_r:aoc_audio_file:s0
|
||||
|
||||
# Aoc persist files
|
||||
/mnt/vendor/persist/aoc(/.*)? u:object_r:persist_aoc_file:s0
|
||||
|
2
aoc/sepolicy/property.te
Normal file
2
aoc/sepolicy/property.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# AoC
|
||||
vendor_internal_prop(vendor_aoc_prop)
|
2
aoc/sepolicy/property_contexts
Normal file
2
aoc/sepolicy/property_contexts
Normal file
|
@ -0,0 +1,2 @@
|
|||
# AoC
|
||||
vendor.aoc.firmware.version u:object_r:vendor_aoc_prop:s0
|
25
audio/aidl.mk
Normal file
25
audio/aidl.mk
Normal file
|
@ -0,0 +1,25 @@
|
|||
DEVICE_MANIFEST_FILE += device/google/gs-common/audio/aidl/manifest.xml
|
||||
|
||||
# Audio HALs
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.audio.service-aidl.aoc
|
||||
|
||||
# AIDL software effects. These are the effects supporting in all projects.
|
||||
# For the project-specific effects, such as haptic generator, please add them
|
||||
# to makefile in the project's device folder.
|
||||
PRODUCT_PACKAGES += \
|
||||
libvisualizeraidl \
|
||||
libbundleaidl \
|
||||
libreverbaidl \
|
||||
libdynamicsprocessingaidl \
|
||||
libloudnessenhanceraidl \
|
||||
libdownmixaidl \
|
||||
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/aidl
|
||||
|
||||
include device/google/gs-common/audio/common.mk
|
||||
|
||||
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/audio/aidl/device_framework_matrix_product.xml
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
vendor.audio_hal.aidl.enable=true
|
10
audio/aidl/device_framework_matrix_product.xml
Normal file
10
audio/aidl/device_framework_matrix_product.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<compatibility-matrix version="1.0" type="framework" level="7">
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.audiometricext</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IAudioMetricExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
11
audio/aidl/manifest.xml
Normal file
11
audio/aidl/manifest.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<manifest version="1.0" type="device" target-level="7">
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.audiometricext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IAudioMetricExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
25
audio/common.mk
Normal file
25
audio/common.mk
Normal file
|
@ -0,0 +1,25 @@
|
|||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/common
|
||||
|
||||
#Audio Vendor libraries
|
||||
PRODUCT_PACKAGES += \
|
||||
libfvsam_prm_parser \
|
||||
libmahalcontroller \
|
||||
libAlgFx_HiFi3z
|
||||
|
||||
## AudioHAL Configurations
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_audio_policy_configuration_7_0.xml \
|
||||
frameworks/av/services/audiopolicy/config/a2dp_in_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_in_audio_policy_configuration_7_0.xml \
|
||||
frameworks/av/services/audiopolicy/config/hearing_aid_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/hearing_aid_audio_policy_configuration_7_0.xml \
|
||||
frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
|
||||
frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/usb_audio_policy_configuration.xml \
|
||||
frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
|
||||
frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
|
||||
frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_audio_policy_configuration_7_0.xml
|
||||
|
||||
## TODO(b/271958194): separate for hidl and aidl.
|
||||
PRODUCT_SOONG_NAMESPACES += \
|
||||
vendor/google/whitechapel/audio/hal \
|
||||
vendor/google/whitechapel/audio/interfaces
|
||||
|
||||
$(call soong_config_set,aoc_audio_board,platform,$(TARGET_BOARD_PLATFORM))
|
18
audio/hidl/device_framework_matrix_product.xml
Normal file
18
audio/hidl/device_framework_matrix_product.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<compatibility-matrix version="1.0" type="framework" level="7">
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.whitechapel.audio.audioext</name>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IAudioExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.audiometricext</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IAudioMetricExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
18
audio/hidl/device_framework_matrix_product_gs101.xml
Normal file
18
audio/hidl/device_framework_matrix_product_gs101.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<compatibility-matrix version="1.0" type="framework" level="6">
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.whitechapel.audio.audioext</name>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IAudioExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.audiometricext</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IAudioMetricExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
47
audio/hidl/manifest.xml
Normal file
47
audio/hidl/manifest.xml
Normal file
|
@ -0,0 +1,47 @@
|
|||
<manifest version="1.0" type="device" target-level="7">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio.effect</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.0</version>
|
||||
<interface>
|
||||
<name>IEffectsFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.soundtrigger</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.3</version>
|
||||
<interface>
|
||||
<name>ISoundTriggerHw</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.whitechapel.audio.audioext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IAudioExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.audiometricext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IAudioMetricExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
47
audio/hidl/manifest_gs101.xml
Normal file
47
audio/hidl/manifest_gs101.xml
Normal file
|
@ -0,0 +1,47 @@
|
|||
<manifest version="1.0" type="device" target-level="6">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio.effect</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.0</version>
|
||||
<interface>
|
||||
<name>IEffectsFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.soundtrigger</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.3</version>
|
||||
<interface>
|
||||
<name>ISoundTriggerHw</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.whitechapel.audio.audioext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IAudioExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.audiometricext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IAudioMetricExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
47
audio/hidl/manifest_gs101_64.xml
Normal file
47
audio/hidl/manifest_gs101_64.xml
Normal file
|
@ -0,0 +1,47 @@
|
|||
<manifest version="1.0" type="device" target-level="5">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio.effect</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.0</version>
|
||||
<interface>
|
||||
<name>IEffectsFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.soundtrigger</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.3</version>
|
||||
<interface>
|
||||
<name>ISoundTriggerHw</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.whitechapel.audio.audioext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IAudioExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.google.audiometricext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IAudioMetricExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
39
audio/hidl_gs101.mk
Normal file
39
audio/hidl_gs101.mk
Normal file
|
@ -0,0 +1,39 @@
|
|||
DEVICE_MANIFEST_FILE += device/google/gs-common/audio/hidl/manifest_gs101$(LOCAL_64ONLY).xml
|
||||
|
||||
# Audio HAL Server & Default Implementations
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.audio.service \
|
||||
android.hardware.audio@7.1-impl \
|
||||
android.hardware.audio.effect@7.0-impl \
|
||||
android.hardware.bluetooth.audio-impl \
|
||||
android.hardware.soundtrigger@2.3-impl \
|
||||
vendor.google.whitechapel.audio.audioext@4.0-impl
|
||||
|
||||
#Audio HAL libraries
|
||||
PRODUCT_PACKAGES += \
|
||||
audio.primary.$(TARGET_BOARD_PLATFORM) \
|
||||
audio.platform.aoc \
|
||||
sound_trigger.primary.$(TARGET_BOARD_PLATFORM) \
|
||||
audio_bt_aoc \
|
||||
audio_tunnel_aoc \
|
||||
aoc_aud_ext \
|
||||
libaoctuningdecoder \
|
||||
libaoc_waves \
|
||||
liboffloadeffect \
|
||||
audio_waves_aoc \
|
||||
audio_fortemedia_aoc \
|
||||
audio_bluenote_aoc \
|
||||
audio_usb_aoc \
|
||||
audio_spk_35l41 \
|
||||
audio.usb.default \
|
||||
audio.usbv2.default \
|
||||
audio.bluetooth.default \
|
||||
audio.r_submix.default \
|
||||
libamcsextfile \
|
||||
audio_amcs_ext \
|
||||
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hidl
|
||||
|
||||
include device/google/gs-common/audio/common.mk
|
||||
|
||||
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/audio/hidl/device_framework_matrix_product_gs101.xml
|
39
audio/hidl_gs201.mk
Normal file
39
audio/hidl_gs201.mk
Normal file
|
@ -0,0 +1,39 @@
|
|||
DEVICE_MANIFEST_FILE += device/google/gs-common/audio/hidl/manifest.xml
|
||||
|
||||
# Audio HAL Server & Default Implementations
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.audio.service \
|
||||
android.hardware.audio@7.1-impl \
|
||||
android.hardware.audio.effect@7.0-impl \
|
||||
android.hardware.soundtrigger@2.3-impl \
|
||||
vendor.google.whitechapel.audio.audioext@4.0-impl \
|
||||
android.hardware.bluetooth.audio-impl \
|
||||
|
||||
#Audio HAL libraries
|
||||
PRODUCT_PACKAGES += \
|
||||
audio.primary.$(TARGET_BOARD_PLATFORM) \
|
||||
audio.platform.aoc \
|
||||
audio_tunnel_aoc \
|
||||
aoc_aud_ext \
|
||||
libaoctuningdecoder \
|
||||
liboffloadeffect \
|
||||
audio_bt_aoc \
|
||||
audio_waves_aoc \
|
||||
audio_fortemedia_aoc \
|
||||
audio_bluenote_aoc \
|
||||
audio_usb_aoc \
|
||||
audio_cca_aoc \
|
||||
libamcsextfile \
|
||||
audio_amcs_ext \
|
||||
audio.usb.default \
|
||||
audio.usbv2.default \
|
||||
audio.bluetooth.default \
|
||||
audio.r_submix.default \
|
||||
audio_spk_35l41 \
|
||||
sound_trigger.primary.$(TARGET_BOARD_PLATFORM)
|
||||
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hidl
|
||||
|
||||
include device/google/gs-common/audio/common.mk
|
||||
|
||||
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/audio/hidl/device_framework_matrix_product.xml
|
38
audio/hidl_zuma.mk
Normal file
38
audio/hidl_zuma.mk
Normal file
|
@ -0,0 +1,38 @@
|
|||
DEVICE_MANIFEST_FILE += device/google/gs-common/audio/hidl/manifest.xml
|
||||
|
||||
# Audio HAL Server & Default Implementations
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.audio.service \
|
||||
android.hardware.audio@7.1-impl \
|
||||
android.hardware.audio.effect@7.0-impl \
|
||||
android.hardware.soundtrigger@2.3-impl \
|
||||
vendor.google.whitechapel.audio.audioext@4.0-impl \
|
||||
android.hardware.bluetooth.audio-impl \
|
||||
|
||||
#Audio HAL libraries
|
||||
PRODUCT_PACKAGES += \
|
||||
audio.primary.$(TARGET_BOARD_PLATFORM) \
|
||||
audio.platform.aoc \
|
||||
audio_tunnel_aoc \
|
||||
aoc_aud_ext \
|
||||
libaoctuningdecoder \
|
||||
liboffloadeffect \
|
||||
audio_bt_aoc \
|
||||
audio_waves_aoc \
|
||||
audio_fortemedia_aoc \
|
||||
audio_bluenote_aoc \
|
||||
audio_usb_aoc \
|
||||
libamcsextfile \
|
||||
audio_amcs_ext \
|
||||
audio.usb.default \
|
||||
audio.usbv2.default \
|
||||
audio.bluetooth.default \
|
||||
audio.r_submix.default \
|
||||
audio_spk_35l41 \
|
||||
sound_trigger.primary.$(TARGET_BOARD_PLATFORM)
|
||||
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hidl
|
||||
|
||||
include device/google/gs-common/audio/common.mk
|
||||
|
||||
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/audio/hidl/device_framework_matrix_product.xml
|
2
audio/sepolicy/aidl/file_contexts
Normal file
2
audio/sepolicy/aidl/file_contexts
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Audio Hal AIDL Service for Aoc
|
||||
/vendor/bin/hw/android\.hardware\.audio\.service-aidl\.aoc u:object_r:hal_audio_default_exec:s0
|
1
audio/sepolicy/aidl/hal_audio_default.te
Normal file
1
audio/sepolicy/aidl/hal_audio_default.te
Normal file
|
@ -0,0 +1 @@
|
|||
add_service(hal_audio_default, hal_audio_ext_service)
|
1
audio/sepolicy/aidl/rild.te
Normal file
1
audio/sepolicy/aidl/rild.te
Normal file
|
@ -0,0 +1 @@
|
|||
allow rild hal_audio_ext_service:service_manager find;
|
2
audio/sepolicy/aidl/service.te
Normal file
2
audio/sepolicy/aidl/service.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Audio
|
||||
type hal_audio_ext_service, service_manager_type;
|
2
audio/sepolicy/aidl/service_contexts
Normal file
2
audio/sepolicy/aidl/service_contexts
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Audio
|
||||
vendor.google.whitechapel.audio.extension.IAudioExtension/default u:object_r:hal_audio_ext_service:s0
|
2
audio/sepolicy/common/device.te
Normal file
2
audio/sepolicy/common/device.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# AMCS device
|
||||
type amcs_device, dev_type;
|
5
audio/sepolicy/common/file.te
Normal file
5
audio/sepolicy/common/file.te
Normal file
|
@ -0,0 +1,5 @@
|
|||
# persist
|
||||
type persist_audio_file, file_type, vendor_persist_type;
|
||||
|
||||
# data
|
||||
type audio_vendor_data_file, file_type, data_file_type;
|
11
audio/sepolicy/common/file_contexts
Normal file
11
audio/sepolicy/common/file_contexts
Normal file
|
@ -0,0 +1,11 @@
|
|||
# AMCS devices
|
||||
/dev/amcs u:object_r:amcs_device:s0
|
||||
|
||||
# AMCS vendor service
|
||||
/vendor/bin/hw/vendor\.google\.audiometricext@1\.0-service-vendor u:object_r:hal_audiometricext_default_exec:s0
|
||||
|
||||
# Audio data files
|
||||
/data/vendor/audio(/.*)? u:object_r:audio_vendor_data_file:s0
|
||||
|
||||
# Audio presist file
|
||||
/mnt/vendor/persist/audio(/.*)? u:object_r:persist_audio_file:s0
|
13
audio/sepolicy/common/genfs_contexts
Normal file
13
audio/sepolicy/common/genfs_contexts
Normal file
|
@ -0,0 +1,13 @@
|
|||
# pixelstat_vendor
|
||||
genfscon sysfs /devices/platform/audiometrics/codec_state u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/hs_codec_state u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/speaker_impedance u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/speaker_excursion u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/speaker_heartbeat u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/speaker_temp u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/mic_broken_degrade u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/codec_crashed_counter u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/hwinfo_part_number u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/ams_rate_read_once u:object_r:sysfs_pixelstats:s0
|
||||
genfscon sysfs /devices/platform/audiometrics/cca_rate_read_once u:object_r:sysfs_pixelstats:s0
|
||||
|
30
audio/sepolicy/common/hal_audio_default.te
Normal file
30
audio/sepolicy/common/hal_audio_default.te
Normal file
|
@ -0,0 +1,30 @@
|
|||
allow hal_audio_default audio_vendor_data_file:dir rw_dir_perms;
|
||||
allow hal_audio_default audio_vendor_data_file:file create_file_perms;
|
||||
|
||||
r_dir_file(hal_audio_default, aoc_audio_file);
|
||||
r_dir_file(hal_audio_default, mnt_vendor_file);
|
||||
r_dir_file(hal_audio_default, persist_audio_file);
|
||||
|
||||
allow hal_audio_default persist_file:dir search;
|
||||
allow hal_audio_default aoc_device:file rw_file_perms;
|
||||
allow hal_audio_default aoc_device:chr_file rw_file_perms;
|
||||
|
||||
allow hal_audio_default amcs_device:file rw_file_perms;
|
||||
allow hal_audio_default amcs_device:chr_file rw_file_perms;
|
||||
allow hal_audio_default sysfs_pixelstats:file rw_file_perms;
|
||||
|
||||
#allow access to DMABUF Heaps for AAudio API
|
||||
allow hal_audio_default dmabuf_heap_device:chr_file r_file_perms;
|
||||
|
||||
set_prop(hal_audio_default, vendor_audio_prop);
|
||||
|
||||
hal_client_domain(hal_audio_default, hal_health);
|
||||
hal_client_domain(hal_audio_default, hal_thermal);
|
||||
allow hal_audio_default fwk_sensor_hwservice:hwservice_manager find;
|
||||
|
||||
userdebug_or_eng(`
|
||||
allow hal_audio_default self:unix_stream_socket create_stream_socket_perms;
|
||||
allow hal_audio_default audio_vendor_data_file:sock_file { create unlink };
|
||||
')
|
||||
|
||||
wakelock_use(hal_audio_default);
|
12
audio/sepolicy/common/hal_audiometricext_default.te
Normal file
12
audio/sepolicy/common/hal_audiometricext_default.te
Normal file
|
@ -0,0 +1,12 @@
|
|||
type hal_audiometricext_default, domain;
|
||||
type hal_audiometricext_default_exec, vendor_file_type, exec_type, file_type;
|
||||
init_daemon_domain(hal_audiometricext_default)
|
||||
|
||||
allow hal_audiometricext_default amcs_device:chr_file rw_file_perms;
|
||||
allow hal_audiometricext_default sysfs_pixelstats:file rw_file_perms;
|
||||
|
||||
get_prop(hal_audiometricext_default, vendor_audio_prop);
|
||||
get_prop(hal_audiometricext_default, hwservicemanager_prop);
|
||||
|
||||
hwbinder_use(hal_audiometricext_default);
|
||||
add_hwservice(hal_audiometricext_default, hal_audiometricext_hwservice);
|
2
audio/sepolicy/common/hwservice.te
Normal file
2
audio/sepolicy/common/hwservice.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# AudioMetric
|
||||
type hal_audiometricext_hwservice, hwservice_manager_type;
|
3
audio/sepolicy/common/hwservice_contexts
Normal file
3
audio/sepolicy/common/hwservice_contexts
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Audio
|
||||
vendor.google.audiometricext::IAudioMetricExt u:object_r:hal_audiometricext_hwservice:s0
|
||||
|
2
audio/sepolicy/common/property.te
Normal file
2
audio/sepolicy/common/property.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Audio
|
||||
vendor_internal_prop(vendor_audio_prop)
|
11
audio/sepolicy/common/property_contexts
Normal file
11
audio/sepolicy/common/property_contexts
Normal file
|
@ -0,0 +1,11 @@
|
|||
# for audio
|
||||
vendor.audio_hal.period_multiplier u:object_r:vendor_audio_prop:s0
|
||||
vendor.audiodump.enable u:object_r:vendor_audio_prop:s0
|
||||
persist.vendor.audio. u:object_r:vendor_audio_prop:s0
|
||||
vendor.audiodump.log.ondemand u:object_r:vendor_audio_prop:s0
|
||||
vendor.audiodump.log.config u:object_r:vendor_audio_prop:s0
|
||||
vendor.audiodump.output.dir u:object_r:vendor_audio_prop:s0
|
||||
vendor.audiodump.encode.disable u:object_r:vendor_audio_prop:s0
|
||||
vendor.audiodump.log.cca.updated u:object_r:vendor_audio_prop:s0
|
||||
vendor.audiodump.cca.config u:object_r:vendor_audio_prop:s0
|
||||
vendor.audio_hal.aidl.enable u:object_r:vendor_audio_prop:s0
|
1
audio/sepolicy/common/rild.te
Normal file
1
audio/sepolicy/common/rild.te
Normal file
|
@ -0,0 +1 @@
|
|||
get_prop(rild, vendor_audio_prop);
|
2
audio/sepolicy/common/vendor_init.te
Normal file
2
audio/sepolicy/common/vendor_init.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Audio property
|
||||
set_prop(vendor_init, vendor_audio_prop)
|
3
audio/sepolicy/hidl/hal_audio_default.te
Normal file
3
audio/sepolicy/hidl/hal_audio_default.te
Normal file
|
@ -0,0 +1,3 @@
|
|||
hwbinder_use(hal_audio_default)
|
||||
|
||||
add_hwservice(hal_audio_default, hal_audio_ext_hwservice)
|
2
audio/sepolicy/hidl/hwservice.te
Normal file
2
audio/sepolicy/hidl/hwservice.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Audio
|
||||
type hal_audio_ext_hwservice, hwservice_manager_type;
|
2
audio/sepolicy/hidl/hwservice_contexts
Normal file
2
audio/sepolicy/hidl/hwservice_contexts
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Audio
|
||||
vendor.google.whitechapel.audio.audioext::IAudioExt u:object_r:hal_audio_ext_hwservice:s0
|
1
audio/sepolicy/hidl/rild.te
Normal file
1
audio/sepolicy/hidl/rild.te
Normal file
|
@ -0,0 +1 @@
|
|||
allow rild hal_audio_ext_hwservice:hwservice_manager find;
|
51
battery_mitigation/Android.bp
Normal file
51
battery_mitigation/Android.bp
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.
|
||||
*/
|
||||
|
||||
soong_namespace {
|
||||
imports: [
|
||||
"hardware/google/pixel",
|
||||
],
|
||||
}
|
||||
|
||||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
vendor: true,
|
||||
name: "battery_mitigation",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
init_rc: ["battery_mitigation.rc"],
|
||||
shared_libs: [
|
||||
"libpixelmitigation",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libcutils",
|
||||
"libhardware",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.thermal@2.0",
|
||||
"android.hardware.thermal-V1-ndk"
|
||||
],
|
||||
srcs: [
|
||||
"battery_mitigation.cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
],
|
||||
}
|
114
battery_mitigation/battery_mitigation.cpp
Normal file
114
battery_mitigation/battery_mitigation.cpp
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "battery-mitigation"
|
||||
|
||||
#include <battery_mitigation/BatteryMitigation.h>
|
||||
#include <android/binder_process.h>
|
||||
|
||||
using android::hardware::google::pixel::BatteryMitigation;
|
||||
using android::hardware::google::pixel::MitigationConfig;
|
||||
|
||||
android::sp<BatteryMitigation> bmSp;
|
||||
|
||||
const struct MitigationConfig::Config cfg = {
|
||||
.SystemPath = {
|
||||
"/dev/thermal/tz-by-name/batoilo/temp",
|
||||
"/dev/thermal/tz-by-name/smpl_gm/temp",
|
||||
"/dev/thermal/tz-by-name/soc/temp",
|
||||
"/dev/thermal/tz-by-name/vdroop1/temp",
|
||||
"/dev/thermal/tz-by-name/vdroop2/temp",
|
||||
"/dev/thermal/tz-by-name/ocp_gpu/temp",
|
||||
"/dev/thermal/tz-by-name/ocp_tpu/temp",
|
||||
"/dev/thermal/tz-by-name/soft_ocp_cpu2/temp",
|
||||
"/dev/thermal/tz-by-name/soft_ocp_cpu1/temp",
|
||||
"/dev/thermal/tz-by-name/battery/temp",
|
||||
"/dev/thermal/tz-by-name/battery_cycle/temp",
|
||||
"/sys/bus/iio/devices/iio:device0/lpf_power",
|
||||
"/sys/bus/iio/devices/iio:device1/lpf_power",
|
||||
"/dev/thermal/cdev-by-name/thermal-cpufreq-2/cur_state",
|
||||
"/dev/thermal/cdev-by-name/thermal-cpufreq-1/cur_state",
|
||||
"/dev/thermal/cdev-by-name/thermal-gpufreq-0/cur_state",
|
||||
"/dev/thermal/cdev-by-name/tpu_cooling/cur_state",
|
||||
"/dev/thermal/cdev-by-name/CAM/cur_state",
|
||||
"/dev/thermal/cdev-by-name/DISP/cur_state",
|
||||
"/dev/thermal/cdev-by-name/gxp-cooling/cur_state",
|
||||
"/sys/class/power_supply/battery/voltage_now",
|
||||
"/sys/class/power_supply/battery/current_now",
|
||||
},
|
||||
.FilteredZones = {
|
||||
"batoilo",
|
||||
"vdroop1",
|
||||
"vdroop2",
|
||||
"smpl_gm",
|
||||
},
|
||||
.SystemName = {
|
||||
"batoilo", "smpl_gm", "soc", "vdroop1", "vdroop2", "ocp_gpu",
|
||||
"ocp_tpu", "soft_ocp_cpu2", "soft_ocp_cpu1", "battery", "battery_cycle",
|
||||
"main", "sub", "CPU2", "CPU1", "GPU", "TPU", "CAM", "DISP", "NPU",
|
||||
"voltage_now", "current_now",
|
||||
},
|
||||
.LogFilePath = "/data/vendor/mitigation/thismeal.txt",
|
||||
.TimestampFormat = "%Y-%m-%d %H:%M:%S",
|
||||
};
|
||||
|
||||
const char kReadyFilePath[] = "/sys/devices/virtual/pmic/mitigation/instruction/ready";
|
||||
const char kReadyProperty[] = "vendor.brownout.mitigation.ready";
|
||||
const char kLastMealPath[] = "/data/vendor/mitigation/lastmeal.txt";
|
||||
const char kBRRequestedProperty[] = "vendor.brownout_reason";
|
||||
const char kLastMealProperty[] = "vendor.brownout.br.feasible";
|
||||
const std::regex kTimestampRegex("^\\S+\\s[0-9]+:[0-9]+:[0-9]+\\S+$");
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/) {
|
||||
auto batteryMitigationStartTime = std::chrono::system_clock::now();
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
||||
ABinderProcess_startThreadPool();
|
||||
bmSp = new BatteryMitigation(cfg);
|
||||
if (!bmSp) {
|
||||
return 0;
|
||||
}
|
||||
bool mitigationLogTimeValid = bmSp->isMitigationLogTimeValid(batteryMitigationStartTime,
|
||||
cfg.LogFilePath,
|
||||
cfg.TimestampFormat,
|
||||
kTimestampRegex);
|
||||
std::string reason = android::base::GetProperty(kBRRequestedProperty, "");
|
||||
if (!reason.empty() && mitigationLogTimeValid) {
|
||||
std::ifstream src(cfg.LogFilePath, std::ios::in);
|
||||
std::ofstream dst(kLastMealPath, std::ios::out);
|
||||
dst << src.rdbuf();
|
||||
android::base::SetProperty(kLastMealProperty, "1");
|
||||
}
|
||||
bool isBatteryMitigationReady = false;
|
||||
std::string ready_str;
|
||||
int val = 0;
|
||||
while (!isBatteryMitigationReady) {
|
||||
if (!android::base::ReadFileToString(kReadyFilePath, &ready_str)) {
|
||||
continue;
|
||||
}
|
||||
ready_str = android::base::Trim(ready_str);
|
||||
if (!android::base::ParseInt(ready_str, &val)) {
|
||||
continue;
|
||||
}
|
||||
if (val == 1) {
|
||||
isBatteryMitigationReady = true;
|
||||
}
|
||||
}
|
||||
android::base::SetProperty(kReadyProperty, "1");
|
||||
while (true) {
|
||||
pause();
|
||||
}
|
||||
return 0;
|
||||
}
|
96
battery_mitigation/battery_mitigation.rc
Normal file
96
battery_mitigation/battery_mitigation.rc
Normal file
|
@ -0,0 +1,96 @@
|
|||
on property:vendor.thermal.link_ready=1
|
||||
mkdir /data/vendor/mitigation 0755 system system
|
||||
chown system system /data/vendor/mitigation
|
||||
start vendor.battery_mitigation
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,uvlo,pmic,if && property:sys.boot.reason=reboot,uvlo,pmic,if
|
||||
setprop vendor.brownout_reason "uvlo,pmic,if"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,pmic,if && property:sys.boot.reason=reboot,ocp,pmic,if
|
||||
setprop vendor.brownout_reason "ocp,pmic,if"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,uvlo,pmic,main && property:sys.boot.reason=reboot,uvlo,pmic,main
|
||||
setprop vendor.brownout_reason "uvlo,pmic,main"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,uvlo,pmic,sub && property:sys.boot.reason=reboot,uvlo,pmic,sub
|
||||
setprop vendor.brownout_reason "uvlo,pmic,sub"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK1M && property:sys.boot.reason=reboot,ocp,buck1m
|
||||
setprop vendor.brownout_reason "ocp,buck1m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK2M && property:sys.boot.reason=reboot,ocp,buck2m
|
||||
setprop vendor.brownout_reason "ocp,buck2m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK3M && property:sys.boot.reason=reboot,ocp,buck3m
|
||||
setprop vendor.brownout_reason "ocp,buck3m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK4M && property:sys.boot.reason=reboot,ocp,buck4m
|
||||
setprop vendor.brownout_reason "ocp,buck4m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK5M && property:sys.boot.reason=reboot,ocp,buck5m
|
||||
setprop vendor.brownout_reason "ocp,buck5m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK6M && property:sys.boot.reason=reboot,ocp,buck6m
|
||||
setprop vendor.brownout_reason "ocp,buck6m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK7M && property:sys.boot.reason=reboot,ocp,buck7m
|
||||
setprop vendor.brownout_reason "ocp,buck7m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK8M && property:sys.boot.reason=reboot,ocp,buck8m
|
||||
setprop vendor.brownout_reason "ocp,buck8m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK9M && property:sys.boot.reason=reboot,ocp,buck9m
|
||||
setprop vendor.brownout_reason "ocp,buck9m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK10M && property:sys.boot.reason=reboot,ocp,buck10m
|
||||
setprop vendor.brownout_reason "ocp,buck10m"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK1S && property:sys.boot.reason=reboot,ocp,buck1s
|
||||
setprop vendor.brownout_reason "ocp,buck1s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK2S && property:sys.boot.reason=reboot,ocp,buck2s
|
||||
setprop vendor.brownout_reason "ocp,buck2s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK3S && property:sys.boot.reason=reboot,ocp,buck3s
|
||||
setprop vendor.brownout_reason "ocp,buck3s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK4S && property:sys.boot.reason=reboot,ocp,buck4s
|
||||
setprop vendor.brownout_reason "ocp,buck4s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK5S && property:sys.boot.reason=reboot,ocp,buck5s
|
||||
setprop vendor.brownout_reason "ocp,buck5s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK6S && property:sys.boot.reason=reboot,ocp,buck6s
|
||||
setprop vendor.brownout_reason "ocp,buck6s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK7S && property:sys.boot.reason=reboot,ocp,buck7s
|
||||
setprop vendor.brownout_reason "ocp,buck7s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK8S && property:sys.boot.reason=reboot,ocp,buck8s
|
||||
setprop vendor.brownout_reason "ocp,buck8s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK9S && property:sys.boot.reason=reboot,ocp,buck9s
|
||||
setprop vendor.brownout_reason "ocp,buck9s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK10S && property:sys.boot.reason=reboot,ocp,buck10s
|
||||
setprop vendor.brownout_reason "ocp,buck10s"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKDS && property:sys.boot.reason=reboot,ocp,buckds
|
||||
setprop vendor.brownout_reason "ocp,buckds"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKAS && property:sys.boot.reason=reboot,ocp,buckas
|
||||
setprop vendor.brownout_reason "ocp,buckas"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKCS && property:sys.boot.reason=reboot,ocp,buckcs
|
||||
setprop vendor.brownout_reason "ocp,buckcs"
|
||||
|
||||
on property:vendor.thermal.link_ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKBS && property:sys.boot.reason=reboot,ocp,buckbs
|
||||
setprop vendor.brownout_reason "ocp,buckbs"
|
||||
|
||||
on property:vendor.brownout.br.feasible=1
|
||||
chown system system data/vendor/mitigation/lastmeal.txt
|
||||
|
||||
service vendor.battery_mitigation /vendor/bin/hw/battery_mitigation
|
||||
user system
|
||||
group system
|
||||
capabilities WAKE_ALARM BLOCK_SUSPEND
|
7
battery_mitigation/bcl.mk
Normal file
7
battery_mitigation/bcl.mk
Normal file
|
@ -0,0 +1,7 @@
|
|||
PRODUCT_PACKAGES += battery_mitigation
|
||||
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
|
||||
PRODUCT_PACKAGES += BrownoutDetection
|
||||
endif
|
||||
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy
|
||||
PRODUCT_SOONG_NAMESPACES += device/google/gs-common/battery_mitigation
|
26
battery_mitigation/sepolicy/battery_mitigation.te
Normal file
26
battery_mitigation/sepolicy/battery_mitigation.te
Normal file
|
@ -0,0 +1,26 @@
|
|||
type battery_mitigation, domain;
|
||||
type battery_mitigation_exec, exec_type, vendor_file_type, file_type;
|
||||
init_daemon_domain(battery_mitigation)
|
||||
get_prop(battery_mitigation, boot_status_prop)
|
||||
get_prop(battery_mitigation, vendor_brownout_reason_prop)
|
||||
get_prop(battery_mitigation, system_boot_reason_prop)
|
||||
set_prop(battery_mitigation, vendor_mitigation_ready_prop)
|
||||
set_prop(battery_mitigation, vendor_brownout_br_feasible_prop)
|
||||
|
||||
hal_client_domain(battery_mitigation, hal_thermal);
|
||||
hal_client_domain(battery_mitigation, hal_health);
|
||||
|
||||
r_dir_file(battery_mitigation, sysfs_batteryinfo)
|
||||
r_dir_file(battery_mitigation, sysfs_iio_devices)
|
||||
r_dir_file(battery_mitigation, sysfs_thermal)
|
||||
r_dir_file(battery_mitigation, thermal_link_device)
|
||||
r_dir_file(battery_mitigation, sysfs_odpm)
|
||||
allow battery_mitigation sysfs_bcl:dir r_dir_perms;
|
||||
allow battery_mitigation sysfs_bcl:file r_file_perms;
|
||||
allow battery_mitigation sysfs_bcl:lnk_file r_file_perms;
|
||||
allow battery_mitigation sysfs_thermal:lnk_file r_file_perms;
|
||||
allow battery_mitigation mitigation_vendor_data_file:dir rw_dir_perms;
|
||||
allow battery_mitigation mitigation_vendor_data_file:file create_file_perms;
|
||||
|
||||
# Allow battery_mitigation to use Binder IPC so that service manager can notify it for callbacks
|
||||
binder_use(battery_mitigation)
|
9
battery_mitigation/sepolicy/brownout_detection_app.te
Normal file
9
battery_mitigation/sepolicy/brownout_detection_app.te
Normal file
|
@ -0,0 +1,9 @@
|
|||
type brownout_detection_app, domain, coredomain;
|
||||
|
||||
userdebug_or_eng(`
|
||||
app_domain(brownout_detection_app)
|
||||
net_domain(brownout_detection_app)
|
||||
allow brownout_detection_app app_api_service:service_manager find;
|
||||
allow brownout_detection_app system_api_service:service_manager find;
|
||||
get_prop(brownout_detection_app, vendor_brownout_reason_prop)
|
||||
')
|
3
battery_mitigation/sepolicy/file.te
Normal file
3
battery_mitigation/sepolicy/file.te
Normal file
|
@ -0,0 +1,3 @@
|
|||
type mitigation_vendor_data_file, file_type, data_file_type;
|
||||
type sysfs_bcl, sysfs_type, fs_type;
|
||||
type sysfs_odpm, sysfs_type, fs_type;
|
2
battery_mitigation/sepolicy/file_contexts
Normal file
2
battery_mitigation/sepolicy/file_contexts
Normal file
|
@ -0,0 +1,2 @@
|
|||
/vendor/bin/hw/battery_mitigation u:object_r:battery_mitigation_exec:s0
|
||||
/data/vendor/mitigation(/.*)? u:object_r:mitigation_vendor_data_file:s0
|
1
battery_mitigation/sepolicy/genfs_contexts
Normal file
1
battery_mitigation/sepolicy/genfs_contexts
Normal file
|
@ -0,0 +1 @@
|
|||
genfscon sysfs /devices/virtual/pmic/mitigation u:object_r:sysfs_bcl:s0
|
4
battery_mitigation/sepolicy/property.te
Normal file
4
battery_mitigation/sepolicy/property.te
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Battery Mitigation
|
||||
vendor_internal_prop(vendor_mitigation_ready_prop)
|
||||
vendor_public_prop(vendor_brownout_reason_prop)
|
||||
vendor_internal_prop(vendor_brownout_br_feasible_prop)
|
4
battery_mitigation/sepolicy/property_contexts
Normal file
4
battery_mitigation/sepolicy/property_contexts
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Battery Mitigation
|
||||
vendor.brownout.mitigation.ready u:object_r:vendor_mitigation_ready_prop:s0
|
||||
vendor.brownout_reason u:object_r:vendor_brownout_reason_prop:s0
|
||||
vendor.brownout.br.feasible u:object_r:vendor_brownout_br_feasible_prop:s0
|
2
battery_mitigation/sepolicy/seapp_contexts
Normal file
2
battery_mitigation/sepolicy/seapp_contexts
Normal file
|
@ -0,0 +1,2 @@
|
|||
# BrownoutDetection
|
||||
user=_app isPrivApp=true name=com.google.android.brownoutdetection domain=brownout_detection_app type=app_data_file levelFrom=all
|
5
battery_mitigation/sepolicy/vendor_init.te
Normal file
5
battery_mitigation/sepolicy/vendor_init.te
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Battery Mitigation
|
||||
set_prop(vendor_init, vendor_brownout_reason_prop)
|
||||
get_prop(vendor_init, vendor_brownout_br_feasible_prop)
|
||||
get_prop(vendor_init, system_boot_reason_prop)
|
||||
get_prop(vendor_init, vendor_thermal_prop)
|
12
bcmbt/bluetooth.mk
Normal file
12
bcmbt/bluetooth.mk
Normal file
|
@ -0,0 +1,12 @@
|
|||
PRODUCT_SOONG_NAMESPACES += vendor/broadcom/bluetooth
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.bluetooth@1.1-service.bcmbtlinux \
|
||||
bt_vendor.conf \
|
||||
android.hardware.bluetooth.prebuilt.xml \
|
||||
android.hardware.bluetooth_le.prebuilt.xml
|
||||
|
||||
|
||||
BOARD_SEPOLICY_DIRS += device/google/gs-common/bcmbt/sepolicy
|
||||
|
||||
DEVICE_MANIFEST_FILE += device/google/gs-common/bcmbt/manifest_bluetooth.xml
|
||||
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/bcmbt/compatibility_matrix.xml
|
42
bcmbt/compatibility_matrix.xml
Normal file
42
bcmbt/compatibility_matrix.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<compatibility-matrix version="1.0" type="framework" level="7">
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.ccc</name>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IBluetoothCcc</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.bt_channel_avoidance</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IBTChannelAvoidance</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.sar</name>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IBluetoothSar</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="true">
|
||||
<name>hardware.google.bluetooth.ext</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IBluetoothExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="true">
|
||||
<name>hardware.google.bluetooth.ewp</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IBluetoothEwp</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
56
bcmbt/manifest_bluetooth.xml
Normal file
56
bcmbt/manifest_bluetooth.xml
Normal file
|
@ -0,0 +1,56 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.bluetooth</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IBluetoothHci</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.bt_channel_avoidance</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IBTChannelAvoidance</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.sar</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IBluetoothSar</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.ext</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IBluetoothExt</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.ccc</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IBluetoothCcc</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>hardware.google.bluetooth.ewp</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IBluetoothEwp</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
3
bcmbt/sepolicy/device.te
Normal file
3
bcmbt/sepolicy/device.te
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Bt Wifi Coexistence device
|
||||
type wb_coexistence_dev, dev_type;
|
||||
|
6
bcmbt/sepolicy/file_contexts
Normal file
6
bcmbt/sepolicy/file_contexts
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Bluetooth
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.bluetooth@1\.1-service\.bcmbtlinux u:object_r:hal_bluetooth_btlinux_exec:s0
|
||||
|
||||
/dev/wbrc u:object_r:wb_coexistence_dev:s0
|
||||
/dev/ttySAC16 u:object_r:hci_attach_dev:s0
|
||||
|
7
bcmbt/sepolicy/genfs_contexts
Normal file
7
bcmbt/sepolicy/genfs_contexts
Normal file
|
@ -0,0 +1,7 @@
|
|||
genfscon sysfs /devices/platform/odm/odm:btbcm/rfkill/rfkill0/state u:object_r:sysfs_bluetooth_writable:s0
|
||||
genfscon sysfs /devices/platform/odm/odm:btbcm/rfkill/rfkill2/state u:object_r:sysfs_bluetooth_writable:s0
|
||||
genfscon proc /bluetooth/sleep/lpm u:object_r:proc_bluetooth_writable:s0
|
||||
genfscon proc /bluetooth/sleep/btwrite u:object_r:proc_bluetooth_writable:s0
|
||||
genfscon proc /bluetooth/sleep/btwake u:object_r:proc_bluetooth_writable:s0
|
||||
genfscon proc /bluetooth/timesync u:object_r:proc_bluetooth_writable:s0
|
||||
|
22
bcmbt/sepolicy/hal_bluetooth_btlinux.te
Normal file
22
bcmbt/sepolicy/hal_bluetooth_btlinux.te
Normal file
|
@ -0,0 +1,22 @@
|
|||
add_hwservice(hal_bluetooth_btlinux, hal_bluetooth_coexistence_hwservice);
|
||||
get_prop(hal_bluetooth_btlinux, boot_status_prop)
|
||||
|
||||
allow hal_bluetooth_btlinux sysfs_bluetooth_writable:file rw_file_perms;
|
||||
allow hal_bluetooth_btlinux proc_bluetooth_writable:file rw_file_perms;
|
||||
allow hal_bluetooth_btlinux hci_attach_dev:chr_file rw_file_perms;
|
||||
allow hal_bluetooth_btlinux wb_coexistence_dev:chr_file rw_file_perms;
|
||||
binder_call(hal_bluetooth_btlinux, servicemanager)
|
||||
|
||||
# power stats
|
||||
vndbinder_use(hal_bluetooth_btlinux)
|
||||
allow hal_bluetooth_btlinux hal_power_stats_vendor_service:service_manager find;
|
||||
binder_call(hal_bluetooth_btlinux, hal_power_stats_default)
|
||||
|
||||
allow hal_bluetooth_btlinux sscoredump_vendor_data_crashinfo_file:dir create_dir_perms;
|
||||
allow hal_bluetooth_btlinux sscoredump_vendor_data_crashinfo_file:file create_file_perms;
|
||||
|
||||
userdebug_or_eng(`
|
||||
allow hal_bluetooth_btlinux sscoredump_vendor_data_coredump_file:dir create_dir_perms;
|
||||
allow hal_bluetooth_btlinux sscoredump_vendor_data_coredump_file:file create_file_perms;
|
||||
allow hal_bluetooth_btlinux logbuffer_device:chr_file r_file_perms;
|
||||
')
|
3
bcmbt/sepolicy/hwservice.te
Normal file
3
bcmbt/sepolicy/hwservice.te
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Bluetooth HAL extension
|
||||
type hal_bluetooth_coexistence_hwservice, hwservice_manager_type, vendor_hwservice_type;
|
||||
|
6
bcmbt/sepolicy/hwservice_contexts
Normal file
6
bcmbt/sepolicy/hwservice_contexts
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Bluetooth HAL extension
|
||||
hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance u:object_r:hal_bluetooth_coexistence_hwservice:s0
|
||||
hardware.google.bluetooth.sar::IBluetoothSar u:object_r:hal_bluetooth_coexistence_hwservice:s0
|
||||
hardware.google.bluetooth.ccc::IBluetoothCcc u:object_r:hal_bluetooth_coexistence_hwservice:s0
|
||||
hardware.google.bluetooth.ewp::IBluetoothEwp u:object_r:hal_bluetooth_coexistence_hwservice:s0
|
||||
hardware.google.bluetooth.ext::IBluetoothExt u:object_r:hal_bluetooth_coexistence_hwservice:s0
|
20
camera/Android.bp
Normal file
20
camera/Android.bp
Normal file
|
@ -0,0 +1,20 @@
|
|||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "dump_camera",
|
||||
srcs: ["dump_camera.cpp"],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libdump",
|
||||
"liblog",
|
||||
],
|
||||
vendor: true,
|
||||
relative_install_path: "dump",
|
||||
}
|
4
camera/dump.mk
Normal file
4
camera/dump.mk
Normal file
|
@ -0,0 +1,4 @@
|
|||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/camera/sepolicy/
|
||||
|
||||
PRODUCT_PACKAGES_DEBUG += dump_camera
|
||||
|
52
camera/dump_camera.cpp
Normal file
52
camera/dump_camera.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright 2022 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 <android-base/file.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <dump/pixel_dump.h>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr std::string_view kCameraLogDir = "/data/vendor/camera/profiler";
|
||||
constexpr std::string_view kGraphStateDumpDir = "/data/vendor/camera";
|
||||
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
if (!::android::base::GetBoolProperty(
|
||||
"vendor.camera.debug.camera_performance_analyzer.attach_to_bugreport",
|
||||
true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::string cameraDestDir =
|
||||
concatenatePath(BUGREPORT_PACKING_DIR, "camera");
|
||||
|
||||
if (mkdir(cameraDestDir.c_str(), 0777) == -1) {
|
||||
printf("Unable to create folder: %s\n", cameraDestDir.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Attach multiple latest sessions (in case the user is running concurrent
|
||||
// sessions or starts a new session after the one with performance issues).
|
||||
dumpLogs(kCameraLogDir.data(), cameraDestDir.c_str(), 10, "session-ended-");
|
||||
dumpLogs(kCameraLogDir.data(), cameraDestDir.c_str(), 5, "high-drop-rate-");
|
||||
dumpLogs(kCameraLogDir.data(), cameraDestDir.c_str(), 5, "watchdog-");
|
||||
dumpLogs(kCameraLogDir.data(), cameraDestDir.c_str(), 5, "camera-ended-");
|
||||
dumpLogs(kGraphStateDumpDir.data(), cameraDestDir.c_str(), 5,
|
||||
"hal_graph_state_");
|
||||
|
||||
return 0;
|
||||
}
|
9
camera/sepolicy/dump_camera.te
Normal file
9
camera/sepolicy/dump_camera.te
Normal file
|
@ -0,0 +1,9 @@
|
|||
pixel_bugreport(dump_camera)
|
||||
|
||||
userdebug_or_eng(`
|
||||
allow dump_camera vendor_camera_data_file:dir r_dir_perms;
|
||||
allow dump_camera vendor_camera_data_file:file create_file_perms;
|
||||
allow dump_camera radio_vendor_data_file:dir create_dir_perms;
|
||||
allow dump_camera radio_vendor_data_file:file create_file_perms;
|
||||
get_prop(dump_camera, vendor_camera_debug_prop)
|
||||
')
|
2
camera/sepolicy/file.te
Normal file
2
camera/sepolicy/file.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
type vendor_camera_data_file, file_type, data_file_type;
|
||||
|
5
camera/sepolicy/file_contexts
Normal file
5
camera/sepolicy/file_contexts
Normal file
|
@ -0,0 +1,5 @@
|
|||
/vendor/bin/dump/dump_camera u:object_r:dump_camera_exec:s0
|
||||
|
||||
# Data
|
||||
/data/vendor/camera(/.*)? u:object_r:vendor_camera_data_file:s0
|
||||
|
2
camera/sepolicy/property.te
Normal file
2
camera/sepolicy/property.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
vendor_internal_prop(vendor_camera_debug_prop)
|
||||
|
2
camera/sepolicy/property_contexts
Normal file
2
camera/sepolicy/property_contexts
Normal file
|
@ -0,0 +1,2 @@
|
|||
vendor.camera.debug. u:object_r:vendor_camera_debug_prop:s0
|
||||
|
10
dauntless/Android.bp
Normal file
10
dauntless/Android.bp
Normal file
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
sh_binary {
|
||||
name: "dump_gsc.sh",
|
||||
src: "dump_gsc.sh",
|
||||
vendor: true,
|
||||
sub_dir: "dump",
|
||||
}
|
7
dauntless/dump_gsc.sh
Normal file
7
dauntless/dump_gsc.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/vendor/bin/sh
|
||||
echo "Citadel VERSION\n"
|
||||
vendor/bin/hw/citadel_updater -lv
|
||||
echo "Citadel STATS\n"
|
||||
vendor/bin/hw/citadel_updater --stats
|
||||
echo "GSC DEBUG DUMP\n"
|
||||
vendor/bin/hw/citadel_updater -D
|
23
dauntless/gsc.mk
Normal file
23
dauntless/gsc.mk
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Dauntless
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/dauntless/sepolicy
|
||||
ifneq ($(wildcard vendor),)
|
||||
PRODUCT_SOONG_NAMESPACES += vendor/google_nos/init/dauntless
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
citadeld \
|
||||
citadel_updater \
|
||||
android.hardware.weaver-service.citadel \
|
||||
android.hardware.authsecret-service.citadel \
|
||||
android.hardware.oemlock-service.citadel \
|
||||
android.hardware.identity@1.0-service.citadel \
|
||||
init_citadel \
|
||||
android.hardware.strongbox_keystore.xml \
|
||||
android.hardware.security.keymint-service.citadel \
|
||||
dump_gsc.sh
|
||||
|
||||
# USERDEBUG ONLY: Install test packages
|
||||
PRODUCT_PACKAGES_DEBUG += citadel_integration_tests \
|
||||
pwntest \
|
||||
nugget_targeted_tests \
|
||||
CitadelProvision
|
||||
endif
|
6
dauntless/sepolicy/citadel_provision.te
Normal file
6
dauntless/sepolicy/citadel_provision.te
Normal file
|
@ -0,0 +1,6 @@
|
|||
type citadel_provision, domain;
|
||||
type citadel_provision_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
userdebug_or_eng(`
|
||||
init_daemon_domain(citadel_provision)
|
||||
')
|
13
dauntless/sepolicy/citadeld.te
Normal file
13
dauntless/sepolicy/citadeld.te
Normal file
|
@ -0,0 +1,13 @@
|
|||
type citadeld, domain;
|
||||
type citadeld_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
init_daemon_domain(citadeld)
|
||||
|
||||
add_service(citadeld, citadeld_service)
|
||||
binder_use(citadeld)
|
||||
vndbinder_use(citadeld)
|
||||
binder_call(citadeld, system_server)
|
||||
|
||||
allow citadeld citadel_device:chr_file rw_file_perms;
|
||||
allow citadeld fwk_stats_service:service_manager find;
|
||||
allow citadeld hal_power_stats_vendor_service:service_manager find;
|
1
dauntless/sepolicy/device.te
Normal file
1
dauntless/sepolicy/device.te
Normal file
|
@ -0,0 +1 @@
|
|||
type citadel_device, dev_type;
|
12
dauntless/sepolicy/dump_gsc.te
Normal file
12
dauntless/sepolicy/dump_gsc.te
Normal file
|
@ -0,0 +1,12 @@
|
|||
type dump_gsc, domain;
|
||||
type dump_gsc_exec, exec_type, vendor_file_type, file_type;
|
||||
domain_auto_trans(hal_dumpstate_default, dump_gsc_exec, dump_gsc)
|
||||
hal_client_domain(dump_gsc, hal_dumpstate)
|
||||
|
||||
allow dump_gsc dumpstate:fd use;
|
||||
allow dump_gsc dumpstate:fifo_file { write getattr };
|
||||
allow dump_gsc shell_data_file:file { write getattr };
|
||||
allow dump_gsc citadel_updater:file execute_no_trans;
|
||||
allow dump_gsc citadeld_service:service_manager find;
|
||||
binder_call(dump_gsc, citadeld)
|
||||
vndbinder_use(dump_gsc)
|
3
dauntless/sepolicy/fastbootd.te
Normal file
3
dauntless/sepolicy/fastbootd.te
Normal file
|
@ -0,0 +1,3 @@
|
|||
recovery_only(`
|
||||
allow fastbootd citadel_device:chr_file rw_file_perms;
|
||||
')
|
1
dauntless/sepolicy/file.te
Normal file
1
dauntless/sepolicy/file.te
Normal file
|
@ -0,0 +1 @@
|
|||
type citadel_updater, vendor_file_type, file_type;
|
13
dauntless/sepolicy/file_contexts
Normal file
13
dauntless/sepolicy/file_contexts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/vendor/bin/dump/dump_gsc\.sh u:object_r:dump_gsc_exec:s0
|
||||
/vendor/bin/CitadelProvision u:object_r:citadel_provision_exec:s0
|
||||
/vendor/bin/hw/init_citadel u:object_r:init_citadel_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.security\.keymint-service\.citadel u:object_r:hal_keymint_citadel_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.weaver@1\.0-service\.citadel u:object_r:hal_weaver_citadel_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.weaver-service\.citadel u:object_r:hal_weaver_citadel_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.identity@1\.0-service\.citadel u:object_r:hal_identity_citadel_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.authsecret-service\.citadel u:object_r:hal_authsecret_citadel_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.oemlock-service\.citadel u:object_r:hal_oemlock_citadel_exec:s0
|
||||
/vendor/bin/hw/citadel_updater u:object_r:citadel_updater:s0
|
||||
/vendor/bin/hw/citadeld u:object_r:citadeld_exec:s0
|
||||
|
||||
/dev/gsc0 u:object_r:citadel_device:s0
|
9
dauntless/sepolicy/hal_authsecret_citadel.te
Normal file
9
dauntless/sepolicy/hal_authsecret_citadel.te
Normal file
|
@ -0,0 +1,9 @@
|
|||
type hal_authsecret_citadel, domain;
|
||||
type hal_authsecret_citadel_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
vndbinder_use(hal_authsecret_citadel)
|
||||
binder_call(hal_authsecret_citadel, citadeld)
|
||||
allow hal_authsecret_citadel citadeld_service:service_manager find;
|
||||
|
||||
hal_server_domain(hal_authsecret_citadel, hal_authsecret)
|
||||
init_daemon_domain(hal_authsecret_citadel)
|
11
dauntless/sepolicy/hal_identity_citadel.te
Normal file
11
dauntless/sepolicy/hal_identity_citadel.te
Normal file
|
@ -0,0 +1,11 @@
|
|||
type hal_identity_citadel, domain;
|
||||
type hal_identity_citadel_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
vndbinder_use(hal_identity_citadel)
|
||||
binder_call(hal_identity_citadel, citadeld)
|
||||
allow hal_identity_citadel citadeld_service:service_manager find;
|
||||
allow hal_identity_citadel hal_keymint_citadel:binder call;
|
||||
|
||||
hal_server_domain(hal_identity_citadel, hal_identity)
|
||||
hal_server_domain(hal_identity_citadel, hal_keymint)
|
||||
init_daemon_domain(hal_identity_citadel)
|
9
dauntless/sepolicy/hal_keymint_citadel.te
Normal file
9
dauntless/sepolicy/hal_keymint_citadel.te
Normal file
|
@ -0,0 +1,9 @@
|
|||
type hal_keymint_citadel, domain;
|
||||
type hal_keymint_citadel_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
hal_server_domain(hal_keymint_citadel, hal_keymint)
|
||||
init_daemon_domain(hal_keymint_citadel)
|
||||
vndbinder_use(hal_keymint_citadel)
|
||||
get_prop(hal_keymint_citadel, vendor_security_patch_level_prop)
|
||||
allow hal_keymint_citadel citadeld_service:service_manager find;
|
||||
binder_call(hal_keymint_citadel, citadeld)
|
9
dauntless/sepolicy/hal_oemlock_citadel.te
Normal file
9
dauntless/sepolicy/hal_oemlock_citadel.te
Normal file
|
@ -0,0 +1,9 @@
|
|||
type hal_oemlock_citadel, domain;
|
||||
type hal_oemlock_citadel_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
vndbinder_use(hal_oemlock_citadel)
|
||||
binder_call(hal_oemlock_citadel, citadeld)
|
||||
allow hal_oemlock_citadel citadeld_service:service_manager find;
|
||||
|
||||
hal_server_domain(hal_oemlock_citadel, hal_oemlock)
|
||||
init_daemon_domain(hal_oemlock_citadel)
|
11
dauntless/sepolicy/hal_weaver_citadel.te
Normal file
11
dauntless/sepolicy/hal_weaver_citadel.te
Normal file
|
@ -0,0 +1,11 @@
|
|||
type hal_weaver_citadel, domain;
|
||||
type hal_weaver_citadel_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
init_daemon_domain(hal_weaver_citadel)
|
||||
hal_server_domain(hal_weaver_citadel, hal_weaver)
|
||||
hal_server_domain(hal_weaver_citadel, hal_oemlock)
|
||||
hal_server_domain(hal_weaver_citadel, hal_authsecret)
|
||||
vndbinder_use(hal_weaver_citadel)
|
||||
binder_call(hal_weaver_citadel, citadeld)
|
||||
|
||||
allow hal_weaver_citadel citadeld_service:service_manager find;
|
15
dauntless/sepolicy/init_citadel.te
Normal file
15
dauntless/sepolicy/init_citadel.te
Normal file
|
@ -0,0 +1,15 @@
|
|||
type init_citadel, domain;
|
||||
type init_citadel_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
init_daemon_domain(init_citadel)
|
||||
|
||||
# Citadel communication must be via citadeld
|
||||
vndbinder_use(init_citadel)
|
||||
binder_call(init_citadel, citadeld)
|
||||
allow init_citadel citadeld_service:service_manager find;
|
||||
|
||||
# Many standard utils are actually vendor_toolbox (like xxd)
|
||||
allow init_citadel vendor_toolbox_exec:file rx_file_perms;
|
||||
|
||||
# init_citadel needs to invoke citadel_updater
|
||||
allow init_citadel citadel_updater:file rx_file_perms;
|
3
dauntless/sepolicy/recovery.te
Normal file
3
dauntless/sepolicy/recovery.te
Normal file
|
@ -0,0 +1,3 @@
|
|||
recovery_only(`
|
||||
allow recovery citadel_device:chr_file rw_file_perms;
|
||||
')
|
3
dauntless/sepolicy/service_contexts
Normal file
3
dauntless/sepolicy/service_contexts
Normal file
|
@ -0,0 +1,3 @@
|
|||
android.hardware.security.keymint.IKeyMintDevice/strongbox u:object_r:hal_keymint_service:s0
|
||||
android.hardware.security.sharedsecret.ISharedSecret/strongbox u:object_r:hal_sharedsecret_service:s0
|
||||
android.hardware.security.keymint.IRemotelyProvisionedComponent/strongbox u:object_r:hal_remotelyprovisionedcomponent_service:s0
|
1
dauntless/sepolicy/vndservice.te
Normal file
1
dauntless/sepolicy/vndservice.te
Normal file
|
@ -0,0 +1 @@
|
|||
type citadeld_service, vndservice_manager_type;
|
1
dauntless/sepolicy/vndservice_contexts
Normal file
1
dauntless/sepolicy/vndservice_contexts
Normal file
|
@ -0,0 +1 @@
|
|||
android.hardware.citadel.ICitadeld u:object_r:citadeld_service:s0
|
1
dauntless/sepolicy/vndservicemanager.te
Normal file
1
dauntless/sepolicy/vndservicemanager.te
Normal file
|
@ -0,0 +1 @@
|
|||
binder_call(vndservicemanager, hal_keymint_citadel)
|
|
@ -23,3 +23,6 @@ PRODUCT_PROPERTY_OVERRIDES += \
|
|||
|
||||
# Installs gsi keys into ramdisk, to boot a developer GSI with verified boot.
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/developer_gsi_keys.mk)
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.software.ipsec_tunnel_migration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnel_migration.xml
|
||||
|
|
42
display/Android.bp
Normal file
42
display/Android.bp
Normal file
|
@ -0,0 +1,42 @@
|
|||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
sh_binary {
|
||||
name: "dump_display_userdebug.sh",
|
||||
src: "dump_display_userdebug.sh",
|
||||
vendor: true,
|
||||
sub_dir: "dump",
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "dump_display",
|
||||
srcs: ["dump_display.cpp"],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libdump",
|
||||
],
|
||||
vendor: true,
|
||||
relative_install_path: "dump",
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "dump_second_display",
|
||||
srcs: ["dump_second_display.cpp"],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
],
|
||||
shared_libs: [
|
||||
"libdump",
|
||||
],
|
||||
vendor: true,
|
||||
relative_install_path: "dump",
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue