Merge 24Q3 to AOSP main

Bug: 357762254
Merged-In: I14cff8dfe4e143995b9011cd34a1e7d74613ae33
Change-Id: Ic2a51a2ac1a142369dd49e4b6eb0dd37c32f1383
This commit is contained in:
Xin Li 2024-09-05 17:02:37 -07:00
commit 3d9a037343
214 changed files with 1865 additions and 150 deletions

View file

@ -29,9 +29,10 @@ int main() {
runCommand("AoC logging wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/logging_wakeup");
runCommand("AoC hotword wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/hotword_wakeup");
runCommand("AoC memory exception wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/memory_exception");
runCommand("AoC memory votes", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/memory_votes_a32");
runCommand("AoC memory votes", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/memory_votes_ff1");
runCommand("AoC memory votes", "timeout 0.5 cat /sys/devices/platform/*.aoc/control/memory_votes_a32");
runCommand("AoC memory votes", "timeout 0.5 cat /sys/devices/platform/*.aoc/control/memory_votes_ff1");
runCommand("clean AoC buffer","echo ' ' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
runCommand("AoC DVFS (A32)", "echo 'dbg info -c 1 DVFSA32' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
runCommand("AoC DVFS (FF1)", "echo 'dbg info -c 2 DVFSFF1' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
runCommand("AoC Monitor Mode Status", "echo 'monitor_mode status' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug");
return 0;

View file

@ -26,3 +26,6 @@ add_service(aocxd, aocx);
# allow managing thread priority
allow aocxd self:global_capability_class_set sys_nice;
allow aocxd dumpstate:fd use;
allow aocxd dumpstate:fifo_file write;

View file

@ -0,0 +1,2 @@
# Allow dumpstate to talk to aocxd over binder
binder_call(dumpstate, aocxd)

View file

@ -28,7 +28,12 @@
/dev/acd-audio_ap_offload_tx u:object_r:aoc_device:s0
/dev/acd-mel_processor u:object_r:aoc_device:s0
/dev/acd-aocx_control u:object_r:aoc_device:s0
/dev/acd-aocx_inject[0-9]* u:object_r:aoc_device:s0
/dev/acd-aocx_tapout[0-9]* u:object_r:aoc_device:s0
/dev/acd-mc_headpos u:object_r:aoc_device:s0
/dev/acd-chre_bt_offload_ctl u:object_r:aoc_device:s0
/dev/acd-chre_bt_offload_data_tx u:object_r:aoc_device:s0
/dev/acd-chre_bt_offload_data_rx u:object_r:aoc_device:s0
# AoC vendor binaries
/vendor/bin/aocd u:object_r:aocd_exec:s0

1
aoc/sepolicy/service.te Normal file
View file

@ -0,0 +1 @@
type aocx, service_manager_type;

View file

@ -1 +0,0 @@
type aocx, vndservice_manager_type;

View file

@ -6,9 +6,6 @@ PRODUCT_PACKAGES += \
android.hardware.audio.service-aidl.aoc \
vendor.google.whitechapel.audio.hal.parserservice \
# 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 \
@ -16,6 +13,7 @@ PRODUCT_PACKAGES += \
libdynamicsprocessingaidl \
libloudnessenhanceraidl \
libdownmixaidl \
libhapticgeneratoraidl \
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/aidl
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hdmi_audio

View file

@ -9,7 +9,7 @@
</hal>
<hal format="aidl">
<name>vendor.google.whitechapel.audio.extension</name>
<version>1</version>
<version>2</version>
<interface>
<name>IAudioExtension</name>
<instance>default</instance>

View file

@ -1 +1,4 @@
add_service(hal_audio_default, hal_audio_ext_service)
# Allow audio-hal to register battery_mitigation service
allow hal_audio_default hal_battery_mitigation_service:service_manager find;
binder_call(hal_audio_default, battery_mitigation)

View file

@ -21,3 +21,4 @@ genfscon sysfs /devices/platform/audiometrics/call_count u:ob
genfscon sysfs /devices/platform/audiometrics/offload_effects_id u:object_r:sysfs_pixelstats:s0
genfscon sysfs /devices/platform/audiometrics/offload_effects_duration u:object_r:sysfs_pixelstats:s0
genfscon sysfs /devices/platform/audiometrics/bt_usage u:object_r:sysfs_pixelstats:s0
genfscon sysfs /devices/platform/audiometrics/speaker_version u:object_r:sysfs_pixelstats:s0

View file

@ -12,6 +12,8 @@ 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 hal_audio_default sysfs_extcon:dir search;
allow hal_audio_default sysfs_extcon:file r_file_perms;
#allow access to aoc and kernel boottime
allow hal_audio_default sysfs_aoc:dir { search };

View file

@ -1,2 +1,5 @@
# Audio
vendor_internal_prop(vendor_audio_prop)
# The property for Audio App
vendor_restricted_prop(vendor_audio_prop_restricted)

View file

@ -1,3 +1,6 @@
# for serial no
vendor.audio_hal.device.serialno u:object_r:vendor_audio_prop:s0
# for audio
vendor.audio_hal.period_multiplier u:object_r:vendor_audio_prop:s0
vendor.audiodump.enable u:object_r:vendor_audio_prop:s0
@ -9,3 +12,6 @@ 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
# for audio app
persist.vendor.app.audio. u:object_r:vendor_audio_prop_restricted:s0

View file

@ -1,2 +1,5 @@
# Audio property
set_prop(vendor_init, vendor_audio_prop)
# Audio App property
set_prop(vendor_init, vendor_audio_prop_restricted)

View file

@ -24,6 +24,8 @@ 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 dumpstate:fd use;
allow battery_mitigation dumpstate:fifo_file rw_file_perms;
# Allow battery_mitigation to use Binder IPC so that service manager can notify it for callbacks
binder_use(battery_mitigation)
@ -31,3 +33,6 @@ binder_use(battery_mitigation)
wakelock_use(battery_mitigation)
# Allow battery_mitigation to run aidl service
add_service(battery_mitigation, hal_battery_mitigation_service)
# Allow battery_mitigation to run audio mitigation callback
binder_call(battery_mitigation, hal_audio_default)
binder_call(battery_mitigation, servicemanager)

View file

@ -0,0 +1,3 @@
# To call battery_mitigation hal
allow dumpstate hal_battery_mitigation_service:service_manager find;
binder_call(dumpstate, battery_mitigation);

View file

@ -1 +1 @@
type hal_battery_mitigation_service, protected_service, hal_service_type, service_manager_type;
type hal_battery_mitigation_service, hal_service_type, service_manager_type;

View file

@ -1,6 +1,8 @@
PRODUCT_SOONG_NAMESPACES += vendor/broadcom/bluetooth
PRODUCT_PACKAGES += \
android.hardware.bluetooth-V1-ndk.so \
android.hardware.bluetooth.finder-V1-ndk.so \
android.hardware.bluetooth.ranging-V1-ndk.so \
android.hardware.bluetooth-service.bcmbtlinux \
vendor.google.bluetooth_ext-V1-ndk.so \
bt_vendor.conf \
@ -9,6 +11,7 @@ PRODUCT_PACKAGES += \
BOARD_SEPOLICY_DIRS += device/google/gs-common/bcmbt/sepolicy
BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/powerstats
DEVICE_MANIFEST_FILE += device/google/gs-common/bcmbt/manifest_bluetooth.xml
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/bcmbt/compatibility_matrix.xml

View file

@ -6,7 +6,6 @@
<name>IBluetoothFinder</name>
<instance>default</instance>
</interface>
<fqname>IBluetoothFinder/default</fqname>
<interface>
<name>IBluetoothCcc</name>
<instance>default</instance>

View file

@ -4,6 +4,16 @@
<version>1</version>
<fqname>IBluetoothHci/default</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.bluetooth.finder</name>
<version>1</version>
<fqname>IBluetoothFinder/default</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.bluetooth.ranging</name>
<version>1</version>
<fqname>IBluetoothChannelSounding/default</fqname>
</hal>
<hal format="aidl">
<name>vendor.google.bluetooth_ext</name>
<version>1</version>

8
betterbug/betterbug.mk Normal file
View file

@ -0,0 +1,8 @@
# When neither AOSP nor factory targets
ifeq (,$(filter aosp_% factory_%, $(TARGET_PRODUCT)))
PRODUCT_PACKAGES += BetterBugStub
PRODUCT_PACKAGES_DEBUG += BetterBug
endif
PRODUCT_PUBLIC_SEPOLICY_DIRS += device/google/gs-common/betterbug/sepolicy/product/public
PRODUCT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/betterbug/sepolicy/product/private

View file

@ -0,0 +1,47 @@
typeattribute better_bug_app coredomain;
app_domain(better_bug_app)
net_domain(better_bug_app)
allow better_bug_app app_api_service:service_manager find;
allow better_bug_app mediaserver_service:service_manager find;
allow better_bug_app radio_service:service_manager find;
allow better_bug_app system_api_service:service_manager find;
allow better_bug_app privapp_data_file:file execute;
allow better_bug_app privapp_data_file:lnk_file r_file_perms;
allow better_bug_app shell_data_file:file r_file_perms;
allow better_bug_app shell_data_file:dir r_dir_perms;
# Allow traceur to pass file descriptors through a content provider to betterbug
allow better_bug_app trace_data_file:file { getattr read };
# Allow betterbug to read profile reports generated by profcollect.
userdebug_or_eng(`
allow better_bug_app profcollectd_data_file:file r_file_perms;
')
# Allow BetterBug access to WM traces attributes
allow better_bug_app wm_trace_data_file:dir r_dir_perms;
allow better_bug_app wm_trace_data_file:file getattr;
# Allow the bug reporting frontend to read the presence and timestamp of the
# trace attached to the bugreport (but not its contents, which will go in the
# usual bugreport .zip file). This is used by the bug reporting UI to tell if
# the bugreport will contain a system trace or not while the bugreport is still
# in progress.
allow better_bug_app perfetto_traces_bugreport_data_file:dir r_dir_perms;
allow better_bug_app perfetto_traces_bugreport_data_file:file { getattr };
# Allow BetterBug to receive Perfetto traces through the framework
# (i.e. TracingServiceProxy) and sendfile them into their private
# directories for reporting when network and battery conditions are
# appropriate.
allow better_bug_app perfetto:fd use;
allow better_bug_app perfetto_traces_data_file:file { read getattr };
# Allow BetterBug to set property to start vendor.touch_dumpstate
set_prop(better_bug_app, ctl_start_prop)
# Allow BetterBug to read system boot reason
get_prop(better_bug_app, system_boot_reason_prop)

View file

@ -0,0 +1,2 @@
# BetterBug
user=_app isPrivApp=true name=com.google.android.apps.internal.betterbug domain=better_bug_app type=privapp_data_file levelFrom=user

View file

@ -0,0 +1 @@
type better_bug_app, domain;

View file

@ -12,8 +12,8 @@ cc_binary {
],
shared_libs: [
"libbase",
"libdump",
"liblog",
"libdump",
"liblog",
],
vendor: true,
relative_install_path: "dump",
@ -26,3 +26,11 @@ prebuilt_etc {
src: "vendor.android.hardware.camera.preview-dis.xml",
sub_dir: "permissions",
}
prebuilt_etc {
name: "concurrent_foldable_dual_front_xml",
vendor: true,
filename: "com.google.pixel.camera.concurrent_foldable_dual_front.xml",
src: "com.google.pixel.camera.concurrent_foldable_dual_front.xml",
sub_dir: "permissions",
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The feature on Pixel devices which supports concurrent foldable
dual front streaming -->
<permissions>
<feature name="com.google.pixel.camera.concurrent_foldable_dual_front" />
</permissions>

View file

@ -42,12 +42,15 @@ int main() {
// 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(), 10, "multicam-");
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(kCameraLogDir.data(), cameraDestDir.c_str(), 5, "fatal-error-");
dumpLogs(kGraphStateDumpDir.data(), cameraDestDir.c_str(), 5,
"hal_graph_state_");
dumpLogs(kCameraLogDir.data(), cameraDestDir.c_str(), 10,
"fd_state_tracker-");
return 0;
}

View file

@ -11,13 +11,8 @@ ifneq ($(wildcard vendor/google/services/LyricCameraHAL/src),)
$(call soong_config_set,gch,hwl_library,lyric)
endif
# Check if we're in PDK build
ifeq ($(wildcard vendor/google/camera),)
# If vendor/google/camera doesn't exist, it's a PDK build.
$(call soong_config_set,lyric,pdk_build,true)
else
# Otherwise, it's an internal Google build.
$(call soong_config_set,lyric,pdk_build,false)
# Check if we're in the internal build
ifneq ($(wildcard vendor/google/camera),)
PRODUCT_SOONG_NAMESPACES += \
vendor/google/camera \

View file

@ -8,5 +8,6 @@ binder_call(hal_camera_default, vendor_pbcs_app);
binder_call(hal_camera_default, vendor_pcs_app);
# Allow Lyric HAL to start ISP Service
# Allow Lyric HAL to start ISP Service and Image Processing HAL
add_service(hal_camera_default, vendor_camera_isp_service)
add_service(hal_camera_default, vendor_image_processing_hal_service)

View file

@ -5,3 +5,5 @@ type vendor_camera_lyricconfigprovider_service, hal_service_type, protected_serv
type vendor_camera_isp_service, hal_service_type, protected_service, service_manager_type;
type vendor_camera_cameraidremapper_service, hal_service_type, protected_service, service_manager_type;
type vendor_image_processing_hal_service, hal_service_type, protected_service, service_manager_type;

View file

@ -5,3 +5,5 @@ com.google.pixel.camera.services.lyricconfigprovider.ILyricConfigProvider/defaul
com.google.pixel.camera.isp.IIspService/default u:object_r:vendor_camera_isp_service:s0
com.google.pixel.camera.services.cameraidremapper.ICameraIdRemapper/default u:object_r:vendor_camera_cameraidremapper_service:s0
com.google.android.imageprocessing.IImageProcessingHal u:object_r:vendor_image_processing_hal_service:s0

View file

@ -9,7 +9,6 @@ PRODUCT_PACKAGES += \
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 \

View file

@ -1,2 +1,2 @@
# EdgeTPU device (DarwiNN)
type edgetpu_device, dev_type, mlstrustedobject;
type edgetpu_device, dev_type, mlstrustedobject, isolated_compute_allowed_device;

View file

@ -38,3 +38,12 @@ binder_call(edgetpu_app_server, edgetpu_vendor_server);
# Allow EdgeTPU service to log to stats service. (metrics)
allow edgetpu_app_server fwk_stats_service:service_manager find;
# Allow mlock without size restriction
allow edgetpu_app_server self:capability ipc_lock;
# Need to effectively read file mapped file when mmap + mlocked.
allow edgetpu_app_server privapp_data_file:file { map read};
# For shell level testing of mlock
allow edgetpu_app_server shell_data_file:file { map read};

View file

@ -49,3 +49,14 @@ get_prop(edgetpu_tachyon_server, vendor_edgetpu_runtime_prop)
get_prop(edgetpu_tachyon_server, vendor_hetero_runtime_prop)
# Allow Tachyon service to read EdgeTPU CPU scheduler properties
get_prop(edgetpu_tachyon_server, vendor_edgetpu_cpu_scheduler_prop)
# Allow mlock without size restriction
allow edgetpu_tachyon_server self:capability ipc_lock;
# Need to effectively read file mapped file when mmap + mlocked.
allow edgetpu_tachyon_server privapp_data_file:file { map read};
# For shell level testing of mlock
userdebug_or_eng(`
allow edgetpu_tachyon_server shell_data_file:file { map read};
')

View file

@ -15,8 +15,10 @@
/vendor/lib64/libmetrics_logger\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/libedgetpu_util\.so u:object_r:same_process_hal_file:s0
# EdgeTPU runtime libraries
/vendor/lib64/com\.google\.edgetpu_app_service-V[1-3]-ndk\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/com\.google\.edgetpu_app_service-V[1-4]-ndk\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/com\.google\.edgetpu_vendor_service-V[1-2]-ndk\.so u:object_r:same_process_hal_file:s0
# EdgeTPU Tachyon libraries
/vendor/lib64/libedgetpu_tachyon\.google\.so u:object_r:same_process_hal_file:s0
# EdgeTPU data files
/data/vendor/hal_neuralnetworks_darwinn(/.*)? u:object_r:hal_neuralnetworks_darwinn_data_file:s0
@ -27,3 +29,6 @@
# Tachyon service
/vendor/bin/hw/com\.google\.edgetpu.tachyon-service u:object_r:edgetpu_tachyon_server_exec:s0
# libfmq.so is dynamically loaded by the Tachyon client-side library libedgetpu_tachyon.google.so
/vendor/lib64/libfmq\.so u:object_r:same_process_hal_file:s0

View file

@ -7,3 +7,6 @@ allow priv_app edgetpu_nnapi_service:service_manager find;
# Allows privileged applications to access the EdgeTPU device, except open,
# which is guarded by the EdgeTPU service.
allow priv_app edgetpu_device:chr_file { getattr read write ioctl map };
# Allows EdgeTPU Tachyon service to call the app.
binder_call(edgetpu_tachyon_server, priv_app);

View file

@ -4,4 +4,4 @@ type edgetpu_dba_service, app_api_service, service_manager_type, isolated_comput
type edgetpu_tachyon_service, app_api_service, service_manager_type, isolated_compute_allowed_service;
# EdgeTPU binder service type declaration.
type edgetpu_app_service, service_manager_type;
type edgetpu_app_service, service_manager_type, isolated_compute_allowed_service;

View file

@ -5,3 +5,5 @@ allow untrusted_app_all edgetpu_app_service:service_manager find;
# by the EdgeTPU service.
allow untrusted_app_all edgetpu_device:chr_file { getattr read write ioctl map };
# Allows EdgeTPU Tachyon service to call the app.
binder_call(edgetpu_tachyon_server, untrusted_app_all);

21
fingerprint/Android.bp Normal file
View file

@ -0,0 +1,21 @@
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_binary {
name: "dump_fingerprint",
srcs: ["dump_fingerprint.cpp"],
init_rc: ["init.fingerprint.dump.rc"],
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
shared_libs: [
"libbase",
"libdump",
"liblog",
],
vendor: true,
relative_install_path: "dump",
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2024 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 <dump/pixel_dump.h>
#include <log/log.h>
#include <stdio.h>
#include <string.h>
static constexpr const char *kTombstonesDirPath = "/data/vendor/tombstones/fingerprint/";
int main() {
printf("------ Fingerprint tombstones ------\n");
std::unique_ptr<DIR, decltype(&closedir)> tombstones_dir(opendir(kTombstonesDirPath), closedir);
if (tombstones_dir) {
dirent *entry;
while ((entry = readdir(tombstones_dir.get())) != nullptr) {
std::string file_name(entry->d_name);
if (!strcmp(file_name.c_str(), ".") || !strcmp(file_name.c_str(), ".."))
continue;
std::string file_path(kTombstonesDirPath + file_name);
dumpFileContent(file_name.c_str(), file_path.c_str());
}
}
return 0;
}

View file

@ -0,0 +1,3 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/fingerprint/sepolicy
PRODUCT_PACKAGES += dump_fingerprint

View file

@ -0,0 +1,2 @@
on post-fs-data
mkdir /data/vendor/tombstones/fingerprint 0770 system system

View file

@ -0,0 +1,5 @@
pixel_bugreport(dump_fingerprint)
allow dump_fingerprint fingerprint_vendor_data_file:dir r_dir_perms;
allow dump_fingerprint fingerprint_vendor_data_file:file r_file_perms;

View file

@ -0,0 +1,2 @@
/vendor/bin/dump/dump_fingerprint u:object_r:dump_fingerprint_exec:s0
/data/vendor/tombstones/fingerprint(/.*)? u:object_r:fingerprint_vendor_data_file:s0

View file

@ -0,0 +1 @@
allow hal_fingerprint trusty_log_device:chr_file r_file_perms;

View file

@ -0,0 +1,29 @@
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_binary {
name: "android.hardware.dumpstate.3-service",
srcs: [
"Dumpstate.cpp",
"service.cpp",
],
init_rc: ["android.hardware.dumpstate.3-service.rc"],
vintf_fragments: ["android.hardware.dumpstate.3-service.xml"],
cflags: [
"-Wall",
"-Werror",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"libcutils",
"libdumpstateutil",
"liblog",
"libutils",
"libdump",
"android.hardware.dumpstate-V1-ndk",
],
vendor: true,
relative_install_path: "hw",
}

View file

@ -0,0 +1,230 @@
/*
* Copyright 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "dumpstate_device"
#define ATRACE_TAG ATRACE_TAG_ALWAYS
#include <inttypes.h>
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <cutils/trace.h>
#include <log/log.h>
#include <sys/stat.h>
#include <dump/pixel_dump.h>
#include "Dumpstate.h"
#include "DumpstateUtil.h"
#define HW_REVISION "ro.boot.hardware.revision"
using android::os::dumpstate::CommandOptions;
using android::os::dumpstate::DumpFileToFd;
using android::os::dumpstate::PropertiesHelper;
using android::os::dumpstate::RunCommandToFd;
namespace aidl {
namespace android {
namespace hardware {
namespace dumpstate {
typedef std::chrono::time_point<std::chrono::steady_clock> timepoint_t;
const char kVerboseLoggingProperty[] = "persist.vendor.verbose_logging_enabled";
timepoint_t startSection(int fd, const std::string &sectionName) {
ATRACE_BEGIN(sectionName.c_str());
::android::base::WriteStringToFd(
"\n"
"------ Section start: " + sectionName + " ------\n"
"\n", fd);
return std::chrono::steady_clock::now();
}
void endSection(int fd, const std::string &sectionName, timepoint_t startTime) {
ATRACE_END();
auto endTime = std::chrono::steady_clock::now();
auto elapsedMsec = std::chrono::duration_cast<std::chrono::milliseconds>
(endTime - startTime).count();
::android::base::WriteStringToFd(
"\n"
"------ Section end: " + sectionName + " ------\n"
"Elapsed msec: " + std::to_string(elapsedMsec) + "\n"
"\n", fd);
}
// Dump data requested by an argument to the "dump" interface, or help info
// if the specified section is not supported.
void Dumpstate::dumpTextSection(int fd, const std::string &sectionName) {
bool dumpAll = (sectionName == kAllSections);
std::string dumpFiles;
struct dirent **dirent_list = NULL;
int num_entries = scandir("/vendor/bin/dump", &dirent_list, 0, (int (*)(const struct dirent **, const struct dirent **)) alphasort);
if (!dirent_list) {
ALOGE("Unable to scan dir: /vendor/bin/dump\n");
return;
} else if (num_entries <= 0) {
ALOGE("No file is found.\n");
return;
}
// Execute all or designated programs under vendor/bin/dump/
for (int i = 0; i < num_entries; i++) {
if (dirent_list[i]->d_name[0] == '.') {
continue;
}
std::string bin(dirent_list[i]->d_name);
dumpFiles = dumpFiles + " " + bin;
if (dumpAll || sectionName == bin) {
auto startTime = startSection(fd, bin);
RunCommandToFd(fd, "/vendor/bin/dump/"+bin, {"/vendor/bin/dump/"+bin}, CommandOptions::WithTimeout(15).Build());
endSection(fd, bin, startTime);
if (!dumpAll) {
return;
}
}
}
if (dumpAll) {
RunCommandToFd(fd, "VENDOR PROPERTIES", {"/vendor/bin/getprop"});
return;
}
// An unsupported section was requested on the command line
::android::base::WriteStringToFd("Unrecognized text section: " + sectionName + "\n", fd);
::android::base::WriteStringToFd("Try \"" + kAllSections + "\" or one of the following:", fd);
::android::base::WriteStringToFd(dumpFiles, fd);
::android::base::WriteStringToFd("\nNote: sections with attachments (e.g. dump_soc) are"
"not available from the command line.\n", fd);
while (num_entries--) {
free(dirent_list[num_entries]);
}
free(dirent_list);
}
void Dumpstate::dumpLogSection(int fd, int fd_bin)
{
std::string logDir = MODEM_LOG_DIRECTORY;
const std::string logCombined = logDir + "/combined_logs.tar";
const std::string logAllDir = logDir + "/all_logs";
RunCommandToFd(fd, "MKDIR LOG", {"/vendor/bin/mkdir", "-p", logAllDir.c_str()}, CommandOptions::WithTimeout(2).Build());
dumpTextSection(fd, kAllSections);
RunCommandToFd(fd, "TAR LOG", {"/vendor/bin/tar", "cvf", logCombined.c_str(), "-C", logAllDir.c_str(), "."}, CommandOptions::WithTimeout(20).Build());
RunCommandToFd(fd, "CHG PERM", {"/vendor/bin/chmod", "a+w", logCombined.c_str()}, CommandOptions::WithTimeout(2).Build());
std::vector<uint8_t> buffer(65536);
::android::base::unique_fd fdLog(TEMP_FAILURE_RETRY(open(logCombined.c_str(), O_RDONLY | O_CLOEXEC | O_NONBLOCK)));
if (fdLog >= 0) {
while (1) {
ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fdLog, buffer.data(), buffer.size()));
if (bytes_read == 0) {
break;
} else if (bytes_read < 0) {
ALOGD("read(%s): %s\n", logCombined.c_str(), strerror(errno));
break;
}
ssize_t result = TEMP_FAILURE_RETRY(write(fd_bin, buffer.data(), bytes_read));
if (result != bytes_read) {
ALOGD("Failed to write %zd bytes, actually written: %zd", bytes_read, result);
break;
}
}
}
RunCommandToFd(fd, "RM LOG DIR", { "/vendor/bin/rm", "-r", logAllDir.c_str()}, CommandOptions::WithTimeout(2).Build());
RunCommandToFd(fd, "RM LOG", { "/vendor/bin/rm", logCombined.c_str()}, CommandOptions::WithTimeout(2).Build());
}
ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds,
IDumpstateDevice::DumpstateMode in_mode,
int64_t in_timeoutMillis) {
ATRACE_BEGIN("dumpstateBoard");
// Unused arguments.
(void) in_timeoutMillis;
if (in_mode < IDumpstateDevice::DumpstateMode::FULL || in_mode > IDumpstateDevice::DumpstateMode::PROTO) {
ALOGE("Invalid mode: %d\n", in_mode);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "Invalid mode");
}
if (in_fds.size() < 1) {
ALOGE("no FDs\n");
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"No file descriptor");
}
int fd = in_fds[0].get();
if (fd < 0) {
ALOGE("invalid FD: %d\n", fd);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"Invalid file descriptor");
}
if (in_fds.size() < 2) {
ALOGE("no FD for dumpstate_board binary\n");
dumpTextSection(fd, "");
} else {
int fd_bin = in_fds[1].get();
dumpLogSection(fd, fd_bin);
}
ATRACE_END();
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Dumpstate::setVerboseLoggingEnabled(bool in_enable) {
::android::base::SetProperty(kVerboseLoggingProperty, in_enable ? "true" : "false");
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Dumpstate::getVerboseLoggingEnabled(bool* _aidl_return) {
*_aidl_return = ::android::base::GetBoolProperty(kVerboseLoggingProperty, false);
return ndk::ScopedAStatus::ok();
}
// Since AIDLs that support the dump() interface are automatically invoked during
// bugreport generation and we don't want to generate a second copy of the same
// data that will go into dumpstate_board.txt, this function will only do
// something if it is called with an option, e.g.
// dumpsys android.hardware.dumpstate.IDumpstateDevice/default all
//
// Also, note that sections which generate attachments and/or binary data when
// included in a bugreport are not available through the dump() interface.
binder_status_t Dumpstate::dump(int fd, const char** args, uint32_t numArgs) {
if (numArgs != 1) {
return STATUS_OK;
}
dumpTextSection(fd, static_cast<std::string>(args[0]));
fsync(fd);
return STATUS_OK;
}
} // namespace dumpstate
} // namespace hardware
} // namespace android
} // namespace aidl

View file

@ -0,0 +1,53 @@
/*
* 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.
*/
#pragma once
#include <aidl/android/hardware/dumpstate/BnDumpstateDevice.h>
#include <aidl/android/hardware/dumpstate/IDumpstateDevice.h>
#include <android/binder_status.h>
namespace aidl {
namespace android {
namespace hardware {
namespace dumpstate {
class Dumpstate : public BnDumpstateDevice {
public:
::ndk::ScopedAStatus dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds,
IDumpstateDevice::DumpstateMode in_mode,
int64_t in_timeoutMillis) override;
::ndk::ScopedAStatus getVerboseLoggingEnabled(bool* _aidl_return) override;
::ndk::ScopedAStatus setVerboseLoggingEnabled(bool in_enable) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
private:
const std::string kAllSections = "all";
void dumpTextSection(int fd, std::string const& sectionName);
void dumpLogSection(int fd, int fdModem);
//bool getVerboseLoggingEnabledImpl();
//::ndk::ScopedAStatus dumpstateBoardImpl(const int fd, const bool full);
};
} // namespace dumpstate
} // namespace hardware
} // namespace android
} // namespace aidl

View file

@ -0,0 +1,4 @@
PRODUCT_SOONG_NAMESPACES += device/google/gs-common/gear/dumpstate_v3
PRODUCT_PACKAGES += android.hardware.dumpstate.3-service
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gear/dumpstate_v3/sepolicy

View file

@ -0,0 +1,5 @@
service vendor.dumpstate-default /vendor/bin/hw/android.hardware.dumpstate.3-service
class hal
user system
group system shell
interface aidl android.hardware.dumpstate.IDumpstateDevice/default

View file

@ -0,0 +1,9 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.dumpstate</name>
<interface>
<name>IDumpstateDevice</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View file

@ -0,0 +1,6 @@
# dumpstate packing directory
type radio_vendor_data_file, file_type, data_file_type;
userdebug_or_eng(`
typeattribute radio_vendor_data_file mlstrustedobject;
')

View file

@ -0,0 +1,5 @@
# generic dumpstate for pixel
/vendor/bin/hw/android\.hardware\.dumpstate\.3-service u:object_r:hal_dumpstate_default_exec:s0
/data/vendor/radio(/.*)? u:object_r:radio_vendor_data_file:s0

View file

@ -0,0 +1,7 @@
# required permission to use tar to pack dumpsate_board.bin
allow hal_dumpstate_default vendor_toolbox_exec:file execute_no_trans;
allow hal_dumpstate_default radio_vendor_data_file:dir create_dir_perms;
allow hal_dumpstate_default radio_vendor_data_file:file create_file_perms;
allow hal_dumpstate_default shell_data_file:file getattr;
set_prop(hal_dumpstate_default, vendor_logger_prop)

View file

@ -0,0 +1,3 @@
# verbose property
vendor_internal_prop(vendor_logger_prop)

View file

@ -0,0 +1,3 @@
# verbose property name
persist.vendor.verbose_logging_enabled u:object_r:vendor_logger_prop:s0

View file

@ -0,0 +1,37 @@
/*
* 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 "android.hardware.dumpstate.3-service"
#include "Dumpstate.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using aidl::android::hardware::dumpstate::Dumpstate;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Dumpstate> dumpstate = ndk::SharedRefBase::make<Dumpstate>();
const std::string instance = std::string() + Dumpstate::descriptor + "/default";
binder_status_t status =
AServiceManager_addService(dumpstate->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // Unreachable
}

View file

@ -1,19 +0,0 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gps/lsi/sepolicy
PRODUCT_SOONG_NAMESPACES += \
vendor/samsung_slsi/gps/s5400
PRODUCT_PACKAGES += \
android.hardware.location.gps.prebuilt.xml \
gnssd \
android.hardware.gnss-service \
ca.pem \
gnss_check.sh \
kepler.bin
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_VENDOR_PROPERTIES += vendor.gps.aol.enabled=true
endif
# Enable Pixel GNSS HAL
include device/google/gs-common/gps/pixel/pixel_gnss_hal.mk

View file

@ -0,0 +1 @@
type vendor_gnss_device, dev_type;

View file

@ -1 +0,0 @@
type vendor_gps_file, file_type, data_file_type;

View file

@ -7,6 +7,4 @@
/vendor/bin/hw/swcnd u:object_r:swcnd_exec:s0
/vendor/bin/hw/spad u:object_r:spad_exec:s0
/vendor/bin/hw/android.hardware.gnss-service u:object_r:hal_gnss_default_exec:s0
/vendor/bin/gnss_check\.sh u:object_r:gnss_check_exec:s0
# keep only one rule and use eGNSS one
# /data/vendor/gps(/.*)? u:object_r:vendor_gps_file:s0
/data/vendor/gps(/.*)? u:object_r:vendor_gps_file:s0

View file

@ -31,3 +31,6 @@ set_prop(gnssd, vendor_gps_prop)
# Read RIL property
get_prop(gnssd, vendor_rild_prop)
# Read modme state
allow gnssd sysfs_modem_state:file r_file_perms;

View file

@ -1,10 +0,0 @@
<compatibility-matrix version="1.0" type="framework" level="8">
<hal format="aidl" optional="true">
<name>android.hardware.gnss</name>
<version>3</version>
<interface>
<name>IGnss</name>
<instance>vendor</instance>
</interface>
</hal>
</compatibility-matrix>

View file

@ -1,15 +0,0 @@
# Include this file to enable Pixel GNSS HAL
$(call soong_config_set, pixel_gnss, enable_pixel_gnss_aidl_service, true)
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gps/pixel/sepolicy
PRODUCT_PACKAGES += \
android.hardware.gnss-service.pixel
PRODUCT_VENDOR_PROPERTIES += \
persist.vendor.gps.hal.service.name=vendor
# Compatibility matrix
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += \
device/google/gs-common/gps/pixel/device_framework_matrix_product.xml

View file

@ -1 +0,0 @@
type sysfs_modem_state, sysfs_type, fs_type;

View file

@ -1,9 +1,3 @@
type hal_gnss_pixel, domain;
hal_server_domain(hal_gnss_pixel, hal_gnss)
type hal_gnss_pixel_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_gnss_pixel)
#IPC between pixel and vendor HAL
binder_call(hal_gnss_pixel, hal_gnss_default)
@ -12,3 +6,18 @@ allow hal_gnss_pixel sysfs_modem_state:file r_file_perms;
#Toggle coredump node
allow hal_gnss_pixel sysfs_gps:file rw_file_perms;
# Allow access to CHRE multiclient HAL.
get_prop(hal_gnss_pixel, vendor_chre_hal_prop)
# Allow binder to CHRE.
binder_call(hal_gnss_pixel, hal_contexthub_default)
allow hal_gnss_pixel hal_contexthub_service:service_manager find;
# Allow connect to gnss service
allow hal_gnss_pixel vendor_gps_file:dir create_dir_perms;
allow hal_gnss_pixel vendor_gps_file:fifo_file create_file_perms;
# Allow access ssrdump information
allow hal_gnss_pixel sscoredump_vendor_data_crashinfo_file:file r_file_perms;
allow hal_gnss_pixel sscoredump_vendor_data_crashinfo_file:dir r_dir_perms;

View file

@ -0,0 +1,4 @@
# Note that native/passthrough HALs use the "{type}/{instance}" pattern from
# SEPolicy perspective and are looked up via the corresponding filename
# "{type}.{instance}.so".
mapper/pixel u:object_r:hal_graphics_mapper_service:s0

View file

@ -14,9 +14,11 @@
* limitations under the License.
*/
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <errno.h>
#include <fcntl.h>
@ -26,21 +28,28 @@
#include <string.h>
#include <unistd.h>
#define DEV_GLOB "/sys/devices/platform/*.watchdog_cl0/watchdog/watchdog*"
#include <chrono>
#include <vector>
#define DEV_GLOB "/sys/devices/platform/*.watchdog_cl*/watchdog/watchdog*"
#define DEFAULT_INTERVAL 10s
#define DEFAULT_MARGIN 10s
using android::base::Basename;
using android::base::StringPrintf;
using std::literals::chrono_literals::operator""s;
int main(int argc, char** argv) {
android::base::InitLogging(argv, &android::base::KernelLogger);
int interval = 10;
if (argc >= 2) interval = atoi(argv[1]);
std::chrono::seconds interval = argc >= 2
? std::chrono::seconds(atoi(argv[1])) : DEFAULT_INTERVAL;
std::chrono::seconds margin = argc >= 3
? std::chrono::seconds(atoi(argv[2])) : DEFAULT_MARGIN;
int margin = 10;
if (argc >= 3) margin = atoi(argv[2]);
LOG(INFO) << "gs_watchdogd started (interval " << interval << ", margin " << margin << ")!";
LOG(INFO) << "gs_watchdogd started (interval " << interval.count()
<< ", margin " << margin.count() << ")!";
glob_t globbuf;
int ret = glob(DEV_GLOB, GLOB_MARK, nullptr, &globbuf);
@ -49,40 +58,42 @@ int main(int argc, char** argv) {
return 1;
}
if (globbuf.gl_pathc > 1) {
PLOG(WARNING) << "Multiple watchdog dev path found by " << DEV_GLOB;
}
std::vector<android::base::unique_fd> wdt_dev_fds;
std::string dev_path = StringPrintf("/dev/%s", Basename(globbuf.gl_pathv[0]).c_str());
globfree(&globbuf);
for (size_t i = 0; i < globbuf.gl_pathc; i++) {
std::chrono::seconds timeout = interval + margin;
int timeout_secs = timeout.count();
std::string dev_path = StringPrintf("/dev/%s", Basename(globbuf.gl_pathv[i]).c_str());
int fd = open(dev_path.c_str(), O_RDWR | O_CLOEXEC);
if (fd == -1) {
PLOG(ERROR) << "Failed to open " << dev_path;
return 1;
}
int fd = TEMP_FAILURE_RETRY(open(dev_path.c_str(), O_RDWR | O_CLOEXEC));
if (fd == -1) {
PLOG(ERROR) << "Failed to open " << dev_path;
return 1;
}
int timeout = interval + margin;
ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
if (ret) {
PLOG(ERROR) << "Failed to set timeout to " << timeout;
ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
wdt_dev_fds.emplace_back(fd);
ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout_secs);
if (ret) {
PLOG(ERROR) << "Failed to get timeout";
} else {
if (timeout > margin) {
interval = timeout - margin;
PLOG(ERROR) << "Failed to set timeout to " << timeout_secs;
ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout_secs);
if (ret) {
PLOG(ERROR) << "Failed to get timeout";
} else {
interval = 1;
interval = timeout > margin ? timeout - margin : 1s;
LOG(WARNING) << "Adjusted interval to timeout returned by driver: "
<< "timeout " << timeout_secs
<< ", interval " << interval.count()
<< ", margin " << margin.count();
}
LOG(WARNING) << "Adjusted interval to timeout returned by driver: "
<< "timeout " << timeout << ", interval " << interval << ", margin "
<< margin;
}
}
globfree(&globbuf);
while (true) {
write(fd, "", 1);
sleep(interval);
for (const auto& fd : wdt_dev_fds) {
TEMP_FAILURE_RETRY(write(fd, "", 1));
}
sleep(interval.count());
}
}

View file

@ -17,7 +17,7 @@
#include <android-base/properties.h>
#include <android-base/file.h>
#define maxGxpDebugDumps 3
#define maxGxpDebugDumps 4
int main() {
/* TODO(b/277094681): Set default value to false around device beta milestone. */

View file

@ -19,7 +19,7 @@
#define GYOTAKU_DIRECTORY "/data/vendor/gyotaku/andlog"
#define GYOTAKU_ANDROID_LOG_PREFIX "android_"
#define GYOTAKU_ODPM_LOG_PREFIX "odpm_"
#define maxFileLogsNumber 30
int main() {
@ -30,6 +30,7 @@ int main() {
}
dumpLogs(GYOTAKU_DIRECTORY, outputDir.c_str(), maxFileLogsNumber, GYOTAKU_ANDROID_LOG_PREFIX);
dumpLogs(GYOTAKU_DIRECTORY, outputDir.c_str(), maxFileLogsNumber, GYOTAKU_ODPM_LOG_PREFIX);
return 0;
}

View file

@ -0,0 +1,19 @@
# Specific build for fingerprint
type gyotaku_app, domain;
app_domain(gyotaku_app)
net_domain(gyotaku_app)
# For Gyotaku app common use
allow gyotaku_app app_api_service:service_manager find;
allow gyotaku_app privapp_data_file:lnk_file read;
allow gyotaku_app system_app_data_file:dir create_dir_perms;
allow gyotaku_app system_app_data_file:file create_file_perms;
# For getproperty isDebuggable use
get_prop(gyotaku_app, userdebug_or_eng_prop)
# For access /data/vendor/misc fingerprint use.
allow gyotaku_app vendor_misc_data_file:dir search;
allow gyotaku_app vendor_fingerprint_data_file:dir r_dir_perms;
allow gyotaku_app vendor_fingerprint_data_file:file r_file_perms;

View file

@ -0,0 +1,2 @@
# Gyotaku app
user=system seinfo=platform name=com.google.android.apps.internal.gyotaku domain=gyotaku_app type=system_app_data_file levelFrom=all

View file

@ -0,0 +1,5 @@
# Specific build for fingerprint
PRODUCT_PACKAGES_DEBUG += \
Gyotaku
BOARD_SEPOLICY_DIRS += device/google/gs-common/gyotaku_app/fingerprint

14
insmod/16k/Android.bp Normal file
View file

@ -0,0 +1,14 @@
soong_namespace {
}
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
sh_binary {
name: "insmod.sh",
src: "insmod.sh",
init_rc: ["init.module.rc"],
vendor: true,
}

119
insmod/16k/insmod.sh Normal file
View file

@ -0,0 +1,119 @@
#!/vendor/bin/sh
#############################################################
### init.insmod.cfg format: ###
### ----------------------------------------------------- ###
### [insmod|setprop|enable/moprobe|wait] [path|prop name] ###
### ... ###
#############################################################
modules_dir=
system_modules_dir=
vendor_modules_dir=
pagesize=$(getconf PAGESIZE)
# bootoption=$(getprop ro.product.build.16k_page.enabled)
# We do not need to check ro.product.build.16k_page.enabled , because this
# version of insmod.sh will only be used if PRODUCT_16K_DEVELOPER_OPTION
# is set to true
if [ "$pagesize" != "4096" ] ; then
echo "Device has page size $pagesize , skip loading modules from vendor_dlkm/system_dlkm because all modules are stored on vendor_boot"
setprop vendor.common.modules.ready 1
setprop vendor.device.modules.ready 1
setprop vendor.all.modules.ready 1
setprop vendor.all.devices.ready 1
return 0
fi
for dir in system vendor; do
for f in /${dir}/lib/modules/*/modules.dep /${dir}/lib/modules/modules.dep; do
if [[ -f "$f" ]]; then
if [[ "${dir}" == "system" ]]; then
system_modules_dir="$(dirname "$f")"
else
vendor_modules_dir="$(dirname "$f")"
modules_dir=${vendor_modules_dir}
fi
break
fi
done
done
if [[ -z "${system_modules_dir}" ]]; then
echo "Unable to locate system kernel modules directory" 2>&1
fi
if [[ -z "${vendor_modules_dir}" ]]; then
echo "Unable to locate vendor kernel modules directory" 2>&1
exit 1
fi
# imitates wait_for_file() in init
wait_for_file()
{
filename="${1}"
timeout="${2:-5}"
expiry=$(($(date "+%s")+timeout))
while [[ ! -e "${filename}" ]] && [[ "$(date "+%s")" -le "${expiry}" ]]
do
sleep 0.01
done
}
if [ $# -eq 1 ]; then
cfg_file=$1
else
# Set property even if there is no insmod config
# to unblock early-boot trigger
setprop vendor.common.modules.ready 1
setprop vendor.device.modules.ready 1
setprop vendor.all.modules.ready 1
setprop vendor.all.devices.ready 1
exit 1
fi
if [ -f $cfg_file ]; then
while IFS="|" read -r action arg
do
case $action in
"insmod") insmod $arg ;;
"setprop") setprop $arg 1 ;;
"enable") echo 1 > $arg ;;
"condinsmod")
prop=$(echo $arg | cut -d '|' -f 1)
module1=$(echo $arg | cut -d '|' -f 2)
module2=$(echo $arg | cut -d '|' -f 3)
value=$(getprop $prop)
if [[ ${value} == "true" ]]; then
insmod ${vendor_modules_dir}/${module1}
else
insmod ${vendor_modules_dir}/${module2}
fi
;;
"modprobe")
case ${arg} in
"system -b *" | "system -b")
modules_dir=${system_modules_dir}
arg="-b --all=${system_modules_dir}/modules.load" ;;
"system *" | "system")
modules_dir=${system_modules_dir}
arg="--all=${system_modules_dir}/modules.load" ;;
"-b *" | "-b" | "vendor -b *" | "vendor -b")
modules_dir=${vendor_modules_dir}
arg="-b --all=${vendor_modules_dir}/modules.load" ;;
"*" | "" | "vendor *" | "vendor")
modules_dir=${vendor_modules_dir}
arg="--all=${vendor_modules_dir}/modules.load" ;;
esac
if [[ -d "${modules_dir}" ]]; then
modprobe -a -d "${modules_dir}" $arg
fi
;;
"wait") wait_for_file $arg ;;
esac
done < $cfg_file
fi

13
insmod/4k/Android.bp Normal file
View file

@ -0,0 +1,13 @@
soong_namespace {
}
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
sh_binary {
name: "insmod.sh",
src: "insmod.sh",
init_rc: ["init.module.rc"],
vendor: true,
}

10
insmod/4k/init.module.rc Normal file
View file

@ -0,0 +1,10 @@
on init
# Loading common kernel modules in background
start insmod_sh
service insmod_sh /vendor/bin/insmod.sh /vendor/etc/init.common.cfg
class main
user root
group root system
disabled
oneshot

View file

@ -66,6 +66,17 @@ if [ -f $cfg_file ]; then
"insmod") insmod $arg ;;
"setprop") setprop $arg 1 ;;
"enable") echo 1 > $arg ;;
"condinsmod")
prop=$(echo $arg | cut -d '|' -f 1)
module1=$(echo $arg | cut -d '|' -f 2)
module2=$(echo $arg | cut -d '|' -f 3)
value=$(getprop $prop)
if [[ ${value} == "true" ]]; then
insmod ${vendor_modules_dir}/${module1}
else
insmod ${vendor_modules_dir}/${module2}
fi
;;
"modprobe")
case ${arg} in
"system -b *" | "system -b")

View file

@ -2,13 +2,6 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
sh_binary {
name: "insmod.sh",
src: "insmod.sh",
init_rc: ["init.module.rc"],
vendor: true,
}
prebuilt_etc {
name: "init.common.cfg",
src: "init.common.cfg",

View file

@ -1,3 +1,9 @@
ifeq (true,$(PRODUCT_16K_DEVELOPER_OPTION))
PRODUCT_SOONG_NAMESPACES += device/google/gs-common/insmod/16k
else
PRODUCT_SOONG_NAMESPACES += device/google/gs-common/insmod/4k
endif
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/insmod/sepolicy
PRODUCT_PACKAGES += \
insmod.sh \

View file

@ -0,0 +1,11 @@
<compatibility-matrix version="1.0" type="framework">
<!-- Optional since older devices will not register any services. -->
<hal format="aidl" optional="true">
<name>com.google.pixel.shared_modem_platform</name>
<version>1</version>
<interface>
<name>ISharedModemPlatform</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View file

@ -0,0 +1 @@
hal_attribute(shared_modem_platform)

View file

@ -0,0 +1,8 @@
# Allow binder connection from client to server
binder_call(hal_shared_modem_platform_client, hal_shared_modem_platform_server)
# Allow client to find the service, server to register the service
hal_attribute_service(hal_shared_modem_platform, hal_shared_modem_platform_service)
# Allow binder communication from server to service_manager
binder_use(hal_shared_modem_platform_server)

View file

@ -0,0 +1 @@
type hal_shared_modem_platform_service, hal_service_type, service_manager_type;

View file

@ -0,0 +1,2 @@
# Bind Shared Modem Platform AIDL service name to the SELinux type.
com.google.pixel.shared_modem_platform.ISharedModemPlatform/default u:object_r:hal_shared_modem_platform_service:s0

View file

@ -0,0 +1,11 @@
# This file is not included in `modem.mk` since this is included at the
# beginning of each `device.mk` file, and so will be called before
# `SHARED_MODEM_PLATFORM_VENDOR` is defined later in the file.
SOONG_CONFIG_NAMESPACES += shared_modem_platform
SOONG_CONFIG_shared_modem_platform += \
vendor
SOONG_CONFIG_shared_modem_platform_vendor := $(SHARED_MODEM_PLATFORM_VENDOR)
PRODUCT_PACKAGES += shared_modem_platform
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/modem/shared_modem_platform/compatibility_matrix.xml
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/modem/shared_modem_platform/sepolicy

View file

@ -3,6 +3,3 @@ include build/make/target/product/fullmte.mk
PRODUCT_MODULE_BUILD_FROM_SOURCE := true
BOARD_KERNEL_CMDLINE += bootloader.pixel.MTE_FORCE_ON
# TODO(b/324412910): Remove this when the stack-buffer-overflow is fixed.
PRODUCT_PRODUCT_PROPERTIES += \
arm64.memtag.process.android.hardware.composer.hwc3-service.pixel=off

View file

@ -5,13 +5,14 @@ package {
cc_binary {
name: "dump_perf",
srcs: ["dump_perf.cpp"],
init_rc: ["init.pixel-mm-gs.rc"],
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
shared_libs: [
"libdump",
"libdump",
],
vendor: true,
relative_install_path: "dump",

View file

@ -18,5 +18,8 @@
int main() {
dumpFileContent("VENDOR PROC DUMP", "/proc/vendor_sched/dump_task");
dumpFileContent("BTS scenario", "/sys/kernel/debug/bts/scenario");
dumpFileContent("BTS vc", "/sys/kernel/debug/bts/vc");
dumpFileContent("BTS status", "/sys/kernel/debug/bts/status");
return 0;
}

View file

@ -0,0 +1,20 @@
# Copyright (C) 2024 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.
on init
# adjust PCP high level
write /proc/sys/vm/percpu_pagelist_high_fraction 430
# disable proactive compaction
write /proc/sys/vm/compaction_proactiveness 0

View file

@ -1,3 +1,7 @@
pixel_bugreport(dump_perf)
allow dump_perf proc_vendor_sched:file r_file_perms;
userdebug_or_eng(`
allow dump_perf vendor_bts_debugfs:dir r_dir_perms;
allow dump_perf vendor_bts_debugfs:file r_file_perms;
')

View file

@ -0,0 +1,8 @@
# proactive kill
type sysfs_pakills, fs_type, sysfs_type;
# bts dump
type vendor_bts_debugfs, fs_type, debugfs_type;
# proc_compaction_proactiveness type
type proc_compaction_proactiveness, fs_type, proc_type;

View file

@ -1 +1,4 @@
genfscon proc /sys/kernel/sched_pelt_multiplier u:object_r:proc_sched:s0
genfscon sysfs /kernel/vendor_mm/pa_kill u:object_r:sysfs_pakills:s0
genfscon debugfs /bts u:object_r:vendor_bts_debugfs:s0
genfscon proc /sys/vm/compaction_proactiveness u:object_r:proc_compaction_proactiveness:s0

View file

@ -0,0 +1,2 @@
allow hal_power_default sysfs_pakills:file rw_file_perms;
allow hal_power_default sysfs_pakills:dir r_dir_perms;

View file

@ -0,0 +1,3 @@
# MM
allow vendor_init proc_percpu_pagelist_high_fraction:file w_file_perms;
allow vendor_init proc_compaction_proactiveness:file w_file_perms;

View file

@ -0,0 +1,5 @@
PRODUCT_PACKAGES += PixelSupportPrebuilt
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/pixelsupport/sepolicy/vendor
PRODUCT_PUBLIC_SEPOLICY_DIRS += device/google/gs-common/pixelsupport/sepolicy/product/public
PRODUCT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/pixelsupport/sepolicy/product/private

View file

@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIGBzCCA++gAwIBAgIVAJriiL3+mR75mIC8e0Xqoz59LduNMA0GCSqGSIb3DQEBCwUAMIGSMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEU
MBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxLjAsBgNVBAMMJWNvbV9nb29n
bGVfYW5kcm9pZF9hcHBzX3BpeGVsX3N1cHBvcnQwIBcNMjIxMjEyMTM1MDA3WhgPMjA1MjEyMTIx
MzUwMDdaMIGSMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91
bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxLjAsBgNV
BAMMJWNvbV9nb29nbGVfYW5kcm9pZF9hcHBzX3BpeGVsX3N1cHBvcnQwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCSWvRumhZOIAZmWKcuVjc1l3OIIWc/nSRVnsfdzeRqK0jwVFcTqMDs
kmZtEj/UTW+N91ExRzWvAQ027AcE7TGF3X2iKKAfpSB0fpVQato5RIzOrRbwgAzsIvBdVtExqSNk
5vh8xJ0azHt6Jn77gW03Mq7AL55Si5q3vU1meeGBPD/YWeqd/oNhPfe0kAHdNnnTOnN6SBxSeO8r
YukV4XYJ3BxgWD1sm2NI8kZ+OGAooBFflZYXoY6NVfLXm6jsqWnooAok7CrNxZc/wstiwd8yYX6f
6R1Trox3a9xOy7E+6Rig0XhbWm4pbp3Zu0OLArUalbQ1cjd1qFy6q9maieBn14ad+UtLNOUjCx91
hLWg/mdpYCvArQb3bBDJdjYfdoo7Q8F9QW3JrFrbIeBezM4TTdK9v/sM4+1OxEo6vwMKQM9Ata/H
Mn89a4nFHgRqGIMKK8zh0Eob+OwiBakviVhAI1o7IONujcJ2hfuyHNPZb8sT0Rewxtw2fD/Jwj+l
ADmlXWw553geFcwP1SqOC6j/XOeazSvV4ccCME2VZqIE4pmL+RUr+cgAyQHXPZnet74C7K9sNRV6
JluS6inqP4lKp7gSFuVrQNYHawNPVinbeTLYEu+df3m3yrHAUpaSvsSUC6qQVWCs0sI8PC6A1+bV
DXMsIYRvrSnmtN75vOECaQIDAQABo1AwTjAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBTODyZ1S/is
Y/2ZuMl8B1M6kFiJwDAfBgNVHSMEGDAWgBTODyZ1S/isY/2ZuMl8B1M6kFiJwDANBgkqhkiG9w0B
AQsFAAOCAgEAL26IGjeu8Q5tn/b4vfYa+7bRUwozAJA9Buyduw/4wVG6rIAkpEsghkgnoOvyjD72
ncbCkDoBV3a1PLw2W/bMQWfZvYScOzc2yFwcR9LdQIiEYmtgnwuJHnqc2MDsh+MDeclblyBYfIQQ
bpZ0JArKalSmDyul0QIcfHq+RKmGAzC3bx0xigclIZJxXEG4tyQylttnqNodAEqYdhMMRajI3w9t
61QwqNv1KTGJt1sC2Q7NyzbZJo02Kwu711Dw6KnVgHaGKC2sRIixsvjm2s6f9/CcVasuLopkJnyl
epPeD2jHwHdE4/c2K5ZVQeZ+R0pIOEBKwg1AVkn+/UTbhpjYCkEGP09e8T45Y+//eMlrbORJAbji
H5cfD9aSO2z4slN4B4w+Fw9Kn+a7bsN2xhv7lvAgQ92aq9g/YS1YysZ7kSoCpmKl7rN+0V/RGRVP
ab2Cb0C3+JewTnOAF30e7zVs9Vaq3oTAV4XFYNiDRUBU/rvv8EIZKcBdufFJmCGYUpmm1EQQdsTt
mFMPEh5I4Qd0sy+HKvLjThcMGHqDX0bCeXkbFZdj0GXPOOt5LX8NZBdnsbVgENrZml318uLEj3ZU
DlojsfsTlVcs5eIPX6Dkx0OdgVcMAXnLF+vjP/ygWuLqiPFPCrZD1b+2g2P9Yip3e221tuyca42b
q3bvQEBwOsA=
-----END CERTIFICATE-----

Some files were not shown because too many files have changed in this diff Show more