From 18b0387a49752b17e5db7e5567a4660d21dc9a24 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Tue, 25 Jul 2017 17:27:54 -0700 Subject: [PATCH 001/300] allow radio app to read /proc/cmdline avc: granted { read open } for comm="main" path="/proc/cmdline" dev="proc" ino=4026532072 scontext=u:r:radio:s0 tcontext=u:object_r:proc:s0 tclass=filea Bug: 28760354 Test: build Change-Id: Iaa51560d84725b99375f9eb3bd47bd6fd490703d --- sepolicy/vendor/radio.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index 2beb473c..38a4b132 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -25,3 +25,6 @@ r_dir_file(radio, sysfs_msm_subsys) allow radio avtimer_device:chr_file r_file_perms; binder_call(radio, hal_imsrtp) + +# read /proc/cmdline +allow radio proc:file r_file_perms; From 6f19c5609254e9163aaa480dda00b92b40c63575 Mon Sep 17 00:00:00 2001 From: Patrick Tjin Date: Fri, 21 Jul 2017 13:30:50 -0700 Subject: [PATCH 002/300] Add ramoops decryption Bug: 37554629 Bug: 37553996 Test: Walleye/Taimen able to decrypt ramoops Change-Id: I834460a0d8dc878aef511ebac47335eb30e53980 --- device.mk | 3 ++- init.hardware.rc | 21 +++++++++++++++++++++ init.ramoops.sh | 20 ++++++++++++++++++++ sepolicy/private/device.te | 1 + sepolicy/private/file_contexts | 11 ++++++++--- sepolicy/private/genfs_contexts | 4 ++++ sepolicy/private/property.te | 1 + sepolicy/private/property_contexts | 1 + sepolicy/private/ramoops.te | 20 ++++++++++++++++++++ sepolicy/public/file.te | 1 + 10 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 init.ramoops.sh create mode 100644 sepolicy/private/device.te create mode 100644 sepolicy/private/genfs_contexts create mode 100644 sepolicy/private/property.te create mode 100644 sepolicy/private/property_contexts create mode 100644 sepolicy/private/ramoops.te diff --git a/device.mk b/device.mk index 30bf66a4..64629b68 100755 --- a/device.mk +++ b/device.mk @@ -66,7 +66,8 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/uinput-fpc.idc:system/usr/idc/uinput-fpc.idc \ $(LOCAL_PATH)/init.qcom.devstart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.devstart.sh \ $(LOCAL_PATH)/init.qcom.ipastart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.ipastart.sh \ - $(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh + $(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \ + $(LOCAL_PATH)/init.ramoops.sh:$(TARGET_COPY_OUT_SYSTEM)/bin/init.ramoops.sh ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) PRODUCT_COPY_FILES += \ diff --git a/init.hardware.rc b/init.hardware.rc index 3dae048d..295e26f4 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -226,6 +226,12 @@ on post-fs # Wait qseecomd started wait_for_prop sys.listeners.registered true +on property:sys.user.0.ce_available=true + mkdir /data/misc_ce/0/ramoops + start ramoops_sh + +on property:sys.ramoops.decrypted=true + mount pstore pstore /sys/fs/pstore on property:sys.listeners.registered=true # load IPA FWs @@ -459,6 +465,13 @@ on boot # default country code setprop ro.boot.wificountrycode 00 + # Encrypted ramoops + umount /sys/fs/pstore + chmod 770 /dev/access-ramoops + chown system system /dev/access-ramoops + chmod 770 /dev/access-metadata + chown system system /dev/access-metadata + # Make the ftm4 command node writeable from dumpstate chown system system /sys/devices/virtual/input/ftm4_touch/cmd @@ -775,3 +788,11 @@ service insmod_sh /vendor/bin/init.insmod.sh group root system disabled oneshot + +service ramoops_sh /system/bin/init.ramoops.sh + class main + user root + group root system + disabled + oneshot + diff --git a/init.ramoops.sh b/init.ramoops.sh new file mode 100644 index 00000000..3457c219 --- /dev/null +++ b/init.ramoops.sh @@ -0,0 +1,20 @@ +#!/system/bin/sh + +# Decrypt the keys and write them to the kernel +ramoops -D + +if [ $? -eq 0 ]; then + # Pivot (and decrypt) and remount pstore + echo 1 > /sys/devices/virtual/ramoops/pstore/use_alt + setprop sys.ramoops.decrypted true +else + setprop sys.ramoops.decrypted Error-$? +fi + +# Generate keys (if none exist), and load the keys to carveout +if [[ $(getprop ro.hardware) == "walleye" ]]; then + ramoops -g -l -c +else + ramoops -g -l +fi + diff --git a/sepolicy/private/device.te b/sepolicy/private/device.te new file mode 100644 index 00000000..ae7cadd7 --- /dev/null +++ b/sepolicy/private/device.te @@ -0,0 +1 @@ +type ramoops_device, dev_type; diff --git a/sepolicy/private/file_contexts b/sepolicy/private/file_contexts index 53de7756..88cdca05 100644 --- a/sepolicy/private/file_contexts +++ b/sepolicy/private/file_contexts @@ -1,3 +1,8 @@ -/system/bin/folio_daemon u:object_r:folio_daemon_exec:s0 -/data/misc/elabel(/.*)? u:object_r:elabel_data_file:s0 -/system/bin/init\.elabel\.sh u:object_r:init_elabel_exec:s0 +/system/bin/folio_daemon u:object_r:folio_daemon_exec:s0 +/data/misc/elabel(/.*)? u:object_r:elabel_data_file:s0 +/system/bin/init\.elabel\.sh u:object_r:init_elabel_exec:s0 +/system/bin/ramoops u:object_r:ramoops_exec:s0 +/system/bin/init\.ramoops\.sh u:object_r:ramoops_exec:s0 +/dev/access-metadata u:object_r:ramoops_device:s0 +/dev/access-ramoops u:object_r:ramoops_device:s0 +/data/misc_ce/[0-9]+/ramoops(/.*)? u:object_r:ramoops_data_file:s0 diff --git a/sepolicy/private/genfs_contexts b/sepolicy/private/genfs_contexts new file mode 100644 index 00000000..9c5764a5 --- /dev/null +++ b/sepolicy/private/genfs_contexts @@ -0,0 +1,4 @@ +genfscon sysfs /devices/virtual/ramoops/pstore/aes_key u:object_r:sysfs_pstore:s0 +genfscon sysfs /devices/virtual/ramoops/pstore/aes_key_iv u:object_r:sysfs_pstore:s0 +genfscon sysfs /devices/virtual/ramoops/pstore/aes_key_tag u:object_r:sysfs_pstore:s0 +genfscon sysfs /devices/virtual/ramoops/pstore/use_alt u:object_r:sysfs_pstore:s0 diff --git a/sepolicy/private/property.te b/sepolicy/private/property.te new file mode 100644 index 00000000..cc8bd9c5 --- /dev/null +++ b/sepolicy/private/property.te @@ -0,0 +1 @@ +type ramoops_prop, property_type; diff --git a/sepolicy/private/property_contexts b/sepolicy/private/property_contexts new file mode 100644 index 00000000..3a5384cc --- /dev/null +++ b/sepolicy/private/property_contexts @@ -0,0 +1 @@ +sys.ramoops.decrypted u:object_r:ramoops_prop:s0 diff --git a/sepolicy/private/ramoops.te b/sepolicy/private/ramoops.te new file mode 100644 index 00000000..57161d95 --- /dev/null +++ b/sepolicy/private/ramoops.te @@ -0,0 +1,20 @@ +type ramoops, domain, coredomain; +type ramoops_data_file, file_type, data_file_type; +type ramoops_exec, exec_type, file_type; + +init_daemon_domain(ramoops); + +# kmod=crypto-gcm(aes) +dontaudit ramoops kernel:system module_request; + +allow ramoops ramoops_exec:file rx_file_perms; +allow ramoops shell_exec:file rx_file_perms; +allow ramoops toolbox_exec:file rx_file_perms; + +# Set the sys.ramoops.decrypted property +set_prop(ramoops, ramoops_prop); + +allow ramoops sysfs_pstore:file rw_file_perms; +allow ramoops ramoops_device:chr_file rw_file_perms; +allow ramoops ramoops_data_file:file create_file_perms; +allow ramoops ramoops_data_file:dir rw_dir_perms; diff --git a/sepolicy/public/file.te b/sepolicy/public/file.te index cc8ee0af..ad98df70 100644 --- a/sepolicy/public/file.te +++ b/sepolicy/public/file.te @@ -1 +1,2 @@ type elabel_data_file, file_type, data_file_type; +type sysfs_pstore, sysfs_type, fs_type; From ef5546c01f5a6a5cea4d563e3ca6e4bbab4be756 Mon Sep 17 00:00:00 2001 From: Fabrizio Basso Date: Tue, 1 Aug 2017 15:32:40 -0700 Subject: [PATCH 003/300] Switch to Easel build. BUG: 36403152. Change-Id: Ic76aef8b6d966f130c7154c08b8b52f7d1dbc577 --- BoardConfig.mk | 2 +- ueventd.hardware.rc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index c84faa2f..ba9d7abb 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -106,7 +106,7 @@ TARGET_USES_AOSP := true BOARD_QTI_CAMERA_32BIT_ONLY := true CAMERA_DAEMON_NOT_PRESENT := true TARGET_USES_ION := true -TARGET_USES_PAINTBOX := true +TARGET_USES_EASEL := true BOARD_USES_EASEL := true # GPS diff --git a/ueventd.hardware.rc b/ueventd.hardware.rc index e3f73621..b6408602 100644 --- a/ueventd.hardware.rc +++ b/ueventd.hardware.rc @@ -103,7 +103,7 @@ /sys/devices/soc/soc:fp_fpc* irq 0600 system system /sys/devices/soc/soc:fp_fpc* wakeup_enable 0200 system system -# Paintbox/Easel +# Easel /dev/easelcomm-client 0660 cameraserver camera /dev/mnh_sm 0664 cameraserver camera From 5293ae6d482aa4b8515b5592f4fb96470c7a734c Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Wed, 2 Aug 2017 13:28:45 -0700 Subject: [PATCH 004/300] Add libunwindstack to the list of vndk libraries. Bug: 23762183 Test: Builds. Change-Id: Ib3f0852e396b343c73eb24da3b7f4dd1d53a0a70 --- device.mk | 1 + vndk/Android.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/device.mk b/device.mk index e1dd3694..07705655 100755 --- a/device.mk +++ b/device.mk @@ -562,6 +562,7 @@ PRODUCT_PACKAGES += \ libcompiler_rt.vndk-sp\ libbacktrace.vndk-sp\ libunwind.vndk-sp\ + libunwindstack.vndk-sp\ liblzma.vndk-sp\ libz.vndk-sp\ diff --git a/vndk/Android.mk b/vndk/Android.mk index eb4fbc36..63e8e747 100644 --- a/vndk/Android.mk +++ b/vndk/Android.mk @@ -24,6 +24,7 @@ VNDK_SP_LIBRARIES := \ libcompiler_rt\ libbacktrace\ libunwind\ + libunwindstack\ liblzma\ define add-vndk-sp-lib From 374c6b66fa56742be5438151d83f3450e621bddb Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 28 Jul 2017 09:50:20 -0700 Subject: [PATCH 005/300] Enable BOARD_VNDK_VERSION=current. Test: boots to UI, camera (incl video and slow motion) Test: YouTube works, wifi works Bug: 37342627 Change-Id: I9ab52c1002733c6757614dfd888167742ddb0127 --- BoardConfig.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index c84faa2f..da6cb602 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -164,3 +164,5 @@ BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true # Use mke2fs to create ext4 images TARGET_USES_MKE2FS := true + +BOARD_VNDK_VERSION := current From 231f1829be8d308b9bf7d0227da4ccd6a2f7a04c Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Wed, 26 Jul 2017 14:04:05 -0700 Subject: [PATCH 006/300] Offload HAL Service: Utilities Provides the implementation of utilities to convert between HIDL format of data types used in Offload HAL service and the format used by CHRE. Added unit tests to verify conversions. Bug: 32842314 Test: VTS and Unit tests Change-Id: I042c49d5f62310c305b557e0f3cdee7ab376d5d8 --- wifi_offload/Android.bp | 10 +- wifi_offload/offload_utils.cpp | 285 ++++++++++++++++++ wifi_offload/offload_utils.h | 30 ++ .../test/offload_hal_test_constants.cpp | 91 ++++++ .../test/offload_hal_test_constants.h | 74 +++++ wifi_offload/test/offload_hal_test_utils.cpp | 200 ++++++++++++ wifi_offload/test/offload_hal_test_utils.h | 47 +++ wifi_offload/test/offload_utils_test.cpp | 73 +++++ 8 files changed, 809 insertions(+), 1 deletion(-) create mode 100644 wifi_offload/offload_utils.cpp create mode 100644 wifi_offload/offload_utils.h create mode 100644 wifi_offload/test/offload_hal_test_constants.cpp create mode 100644 wifi_offload/test/offload_hal_test_constants.h create mode 100644 wifi_offload/test/offload_hal_test_utils.cpp create mode 100644 wifi_offload/test/offload_hal_test_utils.h create mode 100644 wifi_offload/test/offload_utils_test.cpp diff --git a/wifi_offload/Android.bp b/wifi_offload/Android.bp index 8f466e52..9f6fe4e7 100644 --- a/wifi_offload/Android.bp +++ b/wifi_offload/Android.bp @@ -22,6 +22,7 @@ cc_library_static { "offload_server.cpp", "chre_interface_factory.cpp", "offload_status_util.cpp", + "offload_utils.cpp", ], cflags: ["-Wall", "-Wextra"], shared_libs: [ @@ -33,7 +34,8 @@ cc_library_static { "android.hardware.wifi.offload@1.0", ], whole_static_libs: [ - "chre_client" + "chre_client", + "wifi_offload_nanoapp", ] } @@ -68,6 +70,9 @@ cc_test { "test/mock_chre_interface.cpp", "test/offload_server_test.cpp", "test/chre_interface_test.cpp", + "test/offload_utils_test.cpp", + "test/offload_hal_test_constants.cpp", + "test/offload_hal_test_utils.cpp", ], local_include_dirs: [ "test", @@ -87,5 +92,8 @@ cc_test { "libgtest", "android.hardware.wifi.offload@1.0-lib", ], + whole_static_libs: [ + "wifi_offload_nanoapp", + ], } diff --git a/wifi_offload/offload_utils.cpp b/wifi_offload/offload_utils.cpp new file mode 100644 index 00000000..90d4b9ae --- /dev/null +++ b/wifi_offload/offload_utils.cpp @@ -0,0 +1,285 @@ +/* + * Copyright (C) 2016, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "offload_utils.h" + +#include +#include + +namespace { + +bool ToHidlRecordName(const wifi_offload::RpcLogRecord::RpcLogRecordType& chreRecordType, + android::hardware::wifi::offload::V1_0::RecordName* hidlRecordName) { + bool result = true; + switch (chreRecordType) { + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_INIT: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_INT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_CONFIG_SCANS: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_CONFIG_SCANS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_SUBSCRIBE_SCAN_RESULTS: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::CMD_SUBSCRIBE_SCAN_RESULTS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_UNSUBSCRIBE_SCAN_RESULTS: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::CMD_UNSUBSCRIBE_SCAN_RESULTS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_GET_SCAN_STATS: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::CMD_GET_SCAN_STATS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_RESET: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_RESET; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT_ASYNC: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT_ASYNC; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_SCAN_RESULT: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_SCAN_RESULT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_ABORT: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_ABORT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_ERROR: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_ERROR; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_SCAN: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::REQ_SCAN; + break; + default: + result = false; + break; + } + return result; +} + +uint8_t ToChreSecurityMode(uint8_t hidlSecurityMode) { + uint8_t chreSecurityMode = 0; + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::OPEN) { + chreSecurityMode |= wifi_offload::SecurityMode::OPEN; + } + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::WEP) { + chreSecurityMode |= wifi_offload::SecurityMode::WEP; + } + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::PSK) { + chreSecurityMode |= wifi_offload::SecurityMode::PSK; + } + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::EAP) { + chreSecurityMode |= wifi_offload::SecurityMode::EAP; + } + return chreSecurityMode; +} + +uint8_t ToHidlSecurityMode(uint8_t chreSecurityMode) { + uint8_t hidlSecurityMode = 0; + if (chreSecurityMode & wifi_offload::SecurityMode::OPEN) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::OPEN; + } + if (chreSecurityMode & wifi_offload::SecurityMode::WEP) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::WEP; + } + if (chreSecurityMode & wifi_offload::SecurityMode::PSK) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::PSK; + } + if (chreSecurityMode & wifi_offload::SecurityMode::EAP) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::EAP; + } + return hidlSecurityMode; +} + +} // namespace + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_utils { + +bool ToHidlScanResult(const wifi_offload::ScanResult& chreScanResult, ScanResult* hidlScanResult) { + if (hidlScanResult == nullptr) { + return false; + } + hidlScanResult->tsf = chreScanResult.tsf_; + hidlScanResult->capability = chreScanResult.capability_; + hidlScanResult->rssi = chreScanResult.rssi_dbm_; + hidlScanResult->frequency = chreScanResult.frequency_scanned_mhz_; + memcpy(&hidlScanResult->bssid[0], &chreScanResult.bssid_[0], + wifi_offload::ScanResult::kBssidSize); + chreWifiSsidListItem chreWifiSsid; + chreScanResult.ssid_.ToChreWifiSsidListItem(&chreWifiSsid); + std::vector ssid; + for (size_t i = 0; i < chreWifiSsid.ssidLen; i++) { + ssid.push_back(chreWifiSsid.ssid[i]); + } + hidlScanResult->networkInfo.ssid = ssid; + hidlScanResult->networkInfo.flags = ToHidlSecurityMode(chreScanResult.security_modes_); + return true; +} + +bool ToHidlScanResults(const std::vector& chreScanResults, + std::vector* hidlScanResults) { + LOG(VERBOSE) << "ScanResults from CHRE, size=" << chreScanResults.size(); + for (const auto& scan_result_from_nano_app : chreScanResults) { + ScanResult hidl_scan_result; + if (!ToHidlScanResult(scan_result_from_nano_app, &hidl_scan_result)) { + return false; + } + hidlScanResults->push_back(hidl_scan_result); + } + return true; +} + +bool ToHidlScanStats(const wifi_offload::ScanStats& chreScanStats, ScanStats* hidlScanStats) { + hidlScanStats->subscriptionDurationMs = chreScanStats.last_subscription_duration_ms_; + hidlScanStats->numScansRequestedByWifi = chreScanStats.num_scans_requested_by_nanoapp_; + hidlScanStats->numScansServicedByWifi = chreScanStats.num_scans_serviced_by_hardware_; + hidlScanStats->numScansServicedbyCache = chreScanStats.num_scans_serviced_by_cache_; + std::vector hidlScanRecords; + for (const auto& chreScanRecord : chreScanStats.scan_records_) { + ScanRecord hidlScanRecord; + hidlScanRecord.durationMs = chreScanRecord.time_spent_scanning_ms_; + hidlScanRecord.numChannelsScanned = chreScanRecord.num_channels_scanned_; + hidlScanRecord.numEntriesAggregated = chreScanRecord.num_entries_aggregated_; + hidlScanRecords.push_back(hidlScanRecord); + } + hidlScanStats->scanRecord = hidlScanRecords; + std::vector logRecords; + for (const auto& chreLogRecord : chreScanStats.rpc_log_records_) { + LogRecord logRecord; + if (!ToHidlRecordName(chreLogRecord.record_type_, &logRecord.recordName)) { + return false; + } + logRecord.logTimeMs = chreLogRecord.timestamp_chre_ms_; + logRecords.push_back(logRecord); + } + hidlScanStats->logRecord = logRecords; + for (size_t i = 0; i < hidlScanStats->histogramChannelsScanned.elementCount(); i++) { + hidlScanStats->histogramChannelsScanned[i] = + chreScanStats.channel_histogram_.GetChannelScanCount(i); + } + return true; +} + +bool ToChreScanConfig(const ScanParam& param, const ScanFilter& filter, + wifi_offload::ScanConfig* scanConfig) { + scanConfig->scan_params_.disconnected_mode_scan_interval_ms_ = + param.disconnectedModeScanIntervalMs; + for (const auto& ssid : param.ssidList) { + wifi_offload::Ssid chreSsid; + chreSsid.SetData(ssid.data(), ssid.size()); + scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid); + } + for (const auto& freq : param.frequencyList) { + scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(freq); + } + scanConfig->scan_filter_.min_rssi_threshold_dbm_ = filter.rssiThreshold; + for (const auto& nwInfo : filter.preferredNetworkInfoList) { + wifi_offload::PreferredNetwork chreNwInfo; + chreNwInfo.security_modes_ = ToChreSecurityMode(nwInfo.flags); + chreNwInfo.ssid_.SetData(nwInfo.ssid.data(), nwInfo.ssid.size()); + scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo)); + } + return true; +} + +bool ToHidlErrorMessage(uint32_t errorCode, std::string* errorMessage) { + bool reportError = true; + switch (errorCode) { + case wifi_offload::ErrorCode::FAILED_TO_ALLOCATE_MESSAGE_BUFFER: + *errorMessage = "Failed to allocate message buffer"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SERIALIZE_MESSAGE: + *errorMessage = "Failed to serialize message"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_MESSAGE: + *errorMessage = "Failed to send message"; + break; + case wifi_offload::ErrorCode::FAILED_TO_DESERIALIZE_SCAN_CONFIG: + *errorMessage = "Failed to deserialize scan config"; + break; + case wifi_offload::ErrorCode::INVALID_SUBSCRIBE_MESSAGE_SIZE: + *errorMessage = "Invalid subscribe message size"; + break; + case wifi_offload::ErrorCode::SCAN_CONFIG_NOT_INITIALIZED: + *errorMessage = "Scan config not initialized"; + break; + case wifi_offload::ErrorCode::UNSPECIFIED_HOST_ENDPOINT: + *errorMessage = "Unspecified host end point"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_SCAN_RESULTS: + *errorMessage = "Failed to send scan results"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_SCAN_STATS: + *errorMessage = "Failed to send scan stats"; + break; + case wifi_offload::ErrorCode::ONDEMAND_SCAN_NOT_SUPPORTED: + *errorMessage = "On demand scans not supported"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_ONDEMAND_SCAN_REQUEST: + *errorMessage = "Failed to send on demand scan request"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_ONDEMAND_SCAN_REQUEST_ASYNC: + *errorMessage = "Failed to send on demand scan request async"; + break; + case wifi_offload::ErrorCode::OUT_OF_ORDER_SCAN_RESULTS: + *errorMessage = "Out of order scan results"; + break; + case wifi_offload::ErrorCode::INCOMPLETE_SCAN_RESULTS_BEFORE_SCAN_REQUEST: + *errorMessage = "Incomplete scan results before scan request"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SET_SCAN_TIMER: + *errorMessage = "Failed to set scan timer"; + break; + case wifi_offload::ErrorCode::SCAN_MONITORING_NOT_SUPPORTED: + *errorMessage = "Scan Monitoring not supported"; + break; + case wifi_offload::ErrorCode::FAILED_TO_START_SCAN_MONITORING: + *errorMessage = "Failed to start scan monitoring"; + reportError = false; + break; + case wifi_offload::ErrorCode::FAILED_TO_STOP_SCAN_MONITORING: + *errorMessage = "Failed to stop scan monitoring"; + reportError = false; + break; + case wifi_offload::ErrorCode::FAILED_TO_CONFIGURE_SCAN_MONITORING_ASYNC: + *errorMessage = "Failed to configure scan monitoring async"; + reportError = false; + break; + default: + *errorMessage = "Invalid error code"; + reportError = false; + break; + } + return reportError; +} + +} // namespace offload_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi_offload/offload_utils.h b/wifi_offload/offload_utils.h new file mode 100644 index 00000000..ef087c9f --- /dev/null +++ b/wifi_offload/offload_utils.h @@ -0,0 +1,30 @@ +#ifndef WIFI_OFFLOAD_SERVER_UTILS_H_ +#define WIFI_OFFLOAD_SERVER_UTILS_H_ + +#include +#include + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_utils { + +bool ToHidlScanResults(const std::vector& chreScanResults, + std::vector* hidlScanResults); +bool ToHidlScanStats(const wifi_offload::ScanStats& chreScanStats, ScanStats* hildScanStats); +bool ToChreScanConfig(const ScanParam& param, const ScanFilter& filter, + wifi_offload::ScanConfig* scanConfig); +bool ToHidlErrorMessage(uint32_t errorCode, std::string* errorMessage); + +} // namespace offload_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_OFFLOAD_SERVER_UTILS_H_ diff --git a/wifi_offload/test/offload_hal_test_constants.cpp b/wifi_offload/test/offload_hal_test_constants.cpp new file mode 100644 index 00000000..805090de --- /dev/null +++ b/wifi_offload/test/offload_hal_test_constants.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "offload_hal_test_constants.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_constants { + +const uint8_t kSsid1[] = {'G', 'o', 'o', 'g', 'l', 'e'}; +const size_t kSsid1_size = sizeof(kSsid1); +const uint8_t kSsid2[] = {'X', 'f', 'i', 'n', 'i', 't', 'y'}; +const size_t kSsid2_size = sizeof(kSsid2); +const uint8_t kBssid[6] = {0x12, 0xef, 0xa1, 0x2c, 0x97, 0x8b}; +const int16_t kRssi = -60; +const int16_t kRssiThreshold = -76; +const uint32_t kFrequency1 = 2412; +const uint32_t kFrequency2 = 2437; +const uint8_t kBssidSize = 6; +const uint64_t kTsf = 0; +const uint16_t kCapability = 0; +const uint8_t kNetworkFlags = 0; +const uint32_t kDisconnectedModeScanIntervalMs = 5000; +const uint64_t kSubscriptionDurationMs = 10000; +const uint64_t kScanDurationMs[2] = {2000, 500}; +const uint32_t kNumChannelsScanned[] = {1, 2}; +const uint8_t kChannelNotScanned = 0; +const uint32_t kDefaultNumScansRequestedByWifi = 2; +const uint32_t kDefaultNumScansServicedByWifi = 2; +const uint64_t kScanDurationTotalMs = 2000; +const uint32_t kNumChannelsTotalScanned = 3; +const uint32_t kNumChannelsInHistogram = 256; +const uint8_t kTestChannels[] = {1, 6, 11}; +const uint32_t kNumTimesChannelScanned[] = {1, 1, 255}; +const uint32_t kSystemStartTime = 32164; +const uint32_t kIncrementBetweenEvents = 10; +const size_t kRecordLength = 8; +const size_t kInvalidRecordLength = 4; + +const wifi_offload::RpcLogRecord::RpcLogRecordType kChreRecordTypeList[] = { + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_INIT, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_CONFIG_SCANS, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_SUBSCRIBE_SCAN_RESULTS, + wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_SCAN, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_SCAN_RESULT, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_UNSUBSCRIBE_SCAN_RESULTS, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_GET_SCAN_STATS, +}; + +const wifi_offload::RpcLogRecord::RpcLogRecordType kInvalidChreRecordTypeLog[] = { + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_LAST_ITEM, + wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_LAST_ITEM, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_LAST_ITEM, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_LAST_ITEM, +}; + +const android::hardware::wifi::offload::V1_0::RecordName kHidlRecordNameList[] = { + android::hardware::wifi::offload::V1_0::RecordName::CMD_INT, + android::hardware::wifi::offload::V1_0::RecordName::CMD_CONFIG_SCANS, + android::hardware::wifi::offload::V1_0::RecordName::CMD_SUBSCRIBE_SCAN_RESULTS, + android::hardware::wifi::offload::V1_0::RecordName::REQ_SCAN, + android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT, + android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_SCAN_RESULT, + android::hardware::wifi::offload::V1_0::RecordName::CMD_UNSUBSCRIBE_SCAN_RESULTS, + android::hardware::wifi::offload::V1_0::RecordName::CMD_GET_SCAN_STATS, +}; + +} // namespace offload_hal_test_constants +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi_offload/test/offload_hal_test_constants.h b/wifi_offload/test/offload_hal_test_constants.h new file mode 100644 index 00000000..195e0e8b --- /dev/null +++ b/wifi_offload/test/offload_hal_test_constants.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OFFLOAD_HAL_TEST_CONSTANTS_ +#define OFFLOAD_HAL_TEST_CONSTANTS_ + +#include + +#include "offload_utils.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_constants { + +extern const uint8_t kSsid1[]; +extern const size_t kSsid1_size; +extern const uint8_t kSsid2[]; +extern const size_t kSsid2_size; +extern const uint8_t kBssid[6]; +extern const int16_t kRssi; +extern const int16_t kRssiThreshold; +extern const uint32_t kFrequency1; +extern const uint32_t kFrequency2; +extern const uint8_t kBssidSize; +extern const uint64_t kTsf; +extern const uint16_t kCapability; +extern const uint8_t kNetworkFlags; +extern const uint32_t kDisconnectedModeScanIntervalMs; +extern const uint64_t kSubscriptionDurationMs; +extern const uint64_t kScanDurationMs[2]; +extern const uint32_t kNumChannelsScanned[]; +extern const uint8_t kChannelNotScanned; +extern const uint32_t kDefaultNumScansRequestedByWifi; +extern const uint32_t kDefaultNumScansServicedByWifi; +extern const uint64_t kScanDurationTotalMs; +extern const uint32_t kNumChannelsTotalScanned; +extern const uint32_t kNumChannelsInHistogram; +extern const uint64_t kDeathCode; +extern const uint8_t kTestChannels[]; +extern const uint32_t kNumTimesChannelScanned[]; +extern const uint32_t kSystemStartTime; +extern const uint32_t kIncrementBetweenEvents; +extern const size_t kRecordLength; +extern const size_t kInvalidRecordLength; +extern const wifi_offload::RpcLogRecord::RpcLogRecordType kChreRecordTypeList[]; +extern const wifi_offload::RpcLogRecord::RpcLogRecordType kInvalidChreRecordTypeLog[]; +extern const android::hardware::wifi::offload::V1_0::RecordName kHidlRecordNameList[]; + +} // namespace offload_hal_test_constants +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // OFFLOAD_HAL_TEST_CONSTANTS_ diff --git a/wifi_offload/test/offload_hal_test_utils.cpp b/wifi_offload/test/offload_hal_test_utils.cpp new file mode 100644 index 00000000..b58ce408 --- /dev/null +++ b/wifi_offload/test/offload_hal_test_utils.cpp @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "offload_hal_test_utils.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_utils { + +using namespace offload_hal_test_constants; + +void createChreScanResultsForTest(std::vector* chreScanResults) { + wifi_offload::ScanResult chreScanResult; + chreScanResult.security_modes_ = kNetworkFlags; + chreScanResult.capability_ = kCapability; + chreScanResult.frequency_scanned_mhz_ = kFrequency1; + chreScanResult.rssi_dbm_ = kRssi; + chreScanResult.tsf_ = kTsf; + chreScanResult.ssid_.SetData(&kSsid1[0], kSsid1_size); + memcpy(&chreScanResult.bssid_[0], &kBssid[0], kBssidSize); + chreScanResults->push_back(chreScanResult); +} + +void createChreScanStatsForTest(wifi_offload::ScanStats* chreScanStats) { + chreScanStats->num_scans_requested_by_nanoapp_ = kDefaultNumScansRequestedByWifi; + chreScanStats->num_scans_serviced_by_hardware_ = kDefaultNumScansServicedByWifi; + chreScanStats->num_scans_serviced_by_cache_ = + (kDefaultNumScansRequestedByWifi - kDefaultNumScansServicedByWifi); + for (size_t j = 0; j < kNumChannelsScanned[0] + kNumChannelsScanned[1]; j++) { + chreScanStats->channel_histogram_.IncrementScanCountForChannelForTest( + kTestChannels[j], static_cast(kNumTimesChannelScanned[j])); + } + chreScanStats->last_subscription_duration_ms_ = kSubscriptionDurationMs; + wifi_offload::ScanRecord scanRecord1; + scanRecord1.time_spent_scanning_ms_ = kScanDurationMs[0]; + scanRecord1.num_channels_scanned_ = kNumChannelsScanned[0]; + scanRecord1.num_entries_aggregated_ = 1; + chreScanStats->scan_records_.push_back(scanRecord1); + wifi_offload::ScanRecord scanRecord2; + scanRecord2.time_spent_scanning_ms_ = kScanDurationMs[1]; + scanRecord2.num_channels_scanned_ = kNumChannelsScanned[1]; + scanRecord2.num_entries_aggregated_ = 1; + chreScanStats->scan_records_.push_back(scanRecord2); + + for (size_t i = 0; i < kRecordLength; i++) { + wifi_offload::RpcLogRecord logRecord; + logRecord.record_type_ = kChreRecordTypeList[i]; + logRecord.timestamp_chre_ms_ = kSystemStartTime + i * kIncrementBetweenEvents; + chreScanStats->rpc_log_records_.push_back(logRecord); + } +} + +void createHidlScanFilterForTest(ScanFilter* scanFilter) { + std::vector nw_info_list; + NetworkInfo nwInfo1; + std::vector ssid1(kSsid1, kSsid1 + kSsid1_size); + nwInfo1.ssid = ssid1; + nwInfo1.flags = kNetworkFlags; + NetworkInfo nwInfo2; + std::vector ssid2(kSsid2, kSsid2 + kSsid2_size); + nwInfo2.ssid = ssid2; + nwInfo2.flags = kNetworkFlags; + nw_info_list.push_back(nwInfo1); + nw_info_list.push_back(nwInfo2); + scanFilter->preferredNetworkInfoList = nw_info_list; + scanFilter->rssiThreshold = kRssiThreshold; +} + +void createHidlScanParamForTest(ScanParam* scanParam) { + scanParam->disconnectedModeScanIntervalMs = kDisconnectedModeScanIntervalMs; + std::vector frequencyList{kFrequency1, kFrequency2}; + scanParam->frequencyList = frequencyList; + std::vector> ssidList; + std::vector ssid1(kSsid1, kSsid1 + kSsid1_size); + std::vector ssid2(kSsid2, kSsid2 + kSsid2_size); + ssidList.push_back(ssid1); + ssidList.push_back(ssid2); + scanParam->ssidList = ssidList; +} + +void createChreScanConfigForTest(wifi_offload::ScanConfig* scanConfig) { + scanConfig->scan_params_.disconnected_mode_scan_interval_ms_ = kDisconnectedModeScanIntervalMs; + wifi_offload::Ssid chreSsid1; + chreSsid1.SetData(&kSsid1[0], kSsid1_size); + wifi_offload::Ssid chreSsid2; + chreSsid2.SetData(&kSsid2[0], kSsid2_size); + scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid1); + scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid2); + scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(kFrequency1); + scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(kFrequency2); + scanConfig->scan_filter_.min_rssi_threshold_dbm_ = kRssiThreshold; + wifi_offload::PreferredNetwork chreNwInfo1; + chreNwInfo1.security_modes_ = kNetworkFlags; + chreNwInfo1.ssid_.SetData(&kSsid1[0], kSsid1_size); + scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo1)); + wifi_offload::PreferredNetwork chreNwInfo2; + chreNwInfo2.security_modes_ = kNetworkFlags; + chreNwInfo2.ssid_.SetData(&kSsid2[0], kSsid2_size); + scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo2)); +} + +bool validateScanResult(const std::vector& hidlScanResultsTest, + const std::vector chreScanResults) { + if (hidlScanResultsTest.size() != chreScanResults.size()) + return false; + uint32_t i = 0; + for (const auto& hidlScanResult : hidlScanResultsTest) { + if (hidlScanResult.tsf != chreScanResults[i].tsf_) + return false; + if (hidlScanResult.rssi != chreScanResults[i].rssi_dbm_) + return false; + if (hidlScanResult.capability != chreScanResults[i].capability_) + return false; + if (hidlScanResult.frequency != chreScanResults[i].frequency_scanned_mhz_) + return false; + for (int j = 0; j < kBssidSize; j++) { + if (hidlScanResult.bssid[j] != chreScanResults[i].bssid_[j]) + return false; + } + chreWifiSsidListItem chreWifiSsid; + chreScanResults[i].ssid_.ToChreWifiSsidListItem(&chreWifiSsid); + for (size_t k = 0; k < chreWifiSsid.ssidLen; k++) { + if (hidlScanResult.networkInfo.ssid[k] != chreWifiSsid.ssid[k]) + return false; + } + if (hidlScanResult.networkInfo.flags != kNetworkFlags) { + return false; + } + i++; + } + return true; +} + +bool validateScanStats(const ScanStats& hidlScanStats, + const wifi_offload::ScanStats& chreScanStats) { + if (hidlScanStats.subscriptionDurationMs != chreScanStats.last_subscription_duration_ms_) + return false; + if (hidlScanStats.numScansRequestedByWifi != chreScanStats.num_scans_requested_by_nanoapp_) + return false; + if (hidlScanStats.numScansServicedByWifi != chreScanStats.num_scans_serviced_by_hardware_) + return false; + if (hidlScanStats.numScansServicedbyCache != chreScanStats.num_scans_serviced_by_cache_) + return false; + for (uint32_t i = 0; i < kNumChannelsInHistogram; i++) { + if (hidlScanStats.histogramChannelsScanned[i] != + chreScanStats.channel_histogram_.GetChannelScanCount(i)) { + return false; + } + } + if (hidlScanStats.scanRecord.size() != chreScanStats.scan_records_.size()) + return false; + uint32_t i = 0; + for (const auto& scanRecord : hidlScanStats.scanRecord) { + if (scanRecord.durationMs != chreScanStats.scan_records_[i].time_spent_scanning_ms_) + return false; + if (scanRecord.numChannelsScanned != chreScanStats.scan_records_[i].num_channels_scanned_) + return false; + if (scanRecord.numEntriesAggregated != + chreScanStats.scan_records_[i].num_entries_aggregated_) + return false; + i++; + } + if (hidlScanStats.logRecord.size() != chreScanStats.rpc_log_records_.size()) + return false; + i = 0; + + for (const auto& logRecord : hidlScanStats.logRecord) { + if (logRecord.recordName != kHidlRecordNameList[i]) { + return false; + } + if (logRecord.logTimeMs != chreScanStats.rpc_log_records_[i].timestamp_chre_ms_) + return false; + i++; + } + return true; +} + +} // namespace offload_hal_test_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi_offload/test/offload_hal_test_utils.h b/wifi_offload/test/offload_hal_test_utils.h new file mode 100644 index 00000000..ba82a1c6 --- /dev/null +++ b/wifi_offload/test/offload_hal_test_utils.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OFFLOAD_HAL_TEST_UTILS_ +#define OFFLOAD_HAL_TEST_UTILS_ + +#include "offload_hal_test_constants.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_utils { + +void createChreScanResultsForTest(std::vector* chreScanResults); +void createChreScanStatsForTest(wifi_offload::ScanStats* chreScanStats); +void createHidlScanFilterForTest(ScanFilter* scanFilter); +void createHidlScanParamForTest(ScanParam* scanParam); +void createChreScanConfigForTest(wifi_offload::ScanConfig* scanConfig); +bool validateScanResult(const std::vector& hidlScanResultsTest, + const std::vector chreScanResults); +bool validateScanStats(const ScanStats& hidlScanStats, + const wifi_offload::ScanStats& chreScanStats); +} // namespace offload_hal_test_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // OFFLOAD_HAL_TEST_UTILS_ diff --git a/wifi_offload/test/offload_utils_test.cpp b/wifi_offload/test/offload_utils_test.cpp new file mode 100644 index 00000000..7c2e4d52 --- /dev/null +++ b/wifi_offload/test/offload_utils_test.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2016, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +#include +#include "offload_hal_test_utils.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { + +using namespace offload_hal_test_constants; + +class OffloadUtilsTest : public ::testing::Test { + protected: + virtual void SetUp() { + } + + void TearDown() override { + } +}; + +TEST_F(OffloadUtilsTest, ConvertScanResultToHidlTest) { + std::vector hidlScanResultsTest; + std::vector chreScanResultsTest; + offload_hal_test_utils::createChreScanResultsForTest(&chreScanResultsTest); + EXPECT_TRUE(offload_utils::ToHidlScanResults(chreScanResultsTest, &hidlScanResultsTest)); + EXPECT_TRUE( + offload_hal_test_utils::validateScanResult(hidlScanResultsTest, chreScanResultsTest)); +} + +TEST_F(OffloadUtilsTest, ConvertScanStatsToHidlTest) { + ScanStats hidlScanStatsTest; + wifi_offload::ScanStats chreScanStatsTest; + offload_hal_test_utils::createChreScanStatsForTest(&chreScanStatsTest); + EXPECT_TRUE(offload_utils::ToHidlScanStats(chreScanStatsTest, &hidlScanStatsTest)); + EXPECT_TRUE(offload_hal_test_utils::validateScanStats(hidlScanStatsTest, chreScanStatsTest)); +} + +TEST_F(OffloadUtilsTest, ConvertScanConfigToChreTest) { + wifi_offload::ScanConfig scanConfigTest; + wifi_offload::ScanConfig scanConfig; + ScanParam scanParamTest; + ScanFilter scanFilterTest; + offload_hal_test_utils::createHidlScanParamForTest(&scanParamTest); + offload_hal_test_utils::createHidlScanFilterForTest(&scanFilterTest); + offload_hal_test_utils::createChreScanConfigForTest(&scanConfig); + EXPECT_TRUE(offload_utils::ToChreScanConfig(scanParamTest, scanFilterTest, &scanConfigTest)); + EXPECT_TRUE(scanConfig == scanConfigTest); +} + +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android From db6fa29a1671db12149a69c2a21003ea29e21dab Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Wed, 26 Jul 2017 15:05:44 -0700 Subject: [PATCH 007/300] Offload HAL Service: Send messages to CHRE The following messages are to be sent to the nano app in response to invocation of the Offload HAL APIs from the client - subscribe, unsubsuscribe, configure scans CHRE interface will send the following commands to context hub - Get hub info and nano app list requests The callbacks from the socket will handle responses to these requests Bug: 32842314 Test: VTS Change-Id: I1e75cbbe5ad2f7c4908dfba0f56bc04e1af31776 --- wifi_offload/chre_interface.cpp | 26 +++++++++++++++++++ wifi_offload/chre_interface.h | 4 +++ wifi_offload/offload_server.cpp | 46 +++++++++++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/wifi_offload/chre_interface.cpp b/wifi_offload/chre_interface.cpp index 456e6682..448a5782 100644 --- a/wifi_offload/chre_interface.cpp +++ b/wifi_offload/chre_interface.cpp @@ -142,6 +142,9 @@ void ChreInterface::reportConnectionEvent(ChreInterfaceCallbacks::ConnectionEven switch (event) { case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: connectionStatus = true; + if (!getHubInfo() || !getNanoAppList()) { + LOG(WARNING) << "Unable to get platform and nano app info"; + } break; case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: @@ -181,6 +184,29 @@ void ChreInterface::handleMessage(uint32_t messageType, const void* messageData, mServerCallbacks->handleMessage(messageType, message); } +bool ChreInterface::getHubInfo() { + LOG(VERBOSE) << "getHubInfo"; + + FlatBufferBuilder builder(chre_constants::kHubInfoRequestBufLen); + HostProtocolHost::encodeHubInfoRequest(builder); + if (!mClient.sendMessage(builder.GetBufferPointer(), builder.GetSize())) { + LOG(WARNING) << "Failed to send Hub Info request"; + return false; + } + return true; +} + +bool ChreInterface::getNanoAppList() { + LOG(VERBOSE) << "getNanoAppList"; + FlatBufferBuilder builder(chre_constants::kNanoAppListRequestBufLen); + HostProtocolHost::encodeNanoappListRequest(builder); + + if (!mClient.sendMessage(builder.GetBufferPointer(), builder.GetSize())) { + LOG(WARNING) << "Unable to send Nano app List request"; + return false; + } + return true; +} } // namespace implementation } // namespace V1_0 } // namespace offload diff --git a/wifi_offload/chre_interface.h b/wifi_offload/chre_interface.h index 72420af5..92cfa5b6 100644 --- a/wifi_offload/chre_interface.h +++ b/wifi_offload/chre_interface.h @@ -51,6 +51,10 @@ class SocketCallbacks void handleUnloadNanoappResponse(const ::chre::fbs::UnloadNanoappResponseT& response) override; private: + /* Requests Hub Information, returns true if Hub Info request was sent */ + bool getHubInfo(); + /* Request list of Nano apps, returns true if Nano app List request was sent */ + bool getNanoAppList(); ChreInterface* mParent; }; diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 88277ec5..56e139a1 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -1,8 +1,13 @@ #include "offload_server.h" #include +#include +#include #include "offload_status_util.h" +#include "offload_utils.h" + +using namespace android::hardware::wifi::offload::V1_0::implementation::chre_constants; namespace android { namespace hardware { @@ -21,6 +26,25 @@ OffloadServer::OffloadServer(ChreInterfaceFactory* factory) OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFilter& filter) { LOG(INFO) << "configureScans"; + if (!mChreInterface->isConnected()) { + return createOffloadStatus(OffloadStatusCode::ERROR, + "Not connected to hardware implementation"); + } + wifi_offload::ScanConfig scanConfig; + if (!offload_utils::ToChreScanConfig(param, filter, &scanConfig)) { + return createOffloadStatus(OffloadStatusCode::ERROR, + "Unable to convert scan configuration"); + } + uint8_t buffer[kMaxMessageLen]; + size_t result_size = wifi_offload::fbs::Serialize(scanConfig, buffer, kMaxMessageLen); + if (result_size <= 0) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Scan config serialization failed"); + } + std::vector message(buffer, buffer + result_size); + if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_CONFIG_SCANS, + message)) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Unable to send config message"); + } return createOffloadStatus(OffloadStatusCode::OK); } @@ -32,11 +56,31 @@ std::pair OffloadServer::getScanStats() { OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { LOG(INFO) << "subscribeScanResults with delay:" << delayMs; + if (!mChreInterface->isConnected()) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Not connected to hardware"); + } + uint32_t* buffer = &delayMs; + std::vector message(reinterpret_cast(buffer), + reinterpret_cast(buffer) + kSubscriptionDelayMsBufLen); + if (!mChreInterface->sendCommandToApp( + wifi_offload::HostMessageType::HOST_CMD_SUBSCRIBE_SCAN_RESULTS, message)) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Unable to request scans"); + } return createOffloadStatus(OffloadStatusCode::OK); } bool OffloadServer::unsubscribeScanResults() { + bool result = false; LOG(INFO) << "unsubscribeScanResults"; + if (!mChreInterface->isConnected()) { + LOG(WARNING) << "Failed to send unsubscribe scan results message"; + return false; + } + if (!mChreInterface->sendCommandToApp( + wifi_offload::HostMessageType::HOST_CMD_UNSUBSCRIBE_SCAN_RESULTS, {})) { + LOG(WARNING) << "Failed to send unsubscribe scan results message"; + return false; + } return true; } @@ -46,8 +90,6 @@ bool OffloadServer::setEventCallback(const sp& cb) { if (cb != nullptr) { mEventCallback = cb; result = true; - } else { - LOG(WARNING) << "Invalid callback object"; } return result; } From 6445f68be638e6bbb656c7ed8f787ae63581d637 Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Thu, 18 May 2017 12:18:42 -0700 Subject: [PATCH 008/300] Offload HAL Service: Handle messages from Nano app The following messages from Nano app - Error, Scan stats, Scan Results Also invoke the appropriate callback to the client. Bug: 32842314 Test: VTS Change-Id: Ie69ef82fa21ccd87160c18c89e7504c08606610c --- wifi_offload/offload_server.cpp | 129 +++++++++++++++++++++++++++++--- wifi_offload/offload_server.h | 9 +++ 2 files changed, 127 insertions(+), 11 deletions(-) diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 56e139a1..877d420a 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -8,6 +8,11 @@ #include "offload_utils.h" using namespace android::hardware::wifi::offload::V1_0::implementation::chre_constants; +using android::hardware::wifi::offload::V1_0::OffloadStatus; + +namespace { +constexpr auto kScanStatsTimeout = std::chrono::milliseconds(500); +} namespace android { namespace hardware { @@ -27,7 +32,7 @@ OffloadServer::OffloadServer(ChreInterfaceFactory* factory) OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFilter& filter) { LOG(INFO) << "configureScans"; if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::ERROR, + return createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Not connected to hardware implementation"); } wifi_offload::ScanConfig scanConfig; @@ -50,14 +55,33 @@ OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFi std::pair OffloadServer::getScanStats() { LOG(INFO) << "getScanStats"; - OffloadStatus status = createOffloadStatus(OffloadStatusCode::OK); - return std::make_pair(status, mScanStats); + mScanStatsStatus = createOffloadStatus(OffloadStatusCode::OK); + if (!mChreInterface->isConnected()) { + return {createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Unable to send scan stats"), + {}}; + } + if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_GET_SCAN_STATS, + {})) { + return {createOffloadStatus(OffloadStatusCode::ERROR, "Unable to send scan stats command"), + {}}; + } + LOG(VERBOSE) << "Sent getScanStats command"; + { + std::unique_lock lock(mScanStatsLock); + auto timeout_status = mScanStatsCond.wait_for(lock, kScanStatsTimeout); + if (timeout_status == std::cv_status::timeout) { + std::lock_guard lock(mOffloadLock); + LOG(WARNING) << "Timeout waiting for scan stats"; + return {createOffloadStatus(OffloadStatusCode::TIMEOUT, "Scan stats not received"), {}}; + } + } + return std::make_pair(mScanStatsStatus, mScanStats); } OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { LOG(INFO) << "subscribeScanResults with delay:" << delayMs; if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::ERROR, "Not connected to hardware"); + return createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Not connected to hardware"); } uint32_t* buffer = &delayMs; std::vector message(reinterpret_cast(buffer), @@ -70,7 +94,6 @@ OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { } bool OffloadServer::unsubscribeScanResults() { - bool result = false; LOG(INFO) << "unsubscribeScanResults"; if (!mChreInterface->isConnected()) { LOG(WARNING) << "Failed to send unsubscribe scan results message"; @@ -86,21 +109,29 @@ bool OffloadServer::unsubscribeScanResults() { bool OffloadServer::setEventCallback(const sp& cb) { LOG(INFO) << "Set Event callback"; - bool result = false; - if (cb != nullptr) { - mEventCallback = cb; - result = true; + if (cb == nullptr) { + return false; } - return result; + std::lock_guard lock(mOffloadLock); + mEventCallback = cb; + return true; } void OffloadServer::clearEventCallback() { + std::lock_guard lock(mOffloadLock); if (mEventCallback != nullptr) { mEventCallback.clear(); } LOG(INFO) << "Event callback cleared"; } +void OffloadServer::invokeErrorCallback(const OffloadStatus& status) { + std::lock_guard lock(mOffloadLock); + if (mEventCallback != nullptr) { + mEventCallback->onError(status); + } +} + ChreInterfaceCallbacksImpl::ChreInterfaceCallbacksImpl(OffloadServer* server) : mServer(server) { } @@ -109,12 +140,88 @@ ChreInterfaceCallbacksImpl::~ChreInterfaceCallbacksImpl() { void ChreInterfaceCallbacksImpl::handleConnectionEvents( ChreInterfaceCallbacks::ConnectionEvent event) { - LOG(VERBOSE) << "Connection event received " << (int)event; + switch (event) { + case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: + case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: { + LOG(ERROR) << "Connection to socket lost"; + mServer->invokeErrorCallback( + createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Connection to socket lost")); + } break; + case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: { + LOG(INFO) << "Connected to socket"; + mServer->invokeErrorCallback(createOffloadStatus(OffloadStatusCode::OK)); + } break; + default: + LOG(WARNING) << "Invalid connection event received " << (int)event; + break; + } +} + +void OffloadServer::handleScanResult(const std::vector& message) { + std::vector scanResults; + std::vector hidlScanResults; + std::string errorMessage; + if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &scanResults)) { + invokeErrorCallback( + createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserialize scan results")); + return; + } + if (!offload_utils::ToHidlScanResults(scanResults, &hidlScanResults)) { + invokeErrorCallback(createOffloadStatus(OffloadStatusCode::ERROR, + "Cannot convert scan results to HIDL format")); + return; + } + { + std::lock_guard lock(mOffloadLock); + if (mEventCallback != nullptr) { + mEventCallback->onScanResult(hidlScanResults); + } + } +} + +void OffloadServer::handleScanStats(const std::vector& message) { + std::lock_guard lock(mScanStatsLock); + wifi_offload::ScanStats stats; + OffloadStatus status; + // Deserialize scan stats + status = createOffloadStatus(OffloadStatusCode::OK); + LOG(VERBOSE) << "Received scan stats"; + if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &stats)) { + status = createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserailize scan stats"); + } else if (!offload_utils::ToHidlScanStats(stats, &mScanStats)) { + status = createOffloadStatus(OffloadStatusCode::ERROR, + "Cannot convert Scan stats to HIDL format"); + } + mScanStatsStatus = status; + mScanStatsCond.notify_all(); } void ChreInterfaceCallbacksImpl::handleMessage(uint32_t messageType, const std::vector& message) { LOG(VERBOSE) << "Message from Nano app " << messageType; + switch (messageType) { + case wifi_offload::HostMessageType::HOST_MSG_SCAN_RESULTS: { + LOG(INFO) << "Received scan results"; + mServer->handleScanResult(message); + } break; + case wifi_offload::HostMessageType::HOST_MSG_SCAN_STATS: + LOG(VERBOSE) << "Received scan stats from Nano app"; + mServer->handleScanStats(message); + break; + case wifi_offload::HostMessageType::HOST_MSG_ERROR: + LOG(VERBOSE) << "Received error message from Nano app"; + { + std::string errorMessage; + if (offload_utils::ToHidlErrorMessage(message[0], &errorMessage)) { + mServer->invokeErrorCallback( + createOffloadStatus(OffloadStatusCode::ERROR, errorMessage)); + } + } + break; + default: + LOG(WARNING) << "Unknown message received" << messageType; + break; + } } // Methods from ::android::hidl::base::V1_0::IBase follow. diff --git a/wifi_offload/offload_server.h b/wifi_offload/offload_server.h index f10ace16..2b150b16 100644 --- a/wifi_offload/offload_server.h +++ b/wifi_offload/offload_server.h @@ -41,7 +41,16 @@ class OffloadServer { void clearEventCallback(); private: + void invokeErrorCallback(const android::hardware::wifi::offload::V1_0::OffloadStatus& status); + void handleScanResult(const std::vector& message); + void handleScanStats(const std::vector& message); + ScanStats mScanStats; + std::mutex mScanStatsLock; + std::condition_variable mScanStatsCond; + std::mutex mOffloadLock; + OffloadStatus mScanStatsStatus; + std::unique_ptr mChreInterfaceCallbacks; std::unique_ptr mChreInterface; sp mEventCallback; From 0b8ea9dd76d5bed6c057b63f95db9d998082b86b Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Fri, 28 Jul 2017 12:39:15 -0700 Subject: [PATCH 009/300] Offload HAL Service: Reset Nano app upon Error Offload HAL service reports all errors to the client. To bring Wifi Nano app to a known state, also send a RESET command to the Nano app. Bug: 32842314 Test: VTS Change-Id: I18a2988ebbd7ef8ba1919837db6a539acd3a81fc --- wifi_offload/offload_server.cpp | 29 ++++++++++++++++++++++------- wifi_offload/offload_server.h | 4 +++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 877d420a..850b9b06 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -93,6 +93,17 @@ OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { return createOffloadStatus(OffloadStatusCode::OK); } +void OffloadServer::resetNanoApp() { + LOG(INFO) << "resetting Nano app"; + if (!mChreInterface->isConnected()) { + LOG(WARNING) << "Unable to reset nano app, not connected"; + return; + } + if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_RESET, {})) { + LOG(ERROR) << "Unable to send Reset command to Nano app"; + } +} + bool OffloadServer::unsubscribeScanResults() { LOG(INFO) << "unsubscribeScanResults"; if (!mChreInterface->isConnected()) { @@ -125,7 +136,10 @@ void OffloadServer::clearEventCallback() { LOG(INFO) << "Event callback cleared"; } -void OffloadServer::invokeErrorCallback(const OffloadStatus& status) { +void OffloadServer::invokeErrorCallbackAndResetIfNeeded(const OffloadStatus& status) { + if (status.code != OffloadStatusCode::OK) { + resetNanoApp(); + } std::lock_guard lock(mOffloadLock); if (mEventCallback != nullptr) { mEventCallback->onError(status); @@ -144,12 +158,13 @@ void ChreInterfaceCallbacksImpl::handleConnectionEvents( case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: { LOG(ERROR) << "Connection to socket lost"; - mServer->invokeErrorCallback( + mServer->invokeErrorCallbackAndResetIfNeeded( createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Connection to socket lost")); } break; case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: { LOG(INFO) << "Connected to socket"; - mServer->invokeErrorCallback(createOffloadStatus(OffloadStatusCode::OK)); + mServer->invokeErrorCallbackAndResetIfNeeded( + createOffloadStatus(OffloadStatusCode::OK)); } break; default: LOG(WARNING) << "Invalid connection event received " << (int)event; @@ -162,13 +177,13 @@ void OffloadServer::handleScanResult(const std::vector& message) { std::vector hidlScanResults; std::string errorMessage; if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &scanResults)) { - invokeErrorCallback( + invokeErrorCallbackAndResetIfNeeded( createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserialize scan results")); return; } if (!offload_utils::ToHidlScanResults(scanResults, &hidlScanResults)) { - invokeErrorCallback(createOffloadStatus(OffloadStatusCode::ERROR, - "Cannot convert scan results to HIDL format")); + invokeErrorCallbackAndResetIfNeeded(createOffloadStatus( + OffloadStatusCode::ERROR, "Cannot convert scan results to HIDL format")); return; } { @@ -213,7 +228,7 @@ void ChreInterfaceCallbacksImpl::handleMessage(uint32_t messageType, { std::string errorMessage; if (offload_utils::ToHidlErrorMessage(message[0], &errorMessage)) { - mServer->invokeErrorCallback( + mServer->invokeErrorCallbackAndResetIfNeeded( createOffloadStatus(OffloadStatusCode::ERROR, errorMessage)); } } diff --git a/wifi_offload/offload_server.h b/wifi_offload/offload_server.h index 2b150b16..ac7b3469 100644 --- a/wifi_offload/offload_server.h +++ b/wifi_offload/offload_server.h @@ -41,9 +41,11 @@ class OffloadServer { void clearEventCallback(); private: - void invokeErrorCallback(const android::hardware::wifi::offload::V1_0::OffloadStatus& status); + void invokeErrorCallbackAndResetIfNeeded( + const android::hardware::wifi::offload::V1_0::OffloadStatus& status); void handleScanResult(const std::vector& message); void handleScanStats(const std::vector& message); + void resetNanoApp(); ScanStats mScanStats; std::mutex mScanStatsLock; From cedcec272b98090575dff2bd337c9a06f31c2eee Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Thu, 18 May 2017 18:56:33 -0700 Subject: [PATCH 010/300] Offload HAL Service: Enable errors for warnings Update compile flags for this module so that warnings will report errors during compilation. Also fixed one unused variable. Bug: 32842314 Test: VTS Change-Id: I0249cbbc26cbd23a3c9c5d013f303e13ea74a749 --- wifi_offload/Android.bp | 2 +- wifi_offload/Offload.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi_offload/Android.bp b/wifi_offload/Android.bp index 9f6fe4e7..730fbc4f 100644 --- a/wifi_offload/Android.bp +++ b/wifi_offload/Android.bp @@ -24,7 +24,7 @@ cc_library_static { "offload_status_util.cpp", "offload_utils.cpp", ], - cflags: ["-Wall", "-Wextra"], + cflags: ["-Wall", "-Wextra", "-Werror"], shared_libs: [ "libbase", "libhidlbase", diff --git a/wifi_offload/Offload.h b/wifi_offload/Offload.h index 4510f680..d5e9e6db 100644 --- a/wifi_offload/Offload.h +++ b/wifi_offload/Offload.h @@ -24,7 +24,7 @@ class HidlDeathHandler : public android::hardware::hidl_death_recipient { // Death notification for callbacks. void serviceDied(uint64_t cookie, - const android::wp &who) override { + const android::wp& /* who */) override { cb_.clear(); cb_function_(cookie); } From 309c9118c378a6bbfa36a1ed54292742e2fb33ad Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Tue, 15 Aug 2017 17:51:49 +0000 Subject: [PATCH 011/300] Revert "Offload HAL Service: Enable errors for warnings" This reverts commit cedcec272b98090575dff2bd337c9a06f31c2eee. Change-Id: I9077142bfcfa20ba545a405fe64e10f8e5d17b17 --- wifi_offload/Android.bp | 2 +- wifi_offload/Offload.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi_offload/Android.bp b/wifi_offload/Android.bp index 730fbc4f..9f6fe4e7 100644 --- a/wifi_offload/Android.bp +++ b/wifi_offload/Android.bp @@ -24,7 +24,7 @@ cc_library_static { "offload_status_util.cpp", "offload_utils.cpp", ], - cflags: ["-Wall", "-Wextra", "-Werror"], + cflags: ["-Wall", "-Wextra"], shared_libs: [ "libbase", "libhidlbase", diff --git a/wifi_offload/Offload.h b/wifi_offload/Offload.h index d5e9e6db..4510f680 100644 --- a/wifi_offload/Offload.h +++ b/wifi_offload/Offload.h @@ -24,7 +24,7 @@ class HidlDeathHandler : public android::hardware::hidl_death_recipient { // Death notification for callbacks. void serviceDied(uint64_t cookie, - const android::wp& /* who */) override { + const android::wp &who) override { cb_.clear(); cb_function_(cookie); } From 77b000c666aa2653cb1917e6290ede51baea1f8b Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Tue, 15 Aug 2017 17:53:05 +0000 Subject: [PATCH 012/300] Revert "Offload HAL Service: Reset Nano app upon Error" This reverts commit 0b8ea9dd76d5bed6c057b63f95db9d998082b86b. Change-Id: I8c85259925ea969f43707e321cf261c162d78858 --- wifi_offload/offload_server.cpp | 29 +++++++---------------------- wifi_offload/offload_server.h | 4 +--- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 850b9b06..877d420a 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -93,17 +93,6 @@ OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { return createOffloadStatus(OffloadStatusCode::OK); } -void OffloadServer::resetNanoApp() { - LOG(INFO) << "resetting Nano app"; - if (!mChreInterface->isConnected()) { - LOG(WARNING) << "Unable to reset nano app, not connected"; - return; - } - if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_RESET, {})) { - LOG(ERROR) << "Unable to send Reset command to Nano app"; - } -} - bool OffloadServer::unsubscribeScanResults() { LOG(INFO) << "unsubscribeScanResults"; if (!mChreInterface->isConnected()) { @@ -136,10 +125,7 @@ void OffloadServer::clearEventCallback() { LOG(INFO) << "Event callback cleared"; } -void OffloadServer::invokeErrorCallbackAndResetIfNeeded(const OffloadStatus& status) { - if (status.code != OffloadStatusCode::OK) { - resetNanoApp(); - } +void OffloadServer::invokeErrorCallback(const OffloadStatus& status) { std::lock_guard lock(mOffloadLock); if (mEventCallback != nullptr) { mEventCallback->onError(status); @@ -158,13 +144,12 @@ void ChreInterfaceCallbacksImpl::handleConnectionEvents( case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: { LOG(ERROR) << "Connection to socket lost"; - mServer->invokeErrorCallbackAndResetIfNeeded( + mServer->invokeErrorCallback( createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Connection to socket lost")); } break; case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: { LOG(INFO) << "Connected to socket"; - mServer->invokeErrorCallbackAndResetIfNeeded( - createOffloadStatus(OffloadStatusCode::OK)); + mServer->invokeErrorCallback(createOffloadStatus(OffloadStatusCode::OK)); } break; default: LOG(WARNING) << "Invalid connection event received " << (int)event; @@ -177,13 +162,13 @@ void OffloadServer::handleScanResult(const std::vector& message) { std::vector hidlScanResults; std::string errorMessage; if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &scanResults)) { - invokeErrorCallbackAndResetIfNeeded( + invokeErrorCallback( createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserialize scan results")); return; } if (!offload_utils::ToHidlScanResults(scanResults, &hidlScanResults)) { - invokeErrorCallbackAndResetIfNeeded(createOffloadStatus( - OffloadStatusCode::ERROR, "Cannot convert scan results to HIDL format")); + invokeErrorCallback(createOffloadStatus(OffloadStatusCode::ERROR, + "Cannot convert scan results to HIDL format")); return; } { @@ -228,7 +213,7 @@ void ChreInterfaceCallbacksImpl::handleMessage(uint32_t messageType, { std::string errorMessage; if (offload_utils::ToHidlErrorMessage(message[0], &errorMessage)) { - mServer->invokeErrorCallbackAndResetIfNeeded( + mServer->invokeErrorCallback( createOffloadStatus(OffloadStatusCode::ERROR, errorMessage)); } } diff --git a/wifi_offload/offload_server.h b/wifi_offload/offload_server.h index ac7b3469..2b150b16 100644 --- a/wifi_offload/offload_server.h +++ b/wifi_offload/offload_server.h @@ -41,11 +41,9 @@ class OffloadServer { void clearEventCallback(); private: - void invokeErrorCallbackAndResetIfNeeded( - const android::hardware::wifi::offload::V1_0::OffloadStatus& status); + void invokeErrorCallback(const android::hardware::wifi::offload::V1_0::OffloadStatus& status); void handleScanResult(const std::vector& message); void handleScanStats(const std::vector& message); - void resetNanoApp(); ScanStats mScanStats; std::mutex mScanStatsLock; From ccfa7a28078ba07a185d7b984a4bc58d2535f3a8 Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Tue, 15 Aug 2017 18:01:47 +0000 Subject: [PATCH 013/300] Revert "Offload HAL Service: Handle messages from Nano app" This reverts commit 6445f68be638e6bbb656c7ed8f787ae63581d637. Change-Id: Ic34b12752bbbb5957d7b929a3b6b7d6552a7d596 --- wifi_offload/offload_server.cpp | 129 +++----------------------------- wifi_offload/offload_server.h | 9 --- 2 files changed, 11 insertions(+), 127 deletions(-) diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 877d420a..56e139a1 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -8,11 +8,6 @@ #include "offload_utils.h" using namespace android::hardware::wifi::offload::V1_0::implementation::chre_constants; -using android::hardware::wifi::offload::V1_0::OffloadStatus; - -namespace { -constexpr auto kScanStatsTimeout = std::chrono::milliseconds(500); -} namespace android { namespace hardware { @@ -32,7 +27,7 @@ OffloadServer::OffloadServer(ChreInterfaceFactory* factory) OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFilter& filter) { LOG(INFO) << "configureScans"; if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::NO_CONNECTION, + return createOffloadStatus(OffloadStatusCode::ERROR, "Not connected to hardware implementation"); } wifi_offload::ScanConfig scanConfig; @@ -55,33 +50,14 @@ OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFi std::pair OffloadServer::getScanStats() { LOG(INFO) << "getScanStats"; - mScanStatsStatus = createOffloadStatus(OffloadStatusCode::OK); - if (!mChreInterface->isConnected()) { - return {createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Unable to send scan stats"), - {}}; - } - if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_GET_SCAN_STATS, - {})) { - return {createOffloadStatus(OffloadStatusCode::ERROR, "Unable to send scan stats command"), - {}}; - } - LOG(VERBOSE) << "Sent getScanStats command"; - { - std::unique_lock lock(mScanStatsLock); - auto timeout_status = mScanStatsCond.wait_for(lock, kScanStatsTimeout); - if (timeout_status == std::cv_status::timeout) { - std::lock_guard lock(mOffloadLock); - LOG(WARNING) << "Timeout waiting for scan stats"; - return {createOffloadStatus(OffloadStatusCode::TIMEOUT, "Scan stats not received"), {}}; - } - } - return std::make_pair(mScanStatsStatus, mScanStats); + OffloadStatus status = createOffloadStatus(OffloadStatusCode::OK); + return std::make_pair(status, mScanStats); } OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { LOG(INFO) << "subscribeScanResults with delay:" << delayMs; if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Not connected to hardware"); + return createOffloadStatus(OffloadStatusCode::ERROR, "Not connected to hardware"); } uint32_t* buffer = &delayMs; std::vector message(reinterpret_cast(buffer), @@ -94,6 +70,7 @@ OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { } bool OffloadServer::unsubscribeScanResults() { + bool result = false; LOG(INFO) << "unsubscribeScanResults"; if (!mChreInterface->isConnected()) { LOG(WARNING) << "Failed to send unsubscribe scan results message"; @@ -109,29 +86,21 @@ bool OffloadServer::unsubscribeScanResults() { bool OffloadServer::setEventCallback(const sp& cb) { LOG(INFO) << "Set Event callback"; - if (cb == nullptr) { - return false; + bool result = false; + if (cb != nullptr) { + mEventCallback = cb; + result = true; } - std::lock_guard lock(mOffloadLock); - mEventCallback = cb; - return true; + return result; } void OffloadServer::clearEventCallback() { - std::lock_guard lock(mOffloadLock); if (mEventCallback != nullptr) { mEventCallback.clear(); } LOG(INFO) << "Event callback cleared"; } -void OffloadServer::invokeErrorCallback(const OffloadStatus& status) { - std::lock_guard lock(mOffloadLock); - if (mEventCallback != nullptr) { - mEventCallback->onError(status); - } -} - ChreInterfaceCallbacksImpl::ChreInterfaceCallbacksImpl(OffloadServer* server) : mServer(server) { } @@ -140,88 +109,12 @@ ChreInterfaceCallbacksImpl::~ChreInterfaceCallbacksImpl() { void ChreInterfaceCallbacksImpl::handleConnectionEvents( ChreInterfaceCallbacks::ConnectionEvent event) { - switch (event) { - case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: - case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: { - LOG(ERROR) << "Connection to socket lost"; - mServer->invokeErrorCallback( - createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Connection to socket lost")); - } break; - case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: { - LOG(INFO) << "Connected to socket"; - mServer->invokeErrorCallback(createOffloadStatus(OffloadStatusCode::OK)); - } break; - default: - LOG(WARNING) << "Invalid connection event received " << (int)event; - break; - } -} - -void OffloadServer::handleScanResult(const std::vector& message) { - std::vector scanResults; - std::vector hidlScanResults; - std::string errorMessage; - if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &scanResults)) { - invokeErrorCallback( - createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserialize scan results")); - return; - } - if (!offload_utils::ToHidlScanResults(scanResults, &hidlScanResults)) { - invokeErrorCallback(createOffloadStatus(OffloadStatusCode::ERROR, - "Cannot convert scan results to HIDL format")); - return; - } - { - std::lock_guard lock(mOffloadLock); - if (mEventCallback != nullptr) { - mEventCallback->onScanResult(hidlScanResults); - } - } -} - -void OffloadServer::handleScanStats(const std::vector& message) { - std::lock_guard lock(mScanStatsLock); - wifi_offload::ScanStats stats; - OffloadStatus status; - // Deserialize scan stats - status = createOffloadStatus(OffloadStatusCode::OK); - LOG(VERBOSE) << "Received scan stats"; - if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &stats)) { - status = createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserailize scan stats"); - } else if (!offload_utils::ToHidlScanStats(stats, &mScanStats)) { - status = createOffloadStatus(OffloadStatusCode::ERROR, - "Cannot convert Scan stats to HIDL format"); - } - mScanStatsStatus = status; - mScanStatsCond.notify_all(); + LOG(VERBOSE) << "Connection event received " << (int)event; } void ChreInterfaceCallbacksImpl::handleMessage(uint32_t messageType, const std::vector& message) { LOG(VERBOSE) << "Message from Nano app " << messageType; - switch (messageType) { - case wifi_offload::HostMessageType::HOST_MSG_SCAN_RESULTS: { - LOG(INFO) << "Received scan results"; - mServer->handleScanResult(message); - } break; - case wifi_offload::HostMessageType::HOST_MSG_SCAN_STATS: - LOG(VERBOSE) << "Received scan stats from Nano app"; - mServer->handleScanStats(message); - break; - case wifi_offload::HostMessageType::HOST_MSG_ERROR: - LOG(VERBOSE) << "Received error message from Nano app"; - { - std::string errorMessage; - if (offload_utils::ToHidlErrorMessage(message[0], &errorMessage)) { - mServer->invokeErrorCallback( - createOffloadStatus(OffloadStatusCode::ERROR, errorMessage)); - } - } - break; - default: - LOG(WARNING) << "Unknown message received" << messageType; - break; - } } // Methods from ::android::hidl::base::V1_0::IBase follow. diff --git a/wifi_offload/offload_server.h b/wifi_offload/offload_server.h index 2b150b16..f10ace16 100644 --- a/wifi_offload/offload_server.h +++ b/wifi_offload/offload_server.h @@ -41,16 +41,7 @@ class OffloadServer { void clearEventCallback(); private: - void invokeErrorCallback(const android::hardware::wifi::offload::V1_0::OffloadStatus& status); - void handleScanResult(const std::vector& message); - void handleScanStats(const std::vector& message); - ScanStats mScanStats; - std::mutex mScanStatsLock; - std::condition_variable mScanStatsCond; - std::mutex mOffloadLock; - OffloadStatus mScanStatsStatus; - std::unique_ptr mChreInterfaceCallbacks; std::unique_ptr mChreInterface; sp mEventCallback; From 45adb85309cf06d69aee410a9006424709f0a08c Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Tue, 15 Aug 2017 18:02:16 +0000 Subject: [PATCH 014/300] Revert "Offload HAL Service: Send messages to CHRE" This reverts commit db6fa29a1671db12149a69c2a21003ea29e21dab. Change-Id: Ida6d40f543c1498320a6d5c5b9f10e3877056f61 --- wifi_offload/chre_interface.cpp | 26 ------------------- wifi_offload/chre_interface.h | 4 --- wifi_offload/offload_server.cpp | 46 ++------------------------------- 3 files changed, 2 insertions(+), 74 deletions(-) diff --git a/wifi_offload/chre_interface.cpp b/wifi_offload/chre_interface.cpp index 448a5782..456e6682 100644 --- a/wifi_offload/chre_interface.cpp +++ b/wifi_offload/chre_interface.cpp @@ -142,9 +142,6 @@ void ChreInterface::reportConnectionEvent(ChreInterfaceCallbacks::ConnectionEven switch (event) { case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: connectionStatus = true; - if (!getHubInfo() || !getNanoAppList()) { - LOG(WARNING) << "Unable to get platform and nano app info"; - } break; case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: @@ -184,29 +181,6 @@ void ChreInterface::handleMessage(uint32_t messageType, const void* messageData, mServerCallbacks->handleMessage(messageType, message); } -bool ChreInterface::getHubInfo() { - LOG(VERBOSE) << "getHubInfo"; - - FlatBufferBuilder builder(chre_constants::kHubInfoRequestBufLen); - HostProtocolHost::encodeHubInfoRequest(builder); - if (!mClient.sendMessage(builder.GetBufferPointer(), builder.GetSize())) { - LOG(WARNING) << "Failed to send Hub Info request"; - return false; - } - return true; -} - -bool ChreInterface::getNanoAppList() { - LOG(VERBOSE) << "getNanoAppList"; - FlatBufferBuilder builder(chre_constants::kNanoAppListRequestBufLen); - HostProtocolHost::encodeNanoappListRequest(builder); - - if (!mClient.sendMessage(builder.GetBufferPointer(), builder.GetSize())) { - LOG(WARNING) << "Unable to send Nano app List request"; - return false; - } - return true; -} } // namespace implementation } // namespace V1_0 } // namespace offload diff --git a/wifi_offload/chre_interface.h b/wifi_offload/chre_interface.h index 92cfa5b6..72420af5 100644 --- a/wifi_offload/chre_interface.h +++ b/wifi_offload/chre_interface.h @@ -51,10 +51,6 @@ class SocketCallbacks void handleUnloadNanoappResponse(const ::chre::fbs::UnloadNanoappResponseT& response) override; private: - /* Requests Hub Information, returns true if Hub Info request was sent */ - bool getHubInfo(); - /* Request list of Nano apps, returns true if Nano app List request was sent */ - bool getNanoAppList(); ChreInterface* mParent; }; diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 56e139a1..88277ec5 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -1,13 +1,8 @@ #include "offload_server.h" #include -#include -#include #include "offload_status_util.h" -#include "offload_utils.h" - -using namespace android::hardware::wifi::offload::V1_0::implementation::chre_constants; namespace android { namespace hardware { @@ -26,25 +21,6 @@ OffloadServer::OffloadServer(ChreInterfaceFactory* factory) OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFilter& filter) { LOG(INFO) << "configureScans"; - if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::ERROR, - "Not connected to hardware implementation"); - } - wifi_offload::ScanConfig scanConfig; - if (!offload_utils::ToChreScanConfig(param, filter, &scanConfig)) { - return createOffloadStatus(OffloadStatusCode::ERROR, - "Unable to convert scan configuration"); - } - uint8_t buffer[kMaxMessageLen]; - size_t result_size = wifi_offload::fbs::Serialize(scanConfig, buffer, kMaxMessageLen); - if (result_size <= 0) { - return createOffloadStatus(OffloadStatusCode::ERROR, "Scan config serialization failed"); - } - std::vector message(buffer, buffer + result_size); - if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_CONFIG_SCANS, - message)) { - return createOffloadStatus(OffloadStatusCode::ERROR, "Unable to send config message"); - } return createOffloadStatus(OffloadStatusCode::OK); } @@ -56,31 +32,11 @@ std::pair OffloadServer::getScanStats() { OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { LOG(INFO) << "subscribeScanResults with delay:" << delayMs; - if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::ERROR, "Not connected to hardware"); - } - uint32_t* buffer = &delayMs; - std::vector message(reinterpret_cast(buffer), - reinterpret_cast(buffer) + kSubscriptionDelayMsBufLen); - if (!mChreInterface->sendCommandToApp( - wifi_offload::HostMessageType::HOST_CMD_SUBSCRIBE_SCAN_RESULTS, message)) { - return createOffloadStatus(OffloadStatusCode::ERROR, "Unable to request scans"); - } return createOffloadStatus(OffloadStatusCode::OK); } bool OffloadServer::unsubscribeScanResults() { - bool result = false; LOG(INFO) << "unsubscribeScanResults"; - if (!mChreInterface->isConnected()) { - LOG(WARNING) << "Failed to send unsubscribe scan results message"; - return false; - } - if (!mChreInterface->sendCommandToApp( - wifi_offload::HostMessageType::HOST_CMD_UNSUBSCRIBE_SCAN_RESULTS, {})) { - LOG(WARNING) << "Failed to send unsubscribe scan results message"; - return false; - } return true; } @@ -90,6 +46,8 @@ bool OffloadServer::setEventCallback(const sp& cb) { if (cb != nullptr) { mEventCallback = cb; result = true; + } else { + LOG(WARNING) << "Invalid callback object"; } return result; } From 40eac746bf7f5d87e472f6ffa2804155603d4995 Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Tue, 15 Aug 2017 18:02:45 +0000 Subject: [PATCH 015/300] Revert "Offload HAL Service: Utilities" This reverts commit 231f1829be8d308b9bf7d0227da4ccd6a2f7a04c. Change-Id: I17b974ad966d87d2a12469d4dc755823504d3e58 --- wifi_offload/Android.bp | 10 +- wifi_offload/offload_utils.cpp | 285 ------------------ wifi_offload/offload_utils.h | 30 -- .../test/offload_hal_test_constants.cpp | 91 ------ .../test/offload_hal_test_constants.h | 74 ----- wifi_offload/test/offload_hal_test_utils.cpp | 200 ------------ wifi_offload/test/offload_hal_test_utils.h | 47 --- wifi_offload/test/offload_utils_test.cpp | 73 ----- 8 files changed, 1 insertion(+), 809 deletions(-) delete mode 100644 wifi_offload/offload_utils.cpp delete mode 100644 wifi_offload/offload_utils.h delete mode 100644 wifi_offload/test/offload_hal_test_constants.cpp delete mode 100644 wifi_offload/test/offload_hal_test_constants.h delete mode 100644 wifi_offload/test/offload_hal_test_utils.cpp delete mode 100644 wifi_offload/test/offload_hal_test_utils.h delete mode 100644 wifi_offload/test/offload_utils_test.cpp diff --git a/wifi_offload/Android.bp b/wifi_offload/Android.bp index 9f6fe4e7..8f466e52 100644 --- a/wifi_offload/Android.bp +++ b/wifi_offload/Android.bp @@ -22,7 +22,6 @@ cc_library_static { "offload_server.cpp", "chre_interface_factory.cpp", "offload_status_util.cpp", - "offload_utils.cpp", ], cflags: ["-Wall", "-Wextra"], shared_libs: [ @@ -34,8 +33,7 @@ cc_library_static { "android.hardware.wifi.offload@1.0", ], whole_static_libs: [ - "chre_client", - "wifi_offload_nanoapp", + "chre_client" ] } @@ -70,9 +68,6 @@ cc_test { "test/mock_chre_interface.cpp", "test/offload_server_test.cpp", "test/chre_interface_test.cpp", - "test/offload_utils_test.cpp", - "test/offload_hal_test_constants.cpp", - "test/offload_hal_test_utils.cpp", ], local_include_dirs: [ "test", @@ -92,8 +87,5 @@ cc_test { "libgtest", "android.hardware.wifi.offload@1.0-lib", ], - whole_static_libs: [ - "wifi_offload_nanoapp", - ], } diff --git a/wifi_offload/offload_utils.cpp b/wifi_offload/offload_utils.cpp deleted file mode 100644 index 90d4b9ae..00000000 --- a/wifi_offload/offload_utils.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (C) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "offload_utils.h" - -#include -#include - -namespace { - -bool ToHidlRecordName(const wifi_offload::RpcLogRecord::RpcLogRecordType& chreRecordType, - android::hardware::wifi::offload::V1_0::RecordName* hidlRecordName) { - bool result = true; - switch (chreRecordType) { - case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_INIT: - *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_INT; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_CONFIG_SCANS: - *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_CONFIG_SCANS; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_SUBSCRIBE_SCAN_RESULTS: - *hidlRecordName = - android::hardware::wifi::offload::V1_0::RecordName::CMD_SUBSCRIBE_SCAN_RESULTS; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_UNSUBSCRIBE_SCAN_RESULTS: - *hidlRecordName = - android::hardware::wifi::offload::V1_0::RecordName::CMD_UNSUBSCRIBE_SCAN_RESULTS; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_GET_SCAN_STATS: - *hidlRecordName = - android::hardware::wifi::offload::V1_0::RecordName::CMD_GET_SCAN_STATS; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_RESET: - *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_RESET; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT_ASYNC: - *hidlRecordName = - android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT_ASYNC; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT: - *hidlRecordName = - android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_SCAN_RESULT: - *hidlRecordName = - android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_SCAN_RESULT; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_ABORT: - *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_ABORT; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_ERROR: - *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_ERROR; - break; - case wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_SCAN: - *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::REQ_SCAN; - break; - default: - result = false; - break; - } - return result; -} - -uint8_t ToChreSecurityMode(uint8_t hidlSecurityMode) { - uint8_t chreSecurityMode = 0; - if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::OPEN) { - chreSecurityMode |= wifi_offload::SecurityMode::OPEN; - } - if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::WEP) { - chreSecurityMode |= wifi_offload::SecurityMode::WEP; - } - if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::PSK) { - chreSecurityMode |= wifi_offload::SecurityMode::PSK; - } - if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::EAP) { - chreSecurityMode |= wifi_offload::SecurityMode::EAP; - } - return chreSecurityMode; -} - -uint8_t ToHidlSecurityMode(uint8_t chreSecurityMode) { - uint8_t hidlSecurityMode = 0; - if (chreSecurityMode & wifi_offload::SecurityMode::OPEN) { - hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::OPEN; - } - if (chreSecurityMode & wifi_offload::SecurityMode::WEP) { - hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::WEP; - } - if (chreSecurityMode & wifi_offload::SecurityMode::PSK) { - hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::PSK; - } - if (chreSecurityMode & wifi_offload::SecurityMode::EAP) { - hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::EAP; - } - return hidlSecurityMode; -} - -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace offload { -namespace V1_0 { -namespace implementation { -namespace offload_utils { - -bool ToHidlScanResult(const wifi_offload::ScanResult& chreScanResult, ScanResult* hidlScanResult) { - if (hidlScanResult == nullptr) { - return false; - } - hidlScanResult->tsf = chreScanResult.tsf_; - hidlScanResult->capability = chreScanResult.capability_; - hidlScanResult->rssi = chreScanResult.rssi_dbm_; - hidlScanResult->frequency = chreScanResult.frequency_scanned_mhz_; - memcpy(&hidlScanResult->bssid[0], &chreScanResult.bssid_[0], - wifi_offload::ScanResult::kBssidSize); - chreWifiSsidListItem chreWifiSsid; - chreScanResult.ssid_.ToChreWifiSsidListItem(&chreWifiSsid); - std::vector ssid; - for (size_t i = 0; i < chreWifiSsid.ssidLen; i++) { - ssid.push_back(chreWifiSsid.ssid[i]); - } - hidlScanResult->networkInfo.ssid = ssid; - hidlScanResult->networkInfo.flags = ToHidlSecurityMode(chreScanResult.security_modes_); - return true; -} - -bool ToHidlScanResults(const std::vector& chreScanResults, - std::vector* hidlScanResults) { - LOG(VERBOSE) << "ScanResults from CHRE, size=" << chreScanResults.size(); - for (const auto& scan_result_from_nano_app : chreScanResults) { - ScanResult hidl_scan_result; - if (!ToHidlScanResult(scan_result_from_nano_app, &hidl_scan_result)) { - return false; - } - hidlScanResults->push_back(hidl_scan_result); - } - return true; -} - -bool ToHidlScanStats(const wifi_offload::ScanStats& chreScanStats, ScanStats* hidlScanStats) { - hidlScanStats->subscriptionDurationMs = chreScanStats.last_subscription_duration_ms_; - hidlScanStats->numScansRequestedByWifi = chreScanStats.num_scans_requested_by_nanoapp_; - hidlScanStats->numScansServicedByWifi = chreScanStats.num_scans_serviced_by_hardware_; - hidlScanStats->numScansServicedbyCache = chreScanStats.num_scans_serviced_by_cache_; - std::vector hidlScanRecords; - for (const auto& chreScanRecord : chreScanStats.scan_records_) { - ScanRecord hidlScanRecord; - hidlScanRecord.durationMs = chreScanRecord.time_spent_scanning_ms_; - hidlScanRecord.numChannelsScanned = chreScanRecord.num_channels_scanned_; - hidlScanRecord.numEntriesAggregated = chreScanRecord.num_entries_aggregated_; - hidlScanRecords.push_back(hidlScanRecord); - } - hidlScanStats->scanRecord = hidlScanRecords; - std::vector logRecords; - for (const auto& chreLogRecord : chreScanStats.rpc_log_records_) { - LogRecord logRecord; - if (!ToHidlRecordName(chreLogRecord.record_type_, &logRecord.recordName)) { - return false; - } - logRecord.logTimeMs = chreLogRecord.timestamp_chre_ms_; - logRecords.push_back(logRecord); - } - hidlScanStats->logRecord = logRecords; - for (size_t i = 0; i < hidlScanStats->histogramChannelsScanned.elementCount(); i++) { - hidlScanStats->histogramChannelsScanned[i] = - chreScanStats.channel_histogram_.GetChannelScanCount(i); - } - return true; -} - -bool ToChreScanConfig(const ScanParam& param, const ScanFilter& filter, - wifi_offload::ScanConfig* scanConfig) { - scanConfig->scan_params_.disconnected_mode_scan_interval_ms_ = - param.disconnectedModeScanIntervalMs; - for (const auto& ssid : param.ssidList) { - wifi_offload::Ssid chreSsid; - chreSsid.SetData(ssid.data(), ssid.size()); - scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid); - } - for (const auto& freq : param.frequencyList) { - scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(freq); - } - scanConfig->scan_filter_.min_rssi_threshold_dbm_ = filter.rssiThreshold; - for (const auto& nwInfo : filter.preferredNetworkInfoList) { - wifi_offload::PreferredNetwork chreNwInfo; - chreNwInfo.security_modes_ = ToChreSecurityMode(nwInfo.flags); - chreNwInfo.ssid_.SetData(nwInfo.ssid.data(), nwInfo.ssid.size()); - scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo)); - } - return true; -} - -bool ToHidlErrorMessage(uint32_t errorCode, std::string* errorMessage) { - bool reportError = true; - switch (errorCode) { - case wifi_offload::ErrorCode::FAILED_TO_ALLOCATE_MESSAGE_BUFFER: - *errorMessage = "Failed to allocate message buffer"; - break; - case wifi_offload::ErrorCode::FAILED_TO_SERIALIZE_MESSAGE: - *errorMessage = "Failed to serialize message"; - break; - case wifi_offload::ErrorCode::FAILED_TO_SEND_MESSAGE: - *errorMessage = "Failed to send message"; - break; - case wifi_offload::ErrorCode::FAILED_TO_DESERIALIZE_SCAN_CONFIG: - *errorMessage = "Failed to deserialize scan config"; - break; - case wifi_offload::ErrorCode::INVALID_SUBSCRIBE_MESSAGE_SIZE: - *errorMessage = "Invalid subscribe message size"; - break; - case wifi_offload::ErrorCode::SCAN_CONFIG_NOT_INITIALIZED: - *errorMessage = "Scan config not initialized"; - break; - case wifi_offload::ErrorCode::UNSPECIFIED_HOST_ENDPOINT: - *errorMessage = "Unspecified host end point"; - break; - case wifi_offload::ErrorCode::FAILED_TO_SEND_SCAN_RESULTS: - *errorMessage = "Failed to send scan results"; - break; - case wifi_offload::ErrorCode::FAILED_TO_SEND_SCAN_STATS: - *errorMessage = "Failed to send scan stats"; - break; - case wifi_offload::ErrorCode::ONDEMAND_SCAN_NOT_SUPPORTED: - *errorMessage = "On demand scans not supported"; - break; - case wifi_offload::ErrorCode::FAILED_TO_SEND_ONDEMAND_SCAN_REQUEST: - *errorMessage = "Failed to send on demand scan request"; - break; - case wifi_offload::ErrorCode::FAILED_TO_SEND_ONDEMAND_SCAN_REQUEST_ASYNC: - *errorMessage = "Failed to send on demand scan request async"; - break; - case wifi_offload::ErrorCode::OUT_OF_ORDER_SCAN_RESULTS: - *errorMessage = "Out of order scan results"; - break; - case wifi_offload::ErrorCode::INCOMPLETE_SCAN_RESULTS_BEFORE_SCAN_REQUEST: - *errorMessage = "Incomplete scan results before scan request"; - break; - case wifi_offload::ErrorCode::FAILED_TO_SET_SCAN_TIMER: - *errorMessage = "Failed to set scan timer"; - break; - case wifi_offload::ErrorCode::SCAN_MONITORING_NOT_SUPPORTED: - *errorMessage = "Scan Monitoring not supported"; - break; - case wifi_offload::ErrorCode::FAILED_TO_START_SCAN_MONITORING: - *errorMessage = "Failed to start scan monitoring"; - reportError = false; - break; - case wifi_offload::ErrorCode::FAILED_TO_STOP_SCAN_MONITORING: - *errorMessage = "Failed to stop scan monitoring"; - reportError = false; - break; - case wifi_offload::ErrorCode::FAILED_TO_CONFIGURE_SCAN_MONITORING_ASYNC: - *errorMessage = "Failed to configure scan monitoring async"; - reportError = false; - break; - default: - *errorMessage = "Invalid error code"; - reportError = false; - break; - } - return reportError; -} - -} // namespace offload_utils -} // namespace implementation -} // namespace V1_0 -} // namespace offload -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi_offload/offload_utils.h b/wifi_offload/offload_utils.h deleted file mode 100644 index ef087c9f..00000000 --- a/wifi_offload/offload_utils.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef WIFI_OFFLOAD_SERVER_UTILS_H_ -#define WIFI_OFFLOAD_SERVER_UTILS_H_ - -#include -#include - -namespace android { -namespace hardware { -namespace wifi { -namespace offload { -namespace V1_0 { -namespace implementation { -namespace offload_utils { - -bool ToHidlScanResults(const std::vector& chreScanResults, - std::vector* hidlScanResults); -bool ToHidlScanStats(const wifi_offload::ScanStats& chreScanStats, ScanStats* hildScanStats); -bool ToChreScanConfig(const ScanParam& param, const ScanFilter& filter, - wifi_offload::ScanConfig* scanConfig); -bool ToHidlErrorMessage(uint32_t errorCode, std::string* errorMessage); - -} // namespace offload_utils -} // namespace implementation -} // namespace V1_0 -} // namespace offload -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_OFFLOAD_SERVER_UTILS_H_ diff --git a/wifi_offload/test/offload_hal_test_constants.cpp b/wifi_offload/test/offload_hal_test_constants.cpp deleted file mode 100644 index 805090de..00000000 --- a/wifi_offload/test/offload_hal_test_constants.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "offload_hal_test_constants.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace offload { -namespace V1_0 { -namespace implementation { -namespace offload_hal_test_constants { - -const uint8_t kSsid1[] = {'G', 'o', 'o', 'g', 'l', 'e'}; -const size_t kSsid1_size = sizeof(kSsid1); -const uint8_t kSsid2[] = {'X', 'f', 'i', 'n', 'i', 't', 'y'}; -const size_t kSsid2_size = sizeof(kSsid2); -const uint8_t kBssid[6] = {0x12, 0xef, 0xa1, 0x2c, 0x97, 0x8b}; -const int16_t kRssi = -60; -const int16_t kRssiThreshold = -76; -const uint32_t kFrequency1 = 2412; -const uint32_t kFrequency2 = 2437; -const uint8_t kBssidSize = 6; -const uint64_t kTsf = 0; -const uint16_t kCapability = 0; -const uint8_t kNetworkFlags = 0; -const uint32_t kDisconnectedModeScanIntervalMs = 5000; -const uint64_t kSubscriptionDurationMs = 10000; -const uint64_t kScanDurationMs[2] = {2000, 500}; -const uint32_t kNumChannelsScanned[] = {1, 2}; -const uint8_t kChannelNotScanned = 0; -const uint32_t kDefaultNumScansRequestedByWifi = 2; -const uint32_t kDefaultNumScansServicedByWifi = 2; -const uint64_t kScanDurationTotalMs = 2000; -const uint32_t kNumChannelsTotalScanned = 3; -const uint32_t kNumChannelsInHistogram = 256; -const uint8_t kTestChannels[] = {1, 6, 11}; -const uint32_t kNumTimesChannelScanned[] = {1, 1, 255}; -const uint32_t kSystemStartTime = 32164; -const uint32_t kIncrementBetweenEvents = 10; -const size_t kRecordLength = 8; -const size_t kInvalidRecordLength = 4; - -const wifi_offload::RpcLogRecord::RpcLogRecordType kChreRecordTypeList[] = { - wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_INIT, - wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_CONFIG_SCANS, - wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_SUBSCRIBE_SCAN_RESULTS, - wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_SCAN, - wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT, - wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_SCAN_RESULT, - wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_UNSUBSCRIBE_SCAN_RESULTS, - wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_GET_SCAN_STATS, -}; - -const wifi_offload::RpcLogRecord::RpcLogRecordType kInvalidChreRecordTypeLog[] = { - wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_LAST_ITEM, - wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_LAST_ITEM, - wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_LAST_ITEM, - wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_LAST_ITEM, -}; - -const android::hardware::wifi::offload::V1_0::RecordName kHidlRecordNameList[] = { - android::hardware::wifi::offload::V1_0::RecordName::CMD_INT, - android::hardware::wifi::offload::V1_0::RecordName::CMD_CONFIG_SCANS, - android::hardware::wifi::offload::V1_0::RecordName::CMD_SUBSCRIBE_SCAN_RESULTS, - android::hardware::wifi::offload::V1_0::RecordName::REQ_SCAN, - android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT, - android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_SCAN_RESULT, - android::hardware::wifi::offload::V1_0::RecordName::CMD_UNSUBSCRIBE_SCAN_RESULTS, - android::hardware::wifi::offload::V1_0::RecordName::CMD_GET_SCAN_STATS, -}; - -} // namespace offload_hal_test_constants -} // namespace implementation -} // namespace V1_0 -} // namespace offload -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi_offload/test/offload_hal_test_constants.h b/wifi_offload/test/offload_hal_test_constants.h deleted file mode 100644 index 195e0e8b..00000000 --- a/wifi_offload/test/offload_hal_test_constants.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OFFLOAD_HAL_TEST_CONSTANTS_ -#define OFFLOAD_HAL_TEST_CONSTANTS_ - -#include - -#include "offload_utils.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace offload { -namespace V1_0 { -namespace implementation { -namespace offload_hal_test_constants { - -extern const uint8_t kSsid1[]; -extern const size_t kSsid1_size; -extern const uint8_t kSsid2[]; -extern const size_t kSsid2_size; -extern const uint8_t kBssid[6]; -extern const int16_t kRssi; -extern const int16_t kRssiThreshold; -extern const uint32_t kFrequency1; -extern const uint32_t kFrequency2; -extern const uint8_t kBssidSize; -extern const uint64_t kTsf; -extern const uint16_t kCapability; -extern const uint8_t kNetworkFlags; -extern const uint32_t kDisconnectedModeScanIntervalMs; -extern const uint64_t kSubscriptionDurationMs; -extern const uint64_t kScanDurationMs[2]; -extern const uint32_t kNumChannelsScanned[]; -extern const uint8_t kChannelNotScanned; -extern const uint32_t kDefaultNumScansRequestedByWifi; -extern const uint32_t kDefaultNumScansServicedByWifi; -extern const uint64_t kScanDurationTotalMs; -extern const uint32_t kNumChannelsTotalScanned; -extern const uint32_t kNumChannelsInHistogram; -extern const uint64_t kDeathCode; -extern const uint8_t kTestChannels[]; -extern const uint32_t kNumTimesChannelScanned[]; -extern const uint32_t kSystemStartTime; -extern const uint32_t kIncrementBetweenEvents; -extern const size_t kRecordLength; -extern const size_t kInvalidRecordLength; -extern const wifi_offload::RpcLogRecord::RpcLogRecordType kChreRecordTypeList[]; -extern const wifi_offload::RpcLogRecord::RpcLogRecordType kInvalidChreRecordTypeLog[]; -extern const android::hardware::wifi::offload::V1_0::RecordName kHidlRecordNameList[]; - -} // namespace offload_hal_test_constants -} // namespace implementation -} // namespace V1_0 -} // namespace offload -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // OFFLOAD_HAL_TEST_CONSTANTS_ diff --git a/wifi_offload/test/offload_hal_test_utils.cpp b/wifi_offload/test/offload_hal_test_utils.cpp deleted file mode 100644 index b58ce408..00000000 --- a/wifi_offload/test/offload_hal_test_utils.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "offload_hal_test_utils.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace offload { -namespace V1_0 { -namespace implementation { -namespace offload_hal_test_utils { - -using namespace offload_hal_test_constants; - -void createChreScanResultsForTest(std::vector* chreScanResults) { - wifi_offload::ScanResult chreScanResult; - chreScanResult.security_modes_ = kNetworkFlags; - chreScanResult.capability_ = kCapability; - chreScanResult.frequency_scanned_mhz_ = kFrequency1; - chreScanResult.rssi_dbm_ = kRssi; - chreScanResult.tsf_ = kTsf; - chreScanResult.ssid_.SetData(&kSsid1[0], kSsid1_size); - memcpy(&chreScanResult.bssid_[0], &kBssid[0], kBssidSize); - chreScanResults->push_back(chreScanResult); -} - -void createChreScanStatsForTest(wifi_offload::ScanStats* chreScanStats) { - chreScanStats->num_scans_requested_by_nanoapp_ = kDefaultNumScansRequestedByWifi; - chreScanStats->num_scans_serviced_by_hardware_ = kDefaultNumScansServicedByWifi; - chreScanStats->num_scans_serviced_by_cache_ = - (kDefaultNumScansRequestedByWifi - kDefaultNumScansServicedByWifi); - for (size_t j = 0; j < kNumChannelsScanned[0] + kNumChannelsScanned[1]; j++) { - chreScanStats->channel_histogram_.IncrementScanCountForChannelForTest( - kTestChannels[j], static_cast(kNumTimesChannelScanned[j])); - } - chreScanStats->last_subscription_duration_ms_ = kSubscriptionDurationMs; - wifi_offload::ScanRecord scanRecord1; - scanRecord1.time_spent_scanning_ms_ = kScanDurationMs[0]; - scanRecord1.num_channels_scanned_ = kNumChannelsScanned[0]; - scanRecord1.num_entries_aggregated_ = 1; - chreScanStats->scan_records_.push_back(scanRecord1); - wifi_offload::ScanRecord scanRecord2; - scanRecord2.time_spent_scanning_ms_ = kScanDurationMs[1]; - scanRecord2.num_channels_scanned_ = kNumChannelsScanned[1]; - scanRecord2.num_entries_aggregated_ = 1; - chreScanStats->scan_records_.push_back(scanRecord2); - - for (size_t i = 0; i < kRecordLength; i++) { - wifi_offload::RpcLogRecord logRecord; - logRecord.record_type_ = kChreRecordTypeList[i]; - logRecord.timestamp_chre_ms_ = kSystemStartTime + i * kIncrementBetweenEvents; - chreScanStats->rpc_log_records_.push_back(logRecord); - } -} - -void createHidlScanFilterForTest(ScanFilter* scanFilter) { - std::vector nw_info_list; - NetworkInfo nwInfo1; - std::vector ssid1(kSsid1, kSsid1 + kSsid1_size); - nwInfo1.ssid = ssid1; - nwInfo1.flags = kNetworkFlags; - NetworkInfo nwInfo2; - std::vector ssid2(kSsid2, kSsid2 + kSsid2_size); - nwInfo2.ssid = ssid2; - nwInfo2.flags = kNetworkFlags; - nw_info_list.push_back(nwInfo1); - nw_info_list.push_back(nwInfo2); - scanFilter->preferredNetworkInfoList = nw_info_list; - scanFilter->rssiThreshold = kRssiThreshold; -} - -void createHidlScanParamForTest(ScanParam* scanParam) { - scanParam->disconnectedModeScanIntervalMs = kDisconnectedModeScanIntervalMs; - std::vector frequencyList{kFrequency1, kFrequency2}; - scanParam->frequencyList = frequencyList; - std::vector> ssidList; - std::vector ssid1(kSsid1, kSsid1 + kSsid1_size); - std::vector ssid2(kSsid2, kSsid2 + kSsid2_size); - ssidList.push_back(ssid1); - ssidList.push_back(ssid2); - scanParam->ssidList = ssidList; -} - -void createChreScanConfigForTest(wifi_offload::ScanConfig* scanConfig) { - scanConfig->scan_params_.disconnected_mode_scan_interval_ms_ = kDisconnectedModeScanIntervalMs; - wifi_offload::Ssid chreSsid1; - chreSsid1.SetData(&kSsid1[0], kSsid1_size); - wifi_offload::Ssid chreSsid2; - chreSsid2.SetData(&kSsid2[0], kSsid2_size); - scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid1); - scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid2); - scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(kFrequency1); - scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(kFrequency2); - scanConfig->scan_filter_.min_rssi_threshold_dbm_ = kRssiThreshold; - wifi_offload::PreferredNetwork chreNwInfo1; - chreNwInfo1.security_modes_ = kNetworkFlags; - chreNwInfo1.ssid_.SetData(&kSsid1[0], kSsid1_size); - scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo1)); - wifi_offload::PreferredNetwork chreNwInfo2; - chreNwInfo2.security_modes_ = kNetworkFlags; - chreNwInfo2.ssid_.SetData(&kSsid2[0], kSsid2_size); - scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo2)); -} - -bool validateScanResult(const std::vector& hidlScanResultsTest, - const std::vector chreScanResults) { - if (hidlScanResultsTest.size() != chreScanResults.size()) - return false; - uint32_t i = 0; - for (const auto& hidlScanResult : hidlScanResultsTest) { - if (hidlScanResult.tsf != chreScanResults[i].tsf_) - return false; - if (hidlScanResult.rssi != chreScanResults[i].rssi_dbm_) - return false; - if (hidlScanResult.capability != chreScanResults[i].capability_) - return false; - if (hidlScanResult.frequency != chreScanResults[i].frequency_scanned_mhz_) - return false; - for (int j = 0; j < kBssidSize; j++) { - if (hidlScanResult.bssid[j] != chreScanResults[i].bssid_[j]) - return false; - } - chreWifiSsidListItem chreWifiSsid; - chreScanResults[i].ssid_.ToChreWifiSsidListItem(&chreWifiSsid); - for (size_t k = 0; k < chreWifiSsid.ssidLen; k++) { - if (hidlScanResult.networkInfo.ssid[k] != chreWifiSsid.ssid[k]) - return false; - } - if (hidlScanResult.networkInfo.flags != kNetworkFlags) { - return false; - } - i++; - } - return true; -} - -bool validateScanStats(const ScanStats& hidlScanStats, - const wifi_offload::ScanStats& chreScanStats) { - if (hidlScanStats.subscriptionDurationMs != chreScanStats.last_subscription_duration_ms_) - return false; - if (hidlScanStats.numScansRequestedByWifi != chreScanStats.num_scans_requested_by_nanoapp_) - return false; - if (hidlScanStats.numScansServicedByWifi != chreScanStats.num_scans_serviced_by_hardware_) - return false; - if (hidlScanStats.numScansServicedbyCache != chreScanStats.num_scans_serviced_by_cache_) - return false; - for (uint32_t i = 0; i < kNumChannelsInHistogram; i++) { - if (hidlScanStats.histogramChannelsScanned[i] != - chreScanStats.channel_histogram_.GetChannelScanCount(i)) { - return false; - } - } - if (hidlScanStats.scanRecord.size() != chreScanStats.scan_records_.size()) - return false; - uint32_t i = 0; - for (const auto& scanRecord : hidlScanStats.scanRecord) { - if (scanRecord.durationMs != chreScanStats.scan_records_[i].time_spent_scanning_ms_) - return false; - if (scanRecord.numChannelsScanned != chreScanStats.scan_records_[i].num_channels_scanned_) - return false; - if (scanRecord.numEntriesAggregated != - chreScanStats.scan_records_[i].num_entries_aggregated_) - return false; - i++; - } - if (hidlScanStats.logRecord.size() != chreScanStats.rpc_log_records_.size()) - return false; - i = 0; - - for (const auto& logRecord : hidlScanStats.logRecord) { - if (logRecord.recordName != kHidlRecordNameList[i]) { - return false; - } - if (logRecord.logTimeMs != chreScanStats.rpc_log_records_[i].timestamp_chre_ms_) - return false; - i++; - } - return true; -} - -} // namespace offload_hal_test_utils -} // namespace implementation -} // namespace V1_0 -} // namespace offload -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi_offload/test/offload_hal_test_utils.h b/wifi_offload/test/offload_hal_test_utils.h deleted file mode 100644 index ba82a1c6..00000000 --- a/wifi_offload/test/offload_hal_test_utils.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OFFLOAD_HAL_TEST_UTILS_ -#define OFFLOAD_HAL_TEST_UTILS_ - -#include "offload_hal_test_constants.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace offload { -namespace V1_0 { -namespace implementation { -namespace offload_hal_test_utils { - -void createChreScanResultsForTest(std::vector* chreScanResults); -void createChreScanStatsForTest(wifi_offload::ScanStats* chreScanStats); -void createHidlScanFilterForTest(ScanFilter* scanFilter); -void createHidlScanParamForTest(ScanParam* scanParam); -void createChreScanConfigForTest(wifi_offload::ScanConfig* scanConfig); -bool validateScanResult(const std::vector& hidlScanResultsTest, - const std::vector chreScanResults); -bool validateScanStats(const ScanStats& hidlScanStats, - const wifi_offload::ScanStats& chreScanStats); -} // namespace offload_hal_test_utils -} // namespace implementation -} // namespace V1_0 -} // namespace offload -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // OFFLOAD_HAL_TEST_UTILS_ diff --git a/wifi_offload/test/offload_utils_test.cpp b/wifi_offload/test/offload_utils_test.cpp deleted file mode 100644 index 7c2e4d52..00000000 --- a/wifi_offload/test/offload_utils_test.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include "offload_hal_test_utils.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace offload { -namespace V1_0 { -namespace implementation { - -using namespace offload_hal_test_constants; - -class OffloadUtilsTest : public ::testing::Test { - protected: - virtual void SetUp() { - } - - void TearDown() override { - } -}; - -TEST_F(OffloadUtilsTest, ConvertScanResultToHidlTest) { - std::vector hidlScanResultsTest; - std::vector chreScanResultsTest; - offload_hal_test_utils::createChreScanResultsForTest(&chreScanResultsTest); - EXPECT_TRUE(offload_utils::ToHidlScanResults(chreScanResultsTest, &hidlScanResultsTest)); - EXPECT_TRUE( - offload_hal_test_utils::validateScanResult(hidlScanResultsTest, chreScanResultsTest)); -} - -TEST_F(OffloadUtilsTest, ConvertScanStatsToHidlTest) { - ScanStats hidlScanStatsTest; - wifi_offload::ScanStats chreScanStatsTest; - offload_hal_test_utils::createChreScanStatsForTest(&chreScanStatsTest); - EXPECT_TRUE(offload_utils::ToHidlScanStats(chreScanStatsTest, &hidlScanStatsTest)); - EXPECT_TRUE(offload_hal_test_utils::validateScanStats(hidlScanStatsTest, chreScanStatsTest)); -} - -TEST_F(OffloadUtilsTest, ConvertScanConfigToChreTest) { - wifi_offload::ScanConfig scanConfigTest; - wifi_offload::ScanConfig scanConfig; - ScanParam scanParamTest; - ScanFilter scanFilterTest; - offload_hal_test_utils::createHidlScanParamForTest(&scanParamTest); - offload_hal_test_utils::createHidlScanFilterForTest(&scanFilterTest); - offload_hal_test_utils::createChreScanConfigForTest(&scanConfig); - EXPECT_TRUE(offload_utils::ToChreScanConfig(scanParamTest, scanFilterTest, &scanConfigTest)); - EXPECT_TRUE(scanConfig == scanConfigTest); -} - -} // namespace implementation -} // namespace V1_0 -} // namespace offload -} // namespace wifi -} // namespace hardware -} // namespace android From 420aaa81af8e0e3ce5cf340760fd7e04f2568d8d Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Wed, 26 Jul 2017 14:04:05 -0700 Subject: [PATCH 016/300] Offload HAL Service: Utilities Provides the implementation of utilities to convert between HIDL format of data types used in Offload HAL service and the format used by CHRE. Added unit tests to verify conversions. Bug: 32842314 Test: VTS and Unit tests Change-Id: I26a1d9a8efe68cdacacd8226d0739ad40d2b339f --- wifi_offload/Android.bp | 10 +- wifi_offload/offload_utils.cpp | 285 ++++++++++++++++++ wifi_offload/offload_utils.h | 30 ++ .../test/offload_hal_test_constants.cpp | 91 ++++++ .../test/offload_hal_test_constants.h | 74 +++++ wifi_offload/test/offload_hal_test_utils.cpp | 200 ++++++++++++ wifi_offload/test/offload_hal_test_utils.h | 47 +++ wifi_offload/test/offload_utils_test.cpp | 73 +++++ 8 files changed, 809 insertions(+), 1 deletion(-) create mode 100644 wifi_offload/offload_utils.cpp create mode 100644 wifi_offload/offload_utils.h create mode 100644 wifi_offload/test/offload_hal_test_constants.cpp create mode 100644 wifi_offload/test/offload_hal_test_constants.h create mode 100644 wifi_offload/test/offload_hal_test_utils.cpp create mode 100644 wifi_offload/test/offload_hal_test_utils.h create mode 100644 wifi_offload/test/offload_utils_test.cpp diff --git a/wifi_offload/Android.bp b/wifi_offload/Android.bp index 8f466e52..8ff578f5 100644 --- a/wifi_offload/Android.bp +++ b/wifi_offload/Android.bp @@ -22,6 +22,7 @@ cc_library_static { "offload_server.cpp", "chre_interface_factory.cpp", "offload_status_util.cpp", + "offload_utils.cpp", ], cflags: ["-Wall", "-Wextra"], shared_libs: [ @@ -33,7 +34,8 @@ cc_library_static { "android.hardware.wifi.offload@1.0", ], whole_static_libs: [ - "chre_client" + "chre_client", + "wifi_offload_types", ] } @@ -68,6 +70,9 @@ cc_test { "test/mock_chre_interface.cpp", "test/offload_server_test.cpp", "test/chre_interface_test.cpp", + "test/offload_utils_test.cpp", + "test/offload_hal_test_constants.cpp", + "test/offload_hal_test_utils.cpp", ], local_include_dirs: [ "test", @@ -87,5 +92,8 @@ cc_test { "libgtest", "android.hardware.wifi.offload@1.0-lib", ], + whole_static_libs: [ + "wifi_offload_types", + ], } diff --git a/wifi_offload/offload_utils.cpp b/wifi_offload/offload_utils.cpp new file mode 100644 index 00000000..90d4b9ae --- /dev/null +++ b/wifi_offload/offload_utils.cpp @@ -0,0 +1,285 @@ +/* + * Copyright (C) 2016, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "offload_utils.h" + +#include +#include + +namespace { + +bool ToHidlRecordName(const wifi_offload::RpcLogRecord::RpcLogRecordType& chreRecordType, + android::hardware::wifi::offload::V1_0::RecordName* hidlRecordName) { + bool result = true; + switch (chreRecordType) { + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_INIT: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_INT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_CONFIG_SCANS: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_CONFIG_SCANS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_SUBSCRIBE_SCAN_RESULTS: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::CMD_SUBSCRIBE_SCAN_RESULTS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_UNSUBSCRIBE_SCAN_RESULTS: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::CMD_UNSUBSCRIBE_SCAN_RESULTS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_GET_SCAN_STATS: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::CMD_GET_SCAN_STATS; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_RESET: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::CMD_RESET; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT_ASYNC: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT_ASYNC; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_SCAN_RESULT: + *hidlRecordName = + android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_SCAN_RESULT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_ABORT: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_ABORT; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_ERROR: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_ERROR; + break; + case wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_SCAN: + *hidlRecordName = android::hardware::wifi::offload::V1_0::RecordName::REQ_SCAN; + break; + default: + result = false; + break; + } + return result; +} + +uint8_t ToChreSecurityMode(uint8_t hidlSecurityMode) { + uint8_t chreSecurityMode = 0; + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::OPEN) { + chreSecurityMode |= wifi_offload::SecurityMode::OPEN; + } + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::WEP) { + chreSecurityMode |= wifi_offload::SecurityMode::WEP; + } + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::PSK) { + chreSecurityMode |= wifi_offload::SecurityMode::PSK; + } + if (hidlSecurityMode & android::hardware::wifi::offload::V1_0::SecurityMode::EAP) { + chreSecurityMode |= wifi_offload::SecurityMode::EAP; + } + return chreSecurityMode; +} + +uint8_t ToHidlSecurityMode(uint8_t chreSecurityMode) { + uint8_t hidlSecurityMode = 0; + if (chreSecurityMode & wifi_offload::SecurityMode::OPEN) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::OPEN; + } + if (chreSecurityMode & wifi_offload::SecurityMode::WEP) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::WEP; + } + if (chreSecurityMode & wifi_offload::SecurityMode::PSK) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::PSK; + } + if (chreSecurityMode & wifi_offload::SecurityMode::EAP) { + hidlSecurityMode |= android::hardware::wifi::offload::V1_0::SecurityMode::EAP; + } + return hidlSecurityMode; +} + +} // namespace + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_utils { + +bool ToHidlScanResult(const wifi_offload::ScanResult& chreScanResult, ScanResult* hidlScanResult) { + if (hidlScanResult == nullptr) { + return false; + } + hidlScanResult->tsf = chreScanResult.tsf_; + hidlScanResult->capability = chreScanResult.capability_; + hidlScanResult->rssi = chreScanResult.rssi_dbm_; + hidlScanResult->frequency = chreScanResult.frequency_scanned_mhz_; + memcpy(&hidlScanResult->bssid[0], &chreScanResult.bssid_[0], + wifi_offload::ScanResult::kBssidSize); + chreWifiSsidListItem chreWifiSsid; + chreScanResult.ssid_.ToChreWifiSsidListItem(&chreWifiSsid); + std::vector ssid; + for (size_t i = 0; i < chreWifiSsid.ssidLen; i++) { + ssid.push_back(chreWifiSsid.ssid[i]); + } + hidlScanResult->networkInfo.ssid = ssid; + hidlScanResult->networkInfo.flags = ToHidlSecurityMode(chreScanResult.security_modes_); + return true; +} + +bool ToHidlScanResults(const std::vector& chreScanResults, + std::vector* hidlScanResults) { + LOG(VERBOSE) << "ScanResults from CHRE, size=" << chreScanResults.size(); + for (const auto& scan_result_from_nano_app : chreScanResults) { + ScanResult hidl_scan_result; + if (!ToHidlScanResult(scan_result_from_nano_app, &hidl_scan_result)) { + return false; + } + hidlScanResults->push_back(hidl_scan_result); + } + return true; +} + +bool ToHidlScanStats(const wifi_offload::ScanStats& chreScanStats, ScanStats* hidlScanStats) { + hidlScanStats->subscriptionDurationMs = chreScanStats.last_subscription_duration_ms_; + hidlScanStats->numScansRequestedByWifi = chreScanStats.num_scans_requested_by_nanoapp_; + hidlScanStats->numScansServicedByWifi = chreScanStats.num_scans_serviced_by_hardware_; + hidlScanStats->numScansServicedbyCache = chreScanStats.num_scans_serviced_by_cache_; + std::vector hidlScanRecords; + for (const auto& chreScanRecord : chreScanStats.scan_records_) { + ScanRecord hidlScanRecord; + hidlScanRecord.durationMs = chreScanRecord.time_spent_scanning_ms_; + hidlScanRecord.numChannelsScanned = chreScanRecord.num_channels_scanned_; + hidlScanRecord.numEntriesAggregated = chreScanRecord.num_entries_aggregated_; + hidlScanRecords.push_back(hidlScanRecord); + } + hidlScanStats->scanRecord = hidlScanRecords; + std::vector logRecords; + for (const auto& chreLogRecord : chreScanStats.rpc_log_records_) { + LogRecord logRecord; + if (!ToHidlRecordName(chreLogRecord.record_type_, &logRecord.recordName)) { + return false; + } + logRecord.logTimeMs = chreLogRecord.timestamp_chre_ms_; + logRecords.push_back(logRecord); + } + hidlScanStats->logRecord = logRecords; + for (size_t i = 0; i < hidlScanStats->histogramChannelsScanned.elementCount(); i++) { + hidlScanStats->histogramChannelsScanned[i] = + chreScanStats.channel_histogram_.GetChannelScanCount(i); + } + return true; +} + +bool ToChreScanConfig(const ScanParam& param, const ScanFilter& filter, + wifi_offload::ScanConfig* scanConfig) { + scanConfig->scan_params_.disconnected_mode_scan_interval_ms_ = + param.disconnectedModeScanIntervalMs; + for (const auto& ssid : param.ssidList) { + wifi_offload::Ssid chreSsid; + chreSsid.SetData(ssid.data(), ssid.size()); + scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid); + } + for (const auto& freq : param.frequencyList) { + scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(freq); + } + scanConfig->scan_filter_.min_rssi_threshold_dbm_ = filter.rssiThreshold; + for (const auto& nwInfo : filter.preferredNetworkInfoList) { + wifi_offload::PreferredNetwork chreNwInfo; + chreNwInfo.security_modes_ = ToChreSecurityMode(nwInfo.flags); + chreNwInfo.ssid_.SetData(nwInfo.ssid.data(), nwInfo.ssid.size()); + scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo)); + } + return true; +} + +bool ToHidlErrorMessage(uint32_t errorCode, std::string* errorMessage) { + bool reportError = true; + switch (errorCode) { + case wifi_offload::ErrorCode::FAILED_TO_ALLOCATE_MESSAGE_BUFFER: + *errorMessage = "Failed to allocate message buffer"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SERIALIZE_MESSAGE: + *errorMessage = "Failed to serialize message"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_MESSAGE: + *errorMessage = "Failed to send message"; + break; + case wifi_offload::ErrorCode::FAILED_TO_DESERIALIZE_SCAN_CONFIG: + *errorMessage = "Failed to deserialize scan config"; + break; + case wifi_offload::ErrorCode::INVALID_SUBSCRIBE_MESSAGE_SIZE: + *errorMessage = "Invalid subscribe message size"; + break; + case wifi_offload::ErrorCode::SCAN_CONFIG_NOT_INITIALIZED: + *errorMessage = "Scan config not initialized"; + break; + case wifi_offload::ErrorCode::UNSPECIFIED_HOST_ENDPOINT: + *errorMessage = "Unspecified host end point"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_SCAN_RESULTS: + *errorMessage = "Failed to send scan results"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_SCAN_STATS: + *errorMessage = "Failed to send scan stats"; + break; + case wifi_offload::ErrorCode::ONDEMAND_SCAN_NOT_SUPPORTED: + *errorMessage = "On demand scans not supported"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_ONDEMAND_SCAN_REQUEST: + *errorMessage = "Failed to send on demand scan request"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SEND_ONDEMAND_SCAN_REQUEST_ASYNC: + *errorMessage = "Failed to send on demand scan request async"; + break; + case wifi_offload::ErrorCode::OUT_OF_ORDER_SCAN_RESULTS: + *errorMessage = "Out of order scan results"; + break; + case wifi_offload::ErrorCode::INCOMPLETE_SCAN_RESULTS_BEFORE_SCAN_REQUEST: + *errorMessage = "Incomplete scan results before scan request"; + break; + case wifi_offload::ErrorCode::FAILED_TO_SET_SCAN_TIMER: + *errorMessage = "Failed to set scan timer"; + break; + case wifi_offload::ErrorCode::SCAN_MONITORING_NOT_SUPPORTED: + *errorMessage = "Scan Monitoring not supported"; + break; + case wifi_offload::ErrorCode::FAILED_TO_START_SCAN_MONITORING: + *errorMessage = "Failed to start scan monitoring"; + reportError = false; + break; + case wifi_offload::ErrorCode::FAILED_TO_STOP_SCAN_MONITORING: + *errorMessage = "Failed to stop scan monitoring"; + reportError = false; + break; + case wifi_offload::ErrorCode::FAILED_TO_CONFIGURE_SCAN_MONITORING_ASYNC: + *errorMessage = "Failed to configure scan monitoring async"; + reportError = false; + break; + default: + *errorMessage = "Invalid error code"; + reportError = false; + break; + } + return reportError; +} + +} // namespace offload_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi_offload/offload_utils.h b/wifi_offload/offload_utils.h new file mode 100644 index 00000000..ef087c9f --- /dev/null +++ b/wifi_offload/offload_utils.h @@ -0,0 +1,30 @@ +#ifndef WIFI_OFFLOAD_SERVER_UTILS_H_ +#define WIFI_OFFLOAD_SERVER_UTILS_H_ + +#include +#include + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_utils { + +bool ToHidlScanResults(const std::vector& chreScanResults, + std::vector* hidlScanResults); +bool ToHidlScanStats(const wifi_offload::ScanStats& chreScanStats, ScanStats* hildScanStats); +bool ToChreScanConfig(const ScanParam& param, const ScanFilter& filter, + wifi_offload::ScanConfig* scanConfig); +bool ToHidlErrorMessage(uint32_t errorCode, std::string* errorMessage); + +} // namespace offload_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_OFFLOAD_SERVER_UTILS_H_ diff --git a/wifi_offload/test/offload_hal_test_constants.cpp b/wifi_offload/test/offload_hal_test_constants.cpp new file mode 100644 index 00000000..805090de --- /dev/null +++ b/wifi_offload/test/offload_hal_test_constants.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "offload_hal_test_constants.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_constants { + +const uint8_t kSsid1[] = {'G', 'o', 'o', 'g', 'l', 'e'}; +const size_t kSsid1_size = sizeof(kSsid1); +const uint8_t kSsid2[] = {'X', 'f', 'i', 'n', 'i', 't', 'y'}; +const size_t kSsid2_size = sizeof(kSsid2); +const uint8_t kBssid[6] = {0x12, 0xef, 0xa1, 0x2c, 0x97, 0x8b}; +const int16_t kRssi = -60; +const int16_t kRssiThreshold = -76; +const uint32_t kFrequency1 = 2412; +const uint32_t kFrequency2 = 2437; +const uint8_t kBssidSize = 6; +const uint64_t kTsf = 0; +const uint16_t kCapability = 0; +const uint8_t kNetworkFlags = 0; +const uint32_t kDisconnectedModeScanIntervalMs = 5000; +const uint64_t kSubscriptionDurationMs = 10000; +const uint64_t kScanDurationMs[2] = {2000, 500}; +const uint32_t kNumChannelsScanned[] = {1, 2}; +const uint8_t kChannelNotScanned = 0; +const uint32_t kDefaultNumScansRequestedByWifi = 2; +const uint32_t kDefaultNumScansServicedByWifi = 2; +const uint64_t kScanDurationTotalMs = 2000; +const uint32_t kNumChannelsTotalScanned = 3; +const uint32_t kNumChannelsInHistogram = 256; +const uint8_t kTestChannels[] = {1, 6, 11}; +const uint32_t kNumTimesChannelScanned[] = {1, 1, 255}; +const uint32_t kSystemStartTime = 32164; +const uint32_t kIncrementBetweenEvents = 10; +const size_t kRecordLength = 8; +const size_t kInvalidRecordLength = 4; + +const wifi_offload::RpcLogRecord::RpcLogRecordType kChreRecordTypeList[] = { + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_INIT, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_CONFIG_SCANS, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_SUBSCRIBE_SCAN_RESULTS, + wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_SCAN, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_SCAN_RESULT, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_SCAN_RESULT, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_UNSUBSCRIBE_SCAN_RESULTS, + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_GET_SCAN_STATS, +}; + +const wifi_offload::RpcLogRecord::RpcLogRecordType kInvalidChreRecordTypeLog[] = { + wifi_offload::RpcLogRecord::RpcLogRecordType::CMD_LAST_ITEM, + wifi_offload::RpcLogRecord::RpcLogRecordType::REQ_LAST_ITEM, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_RECVD_LAST_ITEM, + wifi_offload::RpcLogRecord::RpcLogRecordType::EVENT_SENT_LAST_ITEM, +}; + +const android::hardware::wifi::offload::V1_0::RecordName kHidlRecordNameList[] = { + android::hardware::wifi::offload::V1_0::RecordName::CMD_INT, + android::hardware::wifi::offload::V1_0::RecordName::CMD_CONFIG_SCANS, + android::hardware::wifi::offload::V1_0::RecordName::CMD_SUBSCRIBE_SCAN_RESULTS, + android::hardware::wifi::offload::V1_0::RecordName::REQ_SCAN, + android::hardware::wifi::offload::V1_0::RecordName::EVENT_RECVD_SCAN_RESULT, + android::hardware::wifi::offload::V1_0::RecordName::EVENT_SENT_SCAN_RESULT, + android::hardware::wifi::offload::V1_0::RecordName::CMD_UNSUBSCRIBE_SCAN_RESULTS, + android::hardware::wifi::offload::V1_0::RecordName::CMD_GET_SCAN_STATS, +}; + +} // namespace offload_hal_test_constants +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi_offload/test/offload_hal_test_constants.h b/wifi_offload/test/offload_hal_test_constants.h new file mode 100644 index 00000000..195e0e8b --- /dev/null +++ b/wifi_offload/test/offload_hal_test_constants.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OFFLOAD_HAL_TEST_CONSTANTS_ +#define OFFLOAD_HAL_TEST_CONSTANTS_ + +#include + +#include "offload_utils.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_constants { + +extern const uint8_t kSsid1[]; +extern const size_t kSsid1_size; +extern const uint8_t kSsid2[]; +extern const size_t kSsid2_size; +extern const uint8_t kBssid[6]; +extern const int16_t kRssi; +extern const int16_t kRssiThreshold; +extern const uint32_t kFrequency1; +extern const uint32_t kFrequency2; +extern const uint8_t kBssidSize; +extern const uint64_t kTsf; +extern const uint16_t kCapability; +extern const uint8_t kNetworkFlags; +extern const uint32_t kDisconnectedModeScanIntervalMs; +extern const uint64_t kSubscriptionDurationMs; +extern const uint64_t kScanDurationMs[2]; +extern const uint32_t kNumChannelsScanned[]; +extern const uint8_t kChannelNotScanned; +extern const uint32_t kDefaultNumScansRequestedByWifi; +extern const uint32_t kDefaultNumScansServicedByWifi; +extern const uint64_t kScanDurationTotalMs; +extern const uint32_t kNumChannelsTotalScanned; +extern const uint32_t kNumChannelsInHistogram; +extern const uint64_t kDeathCode; +extern const uint8_t kTestChannels[]; +extern const uint32_t kNumTimesChannelScanned[]; +extern const uint32_t kSystemStartTime; +extern const uint32_t kIncrementBetweenEvents; +extern const size_t kRecordLength; +extern const size_t kInvalidRecordLength; +extern const wifi_offload::RpcLogRecord::RpcLogRecordType kChreRecordTypeList[]; +extern const wifi_offload::RpcLogRecord::RpcLogRecordType kInvalidChreRecordTypeLog[]; +extern const android::hardware::wifi::offload::V1_0::RecordName kHidlRecordNameList[]; + +} // namespace offload_hal_test_constants +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // OFFLOAD_HAL_TEST_CONSTANTS_ diff --git a/wifi_offload/test/offload_hal_test_utils.cpp b/wifi_offload/test/offload_hal_test_utils.cpp new file mode 100644 index 00000000..b58ce408 --- /dev/null +++ b/wifi_offload/test/offload_hal_test_utils.cpp @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "offload_hal_test_utils.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_utils { + +using namespace offload_hal_test_constants; + +void createChreScanResultsForTest(std::vector* chreScanResults) { + wifi_offload::ScanResult chreScanResult; + chreScanResult.security_modes_ = kNetworkFlags; + chreScanResult.capability_ = kCapability; + chreScanResult.frequency_scanned_mhz_ = kFrequency1; + chreScanResult.rssi_dbm_ = kRssi; + chreScanResult.tsf_ = kTsf; + chreScanResult.ssid_.SetData(&kSsid1[0], kSsid1_size); + memcpy(&chreScanResult.bssid_[0], &kBssid[0], kBssidSize); + chreScanResults->push_back(chreScanResult); +} + +void createChreScanStatsForTest(wifi_offload::ScanStats* chreScanStats) { + chreScanStats->num_scans_requested_by_nanoapp_ = kDefaultNumScansRequestedByWifi; + chreScanStats->num_scans_serviced_by_hardware_ = kDefaultNumScansServicedByWifi; + chreScanStats->num_scans_serviced_by_cache_ = + (kDefaultNumScansRequestedByWifi - kDefaultNumScansServicedByWifi); + for (size_t j = 0; j < kNumChannelsScanned[0] + kNumChannelsScanned[1]; j++) { + chreScanStats->channel_histogram_.IncrementScanCountForChannelForTest( + kTestChannels[j], static_cast(kNumTimesChannelScanned[j])); + } + chreScanStats->last_subscription_duration_ms_ = kSubscriptionDurationMs; + wifi_offload::ScanRecord scanRecord1; + scanRecord1.time_spent_scanning_ms_ = kScanDurationMs[0]; + scanRecord1.num_channels_scanned_ = kNumChannelsScanned[0]; + scanRecord1.num_entries_aggregated_ = 1; + chreScanStats->scan_records_.push_back(scanRecord1); + wifi_offload::ScanRecord scanRecord2; + scanRecord2.time_spent_scanning_ms_ = kScanDurationMs[1]; + scanRecord2.num_channels_scanned_ = kNumChannelsScanned[1]; + scanRecord2.num_entries_aggregated_ = 1; + chreScanStats->scan_records_.push_back(scanRecord2); + + for (size_t i = 0; i < kRecordLength; i++) { + wifi_offload::RpcLogRecord logRecord; + logRecord.record_type_ = kChreRecordTypeList[i]; + logRecord.timestamp_chre_ms_ = kSystemStartTime + i * kIncrementBetweenEvents; + chreScanStats->rpc_log_records_.push_back(logRecord); + } +} + +void createHidlScanFilterForTest(ScanFilter* scanFilter) { + std::vector nw_info_list; + NetworkInfo nwInfo1; + std::vector ssid1(kSsid1, kSsid1 + kSsid1_size); + nwInfo1.ssid = ssid1; + nwInfo1.flags = kNetworkFlags; + NetworkInfo nwInfo2; + std::vector ssid2(kSsid2, kSsid2 + kSsid2_size); + nwInfo2.ssid = ssid2; + nwInfo2.flags = kNetworkFlags; + nw_info_list.push_back(nwInfo1); + nw_info_list.push_back(nwInfo2); + scanFilter->preferredNetworkInfoList = nw_info_list; + scanFilter->rssiThreshold = kRssiThreshold; +} + +void createHidlScanParamForTest(ScanParam* scanParam) { + scanParam->disconnectedModeScanIntervalMs = kDisconnectedModeScanIntervalMs; + std::vector frequencyList{kFrequency1, kFrequency2}; + scanParam->frequencyList = frequencyList; + std::vector> ssidList; + std::vector ssid1(kSsid1, kSsid1 + kSsid1_size); + std::vector ssid2(kSsid2, kSsid2 + kSsid2_size); + ssidList.push_back(ssid1); + ssidList.push_back(ssid2); + scanParam->ssidList = ssidList; +} + +void createChreScanConfigForTest(wifi_offload::ScanConfig* scanConfig) { + scanConfig->scan_params_.disconnected_mode_scan_interval_ms_ = kDisconnectedModeScanIntervalMs; + wifi_offload::Ssid chreSsid1; + chreSsid1.SetData(&kSsid1[0], kSsid1_size); + wifi_offload::Ssid chreSsid2; + chreSsid2.SetData(&kSsid2[0], kSsid2_size); + scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid1); + scanConfig->scan_params_.ssids_to_scan_.push_back(chreSsid2); + scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(kFrequency1); + scanConfig->scan_params_.frequencies_to_scan_mhz_.push_back(kFrequency2); + scanConfig->scan_filter_.min_rssi_threshold_dbm_ = kRssiThreshold; + wifi_offload::PreferredNetwork chreNwInfo1; + chreNwInfo1.security_modes_ = kNetworkFlags; + chreNwInfo1.ssid_.SetData(&kSsid1[0], kSsid1_size); + scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo1)); + wifi_offload::PreferredNetwork chreNwInfo2; + chreNwInfo2.security_modes_ = kNetworkFlags; + chreNwInfo2.ssid_.SetData(&kSsid2[0], kSsid2_size); + scanConfig->scan_filter_.networks_to_match_.push_back(std::move(chreNwInfo2)); +} + +bool validateScanResult(const std::vector& hidlScanResultsTest, + const std::vector chreScanResults) { + if (hidlScanResultsTest.size() != chreScanResults.size()) + return false; + uint32_t i = 0; + for (const auto& hidlScanResult : hidlScanResultsTest) { + if (hidlScanResult.tsf != chreScanResults[i].tsf_) + return false; + if (hidlScanResult.rssi != chreScanResults[i].rssi_dbm_) + return false; + if (hidlScanResult.capability != chreScanResults[i].capability_) + return false; + if (hidlScanResult.frequency != chreScanResults[i].frequency_scanned_mhz_) + return false; + for (int j = 0; j < kBssidSize; j++) { + if (hidlScanResult.bssid[j] != chreScanResults[i].bssid_[j]) + return false; + } + chreWifiSsidListItem chreWifiSsid; + chreScanResults[i].ssid_.ToChreWifiSsidListItem(&chreWifiSsid); + for (size_t k = 0; k < chreWifiSsid.ssidLen; k++) { + if (hidlScanResult.networkInfo.ssid[k] != chreWifiSsid.ssid[k]) + return false; + } + if (hidlScanResult.networkInfo.flags != kNetworkFlags) { + return false; + } + i++; + } + return true; +} + +bool validateScanStats(const ScanStats& hidlScanStats, + const wifi_offload::ScanStats& chreScanStats) { + if (hidlScanStats.subscriptionDurationMs != chreScanStats.last_subscription_duration_ms_) + return false; + if (hidlScanStats.numScansRequestedByWifi != chreScanStats.num_scans_requested_by_nanoapp_) + return false; + if (hidlScanStats.numScansServicedByWifi != chreScanStats.num_scans_serviced_by_hardware_) + return false; + if (hidlScanStats.numScansServicedbyCache != chreScanStats.num_scans_serviced_by_cache_) + return false; + for (uint32_t i = 0; i < kNumChannelsInHistogram; i++) { + if (hidlScanStats.histogramChannelsScanned[i] != + chreScanStats.channel_histogram_.GetChannelScanCount(i)) { + return false; + } + } + if (hidlScanStats.scanRecord.size() != chreScanStats.scan_records_.size()) + return false; + uint32_t i = 0; + for (const auto& scanRecord : hidlScanStats.scanRecord) { + if (scanRecord.durationMs != chreScanStats.scan_records_[i].time_spent_scanning_ms_) + return false; + if (scanRecord.numChannelsScanned != chreScanStats.scan_records_[i].num_channels_scanned_) + return false; + if (scanRecord.numEntriesAggregated != + chreScanStats.scan_records_[i].num_entries_aggregated_) + return false; + i++; + } + if (hidlScanStats.logRecord.size() != chreScanStats.rpc_log_records_.size()) + return false; + i = 0; + + for (const auto& logRecord : hidlScanStats.logRecord) { + if (logRecord.recordName != kHidlRecordNameList[i]) { + return false; + } + if (logRecord.logTimeMs != chreScanStats.rpc_log_records_[i].timestamp_chre_ms_) + return false; + i++; + } + return true; +} + +} // namespace offload_hal_test_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi_offload/test/offload_hal_test_utils.h b/wifi_offload/test/offload_hal_test_utils.h new file mode 100644 index 00000000..ba82a1c6 --- /dev/null +++ b/wifi_offload/test/offload_hal_test_utils.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OFFLOAD_HAL_TEST_UTILS_ +#define OFFLOAD_HAL_TEST_UTILS_ + +#include "offload_hal_test_constants.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { +namespace offload_hal_test_utils { + +void createChreScanResultsForTest(std::vector* chreScanResults); +void createChreScanStatsForTest(wifi_offload::ScanStats* chreScanStats); +void createHidlScanFilterForTest(ScanFilter* scanFilter); +void createHidlScanParamForTest(ScanParam* scanParam); +void createChreScanConfigForTest(wifi_offload::ScanConfig* scanConfig); +bool validateScanResult(const std::vector& hidlScanResultsTest, + const std::vector chreScanResults); +bool validateScanStats(const ScanStats& hidlScanStats, + const wifi_offload::ScanStats& chreScanStats); +} // namespace offload_hal_test_utils +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // OFFLOAD_HAL_TEST_UTILS_ diff --git a/wifi_offload/test/offload_utils_test.cpp b/wifi_offload/test/offload_utils_test.cpp new file mode 100644 index 00000000..7c2e4d52 --- /dev/null +++ b/wifi_offload/test/offload_utils_test.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2016, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +#include +#include "offload_hal_test_utils.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace offload { +namespace V1_0 { +namespace implementation { + +using namespace offload_hal_test_constants; + +class OffloadUtilsTest : public ::testing::Test { + protected: + virtual void SetUp() { + } + + void TearDown() override { + } +}; + +TEST_F(OffloadUtilsTest, ConvertScanResultToHidlTest) { + std::vector hidlScanResultsTest; + std::vector chreScanResultsTest; + offload_hal_test_utils::createChreScanResultsForTest(&chreScanResultsTest); + EXPECT_TRUE(offload_utils::ToHidlScanResults(chreScanResultsTest, &hidlScanResultsTest)); + EXPECT_TRUE( + offload_hal_test_utils::validateScanResult(hidlScanResultsTest, chreScanResultsTest)); +} + +TEST_F(OffloadUtilsTest, ConvertScanStatsToHidlTest) { + ScanStats hidlScanStatsTest; + wifi_offload::ScanStats chreScanStatsTest; + offload_hal_test_utils::createChreScanStatsForTest(&chreScanStatsTest); + EXPECT_TRUE(offload_utils::ToHidlScanStats(chreScanStatsTest, &hidlScanStatsTest)); + EXPECT_TRUE(offload_hal_test_utils::validateScanStats(hidlScanStatsTest, chreScanStatsTest)); +} + +TEST_F(OffloadUtilsTest, ConvertScanConfigToChreTest) { + wifi_offload::ScanConfig scanConfigTest; + wifi_offload::ScanConfig scanConfig; + ScanParam scanParamTest; + ScanFilter scanFilterTest; + offload_hal_test_utils::createHidlScanParamForTest(&scanParamTest); + offload_hal_test_utils::createHidlScanFilterForTest(&scanFilterTest); + offload_hal_test_utils::createChreScanConfigForTest(&scanConfig); + EXPECT_TRUE(offload_utils::ToChreScanConfig(scanParamTest, scanFilterTest, &scanConfigTest)); + EXPECT_TRUE(scanConfig == scanConfigTest); +} + +} // namespace implementation +} // namespace V1_0 +} // namespace offload +} // namespace wifi +} // namespace hardware +} // namespace android From 8204f743784e23cda07e92c04d3b5985c70e11ad Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Wed, 26 Jul 2017 15:05:44 -0700 Subject: [PATCH 017/300] Offload HAL Service: Send messages to CHRE The following messages are to be sent to the nano app in response to invocation of the Offload HAL APIs from the client - subscribe, unsubsuscribe, configure scans CHRE interface will send the following commands to context hub - Get hub info and nano app list requests The callbacks from the socket will handle responses to these requests Bug: 32842314 Test: VTS Change-Id: I441522f5014317b7ac625742ab9782eeba5d78c8 --- wifi_offload/chre_interface.cpp | 26 +++++++++++++++++++ wifi_offload/chre_interface.h | 4 +++ wifi_offload/offload_server.cpp | 46 +++++++++++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/wifi_offload/chre_interface.cpp b/wifi_offload/chre_interface.cpp index 456e6682..448a5782 100644 --- a/wifi_offload/chre_interface.cpp +++ b/wifi_offload/chre_interface.cpp @@ -142,6 +142,9 @@ void ChreInterface::reportConnectionEvent(ChreInterfaceCallbacks::ConnectionEven switch (event) { case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: connectionStatus = true; + if (!getHubInfo() || !getNanoAppList()) { + LOG(WARNING) << "Unable to get platform and nano app info"; + } break; case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: @@ -181,6 +184,29 @@ void ChreInterface::handleMessage(uint32_t messageType, const void* messageData, mServerCallbacks->handleMessage(messageType, message); } +bool ChreInterface::getHubInfo() { + LOG(VERBOSE) << "getHubInfo"; + + FlatBufferBuilder builder(chre_constants::kHubInfoRequestBufLen); + HostProtocolHost::encodeHubInfoRequest(builder); + if (!mClient.sendMessage(builder.GetBufferPointer(), builder.GetSize())) { + LOG(WARNING) << "Failed to send Hub Info request"; + return false; + } + return true; +} + +bool ChreInterface::getNanoAppList() { + LOG(VERBOSE) << "getNanoAppList"; + FlatBufferBuilder builder(chre_constants::kNanoAppListRequestBufLen); + HostProtocolHost::encodeNanoappListRequest(builder); + + if (!mClient.sendMessage(builder.GetBufferPointer(), builder.GetSize())) { + LOG(WARNING) << "Unable to send Nano app List request"; + return false; + } + return true; +} } // namespace implementation } // namespace V1_0 } // namespace offload diff --git a/wifi_offload/chre_interface.h b/wifi_offload/chre_interface.h index 72420af5..92cfa5b6 100644 --- a/wifi_offload/chre_interface.h +++ b/wifi_offload/chre_interface.h @@ -51,6 +51,10 @@ class SocketCallbacks void handleUnloadNanoappResponse(const ::chre::fbs::UnloadNanoappResponseT& response) override; private: + /* Requests Hub Information, returns true if Hub Info request was sent */ + bool getHubInfo(); + /* Request list of Nano apps, returns true if Nano app List request was sent */ + bool getNanoAppList(); ChreInterface* mParent; }; diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 88277ec5..56e139a1 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -1,8 +1,13 @@ #include "offload_server.h" #include +#include +#include #include "offload_status_util.h" +#include "offload_utils.h" + +using namespace android::hardware::wifi::offload::V1_0::implementation::chre_constants; namespace android { namespace hardware { @@ -21,6 +26,25 @@ OffloadServer::OffloadServer(ChreInterfaceFactory* factory) OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFilter& filter) { LOG(INFO) << "configureScans"; + if (!mChreInterface->isConnected()) { + return createOffloadStatus(OffloadStatusCode::ERROR, + "Not connected to hardware implementation"); + } + wifi_offload::ScanConfig scanConfig; + if (!offload_utils::ToChreScanConfig(param, filter, &scanConfig)) { + return createOffloadStatus(OffloadStatusCode::ERROR, + "Unable to convert scan configuration"); + } + uint8_t buffer[kMaxMessageLen]; + size_t result_size = wifi_offload::fbs::Serialize(scanConfig, buffer, kMaxMessageLen); + if (result_size <= 0) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Scan config serialization failed"); + } + std::vector message(buffer, buffer + result_size); + if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_CONFIG_SCANS, + message)) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Unable to send config message"); + } return createOffloadStatus(OffloadStatusCode::OK); } @@ -32,11 +56,31 @@ std::pair OffloadServer::getScanStats() { OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { LOG(INFO) << "subscribeScanResults with delay:" << delayMs; + if (!mChreInterface->isConnected()) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Not connected to hardware"); + } + uint32_t* buffer = &delayMs; + std::vector message(reinterpret_cast(buffer), + reinterpret_cast(buffer) + kSubscriptionDelayMsBufLen); + if (!mChreInterface->sendCommandToApp( + wifi_offload::HostMessageType::HOST_CMD_SUBSCRIBE_SCAN_RESULTS, message)) { + return createOffloadStatus(OffloadStatusCode::ERROR, "Unable to request scans"); + } return createOffloadStatus(OffloadStatusCode::OK); } bool OffloadServer::unsubscribeScanResults() { + bool result = false; LOG(INFO) << "unsubscribeScanResults"; + if (!mChreInterface->isConnected()) { + LOG(WARNING) << "Failed to send unsubscribe scan results message"; + return false; + } + if (!mChreInterface->sendCommandToApp( + wifi_offload::HostMessageType::HOST_CMD_UNSUBSCRIBE_SCAN_RESULTS, {})) { + LOG(WARNING) << "Failed to send unsubscribe scan results message"; + return false; + } return true; } @@ -46,8 +90,6 @@ bool OffloadServer::setEventCallback(const sp& cb) { if (cb != nullptr) { mEventCallback = cb; result = true; - } else { - LOG(WARNING) << "Invalid callback object"; } return result; } From 137a0c654289145825d5fe5b10d3c8fa11ff8734 Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Thu, 18 May 2017 12:18:42 -0700 Subject: [PATCH 018/300] Offload HAL Service: Handle messages from Nano app The following messages from Nano app - Error, Scan stats, Scan Results Also invoke the appropriate callback to the client. Bug: 32842314 Test: VTS Change-Id: I562b2bcf149f8eab1cddc094a7b976aa56bdb9c8 --- wifi_offload/offload_server.cpp | 129 +++++++++++++++++++++++++++++--- wifi_offload/offload_server.h | 9 +++ 2 files changed, 127 insertions(+), 11 deletions(-) diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 56e139a1..877d420a 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -8,6 +8,11 @@ #include "offload_utils.h" using namespace android::hardware::wifi::offload::V1_0::implementation::chre_constants; +using android::hardware::wifi::offload::V1_0::OffloadStatus; + +namespace { +constexpr auto kScanStatsTimeout = std::chrono::milliseconds(500); +} namespace android { namespace hardware { @@ -27,7 +32,7 @@ OffloadServer::OffloadServer(ChreInterfaceFactory* factory) OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFilter& filter) { LOG(INFO) << "configureScans"; if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::ERROR, + return createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Not connected to hardware implementation"); } wifi_offload::ScanConfig scanConfig; @@ -50,14 +55,33 @@ OffloadStatus OffloadServer::configureScans(const ScanParam& param, const ScanFi std::pair OffloadServer::getScanStats() { LOG(INFO) << "getScanStats"; - OffloadStatus status = createOffloadStatus(OffloadStatusCode::OK); - return std::make_pair(status, mScanStats); + mScanStatsStatus = createOffloadStatus(OffloadStatusCode::OK); + if (!mChreInterface->isConnected()) { + return {createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Unable to send scan stats"), + {}}; + } + if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_GET_SCAN_STATS, + {})) { + return {createOffloadStatus(OffloadStatusCode::ERROR, "Unable to send scan stats command"), + {}}; + } + LOG(VERBOSE) << "Sent getScanStats command"; + { + std::unique_lock lock(mScanStatsLock); + auto timeout_status = mScanStatsCond.wait_for(lock, kScanStatsTimeout); + if (timeout_status == std::cv_status::timeout) { + std::lock_guard lock(mOffloadLock); + LOG(WARNING) << "Timeout waiting for scan stats"; + return {createOffloadStatus(OffloadStatusCode::TIMEOUT, "Scan stats not received"), {}}; + } + } + return std::make_pair(mScanStatsStatus, mScanStats); } OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { LOG(INFO) << "subscribeScanResults with delay:" << delayMs; if (!mChreInterface->isConnected()) { - return createOffloadStatus(OffloadStatusCode::ERROR, "Not connected to hardware"); + return createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Not connected to hardware"); } uint32_t* buffer = &delayMs; std::vector message(reinterpret_cast(buffer), @@ -70,7 +94,6 @@ OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { } bool OffloadServer::unsubscribeScanResults() { - bool result = false; LOG(INFO) << "unsubscribeScanResults"; if (!mChreInterface->isConnected()) { LOG(WARNING) << "Failed to send unsubscribe scan results message"; @@ -86,21 +109,29 @@ bool OffloadServer::unsubscribeScanResults() { bool OffloadServer::setEventCallback(const sp& cb) { LOG(INFO) << "Set Event callback"; - bool result = false; - if (cb != nullptr) { - mEventCallback = cb; - result = true; + if (cb == nullptr) { + return false; } - return result; + std::lock_guard lock(mOffloadLock); + mEventCallback = cb; + return true; } void OffloadServer::clearEventCallback() { + std::lock_guard lock(mOffloadLock); if (mEventCallback != nullptr) { mEventCallback.clear(); } LOG(INFO) << "Event callback cleared"; } +void OffloadServer::invokeErrorCallback(const OffloadStatus& status) { + std::lock_guard lock(mOffloadLock); + if (mEventCallback != nullptr) { + mEventCallback->onError(status); + } +} + ChreInterfaceCallbacksImpl::ChreInterfaceCallbacksImpl(OffloadServer* server) : mServer(server) { } @@ -109,12 +140,88 @@ ChreInterfaceCallbacksImpl::~ChreInterfaceCallbacksImpl() { void ChreInterfaceCallbacksImpl::handleConnectionEvents( ChreInterfaceCallbacks::ConnectionEvent event) { - LOG(VERBOSE) << "Connection event received " << (int)event; + switch (event) { + case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: + case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: { + LOG(ERROR) << "Connection to socket lost"; + mServer->invokeErrorCallback( + createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Connection to socket lost")); + } break; + case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: { + LOG(INFO) << "Connected to socket"; + mServer->invokeErrorCallback(createOffloadStatus(OffloadStatusCode::OK)); + } break; + default: + LOG(WARNING) << "Invalid connection event received " << (int)event; + break; + } +} + +void OffloadServer::handleScanResult(const std::vector& message) { + std::vector scanResults; + std::vector hidlScanResults; + std::string errorMessage; + if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &scanResults)) { + invokeErrorCallback( + createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserialize scan results")); + return; + } + if (!offload_utils::ToHidlScanResults(scanResults, &hidlScanResults)) { + invokeErrorCallback(createOffloadStatus(OffloadStatusCode::ERROR, + "Cannot convert scan results to HIDL format")); + return; + } + { + std::lock_guard lock(mOffloadLock); + if (mEventCallback != nullptr) { + mEventCallback->onScanResult(hidlScanResults); + } + } +} + +void OffloadServer::handleScanStats(const std::vector& message) { + std::lock_guard lock(mScanStatsLock); + wifi_offload::ScanStats stats; + OffloadStatus status; + // Deserialize scan stats + status = createOffloadStatus(OffloadStatusCode::OK); + LOG(VERBOSE) << "Received scan stats"; + if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &stats)) { + status = createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserailize scan stats"); + } else if (!offload_utils::ToHidlScanStats(stats, &mScanStats)) { + status = createOffloadStatus(OffloadStatusCode::ERROR, + "Cannot convert Scan stats to HIDL format"); + } + mScanStatsStatus = status; + mScanStatsCond.notify_all(); } void ChreInterfaceCallbacksImpl::handleMessage(uint32_t messageType, const std::vector& message) { LOG(VERBOSE) << "Message from Nano app " << messageType; + switch (messageType) { + case wifi_offload::HostMessageType::HOST_MSG_SCAN_RESULTS: { + LOG(INFO) << "Received scan results"; + mServer->handleScanResult(message); + } break; + case wifi_offload::HostMessageType::HOST_MSG_SCAN_STATS: + LOG(VERBOSE) << "Received scan stats from Nano app"; + mServer->handleScanStats(message); + break; + case wifi_offload::HostMessageType::HOST_MSG_ERROR: + LOG(VERBOSE) << "Received error message from Nano app"; + { + std::string errorMessage; + if (offload_utils::ToHidlErrorMessage(message[0], &errorMessage)) { + mServer->invokeErrorCallback( + createOffloadStatus(OffloadStatusCode::ERROR, errorMessage)); + } + } + break; + default: + LOG(WARNING) << "Unknown message received" << messageType; + break; + } } // Methods from ::android::hidl::base::V1_0::IBase follow. diff --git a/wifi_offload/offload_server.h b/wifi_offload/offload_server.h index f10ace16..2b150b16 100644 --- a/wifi_offload/offload_server.h +++ b/wifi_offload/offload_server.h @@ -41,7 +41,16 @@ class OffloadServer { void clearEventCallback(); private: + void invokeErrorCallback(const android::hardware::wifi::offload::V1_0::OffloadStatus& status); + void handleScanResult(const std::vector& message); + void handleScanStats(const std::vector& message); + ScanStats mScanStats; + std::mutex mScanStatsLock; + std::condition_variable mScanStatsCond; + std::mutex mOffloadLock; + OffloadStatus mScanStatsStatus; + std::unique_ptr mChreInterfaceCallbacks; std::unique_ptr mChreInterface; sp mEventCallback; From f82c395cfcf34425bf6f09f5fc304343a6ff52b5 Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Fri, 28 Jul 2017 12:39:15 -0700 Subject: [PATCH 019/300] Offload HAL Service: Reset Nano app upon Error Offload HAL service reports all errors to the client. To bring Wifi Nano app to a known state, also send a RESET command to the Nano app. Bug: 32842314 Test: VTS Change-Id: Ie5834b80e545e9099e3492b0354fefc2bc82ef8c --- wifi_offload/offload_server.cpp | 29 ++++++++++++++++++++++------- wifi_offload/offload_server.h | 4 +++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/wifi_offload/offload_server.cpp b/wifi_offload/offload_server.cpp index 877d420a..850b9b06 100644 --- a/wifi_offload/offload_server.cpp +++ b/wifi_offload/offload_server.cpp @@ -93,6 +93,17 @@ OffloadStatus OffloadServer::subscribeScanResults(uint32_t delayMs) { return createOffloadStatus(OffloadStatusCode::OK); } +void OffloadServer::resetNanoApp() { + LOG(INFO) << "resetting Nano app"; + if (!mChreInterface->isConnected()) { + LOG(WARNING) << "Unable to reset nano app, not connected"; + return; + } + if (!mChreInterface->sendCommandToApp(wifi_offload::HostMessageType::HOST_CMD_RESET, {})) { + LOG(ERROR) << "Unable to send Reset command to Nano app"; + } +} + bool OffloadServer::unsubscribeScanResults() { LOG(INFO) << "unsubscribeScanResults"; if (!mChreInterface->isConnected()) { @@ -125,7 +136,10 @@ void OffloadServer::clearEventCallback() { LOG(INFO) << "Event callback cleared"; } -void OffloadServer::invokeErrorCallback(const OffloadStatus& status) { +void OffloadServer::invokeErrorCallbackAndResetIfNeeded(const OffloadStatus& status) { + if (status.code != OffloadStatusCode::OK) { + resetNanoApp(); + } std::lock_guard lock(mOffloadLock); if (mEventCallback != nullptr) { mEventCallback->onError(status); @@ -144,12 +158,13 @@ void ChreInterfaceCallbacksImpl::handleConnectionEvents( case ChreInterfaceCallbacks::ConnectionEvent::DISCONNECTED: case ChreInterfaceCallbacks::ConnectionEvent::CONNECTION_ABORT: { LOG(ERROR) << "Connection to socket lost"; - mServer->invokeErrorCallback( + mServer->invokeErrorCallbackAndResetIfNeeded( createOffloadStatus(OffloadStatusCode::NO_CONNECTION, "Connection to socket lost")); } break; case ChreInterfaceCallbacks::ConnectionEvent::CONNECTED: { LOG(INFO) << "Connected to socket"; - mServer->invokeErrorCallback(createOffloadStatus(OffloadStatusCode::OK)); + mServer->invokeErrorCallbackAndResetIfNeeded( + createOffloadStatus(OffloadStatusCode::OK)); } break; default: LOG(WARNING) << "Invalid connection event received " << (int)event; @@ -162,13 +177,13 @@ void OffloadServer::handleScanResult(const std::vector& message) { std::vector hidlScanResults; std::string errorMessage; if (!wifi_offload::fbs::Deserialize((uint8_t*)message.data(), message.size(), &scanResults)) { - invokeErrorCallback( + invokeErrorCallbackAndResetIfNeeded( createOffloadStatus(OffloadStatusCode::ERROR, "Cannot deserialize scan results")); return; } if (!offload_utils::ToHidlScanResults(scanResults, &hidlScanResults)) { - invokeErrorCallback(createOffloadStatus(OffloadStatusCode::ERROR, - "Cannot convert scan results to HIDL format")); + invokeErrorCallbackAndResetIfNeeded(createOffloadStatus( + OffloadStatusCode::ERROR, "Cannot convert scan results to HIDL format")); return; } { @@ -213,7 +228,7 @@ void ChreInterfaceCallbacksImpl::handleMessage(uint32_t messageType, { std::string errorMessage; if (offload_utils::ToHidlErrorMessage(message[0], &errorMessage)) { - mServer->invokeErrorCallback( + mServer->invokeErrorCallbackAndResetIfNeeded( createOffloadStatus(OffloadStatusCode::ERROR, errorMessage)); } } diff --git a/wifi_offload/offload_server.h b/wifi_offload/offload_server.h index 2b150b16..ac7b3469 100644 --- a/wifi_offload/offload_server.h +++ b/wifi_offload/offload_server.h @@ -41,9 +41,11 @@ class OffloadServer { void clearEventCallback(); private: - void invokeErrorCallback(const android::hardware::wifi::offload::V1_0::OffloadStatus& status); + void invokeErrorCallbackAndResetIfNeeded( + const android::hardware::wifi::offload::V1_0::OffloadStatus& status); void handleScanResult(const std::vector& message); void handleScanStats(const std::vector& message); + void resetNanoApp(); ScanStats mScanStats; std::mutex mScanStatsLock; From 2ee9f963d9a77dcd00dd7cee45adbee1945771ec Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Thu, 18 May 2017 18:56:33 -0700 Subject: [PATCH 020/300] Offload HAL Service: Enable errors for warnings Update compile flags for this module so that warnings will report errors during compilation. Also fixed one unused variable. Bug: 32842314 Test: VTS Change-Id: Ic48071c86bc81c93c44a4b0645134dc028f96b9e --- wifi_offload/Android.bp | 2 +- wifi_offload/Offload.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi_offload/Android.bp b/wifi_offload/Android.bp index 8ff578f5..289ae26b 100644 --- a/wifi_offload/Android.bp +++ b/wifi_offload/Android.bp @@ -24,7 +24,7 @@ cc_library_static { "offload_status_util.cpp", "offload_utils.cpp", ], - cflags: ["-Wall", "-Wextra"], + cflags: ["-Wall", "-Wextra", "-Werror"], shared_libs: [ "libbase", "libhidlbase", diff --git a/wifi_offload/Offload.h b/wifi_offload/Offload.h index 4510f680..d5e9e6db 100644 --- a/wifi_offload/Offload.h +++ b/wifi_offload/Offload.h @@ -24,7 +24,7 @@ class HidlDeathHandler : public android::hardware::hidl_death_recipient { // Death notification for callbacks. void serviceDied(uint64_t cookie, - const android::wp &who) override { + const android::wp& /* who */) override { cb_.clear(); cb_function_(cookie); } From cc0d522669ce66afcedb113f53ec94e716ac170f Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Wed, 30 Aug 2017 10:54:11 +0900 Subject: [PATCH 021/300] Add 'vendor.' prefix to a vendor HAL service name To prevent property name collisions between properties of system and vendor, 'vendor.' prefix must be added to a vendor HAL service name. You can see the details in http://go/treble-sysprop-compatibility. Test: succeeded building and tested on a walleye device Bug: 36796459 Change-Id: Idc995c550657feca5e0f934444a31805bc3538f9 --- dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc | 2 +- init.hardware.rc | 6 +++--- power/android.hardware.power@1.1-service.wahoo.rc | 2 +- thermal/android.hardware.thermal@1.0-service.wahoo.rc | 2 +- usb/android.hardware.usb@1.1-service.wahoo.rc | 2 +- vibrator/android.hardware.vibrator@1.1-service.wahoo.rc | 2 +- vr/android.hardware.vr@1.0-service.wahoo.rc | 2 +- wifi_offload/android.hardware.wifi.offload@1.0-service.rc | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc index 924782f0..39a96184 100644 --- a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc +++ b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc @@ -1,4 +1,4 @@ -service dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.wahoo +service vendor.dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.wahoo class hal user system group system diff --git a/init.hardware.rc b/init.hardware.rc index 08fd26ef..64ea6d7f 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -200,9 +200,9 @@ on late-fs # Start services for bootanim start surfaceflinger start bootanim - start hwcomposer-2-1 - start configstore-hal - start gralloc-2-0 + start vendor.hwcomposer-2-1 + start vendor.configstore-hal + start vendor.gralloc-2-0 # Mount RW partitions which need run fsck mount_all /vendor/etc/fstab.${ro.hardware} --late diff --git a/power/android.hardware.power@1.1-service.wahoo.rc b/power/android.hardware.power@1.1-service.wahoo.rc index 064cf35a..cb31655a 100644 --- a/power/android.hardware.power@1.1-service.wahoo.rc +++ b/power/android.hardware.power@1.1-service.wahoo.rc @@ -1,4 +1,4 @@ -service power-hal-1-1 /vendor/bin/hw/android.hardware.power@1.1-service.wahoo +service vendor.power-hal-1-1 /vendor/bin/hw/android.hardware.power@1.1-service.wahoo class hal user system group system diff --git a/thermal/android.hardware.thermal@1.0-service.wahoo.rc b/thermal/android.hardware.thermal@1.0-service.wahoo.rc index e522cb10..2dd296da 100644 --- a/thermal/android.hardware.thermal@1.0-service.wahoo.rc +++ b/thermal/android.hardware.thermal@1.0-service.wahoo.rc @@ -1,4 +1,4 @@ -service thermal-hal-1-0 /vendor/bin/hw/android.hardware.thermal@1.0-service.wahoo +service vendor.thermal-hal-1-0 /vendor/bin/hw/android.hardware.thermal@1.0-service.wahoo class hal user nobody group nobody diff --git a/usb/android.hardware.usb@1.1-service.wahoo.rc b/usb/android.hardware.usb@1.1-service.wahoo.rc index 1451519a..1bb49772 100644 --- a/usb/android.hardware.usb@1.1-service.wahoo.rc +++ b/usb/android.hardware.usb@1.1-service.wahoo.rc @@ -1,4 +1,4 @@ -service usb-hal-1-1 /vendor/bin/hw/android.hardware.usb@1.1-service.wahoo +service vendor.usb-hal-1-1 /vendor/bin/hw/android.hardware.usb@1.1-service.wahoo class hal user root group root system diff --git a/vibrator/android.hardware.vibrator@1.1-service.wahoo.rc b/vibrator/android.hardware.vibrator@1.1-service.wahoo.rc index f9db6b01..be266bab 100644 --- a/vibrator/android.hardware.vibrator@1.1-service.wahoo.rc +++ b/vibrator/android.hardware.vibrator@1.1-service.wahoo.rc @@ -1,4 +1,4 @@ -service vibrator-1-1 /vendor/bin/hw/android.hardware.vibrator@1.1-service.wahoo +service vendor.vibrator-1-1 /vendor/bin/hw/android.hardware.vibrator@1.1-service.wahoo class hal user system group system diff --git a/vr/android.hardware.vr@1.0-service.wahoo.rc b/vr/android.hardware.vr@1.0-service.wahoo.rc index 7a66e903..3f34675d 100644 --- a/vr/android.hardware.vr@1.0-service.wahoo.rc +++ b/vr/android.hardware.vr@1.0-service.wahoo.rc @@ -1,4 +1,4 @@ -service vr-wahoo-1-0 /vendor/bin/hw/android.hardware.vr@1.0-service.wahoo +service vendor.vr-wahoo-1-0 /vendor/bin/hw/android.hardware.vr@1.0-service.wahoo class hal user system group system diff --git a/wifi_offload/android.hardware.wifi.offload@1.0-service.rc b/wifi_offload/android.hardware.wifi.offload@1.0-service.rc index 84e03911..58b45601 100644 --- a/wifi_offload/android.hardware.wifi.offload@1.0-service.rc +++ b/wifi_offload/android.hardware.wifi.offload@1.0-service.rc @@ -1,4 +1,4 @@ -service offload-hal-1-0 /vendor/bin/hw/android.hardware.wifi.offload@1.0-service +service vendor.offload-hal-1-0 /vendor/bin/hw/android.hardware.wifi.offload@1.0-service class hal user wifi group wifi system From e64c0a5e56ebfe68f18408ac15a1f33e7a200a14 Mon Sep 17 00:00:00 2001 From: Ecco Park Date: Tue, 29 Aug 2017 13:13:02 -0700 Subject: [PATCH 022/300] selinux: change the package name for pixel logger Bug: 64000290 Change-Id: I2c90fe2ce1ef92b3585f8f930f20065808e62054 Signed-off-by: Ecco Park --- sepolicy/vendor/seapp_contexts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/vendor/seapp_contexts b/sepolicy/vendor/seapp_contexts index d13ddad6..f74dbf9b 100644 --- a/sepolicy/vendor/seapp_contexts +++ b/sepolicy/vendor/seapp_contexts @@ -1,5 +1,5 @@ user=system seinfo=platform name=com.google.SSRestartDetector domain=ssr_detector_app type=system_app_data_file -user=_app seinfo=platform name=com.android.nexuslogger domain=logger_app type=app_data_file levelFrom=all +user=_app seinfo=platform name=com.android.pixellogger domain=logger_app type=app_data_file levelFrom=all user=_app seinfo=platform name=com.android.ramdump domain=ramdump_app type=app_data_file levelFrom=all user=_app seinfo=platform name=com.google.mds domain=mds_app type=app_data_file levelFrom=all From b34e605b13a1b11fb74fbf89f37f32a9ff26b8e4 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 1 Sep 2017 10:09:50 +0900 Subject: [PATCH 023/300] Remove the tricky *.vndk-sp modules Since BOARD_VNDK_VERSION is turned on, the tricky *.vndk-sp modules aren't needed anymore. Remove them. Bug: 63866913 Test: build 2017 pixel, boots to the UI Change-Id: I07703f57da22d965c6ee43a672aacce0970fa0c4 --- device.mk | 30 +------------------------ vndk/Android.mk | 60 ------------------------------------------------- 2 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 vndk/Android.mk diff --git a/device.mk b/device.mk index 86f1cac4..b2f52ebe 100755 --- a/device.mk +++ b/device.mk @@ -530,35 +530,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ ro.frp.pst=/dev/block/platform/soc/1da4000.ufshc/by-name/frp PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.vndk.version=26.1.0 \ - -# Once BOARD_VNDK_VERSION is defined, below packages will not be used -PRODUCT_PACKAGES += \ - android.hardware.renderscript@1.0.vndk-sp\ - android.hardware.graphics.allocator@2.0.vndk-sp\ - android.hardware.graphics.mapper@2.0.vndk-sp\ - android.hardware.graphics.common@1.0.vndk-sp\ - libhwbinder.vndk-sp\ - libbase.vndk-sp\ - libcutils.vndk-sp\ - libhardware.vndk-sp\ - libhidlbase.vndk-sp\ - libhidltransport.vndk-sp\ - libutils.vndk-sp\ - libc++.vndk-sp\ - libRS_internal.vndk-sp\ - libRSDriver.vndk-sp\ - libRSCpuRef.vndk-sp\ - libbcinfo.vndk-sp\ - libblas.vndk-sp\ - libft2.vndk-sp\ - libpng.vndk-sp\ - libcompiler_rt.vndk-sp\ - libbacktrace.vndk-sp\ - libunwind.vndk-sp\ - libunwindstack.vndk-sp\ - liblzma.vndk-sp\ - libz.vndk-sp\ + ro.vendor.vndk.version=27.1.0 \ # Include vndk/vndk-sp/ll-ndk modules PRODUCT_PACKAGES += vndk_package diff --git a/vndk/Android.mk b/vndk/Android.mk deleted file mode 100644 index 7be018e0..00000000 --- a/vndk/Android.mk +++ /dev/null @@ -1,60 +0,0 @@ -ifneq ($(filter muskie walleye taimen, $(TARGET_DEVICE)),) -LOCAL_PATH := $(call my-dir) - -ifndef BOARD_VNDK_VERSION -VNDK_SP_LIBRARIES += \ - android.hardware.renderscript@1.0\ - android.hardware.graphics.allocator@2.0\ - android.hardware.graphics.mapper@2.0\ - android.hardware.graphics.common@1.0\ - libhwbinder\ - libbase\ - libcutils\ - libhardware\ - libutils\ - libc++\ - libbacktrace\ - libunwind\ - libunwindstack\ - liblzma\ - libhidlbase\ - libhidltransport\ - libz\ - libbcinfo\ - libblas\ - libcompiler_rt\ - libRS_internal\ - libRSDriver\ - libRSCpuRef\ - libft2\ - libpng\ - -endif - -define add-vndk-sp-lib -include $$(CLEAR_VARS) -LOCAL_MODULE := $1.vndk-sp -LOCAL_MODULE_CLASS := SHARED_LIBRARIES -LOCAL_PREBUILT_MODULE_FILE := $$(TARGET_OUT)/lib/$1.so -LOCAL_MULTILIB := 32 -LOCAL_MODULE_TAGS := optional -LOCAL_INSTALLED_MODULE_STEM := $1.so -LOCAL_MODULE_SUFFIX := .so -LOCAL_MODULE_RELATIVE_PATH := vndk-sp -include $$(BUILD_PREBUILT) - -include $$(CLEAR_VARS) -LOCAL_MODULE := $1.vndk-sp -LOCAL_MODULE_CLASS := SHARED_LIBRARIES -LOCAL_PREBUILT_MODULE_FILE := $$(TARGET_OUT)/lib64/$1.so -LOCAL_MULTILIB := 64 -LOCAL_MODULE_TAGS := optional -LOCAL_INSTALLED_MODULE_STEM := $1.so -LOCAL_MODULE_SUFFIX := .so -LOCAL_MODULE_RELATIVE_PATH := vndk-sp -include $$(BUILD_PREBUILT) -endef - -$(foreach lib,$(VNDK_SP_LIBRARIES),\ - $(eval $(call add-vndk-sp-lib,$(lib)))) -endif # if TARGET_DEVICE is muskie or walleye From 33b1891a585e830dbdc1ccc565b2719829f3a7c1 Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Thu, 31 Aug 2017 12:35:41 -0700 Subject: [PATCH 024/300] Add OS Descriptors to MTP and PTP interfaces Test: usb sniffer, verify descriptors are sent Bug: 64790536 Change-Id: If138d74dafe72e1f7dc166b5dc83d4325b32ff4a --- init.hardware.usb.rc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/init.hardware.usb.rc b/init.hardware.usb.rc index 7b8b6924..751813a4 100644 --- a/init.hardware.usb.rc +++ b/init.hardware.usb.rc @@ -39,6 +39,7 @@ on boot mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 + write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" mkdir /dev/usb-ffs 0775 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 @@ -50,15 +51,21 @@ on boot setprop sys.usb.configfs 1 setprop sys.usb.controller "a800000.dwc3" write /sys/module/libcomposite/parameters/disable_l1_for_hs "y" + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + +on property:sys.usb.config=none && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/os_desc/use 0 on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp && property:sys.usb.configfs=1 write /config/usb_gadget/g1/idVendor 0x18d1 write /config/usb_gadget/g1/idProduct 0x4ee1 + write /config/usb_gadget/g1/os_desc/use 1 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 write /config/usb_gadget/g1/idVendor 0x18d1 write /config/usb_gadget/g1/idProduct 0x4ee2 + write /config/usb_gadget/g1/os_desc/use 1 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 on property:sys.usb.config=rndis && property:sys.usb.configfs=1 @@ -74,11 +81,13 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp && property:sys.usb.configfs=1 write /config/usb_gadget/g1/idVendor 0x18d1 write /config/usb_gadget/g1/idProduct 0x4ee5 + write /config/usb_gadget/g1/os_desc/use 1 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 write /config/usb_gadget/g1/idVendor 0x18d1 write /config/usb_gadget/g1/idProduct 0x4ee6 + write /config/usb_gadget/g1/os_desc/use 1 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 on property:sys.usb.config=adb && property:sys.usb.configfs=1 From 34acc4a2bc4f3b526c1587ef6e0a1142693549cd Mon Sep 17 00:00:00 2001 From: Sunmeet Gill Date: Fri, 1 Sep 2017 14:22:13 -0700 Subject: [PATCH 025/300] Change user of cnd from system to radio CRs-Fixed: 2103363 Bug: 62571088 Change-Id: Idca207b8229fad807cb2466ca01991b0ac19f13b --- init.hardware.rc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 4ffe8b0a..e0cb9543 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -704,10 +704,9 @@ service qmuxd /vendor/bin/qmuxd user root group radio audio bluetooth gps nfc qcom_diag -#TODO evaluate group system once b/62571088 is resolved service cnd /vendor/bin/cnd class main - user system + user radio group inet system wifi radio wakelock service netmgrd /vendor/bin/netmgrd From 491d56144b5d3a4192533867fe889f97eb4e2fbd Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Thu, 14 Sep 2017 16:07:36 +0900 Subject: [PATCH 026/300] Add 'vendor.' prefix to a vendor daemon name To prevent property name collisions between properties of system and vendor, 'vendor.' prefix must be added to a vendor HAL service name. You can see the details in http://go/treble-sysprop-compatibility. Test: succeeded building and tested on a walleye device Bug: 36796459 Change-Id: I519603b13978567b51dbb2bcb866aa088a1646e4 --- init.hardware.diag.rc.userdebug | 32 ++++---- init.hardware.rc | 120 +++++++++++++++--------------- power/Power.cpp | 2 +- sepolicy/vendor/property_contexts | 2 +- vr/VrDevice.cpp | 2 +- 5 files changed, 79 insertions(+), 79 deletions(-) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 16d7e834..372b6142 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -58,7 +58,7 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,adb && property: on property:sys.usb.config=diag,serial_cdev,rmnet_gsi,adb && property:sys.usb.configfs=1 start adbd - start port-bridge + start vendor.port-bridge on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,rmnet_gsi,adb && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Default composition" @@ -92,7 +92,7 @@ on property:sys.usb.config=diag,serial_cdev,rmnet_gsi && property:sys.usb.config symlink /config/usb_gadget/g1/functions/gsi.rmnet /config/usb_gadget/g1/configs/b.1/f3 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} - start port-bridge + start vendor.port-bridge on property:sys.usb.config=rndis,diag && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag" @@ -140,11 +140,11 @@ on property:sys.usb.config=rndis,serial_cdev,diag && property:sys.usb.configfs=1 symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f3 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} - start port-bridge + start vendor.port-bridge on property:sys.usb.config=rndis,serial_cdev,diag,adb && property:sys.usb.configfs=1 start adbd - start port-bridge + start vendor.port-bridge on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,serial_cdev,diag,adb && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_dun_diag" @@ -313,11 +313,11 @@ on property:sys.usb.config=diag,serial_cdev && property:sys.usb.configfs=1 symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} - start port-bridge + start vendor.port-bridge on property:sys.usb.config=diag,adb,serial_cdev && property:sys.usb.configfs=1 start adbd - start port-bridge + start vendor.port-bridge on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,adb,serial_cdev && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_adb_dun" @@ -334,14 +334,14 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,adb,serial_cdev write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} -service diag_mdlog_start /vendor/bin/diag_mdlog +service vendor.diag_mdlog_start /vendor/bin/diag_mdlog class late_start user shell group system diag media_rw disabled oneshot -service diag_mdlog_stop /vendor/bin/diag_mdlog -k +service vendor.diag_mdlog_stop /vendor/bin/diag_mdlog -k class late_start user shell group system diag media_rw @@ -352,30 +352,30 @@ on boot && property:persist.sys.modem.diag.mdlog=* setprop sys.modem.diag.mdlog ${persist.sys.modem.diag.mdlog} on property:sys.modem.diag.mdlog=true - start diag_mdlog_start + start vendor.diag_mdlog_start on property:sys.modem.diag.mdlog=false - start diag_mdlog_stop + start vendor.diag_mdlog_stop on property:persist.sys.cnss.diag_qxdm=true - start cnss_diag + start vendor.cnss_diag on property:persist.sys.cnss.diag_qxdm=false - stop cnss_diag + stop vendor.cnss_diag on property:persist.sys.cnss.diag_txt=true - start cnss_diag_txt + start vendor.cnss_diag_txt on property:persist.sys.cnss.diag_txt=false - stop cnss_diag_txt + stop vendor.cnss_diag_txt -service cnss_diag /vendor/bin/cnss_diag -q -u -w +service vendor.cnss_diag /vendor/bin/cnss_diag -q -u -w class late_start user system group system oneshot -service cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cnss_diag/cnss_diag.conf +service vendor.cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cnss_diag/cnss_diag.conf class late_start user system group system diff --git a/init.hardware.rc b/init.hardware.rc index 48971b4a..47467a5b 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -31,7 +31,7 @@ on charger write /sys/class/typec/port0/port_type sink write /sys/module/lpm_levels/parameters/sleep_disabled N -service charger /charger +service vendor.charger /charger class charger seclabel u:r:charger:s0 @@ -39,7 +39,7 @@ on early-init mount debugfs debugfs /sys/kernel/debug chmod 0755 /sys/kernel/debug # Loading kernel modules in background - start insmod_sh + start vendor.insmod_sh on init # Disable UFS powersaving @@ -54,7 +54,7 @@ on init # start qseecomd early as we mount system/ vendor/ early # vold needs keymaster that needs qseecomd - start qseecomd + start vendor.qseecomd # Support legacy paths symlink /sdcard /mnt/sdcard @@ -196,7 +196,7 @@ on fs on late-fs # Start devices by sysfs trigger - start devstart_sh + start vendor.devstart_sh # Start services for bootanim start surfaceflinger start bootanim @@ -211,7 +211,7 @@ on late-fs mkdir /persist/time 0770 system system # Start time daemon early so that the system time can be set early - start time_daemon + start vendor.time_daemon on post-fs # set RLIMIT_MEMLOCK to 64MB @@ -226,7 +226,7 @@ on post-fs on property:sys.user.0.ce_available=true mkdir /data/misc_ce/0/ramoops - start ramoops_sh + start vendor.ramoops_sh on property:sys.ramoops.decrypted=true mount pstore pstore /sys/fs/pstore @@ -239,7 +239,7 @@ on property:sys.ramoops.decrypted=true on property:sys.listeners.registered=true # load IPA FWs - start ipastart_sh + start vendor.ipastart_sh on post-fs-data # We can start netd here before in is launched in common init.rc on zygote-start @@ -484,31 +484,31 @@ on boot # ftm4 VR mode chown system system /sys/devices/virtual/input/ftm4_touch/vrmode -service init-elabel-sh /system/bin/init.elabel.sh +service vendor.init-elabel-sh /system/bin/init.elabel.sh class late_start user system group system oneshot -service init-radio-sh /vendor/bin/init.radio.sh +service vendor.init-radio-sh /vendor/bin/init.radio.sh class late_start user radio group root radio oneshot -service folio_daemon /system/bin/folio_daemon +service vendor.folio_daemon /system/bin/folio_daemon class late_start user system group system -service perfd /vendor/bin/perfd +service vendor.perfd /vendor/bin/perfd class main user root group root readproc system socket perfd seqpacket 0666 root system disabled -service thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf} +service vendor.thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf} class main user root group root system @@ -516,7 +516,7 @@ service thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/ven socket thermal-recv-client stream 0660 system system socket thermal-recv-passive-client stream 0666 system system -service msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf +service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf socket msm_irqbalance seqpacket 660 root system class core user root @@ -524,38 +524,38 @@ service msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance. writepid /dev/cpuset/system-background/tasks on property:persist.sys.ssr.restart_level=* - start ssr_setup + start vendor.ssr_setup -service ssr_setup /vendor/bin/ssr_setup +service vendor.ssr_setup /vendor/bin/ssr_setup oneshot disabled -service ssr_diag /vendor/bin/ssr_diag +service vendor.ssr_diag /vendor/bin/ssr_diag class late_start user system group system disabled -service per_mgr /vendor/bin/pm-service +service vendor.per_mgr /vendor/bin/pm-service class core user system group system ioprio rt 4 shutdown critical -service per_proxy /vendor/bin/pm-proxy +service vendor.per_proxy /vendor/bin/pm-proxy class core user system group system disabled on property:sys.post_boot.parsed=1 - start perfd + start vendor.perfd on property:sys.boot_completed=1 # Enable power setting and set sys.post_boot.parsed to 1 # to start perfd - start power_sh + start vendor.power_sh # Enable UFS powersaving write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1 @@ -582,26 +582,26 @@ on property:sys.boot_completed=1 write /dev/cpuset/application/background/cpus 0-1 write /dev/cpuset/application/cpus 0-1,4-5 -on property:init.svc.per_mgr=running - start per_proxy +on property:init.svc.vendor.per_mgr=running + start vendor.per_proxy on shutdown - stop per_proxy + stop vendor.per_proxy # Disable subsystem restart write /sys/module/subsystem_restart/parameters/disable_restart_work 0x9889deed -service qseecomd /vendor/bin/qseecomd +service vendor.qseecomd /vendor/bin/qseecomd class core user root group root shutdown critical -service time_daemon /vendor/bin/time_daemon +service vendor.time_daemon /vendor/bin/time_daemon class core user root group root -service ss_ramdump /vendor/bin/subsystem_ramdump +service vendor.ss_ramdump /vendor/bin/subsystem_ramdump class main user root group root system @@ -612,12 +612,12 @@ on property:persist.sys.ssr.enable_ramdumps=1 mkdir /data/vendor/ssrdump 761 root system mkdir /data/vendor/ramdump 771 root system mkdir /data/vendor/ramdump/bluetooth 771 root system - start ss_ramdump + start vendor.ss_ramdump on property:persist.sys.ssr.enable_ramdumps=0 write /sys/module/subsystem_restart/parameters/enable_ramdumps 0 -service sensors /vendor/bin/sensors.qcom +service vendor.sensors /vendor/bin/sensors.qcom class core user system group system @@ -625,23 +625,23 @@ service sensors /vendor/bin/sensors.qcom # register QMI services capabilities NET_BIND_SERVICE -service adsprpcd /vendor/bin/adsprpcd +service vendor.adsprpcd /vendor/bin/adsprpcd class main user media group media -service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" +service vendor.irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" class core user root oneshot -service rmt_storage /vendor/bin/rmt_storage +service vendor.rmt_storage /vendor/bin/rmt_storage class core user root ioprio rt 0 shutdown critical -service tftp_server /vendor/bin/tftp_server +service vendor.tftp_server /vendor/bin/tftp_server class core user root group root system @@ -662,18 +662,18 @@ service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ disabled oneshot -service cnss-daemon /vendor/bin/cnss-daemon -n -l +service vendor.cnss-daemon /vendor/bin/cnss-daemon -n -l class late_start user system group system inet wifi -service imsqmidaemon /vendor/bin/imsqmidaemon +service vendor.imsqmidaemon /vendor/bin/imsqmidaemon class main user system socket ims_qmid stream 0660 system radio group radio log diag -service imsdatadaemon /vendor/bin/imsdatadaemon +service vendor.imsdatadaemon /vendor/bin/imsdatadaemon class main user system socket ims_datad stream 0660 system radio @@ -681,85 +681,85 @@ service imsdatadaemon /vendor/bin/imsdatadaemon disabled on property:vendor.ims.QMI_DAEMON_STATUS=1 - start imsdatadaemon + start vendor.imsdatadaemon -service ims_rtp_daemon /vendor/bin/ims_rtp_daemon +service vendor.ims_rtp_daemon /vendor/bin/ims_rtp_daemon class main user system group radio diag inet log disabled -service imsrcsservice /vendor/bin/imsrcsd +service vendor.imsrcsservice /vendor/bin/imsrcsd class hal user system group radio diag inet log disabled on property:vendor.ims.DATA_DAEMON_STATUS=1 - start ims_rtp_daemon - start imsrcsservice + start vendor.ims_rtp_daemon + start vendor.imsrcsservice -service qmuxd /vendor/bin/qmuxd +service vendor.qmuxd /vendor/bin/qmuxd class main user root group radio audio bluetooth gps nfc qcom_diag -service cnd /vendor/bin/cnd +service vendor.cnd /vendor/bin/cnd class main user radio group inet system wifi radio wakelock -service netmgrd /vendor/bin/netmgrd +service vendor.netmgrd /vendor/bin/netmgrd class main user root group root wifi wakelock radio inet -service port-bridge /vendor/bin/port-bridge +service vendor.port-bridge /vendor/bin/port-bridge class main user radio group radio system inet oneshot -service ipacm /vendor/bin/ipacm +service vendor.ipacm /vendor/bin/ipacm class main user radio group radio inet -service qti /vendor/bin/qti +service vendor.qti /vendor/bin/qti class main user radio group radio net_raw diag usb net_admin on property:wc_transport.start_hci=true - start hci_filter + start vendor.hci_filter on property:wc_transport.start_hci=false - stop hci_filter + stop vendor.hci_filter -service hci_filter /vendor/bin/wcnss_filter +service vendor.hci_filter /vendor/bin/wcnss_filter class late_start user bluetooth group bluetooth diag system wakelock disabled -service loc_launcher /vendor/bin/loc_launcher +service vendor.loc_launcher /vendor/bin/loc_launcher class late_start group gps inet diag wifi -service pd_mapper /vendor/bin/pd-mapper +service vendor.pd_mapper /vendor/bin/pd-mapper class core -service atfwd /vendor/bin/ATFWD-daemon +service vendor.atfwd /vendor/bin/ATFWD-daemon class late_start user system group system radio disabled on property:persist.radio.atfwd.start=true - start atfwd + start vendor.atfwd on property:persist.radio.atfwd.start=false - stop atfwd + stop vendor.atfwd # bugreport is triggered by holding down volume down, volume up and power service bugreport /system/bin/dumpstate -d -p -B -z \ @@ -769,42 +769,42 @@ service bugreport /system/bin/dumpstate -d -p -B -z \ oneshot keycodes 114 115 116 -service chre /vendor/bin/chre +service vendor.chre /vendor/bin/chre class late_start user system group system socket chre seqpacket 0660 root system shutdown critical -service power_sh /vendor/bin/init.power.sh +service vendor.power_sh /vendor/bin/init.power.sh class main user root group root system disabled oneshot -service devstart_sh /vendor/bin/init.qcom.devstart.sh +service vendor.devstart_sh /vendor/bin/init.qcom.devstart.sh class main user root group root system disabled oneshot -service ipastart_sh /vendor/bin/init.qcom.ipastart.sh +service vendor.ipastart_sh /vendor/bin/init.qcom.ipastart.sh class main user system group net_admin disabled oneshot -service insmod_sh /vendor/bin/init.insmod.sh +service vendor.insmod_sh /vendor/bin/init.insmod.sh class main user root group root system disabled oneshot -service ramoops_sh /system/bin/init.ramoops.sh +service vendor.ramoops_sh /system/bin/init.ramoops.sh class main user root group root system diff --git a/power/Power.cpp b/power/Power.cpp index c74cb573..81f5db9f 100644 --- a/power/Power.cpp +++ b/power/Power.cpp @@ -60,7 +60,7 @@ Return Power::setInteractive(bool interactive) { } Return Power::powerHint(PowerHint hint, int32_t data) { - if (android::base::GetProperty("init.svc.perfd", "") != "running") { + if (android::base::GetProperty("init.svc.vendor.perfd", "") != "running") { ALOGW("perfd is not started"); return Void(); } diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index b5d5728d..b835280f 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -18,7 +18,7 @@ persist.sys.cnss. u:object_r:cnss_diag_prop:s0 sys.listeners.registered u:object_r:tee_listener_prop:s0 wc_transport. u:object_r:wc_prop:s0 sys.qcom.thermalcfg u:object_r:thermal_prop:s0 -ctl.thermal-engine u:object_r:thermal_prop:s0 +ctl.vendor.thermal-engine u:object_r:thermal_prop:s0 persist.sys.modem.diag. u:object_r:modem_diag_prop:s0 sys.modem.diag. u:object_r:modem_diag_prop:s0 persist.radio.enable_tel_mon u:object_r:tel_mon_prop:s0 diff --git a/vr/VrDevice.cpp b/vr/VrDevice.cpp index c9966abf..75ac436c 100644 --- a/vr/VrDevice.cpp +++ b/vr/VrDevice.cpp @@ -45,7 +45,7 @@ Return VrDevice::setVrMode(bool enabled) { return Void(); } } - if (!android::base::SetProperty("ctl.restart", "thermal-engine")) { + if (!android::base::SetProperty("ctl.restart", "vendor.thermal-engine")) { LOG(ERROR) << "Couldn't set thermal_engine restart property"; } if (!access("/sys/devices/virtual/input/ftm4_touch/vrmode", W_OK)) { From c732976da86147a156a6753c89f41cf272254f17 Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Thu, 14 Sep 2017 08:42:12 -0700 Subject: [PATCH 027/300] [WIFI][TREBLE] Uprev Wi-Fi HAL to 1.2 New HAL APIs are planned. This requires a HAL uprev. Bug: 65647646 Test: builds and Wi-Fi runs Change-Id: Ib7efd3d5263e73d1ad40e1a5a687bdb6c133c812 --- manifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index 6989f4b0..3703fbd1 100644 --- a/manifest.xml +++ b/manifest.xml @@ -340,7 +340,7 @@ android.hardware.wifi hwbinder - 1.1 + 1.2 IWifi default From 98a67963fba19d795339f7ab350414c999dd8c3b Mon Sep 17 00:00:00 2001 From: Ecco Park Date: Wed, 13 Sep 2017 19:07:28 -0700 Subject: [PATCH 028/300] selinux: add the BT logging permission for Pixel logger Denial message: 09-13 18:55:11.249 7554 7577 W libc : Unable to set property "persist.service.bdroid.snooplog" to "true": error code: 0x18 09-13 18:55:11.250 7554 7577 E AndroidRuntime: FATAL EXCEPTION: LoggingService 09-13 18:55:11.250 7554 7577 E AndroidRuntime: Process: com.android.pixellogger, PID: 7554 09-13 18:55:11.250 7554 7577 E AndroidRuntime: java.lang.RuntimeException: failed to set system property 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at android.os.SystemProperties.native_set(Native Method) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at android.os.SystemProperties.set(SystemProperties.java:171) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at com.android.pixellogger.data.logger.vendor.qct.ModemLogger$1.onStart(ModemLogger.java:79) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at com.android.pixellogger.data.logger.vendor.qct.ModemLogger.lambda$startLogging$0$ModemLogger(ModemLogger.java:186) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at com.android.pixellogger.data.logger.vendor.qct.ModemLogger$$Lambda$0.accept(Unknown Source:6) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at java.util.HashMap.forEach(HashMap.java:1292) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at com.android.pixellogger.data.logger.vendor.qct.ModemLogger.startLogging(ModemLogger.java:183) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at com.android.pixellogger.service.logging.LoggingService$StartLoggingRunnable.run(LoggingService.java:458) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:790) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 09-13 18:55:11.250 7554 7577 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:65) 09-13 18:55:11.251 1147 2530 W ActivityManager: Force finishing activity com.android.pixellogger/.ui.main.MainActivity 09-13 18:55:11.257 1147 1206 I ActivityManager: Showing crash dialog for package com.android.pixellogger u0 09-13 21:38:45.198 2084 2084 W wcnss_filter: type=1400 audit(0.0:1174): avc: denied { read } for name="timestamp_switch" dev="sysfs" ino=27539 scontext=u:r:wcnss_filter:s0 tcontext=u:object_r:sysfs_timestamp_switch:s0 tclass=file permissive=0 09-13 21:30:50.451 2031 2031 W wcnss_filter: type=1400 audit(0.0:1390): avc: denied { search } for name="diagchar" dev="sysfs" ino=27213 scontext=u:r:wcnss_filter:s0 tcontext=u:object_r:sysfs_diag:s0 tclass=dir permissive=0 Change-Id: Ia05996c1b6e0969ef6df6ea142271f76445b90e1 Signed-off-by: Ecco Park --- init.hardware.diag.rc.userdebug | 8 ++++++++ sepolicy/vendor/logger_app.te | 1 + sepolicy/vendor/property.te | 1 + sepolicy/vendor/property_contexts | 1 + sepolicy/vendor/wcnss_filter.te | 2 ++ 5 files changed, 13 insertions(+) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 16d7e834..e2e5c81b 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -384,3 +384,11 @@ service cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cnss_diag on property:debug.htc.ramdump.crash=true write /proc/sysrq-trigger "c" + +on property:sys.logger.bluetooth=true + setprop persist.service.bdroid.snooplog true + setprop persist.service.bdroid.fwsnoop true + +on property:sys.logger.bluetooth=false + setprop persist.service.bdroid.snooplog false + setprop persist.service.bdroid.fwsnoop false diff --git a/sepolicy/vendor/logger_app.te b/sepolicy/vendor/logger_app.te index 941da8b7..46874dae 100644 --- a/sepolicy/vendor/logger_app.te +++ b/sepolicy/vendor/logger_app.te @@ -18,4 +18,5 @@ userdebug_or_eng(` set_prop(logger_app, cnss_diag_prop) set_prop(logger_app, modem_diag_prop) + set_prop(logger_app, bluetooth_log_prop) ') diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index b8e8e53f..9f38fab0 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -14,3 +14,4 @@ type modem_diag_prop, property_type; type tel_mon_prop, property_type; type sys_time_prop, property_type; type atfwd_start_prop, property_type; +type bluetooth_log_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index b5d5728d..9094079c 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -24,3 +24,4 @@ sys.modem.diag. u:object_r:modem_diag_prop:s0 persist.radio.enable_tel_mon u:object_r:tel_mon_prop:s0 sys.time.set u:object_r:sys_time_prop:s0 persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 +sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 diff --git a/sepolicy/vendor/wcnss_filter.te b/sepolicy/vendor/wcnss_filter.te index c7c72c77..80d7944e 100644 --- a/sepolicy/vendor/wcnss_filter.te +++ b/sepolicy/vendor/wcnss_filter.te @@ -12,7 +12,9 @@ userdebug_or_eng(` allow wcnss_filter diag_device:chr_file rw_file_perms; allow wcnss_filter ramdump_vendor_data_file:dir create_dir_perms; allow wcnss_filter ramdump_vendor_data_file:file create_file_perms; + allow wcnss_filter sysfs_timestamp_switch:file r_file_perms; r_dir_file(wcnss_filter, debugfs_ipc) + r_dir_file(wcnss_filter, sysfs_diag) ') #allow wakelock From 622c59c143da204bfcfd03c8c86d47b215e2b174 Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Thu, 14 Sep 2017 15:39:31 -0700 Subject: [PATCH 029/300] [RTT2] Add support for RTT feature flag Add RTT feature flag to the list of supported features on wahoo devices. New feature flag for RTT. Bug: 65014628 Test: integration tests pass Change-Id: I5339a2fe6ca88ac05386f0c7b23e509641bb5cff --- device.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/device.mk b/device.mk index 82c4c80c..0d08ba22 100755 --- a/device.mk +++ b/device.mk @@ -146,6 +146,7 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \ frameworks/native/data/etc/android.hardware.wifi.aware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.aware.xml \ frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \ + frameworks/native/data/etc/android.hardware.wifi.rtt.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.rtt.xml \ frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \ frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \ From 383c58d861e790b6144086052e1778c26e4f0b4d Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 18 Sep 2017 15:35:34 -0700 Subject: [PATCH 030/300] dumpstate: Add UFS debug output to dumpstate_board.txt Bug: 65848498 Test: adb bugreport Change-Id: I0df04fdabf085341ba679ffedf06dcdea407e322 --- dumpstate/DumpstateDevice.cpp | 3 +++ sepolicy/vendor/hal_dumpstate_impl.te | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 2e908638..310f45ad 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -182,6 +182,9 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "SoC serial number", "/sys/devices/soc0/serial_number"); DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present"); DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online"); + DumpFileToFd(fd, "UFS model", "/sys/block/sda/device/model"); + DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev"); + DumpFileToFd(fd, "UFS size", "/sys/block/sda/size"); DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts"); DumpFileToFd(fd, "RPM Stats", "/d/rpm_stats"); DumpFileToFd(fd, "Power Management Stats", "/d/rpm_master_stats"); diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index c0a14f9d..9512b223 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -59,3 +59,7 @@ allow hal_dumpstate_impl display_vendor_data_file:file r_file_perms; # Access to touch firmware info allow hal_dumpstate_impl sysfs_touch:dir r_dir_perms; allow hal_dumpstate_impl sysfs_touch:file rw_file_perms; + +# Access to UFS info +allow hal_dumpstate_impl sysfs_scsi_devices_0000:dir r_dir_perms; +allow hal_dumpstate_impl sysfs_scsi_devices_0000:file r_file_perms; From 6ce431799ec477cd57a51d41312e1fc580aca3f0 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Thu, 21 Sep 2017 13:18:25 -0700 Subject: [PATCH 031/300] Ramdump read access to proc/cmdline Test: device boots without selinux denials from ramdump Change-Id: Id4b0dc53295ef26b53d0f7b0e6d65e435743509f --- sepolicy/vendor/ramdump.te | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sepolicy/vendor/ramdump.te b/sepolicy/vendor/ramdump.te index caa01582..d150fbfd 100644 --- a/sepolicy/vendor/ramdump.te +++ b/sepolicy/vendor/ramdump.te @@ -10,7 +10,10 @@ userdebug_or_eng(` allow ramdump ramdump_vendor_data_file:dir create_dir_perms; allow ramdump ramdump_vendor_data_file:file create_file_perms; - allow ramdump proc:file r_file_perms; + allow ramdump { + proc + proc_cmdline + }:file r_file_perms; allow ramdump block_device:dir search; allow ramdump misc_block_device:blk_file rw_file_perms; From 4a6503bf5261c3415fb859a818fd7b6cda2be9b9 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Tue, 26 Sep 2017 15:58:54 +0800 Subject: [PATCH 032/300] Only copy init.recovery.$(PRODUCT_HARDWARE).rc to recovery root Currently it's copied to normal root, for build system to copy init.recovery.*.rc to recovery root. However, with the following fix from AOSP, this isn't needed. We can only copy init.recovery.*.rc to recovery root. https://android-review.googlesource.com/#/c/platform/build/+/493017/ Bug: 65570851 Test: recovery/normal boot the device Change-Id: I9e996a8ed30775ed633ed8ec3fc0b7b9970ff0fb --- CleanSpec.mk | 3 +++ device.mk | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index af32e90a..8e6689f7 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -143,3 +143,6 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/vndk-sp/libz.so) # Remove eSIM OTA image $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/EuiccGoogle/esim.img) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/EuiccGoogle/esim2.img) + +# Remove init.recovery.*.rc file in root directory (only needed in recovery root). +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.recovery.$(PRODUCT_HARDWARE).rc) diff --git a/device.mk b/device.mk index 2ea35376..5ee1829e 100755 --- a/device.mk +++ b/device.mk @@ -55,7 +55,7 @@ DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay PRODUCT_COPY_FILES += \ $(LOCAL_KERNEL):kernel \ - $(LOCAL_PATH)/init.recovery.hardware.rc:root/init.recovery.$(PRODUCT_HARDWARE).rc \ + $(LOCAL_PATH)/init.recovery.hardware.rc:recovery/root/init.recovery.$(PRODUCT_HARDWARE).rc \ $(LOCAL_PATH)/init.hardware.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.$(PRODUCT_HARDWARE).rc \ $(LOCAL_PATH)/init.hardware.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.wahoo.usb.rc \ $(LOCAL_PATH)/ueventd.hardware.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc \ From d303c1509b22cc6abe3a5fe4a9209d334e594dca Mon Sep 17 00:00:00 2001 From: Jie Song Date: Wed, 16 Aug 2017 11:52:05 -0700 Subject: [PATCH 033/300] Collect most recent modem logs Bug: 64329189 Test: Check number of log files in Bugreport Change-Id: I71ebb1d2efda324c9de4adadabf4baac1529f202 --- dumpstate/DumpstateDevice.cpp | 61 +++++++++++++++++++++++++++++++---- dumpstate/DumpstateDevice.h | 2 ++ 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 2e908638..f92b2099 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -21,10 +21,11 @@ #include #include #include -#include #include -#include -#include +#include + +#define _SVID_SOURCE +#include #include "DumpstateUtil.h" @@ -35,6 +36,8 @@ #define DIAG_MDLOG_PROPERTY "sys.modem.diag.mdlog" #define DIAG_MDLOG_STATUS_PROPERTY "sys.modem.diag.mdlog_on" +#define DIAG_MDLOG_NUMBER_BUGREPORT "persist.sys.modem.diag.mdlog_br_num" + using android::os::dumpstate::CommandOptions; using android::os::dumpstate::DumpFileToFd; using android::os::dumpstate::PropertiesHelper; @@ -46,6 +49,54 @@ namespace dumpstate { namespace V1_0 { namespace implementation { +#define DIAG_LOG_PREFIX "diag_log_" + +void DumpstateDevice::dumpDiagLogs(int fd, std::string srcDir, std::string destDir) { + struct dirent **dirent_list = NULL; + int num_entries = scandir(srcDir.c_str(), + &dirent_list, + 0, + (int (*)(const struct dirent **, const struct dirent **)) alphasort); + if (!dirent_list) { + return; + } else if (num_entries <= 0) { + return; + } + + int maxFileNum = android::base::GetIntProperty(DIAG_MDLOG_NUMBER_BUGREPORT, 100); + int copiedFiles = 0; + + for (int i = num_entries - 1; i >= 0; i--) { + ALOGD("Found %s\n", dirent_list[i]->d_name); + + if (0 != strncmp(dirent_list[i]->d_name, DIAG_LOG_PREFIX, strlen(DIAG_LOG_PREFIX))) { + continue; + } + + if ((copiedFiles >= maxFileNum) && (maxFileNum != -1)) { + ALOGD("Skipped %s\n", dirent_list[i]->d_name); + continue; + } + + copiedFiles++; + + CommandOptions options = CommandOptions::WithTimeout(120).Build(); + std::string srcLogFile = srcDir + "/" + dirent_list[i]->d_name; + std::string destLogFile = destDir + "/" + dirent_list[i]->d_name; + + std::string copyCmd= "/vendor/bin/cp " + srcLogFile + " " + destLogFile; + + ALOGD("Copying %s to %s\n", srcLogFile.c_str(), destLogFile.c_str()); + RunCommandToFd(fd, "CP DIAG LOGS", { "/vendor/bin/sh", "-c", copyCmd.c_str() }, options); + } + + while (num_entries--) { + free(dirent_list[num_entries]); + } + + free(dirent_list); +} + void DumpstateDevice::dumpModem(int fd, int fdModem) { std::string modemLogDir = android::base::GetProperty(MODEM_LOG_LOC_PROPERTY, ""); @@ -77,8 +128,6 @@ void DumpstateDevice::dumpModem(int fd, int fdModem) if (smlogEnabled) { RunCommandToFd(fd, "SMLOG DUMP", { "smlog_dump", "-d", "-o", modemLogAllDir.c_str() }, options); } else if (diagLogEnabled) { - std::string copyCmd= "/vendor/bin/cp -rf " + diagLogDir + " " + modemLogAllDir; - android::base::SetProperty(DIAG_MDLOG_PROPERTY, "false"); ALOGD("Waiting for diag log to exit\n"); @@ -92,7 +141,7 @@ void DumpstateDevice::dumpModem(int fd, int fdModem) sleep(1); } - RunCommandToFd(fd, "CP DIAG LOGS", { "/vendor/bin/sh", "-c", copyCmd.c_str()}, options); + dumpDiagLogs(fd, diagLogDir, modemLogAllDir); android::base::SetProperty(DIAG_MDLOG_PROPERTY, "true"); } diff --git a/dumpstate/DumpstateDevice.h b/dumpstate/DumpstateDevice.h index 650c0cd0..0a1d0239 100644 --- a/dumpstate/DumpstateDevice.h +++ b/dumpstate/DumpstateDevice.h @@ -19,6 +19,7 @@ #include #include #include +#include namespace android { namespace hardware { @@ -39,6 +40,7 @@ struct DumpstateDevice : public IDumpstateDevice { // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow. Return dumpstateBoard(const hidl_handle& h) override; + void dumpDiagLogs(int fd, std::string srcDir, std::string destDir); void dumpModem(int fd, int fdModem); }; From f5564a01f6e753c8d8abe12916c4050ffcb44489 Mon Sep 17 00:00:00 2001 From: Garik Badalyan Date: Tue, 19 Sep 2017 12:00:21 -0700 Subject: [PATCH 034/300] Remove slot2 instance QcRilAudio HAL The device doesn't support MSIM and hence the second instance of the QcRilAudio HAL won't be available. cherry picked from e7427bc226af55b44d5e7a440446cd7a111c6e32 BUG=65255945 Test: lshal doesn't show slot2 on wahoo Change-Id: I22baba6ce215422a729914820f32303ed2de0c85 --- manifest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index b4d1c71d..72559d6d 100644 --- a/manifest.xml +++ b/manifest.xml @@ -407,7 +407,6 @@ IQcRilAudio slot1 - slot2 From 7f89808da7c66ca1aa7601214813d21a29c12967 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 27 Sep 2017 14:02:12 -0700 Subject: [PATCH 035/300] wahoo(manifest): Uprev to supplicant 1.1 Bug: 65673412 Test: Device boots up and connects to wifi networks. Change-Id: I2e51291b30fd242edbeae2c69ef9545383895bb3 --- manifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index b4d1c71d..98d5e556 100644 --- a/manifest.xml +++ b/manifest.xml @@ -349,7 +349,7 @@ android.hardware.wifi.supplicant hwbinder - 1.0 + 1.1 ISupplicant default From 2da2a3849933c6b36c5f3b61d0b5d244d382b907 Mon Sep 17 00:00:00 2001 From: Glen Kuhne Date: Wed, 27 Sep 2017 10:45:32 -0700 Subject: [PATCH 036/300] Add p2p_no_group_iface=1 to p2p_supplicant_overlay Configures wpa_supplicant to use p2p0 mgmt iface instead of dynamically created p2p-p2p0-XYZ virtual interfaces for P2P group. Bug: 65524423 Test: CtsVerifier WifiDirect Test: Manual verification Change-Id: If657d8afff278c3c2a196b0ecab8d92c985999dd --- p2p_supplicant_overlay.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/p2p_supplicant_overlay.conf b/p2p_supplicant_overlay.conf index acbace22..b5e89e03 100644 --- a/p2p_supplicant_overlay.conf +++ b/p2p_supplicant_overlay.conf @@ -1 +1,2 @@ disable_scan_offload=1 +p2p_no_group_iface=1 From 0db0037ca1a8015e26c45c0d45e9e5f1976a2881 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 2 Oct 2017 14:48:46 -0700 Subject: [PATCH 037/300] Add UFS health information into board specific dumpstate Test: Take bugreport Bug: 66967195 Change-Id: Id635b64f77d4a6fdc1ace2290f89adfdf86514a7 --- dumpstate/DumpstateDevice.cpp | 1 + init.hardware.rc | 13 +++++++++++++ sepolicy/vendor/file.te | 1 + sepolicy/vendor/genfs_contexts | 1 + sepolicy/vendor/hal_dumpstate_impl.te | 2 ++ 5 files changed, 18 insertions(+) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 8df62913..7bab6be7 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -234,6 +234,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "UFS model", "/sys/block/sda/device/model"); DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev"); DumpFileToFd(fd, "UFS size", "/sys/block/sda/size"); + RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", "for f in $(find /sys/kernel/debug/ufshcd0 -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; fi; done"}); DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts"); DumpFileToFd(fd, "RPM Stats", "/d/rpm_stats"); DumpFileToFd(fd, "Power Management Stats", "/d/rpm_master_stats"); diff --git a/init.hardware.rc b/init.hardware.rc index 4d15ad8d..1b12119f 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -583,6 +583,19 @@ on property:sys.boot_completed=1 write /dev/cpuset/application/background/cpus 0-1 write /dev/cpuset/application/cpus 0-1,4-5 + # UFS health + chmod 755 /sys/kernel/debug/ufshcd0 + chown 644 /sys/kernel/debug/ufshcd0/err_state + chmod 644 /sys/kernel/debug/ufshcd0/power_mode + chmod 644 /sys/kernel/debug/ufshcd0/host_regs + chmod 644 /sys/kernel/debug/ufshcd0/show_hba + chmod 644 /sys/kernel/debug/ufshcd0/dump_device_desc + chmod 644 /sys/kernel/debug/ufshcd0/dump_health_desc + chmod 755 /sys/kernel/debug/ufshcd0/stats + chmod 644 /sys/kernel/debug/ufshcd0/stats/req_stats + chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats + chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats + on property:init.svc.vendor.per_mgr=running start vendor.per_proxy diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index fc569b5a..2e41283c 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -27,6 +27,7 @@ type debugfs_usb, debugfs_type, fs_type; type debugfs_wlan, debugfs_type, fs_type; type debugfs_mdp, debugfs_type, fs_type; type debugfs_icnss, debugfs_type, fs_type; +type debugfs_ufs, debugfs_type, fs_type; # /proc type proc_wifi_dbg, fs_type; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index fae60212..6acbe849 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -85,3 +85,4 @@ genfscon debugfs /msm_ipc_router u:object_r:debugfs_ipc:s0 genfscon debugfs /mdp u:object_r:debugfs_mdp:s0 genfscon debugfs /rmt_storage u:object_r:debugfs_rmt_storage:s0 genfscon debugfs /icnss u:object_r:debugfs_icnss:s0 +genfscon debugfs /ufshcd0 u:object_r:debugfs_ufs:s0 diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index 9512b223..32b875d2 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -45,6 +45,8 @@ allow hal_dumpstate_impl debugfs_icnss:dir r_dir_perms; allow hal_dumpstate_impl debugfs_icnss:file r_file_perms; allow hal_dumpstate_impl debugfs_ipc:file r_file_perms; allow hal_dumpstate_impl proc_stat:file r_file_perms; +allow hal_dumpstate_impl debugfs_ufs:dir r_dir_perms; +allow hal_dumpstate_impl debugfs_ufs:file r_file_perms; # Access to files for dumping allow hal_dumpstate_impl sysfs:dir r_dir_perms; From 4c4b82fdbb38ce544f1a36f5eb9f32b22d58a700 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 31 Aug 2017 13:35:48 -0700 Subject: [PATCH 038/300] lisa: add board file with script to build and flash wahoo device Add board config file holding device and update configuration parameters. It is used by LISA scripts to allow image rebuilding and reimaging of the target device. External script to build and flash wahoo device is provided. Change-Id: I7581cdb6d475aa3206a26bd230baeeb89782b920 Signed-off-by: Suren Baghdasaryan --- lisa/board.json | 41 ++++++++++++++++ lisa/update-script.sh | 111 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 lisa/board.json create mode 100755 lisa/update-script.sh diff --git a/lisa/board.json b/lisa/board.json new file mode 100644 index 00000000..65d7777c --- /dev/null +++ b/lisa/board.json @@ -0,0 +1,41 @@ +{ + "board" : { + "cores" : [ + "a53", "a53", "a53", "a53", + "a72", "a72", "a72", "a72" + ], + "big_core" : "a72", + "modules" : ["bl", "cpufreq"] + }, + "nrg_model" : { + "little" : { + "cpu" : { + "nrg_max" : 201, + "cap_max" : 438 + }, + "cluster" : { + "nrg_max" : 66 + } + }, + "big": { + "cpu" : { + "nrg_max" : 1138, + "cap_max" : 1024 + }, + "cluster" : { + "nrg_max" : 203 + } + } + }, + + "update-config" : { + "kernel" : { + "build-script" : "update-script.sh kernel build", + "flash-script" : "update-script.sh kernel flash" + }, + "all" : { + "build-script" : "update-script.sh all build", + "flash-script" : "update-script.sh all flash" + } + } +} diff --git a/lisa/update-script.sh b/lisa/update-script.sh new file mode 100755 index 00000000..6255dae7 --- /dev/null +++ b/lisa/update-script.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +build_kernel() { + echo "==========Building kernel image==========" + cd $ANDROID_BUILD_TOP + source build/envsetup.sh + lunch walleye-userdebug + cd $LOCAL_KERNEL_HOME + . ./build.config + make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${DEFCONFIG} + make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -j32 + cp $LOCAL_KERNEL_HOME/arch/arm64/boot/Image.lz4-dtb arch/arm64/boot/dtbo.img `find . -name '*.ko'` $ANDROID_BUILD_TOP/device/google/wahoo-kernel +} + +build_image() { + cd $ANDROID_BUILD_TOP + source build/envsetup.sh + lunch walleye-userdebug + if [ "$1" = "bootimage" ]; then + echo "==========Building bootimage==========" + make -j32 vendorimage-nodeps + make -j32 vbmetaimage-nodeps + make -j32 bootimage + else + echo "==========Building complete image==========" + make -j32 + fi +} + +wait_for_fastboot() { + # wait for device to enter fastboot, max wait is 200secs + local i=0 + while [ $i -lt 100 ] + do + if [ -n "`fastboot devices`" ]; then + break + else + sleep 2 + i=$((i+1)) + fi + done +} + +flash_android() { + # reboot the device if it's online + if [ "`adb devices`" != "List of devices attached" ]; then + echo "==========Rebooting the device into fastboot==========" + adb reboot bootloader + fi + + echo "==========Waiting for device to enter fastboot==========" + wait_for_fastboot + + if [ -z "`fastboot devices`" ]; then + echo "==========Device failed to enter fastboot==========" + exit + fi + + # flash the device + if [ "$1" = "bootimage" ]; then + echo "==========Flashing bootimage==========" + fastboot flash vbmeta + fastboot flash vendor + fastboot flash boot + fastboot reboot + else + echo "==========Flashing complete image==========" + fastboot flashall + fi + + echo "==========Waiting for device to come online==========" + # wait for device to boot + adb wait-for-device +} + +# check input parameters +if [ "$1" != "kernel" ] && [ "$1" != "all" ]; then + echo "First parameter \"$1\" is invalid. Should be \"kernel\" or \"all\"." + exit +fi + +if [ "$2" != "build" ] && [ "$2" != "flash" ]; then + echo "Second parameter \"$2\" is invalid. Should be \"build\" or \"flash\"." + exit +fi + +if [ -z "$ANDROID_BUILD_TOP" ]; then + echo "ANDROID_BUILD_TOP environment variable is not set." + exit +fi + +if [ -z "$LOCAL_KERNEL_HOME" ]; then + echo "LOCAL_KERNEL_HOME environment variable is not set." + exit +fi + +if [ "$2" = "build" ]; then + build_kernel + if [ "$1" = "kernel" ]; then + build_image bootimage + else + build_image + fi +else + if [ "$1" = "kernel" ]; then + flash_android bootimage + else + flash_android + fi +fi + From 4f2db9be1a0724b953bc603a79272d6195651198 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Thu, 5 Oct 2017 14:40:59 -0700 Subject: [PATCH 039/300] sepolicy: add owners file Test: build Change-Id: Ic4aa057a87836502e008117e5f648ddbd7a5014f --- sepolicy/OWNERS | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sepolicy/OWNERS diff --git a/sepolicy/OWNERS b/sepolicy/OWNERS new file mode 100644 index 00000000..4bd7e349 --- /dev/null +++ b/sepolicy/OWNERS @@ -0,0 +1,6 @@ +nnk@google.com +jeffv@google.com +klyubin@google.com +dcashman@google.com +jbires@google.com +sspatil@google.com From 23ea15a12a5e253241d85f57568bec709e85f98f Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Thu, 5 Oct 2017 14:46:10 -0700 Subject: [PATCH 040/300] sepolicy: domain: remove world access to /dev/diag This driver is not safe for general use, particularly for third party apps, even on debug builds. Adding OWNERS file in a subsequent commit to prevent security violations like this from getting checked in. Test: build Change-Id: I245244e924ae247b6fbd48aa033bb71cca6067de --- sepolicy/vendor/domain.te | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sepolicy/vendor/domain.te b/sepolicy/vendor/domain.te index fdbac32c..eedf87fd 100644 --- a/sepolicy/vendor/domain.te +++ b/sepolicy/vendor/domain.te @@ -1,7 +1,3 @@ -userdebug_or_eng(` - allow domain diag_device:chr_file rw_file_perms; -') - # In order for /sys/kernel/debug/kgsl/proc//mem # to be created for memory tracking, the domain of # the tracked process must have permission to search From 3fbb53990779f7fbbf22e5bac4d279e78e1b1e3a Mon Sep 17 00:00:00 2001 From: Sundong Ahn Date: Tue, 10 Oct 2017 13:47:40 +0900 Subject: [PATCH 041/300] delete ro.vendor.vndk.version property ro.vendor.vndk.version property is used by system and vendor. So, this property is no longer vendor property. This property is deleted and "ro.vndk.version" property is added in build/make/ Bug: 66072863 Test: Build & run Change-Id: Ia14f12b2507c68bc19cc014b9802ced84dab57d3 --- CleanSpec.mk | 3 +++ device.mk | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index 8e6689f7..a1792ca5 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -146,3 +146,6 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/EuiccGoogle/esim2.i # Remove init.recovery.*.rc file in root directory (only needed in recovery root). $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.recovery.$(PRODUCT_HARDWARE).rc) + +# Remove build and default prop. +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/*.prop) diff --git a/device.mk b/device.mk index e5c015e6..22c54aae 100755 --- a/device.mk +++ b/device.mk @@ -536,9 +536,6 @@ PRODUCT_PACKAGES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.frp.pst=/dev/block/platform/soc/1da4000.ufshc/by-name/frp -PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.vndk.version=27.1.0 \ - # Include vndk/vndk-sp/ll-ndk modules PRODUCT_PACKAGES += vndk_package From e2c0c287fb8fe6b0f33c1a84492c41baaf29c074 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 5 Oct 2017 15:22:09 -0700 Subject: [PATCH 042/300] sepolicy: Remove update_verifier.te. It has been added into core policy through https://android-review.googlesource.com/c/platform/system/sepolicy/+/503421. Bug: 63440407 Test: update_verifier successfully triggers blocks verification and marks a sucessful boot; Test: No sysfs_dm related denials on walleye. Change-Id: I5605af8b10d890489c25f16f82274f828e10e751 --- sepolicy/vendor/update_verifier.te | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 sepolicy/vendor/update_verifier.te diff --git a/sepolicy/vendor/update_verifier.te b/sepolicy/vendor/update_verifier.te deleted file mode 100644 index cdc304f7..00000000 --- a/sepolicy/vendor/update_verifier.te +++ /dev/null @@ -1,4 +0,0 @@ -# update_verifier reads /sys/block/dm-X/dm/name to find the device-mapper -# entries for system and vendor partitions. -allow update_verifier sysfs:file r_file_perms; -allow update_verifier sysfs:dir r_dir_perms; From f7f404b49dad4a5be82e1c8a602cf7a534a14b83 Mon Sep 17 00:00:00 2001 From: Grace Chen Date: Wed, 11 Oct 2017 10:24:01 -0700 Subject: [PATCH 043/300] Enable silent pin verification for BT SAP Bug: 64426015 Test: silent pin verification Change-Id: I2b408a1af92b4dcc3d4b4b85b97197b92c693ba7 --- device.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/device.mk b/device.mk index e5c015e6..c431443b 100755 --- a/device.mk +++ b/device.mk @@ -214,6 +214,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.radio.data_ltd_sys_ind=1 \ persist.radio.is_wps_enabled=true \ persist.radio.videopause.mode=1 \ + persist.radio.sap_silent_pin=1 \ persist.radio.sib16_support=1 \ persist.radio.data_con_rprt=true \ persist.radio.always_send_plmn=true \ From c2b4ce4e0a0cc6b55db97e7872cd1abdd75ec25a Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Wed, 11 Oct 2017 12:50:34 -0700 Subject: [PATCH 044/300] add libcutils to PRODUCT_STATIC_BOOT_CONTROL_HAL This was picked up transitively previously, but that transitive include is removed, so we include it explicitly here. Test: build Change-Id: I023831d0fbe474d363201f792bbfb3f7ea38cd9b --- device.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/device.mk b/device.mk index e5c015e6..203b220d 100755 --- a/device.mk +++ b/device.mk @@ -118,7 +118,8 @@ AB_OTA_POSTINSTALL_CONFIG += \ PRODUCT_STATIC_BOOT_CONTROL_HAL := \ bootctrl.msm8998 \ libgptutils \ - libz + libz \ + libcutils PRODUCT_PACKAGES += \ update_engine_sideload From c760b34307f28d8d68ee6b0e03f0d670e3d8eadd Mon Sep 17 00:00:00 2001 From: Max Bires Date: Tue, 10 Oct 2017 16:23:15 -0700 Subject: [PATCH 045/300] Adding userdebug/eng diag access for following domains World access to diag_device for userdebug/eng builds was revoked due to potential for dangerous use from 3rd party code so this CL grants access back to the domains that requested it. denied { read write } for pid=832 comm="qti" name="diag" dev="tmpfs" ino =9583 scontext=u:r:qti:s0 tcontext=u:object_r:diag_device:s0 tclass=chr_ file denied { read write } for pid=808 comm="thermal-engine" name="diag" dev= "tmpfs" ino=9583 scontext=u:r:thermal-engine:s0 tcontext=u:object_r:diag _device:s0 tclass=chr_file denied { read write } for pid=877 comm="cnss_diag" name="diag" dev="tmpf s" ino=9583 scontext=u:r:wcnss_service:s0 tcontext=u:object_r:diag_devic e:s0 tclass=chr_file denied { read write } for pid=816 comm="imsqmidaemon" name="diag" dev="t mpfs" ino=9583 scontext=u:r:ims:s0 tcontext=u:object_r:diag_device:s0 tc lass=chr_file denied { read write } for pid=753 comm="android.hardwar" name="diag" dev ="tmpfs" ino=9583 scontext=u:r:hal_sensors_default:s0 tcontext=u:object_ r:diag_device:s0 tclass=chr_file denied { read write } for pid=772 comm="sensors.qcom" name="diag" dev="t mpfs" ino=9583 scontext=u:r:sensors:s0 tcontext=u:object_r:diag_device:s 0 tclass=chr_file denied { read write } for pid=677 comm="time_daemon" name="diag" dev="tm pfs" ino=9583 scontext=u:r:time_daemon:s0 tcontext=u:object_r:diag_devic e:s0 tclass=chr_file denied { read write } for pid=618 comm="android.hardwar" name="diag" dev ="tmpfs" ino=9583 scontext=u:r:hal_graphics_composer_default:s0 tcontext =u:object_r:diag_device:s0 tclass=chr_file denied { read write } for pid=854 comm="rild" name="diag" dev="tmpfs" in o=10642 scontext=u:r:rild:s0 tcontext=u:object_r:diag_device:s0 tclass=c hr_file denied { read write } for pid=828 comm="netmgrd" name="diag" dev="tmpfs" ino=10642 scontext=u:r:netmgrd:s0 tcontext=u:object_r:diag_device:s0 tcl ass=chr_file denied { read write } for pid=826 comm="cnd" name="diag" dev="tmpfs" ino =10642 scontext=u:r:cnd:s0 tcontext=u:object_r:diag_device:s0 tclass=chr _file denied { read write } for pid=1559 comm="iptables-wrappe" path="/dev/dia g" dev="tmpfs" ino=17555 scontext=u:r:netutils_wrapper:s0 tcontext=u:obj ect_r:diag_device:s0 tclass=chr_file Test: domains that need diag_device access can get access to it Change-Id: I6b2473958d10145ed981c5fbcb2ebd3232fcee0e --- sepolicy/vendor/cnd.te | 5 +++++ sepolicy/vendor/hal_graphics_composer_default.te | 2 ++ sepolicy/vendor/hal_sensors_default.te | 2 ++ sepolicy/vendor/ims.te | 5 +++++ sepolicy/vendor/netmgrd.te | 2 ++ sepolicy/vendor/netutils_wrapper.te | 5 +++++ sepolicy/vendor/qti.te | 5 +++++ sepolicy/vendor/rild.te | 2 ++ sepolicy/vendor/sensors.te | 2 ++ sepolicy/vendor/thermal-engine.te | 5 +++++ sepolicy/vendor/time_daemon.te | 5 +++++ sepolicy/vendor/wcnss_service.te | 2 ++ 12 files changed, 42 insertions(+) diff --git a/sepolicy/vendor/cnd.te b/sepolicy/vendor/cnd.te index ca562c9a..d7aa8103 100644 --- a/sepolicy/vendor/cnd.te +++ b/sepolicy/vendor/cnd.te @@ -29,3 +29,8 @@ hwbinder_use(cnd) get_prop(cnd, hwservicemanager_prop) binder_call(cnd, dataservice_app) binder_call(cnd, ims) + +userdebug_or_eng(` + allow cnd diag_device:chr_file rw_file_perms; +') +dontaudit cnd diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/hal_graphics_composer_default.te b/sepolicy/vendor/hal_graphics_composer_default.te index 7bea2e1b..d9cb26aa 100644 --- a/sepolicy/vendor/hal_graphics_composer_default.te +++ b/sepolicy/vendor/hal_graphics_composer_default.te @@ -31,4 +31,6 @@ allow hal_graphics_composer_default display_vendor_data_file:file create_file_pe userdebug_or_eng(` allow hal_graphics_composer_default debugfs_mdp:dir r_dir_perms; allow hal_graphics_composer_default debugfs_mdp:file r_file_perms; + allow hal_graphics_composer_default diag_device:chr_file rw_file_perms; ') +dontaudit hal_graphics_composer_default diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/hal_sensors_default.te b/sepolicy/vendor/hal_sensors_default.te index fa473a87..ec604515 100644 --- a/sepolicy/vendor/hal_sensors_default.te +++ b/sepolicy/vendor/hal_sensors_default.te @@ -12,4 +12,6 @@ allow hal_sensors_default qdsp_device:chr_file r_file_perms; userdebug_or_eng(` r_dir_file(hal_sensors_default, sysfs_diag) allow hal_sensors_default sysfs_timestamp_switch:file r_file_perms; + allow hal_sensors_default diag_device:chr_file rw_file_perms; ') +dontaudit hal_sensors_default diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/ims.te b/sepolicy/vendor/ims.te index a229417f..4a11d749 100644 --- a/sepolicy/vendor/ims.te +++ b/sepolicy/vendor/ims.te @@ -33,3 +33,8 @@ r_dir_file(ims, sysfs_diag) hwbinder_use(ims) allow ims hal_cne_hwservice:hwservice_manager find; binder_call(ims, cnd) + +userdebug_or_eng(` + allow ims diag_device:chr_file rw_file_perms; +') +dontaudit ims diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/netmgrd.te b/sepolicy/vendor/netmgrd.te index adbc4b6d..197f6720 100644 --- a/sepolicy/vendor/netmgrd.te +++ b/sepolicy/vendor/netmgrd.te @@ -40,7 +40,9 @@ domain_auto_trans(netmgrd, netutils_wrapper_exec, netutils_wrapper) allow netmgrd sysfs_timestamp_switch:file { read open }; userdebug_or_eng(` r_dir_file(netmgrd, sysfs_diag) + allow netmgrd diag_device:chr_file rw_file_perms; ') +dontaudit netmgrd diag_device:chr_file rw_file_perms; #Ignore if device loading for private IOCTL failed dontaudit netmgrd kernel:system { module_request }; diff --git a/sepolicy/vendor/netutils_wrapper.te b/sepolicy/vendor/netutils_wrapper.te index ec34fd39..f8c6f80a 100644 --- a/sepolicy/vendor/netutils_wrapper.te +++ b/sepolicy/vendor/netutils_wrapper.te @@ -5,3 +5,8 @@ allow netutils_wrapper netmgrd:fifo_file { getattr read write append }; dontaudit netutils_wrapper netmgrd:netlink_socket { getattr read write append }; dontaudit netutils_wrapper kernel:system module_request; dontaudit netutils_wrapper self:capability sys_module; + +userdebug_or_eng(` + allow netutils_wrapper diag_device:chr_file rw_file_perms; +') +dontaudit netutils_wrapper diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/qti.te b/sepolicy/vendor/qti.te index a5d1aa84..e71ac822 100644 --- a/sepolicy/vendor/qti.te +++ b/sepolicy/vendor/qti.te @@ -14,3 +14,8 @@ allow qti self:socket create_socket_perms; allowxperm qti self:socket ioctl msm_sock_ipc_ioctls; r_dir_file(qti, sysfs_msm_subsys) + +userdebug_or_eng(` + allow qti diag_device:chr_file rw_file_perms; +') +dontaudit qti diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te index 15d084ce..ff643af7 100644 --- a/sepolicy/vendor/rild.te +++ b/sepolicy/vendor/rild.te @@ -21,7 +21,9 @@ allow rild time_daemon:unix_stream_socket connectto; userdebug_or_eng(` domain_auto_trans(rild, smlog_dump_exec, smlog_dump) + allow rild diag_device:chr_file rw_file_perms; ') +dontaudit rild diag_device:chr_file rw_file_perms; allow rild radio_vendor_data_file:dir rw_dir_perms; allow rild radio_vendor_data_file:file create_file_perms; diff --git a/sepolicy/vendor/sensors.te b/sepolicy/vendor/sensors.te index fb4cf3af..a3139932 100644 --- a/sepolicy/vendor/sensors.te +++ b/sepolicy/vendor/sensors.te @@ -29,4 +29,6 @@ r_dir_file(sensors, sysfs_msm_subsys) userdebug_or_eng(` r_dir_file(sensors, sysfs_diag) allow sensors sysfs_timestamp_switch:file r_file_perms; + allow sensors diag_device:chr_file rw_file_perms; ') +dontaudit sensors diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/thermal-engine.te b/sepolicy/vendor/thermal-engine.te index 8009959d..e69c1890 100644 --- a/sepolicy/vendor/thermal-engine.te +++ b/sepolicy/vendor/thermal-engine.te @@ -33,3 +33,8 @@ allowxperm thermal-engine self:socket ioctl msm_sock_ipc_ioctls; # reboot/shutdown for thermal limits exceeded set_prop(thermal-engine, powerctl_prop) + +userdebug_or_eng(` + allow thermal-engine diag_device:chr_file rw_file_perms; +') +dontaudit thermal-engine diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/time_daemon.te b/sepolicy/vendor/time_daemon.te index 82a62e2f..d58bc237 100644 --- a/sepolicy/vendor/time_daemon.te +++ b/sepolicy/vendor/time_daemon.te @@ -23,3 +23,8 @@ allow time_daemon persist_file:dir search; allow time_daemon self:socket create_socket_perms; allowxperm time_daemon self:socket ioctl msm_sock_ipc_ioctls; + +userdebug_or_eng(` + allow time_daemon diag_device:chr_file rw_file_perms; +') +dontaudit time_daemon diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/wcnss_service.te b/sepolicy/vendor/wcnss_service.te index aebd86f1..db2d1292 100644 --- a/sepolicy/vendor/wcnss_service.te +++ b/sepolicy/vendor/wcnss_service.te @@ -31,7 +31,9 @@ userdebug_or_eng(` r_dir_file(wcnss_service, proc_wifi_dbg) r_dir_file(wcnss_service, sysfs_diag) allow wcnss_service sysfs_timestamp_switch:file r_file_perms; + allow wcnss_service diag_device:chr_file rw_file_perms; ') +dontaudit wcnss_service diag_device:chr_file rw_file_perms; allow wcnss_service sysfs_soc:dir search; allow wcnss_service sysfs_soc:file r_file_perms; From 365c33bb3705e3c3f41b4ba45535ee9fdd89fc05 Mon Sep 17 00:00:00 2001 From: Max Bires Date: Thu, 12 Oct 2017 17:05:35 -0700 Subject: [PATCH 046/300] Adding rw access to diag_device for hal_gnss_qti denied { read write } for pid=751 comm="Loc_hal" name="diag" dev="tmpfs" ino=10674 scontext=u:r:hal_gnss_qti:s0 tcontext=u:object_r:diag_device:s0 tclass=chr_file Test: on userdebug/eng builds, hal_gnss_qti can access diag_device without generating denials Change-Id: I571e4a4a470f3550c22a7af3145468baa4e0a155 --- sepolicy/vendor/hal_gnss_qti.te | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sepolicy/vendor/hal_gnss_qti.te b/sepolicy/vendor/hal_gnss_qti.te index 74620f8d..d2638aff 100644 --- a/sepolicy/vendor/hal_gnss_qti.te +++ b/sepolicy/vendor/hal_gnss_qti.te @@ -30,6 +30,11 @@ allow hal_gnss_qti netmgrd_socket:dir search; allow hal_gnss_qti self:netlink_generic_socket { bind create read }; allow hal_gnss_qti self:netlink_route_socket { bind create nlmsg_read read write }; +userdebug_or_eng(` + allow hal_gnss_qti diag_device:chr_file rw_file_perms; +') +dontaudit hal_gnss_qti diag_device:chr_file rw_file_perms; + # Most HALs are not allowed to use network sockets. Qcom library # libqdi is used across multiple processes which are clients of # netmgrd including the GNSS HAL. libqdi first attempts to get the network From 480544d501c831d33794dd6090f4a0ec3f494b7a Mon Sep 17 00:00:00 2001 From: Chenjie Luo Date: Mon, 16 Oct 2017 22:38:09 -0700 Subject: [PATCH 047/300] Assign easel related devices world rw In 2018, easel is going to be open for more applications instead of camera only. Change the permission of easel devices to world rw to allow easel processors accessing the devices. The selinux rules are still protecting the devices accessed by non-permitted processes. Test: GCA Change-Id: I3a52f431452f6f0998cfbd7e38cf03378b048ef7 --- ueventd.hardware.rc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ueventd.hardware.rc b/ueventd.hardware.rc index b6408602..1a7fb35b 100644 --- a/ueventd.hardware.rc +++ b/ueventd.hardware.rc @@ -104,11 +104,8 @@ /sys/devices/soc/soc:fp_fpc* wakeup_enable 0200 system system # Easel -/dev/easelcomm-client 0660 cameraserver camera -/dev/mnh_sm 0664 cameraserver camera - -# TODO (b/37941164): Temporary for easel -/sys/devices/soc/c1b7000.i2c/i2c-9/9-0008* asr_dual_phase 0660 cameraserver camera +/dev/easelcomm-client 0666 cameraserver camera +/dev/mnh_sm 0666 cameraserver camera # Storage: for factory reset protection feature /dev/block/platform/soc/1da4000.ufshc/by-name/frp 0660 system system From 53146f8cc0fcf8fe084105668d6d1d715d63d9cb Mon Sep 17 00:00:00 2001 From: Max Bires Date: Mon, 16 Oct 2017 15:07:32 -0700 Subject: [PATCH 048/300] Adding allow rules and bug_map entries to clean up boot on taimen Allow rule denials: denied { ioctl } for pid=863 comm="rild" path="/vendor/radio/qcril_database/qcril.db" dev="dm-1" ino=900 ioctlcmd=f50c scontext=u:r:rild:s0 tcontext=u:object_r:vendor_file:s0 tclass=file denied { read } for pid=1609 comm="batterystats-wo" name="show_stat" dev="sysfs" ino=37781 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs:s0 tclass=file denied { search } for pid=1609 comm="system_server" name="800f000.qcom,spmi" dev="sysfs" ino=19648 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_msm_subsys:s0 tclass=dir bug_map denial entries: denied { create } for pid=751 comm="main" name="tasks" scontext=u:r:zygote:s0 tcontext=u:object_r:cgroup:s0 tclass=fil denied { getattr } for pid=1609 comm="system_server" path="/vendor/framework" dev="dm-1" ino=291 scontext=u:r:system_server:s0 tcontext=u:object_r:vendor_framework_file:s0 tclass=dir Test: denials either don't show up or are properly tagged with a bug number Change-Id: Ibf841033ac5480ddb975772840680011cb331a7d --- sepolicy/vendor/bug_map | 2 ++ sepolicy/vendor/genfs_contexts | 1 + sepolicy/vendor/rild.te | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 sepolicy/vendor/bug_map diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map new file mode 100644 index 00000000..e616f87b --- /dev/null +++ b/sepolicy/vendor/bug_map @@ -0,0 +1,2 @@ +system_server vendor_framework_file dir 67860706 +zygote cgroup file 67860826 diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 6acbe849..7a4ae214 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -59,6 +59,7 @@ genfscon sysfs /bus/msm_subsys u:object genfscon sysfs /module/subsystem_restart u:object_r:sysfs_msm_subsys_restart:s0 genfscon sysfs /kernel/boot_adsp/boot u:object_r:sysfs_msm_subsys:s0 genfscon sysfs /kernel/boot_slpi/boot u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /kernel/memory_state_time u:object_r:sysfs_power:s0 genfscon sysfs /devices/soc/c1b7000.i2c/i2c-9/9-0008 u:object_r:sysfs_easel:s0 genfscon sysfs /class/typec u:object_r:sysfs_usb_c:s0 genfscon sysfs /class/typec/usbc0 u:object_r:sysfs_usb_c:s0 diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te index ff643af7..65768b70 100644 --- a/sepolicy/vendor/rild.te +++ b/sepolicy/vendor/rild.te @@ -8,7 +8,7 @@ allow rild qmuxd_socket:sock_file create_file_perms; allow rild netmgrd_socket:dir search; unix_socket_connect(rild, netmgrd, netmgrd) -allow rild vendor_file:file { execute_no_trans lock }; +allow rild vendor_file:file { execute_no_trans lock ioctl }; allow rild per_mgr_service:service_manager find; From 661dbb6d30798c1acfdbbaff10fba1d489b0f8ef Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Tue, 17 Oct 2017 13:54:28 -0700 Subject: [PATCH 049/300] Move device-agnostic netd rules to fwk policy. These were moved from vendor to fwk policy: 1. sysfs_net type declaration 2. labeling of /sys/devices/virtual/net with sysfs_net 3. netd access to sysfs_net Bug: 65643247 Test: can browse internet without netd denials Test: netd_unit_test, netd_integration_test without netd denials Change-Id: I9e6ec7ab24039bc74a7e47f423222334fed8bf3a --- sepolicy/vendor/file.te | 1 - sepolicy/vendor/genfs_contexts | 1 - sepolicy/vendor/netd.te | 2 -- 3 files changed, 4 deletions(-) diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 2e41283c..cbd3c84f 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -8,7 +8,6 @@ type sysfs_laser, sysfs_type, fs_type; type sysfs_mdss_mdp_caps, sysfs_type, fs_type; type sysfs_msm_subsys, sysfs_type, fs_type; type sysfs_msm_subsys_restart, sysfs_type, fs_type; -type sysfs_net, sysfs_type, fs_type; type sysfs_rmtfs, sysfs_type, fs_type; type sysfs_soc, sysfs_type, fs_type; type sysfs_scsi_devices_0000, sysfs_type, fs_type; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 6acbe849..54b50f8e 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -46,7 +46,6 @@ genfscon sysfs /module/tcp_cubic/parameters u:object genfscon sysfs /module/diagchar/parameters/timestamp_switch u:object_r:sysfs_timestamp_switch:s0 genfscon sysfs /devices/virtual/graphics/fb0 u:object_r:sysfs_graphics:s0 genfscon sysfs /devices/virtual/graphics/fb1 u:object_r:sysfs_graphics:s0 -genfscon sysfs /devices/virtual/net u:object_r:sysfs_net:s0 genfscon sysfs /devices/virtual/misc/mnh_sm u:object_r:sysfs_easel:s0 genfscon sysfs /devices/soc/8c0000.qcom,msm-cam u:object_r:sysfs_camera:s0 genfscon sysfs /devices/soc0 u:object_r:sysfs_soc:s0 diff --git a/sepolicy/vendor/netd.te b/sepolicy/vendor/netd.te index b26f9751..01c5cc3c 100644 --- a/sepolicy/vendor/netd.te +++ b/sepolicy/vendor/netd.te @@ -1,4 +1,2 @@ -allow netd sysfs_net:file w_file_perms; - dontaudit netd kernel:system module_request; dontaudit netd self:capability sys_module; From 036ef1ebc23b6a2d05317f397125f598c042fe52 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Mon, 16 Oct 2017 15:01:45 -0700 Subject: [PATCH 050/300] Remove obdm_app access to proc label. Instead give obdm_app read access to /proc/stat. Bug: 65643247 Test: can login to obdm app without selinux denials Change-Id: I368c018f883610364cd026da68085935aefd69c1 --- sepolicy/verizon/obdm_app.te | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/verizon/obdm_app.te b/sepolicy/verizon/obdm_app.te index c8abf8b0..f24baad7 100644 --- a/sepolicy/verizon/obdm_app.te +++ b/sepolicy/verizon/obdm_app.te @@ -3,7 +3,7 @@ type obdm_app, domain, coredomain; app_domain(obdm_app) net_domain(obdm_app) -r_dir_file(obdm_app, proc) +allow obdm_app proc_stat:file r_file_perms; # talk to /dev/diag allow obdm_app diag_device:chr_file rw_file_perms; From 6f475be419041f239cb0802d0cc9ab0c829956ed Mon Sep 17 00:00:00 2001 From: Max Bires Date: Thu, 19 Oct 2017 10:58:42 -0700 Subject: [PATCH 051/300] Adding bug map entries for boot denials Test: bug metadata is properly attached to relevant denials Change-Id: I20fba3a86104f494131714056b2809ae6a62d416 --- sepolicy/vendor/bug_map | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index e616f87b..c156f286 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -1,2 +1,4 @@ system_server vendor_framework_file dir 67860706 zygote cgroup file 67860826 +shell ramdump_exec file 68002524 +system_server sysfs_msm_subsys dir 68003344 From 3cd3dc6a428f93b4b3ca7be0e2e0296382c46c65 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Thu, 19 Oct 2017 22:23:05 -0700 Subject: [PATCH 052/300] Disable Vulkan StorageImageExtendedFormats capability Bug: 68017541 Test: adb shell cmd gpu vkjson | grep shaderStorageImageExtendedFormats Change-Id: I70030bc2c9ad4e2bf4fcc3e1e400e8a6dddafc75 --- device.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device.mk b/device.mk index b0bbfd01..1d52ca2b 100755 --- a/device.mk +++ b/device.mk @@ -187,6 +187,10 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.opengles.version=196610 +# b/68017541 +PRODUCT_PROPERTY_OVERRIDES += \ + ro.qcom.adreno.qgl.ShaderStorageImageExtendedFormats=0 + # Enable camera EIS3.0 PRODUCT_PROPERTY_OVERRIDES += \ persist.camera.is_type=5 \ From 1945c409cdb8eaca0bcec159c6189a34847f4449 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Tue, 17 Oct 2017 13:54:28 -0700 Subject: [PATCH 053/300] Move device-agnostic netd rules to fwk policy. These were moved from vendor to fwk policy: 1. sysfs_net type declaration 2. labeling of /sys/devices/virtual/net with sysfs_net 3. netd access to sysfs_net Bug: 65643247 Test: can browse internet without netd denials Test: netd_unit_test, netd_integration_test without netd denials Merged-In: I9e6ec7ab24039bc74a7e47f423222334fed8bf3a Change-Id: I9e6ec7ab24039bc74a7e47f423222334fed8bf3a (cherry picked from commit 661dbb6d30798c1acfdbbaff10fba1d489b0f8ef) --- sepolicy/vendor/file.te | 1 - sepolicy/vendor/genfs_contexts | 1 - sepolicy/vendor/netd.te | 2 -- 3 files changed, 4 deletions(-) diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 2e41283c..cbd3c84f 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -8,7 +8,6 @@ type sysfs_laser, sysfs_type, fs_type; type sysfs_mdss_mdp_caps, sysfs_type, fs_type; type sysfs_msm_subsys, sysfs_type, fs_type; type sysfs_msm_subsys_restart, sysfs_type, fs_type; -type sysfs_net, sysfs_type, fs_type; type sysfs_rmtfs, sysfs_type, fs_type; type sysfs_soc, sysfs_type, fs_type; type sysfs_scsi_devices_0000, sysfs_type, fs_type; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 6acbe849..54b50f8e 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -46,7 +46,6 @@ genfscon sysfs /module/tcp_cubic/parameters u:object genfscon sysfs /module/diagchar/parameters/timestamp_switch u:object_r:sysfs_timestamp_switch:s0 genfscon sysfs /devices/virtual/graphics/fb0 u:object_r:sysfs_graphics:s0 genfscon sysfs /devices/virtual/graphics/fb1 u:object_r:sysfs_graphics:s0 -genfscon sysfs /devices/virtual/net u:object_r:sysfs_net:s0 genfscon sysfs /devices/virtual/misc/mnh_sm u:object_r:sysfs_easel:s0 genfscon sysfs /devices/soc/8c0000.qcom,msm-cam u:object_r:sysfs_camera:s0 genfscon sysfs /devices/soc0 u:object_r:sysfs_soc:s0 diff --git a/sepolicy/vendor/netd.te b/sepolicy/vendor/netd.te index b26f9751..01c5cc3c 100644 --- a/sepolicy/vendor/netd.te +++ b/sepolicy/vendor/netd.te @@ -1,4 +1,2 @@ -allow netd sysfs_net:file w_file_perms; - dontaudit netd kernel:system module_request; dontaudit netd self:capability sys_module; From 48c02d56b15ace6ecd265bd63f86fe1cbbf8b849 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Tue, 17 Oct 2017 13:54:28 -0700 Subject: [PATCH 054/300] Move device-agnostic netd rules to fwk policy. These were moved from vendor to fwk policy: 1. sysfs_net type declaration 2. labeling of /sys/devices/virtual/net with sysfs_net 3. netd access to sysfs_net Bug: 65643247 Test: can browse internet without netd denials Test: netd_unit_test, netd_integration_test without netd denials Merged-In: I9e6ec7ab24039bc74a7e47f423222334fed8bf3a Change-Id: I9e6ec7ab24039bc74a7e47f423222334fed8bf3a (cherry picked from commit 661dbb6d30798c1acfdbbaff10fba1d489b0f8ef) --- sepolicy/vendor/file.te | 1 - sepolicy/vendor/genfs_contexts | 1 - sepolicy/vendor/netd.te | 2 -- 3 files changed, 4 deletions(-) diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index fc569b5a..2e9a984b 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -8,7 +8,6 @@ type sysfs_laser, sysfs_type, fs_type; type sysfs_mdss_mdp_caps, sysfs_type, fs_type; type sysfs_msm_subsys, sysfs_type, fs_type; type sysfs_msm_subsys_restart, sysfs_type, fs_type; -type sysfs_net, sysfs_type, fs_type; type sysfs_rmtfs, sysfs_type, fs_type; type sysfs_soc, sysfs_type, fs_type; type sysfs_scsi_devices_0000, sysfs_type, fs_type; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 602c270d..eac549fe 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -46,7 +46,6 @@ genfscon sysfs /module/tcp_cubic/parameters u:object genfscon sysfs /module/diagchar/parameters/timestamp_switch u:object_r:sysfs_timestamp_switch:s0 genfscon sysfs /devices/virtual/graphics/fb0 u:object_r:sysfs_graphics:s0 genfscon sysfs /devices/virtual/graphics/fb1 u:object_r:sysfs_graphics:s0 -genfscon sysfs /devices/virtual/net u:object_r:sysfs_net:s0 genfscon sysfs /devices/soc/8c0000.qcom,msm-cam u:object_r:sysfs_camera:s0 genfscon sysfs /devices/soc0 u:object_r:sysfs_soc:s0 genfscon sysfs /devices/soc/caa0000.qcom,jpeg u:object_r:sysfs_camera:s0 diff --git a/sepolicy/vendor/netd.te b/sepolicy/vendor/netd.te index b26f9751..01c5cc3c 100644 --- a/sepolicy/vendor/netd.te +++ b/sepolicy/vendor/netd.te @@ -1,4 +1,2 @@ -allow netd sysfs_net:file w_file_perms; - dontaudit netd kernel:system module_request; dontaudit netd self:capability sys_module; From 9dccaa56ce67938f60d5c113eeb8ec530ec654a1 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Fri, 20 Oct 2017 12:49:44 -0700 Subject: [PATCH 055/300] Remove system_server access to location daemon's data These permissions no longer appear to be necessary, and violate Treble separation of system/vendor data. Bug: 34980020 Test: Launch google maps, get current location Change-Id: I23f5d887fdcb400dd027431eabc4e744a08d4ea9 --- sepolicy/vendor/system_server.te | 2 -- 1 file changed, 2 deletions(-) diff --git a/sepolicy/vendor/system_server.te b/sepolicy/vendor/system_server.te index 719d2a1f..090cadfa 100644 --- a/sepolicy/vendor/system_server.te +++ b/sepolicy/vendor/system_server.te @@ -6,8 +6,6 @@ binder_call(system_server, hal_camera_default) allow system_server persist_file:dir search; allow system_server persist_sensors_file:dir search; allow system_server persist_sensors_file:file r_file_perms; -allow system_server location_data_file:dir create_dir_perms; -allow system_server location_data_file:file create_file_perms; allow system_server wlan_device:chr_file rw_file_perms; # input files From 97e8a770f6129986202161663edeaa1169e92914 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Fri, 20 Oct 2017 13:00:40 -0700 Subject: [PATCH 056/300] Remove dumpstate HAL's access to radio app data These permissions no longer appear to be needed. Bug: 34980020 Test: adb bugreport, not denials for radio_data_file Change-Id: Id20a3cc87d78ef547811dffe230d13772f1504b0 --- sepolicy/vendor/hal_dumpstate_impl.te | 2 -- 1 file changed, 2 deletions(-) diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index 32b875d2..97a5c361 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -13,10 +13,8 @@ userdebug_or_eng(` domain_auto_trans(hal_dumpstate_impl, smlog_dump_exec, smlog_dump) allow hal_dumpstate_impl modem_dump_file:dir create_dir_perms; allow hal_dumpstate_impl modem_dump_file:file create_file_perms; - allow hal_dumpstate_impl radio_data_file:dir r_dir_perms; allow hal_dumpstate_impl radio_vendor_data_file:dir r_dir_perms; allow hal_dumpstate_impl netmgr_data_file:dir r_dir_perms; - allow hal_dumpstate_impl radio_data_file:file r_file_perms; allow hal_dumpstate_impl radio_vendor_data_file:file r_file_perms; allow hal_dumpstate_impl netmgr_data_file:file r_file_perms; allow hal_dumpstate_impl debugfs_ipc:dir r_dir_perms; From 03320ccd49e5bdcccc44f7b1d17d081e7569624e Mon Sep 17 00:00:00 2001 From: Dan Cashman Date: Fri, 20 Oct 2017 14:37:27 -0700 Subject: [PATCH 057/300] Move dataservice_app to platform policy. Bug: 68012595 Test: Builds. Change-Id: Ibb01d8ba94e271d4d53c2457b27e24cdeb2bb8e2 --- sepolicy/private/seapp_contexts | 3 +++ sepolicy/vendor/seapp_contexts | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 sepolicy/private/seapp_contexts diff --git a/sepolicy/private/seapp_contexts b/sepolicy/private/seapp_contexts new file mode 100644 index 00000000..fbb9ba49 --- /dev/null +++ b/sepolicy/private/seapp_contexts @@ -0,0 +1,3 @@ +#Add new domain for DataServices +#TODO Remove user "system" when b/38043081 is resolved +user=system seinfo=platform name=.dataservices domain=dataservice_app type=system_app_data_file diff --git a/sepolicy/vendor/seapp_contexts b/sepolicy/vendor/seapp_contexts index d13ddad6..2e3fcbd6 100644 --- a/sepolicy/vendor/seapp_contexts +++ b/sepolicy/vendor/seapp_contexts @@ -6,10 +6,6 @@ user=_app seinfo=platform name=com.google.mds domain=mds_app type=app_data_file #TODO Remove user "system" when b/63588267 is resolved user=system seinfo=platform name=com.qualcomm.telephony domain=qtelephony type=system_app_data_file -#Add new domain for DataServices -#TODO Remove user "system" when b/38043081 is resolved -user=system seinfo=platform name=.dataservices domain=dataservice_app type=system_app_data_file - # The default domain for tango_core / arcore process user=_app seinfo=tango name=com.google.tango* domain=tango_core type=app_data_file levelFrom=user user=_app seinfo=arcore name=com.google.ar.core* domain=tango_core type=app_data_file levelFrom=user From b51ae72a5d8c47ecaf6465239c747179d3272745 Mon Sep 17 00:00:00 2001 From: Jie Song Date: Fri, 20 Oct 2017 14:53:38 -0700 Subject: [PATCH 058/300] Remove dumpstate's access to modem dump file Dumpstate is using the 2nd file descriptor to access dump file Bug: 68044348 Test: Take bugreport, no denial for modem_dump_file and modem log is valid Change-Id: I7f65224bd3cc81258bccc3dbf419e52c1bcaeaa3 --- sepolicy/vendor/dumpstate.te | 2 -- 1 file changed, 2 deletions(-) diff --git a/sepolicy/vendor/dumpstate.te b/sepolicy/vendor/dumpstate.te index ce328ce8..31e1fe3f 100644 --- a/sepolicy/vendor/dumpstate.te +++ b/sepolicy/vendor/dumpstate.te @@ -1,6 +1,4 @@ userdebug_or_eng(` - allow dumpstate modem_dump_file:dir create_dir_perms; - allow dumpstate modem_dump_file:file create_file_perms; allow dumpstate proc_modules:file r_file_perms; allow dumpstate proc_stat:file r_file_perms; allow dumpstate persist_file:dir r_dir_perms; From 6749bd83aef653ec782520ef971e9dfdcc13f720 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Mon, 23 Oct 2017 11:14:37 -0700 Subject: [PATCH 059/300] wahoo: fingerprint: change HAL binary name Change the binary name to not be device specific. This allows us not to have multiple init.rc files per device, simplifying code sharing between devices that use the same HAL. Bug: 68144019 Change-Id: Ib81fa673c96a25137ad3dfb673f161243cc55ef4 --- device.mk | 2 +- sepolicy/vendor/file_contexts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device.mk b/device.mk index 43b9fe16..1d3643b8 100755 --- a/device.mk +++ b/device.mk @@ -498,7 +498,7 @@ PRODUCT_COPY_FILES += \ # Fingerprint HIDL implementation PRODUCT_PACKAGES += \ - android.hardware.biometrics.fingerprint@2.1-service.wahoo + android.hardware.biometrics.fingerprint@2.1-service.fpc PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 15419810..8419a657 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -120,7 +120,7 @@ /vendor/firmware(/.*)? u:object_r:vendor_firmware_file:s0 /vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service.wahoo u:object_r:hal_dumpstate_impl_exec:s0 /vendor/bin/hw/android\.hardware\.vr@1\.0-service.wahoo u:object_r:hal_vr_default_exec:s0 -/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service.wahoo u:object_r:hal_fingerprint_default_exec:s0 +/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service.fpc u:object_r:hal_fingerprint_default_exec:s0 /vendor/bin/msm_irqbalance u:object_r:irqbalance_exec:s0 /vendor/bin/perfd u:object_r:perfd_exec:s0 /vendor/bin/thermal-engine u:object_r:thermal-engine_exec:s0 From 2195c105e561a78415e965bbe7a34c49dbf941db Mon Sep 17 00:00:00 2001 From: Isaac Chen Date: Tue, 24 Oct 2017 15:23:13 +0800 Subject: [PATCH 060/300] Set TARGET_2ND_ARCH_VARIANT to armv8-a Taimen and Walleye are armv8 devices. Setting TARGET_2ND_ARCH_VARIANT to armv8-a, instead of armv7-a-neon, can silence the related warning during build. Bug: 68012286 Test: lunch aosp_taimen; make -j lunch aosp_walleye; make -j Change-Id: I9c81e614a7f103cd93c9c2d915d53577e8d19d2d --- BoardConfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index 4085bb5e..0387dae2 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -23,7 +23,7 @@ TARGET_CPU_ABI2 := TARGET_CPU_VARIANT := cortex-a73 TARGET_2ND_ARCH := arm -TARGET_2ND_ARCH_VARIANT := armv7-a-neon +TARGET_2ND_ARCH_VARIANT := armv8-a TARGET_2ND_CPU_ABI := armeabi-v7a TARGET_2ND_CPU_ABI2 := armeabi TARGET_2ND_CPU_VARIANT := cortex-a73 From 0e8be4aca5fc6844fb303a9c8494fd9024708c44 Mon Sep 17 00:00:00 2001 From: Fyodor Kupolov Date: Mon, 23 Oct 2017 17:01:15 -0700 Subject: [PATCH 061/300] Privileged permissions whitelists for aosp targets Test: manual Bug: 67718369 Change-Id: I83e2cf712dee964995fe8ec4dbe97dc0cb95afa6 --- device.mk | 4 ++++ permissions/privapp-permissions-aosp_wahoo.xml | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 permissions/privapp-permissions-aosp_wahoo.xml diff --git a/device.mk b/device.mk index 4328507e..fe5aed14 100755 --- a/device.mk +++ b/device.mk @@ -580,6 +580,10 @@ PRODUCT_COPY_FILES += \ device/google/wahoo/tango_permissions.xml:system/etc/permissions/tango_permissions.xml \ device/google/wahoo/libtango_device2.jar:system/framework/libtango_device2.jar +# Privileged permissions whitelist +PRODUCT_COPY_FILES += \ + device/google/wahoo/permissions/privapp-permissions-aosp_wahoo.xml:system/etc/permissions/privapp-permissions-aosp_wahoo.xml + PRODUCT_PACKAGES += \ ipacm diff --git a/permissions/privapp-permissions-aosp_wahoo.xml b/permissions/privapp-permissions-aosp_wahoo.xml new file mode 100644 index 00000000..1fe50a34 --- /dev/null +++ b/permissions/privapp-permissions-aosp_wahoo.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file From 02d4201a8b2a4963db5cc787237f8fa574378f97 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Tue, 24 Oct 2017 10:49:04 -0700 Subject: [PATCH 062/300] wahoo: sepolicy: escape a period Fixes: 68144019 Change-Id: I88318f9c25e1589a9688c595bda00c9510d55ab0 --- sepolicy/vendor/file_contexts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 8419a657..3f0d951c 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -120,7 +120,7 @@ /vendor/firmware(/.*)? u:object_r:vendor_firmware_file:s0 /vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service.wahoo u:object_r:hal_dumpstate_impl_exec:s0 /vendor/bin/hw/android\.hardware\.vr@1\.0-service.wahoo u:object_r:hal_vr_default_exec:s0 -/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service.fpc u:object_r:hal_fingerprint_default_exec:s0 +/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service\.fpc u:object_r:hal_fingerprint_default_exec:s0 /vendor/bin/msm_irqbalance u:object_r:irqbalance_exec:s0 /vendor/bin/perfd u:object_r:perfd_exec:s0 /vendor/bin/thermal-engine u:object_r:thermal-engine_exec:s0 From 982babc401d3652f72a13c360ee85de32691a4f2 Mon Sep 17 00:00:00 2001 From: Alex Klyubin Date: Tue, 24 Oct 2017 11:19:03 -0700 Subject: [PATCH 063/300] Remove klyubin from wahoo owners I have very little idea about what's going on in the wahoo project these days. Change-Id: Ifd787fbd4eb2812c9dba1b6317c1d9f7c025b771 --- sepolicy/OWNERS | 1 - 1 file changed, 1 deletion(-) diff --git a/sepolicy/OWNERS b/sepolicy/OWNERS index 4bd7e349..b714fc71 100644 --- a/sepolicy/OWNERS +++ b/sepolicy/OWNERS @@ -1,6 +1,5 @@ nnk@google.com jeffv@google.com -klyubin@google.com dcashman@google.com jbires@google.com sspatil@google.com From cb67b3d17069e21188f1e111fed43035daa61b19 Mon Sep 17 00:00:00 2001 From: Max Bires Date: Tue, 24 Oct 2017 14:44:51 -0700 Subject: [PATCH 064/300] Adding bug map entry for surfaceflinger denial Test: the surfaceflinger denial is properly tagged Change-Id: I734aa3880491504c2c7e73236bda11e3cd111384 --- sepolicy/vendor/bug_map | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index c156f286..a7b5b54e 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -2,3 +2,4 @@ system_server vendor_framework_file dir 67860706 zygote cgroup file 67860826 shell ramdump_exec file 68002524 system_server sysfs_msm_subsys dir 68003344 +surfaceflinger vendor_firmware_file dir 68213100 From f22847be7030f1bc335623d1a039405abe34bb5b Mon Sep 17 00:00:00 2001 From: Chien-Yu Chen Date: Thu, 26 Oct 2017 18:31:48 -0700 Subject: [PATCH 065/300] system_app: Set camera property in user builds Allow system app to set camera property in user builds. Test: Settings app Bug: 68346040 Change-Id: Ie183acb88f32f019fdf096b12cba52cecc3e3aee --- sepolicy/vendor/system_app.te | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te index 72d8cf3b..1cc6fb1f 100644 --- a/sepolicy/vendor/system_app.te +++ b/sepolicy/vendor/system_app.te @@ -2,9 +2,8 @@ # userdebug and eng devices userdebug_or_eng(`set_prop(system_app, tel_mon_prop)') -# Needed by Settings app's CameraHalHdrplusPreferenceController, available only on a subset of -# userdebug and eng devices -userdebug_or_eng(`set_prop(system_app, camera_prop)') +# Needed by Settings app's CameraHalHdrplusPreferenceController +set_prop(system_app, camera_prop) # read regulatory info allow system_app elabel_data_file:dir r_dir_perms; From 77f70d9fcbf18ea8d0030c9cd540be22027e8569 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 22 Sep 2017 15:16:18 -0700 Subject: [PATCH 066/300] wahoo: add health@2.0 hal. Test: adb logcat -e health Test: lshal --debug Change-Id: I3b14f087d95578d034898600592cb6fb357a9958 --- device.mk | 4 ++++ manifest.xml | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/device.mk b/device.mk index 2401c223..974552af 100755 --- a/device.mk +++ b/device.mk @@ -175,6 +175,10 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml +# health HAL +PRODUCT_PACKAGES += \ + android.hardware.health@2.0-service + # Audio fluence, ns, aec property, voice and media volume steps PRODUCT_PROPERTY_OVERRIDES += \ ro.qc.sdk.audio.fluencetype=fluencepro \ diff --git a/manifest.xml b/manifest.xml index ba2c6808..6cd9ba82 100644 --- a/manifest.xml +++ b/manifest.xml @@ -149,6 +149,15 @@ default + + android.hardware.health + hwbinder + 2.0 + + IHealth + default + + android.hardware.keymaster hwbinder From 8664a03c40e77723305bac5e3bfe8c26885aaad0 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Wed, 25 Oct 2017 12:14:58 -0700 Subject: [PATCH 067/300] Health hal: grant access to sysfs_msm_subsys Health hal needs access to this label to read files under /sys/class/power_supply, which are symlink to qcom-specific files, e.g. /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/usb/type Test: boots without health hal denials. Change-Id: I1412241ab7fcacc120dc1a0a67cac7f0867f0f37 --- sepolicy/vendor/hal_health_default.te | 1 + 1 file changed, 1 insertion(+) create mode 100644 sepolicy/vendor/hal_health_default.te diff --git a/sepolicy/vendor/hal_health_default.te b/sepolicy/vendor/hal_health_default.te new file mode 100644 index 00000000..ed6ab6ec --- /dev/null +++ b/sepolicy/vendor/hal_health_default.te @@ -0,0 +1 @@ +r_dir_file(hal_health_default, sysfs_msm_subsys) From be7260e7183d75706eb773077f915e0f6906af88 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Wed, 1 Nov 2017 10:31:18 -0700 Subject: [PATCH 068/300] radio: remove access to proc label Added appropriate access to proc_cmdline. Bug: 65643247 Test: make/receive phone calls Test: send/receive text messages Test: browse internet on LTE network No denials to 'proc' label are observed during tests. Change-Id: I59710c75dbb1cf9aec7c2de4c0372d3ab372a31e --- sepolicy/vendor/radio.te | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index 83fcbaed..47e7d8b3 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -26,4 +26,4 @@ allow radio avtimer_device:chr_file r_file_perms; binder_call(radio, hal_imsrtp) # read /proc/cmdline -allow radio proc:file r_file_perms; +allow radio proc_cmdline:file r_file_perms; From d946b273ba44db7c0809a5a256641c25bdfb7644 Mon Sep 17 00:00:00 2001 From: Max Bires Date: Wed, 1 Nov 2017 14:07:49 -0700 Subject: [PATCH 069/300] Removing entry from bug_map that belongs in global policy Test: entry no longer exists in this file Change-Id: I8b16c772983dfd79a54cd049ba3295cc6cdecd41 --- sepolicy/vendor/bug_map | 1 - 1 file changed, 1 deletion(-) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index a7b5b54e..15551402 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -1,4 +1,3 @@ -system_server vendor_framework_file dir 67860706 zygote cgroup file 67860826 shell ramdump_exec file 68002524 system_server sysfs_msm_subsys dir 68003344 From 905a029f49d7d3c2552a99ba0f7461ef67fd7ab2 Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Mon, 23 Oct 2017 11:17:48 -0700 Subject: [PATCH 070/300] Make qchook service accessible via service manager for carrier apps Test: Verified Verizon WFC activation and OMADM Bug: 63750053 Change-Id: I212c2ec9ccbebe2297a4aeb84260588a0c32a778 --- sepolicy/private/platform_app.te | 1 + sepolicy/private/radio.te | 1 + sepolicy/private/service.te | 1 + sepolicy/private/service_contexts | 1 + 4 files changed, 4 insertions(+) create mode 100644 sepolicy/private/platform_app.te diff --git a/sepolicy/private/platform_app.te b/sepolicy/private/platform_app.te new file mode 100644 index 00000000..f8133eee --- /dev/null +++ b/sepolicy/private/platform_app.te @@ -0,0 +1 @@ +allow platform_app qchook_service:service_manager find; diff --git a/sepolicy/private/radio.te b/sepolicy/private/radio.te index 9e505223..d187ca8e 100644 --- a/sepolicy/private/radio.te +++ b/sepolicy/private/radio.te @@ -1 +1,2 @@ allow radio uce_service:service_manager find; +add_service(radio, qchook_service) diff --git a/sepolicy/private/service.te b/sepolicy/private/service.te index d6581237..e5abcaab 100644 --- a/sepolicy/private/service.te +++ b/sepolicy/private/service.te @@ -1,2 +1,3 @@ type cne_service, service_manager_type; type uce_service, service_manager_type; +type qchook_service, service_manager_type; diff --git a/sepolicy/private/service_contexts b/sepolicy/private/service_contexts index 20fa4e6e..bf26183b 100644 --- a/sepolicy/private/service_contexts +++ b/sepolicy/private/service_contexts @@ -2,3 +2,4 @@ qti.ims.ext u:object_r:radio_service:s0 cneservice u:object_r:cne_service:s0 uce u:object_r:uce_service:s0 rcs u:object_r:radio_service:s0 +qchook u:object_r:qchook_service:s0 From 458d1f6a6e5274565976cc93675ce09ef926ed5f Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Thu, 2 Nov 2017 14:46:44 -0700 Subject: [PATCH 071/300] Ban sharing data between platform and vendor processes Annotate processes that violate the ban including fingerprint and widevine HALs. Bug: 34980020 Test: build Change-Id: I4afa03841e1648d4624e66bbd5ed21d09d357547 --- sepolicy/private/ramoops.te | 2 +- sepolicy/public/file.te | 2 +- sepolicy/vendor/hal_drm_widevine.te | 4 ++++ sepolicy/vendor/tee.te | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sepolicy/private/ramoops.te b/sepolicy/private/ramoops.te index 57161d95..f7f4aafa 100644 --- a/sepolicy/private/ramoops.te +++ b/sepolicy/private/ramoops.te @@ -1,5 +1,5 @@ type ramoops, domain, coredomain; -type ramoops_data_file, file_type, data_file_type; +type ramoops_data_file, file_type, data_file_type, core_data_file_type; type ramoops_exec, exec_type, file_type; init_daemon_domain(ramoops); diff --git a/sepolicy/public/file.te b/sepolicy/public/file.te index ad98df70..1224e34a 100644 --- a/sepolicy/public/file.te +++ b/sepolicy/public/file.te @@ -1,2 +1,2 @@ -type elabel_data_file, file_type, data_file_type; +type elabel_data_file, file_type, data_file_type, core_data_file_type; type sysfs_pstore, sysfs_type, fs_type; diff --git a/sepolicy/vendor/hal_drm_widevine.te b/sepolicy/vendor/hal_drm_widevine.te index faf47b31..629ba5e9 100644 --- a/sepolicy/vendor/hal_drm_widevine.te +++ b/sepolicy/vendor/hal_drm_widevine.te @@ -15,3 +15,7 @@ allow hal_drm { appdomain -isolated_app }:fd use; # by the HWC HAL. allow hal_drm_widevine qdisplay_service:service_manager { find }; binder_call(hal_drm_widevine, hal_graphics_composer) + +# TODO(b/36601695): Remove data_between_core_and_vendor violators once +# hal_drm no longer directly accesses media_data_file. +typeattribute hal_drm_widevine data_between_core_and_vendor_violators; diff --git a/sepolicy/vendor/tee.te b/sepolicy/vendor/tee.te index 0ddf90ff..98ae1436 100644 --- a/sepolicy/vendor/tee.te +++ b/sepolicy/vendor/tee.te @@ -16,8 +16,10 @@ allow tee persist_drm_file:file create_file_perms; allow tee persist_data_file:dir create_dir_perms; allow tee persist_data_file:file create_file_perms; +# TODO(b/36644492): Remove data_between_core_and_vendor_violators once +# tee no longer directly accesses /data owned by the frameworks. +typeattribute tee data_between_core_and_vendor_violators; allow tee system_data_file:dir r_dir_perms; - allow tee fingerprintd_data_file:dir rw_dir_perms; allow tee fingerprintd_data_file:file create_file_perms; From 552978d27c7c475e0ec6ff982d9e2bb709b7c93f Mon Sep 17 00:00:00 2001 From: Max Bires Date: Fri, 3 Nov 2017 15:13:48 -0700 Subject: [PATCH 072/300] Adding intermittent taimen denials to bug_map and adding dontaudit These intermittent denials are making it look like taimen boot tests are occasionally unhealthy due to untracked denials. This will remove the failing tests issue. Bug: 68705274 Test: these intermittent denials are now tracked or properly dontaudit'ed Change-Id: I342cff19d7bde73fee93fd8461c9c0680511e23c --- sepolicy/vendor/bug_map | 3 +++ sepolicy/vendor/netutils_wrapper.te | 2 ++ 2 files changed, 5 insertions(+) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index 15551402..9034a7b1 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -2,3 +2,6 @@ zygote cgroup file 67860826 shell ramdump_exec file 68002524 system_server sysfs_msm_subsys dir 68003344 surfaceflinger vendor_firmware_file dir 68213100 +surfaceflinger unlabeled dir 68864350 +hal_graphics_composer_default unlabeled dir 68864350 +bootanim unlabeled dir 68864350 diff --git a/sepolicy/vendor/netutils_wrapper.te b/sepolicy/vendor/netutils_wrapper.te index f8c6f80a..f1bec3b8 100644 --- a/sepolicy/vendor/netutils_wrapper.te +++ b/sepolicy/vendor/netutils_wrapper.te @@ -2,6 +2,8 @@ allow netutils_wrapper netmgrd:fd use; allow netutils_wrapper netmgrd:fifo_file { getattr read write append }; +dontaudit netutils_wrapper netmgrd:socket { read write }; +dontaudit netutils_wrapper netmgrd:unix_stream_socket { read write }; dontaudit netutils_wrapper netmgrd:netlink_socket { getattr read write append }; dontaudit netutils_wrapper kernel:system module_request; dontaudit netutils_wrapper self:capability sys_module; From fb167a94c3e0376c287474a08d919eb85931d58b Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 7 Nov 2017 09:40:51 -0800 Subject: [PATCH 073/300] Use /data/vendor/audio for Audio HAL data This separates the data of audioserver from the data of the hal_audio. Bug: 35042759 Change-Id: I1815c5debaa6d6d2076cebf8beb5acd36c6fe891 Test: no SELinux denials for hal_audio --- init.hardware.rc | 6 +++--- sepolicy/vendor/file.te | 1 + sepolicy/vendor/file_contexts | 1 + sepolicy/vendor/hal_audio_default.te | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 1b12119f..ee1181cd 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -320,11 +320,11 @@ on zygote-start chown system system /data/dpm/nsrm # Create directory used by audio subsystem - mkdir /data/misc/audio 0770 audio audio + mkdir /data/vendor/audio 0770 audio audio # Create directory for audio delta files - mkdir /data/misc/audio/acdbdata 0770 media audio - mkdir /data/misc/audio/acdbdata/delta 0770 media audio + mkdir /data/vendor/audio/acdbdata 0770 media audio + mkdir /data/vendor/audio/acdbdata/delta 0770 media audio # Create directory used by the DASH client mkdir /data/misc/dash 0770 media audio diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index cbd3c84f..8cb35ce8 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -68,6 +68,7 @@ type ramdump_vendor_data_file, file_type, data_file_type, mlstrustedobject; type modem_dump_file, file_type, data_file_type; type ese_vendor_data_file, file_type, data_file_type; type sensors_vendor_data_file, file_type, data_file_type; +type audio_vendor_data_file, file_type, data_file_type; type vendor_firmware_file, vendor_file_type, file_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 3f0d951c..95d8adbf 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -254,6 +254,7 @@ /data/vendor/ese(/.*)? u:object_r:ese_vendor_data_file:s0 /data/vendor/ipa(/.*)? u:object_r:ipa_vendor_data_file:s0 /data/vendor/sensors(/.*)? u:object_r:sensors_vendor_data_file:s0 +/data/vendor/audio(/.*)? u:object_r:audio_vendor_data_file:s0 # input files /vendor/usr/idc(/.*)? u:object_r:idc_file:s0 diff --git a/sepolicy/vendor/hal_audio_default.te b/sepolicy/vendor/hal_audio_default.te index 0b936929..357b4cdf 100644 --- a/sepolicy/vendor/hal_audio_default.te +++ b/sepolicy/vendor/hal_audio_default.te @@ -1,7 +1,7 @@ r_dir_file(hal_audio_default, sysfs_soc) -allow hal_audio_default audio_data_file:dir w_dir_perms; -allow hal_audio_default audio_data_file:file create_file_perms; +allow hal_audio_default audio_vendor_data_file:dir rw_dir_perms; +allow hal_audio_default audio_vendor_data_file:file create_file_perms; allow hal_audio_default perfd:unix_stream_socket connectto; allow hal_audio_default perfd_socket:sock_file write; From 8da95d2f1403e8c9fdc10ba20bdf22dd9d9f7c1a Mon Sep 17 00:00:00 2001 From: Siyuan Zhou Date: Tue, 7 Nov 2017 14:47:09 -0800 Subject: [PATCH 074/300] Allowed ssr_setup to access sysfs_msm_subsys for user builds. Allow ssr_setup to access sysfs_msm_subsys and enable subsystem restart properly for user builds. Otherwise, all subsystem issues are translated into kernel panics. BUG: 69001795 Change-Id: I0e3cf53b92f04433d356fdeb1018bb18a9a954a6 --- sepolicy/vendor/ssr_setup.te | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sepolicy/vendor/ssr_setup.te b/sepolicy/vendor/ssr_setup.te index 9aa54ee7..b05c3568 100644 --- a/sepolicy/vendor/ssr_setup.te +++ b/sepolicy/vendor/ssr_setup.te @@ -3,8 +3,6 @@ type ssr_setup_exec, exec_type, vendor_file_type, file_type; init_daemon_domain(ssr_setup); -userdebug_or_eng(` allow ssr_setup sysfs_msm_subsys:dir r_dir_perms; allow ssr_setup sysfs_msm_subsys:file rw_file_perms; -allow ssr_setup sysfs_msm_subsys:lnk_file read; -') +allow ssr_setup sysfs_msm_subsys:lnk_file read; \ No newline at end of file From 7c20beaed4974356dbd083a1137e7be6fc8a992d Mon Sep 17 00:00:00 2001 From: Ruchi Kandoi Date: Wed, 8 Nov 2017 11:20:34 -0800 Subject: [PATCH 075/300] Edit config paramter as per logging changes in libnfc-nci Sub-system level tracing has been removed. Libnfc-nci now depends on a single level level. If APPL_TRACE_LEVEL is 0 then debug log is disabled, for any other value debug logs are enabled. Test: Change config and check logcat. Change-Id: I123e4d858d4f61471e828770ce1d27ea873c12ac --- nfc/libnfc-brcm.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nfc/libnfc-brcm.conf b/nfc/libnfc-brcm.conf index 05cb160b..a7444c3f 100644 --- a/nfc/libnfc-brcm.conf +++ b/nfc/libnfc-brcm.conf @@ -2,7 +2,7 @@ ############################################################################### # Application options -APPL_TRACE_LEVEL=0x01 +APPL_TRACE_LEVEL=0x00 PROTOCOL_TRACE_LEVEL=0x00000000 ############################################################################### From 9b1fa7dc7e893ea9a87f6ef9465113c227ea078c Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 9 Nov 2017 09:43:22 -0800 Subject: [PATCH 076/300] sepolicy: remove perfd usage in mediacodec VIDEO_DECODE_PLAYBACK_HINT is for interactive governor in HMP kernels Remove the access to it. Bug: 62041945 Test: boot Change-Id: I9454f2707cb380761d8370fa477e6d933dae9d40 --- sepolicy/vendor/mediacodec.te | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sepolicy/vendor/mediacodec.te b/sepolicy/vendor/mediacodec.te index eb6476fb..1bbadd8e 100644 --- a/sepolicy/vendor/mediacodec.te +++ b/sepolicy/vendor/mediacodec.te @@ -1,5 +1,7 @@ -allow mediacodec perfd:unix_stream_socket connectto; -allow mediacodec perfd_socket:sock_file write; +# VIDEO_DECODE_PLAYBACK_HINT is for interactive governor in HMP kernels +# Do not grant the access +dontaudit mediacodec perfd:unix_stream_socket connectto; +dontaudit mediacodec perfd_socket:sock_file write; allow mediacodec sysfs_soc:file r_file_perms; allow mediacodec sysfs_soc:dir search; From 30de4799f9fc9a5dec2743c395be47b7c3d821f2 Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Mon, 23 Oct 2017 11:17:48 -0700 Subject: [PATCH 077/300] Make qchook service accessible via service manager for carrier apps Test: Verified Verizon WFC activation and OMADM Bug: 63750053 Change-Id: I212c2ec9ccbebe2297a4aeb84260588a0c32a778 (cherry picked from commit 905a029f49d7d3c2552a99ba0f7461ef67fd7ab2) --- sepolicy/private/platform_app.te | 1 + sepolicy/private/radio.te | 1 + sepolicy/private/service.te | 1 + sepolicy/private/service_contexts | 1 + 4 files changed, 4 insertions(+) create mode 100644 sepolicy/private/platform_app.te diff --git a/sepolicy/private/platform_app.te b/sepolicy/private/platform_app.te new file mode 100644 index 00000000..f8133eee --- /dev/null +++ b/sepolicy/private/platform_app.te @@ -0,0 +1 @@ +allow platform_app qchook_service:service_manager find; diff --git a/sepolicy/private/radio.te b/sepolicy/private/radio.te index 9e505223..d187ca8e 100644 --- a/sepolicy/private/radio.te +++ b/sepolicy/private/radio.te @@ -1 +1,2 @@ allow radio uce_service:service_manager find; +add_service(radio, qchook_service) diff --git a/sepolicy/private/service.te b/sepolicy/private/service.te index d6581237..e5abcaab 100644 --- a/sepolicy/private/service.te +++ b/sepolicy/private/service.te @@ -1,2 +1,3 @@ type cne_service, service_manager_type; type uce_service, service_manager_type; +type qchook_service, service_manager_type; diff --git a/sepolicy/private/service_contexts b/sepolicy/private/service_contexts index 20fa4e6e..bf26183b 100644 --- a/sepolicy/private/service_contexts +++ b/sepolicy/private/service_contexts @@ -2,3 +2,4 @@ qti.ims.ext u:object_r:radio_service:s0 cneservice u:object_r:cne_service:s0 uce u:object_r:uce_service:s0 rcs u:object_r:radio_service:s0 +qchook u:object_r:qchook_service:s0 From 02ae86343707b26fd381ce93dc6f6bb5afad3f04 Mon Sep 17 00:00:00 2001 From: Shawn Willden Date: Tue, 31 Oct 2017 11:09:59 -0600 Subject: [PATCH 078/300] Add support for SW-only KM4 HAL Test: VtsHalKeymasterV4_0TargtTest Bug: 63931634 Change-Id: I0a5a553ff76c39903442e64d28b38e315b27e852 --- device.mk | 5 +++++ manifest.xml | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/device.mk b/device.mk index 974552af..112cad4d 100755 --- a/device.mk +++ b/device.mk @@ -179,6 +179,11 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ android.hardware.health@2.0-service +# Keymaster 4 (software only) +PRODUCT_PACKAGES += \ + android.hardware.keymaster@4.0-impl \ + android.hardware.keymaster@4.0-service + # Audio fluence, ns, aec property, voice and media volume steps PRODUCT_PROPERTY_OVERRIDES += \ ro.qc.sdk.audio.fluencetype=fluencepro \ diff --git a/manifest.xml b/manifest.xml index 6cd9ba82..87de4645 100644 --- a/manifest.xml +++ b/manifest.xml @@ -167,6 +167,15 @@ default + + android.hardware.keymaster + hwbinder + 4.0 + + IKeymaster + default + + android.hardware.light hwbinder From 2f79642331263c9f06bf74672691fdf74389b51c Mon Sep 17 00:00:00 2001 From: Ecco Park Date: Tue, 14 Nov 2017 12:01:36 -0800 Subject: [PATCH 079/300] Dumpstate: add the Data.msc in the dumpstate_board.txt The file will be used to decode the wifi firmware in the bugreport automatically in the wifi bugbot. Bug: 69010177 Change-Id: I4db3b99fb704d0646ef3b0b8a31cd1592e165f16 Signed-off-by: Ecco Park --- dumpstate/DumpstateDevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 7bab6be7..41bf2752 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -257,6 +257,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "PD Engine", "/d/pd_engine/usbpd0"); DumpFileToFd(fd, "smblib-usb logs", "/d/ipc_logging/smblib/log"); DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports"); + DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); DumpTouch(fd); RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"}); From f2bf7ef233885332be01521bfddb66a6df824067 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Tue, 14 Nov 2017 15:34:33 -0800 Subject: [PATCH 080/300] power: remove unused powerhint settings 1) remove GPU min freq from sustained mode as 257000000 is the lowest valid GPU frequency on msm8998 2) remove B/L CPU max freq setting from launch boost Test: boot Bug: 69271302 Change-Id: I32e13a8f5aa10eba242e1429823f1b9517e1634d --- powerhint.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/powerhint.xml b/powerhint.xml index 19373d49..a87dfcdc 100755 --- a/powerhint.xml +++ b/powerhint.xml @@ -39,7 +39,6 @@ - @@ -69,8 +68,6 @@ - - From 3729835533eb737f223c1d4188f0f5b3c4fb278b Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 16 Nov 2017 22:04:28 -0800 Subject: [PATCH 081/300] init.power.sh: remove CPUBW min freq setting CPU BW is set to 200Mhz in QC MTP, since on Pixel, we also adjust CPU BW in touch PowerHint, we can relax the setting to 100Mhz. Bug: 69271302 Test: boot Change-Id: Iead3634d9c6fb0b3edc24ab0a19d62157a6a1793 --- init.power.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/init.power.sh b/init.power.sh index 3dc650d0..a610afbe 100755 --- a/init.power.sh +++ b/init.power.sh @@ -18,7 +18,6 @@ for cpubw in /sys/class/devfreq/*qcom,cpubw* do write $cpubw/governor "bw_hwmon" write $cpubw/polling_interval 50 - write $cpubw/min_freq 1525 write $cpubw/bw_hwmon/mbps_zones "3143 5859 11863 13763" write $cpubw/bw_hwmon/sample_ms 4 write $cpubw/bw_hwmon/io_percent 34 From a54d493853e680c3600a688474923b21378e369f Mon Sep 17 00:00:00 2001 From: Oleg Matcovschi Date: Tue, 21 Nov 2017 13:44:58 -0800 Subject: [PATCH 082/300] wahoo: Change ramdump property names Avoid using vendor names in properties. Change-Id: I1d0bc294584daa6910fc778ada05631440d3e707 --- init.hardware.diag.rc.userdebug | 2 +- sepolicy/vendor/property_contexts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 0041b981..c55f0ed0 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -382,7 +382,7 @@ service vendor.cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cn disabled oneshot -on property:debug.htc.ramdump.crash=true +on property:debug.ramdump.force_crash=true write /proc/sysrq-trigger "c" on property:sys.logger.bluetooth=true diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 5c559a0d..d698bf31 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -10,8 +10,7 @@ persist.net.doxlat u:object_r:net_radio_prop:s0 sys.post_boot. u:object_r:post_boot_prop:s0 radio. u:object_r:radio_prop:s0 rcs.publish.status u:object_r:radio_prop:s0 -debug.htc.hrdump u:object_r:ramdump_prop:s0 -debug.htc.ramdump u:object_r:ramdump_prop:s0 +debug.ramdump. u:object_r:ramdump_prop:s0 persist.sys.crash_rcu u:object_r:ramdump_prop:s0 debug.ssrdump u:object_r:ssr_prop:s0 persist.sys.cnss. u:object_r:cnss_diag_prop:s0 From 40b61a3bb8f08ab042f0777984b6cf7c38a722d0 Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Tue, 28 Nov 2017 12:53:11 -0800 Subject: [PATCH 083/300] Update SVN to 5 for Jan 2017 Monthly Update Bug:69257226 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 1d52ca2b..2b4026ab 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=4 + ro.vendor.build.svn=5 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 8ce5e19a671fa91bcb3edaf6da598f415ad1066b Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 16 Nov 2017 22:02:29 -0800 Subject: [PATCH 084/300] Power: Implement PowerHal 1.2 Convert all perfd hints into PowerHAL hints Test: do camera/audio powerhint Bug: 62041945 Change-Id: I82c8ca99b76d70d716eabedb617a126446646b7d --- device.mk | 4 +- manifest.xml | 2 +- power/Android.mk | 6 +- power/Power.cpp | 42 ++++++-- power/Power.h | 24 +++-- ...ndroid.hardware.power@1.1-service.wahoo.rc | 4 - ...ndroid.hardware.power@1.2-service.wahoo.rc | 4 + power/hint-data.h | 6 ++ power/power-8998.c | 99 ++++++++++++++++++- power/power-helper.h | 6 ++ power/powerhintparser.h | 2 +- power/service.cpp | 8 +- powerhint.xml | 25 +++++ sepolicy/vendor/audioserver.te | 2 - sepolicy/vendor/file_contexts | 2 +- sepolicy/vendor/hal_audio_default.te | 6 +- 16 files changed, 198 insertions(+), 44 deletions(-) delete mode 100644 power/android.hardware.power@1.1-service.wahoo.rc create mode 100644 power/android.hardware.power@1.2-service.wahoo.rc diff --git a/device.mk b/device.mk index 66822fad..77d93d38 100755 --- a/device.mk +++ b/device.mk @@ -170,7 +170,7 @@ PRODUCT_COPY_FILES += \ # power HAL PRODUCT_PACKAGES += \ - android.hardware.power@1.1-service.wahoo + android.hardware.power@1.2-service.wahoo PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml @@ -611,7 +611,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ # Enable CameraHAL perfd usage PRODUCT_PROPERTY_OVERRIDES += \ - persist.camera.perfd.enable=true + persist.camera.perfd.enable=false # Enable Gcam FD Ensemble PRODUCT_PROPERTY_OVERRIDES += \ diff --git a/manifest.xml b/manifest.xml index 6cd9ba82..ae293f11 100644 --- a/manifest.xml +++ b/manifest.xml @@ -219,7 +219,7 @@ android.hardware.power hwbinder - 1.1 + 1.2 IPower default diff --git a/power/Android.mk b/power/Android.mk index f2e29188..1e9071e4 100644 --- a/power/Android.mk +++ b/power/Android.mk @@ -21,8 +21,8 @@ LOCAL_PROPRIETARY_MODULE := true LOCAL_MODULE_OWNER := qcom LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := android.hardware.power@1.1-service.wahoo -LOCAL_INIT_RC := android.hardware.power@1.1-service.wahoo.rc +LOCAL_MODULE := android.hardware.power@1.2-service.wahoo +LOCAL_INIT_RC := android.hardware.power@1.2-service.wahoo.rc LOCAL_SRC_FILES := service.cpp \ Power.cpp \ InteractionHandler.cpp \ @@ -53,6 +53,6 @@ LOCAL_SHARED_LIBRARIES := \ libhidltransport \ libhardware \ libutils \ - android.hardware.power@1.1 \ + android.hardware.power@1.2 \ include $(BUILD_EXECUTABLE) diff --git a/power/Power.cpp b/power/Power.cpp index 81f5db9f..700663a5 100644 --- a/power/Power.cpp +++ b/power/Power.cpp @@ -14,10 +14,10 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.power@1.1-service.wahoo" +#define LOG_TAG "android.hardware.power@1.2-service.wahoo" -#include #include +#include #include #include #include @@ -33,14 +33,14 @@ extern struct stat_pair rpm_stat_map[]; namespace android { namespace hardware { namespace power { -namespace V1_1 { +namespace V1_2 { namespace implementation { using ::android::hardware::power::V1_0::Feature; -using ::android::hardware::power::V1_0::PowerHint; using ::android::hardware::power::V1_0::PowerStatePlatformSleepState; using ::android::hardware::power::V1_0::Status; using ::android::hardware::power::V1_1::PowerStateSubsystem; +using ::android::hardware::power::V1_1::PowerStateSubsystemSleepState; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; @@ -59,9 +59,9 @@ Return Power::setInteractive(bool interactive) { return Void(); } -Return Power::powerHint(PowerHint hint, int32_t data) { +Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { if (android::base::GetProperty("init.svc.vendor.perfd", "") != "running") { - ALOGW("perfd is not started"); + LOG(WARNING) << "perfd is not started"; return Void(); } @@ -192,18 +192,42 @@ bool Power::isSupportedGovernor() { if (buf == SCHEDUTIL_GOVERNOR || buf == SCHED_GOVERNOR || buf == INTERACTIVE_GOVERNOR) { return true; } else { - ALOGE("Governor not supported by powerHAL, skipping"); + LOG(ERROR) << "Governor not supported by powerHAL, skipping"; return false; } } -Return Power::powerHintAsync(PowerHint hint, int32_t data) { +Return Power::powerHintAsync(PowerHint_1_0 hint, int32_t data) { // just call the normal power hint in this oneway function return powerHint(hint, data); } +// Methods from ::android::hardware::power::V1_2::IPower follow. +Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { + switch(hint) { + case PowerHint_1_2::AUDIO_LOW_LATENCY: + process_audio_low_latency_hint(data); + break; + case PowerHint_1_2::AUDIO_STREAMING: + process_audio_streaming_hint(data); + break; + case PowerHint_1_2::CAMERA_LAUNCH: + process_camera_launch_hint(data); + break; + case PowerHint_1_2::CAMERA_STREAMING: + process_camera_streaming_hint(data); + break; + case PowerHint_1_2::CAMERA_SHOT: + process_camera_shot_hint(data); + break; + default: + return powerHint(static_cast(hint), data); + } + return Void(); +} + } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace power } // namespace hardware } // namespace android diff --git a/power/Power.h b/power/Power.h index 9d4f79fd..650a5181 100644 --- a/power/Power.h +++ b/power/Power.h @@ -14,10 +14,10 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_POWER_V1_1_POWER_H -#define ANDROID_HARDWARE_POWER_V1_1_POWER_H +#ifndef ANDROID_HARDWARE_POWER_V1_2_POWER_H +#define ANDROID_HARDWARE_POWER_V1_2_POWER_H -#include +#include #include #include #include @@ -27,15 +27,16 @@ namespace android { namespace hardware { namespace power { -namespace V1_1 { +namespace V1_2 { namespace implementation { using ::android::hardware::power::V1_0::Feature; -using ::android::hardware::power::V1_0::PowerHint; -using ::android::hardware::power::V1_1::IPower; +using ::android::hardware::power::V1_2::IPower; using ::android::hardware::Return; using ::android::hardware::Void; using ::InteractionHandler; +using PowerHint_1_0 = ::android::hardware::power::V1_0::PowerHint; +using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint; struct Power : public IPower { // Methods from ::android::hardware::power::V1_0::IPower follow. @@ -43,13 +44,16 @@ struct Power : public IPower { Power(); Return setInteractive(bool interactive) override; - Return powerHint(PowerHint hint, int32_t data) override; + Return powerHint(PowerHint_1_0 hint, int32_t data) override; Return setFeature(Feature feature, bool activate) override; Return getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override; // Methods from ::android::hardware::power::V1_1::IPower follow. Return getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override; - Return powerHintAsync(PowerHint hint, int32_t data) override; + Return powerHintAsync(PowerHint_1_0 hint, int32_t data) override; + + // Methods from ::android::hardware::power::V1_2::IPower follow. + Return powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override; // Methods from ::android::hidl::base::V1_0::IBase follow. @@ -59,9 +63,9 @@ struct Power : public IPower { }; } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace power } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_POWER_V1_1_POWER_H +#endif // ANDROID_HARDWARE_POWER_V1_2_POWER_H diff --git a/power/android.hardware.power@1.1-service.wahoo.rc b/power/android.hardware.power@1.1-service.wahoo.rc deleted file mode 100644 index cb31655a..00000000 --- a/power/android.hardware.power@1.1-service.wahoo.rc +++ /dev/null @@ -1,4 +0,0 @@ -service vendor.power-hal-1-1 /vendor/bin/hw/android.hardware.power@1.1-service.wahoo - class hal - user system - group system diff --git a/power/android.hardware.power@1.2-service.wahoo.rc b/power/android.hardware.power@1.2-service.wahoo.rc new file mode 100644 index 00000000..dd5537c7 --- /dev/null +++ b/power/android.hardware.power@1.2-service.wahoo.rc @@ -0,0 +1,4 @@ +service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.wahoo + class hal + user system + group system diff --git a/power/hint-data.h b/power/hint-data.h index 7be3b3b2..6885396a 100644 --- a/power/hint-data.h +++ b/power/hint-data.h @@ -39,6 +39,12 @@ #define INTERACTION_HINT_ID (0x1A00) #define BOOST_HINT_ID (0x1B00) +#define CAMERA_LAUNCH_HINT_ID (0x0B0A) +#define CAMERA_STREAMING_HINT_ID (0x0C0A) +#define CAMERA_SHOT_HINT_ID (0x0D0A) +#define AUDIO_STREAMING_HINT_ID (0x0E0A) +#define AUDIO_LOW_LATENCY_HINT_ID (0x0F0A) + struct hint_data { unsigned long hint_id; /* This is our key. */ unsigned long perflock_handle; diff --git a/power/power-8998.c b/power/power-8998.c index dbc6542f..869f23b6 100644 --- a/power/power-8998.c +++ b/power/power-8998.c @@ -180,18 +180,18 @@ static int process_vr_mode_hint(void *data) return HINT_HANDLED; } -static int process_boost(int boost_handle, int duration) +static int process_boost(int hint_id, int boost_handle, int duration) { int *resource_values; int resources; - resource_values = getPowerhint(BOOST_HINT_ID, &resources); + resource_values = getPowerhint(hint_id, &resources); if (resource_values != NULL) { boost_handle = interaction_with_handle( boost_handle, duration, resources, resource_values); if (!CHECK_HANDLE(boost_handle)) { - ALOGE("Failed interaction_with_handle for boost_handle"); + ALOGE("Failed interaction_with_handle for hint_id %d", hint_id); } } @@ -205,7 +205,7 @@ static int process_video_encode_hint(void *data) if (data) { // TODO: remove the launch boost based on camera launch time int duration = 2000; // boosts 2s for starting encoding - boost_handle = process_boost(boost_handle, duration); + boost_handle = process_boost(BOOST_HINT_ID, boost_handle, duration); ALOGD("LAUNCH ENCODER-ON: %d MS", duration); int *resource_values = NULL; int resources = 0; @@ -222,6 +222,95 @@ static int process_video_encode_hint(void *data) return HINT_NONE; } +int process_camera_launch_hint(int32_t duration) +{ + static int cam_launch_handle = -1; + + if (duration > 0) { + cam_launch_handle = process_boost(CAMERA_LAUNCH_HINT_ID, cam_launch_handle, duration); + ALOGD("CAMERA LAUNCH ON: %d MS", duration); + return HINT_HANDLED; + } else if (duration == 0) { + release_request(cam_launch_handle); + ALOGD("CAMERA LAUNCH OFF"); + return HINT_HANDLED; + } else { + ALOGE("CAMERA LAUNCH INVALID DATA: %d", duration); + } + return HINT_NONE; +} + +int process_camera_streaming_hint(int32_t duration) +{ + static int cam_streaming_handle = -1; + + if (duration > 0) { + cam_streaming_handle = process_boost(CAMERA_STREAMING_HINT_ID, cam_streaming_handle, duration); + ALOGD("CAMERA STREAMING ON: %d MS", duration); + return HINT_HANDLED; + } else if (duration == 0) { + release_request(cam_streaming_handle); + ALOGD("CAMERA STREAMING OFF"); + return HINT_HANDLED; + } else { + ALOGE("CAMERA STREAMING INVALID DATA: %d", duration); + } + return HINT_NONE; +} + +int process_camera_shot_hint(int32_t duration) +{ + static int cam_shot_handle = -1; + + if (duration > 0) { + cam_shot_handle = process_boost(CAMERA_SHOT_HINT_ID, cam_shot_handle, duration); + ALOGD("CAMERA SHOT ON: %d MS", duration); + return HINT_HANDLED; + } else if (duration == 0) { + release_request(cam_shot_handle); + ALOGD("CAMERA SHOT OFF"); + return HINT_HANDLED; + } else { + ALOGE("CAMERA SHOT INVALID DATA: %d", duration); + } + return HINT_NONE; +} + +int process_audio_streaming_hint(int32_t duration) +{ + static int audio_streaming_handle = -1; + + if (duration > 0) { + // set max duration 2s for starting audio + audio_streaming_handle = process_boost(AUDIO_STREAMING_HINT_ID, audio_streaming_handle, 2000); + ALOGD("AUDIO STREAMING ON"); + return HINT_HANDLED; + } else if (duration == 0) { + release_request(audio_streaming_handle); + ALOGD("AUDIO STREAMING OFF"); + return HINT_HANDLED; + } else { + ALOGE("AUDIO STREAMING INVALID DATA: %d", duration); + } + return HINT_NONE; +} + +int process_audio_low_latency_hint(int32_t data) +{ + static int audio_low_latency_handle = -1; + + if (data) { + // Hint until canceled + audio_low_latency_handle = process_boost(AUDIO_LOW_LATENCY_HINT_ID, audio_low_latency_handle, 0); + ALOGD("AUDIO LOW LATENCY ON"); + } else { + release_request(audio_low_latency_handle); + ALOGD("AUDIO LOW LATENCY OFF"); + return HINT_HANDLED; + } + return HINT_HANDLED; +} + static int process_activity_launch_hint(void *data) { // boost will timeout in 1.25s @@ -236,7 +325,7 @@ static int process_activity_launch_hint(void *data) // restart the launch hint if the framework has not yet released // this shouldn't happen, but we've seen bugs where it could if (data) { - launch_handle = process_boost(launch_handle, duration); + launch_handle = process_boost(BOOST_HINT_ID, launch_handle, duration); if (launch_handle > 0) { launch_mode = 1; ALOGD("Activity launch hint handled"); diff --git a/power/power-helper.h b/power/power-helper.h index b2ef147a..6117caba 100644 --- a/power/power-helper.h +++ b/power/power-helper.h @@ -102,6 +102,12 @@ int extract_wlan_stats(uint64_t *list); int is_perf_hint_active(int hint); +int process_camera_launch_hint(int32_t duration); +int process_camera_streaming_hint(int32_t duration); +int process_camera_shot_hint(int32_t duration); +int process_audio_streaming_hint(int32_t duration); +int process_audio_low_latency_hint(int32_t data); + #ifdef __cplusplus } #endif diff --git a/power/powerhintparser.h b/power/powerhintparser.h index c1da1de1..971a472a 100644 --- a/power/powerhintparser.h +++ b/power/powerhintparser.h @@ -31,7 +31,7 @@ #define __POWERHINTPARSER__ #define POWERHINT_XML "/vendor/etc/powerhint.xml" -#define MAX_HINT 8 +#define MAX_HINT 16 #define MAX_PARAM 30 typedef struct perflock_param_t { diff --git a/power/service.cpp b/power/service.cpp index 5b3a47d6..54e6d826 100644 --- a/power/service.cpp +++ b/power/service.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.power@1.1-service.wahoo" +#define LOG_TAG "android.hardware.power@1.2-service.wahoo" #include #include @@ -30,15 +30,15 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; // Generated HIDL files -using android::hardware::power::V1_1::IPower; -using android::hardware::power::V1_1::implementation::Power; +using android::hardware::power::V1_2::IPower; +using android::hardware::power::V1_2::implementation::Power; int main() { status_t status; android::sp service = nullptr; - ALOGI("Power HAL Service 1.1 for Wahoo is starting."); + ALOGI("Power HAL Service 1.2 for Wahoo is starting."); service = new Power(); if (service == nullptr) { diff --git a/powerhint.xml b/powerhint.xml index a87dfcdc..01d6e424 100755 --- a/powerhint.xml +++ b/powerhint.xml @@ -74,4 +74,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sepolicy/vendor/audioserver.te b/sepolicy/vendor/audioserver.te index 02c801ca..4dd8b7cc 100644 --- a/sepolicy/vendor/audioserver.te +++ b/sepolicy/vendor/audioserver.te @@ -1,6 +1,4 @@ binder_call(audioserver, bootanim) -allow audioserver perfd_socket:sock_file write; - allow audioserver sysfs_soc:file r_file_perms; allow audioserver sysfs_soc:dir search; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 95550cfb..a4e7d293 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -168,7 +168,7 @@ /vendor/bin/oemlock_provision u:object_r:hal_bootctl_default_exec:s0 /vendor/bin/oemlock-bridge u:object_r:hal_bootctl_default_exec:s0 /vendor/bin/hw/android\.hardware\.usb@1\.1-service.wahoo u:object_r:hal_usb_default_exec:s0 -/vendor/bin/hw/android\.hardware\.power@1\.1-service.wahoo u:object_r:hal_power_default_exec:s0 +/vendor/bin/hw/android\.hardware\.power@1\.2-service.wahoo u:object_r:hal_power_default_exec:s0 /vendor/bin/hw/android\.hardware\.thermal@1\.0-service.wahoo u:object_r:hal_thermal_default_exec:s0 /vendor/bin/chre u:object_r:chre_exec:s0 /vendor/bin/time_daemon u:object_r:time_daemon_exec:s0 diff --git a/sepolicy/vendor/hal_audio_default.te b/sepolicy/vendor/hal_audio_default.te index 357b4cdf..47f4f7e3 100644 --- a/sepolicy/vendor/hal_audio_default.te +++ b/sepolicy/vendor/hal_audio_default.te @@ -3,8 +3,10 @@ r_dir_file(hal_audio_default, sysfs_soc) allow hal_audio_default audio_vendor_data_file:dir rw_dir_perms; allow hal_audio_default audio_vendor_data_file:file create_file_perms; -allow hal_audio_default perfd:unix_stream_socket connectto; -allow hal_audio_default perfd_socket:sock_file write; +dontaudit hal_audio_default perfd:unix_stream_socket connectto; +dontaudit hal_audio_default perfd_socket:sock_file write; + +hal_client_domain(hal_audio_default, hal_power) userdebug_or_eng(` allow hal_audio diag_device:chr_file rw_file_perms; From 3134f29b6faa594d76b7bc04e8bea8386c0794cb Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Mon, 4 Dec 2017 19:41:43 -0800 Subject: [PATCH 085/300] thermal-engine: start as class hal thermal-engine serves the IThermal 1.1 HAL. Start as class "hal" to re-register with hwservicemanager if hwservicemanager dies. Bug: 69174182 Test: manual: kill hwservicemanager, check for Ithermal 1.1 in lshal Change-Id: I8418a177eca992c20b86ed7ed53699d897c79cef --- init.hardware.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.hardware.rc b/init.hardware.rc index 20a1aa93..74869967 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -508,7 +508,7 @@ service vendor.perfd /vendor/bin/perfd disabled service vendor.thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf} - class main + class hal user root group root system socket thermal-send-client stream 0666 system system From efcc5bf36132f220e5f967650f247f53712c60d6 Mon Sep 17 00:00:00 2001 From: Zhuoyao Zhang Date: Fri, 1 Dec 2017 14:03:10 -0800 Subject: [PATCH 086/300] Update make file for power service * Add dpendency on android.hardware.power@1.0, this is required for coverage build. Test: lunch walleye_coverage-userdebug make android.hardware.power@1.1-service.wahoo Change-Id: I3424f4052e6927ee3825512cb5ba898345ce275f --- power/Android.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/power/Android.mk b/power/Android.mk index 1e9071e4..2d935abf 100644 --- a/power/Android.mk +++ b/power/Android.mk @@ -53,6 +53,8 @@ LOCAL_SHARED_LIBRARIES := \ libhidltransport \ libhardware \ libutils \ + android.hardware.power@1.0 \ + android.hardware.power@1.1 \ android.hardware.power@1.2 \ include $(BUILD_EXECUTABLE) From e61ae0c390db95cadebe945c1e5b56d042146004 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 7 Dec 2017 10:56:52 -0800 Subject: [PATCH 087/300] Power: handle launch hint end sent from framework We handle launch hint end sent from framework on marlin as well. On wahoo, it is disabled due to launch hint end sent earlier than camera fully launch. With more camera related hints linked to PowerHAL, we can do additional boost for camera launch. 12-07 17:52:27.739 765 765 D QCOM PowerHAL: AUDIO STREAMING ON // LAUCH ON from framework, boost 12-07 17:52:27.739 765 765 D QCOM PowerHAL: LAUNCH HINT: ON 12-07 17:52:27.741 765 765 D QCOM PowerHAL: Activity launch hint handled 12-07 17:52:27.775 765 765 D QCOM PowerHAL: AUDIO STREAMING OFF // Do additional 2.5s boost for camera 12-07 17:52:27.784 765 765 D QCOM PowerHAL: CAMERA LAUNCH ON: 1000 MS 12-07 17:52:27.828 765 765 D QCOM PowerHAL: CAMERA STREAMING ON: 1000 MS 12-07 17:52:27.843 765 765 D QCOM PowerHAL: CAMERA STREAMING OFF // LAUCH ON from framework, deboost 12-07 17:52:27.852 765 765 D QCOM PowerHAL: LAUNCH HINT: OFF 12-07 17:52:27.857 765 765 D QCOM PowerHAL: CAMERA STREAMING ON: 1000 MS 12-07 17:52:28.016 765 765 D QCOM PowerHAL: CAMERA STREAMING OFF // Additional 2.5s boost for camera still remains 12-07 17:52:28.017 765 765 D QCOM PowerHAL: CAMERA LAUNCH OFF 12-07 17:52:28.017 765 765 D QCOM PowerHAL: Video Encode hint start Test: monitor cpufreq with camera Bug: 65034076 Change-Id: I06d6fa18c763f40f1a9d2f77b398c372957bbcd4 --- power/power-8998.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/power/power-8998.c b/power/power-8998.c index 869f23b6..3c68a279 100644 --- a/power/power-8998.c +++ b/power/power-8998.c @@ -200,13 +200,7 @@ static int process_boost(int hint_id, int boost_handle, int duration) static int process_video_encode_hint(void *data) { - static int boost_handle = -1; - if (data) { - // TODO: remove the launch boost based on camera launch time - int duration = 2000; // boosts 2s for starting encoding - boost_handle = process_boost(BOOST_HINT_ID, boost_handle, duration); - ALOGD("LAUNCH ENCODER-ON: %d MS", duration); int *resource_values = NULL; int resources = 0; resource_values = getPowerhint(DEFAULT_VIDEO_ENCODE_HINT_ID, &resources); @@ -225,10 +219,13 @@ static int process_video_encode_hint(void *data) int process_camera_launch_hint(int32_t duration) { static int cam_launch_handle = -1; + static int boost_handle = -1; if (duration > 0) { cam_launch_handle = process_boost(CAMERA_LAUNCH_HINT_ID, cam_launch_handle, duration); ALOGD("CAMERA LAUNCH ON: %d MS", duration); + // boosts 2.5s for launching + boost_handle = process_boost(BOOST_HINT_ID, boost_handle, 2500); return HINT_HANDLED; } else if (duration == 0) { release_request(cam_launch_handle); @@ -313,8 +310,8 @@ int process_audio_low_latency_hint(int32_t data) static int process_activity_launch_hint(void *data) { - // boost will timeout in 1.25s - int duration = 1250; + // boost will timeout in 5s + int duration = 5000; ATRACE_BEGIN("launch"); if (sustained_performance_mode || vr_mode) { ATRACE_END(); @@ -337,9 +334,7 @@ static int process_activity_launch_hint(void *data) return HINT_NONE; } } else if (data == NULL && launch_mode == 1) { - // framework release hints aren't necessarily reliable - // always wait the full duration - // release_request(launch_handle); + release_request(launch_handle); ATRACE_INT("launch_lock", 0); launch_mode = 0; ATRACE_END(); From 299ea3dc1982f4742e3a41ad818380180e2168dc Mon Sep 17 00:00:00 2001 From: Andre Eisenbach Date: Wed, 6 Dec 2017 16:16:36 -0800 Subject: [PATCH 088/300] Rename libnfc-brcm.conf -> libnfc-nci.conf Test: manual Change-Id: I9655a14e021024540cf342022cb817e1f8d0f9ad --- device.mk | 2 +- nfc/{libnfc-brcm.conf => libnfc-nci.conf} | 23 +---------------------- 2 files changed, 2 insertions(+), 23 deletions(-) rename nfc/{libnfc-brcm.conf => libnfc-nci.conf} (92%) diff --git a/device.mk b/device.mk index eb368814..1fd2ecb4 100755 --- a/device.mk +++ b/device.mk @@ -338,7 +338,7 @@ PRODUCT_PACKAGES += \ android.hardware.nfc@1.0-service PRODUCT_COPY_FILES += \ - device/google/wahoo/nfc/libnfc-brcm.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-brcm.conf \ + device/google/wahoo/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nci.conf \ PRODUCT_PACKAGES += \ android.hardware.usb@1.1-service.wahoo diff --git a/nfc/libnfc-brcm.conf b/nfc/libnfc-nci.conf similarity index 92% rename from nfc/libnfc-brcm.conf rename to nfc/libnfc-nci.conf index a7444c3f..d14b133a 100644 --- a/nfc/libnfc-brcm.conf +++ b/nfc/libnfc-nci.conf @@ -2,8 +2,7 @@ ############################################################################### # Application options -APPL_TRACE_LEVEL=0x00 -PROTOCOL_TRACE_LEVEL=0x00000000 +NFC_DEBUG_ENABLED=0 ############################################################################### # performance measurement @@ -168,12 +167,6 @@ UICC_IDLE_TIMEOUT=0 # If specified, this AID will be substituted when an Empty SELECT command is # detected. The first byte is the length of the AID. Maximum length is 16. AID_FOR_EMPTY_SELECT={08:A0:00:00:01:51:00:00:00} -############################################################################### -# Maximum Number of Credits to be allowed by the NFCC -# This value overrides what the NFCC specifices allowing the host to have -# the control to work-around transport limitations. If this value does -# not exist or is set to 0, the NFCC will provide the number of credits. -MAX_RF_DATA_CREDITS=1 ############################################################################### # This setting allows you to disable registering the T4t Virtual SE that causes @@ -290,20 +283,6 @@ MAX_RF_DATA_CREDITS=1 # Default poll duration (in ms) # The defualt is 500ms if not set (see nfc_target.h) #NFA_DM_DISC_DURATION_POLL=333 -############################################################################### -# Antenna Configuration - This data is used when setting 0xC8 config item -# at startup (before discovery is started). If not used, no value is sent. -# -# The settings for this value are documented here: -# http://wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/ -# Design/Doc/PHY%20register%20settings/BCM20791-B2-1027-02_PHY_Recommended_Reg_Settings.xlsx -# This document is maintained by Paul Forshaw. -# -# The values marked as ?? should be tweaked per antenna or customer/app: -# {20:C8:1E:06:??:00:??:??:??:00:??:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:??:01:00:00:40:04} -# array[0] = 0x20 is length of the payload from array[1] to the end -# array[1] = 0xC8 is PREINIT_DSP_CFG -#PREINIT_DSP_CFG={20:C8:1E:06:1F:00:0F:03:3C:00:04:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:48:01:00:00:40:04} ############################################################################### # Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1. From 787a4648f250312b351155e156238e46293adb5d Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 13 Dec 2017 13:21:26 +0900 Subject: [PATCH 089/300] android.hardware.thermal@1.0-wahoo can be a static lib thermal_engine, which is a proprietary module for msm8998, is now statically linking to this library. Bug: 70551668 Test: walleye is buildable and boots to the UI Change-Id: I1417a9632f89869f2f8e3dc786c3f1c9fae9e45a --- CleanSpec.mk | 3 +++ thermal/Android.bp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index a1792ca5..abaf41cd 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -149,3 +149,6 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.recovery.$(PRODUCT_HARDWA # Remove build and default prop. $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/*.prop) + +# android.hardware.thermal@1.0-wahoo.so can be a static lib +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.thermal@1.0-wahoo.so) diff --git a/thermal/Android.bp b/thermal/Android.bp index fcd227e1..be1e7039 100644 --- a/thermal/Android.bp +++ b/thermal/Android.bp @@ -1,4 +1,4 @@ -cc_library_shared { +cc_library { name: "android.hardware.thermal@1.1-wahoo", defaults: ["hidl_defaults"], owner: "qcom", From 2c18c1f721b7927f9d8a804677882c4089255f40 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 12 Dec 2017 18:06:35 -0800 Subject: [PATCH 090/300] Remove PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE Replace it with FCM Version = 2, specified explicitly in device manifest. Test: builds Bug: 69636193 Change-Id: I0f5689344bb7b10b2b5db2549e95c940c4812f9d --- device.mk | 1 - manifest.xml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/device.mk b/device.mk index a36292b0..085e626e 100755 --- a/device.mk +++ b/device.mk @@ -53,7 +53,6 @@ endif PRODUCT_CHARACTERISTICS := nosdcard PRODUCT_SHIPPING_API_LEVEL := 26 -PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE := 27 DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay diff --git a/manifest.xml b/manifest.xml index 1a3aca83..1af6c6f5 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,4 +1,4 @@ - + android.hardware.audio hwbinder From 245704da172d235e8b89d4d6d81e79f4e08eb50b Mon Sep 17 00:00:00 2001 From: Kumar Anand Date: Thu, 14 Dec 2017 11:14:39 -0800 Subject: [PATCH 091/300] wifi: cnss_diag is disabled as default Do not start cnss_diag as default. cnss_diag can be started to collect additional logging by launching from Pixel Logger or from command line (adb shell) Bug: 70674448 Test: Manual Wifi Test Change-Id: I351256a3f87ef7e33e5207e97d01de23463abef3 --- init.hardware.diag.rc.userdebug | 1 + 1 file changed, 1 insertion(+) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index c55f0ed0..5ccd4c5b 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -373,6 +373,7 @@ service vendor.cnss_diag /vendor/bin/cnss_diag -q -u -w class late_start user system group system + disabled oneshot service vendor.cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cnss_diag/cnss_diag.conf From b310f0dfef30eb8be0311d3041ff94800d74e7e8 Mon Sep 17 00:00:00 2001 From: Ian Pedowitz Date: Thu, 21 Dec 2017 15:20:28 -0800 Subject: [PATCH 092/300] Update SVN to 6 for Feb 2017 Monthly Update Fixes: 70921882 Test: source build/envsetup.sh && lunch walleye-userdebug && m -j40 Test: Flashed walleye and Verified that SVN is 06 Change-Id: Id546bb9527343e3965e71bd6cd8df0b19d2c0a32 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 2b4026ab..61eb9719 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=5 + ro.vendor.build.svn=6 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 442a23d6280778482e55949128ed5bff153c3e98 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 28 Dec 2017 10:22:18 -0800 Subject: [PATCH 093/300] make InteractionHandler thread safe InteractionHandler calls undo_hint_action in a separate thread, where undo_hint_action manipulates a linklist which is not protected by any locking method. std::lock_guard lk(mLock) protects insides InteractionHandler class, but the linklist is also used in other places of PowerHAL such as Encoder hint. Bug: 71383315 Test: Build Change-Id: I81e2c79ab78ed7bd13ddc663ddbe86fa08f29337 --- power/InteractionHandler.cpp | 9 ++++----- power/InteractionHandler.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/power/InteractionHandler.cpp b/power/InteractionHandler.cpp index ac00514f..ca142a92 100644 --- a/power/InteractionHandler.cpp +++ b/power/InteractionHandler.cpp @@ -45,7 +45,8 @@ InteractionHandler::InteractionHandler() mWaitMs(100), mMinDurationMs(1400), mMaxDurationMs(5650), - mDurationMs(0) { + mDurationMs(0), + mHandle(0) { } InteractionHandler::~InteractionHandler() { @@ -101,16 +102,14 @@ void InteractionHandler::PerfLock() { resource_values = getPowerhint(INTERACTION_HINT_ID, &num_resources); if (resource_values != NULL) { ALOGV("%s: acquiring perf lock", __func__); - perform_hint_action(INTERACTION_HINT_ID, - resource_values, num_resources); - + mHandle = interaction_with_handle(mHandle, 0, num_resources, resource_values); ATRACE_INT("interaction_lock", 1); } } void InteractionHandler::PerfRel() { ALOGV("%s: releasing perf lock", __func__); - undo_hint_action(INTERACTION_HINT_ID); + release_request(mHandle); ATRACE_INT("interaction_lock", 0); } diff --git a/power/InteractionHandler.h b/power/InteractionHandler.h index 8b5aebc9..a7f14f3f 100644 --- a/power/InteractionHandler.h +++ b/power/InteractionHandler.h @@ -61,7 +61,7 @@ struct InteractionHandler { std::unique_ptr mThread; std::mutex mLock; std::condition_variable mCond; + int mHandle; }; #endif //INTERACTIONHANDLER_H - From 51c700f3710a3ba32d30be7951792389fe85e3ee Mon Sep 17 00:00:00 2001 From: Miguel de Dios Date: Thu, 28 Dec 2017 18:16:33 -0800 Subject: [PATCH 094/300] Allow hardware_info_app to read from debugfs_ufs. Add sepolicy for hardware_info_app to read from debugfs_ufs since we need to read /sys/kernel/debug/ufshcd0/dump_health_desc. Change-Id: I86bf99f06bf18a2f7264dd85b745c99433872f35 Bugs: b/70754991 Test: pts-tradefed run pts -m PtsHardwareInfoHostTestCases --- sepolicy/vendor/hardware_info_app.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sepolicy/vendor/hardware_info_app.te b/sepolicy/vendor/hardware_info_app.te index 70cb8010..ba57b624 100644 --- a/sepolicy/vendor/hardware_info_app.te +++ b/sepolicy/vendor/hardware_info_app.te @@ -24,3 +24,6 @@ allow hardware_info_app sysfs_scsi_devices_0000:file { getattr open read }; allow hardware_info_app sysfs_soc:dir search; allow hardware_info_app sysfs_soc:file { getattr open read }; +# DebugFS +allow hardware_info_app debugfs_ufs:dir search; +allow hardware_info_app debugfs_ufs:file r_file_perms; From c426d90f152887f9cd1c5bf5f4bb601f922f7462 Mon Sep 17 00:00:00 2001 From: Janis Danisevskis Date: Wed, 3 Jan 2018 16:54:17 -0800 Subject: [PATCH 095/300] Remove KM4 reference HAL. On wahoo devices we see bootloops due to failure to get KM4 HAL service from hwservicemanager despite being running and registered. This patch removes the reference KM4 HAL for now. Test: N/A Change-Id: I06cc6ce46d1fd754eefaff287e5e3cd8720507e3 --- CleanSpec.mk | 4 ++++ device.mk | 5 ----- manifest.xml | 9 --------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index abaf41cd..c671d938 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -152,3 +152,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/*.prop) # android.hardware.thermal@1.0-wahoo.so can be a static lib $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.thermal@1.0-wahoo.so) + +# Remove android.hardware.keymaster@4.0-service +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.keymaster@4.0-service) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.keymaster@4.0-service.rc) diff --git a/device.mk b/device.mk index e8f48d39..0132e1ba 100755 --- a/device.mk +++ b/device.mk @@ -178,11 +178,6 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ android.hardware.health@2.0-service -# Keymaster 4 (software only) -PRODUCT_PACKAGES += \ - android.hardware.keymaster@4.0-impl \ - android.hardware.keymaster@4.0-service - # Audio fluence, ns, aec property, voice and media volume steps PRODUCT_PROPERTY_OVERRIDES += \ ro.qc.sdk.audio.fluencetype=fluencepro \ diff --git a/manifest.xml b/manifest.xml index 1af6c6f5..961b0644 100644 --- a/manifest.xml +++ b/manifest.xml @@ -167,15 +167,6 @@ default - - android.hardware.keymaster - hwbinder - 4.0 - - IKeymaster - default - - android.hardware.light hwbinder From 6752f8c544663f64bc61eb7bc37fd7a6a932a744 Mon Sep 17 00:00:00 2001 From: Sundong Ahn Date: Mon, 10 Jul 2017 13:31:02 +0900 Subject: [PATCH 096/300] Revert "configstore: applied uprev of configstore" This reverts commit aee1b828f77b3e342a508ba614b65b506d0a1ab4. Configstore was up-revisioned from 1.0 to 1.1. However no new APIs were added to 1.1. Therefore configstore in master will be down revisioned to 1.0. Bug: 71555815 Test: build & run Change-Id: Ie441c505ccc17403e4e5450b3ac86a23f2272e8f --- init.hardware.rc | 2 +- manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 74869967..df966230 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -201,7 +201,7 @@ on late-fs start surfaceflinger start bootanim start vendor.hwcomposer-2-1 - start vendor.configstore-hal + start vendor.configstore-hal-1-0 start vendor.gralloc-2-0 # Mount RW partitions which need run fsck diff --git a/manifest.xml b/manifest.xml index 961b0644..5f227b7b 100644 --- a/manifest.xml +++ b/manifest.xml @@ -65,7 +65,7 @@ android.hardware.configstore hwbinder - 1.1 + 1.0 ISurfaceFlingerConfigs default From e6657935e8fb1025ecc36345d0f15c5a71c8459d Mon Sep 17 00:00:00 2001 From: Shawn Willden Date: Thu, 4 Jan 2018 12:21:13 -0700 Subject: [PATCH 097/300] Restore KM4 reference HAL. This is temporary, until we get the hardware implementation from Qualcomm. When we do, this reference implementation will be replaced. Until then, keystore will notice this implementation when starting up, but favor the hardware keymaster 3.0 implementation. Engineers who wish to do testing and development with the KM4 reference HAL on wahoo can simply remove the hardware 3.0 implementation from the device.mk file. Keystore will then find no HW implementation and will load the SW implementation. Test: Boot and run KM4 VTS tests. Change-Id: I1b7183b221041b55792200a2aa3e0ed974da2e0b --- device.mk | 4 ++++ manifest.xml | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/device.mk b/device.mk index 0132e1ba..c32b08ad 100755 --- a/device.mk +++ b/device.mk @@ -178,6 +178,10 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ android.hardware.health@2.0-service +# Keymaster 4 (software only) +PRODUCT_PACKAGES += \ + android.hardware.keymaster@4.0-service + # Audio fluence, ns, aec property, voice and media volume steps PRODUCT_PROPERTY_OVERRIDES += \ ro.qc.sdk.audio.fluencetype=fluencepro \ diff --git a/manifest.xml b/manifest.xml index 961b0644..d065341f 100644 --- a/manifest.xml +++ b/manifest.xml @@ -167,6 +167,15 @@ default + + android.hardware.keymaster + hwbinder + 4.0 + + IKeymasterDevice + default + + android.hardware.light hwbinder From d7f901b58dd1ea1eb370c1a0f41f3834a87dc6f1 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Sun, 31 Dec 2017 22:14:16 -0800 Subject: [PATCH 098/300] wahoo: power: switch to libperfmgr for powerhint Test: boot and do powerhint Bug: 62041945 Change-Id: I7de1d2bf377fb46162171a084fca3413b1067d3b --- device.mk | 4 +- init.hardware.rc | 14 +- power-libperfmgr/Android.bp | 37 ++ power-libperfmgr/InteractionHandler.cpp | 244 ++++++++++ power-libperfmgr/InteractionHandler.h | 71 +++ power-libperfmgr/Power.cpp | 346 ++++++++++++++ power-libperfmgr/Power.h | 77 ++++ ...ware.power@1.2-service.wahoo-libperfmgr.rc | 4 + power-libperfmgr/power-helper.c | 176 +++++++ power-libperfmgr/power-helper.h | 100 ++++ power-libperfmgr/service.cpp | 67 +++ powerhint.json | 431 ++++++++++++++++++ sepolicy/vendor/file_contexts | 1 + sepolicy/vendor/hal_camera.te | 6 +- sepolicy/vendor/hal_power_default.te | 9 +- sepolicy/vendor/perfd.te | 28 -- 16 files changed, 1576 insertions(+), 39 deletions(-) create mode 100644 power-libperfmgr/Android.bp create mode 100644 power-libperfmgr/InteractionHandler.cpp create mode 100644 power-libperfmgr/InteractionHandler.h create mode 100644 power-libperfmgr/Power.cpp create mode 100644 power-libperfmgr/Power.h create mode 100644 power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc create mode 100644 power-libperfmgr/power-helper.c create mode 100644 power-libperfmgr/power-helper.h create mode 100644 power-libperfmgr/service.cpp create mode 100755 powerhint.json diff --git a/device.mk b/device.mk index e8f48d39..d2913c5d 100755 --- a/device.mk +++ b/device.mk @@ -169,10 +169,10 @@ PRODUCT_COPY_FILES += \ # power HAL PRODUCT_PACKAGES += \ - android.hardware.power@1.2-service.wahoo + android.hardware.power@1.2-service.wahoo-libperfmgr PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml + $(LOCAL_PATH)/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json # health HAL PRODUCT_PACKAGES += \ diff --git a/init.hardware.rc b/init.hardware.rc index 74869967..571eb081 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -385,7 +385,6 @@ on zygote-start # b/62837579 elabel directory mkdir /data/misc/elabel 0700 system system - on early-boot # wait for devices wait_for_prop sys.qcom.devup 1 @@ -549,11 +548,20 @@ service vendor.per_proxy /vendor/bin/pm-proxy disabled on property:sys.post_boot.parsed=1 - start vendor.perfd + # Setup permission for powerHAL + chown system system /dev/stune/top-app/schedtune.boost + chown system system /dev/cpu_dma_latency + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq + chown system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq + chown system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq + chown system system /sys/class/devfreq/soc:qcom,gpubw/min_freq + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_trigger_count + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq on property:sys.boot_completed=1 # Enable power setting and set sys.post_boot.parsed to 1 - # to start perfd start vendor.power_sh # Enable UFS powersaving diff --git a/power-libperfmgr/Android.bp b/power-libperfmgr/Android.bp new file mode 100644 index 00000000..8deca675 --- /dev/null +++ b/power-libperfmgr/Android.bp @@ -0,0 +1,37 @@ +// +// Copyright (C) 2018 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +cc_binary { + name: "android.hardware.power@1.2-service.wahoo-libperfmgr", + relative_install_path: "hw", + init_rc: ["android.hardware.power@1.2-service.wahoo-libperfmgr.rc"], + srcs: ["service.cpp", "Power.cpp", "InteractionHandler.cpp", "power-helper.c"], + cflags: [ + "-Wall", + "-Werror", + ], + shared_libs: [ + "libbase", + "libhidlbase", + "libhidltransport", + "liblog", + "libutils", + "libcutils", + "android.hardware.power@1.0", + "android.hardware.power@1.1", + "android.hardware.power@1.2", + "libperfmgr", + ], + proprietary: true, +} diff --git a/power-libperfmgr/InteractionHandler.cpp b/power-libperfmgr/InteractionHandler.cpp new file mode 100644 index 00000000..b8ce3ef1 --- /dev/null +++ b/power-libperfmgr/InteractionHandler.cpp @@ -0,0 +1,244 @@ +/* + * Copyright (C) 2018 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_NDEBUG 0 + +#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr" +#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL) + +#include +#include +#include +#include +#include +#include +#include + +#include "InteractionHandler.h" + +#define FB_IDLE_PATH "/sys/class/graphics/fb0/idle_state" +#define MAX_LENGTH 64 + +#define MSINSEC 1000L +#define USINMS 1000000L + +InteractionHandler::InteractionHandler(std::shared_ptr const & hint_manager) + : mState(INTERACTION_STATE_UNINITIALIZED), + mWaitMs(100), + mMinDurationMs(1400), + mMaxDurationMs(5650), + mDurationMs(0), + mHintManager(hint_manager) { +} + +InteractionHandler::~InteractionHandler() { + Exit(); +} + +bool InteractionHandler::Init() { + std::lock_guard lk(mLock); + + if (mState != INTERACTION_STATE_UNINITIALIZED) + return true; + + mIdleFd = open(FB_IDLE_PATH, O_RDONLY); + if (mIdleFd < 0) { + ALOGE("Unable to open idle state path (%d)", errno); + return false; + } + + mEventFd = eventfd(0, EFD_NONBLOCK); + if (mEventFd < 0) { + ALOGE("Unable to create event fd (%d)", errno); + close(mIdleFd); + return false; + } + + mState = INTERACTION_STATE_IDLE; + mThread = std::unique_ptr( + new std::thread(&InteractionHandler::Routine, this)); + + return true; +} + +void InteractionHandler::Exit() { + std::unique_lock lk(mLock); + if (mState == INTERACTION_STATE_UNINITIALIZED) + return; + + AbortWaitLocked(); + mState = INTERACTION_STATE_UNINITIALIZED; + lk.unlock(); + + mCond.notify_all(); + mThread->join(); + + close(mEventFd); + close(mIdleFd); +} + +void InteractionHandler::PerfLock() { + ALOGV("%s: acquiring perf lock", __func__); + if (!mHintManager->DoHint("INTERACTION")) { + ALOGE("%s: do hint INTERACTION failed", __func__); + } + ATRACE_INT("interaction_lock", 1); +} + +void InteractionHandler::PerfRel() { + ALOGV("%s: releasing perf lock", __func__); + if (!mHintManager->EndHint("INTERACTION")) { + ALOGE("%s: end hint INTERACTION failed", __func__); + } + ATRACE_INT("interaction_lock", 0); +} + +long long InteractionHandler::CalcTimespecDiffMs(struct timespec start, + struct timespec end) { + long long diff_in_us = 0; + diff_in_us += (end.tv_sec - start.tv_sec) * MSINSEC; + diff_in_us += (end.tv_nsec - start.tv_nsec) / USINMS; + return diff_in_us; +} + +void InteractionHandler::Acquire(int32_t duration) { + ATRACE_CALL(); + + std::lock_guard lk(mLock); + if (mState == INTERACTION_STATE_UNINITIALIZED) { + ALOGW("%s: called while uninitialized", __func__); + return; + } + + int inputDuration = duration + 650; + int finalDuration; + if (inputDuration > mMaxDurationMs) + finalDuration = mMaxDurationMs; + else if (inputDuration > mMinDurationMs) + finalDuration = inputDuration; + else + finalDuration = mMinDurationMs; + + struct timespec cur_timespec; + clock_gettime(CLOCK_MONOTONIC, &cur_timespec); + if (mState != INTERACTION_STATE_IDLE && finalDuration <= mDurationMs) { + long long elapsed_time = CalcTimespecDiffMs(mLastTimespec, cur_timespec); + // don't hint if previous hint's duration covers this hint's duration + if (elapsed_time <= (mDurationMs - finalDuration)) { + ALOGV("%s: Previous duration (%d) cover this (%d) elapsed: %lld", + __func__, mDurationMs, finalDuration, elapsed_time); + return; + } + } + mLastTimespec = cur_timespec; + mDurationMs = finalDuration; + + ALOGV("%s: input: %d final duration: %d", __func__, + duration, finalDuration); + + if (mState == INTERACTION_STATE_WAITING) + AbortWaitLocked(); + else if (mState == INTERACTION_STATE_IDLE) + PerfLock(); + + mState = INTERACTION_STATE_INTERACTION; + mCond.notify_one(); +} + +void InteractionHandler::Release() { + std::lock_guard lk(mLock); + if (mState == INTERACTION_STATE_WAITING) { + ATRACE_CALL(); + PerfRel(); + mState = INTERACTION_STATE_IDLE; + } else { + // clear any wait aborts pending in event fd + uint64_t val; + ssize_t ret = read(mEventFd, &val, sizeof(val)); + + ALOGW_IF(ret < 0, "%s: failed to clear eventfd (%zd, %d)", + __func__, ret, errno); + } +} + +// should be called while locked +void InteractionHandler::AbortWaitLocked() { + uint64_t val = 1; + ssize_t ret = write(mEventFd, &val, sizeof(val)); + if (ret != sizeof(val)) + ALOGW("Unable to write to event fd (%zd)", ret); +} + +void InteractionHandler::WaitForIdle(int32_t wait_ms, int32_t timeout_ms) { + char data[MAX_LENGTH]; + ssize_t ret; + struct pollfd pfd[2]; + + ATRACE_CALL(); + + ALOGV("%s: wait:%d timeout:%d", __func__, wait_ms, timeout_ms); + + pfd[0].fd = mEventFd; + pfd[0].events = POLLIN; + pfd[1].fd = mIdleFd; + pfd[1].events = POLLPRI | POLLERR; + + ret = poll(pfd, 1, wait_ms); + if (ret > 0) { + ALOGV("%s: wait aborted", __func__); + return; + } else if (ret < 0) { + ALOGE("%s: error in poll while waiting", __func__); + return; + } + + ret = pread(mIdleFd, data, sizeof(data), 0); + if (!ret) { + ALOGE("%s: Unexpected EOF!", __func__); + return; + } + + if (!strncmp(data, "idle", 4)) { + ALOGV("%s: already idle", __func__); + return; + } + + ret = poll(pfd, 2, timeout_ms); + if (ret < 0) + ALOGE("%s: Error on waiting for idle (%zd)", __func__, ret); + else if (ret == 0) + ALOGV("%s: timed out waiting for idle", __func__); + else if (pfd[0].revents) + ALOGV("%s: wait for idle aborted", __func__); + else if (pfd[1].revents) + ALOGV("%s: idle detected", __func__); +} + +void InteractionHandler::Routine() { + std::unique_lock lk(mLock, std::defer_lock); + + while (true) { + lk.lock(); + mCond.wait(lk, [&] { return mState != INTERACTION_STATE_IDLE; }); + if (mState == INTERACTION_STATE_UNINITIALIZED) + return; + mState = INTERACTION_STATE_WAITING; + lk.unlock(); + + WaitForIdle(mWaitMs, mDurationMs); + Release(); + } +} diff --git a/power-libperfmgr/InteractionHandler.h b/power-libperfmgr/InteractionHandler.h new file mode 100644 index 00000000..893c72f0 --- /dev/null +++ b/power-libperfmgr/InteractionHandler.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INTERACTIONHANDLER_H +#define INTERACTIONHANDLER_H + +#include +#include +#include + +#include + +using ::android::perfmgr::HintManager; + +enum interaction_state { + INTERACTION_STATE_UNINITIALIZED, + INTERACTION_STATE_IDLE, + INTERACTION_STATE_INTERACTION, + INTERACTION_STATE_WAITING, +}; + +struct InteractionHandler { + InteractionHandler(std::shared_ptr const & hint_manager); + ~InteractionHandler(); + bool Init(); + void Exit(); + void Acquire(int32_t duration); + + private: + void Release(); + void WaitForIdle(int32_t wait_ms, int32_t timeout_ms); + void AbortWaitLocked(); + void Routine(); + + void PerfLock(); + void PerfRel(); + + long long CalcTimespecDiffMs(struct timespec start, struct timespec end); + + enum interaction_state mState; + + int mIdleFd; + int mEventFd; + + int32_t mWaitMs; + int32_t mMinDurationMs; + int32_t mMaxDurationMs; + int32_t mDurationMs; + + struct timespec mLastTimespec; + + std::unique_ptr mThread; + std::mutex mLock; + std::condition_variable mCond; + std::shared_ptr mHintManager; +}; + +#endif //INTERACTIONHANDLER_H diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp new file mode 100644 index 00000000..50608d52 --- /dev/null +++ b/power-libperfmgr/Power.cpp @@ -0,0 +1,346 @@ +/* + * Copyright (C) 2018 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.power@1.2-service.wahoo-libperfmgr" + +#include +#include +#include +#include +#include + +#include "Power.h" + +#include "power-helper.h" + +/* RPM runs at 19.2Mhz. Divide by 19200 for msec */ +#define RPM_CLK 19200 + +extern struct stat_pair rpm_stat_map[]; + +namespace android { +namespace hardware { +namespace power { +namespace V1_2 { +namespace implementation { + +using ::android::hardware::power::V1_0::Feature; +using ::android::hardware::power::V1_0::PowerStatePlatformSleepState; +using ::android::hardware::power::V1_0::Status; +using ::android::hardware::power::V1_1::PowerStateSubsystem; +using ::android::hardware::power::V1_1::PowerStateSubsystemSleepState; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +Power::Power() : + mHintManager(HintManager::GetFromJSON("/vendor/etc/powerhint.json")), + mInteractionHandler(mHintManager), + mVRModeOn(false), + mSustainedPerfModeOn(false), + mEncoderModeOn(false) { + mInteractionHandler.Init(); +} + +// Methods from ::android::hardware::power::V1_0::IPower follow. +Return Power::setInteractive(bool /* interactive */) { + return Void(); +} + +Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { + if (!isSupportedGovernor()) { + return Void(); + } + + switch(hint) { + case PowerHint_1_0::INTERACTION: + if (mVRModeOn || mSustainedPerfModeOn) { + ALOGV("%s: ignoring due to other active perf hints", __func__); + } else { + mInteractionHandler.Acquire(data); + } + break; + case PowerHint_1_0::VIDEO_ENCODE: + if (mVRModeOn || mSustainedPerfModeOn) { + ALOGV("%s: ignoring due to other active perf hints", __func__); + } else { + if (data) { + // Hint until canceled + mHintManager->DoHint("VIDEO_ENCODE"); + ALOGD("VIDEO_ENCODE ON"); + mEncoderModeOn = true; + } else { + mHintManager->EndHint("VIDEO_ENCODE"); + ALOGD("VIDEO_ENCODE OFF"); + mEncoderModeOn = false; + } + } + break; + case PowerHint_1_0::SUSTAINED_PERFORMANCE: + if (data && !mSustainedPerfModeOn) { + if (!mVRModeOn) { // Sustained mode only. + mHintManager->DoHint("SUSTAINED_PERFORMANCE"); + } else { // Sustained + VR mode. + mHintManager->EndHint("VR_MODE"); + mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE"); + } + mSustainedPerfModeOn = true; + } else if (!data && mSustainedPerfModeOn) { + mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE"); + mHintManager->EndHint("SUSTAINED_PERFORMANCE"); + if (mVRModeOn) { // Switch back to VR Mode. + mHintManager->DoHint("VR_MODE"); + } + mSustainedPerfModeOn = false; + } + break; + case PowerHint_1_0::VR_MODE: + if (data && !mVRModeOn) { + if (!mSustainedPerfModeOn) { // VR mode only. + mHintManager->DoHint("VR_MODE"); + } else { // Sustained + VR mode. + mHintManager->EndHint("SUSTAINED_PERFORMANCE"); + mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE"); + } + mVRModeOn = true; + } else if (!data && mVRModeOn) { + mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE"); + mHintManager->EndHint("VR_MODE"); + if (mSustainedPerfModeOn) { // Switch back to sustained Mode. + mHintManager->DoHint("SUSTAINED_PERFORMANCE"); + } + mVRModeOn = false; + } + break; + case PowerHint_1_0::LAUNCH: + if (mVRModeOn || mSustainedPerfModeOn) { + ALOGV("%s: ignoring due to other active perf hints", __func__); + } else { + if (data) { + // Hint until canceled + mHintManager->DoHint("LAUNCH"); + ALOGD("LAUNCH ON"); + } else { + mHintManager->EndHint("LAUNCH"); + ALOGD("LAUNCH OFF"); + } + } + break; + default: + break; + + } + return Void(); +} + +Return Power::setFeature(Feature /*feature*/, bool /*activate*/) { + //Nothing to do + return Void(); +} + +Return Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) { + + hidl_vec states; + uint64_t stats[MAX_PLATFORM_STATS * MAX_RPM_PARAMS] = {0}; + uint64_t *values; + struct PowerStatePlatformSleepState *state; + int ret; + + states.resize(PLATFORM_SLEEP_MODES_COUNT); + + ret = extract_platform_stats(stats); + if (ret != 0) { + states.resize(0); + goto done; + } + + /* Update statistics for XO_shutdown */ + state = &states[RPM_MODE_XO]; + state->name = "XO_shutdown"; + values = stats + (RPM_MODE_XO * MAX_RPM_PARAMS); + + state->residencyInMsecSinceBoot = values[1]; + state->totalTransitions = values[0]; + state->supportedOnlyInSuspend = false; + state->voters.resize(XO_VOTERS); + for(size_t i = 0; i < XO_VOTERS; i++) { + int voter = static_cast(i + XO_VOTERS_START); + state->voters[i].name = rpm_stat_map[voter].label; + values = stats + (voter * MAX_RPM_PARAMS); + state->voters[i].totalTimeInMsecVotedForSinceBoot = values[0] / RPM_CLK; + state->voters[i].totalNumberOfTimesVotedSinceBoot = values[1]; + } + + /* Update statistics for VMIN state */ + state = &states[RPM_MODE_VMIN]; + state->name = "VMIN"; + values = stats + (RPM_MODE_VMIN * MAX_RPM_PARAMS); + + state->residencyInMsecSinceBoot = values[1]; + state->totalTransitions = values[0]; + state->supportedOnlyInSuspend = false; + state->voters.resize(VMIN_VOTERS); + //Note: No filling of state voters since VMIN_VOTERS = 0 + +done: + _hidl_cb(states, Status::SUCCESS); + return Void(); +} + +static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) { + + uint64_t stats[WLAN_POWER_PARAMS_COUNT] = {0}; + struct PowerStateSubsystemSleepState *state; + int ret; + + ret = extract_wlan_stats(stats); + if (ret) + return ret; + + subsystem.name = "wlan"; + subsystem.states.resize(WLAN_STATES_COUNT); + + /* Update statistics for Active State */ + state = &subsystem.states[WLAN_STATE_ACTIVE]; + state->name = "Active"; + state->residencyInMsecSinceBoot = stats[CUMULATIVE_TOTAL_ON_TIME_MS]; + state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER]; + state->lastEntryTimestampMs = 0; //FIXME need a new value from Qcom + state->supportedOnlyInSuspend = false; + + /* Update statistics for Deep-Sleep state */ + state = &subsystem.states[WLAN_STATE_DEEP_SLEEP]; + state->name = "Deep-Sleep"; + state->residencyInMsecSinceBoot = stats[CUMULATIVE_SLEEP_TIME_MS]; + state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER]; + state->lastEntryTimestampMs = stats[LAST_DEEP_SLEEP_ENTER_TSTAMP_MS]; + state->supportedOnlyInSuspend = false; + + return 0; +} + +// Methods from ::android::hardware::power::V1_1::IPower follow. +Return Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) { + + hidl_vec subsystems; + int ret; + + subsystems.resize(SUBSYSTEM_COUNT); + + //We currently have only one Subsystem for WLAN + ret = get_wlan_low_power_stats(subsystems[SUBSYSTEM_WLAN]); + if (ret != 0) + goto done; + + //Add query for other subsystems here + +done: + _hidl_cb(subsystems, Status::SUCCESS); + return Void(); +} + +bool Power::isSupportedGovernor() { + std::string buf; + if (android::base::ReadFileToString("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", &buf)) { + buf = android::base::Trim(buf); + } + // Only support EAS 1.2, legacy EAS + if (buf == "schedutil" || buf == "sched") { + return true; + } else { + LOG(ERROR) << "Governor not supported by powerHAL, skipping"; + return false; + } +} + +Return Power::powerHintAsync(PowerHint_1_0 hint, int32_t data) { + // just call the normal power hint in this oneway function + return powerHint(hint, data); +} + +// Methods from ::android::hardware::power::V1_2::IPower follow. +Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { + if (!isSupportedGovernor()) { + return Void(); + } + + switch(hint) { + case PowerHint_1_2::AUDIO_LOW_LATENCY: + if (data) { + // Hint until canceled + mHintManager->DoHint("AUDIO_LOW_LATENCY"); + ALOGD("AUDIO LOW LATENCY ON"); + } else { + mHintManager->EndHint("AUDIO_LOW_LATENCY"); + ALOGD("AUDIO LOW LATENCY OFF"); + } + break; + case PowerHint_1_2::AUDIO_STREAMING: + if (data) { + // Hint until canceled + mHintManager->DoHint("AUDIO_STREAMING"); + ALOGD("AUDIO LOW LATENCY ON"); + } else { + mHintManager->EndHint("AUDIO_STREAMING"); + ALOGD("AUDIO LOW LATENCY OFF"); + } + break; + case PowerHint_1_2::CAMERA_LAUNCH: + if (data > 0) { + mHintManager->DoHint("CAMERA_LAUNCH", std::chrono::milliseconds(data)); + ALOGD("CAMERA LAUNCH ON: %d MS", data); + // boosts 2.5s for launching + mHintManager->DoHint("LAUNCH", std::chrono::milliseconds(2500)); + } else if (data == 0) { + mHintManager->EndHint("CAMERA_LAUNCH"); + ALOGD("CAMERA LAUNCH OFF"); + } else { + ALOGE("CAMERA LAUNCH INVALID DATA: %d", data); + } + break; + case PowerHint_1_2::CAMERA_STREAMING: + if (data > 0) { + mHintManager->DoHint("CAMERA_STREAMING", std::chrono::milliseconds(data)); + ALOGD("CAMERA STREAMING ON: %d MS", data); + } else if (data == 0) { + mHintManager->EndHint("CAMERA_STREAMING"); + ALOGD("CAMERA STREAMING OFF"); + } else { + ALOGE("CAMERA STREAMING INVALID DATA: %d", data); + } + break; + case PowerHint_1_2::CAMERA_SHOT: + if (data > 0) { + mHintManager->DoHint("CAMERA_SHOT", std::chrono::milliseconds(data)); + ALOGD("CAMERA SHOT ON: %d MS", data); + } else if (data == 0) { + mHintManager->EndHint("CAMERA_SHOT"); + ALOGD("CAMERA SHOT OFF"); + } else { + ALOGE("CAMERA SHOT INVALID DATA: %d", data); + } + break; + default: + return powerHint(static_cast(hint), data); + } + return Void(); +} + +} // namespace implementation +} // namespace V1_2 +} // namespace power +} // namespace hardware +} // namespace android diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h new file mode 100644 index 00000000..2d84fa57 --- /dev/null +++ b/power-libperfmgr/Power.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_POWER_V1_2_POWER_H +#define ANDROID_HARDWARE_POWER_V1_2_POWER_H + +#include + +#include +#include +#include + +#include "InteractionHandler.h" + +namespace android { +namespace hardware { +namespace power { +namespace V1_2 { +namespace implementation { + +using ::android::hardware::power::V1_0::Feature; +using ::android::hardware::power::V1_2::IPower; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::InteractionHandler; +using PowerHint_1_0 = ::android::hardware::power::V1_0::PowerHint; +using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint; +using ::android::perfmgr::HintManager; + +struct Power : public IPower { + // Methods from ::android::hardware::power::V1_0::IPower follow. + + Power(); + + Return setInteractive(bool /* interactive */) override; + Return powerHint(PowerHint_1_0 hint, int32_t data) override; + Return setFeature(Feature feature, bool activate) override; + Return getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override; + + // Methods from ::android::hardware::power::V1_1::IPower follow. + Return getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override; + Return powerHintAsync(PowerHint_1_0 hint, int32_t data) override; + + // Methods from ::android::hardware::power::V1_2::IPower follow. + Return powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override; + + // Methods from ::android::hidl::base::V1_0::IBase follow. + + private: + std::shared_ptr mHintManager; + InteractionHandler mInteractionHandler; + static bool isSupportedGovernor(); + std::atomic mVRModeOn; + std::atomic mSustainedPerfModeOn; + std::atomic mEncoderModeOn; +}; + +} // namespace implementation +} // namespace V1_2 +} // namespace power +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_POWER_V1_2_POWER_H diff --git a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc new file mode 100644 index 00000000..65c43b67 --- /dev/null +++ b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc @@ -0,0 +1,4 @@ +service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.wahoo-libperfmgr + class hal + user system + group system diff --git a/power-libperfmgr/power-helper.c b/power-libperfmgr/power-helper.c new file mode 100644 index 00000000..e355710a --- /dev/null +++ b/power-libperfmgr/power-helper.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_NIDEBUG 0 +#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "power-helper.h" + +#ifndef RPM_SYSTEM_STAT +#define RPM_SYSTEM_STAT "/d/system_stats" +#endif + +#ifndef WLAN_POWER_STAT +#define WLAN_POWER_STAT "/d/wlan0/power_stats" +#endif + +#define ARRAY_SIZE(x) (sizeof((x))/sizeof((x)[0])) +#define LINE_SIZE 128 + +const char *rpm_stat_params[MAX_RPM_PARAMS] = { + "count", + "actual last sleep(msec)", +}; + +const char *master_stat_params[MAX_RPM_PARAMS] = { + "Accumulated XO duration", + "XO Count", +}; + +struct stat_pair rpm_stat_map[] = { + { RPM_MODE_XO, "RPM Mode:vlow", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) }, + { RPM_MODE_VMIN, "RPM Mode:vmin", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) }, + { VOTER_APSS, "APSS", master_stat_params, ARRAY_SIZE(master_stat_params) }, + { VOTER_MPSS, "MPSS", master_stat_params, ARRAY_SIZE(master_stat_params) }, + { VOTER_ADSP, "ADSP", master_stat_params, ARRAY_SIZE(master_stat_params) }, + { VOTER_SLPI, "SLPI", master_stat_params, ARRAY_SIZE(master_stat_params) }, +}; + + +const char *wlan_power_stat_params[] = { + "cumulative_sleep_time_ms", + "cumulative_total_on_time_ms", + "deep_sleep_enter_counter", + "last_deep_sleep_enter_tstamp_ms" +}; + +struct stat_pair wlan_stat_map[] = { + { WLAN_POWER_DEBUG_STATS, "POWER DEBUG STATS", wlan_power_stat_params, ARRAY_SIZE(wlan_power_stat_params) }, +}; + +static int parse_stats(const char **params, size_t params_size, + uint64_t *list, FILE *fp) { + ssize_t nread; + size_t len = LINE_SIZE; + char *line; + size_t params_read = 0; + size_t i; + + line = malloc(len); + if (!line) { + ALOGE("%s: no memory to hold line", __func__); + return -ENOMEM; + } + + while ((params_read < params_size) && + (nread = getline(&line, &len, fp) > 0)) { + char *key = line + strspn(line, " \t"); + char *value = strchr(key, ':'); + if (!value || (value > (line + len))) + continue; + *value++ = '\0'; + + for (i = 0; i < params_size; i++) { + if (!strcmp(key, params[i])) { + list[i] = strtoull(value, NULL, 0); + params_read++; + break; + } + } + } + free(line); + + return 0; +} + + +static int extract_stats(uint64_t *list, char *file, + struct stat_pair *map, size_t map_size) { + FILE *fp; + ssize_t read; + size_t len = LINE_SIZE; + char *line; + size_t i, stats_read = 0; + int ret = 0; + + fp = fopen(file, "re"); + if (fp == NULL) { + ALOGE("%s: failed to open: %s Error = %s", __func__, file, strerror(errno)); + return -errno; + } + + line = malloc(len); + if (!line) { + ALOGE("%s: no memory to hold line", __func__); + fclose(fp); + return -ENOMEM; + } + + while ((stats_read < map_size) && (read = getline(&line, &len, fp) != -1)) { + size_t begin = strspn(line, " \t"); + + for (i = 0; i < map_size; i++) { + if (!strncmp(line + begin, map[i].label, strlen(map[i].label))) { + stats_read++; + break; + } + } + + if (i == map_size) + continue; + + ret = parse_stats(map[i].parameters, map[i].num_parameters, + &list[map[i].stat * MAX_RPM_PARAMS], fp); + if (ret < 0) + break; + } + free(line); + fclose(fp); + + return ret; +} + +int extract_platform_stats(uint64_t *list) { + return extract_stats(list, RPM_SYSTEM_STAT, rpm_stat_map, ARRAY_SIZE(rpm_stat_map)); +} + +int extract_wlan_stats(uint64_t *list) { + return extract_stats(list, WLAN_POWER_STAT, wlan_stat_map, ARRAY_SIZE(wlan_stat_map)); +} diff --git a/power-libperfmgr/power-helper.h b/power-libperfmgr/power-helper.h new file mode 100644 index 00000000..60646464 --- /dev/null +++ b/power-libperfmgr/power-helper.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __POWER_HELPER_H__ +#define __POWER_HELPER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +enum stats_type { + //Platform Stats + RPM_MODE_XO = 0, + RPM_MODE_VMIN, + RPM_MODE_MAX, + XO_VOTERS_START = RPM_MODE_MAX, + VOTER_APSS = XO_VOTERS_START, + VOTER_MPSS, + VOTER_ADSP, + VOTER_SLPI, + MAX_PLATFORM_STATS, + + //WLAN Stats + WLAN_POWER_DEBUG_STATS = 0, + MAX_WLAN_STATS, +}; + +enum subsystem_type { + SUBSYSTEM_WLAN = 0, + + //Don't add any lines after this line + SUBSYSTEM_COUNT +}; + +enum wlan_sleep_states { + WLAN_STATE_ACTIVE = 0, + WLAN_STATE_DEEP_SLEEP, + + //Don't add any lines after this line + WLAN_STATES_COUNT +}; + +enum wlan_power_params { + CUMULATIVE_SLEEP_TIME_MS = 0, + CUMULATIVE_TOTAL_ON_TIME_MS, + DEEP_SLEEP_ENTER_COUNTER, + LAST_DEEP_SLEEP_ENTER_TSTAMP_MS, + + //Don't add any lines after this line + WLAN_POWER_PARAMS_COUNT +}; + + +#define PLATFORM_SLEEP_MODES_COUNT RPM_MODE_MAX + +#define MAX_RPM_PARAMS 2 +#define XO_VOTERS (MAX_PLATFORM_STATS - XO_VOTERS_START) +#define VMIN_VOTERS 0 + +struct stat_pair { + enum stats_type stat; + const char *label; + const char **parameters; + size_t num_parameters; +}; + +int extract_platform_stats(uint64_t *list); +int extract_wlan_stats(uint64_t *list); + +#ifdef __cplusplus +} +#endif + +#endif //__POWER_HELPER_H__ diff --git a/power-libperfmgr/service.cpp b/power-libperfmgr/service.cpp new file mode 100644 index 00000000..77fb1390 --- /dev/null +++ b/power-libperfmgr/service.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2018 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.power@1.2-service.wahoo-libperfmgr" + +#include +#include + +#include "Power.h" + +using android::sp; +using android::status_t; +using android::OK; + +// libhwbinder: +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; + +// Generated HIDL files +using android::hardware::power::V1_2::IPower; +using android::hardware::power::V1_2::implementation::Power; + +int main() { + + status_t status; + android::sp service = nullptr; + + ALOGI("Power HAL Service 1.2 for Wahoo is starting."); + + service = new Power(); + if (service == nullptr) { + ALOGE("Can not create an instance of Power HAL Iface, exiting."); + + goto shutdown; + } + + configureRpcThreadpool(1, true /*callerWillJoin*/); + + status = service->registerAsService(); + if (status != OK) { + ALOGE("Could not register service for Power HAL Iface (%d).", status); + goto shutdown; + } + + ALOGI("Power Service is ready"); + joinRpcThreadpool(); + //Should not pass this line + +shutdown: + // In normal operation, we don't expect the thread pool to exit + + ALOGE("Power Service is shutting down"); + return 1; +} diff --git a/powerhint.json b/powerhint.json new file mode 100755 index 00000000..b641df33 --- /dev/null +++ b/powerhint.json @@ -0,0 +1,431 @@ +{ + "Nodes": [ + { + "Name": "CPULittleClusterMinFreq", + "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", + "Values": [ + "1900800", + "1555200", + "1512000", + "1478400", + "1134000", + "384000" + ], + "ResetOnInit": true + }, + { + "Name": "CPULittleClusterMaxFreq", + "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", + "Values": [ + "1555200", + "1478400", + "1248000", + "1900800" + ], + "ResetOnInit": true + }, + { + "Name": "CPUBigClusterMinFreq", + "Path": "/sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq", + "Values": [ + "2457600", + "1574400", + "1420800", + "1344000", + "1132800", + "300000" + ], + "ResetOnInit": true + }, + { + "Name": "CPUBigClusterMaxFreq", + "Path": "/sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq", + "Values": [ + "1132800", + "1267200", + "1344000", + "1574400", + "1958400", + "2457600" + ], + "ResetOnInit": true + }, + { + "Name": "GPUMinFreq", + "Path": "/sys/class/kgsl/kgsl-3d0/devfreq/min_freq", + "Values": [ + "515000000", + "414000000", + "257000000" + ], + "ResetOnInit": true + }, + { + "Name": "GPUMaxFreq", + "Path": "/sys/class/kgsl/kgsl-3d0/devfreq/max_freq", + "Values": [ + "342000000", + "414000000", + "515000000", + "710000000" + ], + "ResetOnInit": true + }, + { + "Name": "GPUBusMinFreq", + "Path": "/sys/class/devfreq/soc:qcom,gpubw/min_freq", + "Values": [ + "11863", + "7759", + "0" + ], + "ResetOnInit": true + }, + { + "Name": "TASchedtuneBoost", + "Path": "/dev/stune/top-app/schedtune.boost", + "Values": [ + "50", + "10" + ], + "ResetOnInit": true + }, + { + "Name": "CPUBWHystTriggerCount", + "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_trigger_count", + "Values": [ + "0", + "3" + ], + "ResetOnInit": true + }, + { + "Name": "CPUBWHistMemory", + "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory", + "Values": [ + "0", + "20" + ], + "ResetOnInit": true + }, + { + "Name": "CPUBWHystLength", + "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length", + "Values": [ + "0", + "10" + ], + "ResetOnInit": true + }, + { + "Name": "CPUBWMinFreq", + "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq", + "Values": [ + "13763", + "5195", + "1525", + "762" + ], + "ResetOnInit": true + }, + { + "Name": "PMQoSCpuDmaLatency", + "Path": "/dev/cpu_dma_latency", + "Values": [ + "44", + "100" + ], + "HoldFd": true + } + ], + "Actions": [ + { + "PowerHint": "VIDEO_ENCODE", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 4, + "Duration": 0 + }, + { + "PowerHint": "SUSTAINED_PERFORMANCE", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "SUSTAINED_PERFORMANCE", + "Node": "CPULittleClusterMaxFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "SUSTAINED_PERFORMANCE", + "Node": "GPUMaxFreq", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "VR_MODE", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 3, + "Duration": 0 + }, + { + "PowerHint": "VR_MODE", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "VR_MODE", + "Node": "CPULittleClusterMaxFreq", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "VR_MODE", + "Node": "CPULittleClusterMinFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "VR_MODE", + "Node": "GPUMaxFreq", + "ValueIndex": 2, + "Duration": 0 + }, + { + "PowerHint": "VR_MODE", + "Node": "GPUMinFreq", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "VR_MODE", + "Node": "GPUBusMinFreq", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "VR_SUSTAINED_PERFORMANCE", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 2, + "Duration": 0 + }, + { + "PowerHint": "VR_SUSTAINED_PERFORMANCE", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 3, + "Duration": 0 + }, + { + "PowerHint": "VR_SUSTAINED_PERFORMANCE", + "Node": "CPULittleClusterMaxFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "VR_SUSTAINED_PERFORMANCE", + "Node": "CPULittleClusterMinFreq", + "ValueIndex": 3, + "Duration": 0 + }, + { + "PowerHint": "VR_SUSTAINED_PERFORMANCE", + "Node": "GPUMaxFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "VR_SUSTAINED_PERFORMANCE", + "Node": "GPUMaxFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "VR_SUSTAINED_PERFORMANCE", + "Node": "GPUBusMinFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "INTERACTION", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 4, + "Duration": 0 + }, + { + "PowerHint": "INTERACTION", + "Node": "CPULittleClusterMinFreq", + "ValueIndex": 4, + "Duration": 0 + }, + { + "PowerHint": "INTERACTION", + "Node": "TASchedtuneBoost", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "INTERACTION", + "Node": "CPUBWHystTriggerCount", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "INTERACTION", + "Node": "CPUBWHystLength", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "INTERACTION", + "Node": "CPUBWHistMemory", + "ValueIndex": 0, + "Duration": 0 + }, + { + "PowerHint": "INTERACTION", + "Node": "CPUBWMinFreq", + "ValueIndex": 1, + "Duration": 0 + }, + { + "PowerHint": "LAUNCH", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 0, + "Duration": 5000 + }, + { + "PowerHint": "LAUNCH", + "Node": "CPULittleClusterMinFreq", + "ValueIndex": 0, + "Duration": 5000 + }, + { + "PowerHint": "LAUNCH", + "Node": "PMQoSCpuDmaLatency", + "ValueIndex": 0, + "Duration": 5000 + }, + { + "PowerHint": "LAUNCH", + "Node": "CPUBWHystTriggerCount", + "ValueIndex": 0, + "Duration": 5000 + }, + { + "PowerHint": "LAUNCH", + "Node": "CPUBWHystLength", + "ValueIndex": 0, + "Duration": 5000 + }, + { + "PowerHint": "LAUNCH", + "Node": "CPUBWHistMemory", + "ValueIndex": 0, + "Duration": 5000 + }, + { + "PowerHint": "LAUNCH", + "Node": "CPUBWMinFreq", + "ValueIndex": 0, + "Duration": 5000 + }, + { + "PowerHint": "CAMERA_LAUNCH", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_LAUNCH", + "Node": "CPULittleClusterMinFreq", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_LAUNCH", + "Node": "PMQoSCpuDmaLatency", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_STREAMING", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_STREAMING", + "Node": "CPULittleClusterMinFreq", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_STREAMING", + "Node": "PMQoSCpuDmaLatency", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "CPULittleClusterMinFreq", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "PMQoSCpuDmaLatency", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "CPUBWHystTriggerCount", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "CPUBWHystLength", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "CPUBWHistMemory", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "CPUBWMinFreq", + "ValueIndex": 0, + "Duration": 1000 + }, + { + "PowerHint": "AUDIO_STREAMING", + "Node": "CPUBigClusterMinFreq", + "ValueIndex": 2, + "Duration": 2000 + }, + { + "PowerHint": "AUDIO_STREAMING", + "Node": "PMQoSCpuDmaLatency", + "ValueIndex": 0, + "Duration": 2000 + }, + { + "PowerHint": "AUDIO_LOW_LATENCY", + "Node": "PMQoSCpuDmaLatency", + "ValueIndex": 0, + "Duration": 0 + } + ] +} diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 2af2d30d..11839321 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -169,6 +169,7 @@ /vendor/bin/oemlock-bridge u:object_r:hal_bootctl_default_exec:s0 /vendor/bin/hw/android\.hardware\.usb@1\.1-service.wahoo u:object_r:hal_usb_default_exec:s0 /vendor/bin/hw/android\.hardware\.power@1\.2-service.wahoo u:object_r:hal_power_default_exec:s0 +/vendor/bin/hw/android\.hardware\.power@1\.2-service.wahoo-libperfmgr u:object_r:hal_power_default_exec:s0 /vendor/bin/hw/android\.hardware\.thermal@1\.0-service.wahoo u:object_r:hal_thermal_default_exec:s0 /vendor/bin/chre u:object_r:chre_exec:s0 /vendor/bin/time_daemon u:object_r:time_daemon_exec:s0 diff --git a/sepolicy/vendor/hal_camera.te b/sepolicy/vendor/hal_camera.te index 38edfc39..587e0782 100644 --- a/sepolicy/vendor/hal_camera.te +++ b/sepolicy/vendor/hal_camera.te @@ -1,7 +1,7 @@ # communicate with perfd -allow hal_camera perfd:unix_stream_socket connectto; -allow hal_camera perfd_socket:sock_file write; -allow hal_camera perfd_socket:sock_file w_file_perms; +dontaudit hal_camera perfd:unix_stream_socket connectto; +dontaudit hal_camera perfd_socket:sock_file write; +dontaudit hal_camera perfd_socket:sock_file w_file_perms; allow hal_camera self:capability sys_nice; diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te index b588634b..3794e32b 100644 --- a/sepolicy/vendor/hal_power_default.te +++ b/sepolicy/vendor/hal_power_default.te @@ -1,6 +1,3 @@ -allow hal_power_default perfd:unix_stream_socket connectto; -allow hal_power_default perfd_socket:sock_file write; - allow hal_power_default sysfs_graphics:dir search; allow hal_power_default sysfs_graphics:file r_file_perms; @@ -8,3 +5,9 @@ allow hal_power_default debugfs_rpm:file r_file_perms; allow hal_power_default debugfs_wlan:dir r_dir_perms; allow hal_power_default debugfs_wlan:file r_file_perms; + +# To do powerhint on nodes defined in powerhint.json +allow hal_power_default sysfs_msm_subsys:dir search; +allow hal_power_default sysfs_msm_subsys:file w_file_perms; +allow hal_power_default sysfs_devices_system_cpu:file w_file_perms; +allow hal_power_default latency_device:chr_file w_file_perms; diff --git a/sepolicy/vendor/perfd.te b/sepolicy/vendor/perfd.te index fa99d156..950e1d65 100644 --- a/sepolicy/vendor/perfd.te +++ b/sepolicy/vendor/perfd.te @@ -2,31 +2,3 @@ type perfd, domain; type perfd_exec, exec_type, vendor_file_type, file_type; init_daemon_domain(perfd) - -r_dir_file(perfd, sysfs_msm_subsys) - -# perfd uses kill(pid, 0) to determine if a process exists. -# Determining if a process exists does not require the kill capability -# since a permission denied indicates the process exists. -dontaudit perfd self:capability kill; - -allow perfd mediacodec:process signull; -allow perfd hal_power_default:process signull; - -allow perfd cgroup:file r_file_perms; -allow perfd post_boot_prop:file r_file_perms; - -allow perfd proc:file rw_file_perms; -allow perfd sysfs_clkscale:file r_file_perms; -allow perfd sysfs_graphics:dir search; -allow perfd sysfs_graphics:file r_file_perms; -allow perfd sysfs_soc:dir search; -allow perfd sysfs_soc:file r_file_perms; -allow perfd sysfs_graphics:dir search; -allow perfd sysfs_graphics:file r_file_perms; -allow perfd sysfs_msm_subsys:file w_file_perms; -allow perfd sysfs_devices_system_cpu:file w_file_perms; - -allow perfd perfd_socket:sock_file write; - -allow perfd latency_device:chr_file w_file_perms; From 4a56f1b85a0711e5099caabb0d279b3bd04c773e Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 4 Jan 2018 22:30:07 -0800 Subject: [PATCH 099/300] wahoo: power: change node owner early to reduce permission denial log spam PowerHAL (started in class hal) will try to reset nodes to their initial values, however the node permission is granted only upon boot_complete which leads some permission log spam. This CL is to address the logspam. Test: boot and do powerhint Bug: 62041945 Change-Id: I35ad8dfe23f35c829f50479ca951445afeb46b87 --- init.hardware.rc | 15 ++++++++------- power-libperfmgr/Power.cpp | 4 ++++ powerhint.json | 9 +++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 571eb081..c55f139e 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -385,6 +385,14 @@ on zygote-start # b/62837579 elabel directory mkdir /data/misc/elabel 0700 system system + # Setup permission for powerHAL + chown system system /dev/stune/top-app/schedtune.boost + chown system system /dev/cpu_dma_latency + chown system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq + chown system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq + chown system system /sys/class/devfreq/soc:qcom,gpubw/min_freq + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq + on early-boot # wait for devices wait_for_prop sys.qcom.devup 1 @@ -549,16 +557,9 @@ service vendor.per_proxy /vendor/bin/pm-proxy on property:sys.post_boot.parsed=1 # Setup permission for powerHAL - chown system system /dev/stune/top-app/schedtune.boost - chown system system /dev/cpu_dma_latency - chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq - chown system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq - chown system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq - chown system system /sys/class/devfreq/soc:qcom,gpubw/min_freq chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_trigger_count chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length - chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq on property:sys.boot_completed=1 # Enable power setting and set sys.post_boot.parsed to 1 diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index 50608d52..fe60a599 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -91,6 +91,7 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { break; case PowerHint_1_0::SUSTAINED_PERFORMANCE: if (data && !mSustainedPerfModeOn) { + ALOGD("SUSTAINED_PERFORMANCE ON"); if (!mVRModeOn) { // Sustained mode only. mHintManager->DoHint("SUSTAINED_PERFORMANCE"); } else { // Sustained + VR mode. @@ -99,6 +100,7 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { } mSustainedPerfModeOn = true; } else if (!data && mSustainedPerfModeOn) { + ALOGD("SUSTAINED_PERFORMANCE OFF"); mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE"); mHintManager->EndHint("SUSTAINED_PERFORMANCE"); if (mVRModeOn) { // Switch back to VR Mode. @@ -109,6 +111,7 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { break; case PowerHint_1_0::VR_MODE: if (data && !mVRModeOn) { + ALOGD("VR_MODE ON"); if (!mSustainedPerfModeOn) { // VR mode only. mHintManager->DoHint("VR_MODE"); } else { // Sustained + VR mode. @@ -117,6 +120,7 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { } mVRModeOn = true; } else if (!data && mVRModeOn) { + ALOGD("VR_MODE OFF"); mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE"); mHintManager->EndHint("VR_MODE"); if (mSustainedPerfModeOn) { // Switch back to sustained Mode. diff --git a/powerhint.json b/powerhint.json index b641df33..cf45abc5 100755 --- a/powerhint.json +++ b/powerhint.json @@ -96,8 +96,7 @@ "Values": [ "0", "3" - ], - "ResetOnInit": true + ] }, { "Name": "CPUBWHistMemory", @@ -105,8 +104,7 @@ "Values": [ "0", "20" - ], - "ResetOnInit": true + ] }, { "Name": "CPUBWHystLength", @@ -114,8 +112,7 @@ "Values": [ "0", "10" - ], - "ResetOnInit": true + ] }, { "Name": "CPUBWMinFreq", From 359818ed2787b0757d1d98c1c734de502283d788 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 5 Jan 2018 17:24:09 -0700 Subject: [PATCH 100/300] Reserve 128MB for critical system components. We recently created a new GID that can be granted to critical system processes, so that the system is usable enough for the user to free up disk space used by abusive apps. 128MB ought to be enough for anybody. Test: builds, boots Bug: 62024591 Change-Id: I54bfde3fb1a198f6f6c0e03c4bf21e48324ed8fc --- fstab.hardware | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fstab.hardware b/fstab.hardware index 7d1e9ac0..d2fc516f 100644 --- a/fstab.hardware +++ b/fstab.hardware @@ -2,7 +2,7 @@ # /dev/block/platform/soc/1da4000.ufshc/by-name/system / ext4 ro,barrier=1 wait,slotselect,avb -/dev/block/platform/soc/1da4000.ufshc/by-name/userdata /data ext4 errors=panic,noatime,nosuid,nodev,barrier=1,noauto_da_alloc latemount,wait,check,formattable,fileencryption=ice:aes-256-heh,eraseblk=16777216,logicalblk=4096,quota +/dev/block/platform/soc/1da4000.ufshc/by-name/userdata /data ext4 errors=panic,noatime,nosuid,nodev,barrier=1,noauto_da_alloc latemount,wait,check,formattable,fileencryption=ice:aes-256-heh,eraseblk=16777216,logicalblk=4096,quota,reservedsize=128M /dev/block/platform/soc/1da4000.ufshc/by-name/misc /misc emmc defaults defaults /dev/block/platform/soc/1da4000.ufshc/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect /devices/soc/a800000.ssusb/a800000.dwc3* auto vfat defaults voldmanaged=usb:auto From 4c69ba7dda465f546a047e0938c0abee78d45c6d Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 5 Jan 2018 20:12:10 -0800 Subject: [PATCH 101/300] wahoo: power: add atrace into powerhint calls and improve camera powerhint 1) Add atrace into powerhint calls 2) Release encoder hint when placing camera and launch hint Video Encode hint caps Big Cluster to 1.9G, so it will stop camera and launch hints setting Big Cluster minfreq node to Max. If Video Encode hint is on, this CL will cancel it first and recover it after camera/launch hints end. Test: launch camera on walleye Bug: 62041945 Change-Id: Ib278bdc55f58d5be9b2b4c2996c468bff5d71fbb --- power-libperfmgr/Power.cpp | 57 +++++++++++++++++++++++++++++++++++++- power-libperfmgr/Power.h | 4 ++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index fe60a599..0b05518f 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL) #define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr" #include @@ -21,9 +22,9 @@ #include #include #include +#include #include "Power.h" - #include "power-helper.h" /* RPM runs at 19.2Mhz. Divide by 19200 for msec */ @@ -74,20 +75,24 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { } break; case PowerHint_1_0::VIDEO_ENCODE: + ATRACE_BEGIN("video_encode"); if (mVRModeOn || mSustainedPerfModeOn) { ALOGV("%s: ignoring due to other active perf hints", __func__); } else { if (data) { // Hint until canceled + ATRACE_INT("video_encode_lock", 1); mHintManager->DoHint("VIDEO_ENCODE"); ALOGD("VIDEO_ENCODE ON"); mEncoderModeOn = true; } else { + ATRACE_INT("video_encode_lock", 0); mHintManager->EndHint("VIDEO_ENCODE"); ALOGD("VIDEO_ENCODE OFF"); mEncoderModeOn = false; } } + ATRACE_END(); break; case PowerHint_1_0::SUSTAINED_PERFORMANCE: if (data && !mSustainedPerfModeOn) { @@ -130,18 +135,28 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { } break; case PowerHint_1_0::LAUNCH: + ATRACE_BEGIN("launch"); if (mVRModeOn || mSustainedPerfModeOn) { ALOGV("%s: ignoring due to other active perf hints", __func__); } else { if (data) { // Hint until canceled + ATRACE_INT("launch_lock", 1); + if (mEncoderModeOn) { + mHintManager->EndHint("VIDEO_ENCODE"); + } mHintManager->DoHint("LAUNCH"); ALOGD("LAUNCH ON"); } else { + ATRACE_INT("launch_lock", 0); mHintManager->EndHint("LAUNCH"); + if (mEncoderModeOn) { + mHintManager->DoHint("VIDEO_ENCODE"); + } ALOGD("LAUNCH OFF"); } } + ATRACE_END(); break; default: break; @@ -283,59 +298,99 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { switch(hint) { case PowerHint_1_2::AUDIO_LOW_LATENCY: + ATRACE_BEGIN("audio_low_latency"); if (data) { // Hint until canceled + ATRACE_INT("audio_low_latency_lock", 1); mHintManager->DoHint("AUDIO_LOW_LATENCY"); ALOGD("AUDIO LOW LATENCY ON"); } else { + ATRACE_INT("audio_low_latency_lock", 0); mHintManager->EndHint("AUDIO_LOW_LATENCY"); ALOGD("AUDIO LOW LATENCY OFF"); } + ATRACE_END(); break; case PowerHint_1_2::AUDIO_STREAMING: + ATRACE_BEGIN("audio_streaming"); if (data) { // Hint until canceled + ATRACE_INT("audio_streaming_lock", 1); mHintManager->DoHint("AUDIO_STREAMING"); ALOGD("AUDIO LOW LATENCY ON"); } else { + ATRACE_INT("audio_streaming_lock", 0); mHintManager->EndHint("AUDIO_STREAMING"); ALOGD("AUDIO LOW LATENCY OFF"); } + ATRACE_END(); break; case PowerHint_1_2::CAMERA_LAUNCH: + ATRACE_BEGIN("camera_launch"); if (data > 0) { + ATRACE_INT("camera_launch_lock", 1); + // If Encoder hint is on, cancel it first and do camera hint + if (mEncoderModeOn) { + mHintManager->EndHint("VIDEO_ENCODE"); + } mHintManager->DoHint("CAMERA_LAUNCH", std::chrono::milliseconds(data)); ALOGD("CAMERA LAUNCH ON: %d MS", data); // boosts 2.5s for launching mHintManager->DoHint("LAUNCH", std::chrono::milliseconds(2500)); } else if (data == 0) { + ATRACE_INT("camera_launch_lock", 0); mHintManager->EndHint("CAMERA_LAUNCH"); + // If Encoder hint is on, recover it + if (mEncoderModeOn) { + mHintManager->DoHint("VIDEO_ENCODE"); + } ALOGD("CAMERA LAUNCH OFF"); } else { ALOGE("CAMERA LAUNCH INVALID DATA: %d", data); } + ATRACE_END(); break; case PowerHint_1_2::CAMERA_STREAMING: + ATRACE_BEGIN("camera_streaming"); if (data > 0) { + ATRACE_INT("camera_streaming_lock", 1); + if (mEncoderModeOn) { + mHintManager->EndHint("VIDEO_ENCODE"); + } mHintManager->DoHint("CAMERA_STREAMING", std::chrono::milliseconds(data)); ALOGD("CAMERA STREAMING ON: %d MS", data); } else if (data == 0) { + ATRACE_INT("camera_streaming_lock", 0); mHintManager->EndHint("CAMERA_STREAMING"); + if (mEncoderModeOn) { + mHintManager->DoHint("VIDEO_ENCODE"); + } ALOGD("CAMERA STREAMING OFF"); } else { ALOGE("CAMERA STREAMING INVALID DATA: %d", data); } + ATRACE_END(); break; case PowerHint_1_2::CAMERA_SHOT: + ATRACE_BEGIN("camera_shot"); if (data > 0) { + ATRACE_INT("camera_shot_lock", 1); + if (mEncoderModeOn) { + mHintManager->EndHint("VIDEO_ENCODE"); + } mHintManager->DoHint("CAMERA_SHOT", std::chrono::milliseconds(data)); ALOGD("CAMERA SHOT ON: %d MS", data); } else if (data == 0) { + ATRACE_INT("camera_shot_lock", 0); mHintManager->EndHint("CAMERA_SHOT"); + if (mEncoderModeOn) { + mHintManager->DoHint("VIDEO_ENCODE"); + } ALOGD("CAMERA SHOT OFF"); } else { ALOGE("CAMERA SHOT INVALID DATA: %d", data); } + ATRACE_END(); break; default: return powerHint(static_cast(hint), data); diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h index 2d84fa57..30409708 100644 --- a/power-libperfmgr/Power.h +++ b/power-libperfmgr/Power.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "InteractionHandler.h" @@ -60,9 +61,10 @@ struct Power : public IPower { // Methods from ::android::hidl::base::V1_0::IBase follow. private: + static bool isSupportedGovernor(); + std::shared_ptr mHintManager; InteractionHandler mInteractionHandler; - static bool isSupportedGovernor(); std::atomic mVRModeOn; std::atomic mSustainedPerfModeOn; std::atomic mEncoderModeOn; From d78f9a1f87e608cd486be6231e25ae938796832c Mon Sep 17 00:00:00 2001 From: Jie Song Date: Mon, 8 Jan 2018 17:17:50 -0800 Subject: [PATCH 102/300] Fix directory permission issue for modem logging Bug: 71039120 Test: No permission issue after upgrade Change-Id: Ide29dc94babc9db97bb85e7a5388954677c2aa10 --- init.hardware.diag.rc.userdebug | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 5ccd4c5b..c0536379 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -21,6 +21,8 @@ on post-fs-data # Modem logging collection mkdir /data/vendor/radio 0777 radio radio mkdir /data/vendor/radio/diag_logs 0777 system system + chmod 777 /data/vendor/radio/diag_logs/cfg + chmod 777 /data/vendor/radio/diag_logs/custom_cfg # WLAN logging collection mkdir /data/vendor/wifi 0777 system system mkdir /data/vendor/wifi/cnss_diag 0777 system system From 908a39eb89183bd813dc97a963dd7105ddda057c Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Mon, 8 Jan 2018 19:05:06 -0800 Subject: [PATCH 103/300] Make zram swap mounting conditional on persist.sys.zram_enabled Test: manual Change-Id: Id0f73f9516e0b7858a96bd150a8474e51e0cf741 --- device.mk | 5 +++++ init.hardware.rc | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/device.mk b/device.mk index bd629ff4..c1a8cfd6 100755 --- a/device.mk +++ b/device.mk @@ -238,6 +238,11 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.radio.snapshot_enabled=0 \ persist.radio.snapshot_timer=0 +# By default, enable zram; experiment can toggle the flag, +# which takes effect on boot +PRODUCT_PROPERTY_OVERRIDES += \ + persist.sys.zram_enabled=1 + PRODUCT_PROPERTY_OVERRIDES += \ ro.vendor.extension_library=libqti-perfd-client.so diff --git a/init.hardware.rc b/init.hardware.rc index 6063c3fa..e5c9d091 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -571,9 +571,6 @@ on property:sys.boot_completed=1 write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1 write /sys/module/lpm_levels/parameters/sleep_disabled N - # Enable ZRAM on boot_complete - swapon_all /vendor/etc/fstab.${ro.hardware} - # Setup final cpuset write /dev/cpuset/top-app/cpus 0-7 write /dev/cpuset/foreground/cpus 0-3,6-7 @@ -602,6 +599,15 @@ on property:sys.boot_completed=1 chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats + trigger sys-boot-completed-set + +# We want one opportunity per boot to enable zram, so we +# use a trigger we fire from the above stanza. If +# persist.sys.zram_enabled becomes true after boot, +# we don't want to run swapon_all at that time. +on sys-boot-completed-set && property:persist.sys.zram_enabled=1 + swapon_all /vendor/etc/fstab.${ro.hardware} + on property:init.svc.vendor.per_mgr=running start vendor.per_proxy From 1c36565762cbd478e7faf1e16b05f45b4b7a412f Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 8 Jan 2018 23:25:05 -0800 Subject: [PATCH 104/300] wahoo: power: Add hint state into PowerHAL in case of restart PowerHAL should remember the long-lasting hint when it (re)starts, in case it crashed/killed. Also when clint crashed, the long-lasting hint should be cancelled. This CL adds a property for PowerHAL to store its long-lasting hint, and uses init to clear the property and restart PowerHAL when client died. Bug: 67648152 Test: kill cameraHAL, powerHAL, system-server Change-Id: I6b2cae3c2228da00bcb97a3befacf9ab045eeba8 --- power-libperfmgr/Power.cpp | 55 +++++++++++++++++++ power-libperfmgr/Power.h | 2 + ...ware.power@1.2-service.wahoo-libperfmgr.rc | 10 ++++ power-libperfmgr/service.cpp | 22 +++----- sepolicy/vendor/hal_power_default.te | 3 + sepolicy/vendor/property.te | 1 + sepolicy/vendor/property_contexts | 1 + 7 files changed, 79 insertions(+), 15 deletions(-) diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index 0b05518f..6d4e374d 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -54,6 +54,29 @@ Power::Power() : mSustainedPerfModeOn(false), mEncoderModeOn(false) { mInteractionHandler.Init(); + + std::string state = android::base::GetProperty(kPowerHalStateProp, ""); + if (state == "VIDEO_ENCODE") { + ALOGI("Initialize with VIDEO_ENCODE on"); + mHintManager->DoHint("VIDEO_ENCODE"); + mEncoderModeOn = true; + } else if (state == "SUSTAINED_PERFORMANCE") { + ALOGI("Initialize with SUSTAINED_PERFORMANCE on"); + mHintManager->DoHint("SUSTAINED_PERFORMANCE"); + mSustainedPerfModeOn = true; + } else if (state == "VR_MODE") { + ALOGI("Initialize with VR_MODE on"); + mHintManager->DoHint("VR_MODE"); + mVRModeOn = true; + } else if (state == "VR_SUSTAINED_PERFORMANCE") { + ALOGI("Initialize with SUSTAINED_PERFORMANCE and VR_MODE on"); + mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE"); + mSustainedPerfModeOn = true; + mVRModeOn = true; + } else { + ALOGI("Initialize with default setting"); + } + } // Methods from ::android::hardware::power::V1_0::IPower follow. @@ -84,11 +107,17 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { ATRACE_INT("video_encode_lock", 1); mHintManager->DoHint("VIDEO_ENCODE"); ALOGD("VIDEO_ENCODE ON"); + if (!android::base::SetProperty(kPowerHalStateProp, "VIDEO_ENCODE")) { + ALOGE("%s: could not set powerHAL state property to VIDEO_ENCODE", __func__); + } mEncoderModeOn = true; } else { ATRACE_INT("video_encode_lock", 0); mHintManager->EndHint("VIDEO_ENCODE"); ALOGD("VIDEO_ENCODE OFF"); + if (!android::base::SetProperty(kPowerHalStateProp, "")) { + ALOGE("%s: could not clear powerHAL state property", __func__); + } mEncoderModeOn = false; } } @@ -99,9 +128,15 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { ALOGD("SUSTAINED_PERFORMANCE ON"); if (!mVRModeOn) { // Sustained mode only. mHintManager->DoHint("SUSTAINED_PERFORMANCE"); + if (!android::base::SetProperty(kPowerHalStateProp, "SUSTAINED_PERFORMANCE")) { + ALOGE("%s: could not set powerHAL state property to SUSTAINED_PERFORMANCE", __func__); + } } else { // Sustained + VR mode. mHintManager->EndHint("VR_MODE"); mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE"); + if (!android::base::SetProperty(kPowerHalStateProp, "VR_SUSTAINED_PERFORMANCE")) { + ALOGE("%s: could not set powerHAL state property to VR_SUSTAINED_PERFORMANCE", __func__); + } } mSustainedPerfModeOn = true; } else if (!data && mSustainedPerfModeOn) { @@ -110,6 +145,13 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { mHintManager->EndHint("SUSTAINED_PERFORMANCE"); if (mVRModeOn) { // Switch back to VR Mode. mHintManager->DoHint("VR_MODE"); + if (!android::base::SetProperty(kPowerHalStateProp, "VR_MODE")) { + ALOGE("%s: could not set powerHAL state property to VR_MODE", __func__); + } + } else { + if (!android::base::SetProperty(kPowerHalStateProp, "")) { + ALOGE("%s: could not clear powerHAL state property", __func__); + } } mSustainedPerfModeOn = false; } @@ -119,9 +161,15 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { ALOGD("VR_MODE ON"); if (!mSustainedPerfModeOn) { // VR mode only. mHintManager->DoHint("VR_MODE"); + if (!android::base::SetProperty(kPowerHalStateProp, "VR_MODE")) { + ALOGE("%s: could not set powerHAL state property to VR_MODE", __func__); + } } else { // Sustained + VR mode. mHintManager->EndHint("SUSTAINED_PERFORMANCE"); mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE"); + if (!android::base::SetProperty(kPowerHalStateProp, "VR_SUSTAINED_PERFORMANCE")) { + ALOGE("%s: could not set powerHAL state property to VR_SUSTAINED_PERFORMANCE", __func__); + } } mVRModeOn = true; } else if (!data && mVRModeOn) { @@ -130,6 +178,13 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { mHintManager->EndHint("VR_MODE"); if (mSustainedPerfModeOn) { // Switch back to sustained Mode. mHintManager->DoHint("SUSTAINED_PERFORMANCE"); + if (!android::base::SetProperty(kPowerHalStateProp, "SUSTAINED_PERFORMANCE")) { + ALOGE("%s: could not set powerHAL state property to SUSTAINED_PERFORMANCE", __func__); + } + } else { + if (!android::base::SetProperty(kPowerHalStateProp, "")) { + ALOGE("%s: could not clear powerHAL state property", __func__); + } } mVRModeOn = false; } diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h index 30409708..1b301c8c 100644 --- a/power-libperfmgr/Power.h +++ b/power-libperfmgr/Power.h @@ -41,6 +41,8 @@ using PowerHint_1_0 = ::android::hardware::power::V1_0::PowerHint; using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint; using ::android::perfmgr::HintManager; +constexpr char kPowerHalStateProp[] = "vendor.powerhal.state"; + struct Power : public IPower { // Methods from ::android::hardware::power::V1_0::IPower follow. diff --git a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc index 65c43b67..06df36ab 100644 --- a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc +++ b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc @@ -2,3 +2,13 @@ service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.w class hal user system group system + +# restart powerHAL when framework died +on property:init.svc.zygote=restarting + setprop vendor.powerhal.state 0 + restart vendor.power-hal-1-2 + +# restart powerHAL when cameraHAL died +on property:init.svc.vendor.camera-provider-2-4=restarting && property:vendor.powerhal.state=VIDEO_ENCODE + setprop vendor.powerhal.state 0 + restart vendor.power-hal-1-2 diff --git a/power-libperfmgr/service.cpp b/power-libperfmgr/service.cpp index 77fb1390..c128f95d 100644 --- a/power-libperfmgr/service.cpp +++ b/power-libperfmgr/service.cpp @@ -33,35 +33,27 @@ using android::hardware::joinRpcThreadpool; using android::hardware::power::V1_2::IPower; using android::hardware::power::V1_2::implementation::Power; -int main() { +int main(int /* argc */, char** /* argv */) { + ALOGI("Power HAL Service 1.2 for Wahoo is starting"); - status_t status; - android::sp service = nullptr; - - ALOGI("Power HAL Service 1.2 for Wahoo is starting."); - - service = new Power(); + android::sp service = new Power(); if (service == nullptr) { ALOGE("Can not create an instance of Power HAL Iface, exiting."); - - goto shutdown; + return 1; } configureRpcThreadpool(1, true /*callerWillJoin*/); - status = service->registerAsService(); + status_t status = service->registerAsService(); if (status != OK) { - ALOGE("Could not register service for Power HAL Iface (%d).", status); - goto shutdown; + ALOGE("Could not register service for Power HAL Iface (%d), exiting.", status); + return 1; } ALOGI("Power Service is ready"); joinRpcThreadpool(); - //Should not pass this line -shutdown: // In normal operation, we don't expect the thread pool to exit - ALOGE("Power Service is shutting down"); return 1; } diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te index 3794e32b..48009432 100644 --- a/sepolicy/vendor/hal_power_default.te +++ b/sepolicy/vendor/hal_power_default.te @@ -11,3 +11,6 @@ allow hal_power_default sysfs_msm_subsys:dir search; allow hal_power_default sysfs_msm_subsys:file w_file_perms; allow hal_power_default sysfs_devices_system_cpu:file w_file_perms; allow hal_power_default latency_device:chr_file w_file_perms; + +# To get/set powerhal state property +set_prop(hal_power_default, power_prop) diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index 9f38fab0..30822410 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -15,3 +15,4 @@ type tel_mon_prop, property_type; type sys_time_prop, property_type; type atfwd_start_prop, property_type; type bluetooth_log_prop, property_type; +type power_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index d698bf31..bce1fda4 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -24,3 +24,4 @@ persist.radio.enable_tel_mon u:object_r:tel_mon_prop:s0 sys.time.set u:object_r:sys_time_prop:s0 persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 +vendor.powerhal.state u:object_r:power_prop:s0 From 252f00b4aff279aee53e1b633b84e3646606834f Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Fri, 22 Dec 2017 15:17:15 -0800 Subject: [PATCH 105/300] hostapd: Remove treble violation exception Bug: 36646171 Test: Device boots up and able to turn on SoftAp. Change-Id: I8a826d944fc25b08aa9e919ff95f20e34c13346a --- sepolicy/vendor/hostapd.te | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 sepolicy/vendor/hostapd.te diff --git a/sepolicy/vendor/hostapd.te b/sepolicy/vendor/hostapd.te deleted file mode 100644 index 86b985ae..00000000 --- a/sepolicy/vendor/hostapd.te +++ /dev/null @@ -1,11 +0,0 @@ -# TODO(b/36657258): Remove data_between_core_and_vendor_violators once -# hostapd no longer directly accesses /data outside /data/vendor. -typeattribute hostapd data_between_core_and_vendor_violators; -# hostapd can read and write WiFi related data and configuration. -allow hostapd wifi_data_file:file rw_file_perms; -r_dir_file(hostapd, wifi_data_file) - -# hostapd wants to create the directory holding its control socket. -allow hostapd hostapd_socket:dir create_dir_perms; -# hostapd needs to create, bind to, read, and write its control socket. -allow hostapd hostapd_socket:sock_file create_file_perms; From a743f9162386b4c8a28bfce71a60130f63d39d1e Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 27 Dec 2017 15:33:53 -0800 Subject: [PATCH 106/300] wahoo(manifest): Add hostapd HIDL interface Bug: 36646171 Test: Manual softap toggle Change-Id: Ia7ef8bf3da8adc3491c4dac4096e4297cbd5bf5b --- manifest.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manifest.xml b/manifest.xml index 83b24592..640ce9c8 100644 --- a/manifest.xml +++ b/manifest.xml @@ -355,6 +355,15 @@ default + + android.hardware.wifi.hostapd + hwbinder + 1.0 + + IHostapd + default + + android.hardware.wifi.supplicant hwbinder From 7a37d573638459c382783f8447123a9dd7a3197d Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 4 Jan 2018 16:03:48 -0800 Subject: [PATCH 107/300] wahoo(sepolicy): Redefine cnss_diag folder The parent folder /data/vendor/wifi of cnss diag is going to be used by hostapd data file storage. So, rename sepolicy file attribute to limit the path controlled by the cnss_vendor_data_file attribute. Bug: Start softap Test: Compiles Change-Id: I0001199864fed580983f8340645f36fd4e2f69ef --- sepolicy/vendor/file_contexts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 11839321..97014c68 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -248,7 +248,7 @@ /data/vendor/display(/.*)? u:object_r:display_vendor_data_file:s0 /data/vendor/nfc(/.*)? u:object_r:nfc_vendor_data_file:s0 /data/vendor/radio(/.*)? u:object_r:radio_vendor_data_file:s0 -/data/vendor/wifi(/.*)? u:object_r:cnss_vendor_data_file:s0 +/data/vendor/wifi/cnss_diag(/.*)? u:object_r:cnss_vendor_data_file:s0 /data/vendor/ramdump(/.*)? u:object_r:ramdump_vendor_data_file:s0 /data/vendor/ssrdump(/.*)? u:object_r:ramdump_vendor_data_file:s0 /data/vendor/modem_dump(/.*)? u:object_r:modem_dump_file:s0 From 763e14d06a1b995b352d48d7d28c43ef52e4a1c3 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Tue, 9 Jan 2018 13:28:41 -0800 Subject: [PATCH 108/300] wahoo: power: set cpufreq max first There is a small chance that canceling Encode hint and enabling launch at the same time. In this case, CPU max is capped so it need to be updated first. This CL will make PowerHAL updates max node first, in favor of boosting hints, such as launch, camera shot and etc. When these boost hints end, the performance limiting (power conserving) hint such as encode hint could fail to set at the beginning but will succeed in the second try in 500ms. Also change the rc file to let init do not restart PowerHAL when framework died and there is no active long-lasting hint. Bug: 67648152 Bug: 62041945 Test: launch camera Test: kill cameraHAL, powerHAL, system-server Change-Id: I4a9d8d395dea9f42cf6659c86635852f332f7617 --- ...ware.power@1.2-service.wahoo-libperfmgr.rc | 6 +-- powerhint.json | 52 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc index 06df36ab..79ebf7af 100644 --- a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc +++ b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc @@ -4,11 +4,11 @@ service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.w group system # restart powerHAL when framework died -on property:init.svc.zygote=restarting - setprop vendor.powerhal.state 0 +on property:init.svc.zygote=restarting && property:vendor.powerhal.state=* + setprop vendor.powerhal.state "" restart vendor.power-hal-1-2 # restart powerHAL when cameraHAL died on property:init.svc.vendor.camera-provider-2-4=restarting && property:vendor.powerhal.state=VIDEO_ENCODE - setprop vendor.powerhal.state 0 + setprop vendor.powerhal.state "" restart vendor.power-hal-1-2 diff --git a/powerhint.json b/powerhint.json index cf45abc5..54885e2e 100755 --- a/powerhint.json +++ b/powerhint.json @@ -1,18 +1,5 @@ { "Nodes": [ - { - "Name": "CPULittleClusterMinFreq", - "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", - "Values": [ - "1900800", - "1555200", - "1512000", - "1478400", - "1134000", - "384000" - ], - "ResetOnInit": true - }, { "Name": "CPULittleClusterMaxFreq", "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", @@ -25,15 +12,15 @@ "ResetOnInit": true }, { - "Name": "CPUBigClusterMinFreq", - "Path": "/sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq", + "Name": "CPULittleClusterMinFreq", + "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", "Values": [ - "2457600", - "1574400", - "1420800", - "1344000", - "1132800", - "300000" + "1900800", + "1555200", + "1512000", + "1478400", + "1134000", + "384000" ], "ResetOnInit": true }, @@ -51,12 +38,15 @@ "ResetOnInit": true }, { - "Name": "GPUMinFreq", - "Path": "/sys/class/kgsl/kgsl-3d0/devfreq/min_freq", + "Name": "CPUBigClusterMinFreq", + "Path": "/sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq", "Values": [ - "515000000", - "414000000", - "257000000" + "2457600", + "1574400", + "1420800", + "1344000", + "1132800", + "300000" ], "ResetOnInit": true }, @@ -71,6 +61,16 @@ ], "ResetOnInit": true }, + { + "Name": "GPUMinFreq", + "Path": "/sys/class/kgsl/kgsl-3d0/devfreq/min_freq", + "Values": [ + "515000000", + "414000000", + "257000000" + ], + "ResetOnInit": true + }, { "Name": "GPUBusMinFreq", "Path": "/sys/class/devfreq/soc:qcom,gpubw/min_freq", From bb267fa16f8a1a13283575a4e89b880cd44a00b2 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Thu, 14 Dec 2017 12:23:05 -0800 Subject: [PATCH 109/300] STOPSHIP: sys.vdso reflector for experiments On userdebug or eng, permit vdso to be enabled or disabled at will to manage performance experiments on the dogfood population. ro.debuggable=1 -> permit sys.vdso to maintain an influence over vdso sys.vdso=false -> 32 and 64 bit vdso disabled sys.vdso=32 -> 64 bit vdso disabled sys.vdso=64 -> 32 bit vdso disabled sys.vdso= -> 32 and 64 bit vdso enabled NB: sys.vdso set to any other value will default to vdso enabled. Test: manual, bionic-benchmarks --bionic_xml=vdso.xml to confirm. Bug: 70518189 Change-Id: I839feff206a1404f228a5bdf35fb0c392fd8974a --- init.hardware.diag.rc.userdebug | 15 +++++++++++++++ sepolicy/vendor/file.te | 2 ++ sepolicy/vendor/file_contexts | 3 +++ sepolicy/vendor/init.te | 5 +++++ 4 files changed, 25 insertions(+) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index c0536379..0366ee48 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -401,3 +401,18 @@ on property:persist.bluetooth.btsnoopenable=true on property:persist.bluetooth.btsnoopenable=false setprop persist.service.bdroid.soclog false + +# b/70518189 vDSO experiments +on property:sys.vdso=* + write /sys/module/vdso/parameters/enable_32 1 + write /sys/module/vdso/parameters/enable_64 1 + +on property:sys.vdso=false + write /sys/module/vdso/parameters/enable_32 0 + write /sys/module/vdso/parameters/enable_64 0 + +on property:sys.vdso=64 + write /sys/module/vdso/parameters/enable_32 0 + +on property:sys.vdso=32 + write /sys/module/vdso/parameters/enable_64 0 diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 118fbd16..f503f7a5 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -15,6 +15,8 @@ type sysfs_timestamp_switch, sysfs_type, fs_type; type sysfs_touch, sysfs_type, fs_type; type sysfs_usb_c, sysfs_type, fs_type; type sysfs_usb_device, sysfs_type, fs_type; +# b/70518189 vDSO experiments +type sysfs_vdso, fs_type, sysfs_type; type debugfs_clk, debugfs_type, fs_type; type debugfs_ion, debugfs_type, fs_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 11839321..26078d08 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -282,3 +282,6 @@ /metadata u:object_r:rootfs:s0 /metadata/.* u:object_r:vold_data_file:s0 + +# b/70518189 vDSO experiments +/sys/module/vdso/parameters u:object_r:sysfs_vdso:s0 diff --git a/sepolicy/vendor/init.te b/sepolicy/vendor/init.te index fe41cf49..5a8db16a 100644 --- a/sepolicy/vendor/init.te +++ b/sepolicy/vendor/init.te @@ -15,3 +15,8 @@ allow init boot_block_device:lnk_file relabelto; allow init persist_block_device:lnk_file relabelto; dontaudit init kernel:system module_request; + +# b/70518189 vDSO experiments +userdebug_or_eng(` +allow init sysfs_vdso:file w_file_perms; +') From 86815f4889cb100a8cace63829e697a3e7c8eba8 Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Tue, 2 Jan 2018 16:01:56 -0800 Subject: [PATCH 110/300] enable power anomaly detection Move connectivity monitor sepolicies to specific policy file Allow Power Anomaly detector to access /data/vendor/radio Fixes below errors 12-28 18:01:37.294 W/ectivitymonitor( 3619): type=1400 audit(0.0:13): avc: denied { search } for name="radio" dev="sda13" ino=1835015 scontext=u:r:radio:s0 tcontext=u:object_r:radio_vendor_data_file:s0 tclass=dir permissive=0 12-28 18:15:03.838 W/ectivitymonitor( 3621): type=1400 audit(0.0:18): avc: denied { read } for name="u:object_r:tel_mon_prop:s0" dev="tmpfs" ino=9592 scontext=u:r:con_monitor_app:s0:c233,c259,c512,c768 tcontext=u:object_r:tel_mon_prop:s0 tclass=file permissive=0 01-10 19:38:17.399 939 939 W rild : type=1400 audit(0.0:87): avc: denied { read } for name="u:object_r:tel_mon_prop:s0" dev="tmpfs" ino=17732 scontext=u:r:rild:s0 tcontext=u:object_r:tel_mon_prop:s0 tclass=file permissive= add power_anomaly_data.txt to be picked up in bugreport Test: tested by testing power anomaly detector and connectivity monitor Bug: 67058502 Change-Id: I8ad45d5e9cedde8f498627f97b35db27dfd2ea28 --- dumpstate/DumpstateDevice.cpp | 3 ++- sepolicy/vendor/con_monitor.te | 9 +++++++++ sepolicy/vendor/property_contexts | 1 + sepolicy/vendor/rild.te | 2 ++ sepolicy/vendor/seapp_contexts | 3 +++ 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 sepolicy/vendor/con_monitor.te diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 7b124351..363f3343 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -119,7 +119,8 @@ void DumpstateDevice::dumpModem(int fd, int fdModem) "/data/vendor/radio/ril_log", "/data/vendor/radio/ril_log_old", "/data/vendor/netmgr/netmgr_log", - "/data/vendor/netmgr/netmgr_log_old" + "/data/vendor/netmgr/netmgr_log_old", + "/data/vendor/radio/power_anomaly_data.txt" }; std::string modemLogMkDirCmd= "/vendor/bin/mkdir -p " + modemLogAllDir; diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te new file mode 100644 index 00000000..96483ac7 --- /dev/null +++ b/sepolicy/vendor/con_monitor.te @@ -0,0 +1,9 @@ +# ConnectivityMonitor app +type con_monitor_app, domain; + +app_domain(con_monitor_app) + +set_prop(con_monitor_app, tel_mon_prop) +allow con_monitor_app app_api_service:service_manager find; +allow con_monitor_app radio_vendor_data_file:dir rw_dir_perms; +allow con_monitor_app radio_vendor_data_file:file create_file_perms; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index d698bf31..75dd20a9 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -21,6 +21,7 @@ ctl.vendor.thermal-engine u:object_r:thermal_prop:s0 persist.sys.modem.diag. u:object_r:modem_diag_prop:s0 sys.modem.diag. u:object_r:modem_diag_prop:s0 persist.radio.enable_tel_mon u:object_r:tel_mon_prop:s0 +persist.radio.poweranomaly.start u:object_r:tel_mon_prop:s0 sys.time.set u:object_r:sys_time_prop:s0 persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te index 65768b70..36470144 100644 --- a/sepolicy/vendor/rild.te +++ b/sepolicy/vendor/rild.te @@ -27,3 +27,5 @@ dontaudit rild diag_device:chr_file rw_file_perms; allow rild radio_vendor_data_file:dir rw_dir_perms; allow rild radio_vendor_data_file:file create_file_perms; + +get_prop(rild, tel_mon_prop) diff --git a/sepolicy/vendor/seapp_contexts b/sepolicy/vendor/seapp_contexts index a48857e9..6d17cf73 100644 --- a/sepolicy/vendor/seapp_contexts +++ b/sepolicy/vendor/seapp_contexts @@ -24,3 +24,6 @@ user=_app seinfo=platform name=com.qualcomm.timeservice domain=timeservice_app t # Domain for easelservice app user=_app seinfo=easel name=com.google.android.imaging.easel.service domain=easelservice_app type=app_data_file levelFrom=user + +#Domain for connectivity monitor +user=radio seinfo=platform name=com.google.android.connectivitymonitor domain=con_monitor_app type=app_data_file levelFrom=all From f4494825c5fc75203d3a55d5e58110dfd43c1033 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Thu, 21 Dec 2017 14:48:50 -0800 Subject: [PATCH 111/300] system_executes_vendor_violators: google_camera_app and tango_core Bug: 62041836 Test: policy builds No rules were added to google_camera_app and tango_core domains Change-Id: Ib8605db10d28998ca564bf9f17a1a89a1b76d504 --- sepolicy/vendor/google_camera_app.te | 1 + sepolicy/vendor/tango_core.te | 1 + 2 files changed, 2 insertions(+) diff --git a/sepolicy/vendor/google_camera_app.te b/sepolicy/vendor/google_camera_app.te index 61928827..c6f2a2ea 100644 --- a/sepolicy/vendor/google_camera_app.te +++ b/sepolicy/vendor/google_camera_app.te @@ -1,4 +1,5 @@ type google_camera_app, domain, coredomain; +typeattribute google_camera_app system_executes_vendor_violators; app_domain(google_camera_app) net_domain(google_camera_app) diff --git a/sepolicy/vendor/tango_core.te b/sepolicy/vendor/tango_core.te index e72e3bcc..491abefa 100644 --- a/sepolicy/vendor/tango_core.te +++ b/sepolicy/vendor/tango_core.te @@ -1,4 +1,5 @@ type tango_core, domain, coredomain; +typeattribute tango_core system_executes_vendor_violators; app_domain(tango_core) #from system/sepolicy/private/untrusted_app.te From c5a707bc2f123958d4c0da42abb51ba6d90a0ce5 Mon Sep 17 00:00:00 2001 From: Hridya Valsaraju Date: Wed, 20 Dec 2017 12:49:01 -0800 Subject: [PATCH 112/300] Add health service for Wahoo Bug: 68388678 Test: vts-tradefed run vts -m VtsHalHealthV2_0 Change-Id: I37c2c66d26b1af04ccfedb59a24bb4e4aa492041 --- Android.bp | 7 - CleanSpec.mk | 5 + health/Android.bp | 49 +++++++ health/HealthService.cpp | 132 ++++++++++++++++++ health/HealthServiceCommon.cpp | 86 ++++++++++++ ...droid.hardware.health@2.0-service.wahoo.rc | 4 + 6 files changed, 276 insertions(+), 7 deletions(-) delete mode 100644 Android.bp create mode 100644 health/Android.bp create mode 100644 health/HealthService.cpp create mode 100644 health/HealthServiceCommon.cpp create mode 100644 health/android.hardware.health@2.0-service.wahoo.rc diff --git a/Android.bp b/Android.bp deleted file mode 100644 index 9f2d303a..00000000 --- a/Android.bp +++ /dev/null @@ -1,7 +0,0 @@ -subdirs = [ - "thermal", - "vr", - "vibrator", - "wifi_offload", - "usb", -] diff --git a/CleanSpec.mk b/CleanSpec.mk index c671d938..d581e373 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -156,3 +156,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.ther # Remove android.hardware.keymaster@4.0-service $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.keymaster@4.0-service) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.keymaster@4.0-service.rc) + +# Health HAL 2.0 +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.health@2.0-service) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.health@2.0-service.rc) + diff --git a/health/Android.bp b/health/Android.bp new file mode 100644 index 00000000..8d405542 --- /dev/null +++ b/health/Android.bp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +cc_binary { + name: "android.hardware.health@2.0-service.wahoo", + init_rc: ["android.hardware.health@2.0-service.wahoo.rc"], + proprietary: true, + relative_install_path: "hw", + srcs: [ + "HealthServiceCommon.cpp", + "HealthService.cpp", + ], + + cflags: [ + "-DHEALTH_INSTANCE_NAME=\"default\"", + "-Wall", + "-Werror", + ], + + static_libs: [ + "android.hardware.health@2.0-impl", + "android.hardware.health@1.0-convert", + "libbatterymonitor", + ], + + shared_libs: [ + "libbase", + "libcutils", + "libhidlbase", + "libhidltransport", + "libhwbinder", + "libutils", + "android.hardware.health@2.0", + ], + + header_libs: ["libhealthd_headers"], +} diff --git a/health/HealthService.cpp b/health/HealthService.cpp new file mode 100644 index 00000000..7072ff03 --- /dev/null +++ b/health/HealthService.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2018 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.health@2.0-service.wahoo" +#include + +#include +#include +#include + +#include +#include + +#include +#include + +using android::hardware::health::V2_0::StorageInfo; +using android::hardware::health::V2_0::DiskStats; + +void healthd_board_init(struct healthd_config*) { +} + +int healthd_board_battery_update(struct android::BatteryProperties*) { + return 0; +} + +const char kUFSHealthFile[] = "/sys/kernel/debug/ufshcd0/dump_health_desc"; +const char kUFSHealthVersionFile[] = "/sys/kernel/debug/ufshcd0/show_hba"; +const char kDiskStatsFile[] = "/sys/block/sda/stat"; +const char kUFSName[] = "UFS0"; + +/* + * Implementation based on system/core/storaged/storaged_info.cc + */ +void get_storage_info(std::vector& vec_storage_info) { + StorageInfo storage_info = {}; + std::string buffer, version; + + storage_info.attr.isInternal = true; + storage_info.attr.isBootDevice = true; + storage_info.attr.name = std::string(kUFSName); + + if (!android::base::ReadFileToString(std::string(kUFSHealthVersionFile), &version)) { + return; + } + + std::vector lines = android::base::Split(version, "\n"); + if (lines.empty()) { + return; + } + + char rev[8]; + if (sscanf(lines[6].c_str(), "hba->ufs_version = 0x%7s\n", rev) < 1) { + return; + } + + storage_info.version = "ufs " + std::string(rev); + + if (!android::base::ReadFileToString(std::string(kUFSHealthFile), &buffer)) { + return; + } + + lines = android::base::Split(buffer, "\n"); + if (lines.empty()) { + return; + } + + for (size_t i = 1; i < lines.size(); i++) { + char token[32]; + uint16_t val; + int ret; + if ((ret = sscanf(lines[i].c_str(), + "Health Descriptor[Byte offset 0x%*d]: %31s = 0x%hx", + token, &val)) < 2) { + continue; + } + + if (std::string(token) == "bPreEOLInfo") { + storage_info.eol = val; + } else if (std::string(token) == "bDeviceLifeTimeEstA") { + storage_info.lifetimeA = val; + } else if (std::string(token) == "bDeviceLifeTimeEstB") { + storage_info.lifetimeB = val; + } + } + + vec_storage_info.resize(1); + vec_storage_info[0] = storage_info; + return; +} + +/* + * Implementation based on parse_disk_stats() in system/core/storaged_diskstats.cpp + */ +void get_disk_stats(std::vector& vec_stats) { + const size_t kDiskStatsSize = 11; + struct DiskStats stats = {}; + + stats.attr.isInternal = true; + stats.attr.isBootDevice = true; + stats.attr.name = std::string(kUFSName); + + + std::string buffer; + if (!android::base::ReadFileToString(std::string(kDiskStatsFile), &buffer)) { + LOG(ERROR) << kDiskStatsFile << ": ReadFileToString failed."; + return; + } + + // Regular diskstats entries + std::stringstream ss(buffer); + for (uint i = 0; i < kDiskStatsSize; ++i) { + ss >> *(reinterpret_cast(&stats) + i); + } + vec_stats.resize(1); + vec_stats[0] = stats; + + return; +} + diff --git a/health/HealthServiceCommon.cpp b/health/HealthServiceCommon.cpp new file mode 100644 index 00000000..ece9fd1a --- /dev/null +++ b/health/HealthServiceCommon.cpp @@ -0,0 +1,86 @@ +/* + * Copyright 2018 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 "health@2.0/" HEALTH_INSTANCE_NAME +#include + +#include +#include +#include +#include +#include + +using android::hardware::IPCThreadState; +using android::hardware::configureRpcThreadpool; +using android::hardware::handleTransportPoll; +using android::hardware::setupTransportPolling; +using android::hardware::health::V1_0::HealthInfo; +using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo; +using android::hardware::health::V2_0::IHealth; +using android::hardware::health::V2_0::implementation::Health; + +extern int healthd_main(void); + +static int gBinderFd = -1; + +static void binder_event(uint32_t /*epevents*/) { + if (gBinderFd >= 0) handleTransportPoll(gBinderFd); +} + +void healthd_mode_service_2_0_init(struct healthd_config* config) { + LOG(INFO) << LOG_TAG << " Hal is starting up..."; + + gBinderFd = setupTransportPolling(); + + if (gBinderFd >= 0) { + if (healthd_register_event(gBinderFd, binder_event)) + LOG(ERROR) << LOG_TAG << ": Register for binder events failed"; + } + + android::sp service = Health::initInstance(config); + CHECK_EQ(service->registerAsService(HEALTH_INSTANCE_NAME), android::OK) + << LOG_TAG << ": Failed to register HAL"; + + LOG(INFO) << LOG_TAG << ": Hal init done"; +} + +int healthd_mode_service_2_0_preparetowait(void) { + IPCThreadState::self()->flushCommands(); + return -1; +} + +void healthd_mode_service_2_0_heartbeat(void) { + // noop +} + +void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* prop) { + HealthInfo info; + convertToHealthInfo(prop, info); + Health::getImplementation()->notifyListeners(info); +} + +static struct healthd_mode_ops healthd_mode_service_2_0_ops = { + .init = healthd_mode_service_2_0_init, + .preparetowait = healthd_mode_service_2_0_preparetowait, + .heartbeat = healthd_mode_service_2_0_heartbeat, + .battery_update = healthd_mode_service_2_0_battery_update, +}; + +int main() { + healthd_mode_ops = &healthd_mode_service_2_0_ops; + LOG(INFO) << LOG_TAG << ": Hal starting main loop..."; + return healthd_main(); +} diff --git a/health/android.hardware.health@2.0-service.wahoo.rc b/health/android.hardware.health@2.0-service.wahoo.rc new file mode 100644 index 00000000..2897b5e7 --- /dev/null +++ b/health/android.hardware.health@2.0-service.wahoo.rc @@ -0,0 +1,4 @@ +service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service.wahoo + class hal + user system + group system From dd69b2ca0c3fc466eaf8321b9f3fc48c66994515 Mon Sep 17 00:00:00 2001 From: Hridya Valsaraju Date: Wed, 20 Dec 2017 12:49:31 -0800 Subject: [PATCH 113/300] Create sepolicy for Wahoo health HAL service Bug: 68388678 Test: vts-tradefed run vts -m VtsHalHealthV2_0 Change-Id: I4d7214c760948bc07cfdf3143526d137718e4f9a --- device.mk | 2 +- sepolicy/vendor/file_contexts | 1 + sepolicy/vendor/hal_health_default.te | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/device.mk b/device.mk index bd629ff4..99c78fcf 100755 --- a/device.mk +++ b/device.mk @@ -176,7 +176,7 @@ PRODUCT_COPY_FILES += \ # health HAL PRODUCT_PACKAGES += \ - android.hardware.health@2.0-service + android.hardware.health@2.0-service.wahoo # Keymaster 4 (software only) PRODUCT_PACKAGES += \ diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 11839321..b529df96 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -183,6 +183,7 @@ /vendor/bin/hw/android\.hardware\.drm@1\.0-service.widevine u:object_r:hal_drm_widevine_exec:s0 /vendor/bin/hw/android\.hardware\.vibrator@1\.1-service.wahoo u:object_r:hal_vibrator_default_exec:s0 +/vendor/bin/hw/android\.hardware\.health@2\.0-service.wahoo u:object_r:hal_health_default_exec:s0 /vendor/bin/hw/android\.hardware\.keymaster@3\.0-service-qti u:object_r:hal_keymaster_qti_exec:s0 /vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service-qti u:object_r:hal_gatekeeper_qti_exec:s0 /vendor/bin/hw/android\.hardware\.gnss@1\.0-service-qti u:object_r:hal_gnss_qti_exec:s0 diff --git a/sepolicy/vendor/hal_health_default.te b/sepolicy/vendor/hal_health_default.te index ed6ab6ec..9f7f6815 100644 --- a/sepolicy/vendor/hal_health_default.te +++ b/sepolicy/vendor/hal_health_default.te @@ -1 +1,6 @@ r_dir_file(hal_health_default, sysfs_msm_subsys) + +allow hal_health_default debugfs_ufs:dir search; +allow hal_health_default sysfs_scsi_devices_0000:dir search; +allow hal_health_default debugfs_ufs:file { getattr open read }; +allow hal_health_default sysfs_scsi_devices_0000:file { getattr open read }; From da9a297f5073dba61a12498e84e8361b14e12292 Mon Sep 17 00:00:00 2001 From: Elisa Pascual Trevino Date: Thu, 11 Jan 2018 15:08:14 -0800 Subject: [PATCH 114/300] Update SVN to 7 for March 2018 Monthly Update Bug:71860241 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 61eb9719..9b93bd6e 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=6 + ro.vendor.build.svn=7 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From fadd4b28e0393f7016a664b06fecf3ad348d4805 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 11 Jan 2018 22:10:18 -0800 Subject: [PATCH 115/300] wahoo: power: Reorder cpu max node value priority Add CPUBigClusterMaxFreq to Launch and Camera hints with higher priority than Video Encode's hint value. In this case, Video Encode hint doesn't need to be canceled during those hints. Bug: 71869406 Test: Build Change-Id: I53d17d32a8ff77257ba44cef7b8be2911b20b85f --- power-libperfmgr/Power.cpp | 26 ------------------ powerhint.json | 55 +++++++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index 6d4e374d..c560c0fd 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -197,17 +197,11 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { if (data) { // Hint until canceled ATRACE_INT("launch_lock", 1); - if (mEncoderModeOn) { - mHintManager->EndHint("VIDEO_ENCODE"); - } mHintManager->DoHint("LAUNCH"); ALOGD("LAUNCH ON"); } else { ATRACE_INT("launch_lock", 0); mHintManager->EndHint("LAUNCH"); - if (mEncoderModeOn) { - mHintManager->DoHint("VIDEO_ENCODE"); - } ALOGD("LAUNCH OFF"); } } @@ -384,10 +378,6 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { ATRACE_BEGIN("camera_launch"); if (data > 0) { ATRACE_INT("camera_launch_lock", 1); - // If Encoder hint is on, cancel it first and do camera hint - if (mEncoderModeOn) { - mHintManager->EndHint("VIDEO_ENCODE"); - } mHintManager->DoHint("CAMERA_LAUNCH", std::chrono::milliseconds(data)); ALOGD("CAMERA LAUNCH ON: %d MS", data); // boosts 2.5s for launching @@ -395,10 +385,6 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { } else if (data == 0) { ATRACE_INT("camera_launch_lock", 0); mHintManager->EndHint("CAMERA_LAUNCH"); - // If Encoder hint is on, recover it - if (mEncoderModeOn) { - mHintManager->DoHint("VIDEO_ENCODE"); - } ALOGD("CAMERA LAUNCH OFF"); } else { ALOGE("CAMERA LAUNCH INVALID DATA: %d", data); @@ -409,17 +395,11 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { ATRACE_BEGIN("camera_streaming"); if (data > 0) { ATRACE_INT("camera_streaming_lock", 1); - if (mEncoderModeOn) { - mHintManager->EndHint("VIDEO_ENCODE"); - } mHintManager->DoHint("CAMERA_STREAMING", std::chrono::milliseconds(data)); ALOGD("CAMERA STREAMING ON: %d MS", data); } else if (data == 0) { ATRACE_INT("camera_streaming_lock", 0); mHintManager->EndHint("CAMERA_STREAMING"); - if (mEncoderModeOn) { - mHintManager->DoHint("VIDEO_ENCODE"); - } ALOGD("CAMERA STREAMING OFF"); } else { ALOGE("CAMERA STREAMING INVALID DATA: %d", data); @@ -430,17 +410,11 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { ATRACE_BEGIN("camera_shot"); if (data > 0) { ATRACE_INT("camera_shot_lock", 1); - if (mEncoderModeOn) { - mHintManager->EndHint("VIDEO_ENCODE"); - } mHintManager->DoHint("CAMERA_SHOT", std::chrono::milliseconds(data)); ALOGD("CAMERA SHOT ON: %d MS", data); } else if (data == 0) { ATRACE_INT("camera_shot_lock", 0); mHintManager->EndHint("CAMERA_SHOT"); - if (mEncoderModeOn) { - mHintManager->DoHint("VIDEO_ENCODE"); - } ALOGD("CAMERA SHOT OFF"); } else { ALOGE("CAMERA SHOT INVALID DATA: %d", data); diff --git a/powerhint.json b/powerhint.json index 54885e2e..a7b007be 100755 --- a/powerhint.json +++ b/powerhint.json @@ -4,11 +4,12 @@ "Name": "CPULittleClusterMaxFreq", "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", "Values": [ + "1900800", "1555200", "1478400", - "1248000", - "1900800" + "1248000" ], + "DefaultIndex": 0, "ResetOnInit": true }, { @@ -28,13 +29,13 @@ "Name": "CPUBigClusterMaxFreq", "Path": "/sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq", "Values": [ - "1132800", - "1267200", - "1344000", - "1574400", + "2457600", "1958400", - "2457600" + "1574400", + "1344000", + "1267200" ], + "DefaultIndex": 0, "ResetOnInit": true }, { @@ -139,19 +140,19 @@ { "PowerHint": "VIDEO_ENCODE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 4, + "ValueIndex": 1, "Duration": 0 }, { "PowerHint": "SUSTAINED_PERFORMANCE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 1, + "ValueIndex": 4, "Duration": 0 }, { "PowerHint": "SUSTAINED_PERFORMANCE", "Node": "CPULittleClusterMaxFreq", - "ValueIndex": 1, + "ValueIndex": 3, "Duration": 0 }, { @@ -163,7 +164,7 @@ { "PowerHint": "VR_MODE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 3, + "ValueIndex": 2, "Duration": 0 }, { @@ -175,7 +176,7 @@ { "PowerHint": "VR_MODE", "Node": "CPULittleClusterMaxFreq", - "ValueIndex": 0, + "ValueIndex": 1, "Duration": 0 }, { @@ -205,7 +206,7 @@ { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 2, + "ValueIndex": 3, "Duration": 0 }, { @@ -217,7 +218,7 @@ { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "CPULittleClusterMaxFreq", - "ValueIndex": 1, + "ValueIndex": 2, "Duration": 0 }, { @@ -234,7 +235,7 @@ }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", - "Node": "GPUMaxFreq", + "Node": "GPUMinFreq", "ValueIndex": 1, "Duration": 0 }, @@ -286,6 +287,12 @@ "ValueIndex": 1, "Duration": 0 }, + { + "PowerHint": "LAUNCH", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 0, + "Duration": 0 + }, { "PowerHint": "LAUNCH", "Node": "CPUBigClusterMinFreq", @@ -328,6 +335,12 @@ "ValueIndex": 0, "Duration": 5000 }, + { + "PowerHint": "CAMERA_LAUNCH", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 0, + "Duration": 0 + }, { "PowerHint": "CAMERA_LAUNCH", "Node": "CPUBigClusterMinFreq", @@ -346,6 +359,12 @@ "ValueIndex": 0, "Duration": 1000 }, + { + "PowerHint": "CAMERA_STREAMING", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 0, + "Duration": 0 + }, { "PowerHint": "CAMERA_STREAMING", "Node": "CPUBigClusterMinFreq", @@ -364,6 +383,12 @@ "ValueIndex": 0, "Duration": 1000 }, + { + "PowerHint": "CAMERA_SHOT", + "Node": "CPUBigClusterMaxFreq", + "ValueIndex": 0, + "Duration": 0 + }, { "PowerHint": "CAMERA_SHOT", "Node": "CPUBigClusterMinFreq", From 840d4a5ea4081c0a819a53b447f22e9f68eea0f9 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Fri, 12 Jan 2018 18:07:20 +0000 Subject: [PATCH 116/300] Revert "system_executes_vendor_violators: google_camera_app and tango_core" This reverts commit f4494825c5fc75203d3a55d5e58110dfd43c1033. Reason for revert: albacore build broken Change-Id: I79bccbab740d545261afd8f7f3ffec3be20d0a27 --- sepolicy/vendor/google_camera_app.te | 1 - sepolicy/vendor/tango_core.te | 1 - 2 files changed, 2 deletions(-) diff --git a/sepolicy/vendor/google_camera_app.te b/sepolicy/vendor/google_camera_app.te index c6f2a2ea..61928827 100644 --- a/sepolicy/vendor/google_camera_app.te +++ b/sepolicy/vendor/google_camera_app.te @@ -1,5 +1,4 @@ type google_camera_app, domain, coredomain; -typeattribute google_camera_app system_executes_vendor_violators; app_domain(google_camera_app) net_domain(google_camera_app) diff --git a/sepolicy/vendor/tango_core.te b/sepolicy/vendor/tango_core.te index 491abefa..e72e3bcc 100644 --- a/sepolicy/vendor/tango_core.te +++ b/sepolicy/vendor/tango_core.te @@ -1,5 +1,4 @@ type tango_core, domain, coredomain; -typeattribute tango_core system_executes_vendor_violators; app_domain(tango_core) #from system/sepolicy/private/untrusted_app.te From 920bd9af1f2aedf727f7853810bb913d4763e6e5 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 12 Jan 2018 21:31:44 -0800 Subject: [PATCH 117/300] Remove PowerHAL in CleanSpec.mk Test: Build Change-Id: If06a71df9abfd7833a691a77951b22ce8363bf26 --- CleanSpec.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CleanSpec.mk b/CleanSpec.mk index d581e373..c105dba8 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -161,3 +161,6 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.ke $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.health@2.0-service) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.health@2.0-service.rc) +# Remove PowerHAL +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.power*) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.power*) From 5a31d4bff08e048696e4c1311ebe36000f86cb81 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Sat, 13 Jan 2018 21:39:45 -0800 Subject: [PATCH 118/300] making config_displayBlanksAfterDoze device specific Moving config_displayBlanksAfterDoze into device folder instead of device family because walleye supports seamless transitions but taimen doesn't. Change-Id: I4710388122852dc68bff9c2cb96633ffade9be4e Fixes: 71897888 Test: flash walleye, taimen and salfish --- overlay/frameworks/base/core/res/res/values/config.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index fd3a0ad3..90413a66 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -243,9 +243,6 @@ true - - true - true From d71c835526126de7d244220fdd93e6cd4de3aff8 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 15 Jan 2018 12:48:36 -0800 Subject: [PATCH 119/300] Power: fix typo in log Test: Build Change-Id: Iaaa7365e5c62173ada90cb6253ad21503df13d88 --- power-libperfmgr/Power.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index c560c0fd..f1509c15 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -366,11 +366,11 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { // Hint until canceled ATRACE_INT("audio_streaming_lock", 1); mHintManager->DoHint("AUDIO_STREAMING"); - ALOGD("AUDIO LOW LATENCY ON"); + ALOGD("AUDIO STREAMING ON"); } else { ATRACE_INT("audio_streaming_lock", 0); mHintManager->EndHint("AUDIO_STREAMING"); - ALOGD("AUDIO LOW LATENCY OFF"); + ALOGD("AUDIO STREAMING OFF"); } ATRACE_END(); break; @@ -379,7 +379,7 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { if (data > 0) { ATRACE_INT("camera_launch_lock", 1); mHintManager->DoHint("CAMERA_LAUNCH", std::chrono::milliseconds(data)); - ALOGD("CAMERA LAUNCH ON: %d MS", data); + ALOGD("CAMERA LAUNCH ON: %d MS, LAUNCH ON: 2500 MS", data); // boosts 2.5s for launching mHintManager->DoHint("LAUNCH", std::chrono::milliseconds(2500)); } else if (data == 0) { From 1a56e91aee29546474f5f70a61204a0f695c07d9 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 15 Jan 2018 19:38:23 -0800 Subject: [PATCH 120/300] Power: fix timeout in powerhint.json Test: boot Change-Id: I4a93e4abf279291ed6a09c1c0944e56548c426fb --- powerhint.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/powerhint.json b/powerhint.json index a7b007be..04279092 100755 --- a/powerhint.json +++ b/powerhint.json @@ -291,7 +291,7 @@ "PowerHint": "LAUNCH", "Node": "CPUBigClusterMaxFreq", "ValueIndex": 0, - "Duration": 0 + "Duration": 5000 }, { "PowerHint": "LAUNCH", @@ -339,7 +339,7 @@ "PowerHint": "CAMERA_LAUNCH", "Node": "CPUBigClusterMaxFreq", "ValueIndex": 0, - "Duration": 0 + "Duration": 1000 }, { "PowerHint": "CAMERA_LAUNCH", @@ -363,7 +363,7 @@ "PowerHint": "CAMERA_STREAMING", "Node": "CPUBigClusterMaxFreq", "ValueIndex": 0, - "Duration": 0 + "Duration": 1000 }, { "PowerHint": "CAMERA_STREAMING", @@ -387,7 +387,7 @@ "PowerHint": "CAMERA_SHOT", "Node": "CPUBigClusterMaxFreq", "ValueIndex": 0, - "Duration": 0 + "Duration": 1000 }, { "PowerHint": "CAMERA_SHOT", From 3ece4d183a1840e703e1d26ca83e708c5d533ad2 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Wed, 25 Oct 2017 18:24:52 -0700 Subject: [PATCH 121/300] Enable hvx NN service for oc-mr1-nn-dev Bug: 67478959 Test: mm, vts, cts Change-Id: I0cc9dc1b9ba8773536952cd3a6252bc763e49baf (cherry picked from commit 47f3f80d14b98f6597871be39ca7fa286baddcd6) --- device.mk | 4 ++++ manifest.xml | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/device.mk b/device.mk index bd629ff4..44ea3d20 100755 --- a/device.mk +++ b/device.mk @@ -327,6 +327,10 @@ PRODUCT_PACKAGES += \ android.hardware.drm@1.0-service \ android.hardware.drm@1.0-service.widevine +# NeuralNetworks HAL +PRODUCT_PACKAGES += \ + android.hardware.neuralnetworks@1.0-service-hvx + # NFC packages PRODUCT_PACKAGES += \ nfc_nci.msm8998 \ diff --git a/manifest.xml b/manifest.xml index 83b24592..5a080838 100644 --- a/manifest.xml +++ b/manifest.xml @@ -207,6 +207,15 @@ default + + android.hardware.neuralnetworks + hwbinder + 1.0 + + IDevice + hvx + + android.hardware.nfc hwbinder From 0d045dd2c4573183a3d01af62dbdf35b1329aae1 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 16 Jan 2018 09:45:47 -0800 Subject: [PATCH 122/300] STOPSHIP: move sys.vdso reflector to allow "user" builds Modification of bb267fa16f8a1a13283575a4e89b880cd44a00b2 to remove restriction to userdebug and eng builds. Rationalization is the experiment will continue during public beta releases. Test: manual, bionic-benchmarks --bionic_xml=vdso.xml Bug: 70518189 Change-Id: I57e5cdc21569dd32377256d3962e1dc03385f7cb --- init.hardware.diag.rc.userdebug | 15 --------------- init.hardware.rc | 14 ++++++++++++++ sepolicy/vendor/init.te | 2 -- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 0366ee48..c0536379 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -401,18 +401,3 @@ on property:persist.bluetooth.btsnoopenable=true on property:persist.bluetooth.btsnoopenable=false setprop persist.service.bdroid.soclog false - -# b/70518189 vDSO experiments -on property:sys.vdso=* - write /sys/module/vdso/parameters/enable_32 1 - write /sys/module/vdso/parameters/enable_64 1 - -on property:sys.vdso=false - write /sys/module/vdso/parameters/enable_32 0 - write /sys/module/vdso/parameters/enable_64 0 - -on property:sys.vdso=64 - write /sys/module/vdso/parameters/enable_32 0 - -on property:sys.vdso=32 - write /sys/module/vdso/parameters/enable_64 0 diff --git a/init.hardware.rc b/init.hardware.rc index e5c9d091..2d929756 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -836,3 +836,17 @@ service vendor.ramoops_sh /system/bin/init.ramoops.sh disabled oneshot +# b/70518189 vDSO experiments +on property:sys.vdso=* + write /sys/module/vdso/parameters/enable_32 1 + write /sys/module/vdso/parameters/enable_64 1 + +on property:sys.vdso=false + write /sys/module/vdso/parameters/enable_32 0 + write /sys/module/vdso/parameters/enable_64 0 + +on property:sys.vdso=64 + write /sys/module/vdso/parameters/enable_32 0 + +on property:sys.vdso=32 + write /sys/module/vdso/parameters/enable_64 0 diff --git a/sepolicy/vendor/init.te b/sepolicy/vendor/init.te index 5a8db16a..0ecbfe5b 100644 --- a/sepolicy/vendor/init.te +++ b/sepolicy/vendor/init.te @@ -17,6 +17,4 @@ allow init persist_block_device:lnk_file relabelto; dontaudit init kernel:system module_request; # b/70518189 vDSO experiments -userdebug_or_eng(` allow init sysfs_vdso:file w_file_perms; -') From 15fd9f5fae85cd3aed1853612369c2211c9e2410 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Tue, 16 Jan 2018 12:03:13 -0800 Subject: [PATCH 123/300] Power: restart PowerHAL if audio HAL died with active low_latency hint Audio low latency which can go parallel with other long-term hints and there is small change that leaves the powerHAL stuck with the hint for long time. This CL will require another property to record the state of it. Bug: 67648152 Test: kill audiohal, audioserver Change-Id: Ic0017b0c7a27994e7583d7701665b2cd156ca192 --- power-libperfmgr/Power.cpp | 17 ++++++++++++++++- power-libperfmgr/Power.h | 1 + ...rdware.power@1.2-service.wahoo-libperfmgr.rc | 7 +++++++ sepolicy/vendor/property_contexts | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index f1509c15..d76321b1 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -74,9 +74,14 @@ Power::Power() : mSustainedPerfModeOn = true; mVRModeOn = true; } else { - ALOGI("Initialize with default setting"); + ALOGI("Initialize PowerHAL"); } + state = android::base::GetProperty(kPowerHalAudioProp, ""); + if (state == "LOW_LATENCY") { + ALOGI("Initialize with AUDIO_LOW_LATENCY on"); + mHintManager->DoHint("AUDIO_LOW_LATENCY"); + } } // Methods from ::android::hardware::power::V1_0::IPower follow. @@ -98,6 +103,10 @@ Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { } break; case PowerHint_1_0::VIDEO_ENCODE: + if (mVRModeOn || mSustainedPerfModeOn) { + ALOGV("%s: ignoring due to other active perf hints", __func__); + break; + } ATRACE_BEGIN("video_encode"); if (mVRModeOn || mSustainedPerfModeOn) { ALOGV("%s: ignoring due to other active perf hints", __func__); @@ -353,10 +362,16 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { ATRACE_INT("audio_low_latency_lock", 1); mHintManager->DoHint("AUDIO_LOW_LATENCY"); ALOGD("AUDIO LOW LATENCY ON"); + if (!android::base::SetProperty(kPowerHalAudioProp, "LOW_LATENCY")) { + ALOGE("%s: could not set powerHAL audio state property to LOW_LATENCY", __func__); + } } else { ATRACE_INT("audio_low_latency_lock", 0); mHintManager->EndHint("AUDIO_LOW_LATENCY"); ALOGD("AUDIO LOW LATENCY OFF"); + if (!android::base::SetProperty(kPowerHalAudioProp, "")) { + ALOGE("%s: could not clear powerHAL audio state property", __func__); + } } ATRACE_END(); break; diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h index 1b301c8c..d1eccbe4 100644 --- a/power-libperfmgr/Power.h +++ b/power-libperfmgr/Power.h @@ -42,6 +42,7 @@ using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint; using ::android::perfmgr::HintManager; constexpr char kPowerHalStateProp[] = "vendor.powerhal.state"; +constexpr char kPowerHalAudioProp[] = "vendor.powerhal.audio"; struct Power : public IPower { // Methods from ::android::hardware::power::V1_0::IPower follow. diff --git a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc index 79ebf7af..d77b8f05 100644 --- a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc +++ b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc @@ -6,9 +6,16 @@ service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.w # restart powerHAL when framework died on property:init.svc.zygote=restarting && property:vendor.powerhal.state=* setprop vendor.powerhal.state "" + setprop vendor.powerhal.audio "" restart vendor.power-hal-1-2 # restart powerHAL when cameraHAL died on property:init.svc.vendor.camera-provider-2-4=restarting && property:vendor.powerhal.state=VIDEO_ENCODE setprop vendor.powerhal.state "" + setprop vendor.powerhal.audio "" + restart vendor.power-hal-1-2 + +# restart powerHAL when audioHAL died +on property:init.svc.vendor.audio-hal-2-0=restarting && property:vendor.powerhal.audio=LOW_LATENCY + setprop vendor.powerhal.audio "" restart vendor.power-hal-1-2 diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 2839be4e..e7f2a02e 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -26,3 +26,4 @@ sys.time.set u:object_r:sys_time_prop:s0 persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 vendor.powerhal.state u:object_r:power_prop:s0 +vendor.powerhal.audio u:object_r:power_prop:s0 From 06c8581a2152ce6cd0b11dbddd0b5366b8c94cc5 Mon Sep 17 00:00:00 2001 From: Siddharth Ray Date: Tue, 16 Jan 2018 16:29:37 -0800 Subject: [PATCH 124/300] Increased GPS debugging Increased GPS debugging for W/T to root cause b/72045381 BUG:72045381 Change-Id: Ibd248ada765b69a42746f6f8a9d68d2797ed2eb9 --- gps.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gps.conf b/gps.conf index 4e8fffa7..61680665 100644 --- a/gps.conf +++ b/gps.conf @@ -26,7 +26,7 @@ NTP_SERVER = time.google.com # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info # 4 - Debug, 5 - Verbose # If DEBUG_LEVEL is commented, Android's logging levels will be used -DEBUG_LEVEL = 2 +DEBUG_LEVEL = 5 # Intermediate position report, 1=enable, 0=disable INTERMEDIATE_POS=0 From 6b106184074c091017417700aaa87bb3fb385821 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Thu, 19 Oct 2017 17:07:15 +0900 Subject: [PATCH 125/300] Mark unlabeled vendor properties with vendor_default_prop For now, unlabeled vendor properties are marked as default_prop which is one of core_property_type. This CL will mark them with vendor_default_prop. Bug: 38146102 Test: tested on walleye with PRODUCT_COMPATIBLE_PROPERTY=true Change-Id: I8d4068927f435a0a0732fce86920adc3e7389424 --- device.mk | 2 + sepolicy/vendor/atfwd.te | 2 +- sepolicy/vendor/charger.te | 1 + sepolicy/vendor/domain.te | 4 + sepolicy/vendor/hal_dumpstate_impl.te | 2 + sepolicy/vendor/healthd.te | 1 + sepolicy/vendor/init-devstart-sh.te | 2 +- sepolicy/vendor/init-insmod-sh.te | 2 +- sepolicy/vendor/netmgrd.te | 2 +- sepolicy/vendor/property.te | 4 + sepolicy/vendor/property_contexts | 166 +++++++++++++++++++++++++- sepolicy/vendor/radio.te | 2 + sepolicy/vendor/rild.te | 1 + sepolicy/vendor/surfaceflinger.te | 2 + sepolicy/vendor/system_app.te | 2 + sepolicy/vendor/system_server.te | 2 + sepolicy/vendor/vendor_init.te | 5 +- 17 files changed, 194 insertions(+), 8 deletions(-) create mode 100644 sepolicy/vendor/charger.te create mode 100644 sepolicy/vendor/healthd.te diff --git a/device.mk b/device.mk index 62970822..47d95552 100755 --- a/device.mk +++ b/device.mk @@ -14,6 +14,8 @@ # limitations under the License. # +PRODUCT_COMPATIBLE_PROPERTY := true + PRODUCT_PROPERTY_OVERRIDES += \ keyguard.no_require_sim=true diff --git a/sepolicy/vendor/atfwd.te b/sepolicy/vendor/atfwd.te index ad96a120..6dbd56bb 100644 --- a/sepolicy/vendor/atfwd.te +++ b/sepolicy/vendor/atfwd.te @@ -13,4 +13,4 @@ allowxperm atfwd self:socket ioctl msm_sock_ipc_ioctls; r_dir_file(atfwd, sysfs_type) -set_prop(atfwd, radio_prop) +set_prop(atfwd, vendor_radio_prop) diff --git a/sepolicy/vendor/charger.te b/sepolicy/vendor/charger.te new file mode 100644 index 00000000..3f30f35d --- /dev/null +++ b/sepolicy/vendor/charger.te @@ -0,0 +1 @@ +set_prop(charger, public_vendor_system_prop) diff --git a/sepolicy/vendor/domain.te b/sepolicy/vendor/domain.te index eedf87fd..0a0cc413 100644 --- a/sepolicy/vendor/domain.te +++ b/sepolicy/vendor/domain.te @@ -5,3 +5,7 @@ allow domain debugfs_kgsl:dir search; allow domain debugfs_ion:dir search; + +get_prop(domain, public_vendor_default_prop) +get_prop(domain, public_vendor_system_prop) +get_prop(domain, vendor_radio_prop) diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index 97a5c361..7815f71b 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -26,6 +26,8 @@ userdebug_or_eng(` set_prop(hal_dumpstate_impl, modem_diag_prop) ') +get_prop(hal_dumpstate_impl, vendor_radio_prop) + allow hal_dumpstate_impl uio_device:chr_file rw_file_perms; r_dir_file(hal_dumpstate_impl, sysfs_uio) r_dir_file(hal_dumpstate_impl, sysfs_rmtfs) diff --git a/sepolicy/vendor/healthd.te b/sepolicy/vendor/healthd.te new file mode 100644 index 00000000..5032bba8 --- /dev/null +++ b/sepolicy/vendor/healthd.te @@ -0,0 +1 @@ +set_prop(healthd, public_vendor_system_prop) diff --git a/sepolicy/vendor/init-devstart-sh.te b/sepolicy/vendor/init-devstart-sh.te index 9b762638..47de30f8 100644 --- a/sepolicy/vendor/init-devstart-sh.te +++ b/sepolicy/vendor/init-devstart-sh.te @@ -10,7 +10,7 @@ allow init-qcom-devstart-sh vendor_toolbox_exec:file rx_file_perms; allow init-qcom-devstart-sh vendor_file:file rx_file_perms; # Set the sys.qcom.devup property -set_prop(init-qcom-devstart-sh, system_prop) +set_prop(init-qcom-devstart-sh, public_vendor_system_prop) # Set boot_adsp and boot_slpi to 1 allow init-qcom-devstart-sh sysfs_msm_subsys:file w_file_perms; diff --git a/sepolicy/vendor/init-insmod-sh.te b/sepolicy/vendor/init-insmod-sh.te index 024984a5..184dd03f 100644 --- a/sepolicy/vendor/init-insmod-sh.te +++ b/sepolicy/vendor/init-insmod-sh.te @@ -7,7 +7,7 @@ allow init-insmod-sh vendor_shell_exec:file rx_file_perms; allow init-insmod-sh vendor_toolbox_exec:file rx_file_perms; # Set the sys.touch.modules.ready property -set_prop(init-insmod-sh, system_prop) +set_prop(init-insmod-sh, public_vendor_system_prop) # Allow insmod allow init-insmod-sh self:capability sys_module; diff --git a/sepolicy/vendor/netmgrd.te b/sepolicy/vendor/netmgrd.te index 197f6720..32fc7ec0 100644 --- a/sepolicy/vendor/netmgrd.te +++ b/sepolicy/vendor/netmgrd.te @@ -4,7 +4,7 @@ type netmgrd_exec, exec_type, vendor_file_type, file_type; net_domain(netmgrd) init_daemon_domain(netmgrd) -set_prop(netmgrd, net_radio_prop) +set_prop(netmgrd, vendor_net_radio_prop) set_prop(netmgrd, net_rmnet_prop) # communicate with netd diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index 30822410..401dbb3f 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -5,6 +5,8 @@ type keymaster_prop, property_type; type net_rmnet_prop, property_type; type ramdump_prop, property_type; type post_boot_prop, property_type; +type public_vendor_default_prop, property_type; +type public_vendor_system_prop, property_type; type ssr_prop, property_type; type cnss_diag_prop, property_type; type tee_listener_prop, property_type; @@ -16,3 +18,5 @@ type sys_time_prop, property_type; type atfwd_start_prop, property_type; type bluetooth_log_prop, property_type; type power_prop, property_type; +type vendor_net_radio_prop, property_type; +type vendor_radio_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index e7f2a02e..611b45e4 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -6,10 +6,10 @@ sys.ims. u:object_r:ims_prop:s0 vendor.ims. u:object_r:ims_prop:s0 sys.keymaster.loaded u:object_r:keymaster_prop:s0 net.r_rmnet_data0 u:object_r:net_rmnet_prop:s0 -persist.net.doxlat u:object_r:net_radio_prop:s0 +persist.net.doxlat u:object_r:vendor_net_radio_prop:s0 sys.post_boot. u:object_r:post_boot_prop:s0 -radio. u:object_r:radio_prop:s0 -rcs.publish.status u:object_r:radio_prop:s0 +radio. u:object_r:vendor_radio_prop:s0 +rcs.publish.status u:object_r:vendor_radio_prop:s0 debug.ramdump. u:object_r:ramdump_prop:s0 persist.sys.crash_rcu u:object_r:ramdump_prop:s0 debug.ssrdump u:object_r:ssr_prop:s0 @@ -27,3 +27,163 @@ persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 vendor.powerhal.state u:object_r:power_prop:s0 vendor.powerhal.audio u:object_r:power_prop:s0 + +# public_vendor_default_prop +# They are public_vendor_default_props for vendor-specific extension. +# Usually they are for vndk-sp libs and vendor apks. +fastrpc.perf. u:object_r:public_vendor_default_prop:s0 +persist.cne.cqetimer u:object_r:public_vendor_default_prop:s0 +persist.cne.feature u:object_r:public_vendor_default_prop:s0 +persist.cne.logging.qxdm u:object_r:public_vendor_default_prop:s0 +persist.gcam. u:object_r:public_vendor_default_prop:s0 +persist.vendor.cnd.iwlan u:object_r:public_vendor_default_prop:s0 +persist.vendor.cnd.wqe u:object_r:public_vendor_default_prop:s0 +ro.graphics.memory u:object_r:public_vendor_default_prop:s0 +ro.boot.ddrsize u:object_r:public_vendor_default_prop:s0 +ro.boot.hardware.ddr u:object_r:public_vendor_default_prop:s0 +ro.boot.hardware.ufs u:object_r:public_vendor_default_prop:s0 + +# public_vendor_system_prop +# They are public_vendor_system_props for vendor-specific extension. +sys.all.modules.ready u:object_r:public_vendor_system_prop:s0 +sys.qcom.devup u:object_r:public_vendor_system_prop:s0 +sys.slpi.firmware.version u:object_r:public_vendor_system_prop:s0 + +# vendor_default_prop +# default_prop isn't accessible from vendor components. +# So vendor_default_prop should be marked. +audio_hal.in_period_size u:object_r:vendor_default_prop:s0 +audio_hal.period_multiplier u:object_r:vendor_default_prop:s0 +audio_hal.period_size u:object_r:vendor_default_prop:s0 +audio.adm. u:object_r:vendor_default_prop:s0 +audio.snd_card.open.retries u:object_r:vendor_default_prop:s0 +audio.volume.headset.gain.depcal u:object_r:vendor_default_prop:s0 +audio.volume.listener.dump u:object_r:vendor_default_prop:s0 +boost_override u:object_r:vendor_default_prop:s0 +cameradaemon.SaveMemAtBoot u:object_r:vendor_default_prop:s0 +camera.cpp. u:object_r:vendor_default_prop:s0 +camera.eis.fov_correction u:object_r:vendor_default_prop:s0 +camera.hdrplus.donotpoweroneasel u:object_r:vendor_default_prop:s0 +com.qti. u:object_r:vendor_default_prop:s0 +cpp.set.clock u:object_r:vendor_default_prop:s0 +disable.cpp.power.collapse u:object_r:vendor_default_prop:s0 +downmix_override_mode u:object_r:vendor_default_prop:s0 +fmas. u:object_r:vendor_default_prop:s0 +gpu.stats.debug.level u:object_r:vendor_default_prop:s0 +hw.hdmi.resolution u:object_r:vendor_default_prop:s0 +fpc_kpi u:object_r:vendor_default_prop:s0 +media.aac_51_output_enabled u:object_r:vendor_default_prop:s0 +mmp.enable.3g2 u:object_r:vendor_default_prop:s0 +mm.enable.qcom_parser u:object_r:vendor_default_prop:s0 +mm.enable.smoothstreaming u:object_r:vendor_default_prop:s0 +perflocks.predefined_clust_map u:object_r:vendor_default_prop:s0 +perflocks.predefined_freq_map u:object_r:vendor_default_prop:s0 +perist.vendor. u:object_r:vendor_default_prop:s0 +persist.audio.calfile0 u:object_r:vendor_default_prop:s0 +persist.audio.dualmic.config u:object_r:vendor_default_prop:s0 +persist.audio.fluence. u:object_r:vendor_default_prop:s0 +persist.cam.pp.feat.mask u:object_r:vendor_default_prop:s0 +persist.cne.override.memlimit u:object_r:vendor_default_prop:s0 +persist.data_netmgrd_mtu u:object_r:vendor_default_prop:s0 +persist.data_netmgrd_nint u:object_r:vendor_default_prop:s0 +persist.data.df. u:object_r:vendor_default_prop:s0 +persist.data.dont_use_epc u:object_r:vendor_default_prop:s0 +persist.data.dont_use_npflag u:object_r:vendor_default_prop:s0 +persist.data.dpm.enable u:object_r:vendor_default_prop:s0 +persist.data.dropssdp u:object_r:vendor_default_prop:s0 +persist.data.ibfc.enable u:object_r:vendor_default_prop:s0 +persist.data.iwlan.enable u:object_r:vendor_default_prop:s0 +persist.data.iwlan.ims.enable u:object_r:vendor_default_prop:s0 +persist.data.iwlan.rekey u:object_r:vendor_default_prop:s0 +persist.data.llf.enable u:object_r:vendor_default_prop:s0 +persist.data.mode u:object_r:vendor_default_prop:s0 +persist.data.netmgrd.qos.enable u:object_r:vendor_default_prop:s0 +persist.data.netmgrd.qos.hybrid u:object_r:vendor_default_prop:s0 +persist.data.netmgr.log_to_file u:object_r:vendor_default_prop:s0 +persist.data.netmgr.wl.timeout u:object_r:vendor_default_prop:s0 +persist.data.port_bridge.log u:object_r:vendor_default_prop:s0 +persist.data.profile_update u:object_r:vendor_default_prop:s0 +persist.data.qmi.adb_logmask u:object_r:vendor_default_prop:s0 +persist.data.rmnet.en u:object_r:vendor_default_prop:s0 +persist.data.target.msm8998 u:object_r:vendor_default_prop:s0 +persist.data.tcpackprio.enable u:object_r:vendor_default_prop:s0 +persist.data.wda.enable u:object_r:vendor_default_prop:s0 +persist.debug.sensors.elmyra.rate u:object_r:vendor_default_prop:s0 +persist.debug.sensors.hal u:object_r:vendor_default_prop:s0 +persist.debug.sf.showfps u:object_r:vendor_default_prop:s0 +persist.delta_time.enable u:object_r:vendor_default_prop:s0 +persist.enable.max.pending.buf u:object_r:vendor_default_prop:s0 +persist.env.spec u:object_r:vendor_default_prop:s0 +persist.fci u:object_r:vendor_default_prop:s0 +persist.fuse_sdcard u:object_r:vendor_default_prop:s0 +persist.hwc.blit.comp u:object_r:vendor_default_prop:s0 +persist.metadata_dynfps.disable u:object_r:vendor_default_prop:s0 +persist.msmirqbalance.debug u:object_r:vendor_default_prop:s0 +persist.net.logmask u:object_r:vendor_default_prop:s0 +persist.partial.skip u:object_r:vendor_default_prop:s0 +persist.pd_locater_debug u:object_r:vendor_default_prop:s0 +persist.qcril u:object_r:vendor_default_prop:s0 +persist.rild.nitz_ u:object_r:vendor_default_prop:s0 +persist.rmnet.data.enable u:object_r:vendor_default_prop:s0 +persist.sensors.elmyra.sensitivity u:object_r:vendor_default_prop:s0 +persist.sensors.hal_timeout u:object_r:vendor_default_prop:s0 +persist.sys.ssr.enable_ramdumps u:object_r:vendor_default_prop:s0 +persist.sys.ssr.restart_level u:object_r:vendor_default_prop:s0 +persist.timed.enable u:object_r:vendor_default_prop:s0 +persist.tnr.process.plates u:object_r:vendor_default_prop:s0 +qcom.bluetooth.soc u:object_r:vendor_default_prop:s0 +qcril.support.encrypted_calls u:object_r:vendor_default_prop:s0 +qdcm. u:object_r:vendor_default_prop:s0 +rild.libargs u:object_r:vendor_default_prop:s0 +rild.libpath u:object_r:vendor_default_prop:s0 +ro.alarm_boot u:object_r:vendor_default_prop:s0 +ro.boot.factoryota u:object_r:vendor_default_prop:s0 +ro.boot.mid u:object_r:vendor_default_prop:s0 +ro.boot.temp_protect_ignore u:object_r:vendor_default_prop:s0 +ro.bluetooth.a4wp u:object_r:vendor_default_prop:s0 +ro.bluetooth.emb_wp_mode u:object_r:vendor_default_prop:s0 +ro.bluetooth.wipower u:object_r:vendor_default_prop:s0 +ro.camera.wrapper.hal3TrebleMinorVersion u:object_r:vendor_default_prop:s0 +ro.fota.oem u:object_r:vendor_default_prop:s0 +ro.lean u:object_r:vendor_default_prop:s0 +ro.min_freq_0 u:object_r:vendor_default_prop:s0 +ro.min_freq_4 u:object_r:vendor_default_prop:s0 +ro.oem_unlock.pst u:object_r:vendor_default_prop:s0 +ro.qcom. u:object_r:vendor_default_prop:s0 +ro.qc.sdk.audio.fluencetype u:object_r:vendor_default_prop:s0 +ro.qfusion_use_report_period u:object_r:vendor_default_prop:s0 +ro.qti. u:object_r:vendor_default_prop:s0 +ro.qualcomm. u:object_r:vendor_default_prop:s0 +ro.radio.log_loc u:object_r:vendor_default_prop:s0 +ro.radio.log_prefix u:object_r:vendor_default_prop:s0 +ro.rfkilldisabled u:object_r:vendor_default_prop:s0 +ro.vendor.build.svn u:object_r:vendor_default_prop:s0 +ro.vendor.extension_library u:object_r:vendor_default_prop:s0 +ro.vibrator.hal.click.duration u:object_r:vendor_default_prop:s0 +ro.vibrator.hal.tick.duration u:object_r:vendor_default_prop:s0 +sdm. u:object_r:vendor_default_prop:s0 +sys.disable_ext_animation u:object_r:vendor_default_prop:s0 +sys.display.low_persistence_mode_brightness u:object_r:vendor_default_prop:s0 +sys.hwc_disable_hdr u:object_r:vendor_default_prop:s0 +sys.qca1530 u:object_r:vendor_default_prop:s0 +vendor.audio.adm.buffering.ms u:object_r:vendor_default_prop:s0 +vendor.vidc.enc.dcvs.extra-buff-count u:object_r:vendor_default_prop:s0 +ubwc.no.compression u:object_r:vendor_default_prop:s0 + +# vendor_radio_prop +persist.radio.always_send_plmn u:object_r:vendor_radio_prop:s0 +persist.radio.apm_sim_not_pwdn u:object_r:vendor_radio_prop:s0 +persist.radio.custom_ecc u:object_r:vendor_radio_prop:s0 +persist.radio.data_con_rprt u:object_r:vendor_radio_prop:s0 +persist.radio.data_ltd_sys_ind u:object_r:vendor_radio_prop:s0 +persist.radio.is_wps_enabled u:object_r:vendor_radio_prop:s0 +persist.radio.RATE_ADAPT_ENABLE u:object_r:vendor_radio_prop:s0 +persist.radio.ROTATION_ENABLE u:object_r:vendor_radio_prop:s0 +persist.radio.sap_silent_pin u:object_r:vendor_radio_prop:s0 +persist.radio.sib16_support u:object_r:vendor_radio_prop:s0 +persist.radio.smlog_switch u:object_r:vendor_radio_prop:s0 +persist.radio.snapshot_enabled u:object_r:vendor_radio_prop:s0 +persist.radio.snapshot_timer u:object_r:vendor_radio_prop:s0 +persist.radio.videopause.mode u:object_r:vendor_radio_prop:s0 +persist.radio.VT_ENABLE u:object_r:vendor_radio_prop:s0 +persist.radio.VT_HYBRID_ENABLE u:object_r:vendor_radio_prop:s0 diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index 47e7d8b3..5e3bdd82 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -27,3 +27,5 @@ binder_call(radio, hal_imsrtp) # read /proc/cmdline allow radio proc_cmdline:file r_file_perms; + +get_prop(radio, vendor_radio_prop) diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te index 36470144..3d54a40b 100644 --- a/sepolicy/vendor/rild.te +++ b/sepolicy/vendor/rild.te @@ -29,3 +29,4 @@ allow rild radio_vendor_data_file:dir rw_dir_perms; allow rild radio_vendor_data_file:file create_file_perms; get_prop(rild, tel_mon_prop) +get_prop(rild, vendor_radio_prop) diff --git a/sepolicy/vendor/surfaceflinger.te b/sepolicy/vendor/surfaceflinger.te index fee5e123..a8f71cbb 100644 --- a/sepolicy/vendor/surfaceflinger.te +++ b/sepolicy/vendor/surfaceflinger.te @@ -1,3 +1,5 @@ dontaudit surfaceflinger firmware_file:dir search; dontaudit surfaceflinger kernel:system module_request; allow surfaceflinger debugfs_ion:dir search; + +set_prop(surfaceflinger, public_vendor_system_prop) diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te index 1cc6fb1f..5e5eb62f 100644 --- a/sepolicy/vendor/system_app.te +++ b/sepolicy/vendor/system_app.te @@ -8,3 +8,5 @@ set_prop(system_app, camera_prop) # read regulatory info allow system_app elabel_data_file:dir r_dir_perms; allow system_app elabel_data_file:file r_file_perms; + +set_prop(system_app, public_vendor_system_prop) diff --git a/sepolicy/vendor/system_server.te b/sepolicy/vendor/system_server.te index 090cadfa..92ab548a 100644 --- a/sepolicy/vendor/system_server.te +++ b/sepolicy/vendor/system_server.te @@ -18,3 +18,5 @@ dontaudit system_server audioserver:file write; dontaudit system_server untrusted_app:file write; dontaudit system_server hal_audio_default:file write; dontaudit system_server appdomain:file write; + +set_prop(system_server, public_vendor_system_prop) diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 33dce0bb..21a228a9 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -1,4 +1,7 @@ allow vendor_init debugfs_clk:file w_file_perms; dontaudit vendor_init kernel:system module_request; -get_prop(vendor_init, modem_diag_prop) +set_prop(vendor_init, camera_prop) +set_prop(vendor_init, modem_diag_prop) +set_prop(vendor_init, public_vendor_default_prop) +set_prop(vendor_init, vendor_radio_prop) From b619b3220cb32b2ff7343649d5d879afa9cb44f8 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Wed, 17 Jan 2018 07:10:27 +0900 Subject: [PATCH 126/300] Use PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE instead of PRODUCT_COMPATIBLE_PROPERTY PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE must be true because wahoo devices aren't prepared yet for whitelisting actionable system properties. Bug: 38146102 Test: tested on walleye Change-Id: Ic41cbbf6cbe6f191f8ffe9a48609e46aeee5c374 --- device.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 47d95552..2bdaabee 100755 --- a/device.mk +++ b/device.mk @@ -14,7 +14,8 @@ # limitations under the License. # -PRODUCT_COMPATIBLE_PROPERTY := true +PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true +PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := true PRODUCT_PROPERTY_OVERRIDES += \ keyguard.no_require_sim=true From 9c42cd16300baaf7a76eabaee5f9ae7a60d3aa98 Mon Sep 17 00:00:00 2001 From: Ranjith Kagathi Ananda Date: Wed, 17 Jan 2018 08:09:14 -0800 Subject: [PATCH 127/300] Remove tango_permissions.xml and libtango jar file TangoCore apk is not used anymore and hence these files are removed Test: Tested on taimen Bug: 71862081 Change-Id: I06ebb66c64b5aab7eec3ccacc96d1ae54f652f83 --- device.mk | 4 ---- libtango_device2.jar | Bin 173 -> 0 bytes tango_permissions.xml | 5 ----- 3 files changed, 9 deletions(-) delete mode 100644 libtango_device2.jar delete mode 100644 tango_permissions.xml diff --git a/device.mk b/device.mk index bd629ff4..91576eb3 100755 --- a/device.mk +++ b/device.mk @@ -580,10 +580,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ qcom.bluetooth.soc=cherokee -PRODUCT_COPY_FILES += \ - device/google/wahoo/tango_permissions.xml:system/etc/permissions/tango_permissions.xml \ - device/google/wahoo/libtango_device2.jar:system/framework/libtango_device2.jar - # Privileged permissions whitelist PRODUCT_COPY_FILES += \ device/google/wahoo/permissions/privapp-permissions-aosp_wahoo.xml:system/etc/permissions/privapp-permissions-aosp_wahoo.xml diff --git a/libtango_device2.jar b/libtango_device2.jar deleted file mode 100644 index 36d86087ca5c0b2560b8fd40fd41fbb84876538c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 173 zcmWIWW@Zs#VBp|jSRF0xx~ZP&oiqajgCr1(Ft9NAx`sIFdiuHP`#So0y1532==r++ zJH^28+4sz8A8%c~i@e^tTIbH3-yCFc#rVO~M^Bj;0=yZSM1Y!c83{BQ3E;9Iz?+o~ Oq>K>=-GFo;SPuZ8`6hk< diff --git a/tango_permissions.xml b/tango_permissions.xml deleted file mode 100644 index e7b4fcc0..00000000 --- a/tango_permissions.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - From 5aa4a171176de9ec3939da60504cceb2bdb9d793 Mon Sep 17 00:00:00 2001 From: Siddharth Ray Date: Wed, 17 Jan 2018 10:35:26 -0800 Subject: [PATCH 128/300] Reduced GPS debug Reducing GPS debug for W/T to 3 BUG:72045381 Change-Id: I04c09250fa59c6e9585e2c34e765e11e6b775f3a --- gps.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gps.conf b/gps.conf index 61680665..54482b19 100644 --- a/gps.conf +++ b/gps.conf @@ -26,7 +26,7 @@ NTP_SERVER = time.google.com # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info # 4 - Debug, 5 - Verbose # If DEBUG_LEVEL is commented, Android's logging levels will be used -DEBUG_LEVEL = 5 +DEBUG_LEVEL = 3 # Intermediate position report, 1=enable, 0=disable INTERMEDIATE_POS=0 From adc0f277d3bdd279ef83606c11be8c33536e035c Mon Sep 17 00:00:00 2001 From: Siddharth Ray Date: Wed, 17 Jan 2018 15:19:05 -0800 Subject: [PATCH 129/300] Moved Cellular/Wifi power profile Cellular/Wifi power profile moved to power_profile.xml from config.xml Change-Id: Ib896669775ff5073ea98025d9126565c811860ba --- .../frameworks/base/core/res/res/values/config.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 90413a66..6cb31c01 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -295,18 +295,6 @@ rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max --> 524288,2097152,8388608,262144,524288,4194304 - - 1 - - - 100 - - - 250 - - - 3800 - 6 From 7ac08299336eae15763c572879dd7fe2ca730db1 Mon Sep 17 00:00:00 2001 From: Hridya Valsaraju Date: Wed, 17 Jan 2018 22:54:55 -0800 Subject: [PATCH 130/300] Modify IHealthCallback Interface to return V2_0 HealthInfo Bug: 71860528 Test: vts-tradefed run vts -m VtsHalHealthV2_0 Change-Id: I68907133af5d30b657a6ca248bcd3df47de33ab5 --- health/HealthServiceCommon.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/health/HealthServiceCommon.cpp b/health/HealthServiceCommon.cpp index ece9fd1a..afffe03e 100644 --- a/health/HealthServiceCommon.cpp +++ b/health/HealthServiceCommon.cpp @@ -27,7 +27,7 @@ using android::hardware::IPCThreadState; using android::hardware::configureRpcThreadpool; using android::hardware::handleTransportPoll; using android::hardware::setupTransportPolling; -using android::hardware::health::V1_0::HealthInfo; +using android::hardware::health::V2_0::HealthInfo; using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo; using android::hardware::health::V2_0::IHealth; using android::hardware::health::V2_0::implementation::Health; @@ -68,8 +68,8 @@ void healthd_mode_service_2_0_heartbeat(void) { void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* prop) { HealthInfo info; - convertToHealthInfo(prop, info); - Health::getImplementation()->notifyListeners(info); + convertToHealthInfo(prop, info.legacy); + Health::getImplementation()->notifyListeners(&info); } static struct healthd_mode_ops healthd_mode_service_2_0_ops = { From 0cd6c2991df80d7c86618989f12f180694717178 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 18 Jan 2018 14:24:13 -0800 Subject: [PATCH 131/300] wahoo(init.rc): Don't start supplicant with interfaces Framework will now add interface to supplicant (via HIDL) when it needs to control an interface, so don't specify them in the startup params. Bug: 69426063 Test: Device boots up and able to connect to wifi. Change-Id: I817d28093f8b982e3806c212babd888c0f5eb7c0 --- init.hardware.rc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 2d929756..d4693aa1 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -672,10 +672,6 @@ service vendor.tftp_server /vendor/bin/tftp_server group root system service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ - -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ - -I/vendor/etc/wifi/p2p_supplicant_overlay.conf -N \ - -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ - -I/vendor/etc/wifi/wpa_supplicant_overlay.conf \ -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 -dd \ -g@android:wpa_wlan0 # we will start as root and wpa_supplicant will switch to user wifi From 76a9699fbca13a7acf7fb5b92cc9c4ecf2ce4983 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 8 Jan 2018 17:05:28 -0800 Subject: [PATCH 132/300] Switch to Soundtrigger 2.1 implementation Bug: 68823037 Change-Id: If634345594ea6d574f49d58e29b48165c3b9458b Test: "ok google" and music iq from locked screen --- device.mk | 2 +- manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device.mk b/device.mk index d72be224..fbf8772c 100755 --- a/device.mk +++ b/device.mk @@ -460,7 +460,7 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ android.hardware.audio@2.0-impl \ android.hardware.audio.effect@2.0-impl \ - android.hardware.soundtrigger@2.0-impl \ + android.hardware.soundtrigger@2.1-impl \ android.hardware.audio@2.0-service # stereo speakers: orientation changes swap L/R channels diff --git a/manifest.xml b/manifest.xml index 90ab4746..7784c33d 100644 --- a/manifest.xml +++ b/manifest.xml @@ -286,7 +286,7 @@ android.hardware.soundtrigger hwbinder - 2.0 + 2.1 ISoundTriggerHw default From 00d46c1e0037510cb12bfccd254ca8b8aebf5485 Mon Sep 17 00:00:00 2001 From: Ajay Dudani Date: Fri, 1 Dec 2017 09:57:11 -0800 Subject: [PATCH 133/300] sepolicy: Allow rpm and wifi power stats in user builds [DO NOT MERGE] In order to enable debugging of power issues on 'user' builds, we need to capture rpm stats and wifi power stats from debugfs. Allow this for user builds. Bug: 69003183 Test: Verify rpm & wifi power stats are present in bugreport Change-Id: If9754137f9331832d055ee39d3fd3d5ec79cfc15 --- sepolicy/vendor/hal_power_default.te | 3 --- sepolicy/vendor/kernel.te | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te index aa92c358..b588634b 100644 --- a/sepolicy/vendor/hal_power_default.te +++ b/sepolicy/vendor/hal_power_default.te @@ -4,10 +4,7 @@ allow hal_power_default perfd_socket:sock_file write; allow hal_power_default sysfs_graphics:dir search; allow hal_power_default sysfs_graphics:file r_file_perms; -userdebug_or_eng(` -# debugfs entries are only needed in user-debug or eng builds allow hal_power_default debugfs_rpm:file r_file_perms; allow hal_power_default debugfs_wlan:dir r_dir_perms; allow hal_power_default debugfs_wlan:file r_file_perms; -') diff --git a/sepolicy/vendor/kernel.te b/sepolicy/vendor/kernel.te index 23686463..d2bf9c0f 100644 --- a/sepolicy/vendor/kernel.te +++ b/sepolicy/vendor/kernel.te @@ -1,7 +1,6 @@ # for diag over socket userdebug_or_eng(` allow kernel self:socket create; - allow kernel debugfs_wlan:dir search; ') allow kernel vendor_firmware_file:dir search; @@ -12,3 +11,5 @@ dontaudit kernel kernel:system module_request; allow kernel debugfs_ipc:dir search; allow kernel persist_file:dir search; + +allow kernel debugfs_wlan:dir search; From 8c43e0cea23b7f075ffc7330786fd66951b303fe Mon Sep 17 00:00:00 2001 From: Ajay Dudani Date: Mon, 4 Dec 2017 17:44:01 -0800 Subject: [PATCH 134/300] dumpstate: Add battery type to bugreport & fixup sepolicy [DO NOT MERGE] Add sepolicy for this operation, and update sepolicy to allow collecting batteryinfo in bugreport for user builds. Bug: 70094701, 70094083 Test: Take bugreport, verify battery type is present Change-Id: Id67776301e2ed39a283a08483ac5eb8125aba96b --- dumpstate/DumpstateDevice.cpp | 2 ++ sepolicy/vendor/dumpstate.te | 3 +++ sepolicy/vendor/genfs_contexts | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index efcf8bcf..f50919cd 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -216,6 +216,8 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { RunCommandToFd(fd, "FP LOGS", {"qsee_logger", "-d"}); } + DumpFileToFd(fd, "Battery type", "/sys/class/power_supply/bms/battery_type"); + RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"}); return Void(); }; diff --git a/sepolicy/vendor/dumpstate.te b/sepolicy/vendor/dumpstate.te index ce328ce8..e9932005 100644 --- a/sepolicy/vendor/dumpstate.te +++ b/sepolicy/vendor/dumpstate.te @@ -11,3 +11,6 @@ userdebug_or_eng(` binder_call(dumpstate, per_mgr) ') + +allow hal_dumpstate sysfs_batteryinfo:dir search; +allow hal_dumpstate sysfs_batteryinfo:file rw_file_perms; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 6acbe849..58e4014a 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -53,7 +53,6 @@ genfscon sysfs /devices/soc0 u:object genfscon sysfs /devices/soc/caa0000.qcom,jpeg u:object_r:sysfs_camera:s0 genfscon sysfs /devices/soc/caa4000.qcom,fd u:object_r:sysfs_camera:s0 genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms u:object_r:sysfs_batteryinfo:s0 -genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/capacity u:object_r:sysfs_batteryinfo:s0 genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/capacity u:object_r:sysfs_batteryinfo:s0 genfscon sysfs /bus/msm_subsys u:object_r:sysfs_msm_subsys:s0 genfscon sysfs /module/subsystem_restart u:object_r:sysfs_msm_subsys_restart:s0 From 96b9a25b8e5070cacf9ba6454d964a1a0be54b87 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Fri, 19 Jan 2018 11:27:55 +0900 Subject: [PATCH 135/300] Allow vendor_init to set HAL properties The following properties of bluetooth_prop are set in init scripts. - persist.service.bdroid.snooplog - persist.service.bdroid.fwsnoop - persist.service.bdroid.snooplog - persist.service.bdroid.fwsnoop - persist.service.bdroid.soclog - persist.service.bdroid.soclog And the following properties of power_prop are set in init scripts. - vendor.powerhal.state - vendor.powerhal.audio Bug: 62875318 Test: tested with walleye Change-Id: I7cf63bc6ae575150024df3ec7373c750db923ab3 --- sepolicy/vendor/vendor_init.te | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 21a228a9..6e9a2404 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -1,7 +1,9 @@ allow vendor_init debugfs_clk:file w_file_perms; dontaudit vendor_init kernel:system module_request; +set_prop(vendor_init, bluetooth_prop) set_prop(vendor_init, camera_prop) set_prop(vendor_init, modem_diag_prop) +set_prop(vendor_init, power_prop) set_prop(vendor_init, public_vendor_default_prop) set_prop(vendor_init, vendor_radio_prop) From b4dcb5d2dab7abf5d8dacd6deedca2099c7acb0b Mon Sep 17 00:00:00 2001 From: Nadav Bar Date: Sun, 7 Jan 2018 12:12:01 +0200 Subject: [PATCH 136/300] Add incall music policy to walleye and taimen This change adds the incall music mix port to walleye and taimen audio policy oconfiguration. This change was tested together with a set of additional changes to the audio framework and the HAL which introduces the ability to play pcm audio to the uplink stream. Bug: 69973354. Test: Tested manually. Change-Id: Iec4f72d836cf391645c2af891d62da9c2a6f240c --- audio_policy_configuration.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/audio_policy_configuration.xml b/audio_policy_configuration.xml index 07daa6c8..91d790a0 100644 --- a/audio_policy_configuration.xml +++ b/audio_policy_configuration.xml @@ -73,6 +73,12 @@ + + + + sources="voice_tx,incall_music_uplink"/> Date: Wed, 10 Jan 2018 12:57:08 -0800 Subject: [PATCH 137/300] STOPSHIP: Temporary permission exceptions for AiAi Temporarily granting runtime exceptions for AiAi apk: android.permission.ACCESS_COARSE_LOCATION android.permission.ACCESS_FINE_LOCATION android.permission.READ_CALL_LOG android.permission.CALL_PHONE android.permission.READ_CONTACTS android.permission.READ_CALENDAR android.permission.READ_SMS Test: Built walleye userdebug image and confirmed aiai apk has acquired default permissions. Bug: 68268471 Bug: 72222560 Change-Id: I3106055f14e846b0415f1c35656e8b6f97a5dc69 --- default-permissions.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/default-permissions.xml b/default-permissions.xml index 5c373157..75c5c8fa 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -85,4 +85,21 @@ + + + + + + + + + + + + + + + From b99a4572da553ba8ee42ea75a41df9b362d88a76 Mon Sep 17 00:00:00 2001 From: Brian Duddie Date: Fri, 19 Jan 2018 17:32:13 -0800 Subject: [PATCH 138/300] Update wifi_offload for refactored IChreMessageHandlers Test: build taimen Change-Id: Idcb8d47b2308adc8e31baa67893fb4987e1660ea --- wifi_offload/chre_interface.cpp | 46 ++++++++++++++------------------- wifi_offload/chre_interface.h | 9 ++----- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/wifi_offload/chre_interface.cpp b/wifi_offload/chre_interface.cpp index 448a5782..35c1d7de 100644 --- a/wifi_offload/chre_interface.cpp +++ b/wifi_offload/chre_interface.cpp @@ -21,6 +21,7 @@ #include "chre_host/host_protocol_host.h" +using android::chre::getStringFromByteVector; using android::chre::HostProtocolHost; using flatbuffers::FlatBufferBuilder; @@ -60,36 +61,29 @@ void SocketCallbacks::onDisconnected() { mParent->reportConnectionEvent(ChreInterfaceCallbacks::DISCONNECTED); } -void SocketCallbacks::handleNanoappMessage(uint64_t appId, uint32_t messageType, - uint16_t hostEndpoint, const void* messageData, - size_t messageDataLen) { - LOG(VERBOSE) << "handleNanoappMessage from appId: " << appId; - LOG(VERBOSE) << "HostEndPoint: " << hostEndpoint; - if (appId == chre_constants::kWifiOffloadNanoAppId) { - mParent->handleMessage(messageType, messageData, messageDataLen); +void SocketCallbacks::handleNanoappMessage(const fbs::NanoappMessageT& message) { + LOG(VERBOSE) << "handleNanoappMessage from appId: " << message.app_id; + LOG(VERBOSE) << "HostEndPoint: " << message.host_endpoint; + if (message.app_id == chre_constants::kWifiOffloadNanoAppId) { + mParent->handleMessage(message.message_type, message.message.data(), message.message.size()); } } -void SocketCallbacks::handleHubInfoResponse(const char* name, const char* vendor, - const char* toolchain, uint32_t legacyPlatformVersion, - uint32_t legacyToolchainVersion, float peakMips, - float stoppedPower, float sleepPower, float peakPower, - uint32_t maxMessageLen, uint64_t platformId, - uint32_t version) { +void SocketCallbacks::handleHubInfoResponse(const fbs::HubInfoResponseT& response) { LOG(VERBOSE) << "Hub Info response"; - LOG(VERBOSE) << "Hub Info name: " << name; - LOG(VERBOSE) << "Version : " << version; - LOG(VERBOSE) << "Legacy Platform Version: " << legacyPlatformVersion; - LOG(VERBOSE) << "Legacy Toolchain Version: " << legacyToolchainVersion; - LOG(VERBOSE) << "Peak Mips: " << peakMips; - LOG(VERBOSE) << "Stopped Power: " << stoppedPower; - LOG(VERBOSE) << "Sleep Power: " << sleepPower; - LOG(VERBOSE) << "Peak Power: " << peakPower; - LOG(VERBOSE) << "Platform ID: " << platformId; - LOG(VERBOSE) << "Vendor : " << vendor; - LOG(VERBOSE) << "Toolchain : " << toolchain; - LOG(VERBOSE) << "maxMessageLen : " << maxMessageLen; - if (maxMessageLen < chre_constants::kMaxMessageLen) { + LOG(VERBOSE) << "Hub Info name: " << getStringFromByteVector(response.name); + LOG(VERBOSE) << "Version : " << response.chre_platform_version; + LOG(VERBOSE) << "Legacy Platform Version: " << response.platform_version; + LOG(VERBOSE) << "Legacy Toolchain Version: " << response.toolchain_version; + LOG(VERBOSE) << "Peak Mips: " << response.peak_mips; + LOG(VERBOSE) << "Stopped Power: " << response.stopped_power; + LOG(VERBOSE) << "Sleep Power: " << response.sleep_power; + LOG(VERBOSE) << "Peak Power: " << response.peak_power; + LOG(VERBOSE) << "Platform ID: " << response.platform_id; + LOG(VERBOSE) << "Vendor : " << getStringFromByteVector(response.vendor); + LOG(VERBOSE) << "Toolchain : " << getStringFromByteVector(response.toolchain); + LOG(VERBOSE) << "maxMessageLen : " << response.max_msg_len; + if (response.max_msg_len < chre_constants::kMaxMessageLen) { LOG(WARNING) << "Incorrect max message length"; } } diff --git a/wifi_offload/chre_interface.h b/wifi_offload/chre_interface.h index 92cfa5b6..b4afef2d 100644 --- a/wifi_offload/chre_interface.h +++ b/wifi_offload/chre_interface.h @@ -39,13 +39,8 @@ class SocketCallbacks void onConnected() override; void onConnectionAborted() override; void onDisconnected() override; - void handleNanoappMessage(uint64_t appId, uint32_t messageType, uint16_t hostEndpoint, - const void* messageData, size_t messageDataLen) override; - void handleHubInfoResponse(const char* name, const char* vendor, const char* toolchain, - uint32_t legacyPlatformVersion, uint32_t legacyToolchainVersion, - float peakMips, float stoppedPower, float sleepPower, - float peakPower, uint32_t maxMessageLen, uint64_t platformId, - uint32_t version) override; + void handleNanoappMessage(const ::chre::fbs::NanoappMessageT& message) override; + void handleHubInfoResponse(const ::chre::fbs::HubInfoResponseT& response) override; void handleNanoappListResponse(const ::chre::fbs::NanoappListResponseT& response) override; void handleLoadNanoappResponse(const ::chre::fbs::LoadNanoappResponseT& response) override; void handleUnloadNanoappResponse(const ::chre::fbs::UnloadNanoappResponseT& response) override; From d27f55d8c66742350be897656ed5231f7b2bac83 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 19 Jan 2018 15:54:02 -0800 Subject: [PATCH 139/300] health: remove duplicate HealthServiceCommon code. Test: boots Bug: 63702641 Change-Id: I028ed6a4223517279117ac2c276d32c829dea7bb --- health/Android.bp | 3 +- health/HealthService.cpp | 4 ++ health/HealthServiceCommon.cpp | 86 ---------------------------------- 3 files changed, 5 insertions(+), 88 deletions(-) delete mode 100644 health/HealthServiceCommon.cpp diff --git a/health/Android.bp b/health/Android.bp index 8d405542..e1d9bd3a 100644 --- a/health/Android.bp +++ b/health/Android.bp @@ -19,12 +19,10 @@ cc_binary { proprietary: true, relative_install_path: "hw", srcs: [ - "HealthServiceCommon.cpp", "HealthService.cpp", ], cflags: [ - "-DHEALTH_INSTANCE_NAME=\"default\"", "-Wall", "-Werror", ], @@ -32,6 +30,7 @@ cc_binary { static_libs: [ "android.hardware.health@2.0-impl", "android.hardware.health@1.0-convert", + "libhealthservice", "libbatterymonitor", ], diff --git a/health/HealthService.cpp b/health/HealthService.cpp index 7072ff03..1e7b4508 100644 --- a/health/HealthService.cpp +++ b/health/HealthService.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -130,3 +131,6 @@ void get_disk_stats(std::vector& vec_stats) { return; } +int main(void) { + return health_service_main(); +} diff --git a/health/HealthServiceCommon.cpp b/health/HealthServiceCommon.cpp deleted file mode 100644 index afffe03e..00000000 --- a/health/HealthServiceCommon.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2018 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 "health@2.0/" HEALTH_INSTANCE_NAME -#include - -#include -#include -#include -#include -#include - -using android::hardware::IPCThreadState; -using android::hardware::configureRpcThreadpool; -using android::hardware::handleTransportPoll; -using android::hardware::setupTransportPolling; -using android::hardware::health::V2_0::HealthInfo; -using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo; -using android::hardware::health::V2_0::IHealth; -using android::hardware::health::V2_0::implementation::Health; - -extern int healthd_main(void); - -static int gBinderFd = -1; - -static void binder_event(uint32_t /*epevents*/) { - if (gBinderFd >= 0) handleTransportPoll(gBinderFd); -} - -void healthd_mode_service_2_0_init(struct healthd_config* config) { - LOG(INFO) << LOG_TAG << " Hal is starting up..."; - - gBinderFd = setupTransportPolling(); - - if (gBinderFd >= 0) { - if (healthd_register_event(gBinderFd, binder_event)) - LOG(ERROR) << LOG_TAG << ": Register for binder events failed"; - } - - android::sp service = Health::initInstance(config); - CHECK_EQ(service->registerAsService(HEALTH_INSTANCE_NAME), android::OK) - << LOG_TAG << ": Failed to register HAL"; - - LOG(INFO) << LOG_TAG << ": Hal init done"; -} - -int healthd_mode_service_2_0_preparetowait(void) { - IPCThreadState::self()->flushCommands(); - return -1; -} - -void healthd_mode_service_2_0_heartbeat(void) { - // noop -} - -void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* prop) { - HealthInfo info; - convertToHealthInfo(prop, info.legacy); - Health::getImplementation()->notifyListeners(&info); -} - -static struct healthd_mode_ops healthd_mode_service_2_0_ops = { - .init = healthd_mode_service_2_0_init, - .preparetowait = healthd_mode_service_2_0_preparetowait, - .heartbeat = healthd_mode_service_2_0_heartbeat, - .battery_update = healthd_mode_service_2_0_battery_update, -}; - -int main() { - healthd_mode_ops = &healthd_mode_service_2_0_ops; - LOG(INFO) << LOG_TAG << ": Hal starting main loop..."; - return healthd_main(); -} From 3ef4216053407b8b0d9ff26f622efc2224cbf4c4 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Tue, 23 Jan 2018 13:05:12 -0800 Subject: [PATCH 140/300] Remove vendor access to wpa_socket It violates new restrictions on sharing data between system and vendor processes. Bug: 34980020 Test: build (these are build-time tests). Change-Id: Ie57a7587bb497557e48d0f2940d1fe60f4ee3700 --- sepolicy/vendor/hal_wifi_supplicant_default.te | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sepolicy/vendor/hal_wifi_supplicant_default.te b/sepolicy/vendor/hal_wifi_supplicant_default.te index 4f13574e..cab782ac 100644 --- a/sepolicy/vendor/hal_wifi_supplicant_default.te +++ b/sepolicy/vendor/hal_wifi_supplicant_default.te @@ -4,7 +4,3 @@ typeattribute hal_wifi_supplicant_default data_between_core_and_vendor_violators allow hal_wifi_supplicant_default wifi_data_file:dir create_dir_perms; allow hal_wifi_supplicant_default wifi_data_file:file create_file_perms; - -# Create a socket for receiving info from wpa -allow hal_wifi_supplicant_default wpa_socket:dir create_dir_perms; -allow hal_wifi_supplicant_default wpa_socket:sock_file create_file_perms; From b0d2703467c90378aed0fad730399bb82610bcfe Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 23 Jan 2018 14:26:03 -0800 Subject: [PATCH 141/300] Remove deprecated tags from wahoo manifest. Bug: N/A Test: N/A Change-Id: If522fb1934de36d21921fe9492d1ffc72bc17145 --- manifest.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifest.xml b/manifest.xml index 7784c33d..7fd0ea95 100644 --- a/manifest.xml +++ b/manifest.xml @@ -439,7 +439,6 @@ com.quicinc.cne.server hwbinder - 1.0 IServer @@ -449,7 +448,6 @@ com.quicinc.cne.api hwbinder - 1.0 IApiService From 9244427d036ae2b0891929f0d98ebf211cb01bf0 Mon Sep 17 00:00:00 2001 From: Jeffrey Vander Stoep Date: Wed, 24 Jan 2018 01:17:53 +0000 Subject: [PATCH 142/300] Revert "Remove vendor access to wpa_socket" This reverts commit 3ef4216053407b8b0d9ff26f622efc2224cbf4c4. rpius@ says that this can cause some devices to fail to boot. Reverting and will re-test/resubmit tomorrow. Change-Id: I48f033516b93d10edc77a277de49a3e21a068930 --- sepolicy/vendor/hal_wifi_supplicant_default.te | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sepolicy/vendor/hal_wifi_supplicant_default.te b/sepolicy/vendor/hal_wifi_supplicant_default.te index cab782ac..4f13574e 100644 --- a/sepolicy/vendor/hal_wifi_supplicant_default.te +++ b/sepolicy/vendor/hal_wifi_supplicant_default.te @@ -4,3 +4,7 @@ typeattribute hal_wifi_supplicant_default data_between_core_and_vendor_violators allow hal_wifi_supplicant_default wifi_data_file:dir create_dir_perms; allow hal_wifi_supplicant_default wifi_data_file:file create_file_perms; + +# Create a socket for receiving info from wpa +allow hal_wifi_supplicant_default wpa_socket:dir create_dir_perms; +allow hal_wifi_supplicant_default wpa_socket:sock_file create_file_perms; From 0292352f5eac4dbaa84714b24c7b914c4bc4adb0 Mon Sep 17 00:00:00 2001 From: Kelly Rossmoyer Date: Tue, 23 Jan 2018 15:52:44 -0800 Subject: [PATCH 143/300] Low Power Monitor security policies for wahoo Adds a security policy allowing ConnectivityMonitor to access the new system property controlling startup of the Low Power Monitor service. Also adds security policies allowing ConnectivityMonitor to access the device PowerHAL service, which is used on 2017 devices to obtain low power operation stats. Error 1 (related to PowerHAL access): 01-24 11:20:41.444 589 589 E SELinux : avc: denied { find } for interface=android.hardware.power::IPower pid=3964 scontext=u:r:con_monitor_app:s0:c233,c259,c512,c768 tcontext=u:object_r:hal_power_hwservice:s0 tclass=hwservice_manager permissive=0 Policy 1: allow con_monitor_app hal_power_hwservice:hwservice_manager find; Error 2 (also related to PowerHAL access): 01-24 11:28:37.527 3971 3971 W ectivitymonitor: type=1400 audit(0.0:12): avc: denied { call } for scontext=u:r:con_monitor_app:s0:c233,c259,c512,c768 tcontext=u:r:hal_power_default:s0 tclass=binder permissive=0 Policy 2: allow con_monitor_app hal_power_default:binder call; Error 3 (related to setting system property): 01-24 11:37:41.853 3756 3756 W libc : Unable to set property "persist.radio.poweranomaly.start" to "disabled": error code: 0x18 01-24 11:37:41.854 3756 3756 D AndroidRuntime: Shutting down VM --------- beginning of crash 01-24 11:37:41.855 3756 3756 E AndroidRuntime: FATAL EXCEPTION: main 01-24 11:37:41.855 3756 3756 E AndroidRuntime: Process: com.google.android.connectivitymonitor, PID: 3756 01-24 11:37:41.855 3756 3756 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.google.android.connectivitymonitor.GservicesChangeReceiver: java.lang.RuntimeException: failed to set system property Policy 3: persist.radio.lowpowermonitor.start u:object_r:tel_mon_prop:s0 Bug:35955665 Test: All policies taken from audit2allow (see commit text) and tested before/after policy change to establish correctness. Change-Id: I02bb85a8fd39f3003c035a1ac8f28622d1f0ecc2 --- sepolicy/vendor/con_monitor.te | 3 +++ sepolicy/vendor/property_contexts | 1 + 2 files changed, 4 insertions(+) diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te index 96483ac7..ee1f0f0c 100644 --- a/sepolicy/vendor/con_monitor.te +++ b/sepolicy/vendor/con_monitor.te @@ -7,3 +7,6 @@ set_prop(con_monitor_app, tel_mon_prop) allow con_monitor_app app_api_service:service_manager find; allow con_monitor_app radio_vendor_data_file:dir rw_dir_perms; allow con_monitor_app radio_vendor_data_file:file create_file_perms; +allow con_monitor_app hal_power_hwservice:hwservice_manager find; +allow con_monitor_app hal_power_default:binder call; + diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 611b45e4..3c3046b0 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -22,6 +22,7 @@ persist.sys.modem.diag. u:object_r:modem_diag_prop:s0 sys.modem.diag. u:object_r:modem_diag_prop:s0 persist.radio.enable_tel_mon u:object_r:tel_mon_prop:s0 persist.radio.poweranomaly.start u:object_r:tel_mon_prop:s0 +persist.radio.lowpowermonitor.start u:object_r:tel_mon_prop:s0 sys.time.set u:object_r:sys_time_prop:s0 persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 From 4c05539d6cfbdb38131ea667c411c2da59b8534a Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Wed, 24 Jan 2018 08:57:13 -0800 Subject: [PATCH 144/300] wpa_supplicant: move control sockets to /data/vendor Treble compliance. Bug: 70228425 Bug: 70393317 Test: complete wifi test in b/70393317 Test: Test wifi on Taimen and Sailfish Test: verify sockets exist in /data/vendor/wifi/wpa/sockets Change-Id: I0bfc3a351419f0a03498e79664949f353369bf1b --- init.hardware.rc | 6 ++++-- sepolicy/vendor/hal_wifi_supplicant_default.te | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 9f3c49ac..d00eb4c2 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -283,8 +283,10 @@ on zygote-start # Create the directories used by the Wireless subsystem mkdir /data/misc/wifi 0770 wifi wifi - mkdir /data/misc/wifi/sockets 0770 wifi wifi mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi + mkdir /data/vendor/wifi 0770 wifi wifi + mkdir /data/vendor/wifi/wpa 0770 wifi wifi + mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi mkdir /data/misc/dhcp 0770 dhcp dhcp chown dhcp dhcp /data/misc/dhcp @@ -668,7 +670,7 @@ service vendor.tftp_server /vendor/bin/tftp_server group root system service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ - -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 -dd \ + -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 -dd \ -g@android:wpa_wlan0 # we will start as root and wpa_supplicant will switch to user wifi # after setting up the capabilities required for WEXT diff --git a/sepolicy/vendor/hal_wifi_supplicant_default.te b/sepolicy/vendor/hal_wifi_supplicant_default.te index 4f13574e..cab782ac 100644 --- a/sepolicy/vendor/hal_wifi_supplicant_default.te +++ b/sepolicy/vendor/hal_wifi_supplicant_default.te @@ -4,7 +4,3 @@ typeattribute hal_wifi_supplicant_default data_between_core_and_vendor_violators allow hal_wifi_supplicant_default wifi_data_file:dir create_dir_perms; allow hal_wifi_supplicant_default wifi_data_file:file create_file_perms; - -# Create a socket for receiving info from wpa -allow hal_wifi_supplicant_default wpa_socket:dir create_dir_perms; -allow hal_wifi_supplicant_default wpa_socket:sock_file create_file_perms; From a1c63b3579387ac4def98511c0c9ec873dc501e8 Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Wed, 24 Jan 2018 17:58:16 -0800 Subject: [PATCH 145/300] Add "android.hardware.camera.ar" feature to Pixel 2 Test: New SystemFeatureTest passes Bug: 63629224 Bug: 70565622 Change-Id: Id9466248ed9ccd6ad1d6df1092f37f0fdd040ae8 --- device.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/device.mk b/device.mk index fbf8772c..437d3e37 100755 --- a/device.mk +++ b/device.mk @@ -136,6 +136,7 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \ frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml\ frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml\ + frameworks/native/data/etc/android.hardware.camera.ar.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.ar.xml\ frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \ frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \ From 5e309b924830644827182e039e915e5ba314a81f Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Fri, 19 Jan 2018 06:08:52 -0800 Subject: [PATCH 146/300] Usb Gadget hal implementation for wahoo (cherry-pick of commit: e9af4669659c306a9c9b1a1ae3a1313a7631357d) Bug: 63669128 Test: Tested USB gadget configurations and verified that they enumerated. Change-Id: If0f98697488f6c7cfe335d4c292acebaaba6c20f --- init.hardware.diag.rc.userdebug | 311 +---------- init.hardware.usb.rc | 87 +-- manifest.xml | 9 + sepolicy/vendor/file_contexts | 2 +- sepolicy/vendor/hal_usb_default.te | 7 - sepolicy/vendor/hal_usb_impl.te | 14 + usb/Android.bp | 7 +- usb/Usb.cpp | 2 +- usb/Usb.h | 2 +- usb/UsbGadget.cpp | 497 ++++++++++++++++++ usb/UsbGadget.h | 99 ++++ usb/android.hardware.usb@1.1-service.wahoo.rc | 2 +- usb/service.cpp | 36 +- 13 files changed, 657 insertions(+), 418 deletions(-) delete mode 100644 sepolicy/vendor/hal_usb_default.te create mode 100644 sepolicy/vendor/hal_usb_impl.te create mode 100644 usb/UsbGadget.cpp create mode 100644 usb/UsbGadget.h diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index c0536379..72a9317a 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -27,316 +27,7 @@ on post-fs-data mkdir /data/vendor/wifi 0777 system system mkdir /data/vendor/wifi/cnss_diag 0777 system system -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x900E - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,adb && property:sys.usb.configfs=1 - start adbd - - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_adb" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x901D - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,serial_cdev,rmnet_gsi,adb && property:sys.usb.configfs=1 - start adbd - start vendor.port-bridge - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,rmnet_gsi,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Default composition" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9091 - write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/gsi.rmnet /config/usb_gadget/g1/configs/b.1/f3 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,serial_cdev,rmnet_gsi && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Default comp without ADB" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9092 - write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/gsi.rmnet /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - start vendor.port-bridge - -on property:sys.usb.config=rndis,diag && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x902C - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,diag,adb && property:sys.usb.configfs=1 - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_adb" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x902D - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,serial_cdev,diag && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_dun_diag" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x90B5 - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - start vendor.port-bridge - -on property:sys.usb.config=rndis,serial_cdev,diag,adb && property:sys.usb.configfs=1 - start adbd - start vendor.port-bridge - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,serial_cdev,diag,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_dun_diag" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x90B6 - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f3 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=mtp,diag && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_diag" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x901B - symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=mtp,diag,adb && property:sys.usb.configfs=1 - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,diag,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_diag_adb" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x903A - symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,qdss && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x904A - write /config/usb_gadget/g1/functions/qdss.qdss/enable_debug_inface 1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f2 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,qdss,adb && property:sys.usb.configfs=1 - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,qdss,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss_adb" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9060 - write /config/usb_gadget/g1/functions/qdss.qdss/enable_debug_inface 1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,qdss,rmnet_gsi && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss_rmnet" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9083 - write /config/usb_gadget/g1/functions/qdss.qdss/enable_debug_inface 1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/gsi.rmnet /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,qdss,rmnet_gsi,adb && property:sys.usb.configfs=1 - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,qdss,rmnet_gsi,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss_rmnet_adb" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9084 - write /config/usb_gadget/g1/functions/qdss.qdss/enable_debug_inface 1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/gsi.rmnet /config/usb_gadget/g1/configs/b.1/f3 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,diag,qdss && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_qdss" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9081 - write /config/usb_gadget/g1/functions/qdss.qdss/enable_debug_inface 1 - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,diag,qdss,adb && property:sys.usb.configfs=1 - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,qdss,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_qdss_adb" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9082 - write /config/usb_gadget/g1/functions/qdss.qdss/enable_debug_inface 1 - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,serial_cdev && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x9004 - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - start vendor.port-bridge - -on property:sys.usb.config=diag,adb,serial_cdev && property:sys.usb.configfs=1 - start adbd - start vendor.port-bridge - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,adb,serial_cdev && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_adb_dun" - rm /config/usb_gadget/g1/configs/b.1/f1 - rm /config/usb_gadget/g1/configs/b.1/f2 - rm /config/usb_gadget/g1/configs/b.1/f3 - rm /config/usb_gadget/g1/configs/b.1/f4 - rm /config/usb_gadget/g1/configs/b.1/f5 - write /config/usb_gadget/g1/idVendor 0x05C6 - write /config/usb_gadget/g1/idProduct 0x901f - symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 - symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 - symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f3 - write /config/usb_gadget/g1/UDC ${sys.usb.controller} - setprop sys.usb.state ${sys.usb.config} - -service vendor.diag_mdlog_start /vendor/bin/diag_mdlog +service diag_mdlog_start /vendor/bin/diag_mdlog class late_start user shell group system diag media_rw diff --git a/init.hardware.usb.rc b/init.hardware.usb.rc index 0ecc976e..c504a40e 100644 --- a/init.hardware.usb.rc +++ b/init.hardware.usb.rc @@ -14,10 +14,10 @@ # limitations under the License. # -on boot +on early-boot mount configfs none /config - mkdir /config/usb_gadget/g1 0770 shell shell - mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell + mkdir /config/usb_gadget/g1 0770 + mkdir /config/usb_gadget/g1/strings/0x409 0770 write /config/usb_gadget/g1/bcdUSB 0x0200 write /config/usb_gadget/g1/idVendor 0x18d1 write /config/usb_gadget/g1/bcdDevice 0x0440 @@ -36,93 +36,22 @@ on boot mkdir /config/usb_gadget/g1/functions/gsi.rmnet mkdir /config/usb_gadget/g1/functions/gsi.rndis mkdir /config/usb_gadget/g1/functions/qdss.qdss - mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell - mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell + mkdir /config/usb_gadget/g1/configs/b.1 0770 + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" mkdir /dev/usb-ffs 0775 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell - mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 + mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000 mkdir /dev/usb-ffs/mtp 0770 mtp mtp mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 setprop sys.usb.ffs.max_write 524288 setprop sys.usb.ffs.max_read 524288 setprop sys.usb.mtp.device_type 3 - setprop sys.usb.configfs 1 setprop sys.usb.controller "a800000.dwc3" write /sys/module/libcomposite/parameters/disable_l1_for_hs "y" symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 write /config/usb_gadget/g1/functions/gsi.rndis/rndis_wceis 1 -on property:sys.usb.config=none && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/os_desc/use 0 - -on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee1 - write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 - -on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee2 - write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 - -on property:sys.usb.config=rndis && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee3 - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee4 - symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 - -on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee5 - write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 - -on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee6 - write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 - -on property:sys.usb.config=adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee7 - -on property:sys.usb.config=midi && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee8 - -on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x4ee9 - -on property:sys.usb.config=accessory && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x2d00 - -on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x2d01 - -on property:sys.usb.config=audio_source && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x2d02 - -on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x2d03 - -on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x2d04 - -on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 - write /config/usb_gadget/g1/idVendor 0x18d1 - write /config/usb_gadget/g1/idProduct 0x2d05 +on boot + setprop sys.usb.configfs 2 diff --git a/manifest.xml b/manifest.xml index 7784c33d..67e194ca 100644 --- a/manifest.xml +++ b/manifest.xml @@ -328,6 +328,15 @@ default + + android.hardware.usb.gadget + hwbinder + 1.0 + + IUsbGadget + default + + android.hardware.vibrator hwbinder diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 2a04bf73..ffffe6a6 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -170,7 +170,7 @@ /vendor/bin/hw/android\.hardware\.oemlock@1\.0-service u:object_r:hal_oemlock_default_exec:s0 /vendor/bin/oemlock_provision u:object_r:hal_bootctl_default_exec:s0 /vendor/bin/oemlock-bridge u:object_r:hal_bootctl_default_exec:s0 -/vendor/bin/hw/android\.hardware\.usb@1\.1-service.wahoo u:object_r:hal_usb_default_exec:s0 +/vendor/bin/hw/android\.hardware\.usb@1\.1-service.wahoo u:object_r:hal_usb_impl_exec:s0 /vendor/bin/hw/android\.hardware\.power@1\.2-service.wahoo u:object_r:hal_power_default_exec:s0 /vendor/bin/hw/android\.hardware\.power@1\.2-service.wahoo-libperfmgr u:object_r:hal_power_default_exec:s0 /vendor/bin/hw/android\.hardware\.thermal@1\.0-service.wahoo u:object_r:hal_thermal_default_exec:s0 diff --git a/sepolicy/vendor/hal_usb_default.te b/sepolicy/vendor/hal_usb_default.te deleted file mode 100644 index e085b3a5..00000000 --- a/sepolicy/vendor/hal_usb_default.te +++ /dev/null @@ -1,7 +0,0 @@ -allow hal_usb_default sysfs_msm_subsys:dir search; -allow hal_usb_default sysfs_msm_subsys:file r_file_perms; -allow hal_usb_default sysfs_usb_c:dir r_dir_perms; -allow hal_usb_default sysfs_usb_c:lnk_file read; -allow hal_usb_default sysfs_usb_c:file rw_file_perms; -allow hal_usb_default sysfs_usb_device:dir r_dir_perms; -allow hal_usb_default sysfs_usb_device:file rw_file_perms; diff --git a/sepolicy/vendor/hal_usb_impl.te b/sepolicy/vendor/hal_usb_impl.te new file mode 100644 index 00000000..ddbf8f33 --- /dev/null +++ b/sepolicy/vendor/hal_usb_impl.te @@ -0,0 +1,14 @@ +type hal_usb_impl, domain; +hal_server_domain(hal_usb_impl, hal_usb) +hal_server_domain(hal_usb_impl, hal_usb_gadget) + +type hal_usb_impl_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_usb_impl) + +allow hal_usb_impl sysfs_msm_subsys:dir search; +allow hal_usb_impl sysfs_msm_subsys:file r_file_perms; +r_dir_file(hal_usb_impl, sysfs_usb_c) +allow hal_usb_impl sysfs_usb_c:file w_file_perms; +allow hal_usb_impl sysfs_usb_device:dir r_dir_perms; +allow hal_usb_impl sysfs_usb_device:file rw_file_perms; +allow hal_usb_impl configfs:file create_file_perms; diff --git a/usb/Android.bp b/usb/Android.bp index f5bde70a..258c436b 100644 --- a/usb/Android.bp +++ b/usb/Android.bp @@ -16,11 +16,7 @@ cc_binary { name: "android.hardware.usb@1.1-service.wahoo", relative_install_path: "hw", init_rc: ["android.hardware.usb@1.1-service.wahoo.rc"], - srcs: ["service.cpp", "Usb.cpp"], - cflags: [ - "-Wall", - "-Werror", - ], + srcs: ["service.cpp", "Usb.cpp", "UsbGadget.cpp"], shared_libs: [ "libbase", "libhidlbase", @@ -30,6 +26,7 @@ cc_binary { "libhardware", "android.hardware.usb@1.0", "android.hardware.usb@1.1", + "android.hardware.usb.gadget@1.0", "libcutils", ], proprietary: true, diff --git a/usb/Usb.cpp b/usb/Usb.cpp index 5f8bdce4..0644b810 100644 --- a/usb/Usb.cpp +++ b/usb/Usb.cpp @@ -238,7 +238,7 @@ Usb::Usb() Return Usb::switchRole(const hidl_string &portName, - const PortRole &newRole) { + const V1_0::PortRole &newRole) { std::string filename = appendRoleNodeHelper(std::string(portName.c_str()), newRole.type); std::string written; diff --git a/usb/Usb.h b/usb/Usb.h index 78be2f90..09bfdf92 100644 --- a/usb/Usb.h +++ b/usb/Usb.h @@ -42,7 +42,7 @@ using ::android::sp; struct Usb : public IUsb { Usb(); - Return switchRole(const hidl_string& portName, const PortRole& role) override; + Return switchRole(const hidl_string& portName, const V1_0::PortRole& role) override; Return setCallback(const sp& callback) override; Return queryPortStatus() override; diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp new file mode 100644 index 00000000..e1ee289a --- /dev/null +++ b/usb/UsbGadget.cpp @@ -0,0 +1,497 @@ +/* + * Copyright (C) 2018 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.usb.gadget@1.0-service.wahoo" + +#include "UsbGadget.h" +#include +#include +#include +#include +#include +#include +#include +#include + +constexpr int BUFFER_SIZE = 512; +constexpr int MAX_FILE_PATH_LENGTH = 256; +constexpr int EPOLL_EVENTS = 10; +constexpr bool DEBUG = false; +constexpr int DISCONNECT_WAIT_US = 10000; + +#define GADGET_PATH "/config/usb_gadget/g1/" +#define PULLUP_PATH GADGET_PATH "UDC" +#define GADGET_NAME "a800000.dwc3" +#define PERSISTENT_BOOT_MODE "ro.bootmode" +#define VENDOR_ID_PATH GADGET_PATH "idVendor" +#define PRODUCT_ID_PATH GADGET_PATH "idProduct" +#define DEVICE_CLASS_PATH GADGET_PATH "bDeviceClass" +#define DEVICE_SUB_CLASS_PATH GADGET_PATH "bDeviceSubClass" +#define DEVICE_PROTOCOL_PATH GADGET_PATH "bDeviceProtocol" +#define DESC_USE_PATH GADGET_PATH "os_desc/use" +#define OS_DESC_PATH GADGET_PATH "os_desc/b.1" +#define CONFIG_PATH GADGET_PATH "configs/b.1/" +#define FUNCTIONS_PATH GADGET_PATH "functions/" +#define FUNCTION_NAME "function" +#define FUNCTION_PATH CONFIG_PATH FUNCTION_NAME +#define RNDIS_PATH FUNCTIONS_PATH "gsi.rndis" + +namespace android { +namespace hardware { +namespace usb { +namespace gadget { +namespace V1_0 { +namespace implementation { + +volatile bool gadgetPullup; + +// Used for debug. +static void displayInotifyEvent(struct inotify_event *i) { + ALOGE(" wd =%2d; ", i->wd); + if (i->cookie > 0) ALOGE("cookie =%4d; ", i->cookie); + + ALOGE("mask = "); + if (i->mask & IN_ACCESS) ALOGE("IN_ACCESS "); + if (i->mask & IN_ATTRIB) ALOGE("IN_ATTRIB "); + if (i->mask & IN_CLOSE_NOWRITE) ALOGE("IN_CLOSE_NOWRITE "); + if (i->mask & IN_CLOSE_WRITE) ALOGE("IN_CLOSE_WRITE "); + if (i->mask & IN_CREATE) ALOGE("IN_CREATE "); + if (i->mask & IN_DELETE) ALOGE("IN_DELETE "); + if (i->mask & IN_DELETE_SELF) ALOGE("IN_DELETE_SELF "); + if (i->mask & IN_IGNORED) ALOGE("IN_IGNORED "); + if (i->mask & IN_ISDIR) ALOGE("IN_ISDIR "); + if (i->mask & IN_MODIFY) ALOGE("IN_MODIFY "); + if (i->mask & IN_MOVE_SELF) ALOGE("IN_MOVE_SELF "); + if (i->mask & IN_MOVED_FROM) ALOGE("IN_MOVED_FROM "); + if (i->mask & IN_MOVED_TO) ALOGE("IN_MOVED_TO "); + if (i->mask & IN_OPEN) ALOGE("IN_OPEN "); + if (i->mask & IN_Q_OVERFLOW) ALOGE("IN_Q_OVERFLOW "); + if (i->mask & IN_UNMOUNT) ALOGE("IN_UNMOUNT "); + ALOGE("\n"); + + if (i->len > 0) ALOGE(" name = %s\n", i->name); +} + +static void *monitorFfs(void *param) { + UsbGadget *usbGadget = (UsbGadget *)param; + char buf[BUFFER_SIZE]; + bool writeUdc = true, stopMonitor = false; + struct epoll_event events[EPOLL_EVENTS]; + + bool descriptorWritten = true; + for (int i = 0; i < static_cast(usbGadget->mEndpointList.size()); i++) { + if (access(usbGadget->mEndpointList.at(i).c_str(), R_OK)) { + descriptorWritten = false; + break; + } + } + + // notify here if the endpoints are already present. + if (descriptorWritten && !!WriteStringToFile(GADGET_NAME, PULLUP_PATH)) { + lock_guard lock(usbGadget->mLock); + usbGadget->mCurrentUsbFunctionsApplied = true; + gadgetPullup = true; + usbGadget->mCv.notify_all(); + } + + while (!stopMonitor) { + int nrEvents = epoll_wait(usbGadget->mEpollFd, events, EPOLL_EVENTS, -1); + if (nrEvents <= 0) { + ALOGE("epoll wait did not return descriptor number"); + continue; + } + + for (int i = 0; i < nrEvents; i++) { + ALOGI("event=%u on fd=%d\n", events[i].events, events[i].data.fd); + + if (events[i].data.fd == usbGadget->mInotifyFd) { + // Process all of the events in buffer returned by read(). + int numRead = read(usbGadget->mInotifyFd, buf, BUFFER_SIZE); + for (char *p = buf; p < buf + numRead;) { + struct inotify_event *event = (struct inotify_event *)p; + if (DEBUG) displayInotifyEvent(event); + + p += sizeof(struct inotify_event) + event->len; + + bool descriptorPresent = true; + for (int j = 0; j < static_cast(usbGadget->mEndpointList.size()); + j++) { + if (access(usbGadget->mEndpointList.at(j).c_str(), R_OK)) { + if (DEBUG) + ALOGI("%s absent", usbGadget->mEndpointList.at(j).c_str()); + descriptorPresent = false; + break; + } + } + + if (!descriptorPresent && !writeUdc) { + if (DEBUG) ALOGI("endpoints not up"); + writeUdc = true; + } else if (descriptorPresent && writeUdc && + !!WriteStringToFile(GADGET_NAME, PULLUP_PATH)) { + lock_guard lock(usbGadget->mLock); + usbGadget->mCurrentUsbFunctionsApplied = true; + ALOGI("GADGET pulled up"); + writeUdc = false; + gadgetPullup = true; + // notify the main thread to signal userspace. + usbGadget->mCv.notify_all(); + } + } + } else { + uint64_t flag; + read(usbGadget->mEventFd, &flag, sizeof(flag)); + if (flag == 100) { + stopMonitor = true; + break; + } + } + } + } + return NULL; +} + +UsbGadget::UsbGadget() { + if (access(OS_DESC_PATH, R_OK) != 0) + ALOGE("configfs setup not done yet"); +} + +static int unlinkFunctions(const char *path) { + DIR *config = opendir(path); + struct dirent *function; + char filepath[MAX_FILE_PATH_LENGTH]; + int ret = 0; + + if (config == NULL) return -1; + + // d_type does not seems to be supported in /config + // so filtering by name. + while (((function = readdir(config)) != NULL)) { + if ((strstr(function->d_name, FUNCTION_NAME) == NULL)) continue; + // build the path for each file in the folder. + sprintf(filepath, "%s/%s", path, function->d_name); + ret = remove(filepath); + if (ret) { + ALOGE("Unable remove file %s errno:%d", filepath, errno); + break; + } + } + + closedir(config); + return ret; +} + +static int addEpollFd(const unique_fd &epfd, const unique_fd &fd) { + struct epoll_event event; + int ret; + + event.data.fd = fd; + event.events = EPOLLIN; + + ret = epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &event); + if (ret) ALOGE("epoll_ctl error %d", errno); + + return ret; +} + +Return UsbGadget::getCurrentUsbFunctions( + const sp &callback) { + Return ret = callback->getCurrentUsbFunctionsCb( + mCurrentUsbFunctions, mCurrentUsbFunctionsApplied + ? Status::FUNCTIONS_APPLIED + : Status::FUNCTIONS_NOT_APPLIED); + if (!ret.isOk()) + ALOGE("Call to getCurrentUsbFunctionsCb failed %s", + ret.description().c_str()); + + return Void(); +} + +V1_0::Status UsbGadget::tearDownGadget() { + ALOGI("setCurrentUsbFunctions None"); + + if (!WriteStringToFile("none", PULLUP_PATH)) + ALOGI("Gadget cannot be pulled down"); + + if (!WriteStringToFile("0", DEVICE_CLASS_PATH)) return Status::ERROR; + + if (!WriteStringToFile("0", DEVICE_SUB_CLASS_PATH)) return Status::ERROR; + + if (!WriteStringToFile("0", DEVICE_PROTOCOL_PATH)) return Status::ERROR; + + if (!WriteStringToFile("0", DESC_USE_PATH)) return Status::ERROR; + + if (unlinkFunctions(CONFIG_PATH)) return Status::ERROR; + + if (mMonitorCreated) { + uint64_t flag = 100; + // Stop the monitor thread by writing into signal fd. + write(mEventFd, &flag, sizeof(flag)); + mMonitor->join(); + mMonitorCreated = false; + ALOGI("mMonitor destroyed"); + } else { + ALOGI("mMonitor not running"); + } + + mInotifyFd.reset(-1); + mEventFd.reset(-1); + mEpollFd.reset(-1); + mEndpointList.clear(); + return Status::SUCCESS; +} + +static int linkFunction(const char *function, int index) { + char functionPath[MAX_FILE_PATH_LENGTH]; + char link[MAX_FILE_PATH_LENGTH]; + + sprintf(functionPath, "%s%s", FUNCTIONS_PATH, function); + sprintf(link, "%s%d", FUNCTION_PATH, index); + if (symlink(functionPath, link)) { + ALOGE("Cannot create symlink %s -> %s errno:%d", link, functionPath, errno); + return -1; + } + return 0; +} + +static V1_0::Status setVidPid(const char *vid, const char *pid) { + if (!WriteStringToFile(vid, VENDOR_ID_PATH)) return Status::ERROR; + + if (!WriteStringToFile(pid, PRODUCT_ID_PATH)) return Status::ERROR; + + return Status::SUCCESS; +} + +static V1_0::Status validateAndSetVidPid(uint64_t functions) { + V1_0::Status ret = Status::SUCCESS; + switch (functions) { + case static_cast(GadgetFunction::MTP): + ret = setVidPid("0x18d1", "0x4ee1"); + break; + case GadgetFunction::ADB | GadgetFunction::MTP: + ret = setVidPid("0x18d1", "0x4ee2"); + break; + case static_cast(GadgetFunction::RNDIS): + ret = setVidPid("0x18d1", "0x4ee3"); + break; + case GadgetFunction::ADB | GadgetFunction::RNDIS: + ret = setVidPid("0x18d1", "0x4ee4"); + break; + case static_cast(GadgetFunction::PTP): + ret = setVidPid("0x18d1", "0x4ee5"); + break; + case GadgetFunction::ADB | GadgetFunction::PTP: + ret = setVidPid("0x18d1", "0x4ee6"); + break; + case static_cast(GadgetFunction::ADB): + ret = setVidPid("0x18d1", "0x4ee7"); + break; + case static_cast(GadgetFunction::MIDI): + ret = setVidPid("0x18d1", "0x4ee8"); + break; + case GadgetFunction::ADB | GadgetFunction::MIDI: + ret = setVidPid("0x18d1", "0x4ee9"); + break; + case static_cast(GadgetFunction::ACCESSORY): + ret = setVidPid("0x18d1", "0x2d00"); + break; + case GadgetFunction::ADB | GadgetFunction::ACCESSORY: + ret = setVidPid("0x18d1", "0x2d01"); + break; + default: + ALOGE("Combination not supported"); + ret = Status::CONFIGURATION_NOT_SUPPORTED; + } + return ret; +} + +V1_0::Status UsbGadget::setupFunctions( + uint64_t functions, const sp &callback, + uint64_t timeout) { + std::unique_lock lk(mLock); + + unique_fd inotifyFd(inotify_init()); + if (inotifyFd < 0) { + ALOGE("inotify init failed"); + return Status::ERROR; + } + + bool ffsEnabled = false; + int i = 0; + std::string bootMode = GetProperty(PERSISTENT_BOOT_MODE, ""); + + if (((functions & GadgetFunction::PTP) != 0) || + ((functions & GadgetFunction::MTP) != 0)) { + ffsEnabled = true; + ALOGI("setCurrentUsbFunctions mtp"); + if (!WriteStringToFile("1", DESC_USE_PATH)) return Status::ERROR; + + if (inotify_add_watch(inotifyFd, "/dev/usb-ffs/mtp/", IN_ALL_EVENTS) == -1) + return Status::ERROR; + + + if (linkFunction("ffs.mtp", i++)) return Status::ERROR; + + // Add endpoints to be monitored. + mEndpointList.push_back("/dev/usb-ffs/mtp/ep1"); + mEndpointList.push_back("/dev/usb-ffs/mtp/ep2"); + mEndpointList.push_back("/dev/usb-ffs/mtp/ep3"); + } + + if ((functions & GadgetFunction::MIDI) != 0) { + ALOGI("setCurrentUsbFunctions MIDI"); + if (linkFunction("midi.gs5", i++)) return Status::ERROR;; + } + + if ((functions & GadgetFunction::ACCESSORY) != 0) { + ALOGI("setCurrentUsbFunctions Accessory"); + if (linkFunction("accessory.gs2", i++)) return Status::ERROR; + } + + if ((functions & GadgetFunction::RNDIS) != 0) { + ALOGI("setCurrentUsbFunctions rndis"); + if (linkFunction("gsi.rndis", i++)) return Status::ERROR; + } + + if (bootMode == "usbradio") { + ALOGI("enable usbradio debug functions"); + if (linkFunction("diag.diag", i++)) return Status::ERROR; + if (linkFunction("cser.dun.0", i++)) return Status::ERROR; + if (linkFunction("gsi.rmnet", i++)) return Status::ERROR; + } + + if ((functions & GadgetFunction::ADB) != 0) { + ffsEnabled = true; + ALOGI("setCurrentUsbFunctions Adb"); + if (inotify_add_watch(inotifyFd, "/dev/usb-ffs/adb/", IN_ALL_EVENTS) == -1) + return Status::ERROR; + + if (linkFunction("ffs.adb", i++)) return Status::ERROR; + mEndpointList.push_back("/dev/usb-ffs/adb/ep1"); + mEndpointList.push_back("/dev/usb-ffs/adb/ep2"); + ALOGI("Service started"); + } + + // Pull up the gadget right away when there are no ffs functions. + if (!ffsEnabled) { + if (!WriteStringToFile(GADGET_NAME, PULLUP_PATH)) return Status::ERROR; + mCurrentUsbFunctionsApplied = true; + if (callback) + callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS); + return Status::SUCCESS; + } + + unique_fd eventFd(eventfd(0, 0)); + if (eventFd == -1) { + ALOGE("mEventFd failed to create %d", errno); + return Status::ERROR; + } + + unique_fd epollFd(epoll_create(2)); + if (epollFd == -1) { + ALOGE("mEpollFd failed to create %d", errno); + return Status::ERROR; + } + + if (addEpollFd(epollFd, inotifyFd) == -1) return Status::ERROR; + + if (addEpollFd(epollFd, eventFd) == -1) return Status::ERROR; + + mEpollFd = move(epollFd); + mInotifyFd = move(inotifyFd); + mEventFd = move(eventFd); + gadgetPullup = false; + + // Monitors the ffs paths to pull up the gadget when descriptors are written. + // Also takes of the pulling up the gadget again if the userspace process + // dies and restarts. + mMonitor = unique_ptr(new thread(monitorFfs, this)); + mMonitorCreated = true; + if (DEBUG) ALOGI("Mainthread in Cv"); + + if (callback) { + if (mCv.wait_for(lk, timeout * 1ms, [] { return gadgetPullup; })) { + ALOGI("monitorFfs signalled true"); + } else { + ALOGI("monitorFfs signalled error"); + // continue monitoring as the descriptors might be written at a later + // point. + } + Return ret = callback->setCurrentUsbFunctionsCb( + functions, gadgetPullup ? Status::SUCCESS : Status::ERROR); + if (!ret.isOk()) + ALOGE("setCurrentUsbFunctionsCb error %s", ret.description().c_str()); + } + + return Status::SUCCESS; +} + +Return UsbGadget::setCurrentUsbFunctions( + uint64_t functions, const sp &callback, + uint64_t timeout) { + std::unique_lock lk(mLockSetCurrentFunction); + + mCurrentUsbFunctions = functions; + mCurrentUsbFunctionsApplied = false; + + // Unlink the gadget and stop the monitor if running. + V1_0::Status status = tearDownGadget(); + if (status != Status::SUCCESS) { + goto error; + } + + // Leave the gadget pulled down to give time for the host to sense disconnect. + usleep(DISCONNECT_WAIT_US); + + if (functions == static_cast(GadgetFunction::NONE)) { + if (callback == NULL) return Void(); + Return ret = + callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS); + if (!ret.isOk()) + ALOGE("Error while calling setCurrentUsbFunctionsCb %s", + ret.description().c_str()); + return Void(); + } + + status = validateAndSetVidPid(functions); + + if (status != Status::SUCCESS) { + goto error; + } + + status = setupFunctions(functions, callback, timeout); + if (status != Status::SUCCESS) { + goto error; + } + + ALOGI("Usb Gadget setcurrent functions called successfully"); + return Void(); + +error: + ALOGI("Usb Gadget setcurrent functions failed"); + if (callback == NULL) return Void(); + Return ret = callback->setCurrentUsbFunctionsCb(functions, status); + if (!ret.isOk()) + ALOGE("Error while calling setCurrentUsbFunctionsCb %s", + ret.description().c_str()); + return Void(); +} +} // namespace implementation +} // namespace V1_0 +} // namespace gadget +} // namespace usb +} // namespace hardware +} // namespace android diff --git a/usb/UsbGadget.h b/usb/UsbGadget.h new file mode 100644 index 00000000..ef2ea4dc --- /dev/null +++ b/usb/UsbGadget.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_USB_GADGET_V1_0_USBGADGET_H +#define ANDROID_HARDWARE_USB_GADGET_V1_0_USBGADGET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace usb { +namespace gadget { +namespace V1_0 { +namespace implementation { + +using ::android::sp; +using ::android::base::GetProperty; +using ::android::base::unique_fd; +using ::android::base::WriteStringToFile; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::std::lock_guard; +using ::std::move; +using ::std::mutex; +using ::std::string; +using ::std::thread; +using ::std::unique_ptr; +using ::std::vector; +using namespace std::chrono_literals; + +struct UsbGadget : public IUsbGadget { + UsbGadget(); + unique_fd mInotifyFd; + unique_fd mEventFd; + unique_fd mEpollFd; + + unique_ptr mMonitor; + volatile bool mMonitorCreated; + vector mEndpointList; + // protects the CV. + std::mutex mLock; + std::condition_variable mCv; + + // Makes sure that only one request is processed at a time. + std::mutex mLockSetCurrentFunction; + uint64_t mCurrentUsbFunctions; + bool mCurrentUsbFunctionsApplied; + + Return setCurrentUsbFunctions(uint64_t functions, + const sp& callback, + uint64_t timeout) override; + + Return getCurrentUsbFunctions( + const sp& callback) override; + + private: + Status tearDownGadget(); + Status setupFunctions(uint64_t functions, + const sp& callback, + uint64_t timeout); +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace gadget +} // namespace usb +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_USB_V1_2_USBGADGET_H diff --git a/usb/android.hardware.usb@1.1-service.wahoo.rc b/usb/android.hardware.usb@1.1-service.wahoo.rc index 1bb49772..3e2736cf 100644 --- a/usb/android.hardware.usb@1.1-service.wahoo.rc +++ b/usb/android.hardware.usb@1.1-service.wahoo.rc @@ -1,7 +1,7 @@ service vendor.usb-hal-1-1 /vendor/bin/hw/android.hardware.usb@1.1-service.wahoo class hal user root - group root system + group root system shell mtp on boot chown root system /sys/class/typec/port0/power_role diff --git a/usb/service.cpp b/usb/service.cpp index 5fffc4ce..e540608b 100644 --- a/usb/service.cpp +++ b/usb/service.cpp @@ -18,6 +18,7 @@ #include #include "Usb.h" +#include "UsbGadget.h" using android::sp; @@ -27,26 +28,35 @@ using android::hardware::joinRpcThreadpool; // Generated HIDL files using android::hardware::usb::V1_1::IUsb; +using android::hardware::usb::gadget::V1_0::IUsbGadget; using android::hardware::usb::V1_1::implementation::Usb; +using android::hardware::usb::gadget::V1_0::implementation::UsbGadget; -using android::status_t; using android::OK; +using android::status_t; int main() { - android::sp service = new Usb(); + android::sp service = new Usb(); + android::sp service2 = new UsbGadget(); - configureRpcThreadpool(1, true /*callerWillJoin*/); - status_t status = service->registerAsService(); + configureRpcThreadpool(2, true /*callerWillJoin*/); + status_t status = service->registerAsService(); - if (status != OK) { - ALOGE("Cannot register USB HAL service"); - return 1; - } - - ALOGI("USB HAL Ready."); - joinRpcThreadpool(); - // Under noraml cases, execution will not reach this line. - ALOGI("USB HAL failed to join thread pool."); + if (status != OK) { + ALOGE("Cannot register USB HAL service"); return 1; + } + status = service2->registerAsService(); + + if (status != OK) { + ALOGE("Cannot register USB Gadget HAL service"); + return 1; + } + + ALOGI("USB HAL Ready."); + joinRpcThreadpool(); + // Under noraml cases, execution will not reach this line. + ALOGI("USB HAL failed to join thread pool."); + return 1; } From c58ae4e91923b94e285d7a58ade4577392b93a98 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 29 Jan 2018 12:34:14 -0800 Subject: [PATCH 147/300] wahoo: VR: Reset setting in runtime crash and add dumpstate support Reset thermal setting after runtime reboot in VR Reset touch setting after runtime reboot in VR Add dump support in VR Test: Kill system_server during VR session and check thermal and touch settings Test: Capture bugreport and look at: lshal-debug/android.hardware.vr@1.0::IVr_default.txt Bug: 72644266 Bug: 72071908 Change-Id: I752c98ec88975a45eda19e72aed24df1a9fef2ba --- sepolicy/vendor/vendor_init.te | 1 + vr/VrDevice.cpp | 46 ++++++++++++++++----- vr/VrDevice.h | 5 +++ vr/android.hardware.vr@1.0-service.wahoo.rc | 6 +++ 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 3cbe3e50..dbc56673 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -25,3 +25,4 @@ set_prop(vendor_init, modem_diag_prop) set_prop(vendor_init, power_prop) set_prop(vendor_init, public_vendor_default_prop) set_prop(vendor_init, vendor_radio_prop) +set_prop(vendor_init, thermal_prop) diff --git a/vr/VrDevice.cpp b/vr/VrDevice.cpp index 75ac436c..e5cd94dd 100644 --- a/vr/VrDevice.cpp +++ b/vr/VrDevice.cpp @@ -16,8 +16,11 @@ #define LOG_TAG "VrDevice" +#include #include #include +#include + #include "VrDevice.h" namespace android { @@ -26,7 +29,16 @@ namespace vr { namespace V1_0 { namespace implementation { -VrDevice::VrDevice() {} +constexpr char kTouchVRModeSysfs[] = "/sys/devices/virtual/input/ftm4_touch/vrmode"; + +VrDevice::VrDevice() : mVRmode(false) { + std::string hardware = android::base::GetProperty("ro.hardware", ""); + if (hardware == "taimen") { + mFtm4Touch = true; + } else { + mFtm4Touch = false; + } +} Return VrDevice::init() { // NOOP @@ -34,13 +46,16 @@ Return VrDevice::init() { } Return VrDevice::setVrMode(bool enabled) { + mVRmode = enabled; if (enabled) { - if (!android::base::SetProperty("sys.qcom.thermalcfg", "/vendor/etc/thermal-engine-vr.conf")) { + if (!android::base::SetProperty("sys.qcom.thermalcfg", + "/vendor/etc/thermal-engine-vr.conf")) { LOG(ERROR) << "Couldn't set thermal_engine enable property"; return Void(); } } else { - if (!android::base::SetProperty("sys.qcom.thermalcfg", "/vendor/etc/thermal-engine.conf")) { + if (!android::base::SetProperty("sys.qcom.thermalcfg", + "/vendor/etc/thermal-engine.conf")) { LOG(ERROR) << "Couldn't set thermal_engine disable property"; return Void(); } @@ -48,15 +63,24 @@ Return VrDevice::setVrMode(bool enabled) { if (!android::base::SetProperty("ctl.restart", "vendor.thermal-engine")) { LOG(ERROR) << "Couldn't set thermal_engine restart property"; } - if (!access("/sys/devices/virtual/input/ftm4_touch/vrmode", W_OK)) { - FILE *f = fopen("/sys/devices/virtual/input/ftm4_touch/vrmode", "w"); - if (f) { - fprintf(f, "%d", (enabled ? 1 : 0)); - fclose(f); - } - else { - LOG(ERROR) << "Couldn't open vrmode sysfs node"; + + if (mFtm4Touch && + !android::base::WriteStringToFile((enabled ? "1" : "0"), kTouchVRModeSysfs)) { + PLOG(ERROR) << "Failed to write to vrmode sysfs node with :" << enabled; + } + + return Void(); +} + +Return VrDevice::debug(const hidl_handle& handle, const hidl_vec&) { + if (handle != nullptr && handle->numFds >= 1) { + int fd = handle->data[0]; + std::string buf(android::base::StringPrintf("VRMode: %s\n", + (mVRmode ? "true" : "false"))); + if (!android::base::WriteStringToFd(buf, fd)) { + PLOG(ERROR) << "Failed to dump state to fd"; } + fsync(fd); } return Void(); } diff --git a/vr/VrDevice.h b/vr/VrDevice.h index cd754508..7bc3e149 100644 --- a/vr/VrDevice.h +++ b/vr/VrDevice.h @@ -32,6 +32,11 @@ struct VrDevice : public IVr { Return init() override; Return setVrMode(bool enabled) override; + Return debug(const hidl_handle& handle, const hidl_vec&) override; + private: + // Taimen display touch sensitivity for VR Mode (b/37515573) + bool mFtm4Touch; + bool mVRmode; }; } // namespace implementation diff --git a/vr/android.hardware.vr@1.0-service.wahoo.rc b/vr/android.hardware.vr@1.0-service.wahoo.rc index 3f34675d..10f3ac96 100644 --- a/vr/android.hardware.vr@1.0-service.wahoo.rc +++ b/vr/android.hardware.vr@1.0-service.wahoo.rc @@ -2,3 +2,9 @@ service vendor.vr-wahoo-1-0 /vendor/bin/hw/android.hardware.vr@1.0-service.wahoo class hal user system group system + +# reset touch and thermal-engine when framework died and thermal-engine is in VR mode +on property:init.svc.zygote=restarting && property:sys.qcom.thermalcfg=/vendor/etc/thermal-engine-vr.conf + write /sys/devices/virtual/input/ftm4_touch/vrmode 0 + setprop sys.qcom.thermalcfg "/vendor/etc/thermal-engine.conf" + restart vendor.thermal-engine From 76b6dbfbc52612ca52e44d95ed6ebda6f200e8f7 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Wed, 31 Jan 2018 11:34:36 +0900 Subject: [PATCH 148/300] Mark ro.qcom.adreno.* as public_vendor_default_prop ro.qcom.adreno.* are used in some of VNDK-SP libs, and so they should be accessible from system components. Bug: 72697173 Test: tested with ro.qcom.adreno.qgl.VkApiMinorVersion=1 Change-Id: I307c2013a5424245586509cf250c14cf02a8c1cc --- sepolicy/vendor/property_contexts | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 3c3046b0..9f8c01c9 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -43,6 +43,7 @@ ro.graphics.memory u:object_r:public_vendor_default_prop:s0 ro.boot.ddrsize u:object_r:public_vendor_default_prop:s0 ro.boot.hardware.ddr u:object_r:public_vendor_default_prop:s0 ro.boot.hardware.ufs u:object_r:public_vendor_default_prop:s0 +ro.qcom.adreno. u:object_r:public_vendor_default_prop:s0 # public_vendor_system_prop # They are public_vendor_system_props for vendor-specific extension. From cb840d8de751e45daea008a7da912186a1884210 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Wed, 31 Jan 2018 00:39:42 -0800 Subject: [PATCH 149/300] Initialize booleans Since mMonitorCreated wasnt initialized to false, join was called on the thread eventhough the thread didnt exist. Bug: 72691300 Test: Booted asan and verified that adb was enabled. Change-Id: Iafb529b66084fbe196d6c8b10fabd62a5ec8ec4a --- usb/UsbGadget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp index e1ee289a..33944433 100644 --- a/usb/UsbGadget.cpp +++ b/usb/UsbGadget.cpp @@ -164,7 +164,9 @@ static void *monitorFfs(void *param) { return NULL; } -UsbGadget::UsbGadget() { +UsbGadget::UsbGadget() + : mMonitorCreated(false), + mCurrentUsbFunctionsApplied(false) { if (access(OS_DESC_PATH, R_OK) != 0) ALOGE("configfs setup not done yet"); } From 29ee545bedb1944afda789dabd2f7611edcd209d Mon Sep 17 00:00:00 2001 From: Ecco Park Date: Wed, 31 Jan 2018 14:59:05 -0800 Subject: [PATCH 150/300] Adding the execute permission for /data/vendor/wifi ag/3332074 broke the Pixel Logger funtionality for wifi. The Logger needs the write permission for /data/vendor/wifi/cnss_diag. so, parent directory needs to set the execute permission for other group. Test: manual test with Pixel Logger Bug: 70228425 Change-Id: I75819f0b0bf4ed376d5d87f33af2e1693c864db8 Signed-off-by: Ecco Park --- init.hardware.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.hardware.rc b/init.hardware.rc index 2649aa78..d990bff0 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -284,7 +284,7 @@ on zygote-start # Create the directories used by the Wireless subsystem mkdir /data/misc/wifi 0770 wifi wifi mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi - mkdir /data/vendor/wifi 0770 wifi wifi + mkdir /data/vendor/wifi 0771 wifi wifi mkdir /data/vendor/wifi/wpa 0770 wifi wifi mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi mkdir /data/misc/dhcp 0770 dhcp dhcp From 6c9b99e10861a7d3dfac0a55ab39670850a3da0e Mon Sep 17 00:00:00 2001 From: Edwin Wong Date: Wed, 31 Jan 2018 10:29:05 -0800 Subject: [PATCH 151/300] Add SELinux policy for clearkey HIDL service. Convert clearkey plugin to HIDL to support drm HAL v1.1. Add SELinux policy for android.hardware.drm@1.1-service.clearkey. Test: CTS test ANDROID_BUILD_TOP= ./android-ccts-tradefed run cts-dev --module CtsMediaTestCases -t android.media.cts.ClearKeySystemTest#testClearKeyPlaybackCenc bug: 69635855 Change-Id: I61e9c272c2a2788fd07d5c12921d28c785661b77 --- device.mk | 3 ++- manifest.xml | 4 +++- sepolicy/vendor/file_contexts | 7 ++++--- sepolicy/vendor/hal_drm_clearkey.te | 11 +++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 sepolicy/vendor/hal_drm_clearkey.te diff --git a/device.mk b/device.mk index 437d3e37..ae12bc44 100755 --- a/device.mk +++ b/device.mk @@ -334,7 +334,8 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ android.hardware.drm@1.0-impl \ android.hardware.drm@1.0-service \ - android.hardware.drm@1.0-service.widevine + android.hardware.drm@1.0-service.widevine \ + android.hardware.drm@1.1-service.clearkey # NeuralNetworks HAL PRODUCT_PACKAGES += \ diff --git a/manifest.xml b/manifest.xml index 67e194ca..711e2b77 100644 --- a/manifest.xml +++ b/manifest.xml @@ -83,16 +83,18 @@ android.hardware.drm hwbinder - 1.0 + 1.1 ICryptoFactory default widevine + clearkey IDrmFactory default widevine + clearkey diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index ffffe6a6..6af22630 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -184,9 +184,10 @@ /vendor/bin/init\.power\.sh u:object_r:init_power_exec:s0 /vendor/bin/init\.radio\.sh u:object_r:init_radio_exec:s0 -/vendor/bin/hw/android\.hardware\.drm@1\.0-service.widevine u:object_r:hal_drm_widevine_exec:s0 -/vendor/bin/hw/android\.hardware\.vibrator@1\.1-service.wahoo u:object_r:hal_vibrator_default_exec:s0 -/vendor/bin/hw/android\.hardware\.health@2\.0-service.wahoo u:object_r:hal_health_default_exec:s0 +/vendor/bin/hw/android\.hardware\.drm@1\.0-service\.widevine u:object_r:hal_drm_widevine_exec:s0 +/vendor/bin/hw/android\.hardware\.drm@1\.1-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 +/vendor/bin/hw/android\.hardware\.vibrator@1\.1-service\.wahoo u:object_r:hal_vibrator_default_exec:s0 +/vendor/bin/hw/android\.hardware\.health@2\.0-service\.wahoo u:object_r:hal_health_default_exec:s0 /vendor/bin/hw/android\.hardware\.keymaster@3\.0-service-qti u:object_r:hal_keymaster_qti_exec:s0 /vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service-qti u:object_r:hal_gatekeeper_qti_exec:s0 /vendor/bin/hw/android\.hardware\.gnss@1\.0-service-qti u:object_r:hal_gnss_qti_exec:s0 diff --git a/sepolicy/vendor/hal_drm_clearkey.te b/sepolicy/vendor/hal_drm_clearkey.te new file mode 100644 index 00000000..976b9fab --- /dev/null +++ b/sepolicy/vendor/hal_drm_clearkey.te @@ -0,0 +1,11 @@ +# policy for /vendor/bin/hw/android.hardware.drm@1.1-service.clearkey +type hal_drm_clearkey, domain; +type hal_drm_clearkey_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(hal_drm_clearkey) + +hal_server_domain(hal_drm_clearkey, hal_drm) + +vndbinder_use(hal_drm_clearkey); + +allow hal_drm_clearkey { appdomain -isolated_app }:fd use; From 358d72f626595048cf50e079d33946b283c3f985 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Thu, 1 Feb 2018 12:47:39 -0800 Subject: [PATCH 152/300] Reflect libegl move in sepolicy libraries moved from /vendor/lib to /vendor/lib/egl. Bug: 72814034 Test: spfetsch@ to verify Change-Id: Ifd3d80053436aed6a42c4a64e113474eb65bbae5 --- sepolicy/vendor/file_contexts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index ffffe6a6..07556577 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -203,9 +203,9 @@ /vendor/lib(64)?/libgsl\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/hw/vulkan\.msm8998\.so u:object_r:same_process_hal_file:s0 -/vendor/lib(64)?/libEGL_adreno\.so u:object_r:same_process_hal_file:s0 -/vendor/lib(64)?/libGLESv1_CM_adreno\.so u:object_r:same_process_hal_file:s0 -/vendor/lib(64)?/libGLESv2_adreno\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/egl/libEGL_adreno\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/egl/libGLESv1_CM_adreno\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/egl/libGLESv2_adreno\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/libdrmutils\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/libdrm\.so u:object_r:same_process_hal_file:s0 From 6c5945b4b7b1f10a56fef980f86d5e1b64589735 Mon Sep 17 00:00:00 2001 From: Jie Song Date: Fri, 2 Feb 2018 13:15:26 -0800 Subject: [PATCH 153/300] Correct diag_mdlog_start service name Bug: 72732633 Test: Start logging Change-Id: I4fe452829e77ae0e9fd1fa1629a18a9c40d804df --- init.hardware.diag.rc.userdebug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 72a9317a..234ea230 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -27,7 +27,7 @@ on post-fs-data mkdir /data/vendor/wifi 0777 system system mkdir /data/vendor/wifi/cnss_diag 0777 system system -service diag_mdlog_start /vendor/bin/diag_mdlog +service vendor.diag_mdlog_start /vendor/bin/diag_mdlog class late_start user shell group system diag media_rw From c127f046f8b0eb102ab61654e2c07004cbcaea4d Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 5 Feb 2018 16:16:57 -0800 Subject: [PATCH 154/300] wpa_supplicant(hidl): Add support for starting HAL lazily Bug: 72394251 Test: Able to start supplicant from framework using ISupplicant.getService() Change-Id: I19b8434e7241b9028e7dc86316ec9d5512affcca --- init.hardware.rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.hardware.rc b/init.hardware.rc index d990bff0..3612e188 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -676,6 +676,8 @@ service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ # after setting up the capabilities required for WEXT # user wifi # group wifi inet keystore + interface android.hardware.wifi.supplicant@1.0::ISupplicant default + interface android.hardware.wifi.supplicant@1.1::ISupplicant default class main socket wpa_wlan0 dgram 660 wifi wifi disabled From 3f543a93256299e4ffb43c56c81ae674ff064d69 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Thu, 25 Jan 2018 12:45:29 -0800 Subject: [PATCH 155/300] sepolicy: add OWNERS Test: n/a Change-Id: I7c46d5f984955f963b668fe8d978e68e6b7b9a83 --- sepolicy/OWNERS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sepolicy/OWNERS b/sepolicy/OWNERS index b714fc71..b3462931 100644 --- a/sepolicy/OWNERS +++ b/sepolicy/OWNERS @@ -1,5 +1,7 @@ -nnk@google.com -jeffv@google.com dcashman@google.com jbires@google.com +jeffv@google.com +jgalenson@google.com +nnk@google.com sspatil@google.com +trong@google.com From cf979de2464efb9007f671b32b4420e97043b41d Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Mon, 12 Feb 2018 13:41:14 -0800 Subject: [PATCH 156/300] Increase SVN to 8 for April Security Update Bug: 73240847 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 9b93bd6e..89319f4c 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=7 + ro.vendor.build.svn=8 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 14e25412bdbf9493b6f46500dba469e82705ae30 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Mon, 29 Jan 2018 15:56:22 -0800 Subject: [PATCH 157/300] Enable telephony audio device for pixel devices. Pixel devices support a special audio device called TYPE_TELEPHONY which enables system apps to output audio in the telephony outgoing audio stream. This is used for some carriers to play a "call recording tone" which the remote party will hear if the user starts recording audio with a call recording app. Test: Manual testing Bug: 64138141 Change-Id: I6e1981a4baaea34c0cea54f1af7aa2945c6e09a6 --- overlay/packages/services/Telephony/res/values/config.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml index 29ef7ce5..297ef385 100644 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ b/overlay/packages/services/Telephony/res/values/config.xml @@ -21,4 +21,9 @@ true true + + true From c113d6879ceff17ef09f1cc4af8e5ca8dbc57298 Mon Sep 17 00:00:00 2001 From: Philip Quinn Date: Fri, 9 Feb 2018 18:14:07 -0800 Subject: [PATCH 158/300] Enable support for assist gesture hardware on Wahoo. Bug: 73176604 Test: make -j Change-Id: I68945c641712545ab8ce89d5424e467933b61df7 --- device.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/device.mk b/device.mk index ae12bc44..ddf248cd 100755 --- a/device.mk +++ b/device.mk @@ -140,6 +140,7 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \ frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \ + frameworks/native/data/etc/android.hardware.sensor.assist.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.assist.xml \ frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \ frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \ frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \ From 30b7334dc68a181898cb938bd0d46ee788dfdef7 Mon Sep 17 00:00:00 2001 From: Artem Iglikov Date: Thu, 25 Jan 2018 16:09:56 +0000 Subject: [PATCH 159/300] Add external storage and contact permissions to google phones. Bug: 72088198 Test: n/a Change-Id: If6e3e443e681c293b63d7d3011884425099bed89 --- default-permissions.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/default-permissions.xml b/default-permissions.xml index 75c5c8fa..8182d179 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -51,6 +51,17 @@ + + + + + + + + + From 4ede3902cb6c7f4c0a6e07ae89be19ac6600acf6 Mon Sep 17 00:00:00 2001 From: Naina Nalluri Date: Wed, 14 Feb 2018 16:12:23 -0800 Subject: [PATCH 160/300] Allow ConnectivityMonitor to use radio_service This change is a result of moving ConnectivityMonitor app to vendor partition Fixes below errors: 02-13 15:13:13.620 1000 606 606 E SELinux : avc: denied { find } for service=isub pid=3878 uid=1001 scontext=u:r:con_monitor_app:s0:c233,c259,c512,c768 tcontext=u:object_r:radio_service:s0 tclass=service_manager permissive=0 Bug: 73381264 Test: Tested on device Change-Id: If6b22d23d1363c10bda3982bf30e97e35e044c60 --- sepolicy/vendor/con_monitor.te | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te index ee1f0f0c..74e7496e 100644 --- a/sepolicy/vendor/con_monitor.te +++ b/sepolicy/vendor/con_monitor.te @@ -9,4 +9,4 @@ allow con_monitor_app radio_vendor_data_file:dir rw_dir_perms; allow con_monitor_app radio_vendor_data_file:file create_file_perms; allow con_monitor_app hal_power_hwservice:hwservice_manager find; allow con_monitor_app hal_power_default:binder call; - +allow con_monitor_app radio_service:service_manager find; From 87b0264022f286391401549b9a933b2bbcc5c7b4 Mon Sep 17 00:00:00 2001 From: Ajay Nambi Date: Thu, 15 Feb 2018 14:01:34 -0800 Subject: [PATCH 161/300] Move AtFwd hal from device to framework manifest. AtFwd hal is implemented as an android service and it stars from system partition, that is, it's not a traditional vendor hal and hence it should be declared in the framework manifest and not in the device manifest. This commit introduces new device specific framework manifest (framework_manifest.xml) and moves AtFwd hal from device to framework manifest. Bug: 68662838 Test: vts_treble_vintf_test atcmdfwd service is served Change-Id: I9df05206fbe067ddf19a96fc52aba6b2cc922172 (cherry picked from commit b2895ddbcf1cc0b8986b4a80a43a3f0b6eb9fd66) --- BoardConfig.mk | 1 + framework_manifest.xml | 12 ++++++++++++ manifest.xml | 9 --------- 3 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 framework_manifest.xml diff --git a/BoardConfig.mk b/BoardConfig.mk index 1eb91b2b..16d96b61 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -149,6 +149,7 @@ BOARD_CHARGER_ENABLE_SUSPEND := true # Vendor Interface Manifest DEVICE_MANIFEST_FILE := device/google/wahoo/manifest.xml DEVICE_MATRIX_FILE := device/google/wahoo/compatibility_matrix.xml +DEVICE_FRAMEWORK_MANIFEST_FILE := device/google/wahoo/framework_manifest.xml BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true diff --git a/framework_manifest.xml b/framework_manifest.xml new file mode 100644 index 00000000..c82d51c8 --- /dev/null +++ b/framework_manifest.xml @@ -0,0 +1,12 @@ + + + vendor.qti.atcmdfwd + hwbinder + 1.0 + + IAtCmdFwd + AtCmdFwdService + + + + diff --git a/manifest.xml b/manifest.xml index f10c4453..ca6f6c7f 100644 --- a/manifest.xml +++ b/manifest.xml @@ -465,13 +465,4 @@ cnd - - vendor.qti.atcmdfwd - hwbinder - 1.0 - - IAtCmdFwd - AtCmdFwdService - - From 3e8e6599972bf8fd48c832dbd5ba6214e0b2cefc Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Mon, 29 Jan 2018 14:54:37 +0000 Subject: [PATCH 162/300] Upgrade vibrator to HAL 1.2 Bug: 64184692 Test: build, flash and play with device Change-Id: I44d82371e6a6d7dc7e05e740aa5f2fdb5c3f8df6 --- CleanSpec.mk | 4 ++ device.mk | 2 +- manifest.xml | 2 +- sepolicy/vendor/file_contexts | 2 +- vibrator/Android.bp | 5 +- vibrator/Vibrator.cpp | 57 +++++++++---------- vibrator/Vibrator.h | 21 ++++--- ...oid.hardware.vibrator@1.1-service.wahoo.rc | 4 -- ...oid.hardware.vibrator@1.2-service.wahoo.rc | 4 ++ vibrator/service.cpp | 8 +-- 10 files changed, 57 insertions(+), 52 deletions(-) delete mode 100644 vibrator/android.hardware.vibrator@1.1-service.wahoo.rc create mode 100644 vibrator/android.hardware.vibrator@1.2-service.wahoo.rc diff --git a/CleanSpec.mk b/CleanSpec.mk index c105dba8..b0c4379e 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -164,3 +164,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.he # Remove PowerHAL $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.power*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.power*) + +# Remove Vibrator HAL 1.1 +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.vibrator@1.1-service.wahoo.rc) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.vibrator@1.1-service.wahoo) diff --git a/device.mk b/device.mk index 64fa0521..38c6cdb0 100755 --- a/device.mk +++ b/device.mk @@ -402,7 +402,7 @@ PRODUCT_PACKAGES += \ # Vibrator HAL PRODUCT_PACKAGES += \ - android.hardware.vibrator@1.1-service.wahoo + android.hardware.vibrator@1.2-service.wahoo # Thermal packages PRODUCT_PACKAGES += \ diff --git a/manifest.xml b/manifest.xml index ca6f6c7f..132d0d19 100644 --- a/manifest.xml +++ b/manifest.xml @@ -342,7 +342,7 @@ android.hardware.vibrator hwbinder - 1.1 + 1.2 IVibrator default diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index b7a01b76..e4ab3a9b 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -186,7 +186,7 @@ /vendor/bin/hw/android\.hardware\.drm@1\.0-service\.widevine u:object_r:hal_drm_widevine_exec:s0 /vendor/bin/hw/android\.hardware\.drm@1\.1-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 -/vendor/bin/hw/android\.hardware\.vibrator@1\.1-service\.wahoo u:object_r:hal_vibrator_default_exec:s0 +/vendor/bin/hw/android\.hardware\.vibrator@1\.2-service\.wahoo u:object_r:hal_vibrator_default_exec:s0 /vendor/bin/hw/android\.hardware\.health@2\.0-service\.wahoo u:object_r:hal_health_default_exec:s0 /vendor/bin/hw/android\.hardware\.keymaster@3\.0-service-qti u:object_r:hal_keymaster_qti_exec:s0 /vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service-qti u:object_r:hal_gatekeeper_qti_exec:s0 diff --git a/vibrator/Android.bp b/vibrator/Android.bp index b4f5fa7d..c02ae54e 100644 --- a/vibrator/Android.bp +++ b/vibrator/Android.bp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. cc_binary { - name: "android.hardware.vibrator@1.1-service.wahoo", + name: "android.hardware.vibrator@1.2-service.wahoo", relative_install_path: "hw", - init_rc: ["android.hardware.vibrator@1.1-service.wahoo.rc"], + init_rc: ["android.hardware.vibrator@1.2-service.wahoo.rc"], srcs: ["service.cpp", "Vibrator.cpp"], cflags: [ "-Wall", @@ -31,6 +31,7 @@ cc_binary { "libhardware", "android.hardware.vibrator@1.0", "android.hardware.vibrator@1.1", + "android.hardware.vibrator@1.2", ], proprietary: true, } diff --git a/vibrator/Vibrator.cpp b/vibrator/Vibrator.cpp index db64bb13..20ae48b0 100644 --- a/vibrator/Vibrator.cpp +++ b/vibrator/Vibrator.cpp @@ -33,7 +33,7 @@ namespace android { namespace hardware { namespace vibrator { -namespace V1_1 { +namespace V1_2 { namespace implementation { static constexpr int8_t MAX_RTP_INPUT = 127; @@ -116,7 +116,7 @@ Return Vibrator::on(uint32_t timeoutMs, bool forceOpenLoop, bool isWavef return Status::OK; } -// Methods from ::android::hardware::vibrator::V1_1::IVibrator follow. +// Methods from ::android::hardware::vibrator::V1_2::IVibrator follow. Return Vibrator::on(uint32_t timeoutMs) { return on(timeoutMs, false /* forceOpenLoop */, false /* isWaveform */); } @@ -158,7 +158,7 @@ static uint8_t convertEffectStrength(EffectStrength strength) { switch (strength) { case EffectStrength::LIGHT: - scale = 1; // 50% + scale = 2; // 50% break; case EffectStrength::MEDIUM: case EffectStrength::STRONG: @@ -169,52 +169,49 @@ static uint8_t convertEffectStrength(EffectStrength strength) { return scale; } -Return Vibrator::perform(Effect effect, EffectStrength strength, perform_cb _hidl_cb) { +Return Vibrator::perform(V1_0::Effect effect, EffectStrength strength, perform_cb _hidl_cb) { + return performEffect(static_cast(effect), strength, _hidl_cb); +} + +Return Vibrator::perform_1_1(V1_1::Effect_1_1 effect, EffectStrength strength, + perform_cb _hidl_cb) { + return performEffect(static_cast(effect), strength, _hidl_cb); +} + +Return Vibrator::perform_1_2(Effect effect, EffectStrength strength, perform_cb _hidl_cb) { + return performEffect(static_cast(effect), strength, _hidl_cb); +} + +Return Vibrator::performEffect(Effect effect, EffectStrength strength, perform_cb _hidl_cb) { Status status = Status::OK; uint32_t timeMS; - if (effect == Effect::CLICK) { + switch (effect) { + case Effect::CLICK: mSequencer << WAVEFORM_CLICK_EFFECT_SEQ << std::endl; timeMS = mClickDuration; - } else if (effect == Effect::DOUBLE_CLICK) { + break; + case Effect::DOUBLE_CLICK: mSequencer << WAVEFORM_DOUBLE_CLICK_EFFECT_SEQ << std::endl; timeMS = WAVEFORM_DOUBLE_CLICK_EFFECT_MS; - } else { - _hidl_cb(Status::UNSUPPORTED_OPERATION, 0); - return Void(); - } - - mScale << convertEffectStrength(strength) << std::endl; - on(timeMS, true /* forceOpenLoop */, true /* isWaveform */); - - _hidl_cb(status, timeMS); - return Void(); -} - -Return Vibrator::perform_1_1(Effect_1_1 effect, EffectStrength strength, - perform_cb _hidl_cb) { - Status status = Status::OK; - uint32_t timeMS; - - if (effect == Effect_1_1::TICK) { + break; + case Effect::TICK: mSequencer << WAVEFORM_TICK_EFFECT_SEQ << std::endl; timeMS = mTickDuration; - } else if (effect < Effect_1_1::TICK) { - return perform(static_cast(effect), strength, _hidl_cb); - } else { + break; + default: _hidl_cb(Status::UNSUPPORTED_OPERATION, 0); return Void(); } - mScale << convertEffectStrength(strength) << std::endl; on(timeMS, true /* forceOpenLoop */, true /* isWaveform */); - _hidl_cb(status, timeMS); return Void(); } + } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace vibrator } // namespace hardware } // namespace android diff --git a/vibrator/Vibrator.h b/vibrator/Vibrator.h index 82d4da20..2f0ed082 100644 --- a/vibrator/Vibrator.h +++ b/vibrator/Vibrator.h @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H -#define ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H +#ifndef ANDROID_HARDWARE_VIBRATOR_V1_2_VIBRATOR_H +#define ANDROID_HARDWARE_VIBRATOR_V1_2_VIBRATOR_H -#include +#include #include #include @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace vibrator { -namespace V1_1 { +namespace V1_2 { namespace implementation { class Vibrator : public IVibrator { @@ -42,12 +42,15 @@ public: Return setAmplitude(uint8_t amplitude) override; using EffectStrength = ::android::hardware::vibrator::V1_0::EffectStrength; - using Effect = ::android::hardware::vibrator::V1_0::Effect; - Return perform(Effect effect, EffectStrength strength, perform_cb _hidl_cb) override; - Return perform_1_1(Effect_1_1 effect, EffectStrength strength, perform_cb _hidl_cb) override; + Return perform(V1_0::Effect effect, EffectStrength strength, perform_cb _hidl_cb) + override; + Return perform_1_1(V1_1::Effect_1_1 effect, EffectStrength strength, perform_cb _hidl_cb) + override; + Return perform_1_2(Effect effect, EffectStrength strength, perform_cb _hidl_cb) override; private: Return on(uint32_t timeoutMs, bool forceOpenLoop, bool isWaveform); + Return performEffect(Effect effect, EffectStrength strength, perform_cb _hidl_cb); std::ofstream mActivate; std::ofstream mDuration; std::ofstream mState; @@ -61,9 +64,9 @@ private: int32_t mTickDuration; }; } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace vibrator } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H +#endif // ANDROID_HARDWARE_VIBRATOR_V1_2_VIBRATOR_H diff --git a/vibrator/android.hardware.vibrator@1.1-service.wahoo.rc b/vibrator/android.hardware.vibrator@1.1-service.wahoo.rc deleted file mode 100644 index be266bab..00000000 --- a/vibrator/android.hardware.vibrator@1.1-service.wahoo.rc +++ /dev/null @@ -1,4 +0,0 @@ -service vendor.vibrator-1-1 /vendor/bin/hw/android.hardware.vibrator@1.1-service.wahoo - class hal - user system - group system diff --git a/vibrator/android.hardware.vibrator@1.2-service.wahoo.rc b/vibrator/android.hardware.vibrator@1.2-service.wahoo.rc new file mode 100644 index 00000000..b5397861 --- /dev/null +++ b/vibrator/android.hardware.vibrator@1.2-service.wahoo.rc @@ -0,0 +1,4 @@ +service vendor.vibrator-1-2 /vendor/bin/hw/android.hardware.vibrator@1.2-service.wahoo + class hal + user system + group system diff --git a/vibrator/service.cpp b/vibrator/service.cpp index 25c49c55..ea05151d 100644 --- a/vibrator/service.cpp +++ b/vibrator/service.cpp @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "android.hardware.vibrator@1.1-service.wahoo" +#define LOG_TAG "android.hardware.vibrator@1.2-service.wahoo" -#include +#include #include #include #include @@ -25,8 +25,8 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; -using android::hardware::vibrator::V1_1::IVibrator; -using android::hardware::vibrator::V1_1::implementation::Vibrator; +using android::hardware::vibrator::V1_2::IVibrator; +using android::hardware::vibrator::V1_2::implementation::Vibrator; using namespace android; // Refer to Documentation/ABI/testing/sysfs-class-led-driver-drv2624 From 43eb8a3a50fb394cf2858955c82a9c4e9a77df71 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 22 Feb 2018 15:39:20 -0800 Subject: [PATCH 163/300] Update IMS Radio version to 1.1. The version actually being served is 1.1 Bug: 73772212 Test: vts_treble_vintf_test --gtest_filter=VtsTrebleVintfTest.ServedHalsAreInManifest passes on walleye. Change-Id: I84da55d2d1528afe4a8a3e9856b87c0ea15dd5f8 --- manifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index ca6f6c7f..495e8676 100644 --- a/manifest.xml +++ b/manifest.xml @@ -405,7 +405,7 @@ com.qualcomm.qti.ims.radio hwbinder - 1.0 + 1.1 IImsRadio imsradio0 From 16348760b3e21be8a8af9542f22f3d9bf9b75952 Mon Sep 17 00:00:00 2001 From: Petri Gynther Date: Tue, 27 Feb 2018 18:00:28 -0800 Subject: [PATCH 164/300] Walleye/Taimen: add wcnss_filter to device.mk Add wcnss_filter to Bluetooth HAL section of device.mk. This is done for three reasons: 1. wcnss_filter is part of Bluetooth HAL. 2. Once wcnss_filter is added to device.mk, entire BT section in vendor/qcom/msm8998/proprietary/device-vendor.mk can be removed. 3. Switching to QCOM BT HAL becomes easier, just modify device.mk. Bug: 73968979 Test: Manual build and test with BT A2DP headphones Change-Id: Iecb725eb360bda624e98b21db154ebf3e9e17381 --- device.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/device.mk b/device.mk index f18b604d..88f2318e 100755 --- a/device.mk +++ b/device.mk @@ -328,8 +328,9 @@ PRODUCT_PACKAGES += \ # Bluetooth HAL PRODUCT_PACKAGES += \ libbt-vendor \ - android.hardware.bluetooth@1.0-impl \ - android.hardware.bluetooth@1.0-service + android.hardware.bluetooth@1.0-impl \ + android.hardware.bluetooth@1.0-service \ + wcnss_filter # DRM HAL PRODUCT_PACKAGES += \ From 847ee61ebb998bfe0f8ff4481cbc3f29698efb12 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 28 Feb 2018 16:13:51 -0800 Subject: [PATCH 165/300] Fix shared vdex name The files in arm/arm64 are symlinks and pinning symlinks is not supported. Pin the target vdex file intead. Bug: 73990433 Test: manual Change-Id: I1edadcc3be6d88cc07c599cba024babc5abe0633 --- overlay/frameworks/base/core/res/res/values/config.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 6cb31c01..ead9b5fa 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -310,13 +310,13 @@ "/system/framework/arm64/boot-framework.oat" - "/system/framework/arm64/boot-framework.vdex" + "/system/framework/boot-framework.vdex" "/system/framework/oat/arm64/services.odex" "/system/framework/oat/arm64/services.vdex" "/system/framework/arm64/boot.oat" - "/system/framework/arm64/boot.vdex" + "/system/framework/boot.vdex" "/system/framework/arm64/boot-core-libart.oat" - "/system/framework/arm64/boot-core-libart.vdex" + "/system/framework/boot-core-libart.vdex" From b5cdf6175a15c65c3383eb5efdc2fa2cffa310f7 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Mon, 5 Feb 2018 18:00:04 -0800 Subject: [PATCH 166/300] Mark NNAPI HAL as 1.1 Bug: 63911257 Test: mm Test: cts binaries for sample drivers on walleye Test: vts binaries for sample drivers on walleye Change-Id: Ifc1f0381e5ac8d63152ad18635dafced10aadfe8 --- manifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index 60d389c2..b0829eb7 100644 --- a/manifest.xml +++ b/manifest.xml @@ -212,7 +212,7 @@ android.hardware.neuralnetworks hwbinder - 1.0 + 1.1 IDevice hvx From 0f10edb1dcb0bb67ef8be9f79bacf3a01568e073 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Wed, 28 Feb 2018 14:04:26 -0800 Subject: [PATCH 167/300] sepolicy: add domain for WfcActivation app ... and allow access qchook_service via servicemanager. Bug: 73974808 Test: basic sanity Change-Id: If8ea19701c9e8258a06afbde4b39c197afedf302 --- sepolicy/private/certs/wfcactivation.x509.pem | 23 ++++++++++++++++ sepolicy/private/keys.conf | 2 ++ sepolicy/private/mac_permissions.xml | 26 +++++++++++++++++++ sepolicy/private/seapp_contexts | 3 +++ sepolicy/private/wfc_activation_app.te | 9 +++++++ 5 files changed, 63 insertions(+) create mode 100644 sepolicy/private/certs/wfcactivation.x509.pem create mode 100644 sepolicy/private/keys.conf create mode 100644 sepolicy/private/mac_permissions.xml create mode 100644 sepolicy/private/wfc_activation_app.te diff --git a/sepolicy/private/certs/wfcactivation.x509.pem b/sepolicy/private/certs/wfcactivation.x509.pem new file mode 100644 index 00000000..bead020b --- /dev/null +++ b/sepolicy/private/certs/wfcactivation.x509.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDyTCCArGgAwIBAgIJAODrqTpclyUkMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNV +BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBW +aWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEXMBUG +A1UEAwwOd2ZjX2FjdGl2YXRpb24wHhcNMTgwMjIxMDA1NTM4WhcNNDUwNzA5MDA1 +NTM4WjB7MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UE +BwwNTW91bnRhaW4gVmlldzEUMBIGA1UECgwLR29vZ2xlIEluYy4xEDAOBgNVBAsM +B0FuZHJvaWQxFzAVBgNVBAMMDndmY19hY3RpdmF0aW9uMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAruKdMaQjRrlTwLHWAhUwLXoq+1glzoQ5ibqHDg4i +GPPlwT7qPG8xWW6UmTiLNES6YSDpvCvptqrZccecviYfYIg7/JCF/xr2cFt9Gyyo +L0muemdUMFjGQJxKCQMi8jlqPVgfcy7ZEfVvoDWUupD7hVVA6TFkWH1nv/5GzJVK +h7D4vBaYE6qwM1+NJjrbk1O8SMMCES7MkJhpnfbRYr8d5uxSzDWqqeqvM6CFSvKw +cxqbCcNl0MDgSCgtnxzZZjg5AFuPECV8lgJpxFEqgEIK1fsebK5G8o4buokMW+W4 +ZT2LZtMq/qsZXl59h22KQX2w5mcI6KyV8WZOcPPOm8uf8wIDAQABo1AwTjAdBgNV +HQ4EFgQU9jpHDUfkIqBODCp9/c5TsraA9sowHwYDVR0jBBgwFoAU9jpHDUfkIqBO +DCp9/c5TsraA9sowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAZMf+ +KD3oFS0cv/C0qQx28wW5BKFb/PM6RxDwTRF7yyJj4+uZU0+O8NJEqBNDgHusFJR6 +2ZXXiWDqzNb0scZxD95FP1YxiLPAcbn2oCTkGPYcCsBmT1i25RsIKTb7fR3UJ/bY +V55CQy1FjX5H1katVpezi1bs17stqrjL0aCk8s7wZPQ9KTy7SfMF9rUfg8ltrj8s +MD5cq21GJuJMpI2kNUV7IT+4B3CeHzpm0iy8NmbavgNezZAx1za4QIySNcKfdsSs +7PsNYPS0R9BeZK/4u4/yrQvRV0lXzQcIJPpwr0cfuhcgcHG8sbCLaw4Ph6go9kRL +hvY7ZX9pdBLS8ukQ4w== +-----END CERTIFICATE----- diff --git a/sepolicy/private/keys.conf b/sepolicy/private/keys.conf new file mode 100644 index 00000000..9b0aa03d --- /dev/null +++ b/sepolicy/private/keys.conf @@ -0,0 +1,2 @@ +[@WFCACTIVATION] +ALL : device/google/wahoo/sepolicy/private/certs/wfcactivation.x509.pem diff --git a/sepolicy/private/mac_permissions.xml b/sepolicy/private/mac_permissions.xml new file mode 100644 index 00000000..636d5794 --- /dev/null +++ b/sepolicy/private/mac_permissions.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/sepolicy/private/seapp_contexts b/sepolicy/private/seapp_contexts index fbb9ba49..9dde7c20 100644 --- a/sepolicy/private/seapp_contexts +++ b/sepolicy/private/seapp_contexts @@ -1,3 +1,6 @@ #Add new domain for DataServices #TODO Remove user "system" when b/38043081 is resolved user=system seinfo=platform name=.dataservices domain=dataservice_app type=system_app_data_file + +# Domain for WfcActivation app +user=_app seinfo=wfcactivation name=com.google.android.wfcactivation domain=wfc_activation_app levelFrom=all diff --git a/sepolicy/private/wfc_activation_app.te b/sepolicy/private/wfc_activation_app.te new file mode 100644 index 00000000..cd32efc4 --- /dev/null +++ b/sepolicy/private/wfc_activation_app.te @@ -0,0 +1,9 @@ +type wfc_activation_app, domain, coredomain; + +app_domain(wfc_activation_app) +net_domain(wfc_activation_app) + +# Services +allow wfc_activation_app app_api_service:service_manager find; +allow wfc_activation_app qchook_service:service_manager find; +allow wfc_activation_app radio_service:service_manager find; From aa948d83570e29566212409dbd1d68cd9727f825 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 27 Feb 2018 17:00:06 -0800 Subject: [PATCH 168/300] Only include bitness of hal impls that is used. Bug: 73829928 Test: boot walleye, check directories, no errors during boot Change-Id: Ia1272b2bcc5006fa75a50631861fbaccdeed7bee --- CleanSpec.mk | 4 ++++ device.mk | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index b0c4379e..427efc57 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -168,3 +168,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.powe # Remove Vibrator HAL 1.1 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.vibrator@1.1-service.wahoo.rc) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.vibrator@1.1-service.wahoo) + +# Remove all HALs (actual bitness now being specified) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/*) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/*) diff --git a/device.mk b/device.mk index 88f2318e..739065af 100755 --- a/device.mk +++ b/device.mk @@ -297,10 +297,10 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ hwcomposer.msm8998 \ - android.hardware.graphics.composer@2.1-impl \ + android.hardware.graphics.composer@2.1-impl:64 \ android.hardware.graphics.composer@2.1-service \ gralloc.msm8998 \ - android.hardware.graphics.allocator@2.0-impl \ + android.hardware.graphics.allocator@2.0-impl:64 \ android.hardware.graphics.allocator@2.0-service \ android.hardware.graphics.mapper@2.0-impl \ libbt-vendor @@ -312,7 +312,7 @@ PRODUCT_PACKAGES += \ # Light HAL PRODUCT_PACKAGES += \ lights.$(PRODUCT_HARDWARE) \ - android.hardware.light@2.0-impl \ + android.hardware.light@2.0-impl:64 \ android.hardware.light@2.0-service # eSE applet HALs @@ -328,13 +328,13 @@ PRODUCT_PACKAGES += \ # Bluetooth HAL PRODUCT_PACKAGES += \ libbt-vendor \ - android.hardware.bluetooth@1.0-impl \ + android.hardware.bluetooth@1.0-impl:64 \ android.hardware.bluetooth@1.0-service \ wcnss_filter # DRM HAL PRODUCT_PACKAGES += \ - android.hardware.drm@1.0-impl \ + android.hardware.drm@1.0-impl:32 \ android.hardware.drm@1.0-service \ android.hardware.drm@1.0-service.widevine \ android.hardware.drm@1.1-service.clearkey \ @@ -349,7 +349,7 @@ PRODUCT_PACKAGES += \ nfc_nci.msm8998 \ NfcNci \ Tag \ - android.hardware.nfc@1.0-impl \ + android.hardware.nfc@1.0-impl:64 \ android.hardware.nfc@1.0-service PRODUCT_COPY_FILES += \ @@ -368,7 +368,7 @@ PRODUCT_PACKAGES += \ libc2dcolorconvert PRODUCT_PACKAGES += \ - android.hardware.camera.provider@2.4-impl \ + android.hardware.camera.provider@2.4-impl:32 \ android.hardware.camera.provider@2.4-service \ camera.device@3.2-impl \ camera.msm8998 \ @@ -378,7 +378,7 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ sensors.$(PRODUCT_HARDWARE) \ - android.hardware.sensors@1.0-impl \ + android.hardware.sensors@1.0-impl:64 \ android.hardware.sensors@1.0-service PRODUCT_COPY_FILES += \ @@ -394,12 +394,12 @@ PRODUCT_PACKAGES += \ # Context hub HAL PRODUCT_PACKAGES += \ - android.hardware.contexthub@1.0-impl.generic \ + android.hardware.contexthub@1.0-impl.generic:64 \ android.hardware.contexthub@1.0-service # Boot control HAL PRODUCT_PACKAGES += \ - android.hardware.boot@1.0-impl \ + android.hardware.boot@1.0-impl:64 \ android.hardware.boot@1.0-service \ # Vibrator HAL @@ -463,9 +463,9 @@ PRODUCT_PACKAGES += \ libaudio-resampler PRODUCT_PACKAGES += \ - android.hardware.audio@2.0-impl \ - android.hardware.audio.effect@2.0-impl \ - android.hardware.soundtrigger@2.1-impl \ + android.hardware.audio@2.0-impl:32 \ + android.hardware.audio.effect@2.0-impl:32 \ + android.hardware.soundtrigger@2.1-impl:32 \ android.hardware.audio@2.0-service # stereo speakers: orientation changes swap L/R channels From 0c556bbbac9d3a2366d5d244cd5be720a42c0677 Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Wed, 6 Dec 2017 16:20:18 -0800 Subject: [PATCH 169/300] Mount ptp separately from mtp Ptp is now mounted in its own directory so the mtp endpoint does not need to be closed to write the ptp descriptors. Bug: 72877174 Test: switch config to mtp/ptp Change-Id: I9cec66eeb882fbf23851cdaf2e3906e8b3150b0a --- init.hardware.usb.rc | 5 +++-- usb/UsbGadget.cpp | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/init.hardware.usb.rc b/init.hardware.usb.rc index c504a40e..09ae4d53 100644 --- a/init.hardware.usb.rc +++ b/init.hardware.usb.rc @@ -30,6 +30,7 @@ on early-boot mkdir /config/usb_gadget/g1/functions/midi.gs5 mkdir /config/usb_gadget/g1/functions/ffs.adb mkdir /config/usb_gadget/g1/functions/ffs.mtp + mkdir /config/usb_gadget/g1/functions/ffs.ptp mkdir /config/usb_gadget/g1/functions/diag.diag mkdir /config/usb_gadget/g1/functions/cser.dun.0 mkdir /config/usb_gadget/g1/functions/cser.nmea.1 @@ -44,9 +45,9 @@ on early-boot mkdir /dev/usb-ffs/adb 0770 shell shell mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000 mkdir /dev/usb-ffs/mtp 0770 mtp mtp + mkdir /dev/usb-ffs/ptp 0770 mtp mtp mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 - setprop sys.usb.ffs.max_write 524288 - setprop sys.usb.ffs.max_read 524288 + mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 setprop sys.usb.mtp.device_type 3 setprop sys.usb.controller "a800000.dwc3" write /sys/module/libcomposite/parameters/disable_l1_for_hs "y" diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp index 33944433..3ba0394e 100644 --- a/usb/UsbGadget.cpp +++ b/usb/UsbGadget.cpp @@ -335,8 +335,7 @@ V1_0::Status UsbGadget::setupFunctions( int i = 0; std::string bootMode = GetProperty(PERSISTENT_BOOT_MODE, ""); - if (((functions & GadgetFunction::PTP) != 0) || - ((functions & GadgetFunction::MTP) != 0)) { + if (((functions & GadgetFunction::MTP) != 0)) { ffsEnabled = true; ALOGI("setCurrentUsbFunctions mtp"); if (!WriteStringToFile("1", DESC_USE_PATH)) return Status::ERROR; @@ -351,6 +350,21 @@ V1_0::Status UsbGadget::setupFunctions( mEndpointList.push_back("/dev/usb-ffs/mtp/ep1"); mEndpointList.push_back("/dev/usb-ffs/mtp/ep2"); mEndpointList.push_back("/dev/usb-ffs/mtp/ep3"); + } else if (((functions & GadgetFunction::PTP) != 0)) { + ffsEnabled = true; + ALOGI("setCurrentUsbFunctions ptp"); + if (!WriteStringToFile("1", DESC_USE_PATH)) return Status::ERROR; + + if (inotify_add_watch(inotifyFd, "/dev/usb-ffs/ptp/", IN_ALL_EVENTS) == -1) + return Status::ERROR; + + + if (linkFunction("ffs.ptp", i++)) return Status::ERROR; + + // Add endpoints to be monitored. + mEndpointList.push_back("/dev/usb-ffs/ptp/ep1"); + mEndpointList.push_back("/dev/usb-ffs/ptp/ep2"); + mEndpointList.push_back("/dev/usb-ffs/ptp/ep3"); } if ((functions & GadgetFunction::MIDI) != 0) { From d3ecc04db8cba65a48c17d798feec16ba88af2b3 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Wed, 28 Feb 2018 12:20:17 +0900 Subject: [PATCH 170/300] Rename rild.libpath to vendor.rild.libpath Bug: 36796459 Test: succeeded building and tested on a taimen device Change-Id: Iaf77c0b2fb15bf75c48f7cbe5d5bb96bdd6417fe Merged-In: Iaf77c0b2fb15bf75c48f7cbe5d5bb96bdd6417fe (cherry picked from commit 4e66b11f93d1b4fef99b500af23e65e1b5942867) --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 739065af..78592ae8 100755 --- a/device.mk +++ b/device.mk @@ -236,7 +236,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.radio.data_con_rprt=true \ persist.radio.always_send_plmn=true \ persist.rcs.supported=1 \ - rild.libpath=/vendor/lib64/libril-qc-qmi-1.so + vendor.rild.libpath=/vendor/lib64/libril-qc-qmi-1.so # Disable snapshot timer PRODUCT_PROPERTY_OVERRIDES += \ From a7b1f6be9c48ec2da78e828d4a4d1d115e030983 Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Sun, 11 Feb 2018 16:18:16 -0800 Subject: [PATCH 171/300] add back nfc_notify for both walleye and taimen Taimen also has the nfc issue. Bug: 69482513 Change-Id: I1cff9b02df04c060c98a8baa6378c5bb6f95030b --- device.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/device.mk b/device.mk index 739065af..e2322675 100755 --- a/device.mk +++ b/device.mk @@ -636,3 +636,8 @@ PRODUCT_DEXPREOPT_SPEED_APPS += \ # audio effects config PRODUCT_PROPERTY_OVERRIDES += \ fmas.hdph_sgain=0 + +# NFC/camera interaction workaround - DO NOT COPY TO NEW DEVICES +PRODUCT_PROPERTY_OVERRIDES += \ + ro.camera.notify_nfc=1 + From ba1439d10aad8295d11922087e2f3f6c8c6faac3 Mon Sep 17 00:00:00 2001 From: Siqi Lin Date: Fri, 2 Mar 2018 15:06:23 -0800 Subject: [PATCH 172/300] sepolicy: allow vendor_init to write to /proc/sysrq-trigger Bug: 73088609 Test: manual - trigger crash from app Change-Id: I045169d7ea6a38d681dc6826117e505cd20aadd0 --- sepolicy/vendor/vendor_init.te | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index dbc56673..549a668f 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -19,6 +19,11 @@ allow vendor_init debugfs_clk:file w_file_perms; allow vendor_init proc_uid_cpupower:file write; dontaudit vendor_init kernel:system module_request; +# Allow vendor_init to write to /proc/sysrq-trigger on userdebug and eng builds +userdebug_or_eng(` + allow vendor_init proc_sysrq:file w_file_perms; +') + set_prop(vendor_init, bluetooth_prop) set_prop(vendor_init, camera_prop) set_prop(vendor_init, modem_diag_prop) From 2697312928f31006331af518a7e4837b56cbb4dd Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Fri, 2 Mar 2018 19:41:31 -0800 Subject: [PATCH 173/300] Migrate pixel 2 to audio V4 Test: regression test on the board Bug: 38184704 Change-Id: Ife559125850277865451f92ea862e7ec47fc9da7 Merged-In: Ife559125850277865451f92ea862e7ec47fc9da7 Cherry-picked from master Signed-off-by: Kevin Rocard --- CleanSpec.mk | 4 ++++ device.mk | 4 ++-- manifest.xml | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index 427efc57..7f0654ab 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -172,3 +172,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.vibr # Remove all HALs (actual bitness now being specified) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/*) + +# Remove android.hardware.audio*@2.0 implementation +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.audio*@2.0-impl.so) + diff --git a/device.mk b/device.mk index e2322675..12dd9f1e 100755 --- a/device.mk +++ b/device.mk @@ -463,8 +463,8 @@ PRODUCT_PACKAGES += \ libaudio-resampler PRODUCT_PACKAGES += \ - android.hardware.audio@2.0-impl:32 \ - android.hardware.audio.effect@2.0-impl:32 \ + android.hardware.audio@4.0-impl:32 \ + android.hardware.audio.effect@4.0-impl:32 \ android.hardware.soundtrigger@2.1-impl:32 \ android.hardware.audio@2.0-service diff --git a/manifest.xml b/manifest.xml index b0829eb7..44712f7e 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,8 +1,8 @@ - + android.hardware.audio hwbinder - 2.0 + 4.0 IDevicesFactory default @@ -11,7 +11,7 @@ android.hardware.audio.effect hwbinder - 2.0 + 4.0 IEffectsFactory default From f39d286782e6c8259389ef5ecb5cf63fcfe42a4d Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Fri, 2 Mar 2018 14:14:09 -0800 Subject: [PATCH 174/300] Ensure taking a bugreport generates no denials. This commit adds new SELinux permissions and neverallow rules so that taking a bugreport does not produce any denials. Bug: 73256908 Test: Captured bugreports and verified that there were no denials. Merged-In: I84ed2be7438a4202d37ff91cb3846f491de29d70 Change-Id: I84ed2be7438a4202d37ff91cb3846f491de29d70 (cherry picked from commit d7854eb513f1533b0239baa81706b37a327cb529) --- sepolicy/vendor/dumpstate.te | 6 ++++++ sepolicy/vendor/file.te | 3 +++ sepolicy/vendor/file_contexts | 2 ++ sepolicy/vendor/genfs_contexts | 7 +++++++ sepolicy/vendor/hal_dumpstate_impl.te | 5 +++++ sepolicy/vendor/smlog_dump.te | 3 +++ sepolicy/vendor/vold.te | 1 + 7 files changed, 27 insertions(+) diff --git a/sepolicy/vendor/dumpstate.te b/sepolicy/vendor/dumpstate.te index 05c68ec6..ad385db0 100644 --- a/sepolicy/vendor/dumpstate.te +++ b/sepolicy/vendor/dumpstate.te @@ -12,3 +12,9 @@ userdebug_or_eng(` allow hal_dumpstate sysfs_batteryinfo:dir search; allow hal_dumpstate sysfs_batteryinfo:file rw_file_perms; + +# For collecting bugreports. +allow dumpstate sysfs_scsi_devices_0000:file r_file_perms; +allow dumpstate sysfs_scsi_devices_other:file r_file_perms; +allow dumpstate sysfs_devices_block_stat:file r_file_perms; +dontaudit dumpstate kernel:system module_request; diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 2d4adebf..9f7faeff 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -11,6 +11,8 @@ type sysfs_msm_subsys_restart, sysfs_type, fs_type; type sysfs_rmtfs, sysfs_type, fs_type; type sysfs_soc, sysfs_type, fs_type; type sysfs_scsi_devices_0000, sysfs_type, fs_type; +type sysfs_scsi_devices_other, sysfs_type, fs_type; +type sysfs_devices_block_stat, sysfs_type, fs_type; type sysfs_timestamp_switch, sysfs_type, fs_type; type sysfs_touch, sysfs_type, fs_type; type sysfs_usb_c, sysfs_type, fs_type; @@ -29,6 +31,7 @@ type debugfs_wlan, debugfs_type, fs_type; type debugfs_mdp, debugfs_type, fs_type; type debugfs_icnss, debugfs_type, fs_type; type debugfs_ufs, debugfs_type, fs_type; +type debugfs_dma_bufinfo, debugfs_type, fs_type; # /proc type proc_wifi_dbg, fs_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 1079d070..16a27a6b 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -290,3 +290,5 @@ # b/70518189 vDSO experiments /sys/module/vdso/parameters u:object_r:sysfs_vdso:s0 + +/sys/devices/virtual/block/.*/stat u:object_r:sysfs_devices_block_stat:s0 diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 6434c9a6..7f05483c 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -12,6 +12,11 @@ genfscon sysfs /devices/soc/soc:qcom,memlat-cpu4 u:object_r:sysfs_msm_subsy genfscon sysfs /android_touch u:object_r:sysfs_touch:s0 genfscon sysfs /devices/soc/1da4000.ufshc/host0/target0:0:0/0:0:0:0 u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/soc/1da4000.ufshc/host0/target0:0:0/0:0:0:1 u:object_r:sysfs_scsi_devices_other:s0 +genfscon sysfs /devices/soc/1da4000.ufshc/host0/target0:0:0/0:0:0:2 u:object_r:sysfs_scsi_devices_other:s0 +genfscon sysfs /devices/soc/1da4000.ufshc/host0/target0:0:0/0:0:0:3 u:object_r:sysfs_scsi_devices_other:s0 +genfscon sysfs /devices/soc/1da4000.ufshc/host0/target0:0:0/0:0:0:4 u:object_r:sysfs_scsi_devices_other:s0 +genfscon sysfs /devices/soc/1da4000.ufshc/host0/target0:0:0/0:0:0:5 u:object_r:sysfs_scsi_devices_other:s0 genfscon sysfs /class/rfkill/rfkill0/state u:object_r:sysfs_bluetooth_writable:s0 @@ -90,3 +95,5 @@ genfscon debugfs /mdp u:object_r:debugfs_mdp:s0 genfscon debugfs /rmt_storage u:object_r:debugfs_rmt_storage:s0 genfscon debugfs /icnss u:object_r:debugfs_icnss:s0 genfscon debugfs /ufshcd0 u:object_r:debugfs_ufs:s0 + +genfscon debugfs /dma_buf/bufinfo u:object_r:debugfs_dma_bufinfo:s0 diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index 7815f71b..bcfc2673 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -65,3 +65,8 @@ allow hal_dumpstate_impl sysfs_touch:file rw_file_perms; # Access to UFS info allow hal_dumpstate_impl sysfs_scsi_devices_0000:dir r_dir_perms; allow hal_dumpstate_impl sysfs_scsi_devices_0000:file r_file_perms; + +# For collecting bugreports. +allow hal_dumpstate_impl shell_data_file:file getattr; +userdebug_or_eng(`allow hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms;') +dontaudit hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms; diff --git a/sepolicy/vendor/smlog_dump.te b/sepolicy/vendor/smlog_dump.te index bc8d94b4..243a1def 100644 --- a/sepolicy/vendor/smlog_dump.te +++ b/sepolicy/vendor/smlog_dump.te @@ -24,4 +24,7 @@ userdebug_or_eng(` allow smlog_dump dumpstate:fd use; allow smlog_dump hal_dumpstate_impl:fd use; allow smlog_dump uio_device:chr_file rw_file_perms; + + # For collecting bugreports. + allow smlog_dump shell_data_file:file write; ') diff --git a/sepolicy/vendor/vold.te b/sepolicy/vendor/vold.te index 80edf33c..be4eff39 100644 --- a/sepolicy/vendor/vold.te +++ b/sepolicy/vendor/vold.te @@ -1,6 +1,7 @@ get_prop(vold, tee_listener_prop) allow vold sysfs_scsi_devices_0000:file write; +allow vold sysfs_scsi_devices_other:file write; allow vold persist_file:dir r_dir_perms; From 1b7e98f600a596a5d3a09cc1f369556fdbbf048c Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 5 Mar 2018 20:08:57 -0800 Subject: [PATCH 175/300] Grant hal_bootctl permissions for new type. Bug: 74213358 Test: Built policy. Merged-In: Icf523468e06b65095755594a8de68f42c789751c Change-Id: Icf523468e06b65095755594a8de68f42c789751c (cherry picked from commit 84e961164e269241eebf4bc78650c796c7d2e502) --- sepolicy/vendor/hal_bootctl.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sepolicy/vendor/hal_bootctl.te b/sepolicy/vendor/hal_bootctl.te index da24b797..e5ebb89a 100644 --- a/sepolicy/vendor/hal_bootctl.te +++ b/sepolicy/vendor/hal_bootctl.te @@ -29,3 +29,6 @@ allow hal_bootctl xbl_block_device:blk_file rw_file_perms; # Expose a socket for brokered boot message access for hal_oemlock. allow hal_bootctl hal_bootctl_socket:sock_file create_file_perms; + +allow hal_bootctl sysfs_scsi_devices_other:dir r_dir_perms; +allow hal_bootctl sysfs_scsi_devices_other:file r_file_perms; From fd5a749d3bdf3844e869932d09b07e775f398977 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Tue, 6 Mar 2018 13:32:07 -0800 Subject: [PATCH 176/300] Remove unnecessary permissions. Remove sysfs file permissions and use the generic type for directories. Bug:74213358 Test: Flash OTA. Merged-In: I27a27972f01a273b4eb65d72dd8f2827c1a374af Change-Id: I27a27972f01a273b4eb65d72dd8f2827c1a374af (cherry picked from commit 278cab5f371e79b638a71c45bbc8afd523b15d13) --- sepolicy/vendor/hal_bootctl.te | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sepolicy/vendor/hal_bootctl.te b/sepolicy/vendor/hal_bootctl.te index e5ebb89a..2c9e49ef 100644 --- a/sepolicy/vendor/hal_bootctl.te +++ b/sepolicy/vendor/hal_bootctl.te @@ -22,13 +22,10 @@ allow hal_bootctl tmpfs:lnk_file r_file_perms; # Read the sysfs to lookup what /dev/sgN device # corresponds to the XBL partitions. -allow hal_bootctl sysfs:dir r_dir_perms; +allow hal_bootctl sysfs_type:dir r_dir_perms; # Write to the XBL devices. allow hal_bootctl xbl_block_device:blk_file rw_file_perms; # Expose a socket for brokered boot message access for hal_oemlock. allow hal_bootctl hal_bootctl_socket:sock_file create_file_perms; - -allow hal_bootctl sysfs_scsi_devices_other:dir r_dir_perms; -allow hal_bootctl sysfs_scsi_devices_other:file r_file_perms; From 56c0900c11e72e1895b7150bd6d39f7aa153e725 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Thu, 8 Mar 2018 17:30:27 +0900 Subject: [PATCH 177/300] Disable modules that can't be built in PDK Modules that can't be built in PDK are disabled when TARGET_BUILD_PDK is true Bug: 71361051 Test: lunch aosp_walleye-userdebug PDK_FUSION_PLATFORM_ZIP=vendor/pdk/walleye/walleye-userdebug/platform/platform.zip m -j Change-Id: I2cc7ab6d667daab7d3566baf8a9b473cafc4e452 --- folio_daemon/Android.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/folio_daemon/Android.mk b/folio_daemon/Android.mk index d2787c06..ed5b5daa 100755 --- a/folio_daemon/Android.mk +++ b/folio_daemon/Android.mk @@ -1,4 +1,8 @@ LOCAL_PATH := $(call my-dir) + +# Disabling when building with PDK (b/68767391) +ifneq ($(TARGET_BUILD_PDK),true) + include $(CLEAR_VARS) LOCAL_SHARED_LIBRARIES := \ @@ -20,3 +24,5 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE_OWNER := google include $(BUILD_EXECUTABLE) + +endif From 6a644c872b6a89dad3fa990c1558538c9ff49077 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 8 Mar 2018 11:02:43 -0800 Subject: [PATCH 178/300] WORKAROUND: add audio 2.0 to manifest ... to fix the mixed build. Wahoo doesn't have audio 2.0 so this is expected to break VtsTrebleVintfTest, but this allows the GSI + wahoo vendor image to build (because GSI falsely requires audio 2.0 but wahoo only provides 4.0). Test: checkvintf manifest.xml compatibility_matrix.legacy.xml Bug: 74341777 Change-Id: I3403127ae13bb12d9266d9f467391a51b135e73d --- manifest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifest.xml b/manifest.xml index 44712f7e..5ab960bb 100644 --- a/manifest.xml +++ b/manifest.xml @@ -2,6 +2,8 @@ android.hardware.audio hwbinder + + 2.0 4.0 IDevicesFactory @@ -11,6 +13,8 @@ android.hardware.audio.effect hwbinder + + 2.0 4.0 IEffectsFactory From c10e253c27f09eea56e9cc670a24a6c76d3eba3a Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 5 Mar 2018 17:50:45 -0800 Subject: [PATCH 179/300] Remove regex and label the whole directory. This is cleaner, as it allows us to remove a regex and label the entire directory, and it will hopefully improve performance. Bug: 74209458 Bug: 74366296 Test: Boot device, verify file labels, and test wifi and camera. Test: Locally flashed OTA by following go/manual-ab-ota. Test: Locally tested updated_verifier by following b/74366296#comment8. Merged-In: I003dc949cf109cc63d75cee9515ef72cb9d0f055 Change-Id: I85f07b2fc8bfb472f25a66e32d3c7d746886535e (cherry picked from commit 8a70f7ef1d1805a8f79486c10280407354f1230b) --- sepolicy/vendor/dumpstate.te | 2 +- sepolicy/vendor/file.te | 2 +- sepolicy/vendor/file_contexts | 2 -- sepolicy/vendor/genfs_contexts | 1 + sepolicy/vendor/vold.te | 1 + 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sepolicy/vendor/dumpstate.te b/sepolicy/vendor/dumpstate.te index ad385db0..e2bdda42 100644 --- a/sepolicy/vendor/dumpstate.te +++ b/sepolicy/vendor/dumpstate.te @@ -16,5 +16,5 @@ allow hal_dumpstate sysfs_batteryinfo:file rw_file_perms; # For collecting bugreports. allow dumpstate sysfs_scsi_devices_0000:file r_file_perms; allow dumpstate sysfs_scsi_devices_other:file r_file_perms; -allow dumpstate sysfs_devices_block_stat:file r_file_perms; +allow dumpstate sysfs_devices_block:file r_file_perms; dontaudit dumpstate kernel:system module_request; diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 9f7faeff..b73cef69 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -12,7 +12,7 @@ type sysfs_rmtfs, sysfs_type, fs_type; type sysfs_soc, sysfs_type, fs_type; type sysfs_scsi_devices_0000, sysfs_type, fs_type; type sysfs_scsi_devices_other, sysfs_type, fs_type; -type sysfs_devices_block_stat, sysfs_type, fs_type; +type sysfs_devices_block, sysfs_type, fs_type; type sysfs_timestamp_switch, sysfs_type, fs_type; type sysfs_touch, sysfs_type, fs_type; type sysfs_usb_c, sysfs_type, fs_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 16a27a6b..1079d070 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -290,5 +290,3 @@ # b/70518189 vDSO experiments /sys/module/vdso/parameters u:object_r:sysfs_vdso:s0 - -/sys/devices/virtual/block/.*/stat u:object_r:sysfs_devices_block_stat:s0 diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 7f05483c..fa5a27c0 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -77,6 +77,7 @@ genfscon sysfs /devices/soc/a800000.ssusb/a800000.dwc3/xhci-hcd.0.auto/usb2 u:ob genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,usb-pdphy@1700/usbpd0/typec u:object_r:sysfs_usb_c:s0 genfscon sysfs /module/diagchar u:object_r:sysfs_diag:s0 genfscon sysfs /kernel/irq_helper/irq_blacklist_on u:object_r:sysfs_irq:s0 +genfscon sysfs /devices/virtual/block/ u:object_r:sysfs_devices_block:s0 genfscon debugfs /kgsl/proc u:object_r:debugfs_kgsl:s0 genfscon debugfs /clk/debug_suspend u:object_r:debugfs_clk:s0 diff --git a/sepolicy/vendor/vold.te b/sepolicy/vendor/vold.te index be4eff39..43647df0 100644 --- a/sepolicy/vendor/vold.te +++ b/sepolicy/vendor/vold.te @@ -2,6 +2,7 @@ get_prop(vold, tee_listener_prop) allow vold sysfs_scsi_devices_0000:file write; allow vold sysfs_scsi_devices_other:file write; +allow vold sysfs_devices_block:file write; allow vold persist_file:dir r_dir_perms; From 43e4bf7ab7cde8b8bde22213b0f73cc61f38c4ba Mon Sep 17 00:00:00 2001 From: Amruth Ramachandran Date: Wed, 7 Mar 2018 17:49:14 -0800 Subject: [PATCH 180/300] ConnectivityMonitor sepolicy update: Add audio_server permission ConnectivityMonitor requires the current audio route for voice calls. Error fixed: auditd : avc: denied { find } for service=media.audio_policy pid=4056 uid=1001 scontext=u:r:con_monitor_app:s0:c233,c259,c512,c768 tcontext=u:object_r:audioserver_service:s0 tclass=service_manager permissive=0 Bug: 3619416 Change-Id: I6f5c1512a554b2db21768aa36277ada7e57fdf8a --- sepolicy/vendor/con_monitor.te | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te index 74e7496e..534cff00 100644 --- a/sepolicy/vendor/con_monitor.te +++ b/sepolicy/vendor/con_monitor.te @@ -10,3 +10,4 @@ allow con_monitor_app radio_vendor_data_file:file create_file_perms; allow con_monitor_app hal_power_hwservice:hwservice_manager find; allow con_monitor_app hal_power_default:binder call; allow con_monitor_app radio_service:service_manager find; +allow con_monitor_app audioserver_service:service_manager find; From e176b1e9d1b8f931d938e87f64a6670706b2667c Mon Sep 17 00:00:00 2001 From: Petri Gynther Date: Fri, 2 Mar 2018 18:00:19 -0800 Subject: [PATCH 181/300] Walleye/Taimen: switch to QCOM BT HAL The flag definition: BOARD_USES_SDM845_BLUETOOTH_HAL := true adds SDM845 Bluetooth components to the build: vendor/qcom/sdm845/proprietary/bluetooth/hidl_transport/Android.mk vendor/qcom/sdm845/proprietary/bt/hci_qcomm_init/Android.mk and removes MSM8998 Bluetooth components from the build: vendor/qcom/msm8998/prebuilts/grease/target/product/msm8998/Android.mk vendor/qcom/msm8998/proprietary/proprietary/bt/hci_qcomm_init/Android.mk Effectively, Walleye/Taimen switch to the same QCOM BT HAL as B1/C1. Bug: 73968979 Test: Manual build and test with BT A2DP headphones (cherry picked from commit 7c2dc1679dc6cfc4576a53cf7257c94f654dae2e) Change-Id: I4d6444932a807e573f6e8d88c6ad4ba4de8f277a --- BoardConfig.mk | 1 + device.mk | 7 +++---- sepolicy/vendor/file_contexts | 1 + sepolicy/vendor/hal_bluetooth_default.te | 12 ++++++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index 16d96b61..a0c27247 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -89,6 +89,7 @@ TARGET_ANDROID_FILESYSTEM_CONFIG_H := device/google/wahoo/android_filesystem_con QCOM_BOARD_PLATFORMS += msm8998 BOARD_HAVE_BLUETOOTH_QCOM := true +BOARD_USES_SDM845_BLUETOOTH_HAL := true BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/google/wahoo/bluetooth # Camera diff --git a/device.mk b/device.mk index adf24cd2..49859a80 100755 --- a/device.mk +++ b/device.mk @@ -327,10 +327,9 @@ PRODUCT_PACKAGES += \ # Bluetooth HAL PRODUCT_PACKAGES += \ - libbt-vendor \ - android.hardware.bluetooth@1.0-impl:64 \ - android.hardware.bluetooth@1.0-service \ - wcnss_filter + android.hardware.bluetooth@1.0-impl-qti:64 \ + android.hardware.bluetooth@1.0-service-qti \ + android.hardware.bluetooth@1.0-service-qti.rc # DRM HAL PRODUCT_PACKAGES += \ diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 1079d070..ddca8dec 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -183,6 +183,7 @@ /vendor/bin/init\.power\.sh u:object_r:init_power_exec:s0 /vendor/bin/init\.radio\.sh u:object_r:init_radio_exec:s0 +/vendor/bin/hw/android\.hardware\.bluetooth@1\.0-service-qti u:object_r:hal_bluetooth_default_exec:s0 /vendor/bin/hw/android\.hardware\.drm@1\.0-service\.widevine u:object_r:hal_drm_widevine_exec:s0 /vendor/bin/hw/android\.hardware\.drm@1\.1-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 /vendor/bin/hw/android\.hardware\.vibrator@1\.2-service\.wahoo u:object_r:hal_vibrator_default_exec:s0 diff --git a/sepolicy/vendor/hal_bluetooth_default.te b/sepolicy/vendor/hal_bluetooth_default.te index d345ee72..fa6ba605 100644 --- a/sepolicy/vendor/hal_bluetooth_default.te +++ b/sepolicy/vendor/hal_bluetooth_default.te @@ -7,3 +7,15 @@ allow hal_bluetooth fwk_scheduler_hwservice:hwservice_manager find; allow hal_bluetooth system_server:binder call; set_prop(hal_bluetooth_default, wc_prop) + +userdebug_or_eng(` + allow hal_bluetooth_default diag_device:chr_file rw_file_perms; + allow hal_bluetooth_default ramdump_vendor_data_file:dir w_dir_perms; + allow hal_bluetooth_default ramdump_vendor_data_file:file { create w_file_perms }; + allow hal_bluetooth_default sysfs_timestamp_switch:file r_file_perms; + r_dir_file(hal_bluetooth_default, debugfs_ipc) + r_dir_file(hal_bluetooth_default, sysfs_diag) + set_prop(hal_bluetooth_default, ssr_prop) +') + +dontaudit hal_bluetooth_default diag_device:chr_file rw_file_perms; From a4a5db5772301ed57f6ebd6d8f64527742690a01 Mon Sep 17 00:00:00 2001 From: Ruchi Kandoi Date: Thu, 1 Mar 2018 13:59:26 -0800 Subject: [PATCH 182/300] Remove system and vendor image dependency libnfc-nci.conf shouldn't be a part of vendor image, since it is accessed by libnfc-nci and Nfc application, both are part of system image. Test: Nfc enable/disable Bug: 72080121 Change-Id: I686ba234c7d2aa923070c3fa980c56b73b18e574 (cherry picked from commit 3197b56882ed9997043d87e6582f6ebaa0fdbace) --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 49859a80..84bfcfbc 100755 --- a/device.mk +++ b/device.mk @@ -352,7 +352,7 @@ PRODUCT_PACKAGES += \ android.hardware.nfc@1.0-service PRODUCT_COPY_FILES += \ - device/google/wahoo/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nci.conf \ + device/google/wahoo/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_SYSTEM)/etc/libnfc-nci.conf \ PRODUCT_PACKAGES += \ android.hardware.usb@1.1-service.wahoo From 9361747cc93dc3b392ecde6023cbf3f6508aff2d Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Fri, 9 Mar 2018 11:15:19 -0800 Subject: [PATCH 183/300] Make sure network scan results get SPN name Make sure network scan results get SPN name so that it is same as OPERATOR NAME Bug: 72360640 Change-Id: I3e7bdfcef5f1c402faa137f211ed2f59f61d0b48 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 84bfcfbc..23f76b65 100755 --- a/device.mk +++ b/device.mk @@ -234,7 +234,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.radio.sap_silent_pin=1 \ persist.radio.sib16_support=1 \ persist.radio.data_con_rprt=true \ - persist.radio.always_send_plmn=true \ + persist.radio.always_send_plmn=false\ persist.rcs.supported=1 \ vendor.rild.libpath=/vendor/lib64/libril-qc-qmi-1.so From a6bb5dd866b4d90c86a8425bf0466803e803ed38 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 22 Feb 2018 15:58:32 -0800 Subject: [PATCH 184/300] Enable BLE Hearing Aid on wahoo Bug: 69623109 Change-Id: Id138c157dd508a4c42167095f30d68fad1013ac5 --- audio_policy_configuration.xml | 3 +++ device.mk | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/audio_policy_configuration.xml b/audio_policy_configuration.xml index 91d790a0..6ccfc176 100644 --- a/audio_policy_configuration.xml +++ b/audio_policy_configuration.xml @@ -197,6 +197,9 @@ + + + diff --git a/device.mk b/device.mk index 23f76b65..f023c581 100755 --- a/device.mk +++ b/device.mk @@ -459,7 +459,8 @@ PRODUCT_PACKAGES += \ audio.a2dp.default \ audio.usb.default \ audio.r_submix.default \ - libaudio-resampler + libaudio-resampler \ + audio.hearing_aid.default PRODUCT_PACKAGES += \ android.hardware.audio@4.0-impl:32 \ @@ -502,6 +503,7 @@ PRODUCT_COPY_FILES += \ 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/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/hearing_aid_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/hearing_aid_audio_policy_configuration.xml \ # audio hal tables PRODUCT_COPY_FILES += \ From fcdd5dd588cbec5ae1b6a891c8829ae09165547a Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Mon, 12 Mar 2018 14:07:37 -0700 Subject: [PATCH 185/300] Match NN manifest version with current HVX version Currently, HIDL manifests files only support a single version of a HIDL interface. Even though the Neural Networks API has defined and implemented a 1.1 HAL, the only real driver (HVX service driver) is currently only 1.0. This problem is similar to that in b/73556059. Soon, HIDL will be able to support multiple interface versions in the device manifest. Until then, or until the HVX service driver is upgraded to 1.1, the manifest will be changed to 1.0. Bug: 74443090 Test: mma Change-Id: I46811231dff92e136dfccb88e85b8ce70b89ac1d --- manifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index 5ab960bb..84f19d70 100644 --- a/manifest.xml +++ b/manifest.xml @@ -216,7 +216,7 @@ android.hardware.neuralnetworks hwbinder - 1.1 + 1.0 IDevice hvx From 294cd6b8d899ff28f13639abeaebc56e48e392e6 Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Tue, 13 Mar 2018 15:31:06 -0700 Subject: [PATCH 186/300] Update SVN to 9 for May Release bug: 74345861 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 89319f4c..654393b8 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=8 + ro.vendor.build.svn=9 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 11cb44a54d71809a9b041c408295e86ea66b1e58 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 15 Mar 2018 15:22:16 -0700 Subject: [PATCH 187/300] wahoo: power: change CPU min freq to 0 in config cpufreq driver will pick up lowest freq if 0 is written. Bug: 75018682 Test: Boot Change-Id: I458fdc199908b334023c30617b77cc558827424e --- powerhint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/powerhint.json b/powerhint.json index 04279092..2c2b785e 100755 --- a/powerhint.json +++ b/powerhint.json @@ -21,7 +21,7 @@ "1512000", "1478400", "1134000", - "384000" + "0" ], "ResetOnInit": true }, @@ -47,7 +47,7 @@ "1420800", "1344000", "1132800", - "300000" + "0" ], "ResetOnInit": true }, From f276b19001381bddfe4f8d69a74c03c5a4535842 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 15 Mar 2018 17:31:03 -0700 Subject: [PATCH 188/300] Remove audio V2 from manifest. Test: build VINTF metadata Test: change target-level to 2, build VINTF metadata Test: vts_treble_vintf_test does not complain on audio V2. Bug: 74341777 Change-Id: Id93c53914bbdaa02098e90912a38c3ba1c341a20 --- manifest.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/manifest.xml b/manifest.xml index 84f19d70..034e8c46 100644 --- a/manifest.xml +++ b/manifest.xml @@ -2,8 +2,6 @@ android.hardware.audio hwbinder - - 2.0 4.0 IDevicesFactory @@ -13,8 +11,6 @@ android.hardware.audio.effect hwbinder - - 2.0 4.0 IEffectsFactory From e848273f3db4d7547a4ebc3a64804942a043eabf Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 16 Mar 2018 16:43:31 -0700 Subject: [PATCH 189/300] wahoo: target FCM version = 2 because it serves radio.deprecated. Fixes: 75321688 Test: vts_treble_vintf_test Change-Id: I79b03129414140fdc773797adca57135a048397c --- manifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index 034e8c46..5745cb1b 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,4 +1,4 @@ - + android.hardware.audio hwbinder From d4945911233151030fcd2bfd55be1f5eeb464a26 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Thu, 15 Mar 2018 16:38:35 -0700 Subject: [PATCH 190/300] Remove hibern8 tweak We disabled auto_hibern8 in kernel, so there's no sysfs entry for that. Bug: 75004568 Bug: 66697973 Bug: 65535484 Change-Id: Iaa95c60435b74ffb97c103701515e9aa55946a91 Signed-off-by: Jaegeuk Kim --- init.hardware.rc | 3 --- 1 file changed, 3 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 60786f5a..c3066958 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -27,7 +27,6 @@ on charger # Enable UFS powersaving write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1 write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1 - write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1 write /sys/class/typec/port0/port_type sink write /sys/module/lpm_levels/parameters/sleep_disabled N @@ -45,7 +44,6 @@ on init # Disable UFS powersaving write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 0 write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 0 - write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 0 write /sys/module/lpm_levels/parameters/sleep_disabled Y # QSEE rpmb listener need symlink for bootdevice @@ -566,7 +564,6 @@ on property:sys.boot_completed=1 # Enable UFS powersaving write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1 write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1 - write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1 write /sys/module/lpm_levels/parameters/sleep_disabled N # Setup final cpuset From 8e42ca9426069d06cafc3246e15271eba996e9db Mon Sep 17 00:00:00 2001 From: Andrew LeCain Date: Wed, 14 Mar 2018 19:57:00 -0700 Subject: [PATCH 191/300] Add qsee_log to dumpstate Updating dumpstate to cat /d/tzdbg/qsee_log Added debugfs_tzdbg selinux security context Give hal_dumpstate_impl debugfs_tzdbg read permissions Fixes: 74536221 Test: taimen: adb bugreport, qsee_log in dumpstate_device.txt Change-Id: If80e665b789125d11a55d2812380aa4b906f10ab --- dumpstate/DumpstateDevice.cpp | 7 +------ dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc | 3 +++ sepolicy/vendor/file.te | 1 + sepolicy/vendor/genfs_contexts | 1 + sepolicy/vendor/hal_dumpstate_impl.te | 2 ++ 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 363f3343..7c9a0dea 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -261,12 +261,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); DumpTouch(fd); RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"}); - - /* Check if qsee_logger tool exists */ - if (!access("/vendor/bin/qsee_logger", X_OK)) { - RunCommandToFd(fd, "FP LOGS", {"qsee_logger", "-d"}); - } - + RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "cat /d/tzdbg/qsee_log"}); DumpFileToFd(fd, "Battery type", "/sys/class/power_supply/bms/battery_type"); RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"}); diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc index 39a96184..bfd76177 100644 --- a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc +++ b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc @@ -2,3 +2,6 @@ service vendor.dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-servi class hal user system group system + +on boot + chmod 0444 /sys/kernel/debug/tzdbg/qsee_log diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index b73cef69..cc99f23f 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -32,6 +32,7 @@ type debugfs_mdp, debugfs_type, fs_type; type debugfs_icnss, debugfs_type, fs_type; type debugfs_ufs, debugfs_type, fs_type; type debugfs_dma_bufinfo, debugfs_type, fs_type; +type debugfs_tzdbg, debugfs_type, fs_type; # /proc type proc_wifi_dbg, fs_type; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index fa5a27c0..fa561efb 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -98,3 +98,4 @@ genfscon debugfs /icnss u:object_r:debugfs_icnss:s genfscon debugfs /ufshcd0 u:object_r:debugfs_ufs:s0 genfscon debugfs /dma_buf/bufinfo u:object_r:debugfs_dma_bufinfo:s0 +genfscon debugfs /tzdbg u:object_r:debugfs_tzdbg:s0 diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index bcfc2673..8a60bfa5 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -19,6 +19,8 @@ userdebug_or_eng(` allow hal_dumpstate_impl netmgr_data_file:file r_file_perms; allow hal_dumpstate_impl debugfs_ipc:dir r_dir_perms; allow hal_dumpstate_impl debugfs_ipc:file r_file_perms; + allow hal_dumpstate_impl debugfs_tzdbg:dir search; + allow hal_dumpstate_impl debugfs_tzdbg:file r_file_perms; allow hal_dumpstate_impl sysfs_usb_device:dir r_dir_perms; allow hal_dumpstate_impl sysfs_usb_device:file r_file_perms; allow hal_dumpstate_impl sysfs_msm_subsys:file write; From 5d2db97dd9a664ef18a5f122c3b76d26794fcb99 Mon Sep 17 00:00:00 2001 From: Andrew Lehmer Date: Fri, 23 Feb 2018 12:28:07 -0800 Subject: [PATCH 192/300] folio_daemon: start and stop with other services If sensorservice goes down while folio_daemon is running, folio_daemon will gracefully exit and restart. If sensorservice remains down while folio_daemon is starting, it will eventually crash due to the way the ASensorManager_getInstanceForPackage() API behaves (i.e., it will exit with a SIGABRT after five minutes of waiting). We can reduce the chance of this happening by ensuring folio_daemon is only started when its dependent services are explicitly started as well. Note that this cannot guarantee that folio_daemon will *never* crash due to SIGABRT, since there is no variant of ASensorManager_getInstanceForPackage() that allows for graceful handling of the service timeout. Events that negatively affect the availability of sensors are outside the control of folio_daemon. Bug: 73555660 Test: loaded on walleye and tested with `stop` and `start` commands Change-Id: I65e1b72745719f2540bff7cab8e556725486bcad (cherry picked from commit 9ebb33ed1373677a40a17faf12700408ba97ee8e) --- init.hardware.rc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/init.hardware.rc b/init.hardware.rc index c3066958..4b5be71f 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -502,6 +502,13 @@ service vendor.folio_daemon /system/bin/folio_daemon class late_start user system group system + disabled + +on property:init.svc.zygote=running + start vendor.folio_daemon + +on property:init.svc.zygote=stopped + stop vendor.folio_daemon service vendor.perfd /vendor/bin/perfd class main From be2ed11266296db3c486642a22db9326c67fdc70 Mon Sep 17 00:00:00 2001 From: Miguel de Dios Date: Wed, 7 Mar 2018 17:21:45 -0800 Subject: [PATCH 193/300] Expose USB-C thermistor in ThermalHAL for Wahoo. Expose USB-C to calls to getTemperatures() in ThermalHAL for wahoo. Bug: 67749183 Test: VtsHalThermalV1_0TargetTest pass Change-Id: Ic45dea1c990e0c71a6ac621145b93cb0f7aa9519 (cherry picked from commit 51872d4950d3ce0ce66ff6ea9c3bd81301b53ad8) --- thermal/thermal-helper.cpp | 12 ++++++++++++ thermal/thermal-helper.h | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/thermal/thermal-helper.cpp b/thermal/thermal-helper.cpp index 878c82f5..163f0fd0 100644 --- a/thermal/thermal-helper.cpp +++ b/thermal/thermal-helper.cpp @@ -200,6 +200,18 @@ ssize_t fillTemperatures(hidl_vec *temperatures) { } current_index++; } + + // USB-C temperature. + if (current_index < temperatures->size()) { + // temperature in Celsius. + result = readTemperature( + kUsbcSensorNum, TemperatureType::UNKNOWN, kUsbcLabel, 0.1, NAN, NAN, + NAN, &(*temperatures)[current_index]); + if (result < 0) { + return result; + } + current_index++; + } return kTemperatureNum; } diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h index 311a67d8..3b86efe2 100644 --- a/thermal/thermal-helper.h +++ b/thermal/thermal-helper.h @@ -69,17 +69,19 @@ constexpr unsigned int kTaimenRcVrThrottledBelowMin = 50; constexpr unsigned int kBatterySensorNum = 0; +constexpr unsigned int kUsbcSensorNum = 5; constexpr unsigned int kGpuTsensOffset = 11; constexpr unsigned int kCpuNum = 8; constexpr const char *kGpuLabel = "GPU"; constexpr const char *kBatteryLabel = "battery"; constexpr const char *kSkinLabel = "skin"; +constexpr const char *kUsbcLabel = "usbc"; constexpr const char *kCpuLabel[kCpuNum] = {"CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7"}; constexpr int kCpuTsensOffset[kCpuNum] = {1, 2, 4, 3, 5, 6, 7, 8}; -// Sum of kCpuNum + 3 for GPU, BATTERY, and SKIN. -constexpr unsigned int kTemperatureNum = 3 + kCpuNum; +// Sum of kCpuNum + 4 for GPU, BATTERY, SKIN, and USB-C. +constexpr unsigned int kTemperatureNum = 4 + kCpuNum; // qcom, therm-reset-temp constexpr unsigned int kCpuShutdownThreshold = 115; From d1fc766d4d483119b44c5d41c21d0149403e69ce Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Wed, 14 Mar 2018 14:17:30 -0700 Subject: [PATCH 194/300] Remove drm@1.1::I*/default and widevine from the manifest. 1.1 clearkey is kept using the old format so that OTA still works (otherwise, the old libvintf on the device won't be able to see that 1.1 clearkey is on the device, and will fail OTA.) Use the latest syntax. Test: build device Test: lshal Test: play Google Play videos Test: vts_treble_vintf_test DRM passes Bug: 73556059 Change-Id: I7ef58838dbff0e28e55de2a9e9404571d2006af6 --- manifest.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.xml b/manifest.xml index 5745cb1b..2c00afc8 100644 --- a/manifest.xml +++ b/manifest.xml @@ -86,16 +86,16 @@ 1.1 ICryptoFactory - default - widevine clearkey IDrmFactory - default - widevine clearkey + @1.0::ICryptoFactory/default + @1.0::IDrmFactory/default + @1.0::ICryptoFactory/widevine + @1.0::IDrmFactory/widevine android.hardware.dumpstate From 5a2137fd80948c0618afab197b3876a71c53b9f2 Mon Sep 17 00:00:00 2001 From: Miguel de Dios Date: Mon, 19 Mar 2018 08:29:59 -0700 Subject: [PATCH 195/300] Fix the thermal zone offsets for thermalHAL in wahoo. We added four new thermal zones in wahoo. First 4 thermal_zone (0-3) now are: mnh_ipu1, mnh_ipu2, mnh_cpu, mnh_lpddr so we need to shift all our thermal zone offsets by 4. This is also causing an IO error whenever we call getTemperatures() since the battery sensor tries to read mnh_ipu1: taimen:/ # cat /sys/class/thermal/thermal_zone0/type mnh_ipu1 taimen:/ # cat /sys/class/thermal/thermal_zone0/temp cat: /sys/class/thermal/thermal_zone0/temp: I/O error taimen:/ # cat /sys/class/thermal/thermal_zone4/type battery taimen:/ # cat /sys/class/thermal/thermal_zone4/temp 19800 Bug: 75842171 Test: VtsHalThermalV1_0TargetTest pass Change-Id: Iaa54bd69caaa3b9a16324709d6b858a7dec6200e --- thermal/thermal-helper.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h index 3b86efe2..be3ae861 100644 --- a/thermal/thermal-helper.h +++ b/thermal/thermal-helper.h @@ -46,30 +46,29 @@ constexpr const char *kTemperatureFileFormat = "/sys/class/thermal/thermal_zone% constexpr const char *kCpuOnlineFileFormat = "/sys/devices/system/cpu/cpu%d/online"; // thermal-engine.conf -constexpr unsigned int kWalleyeSkinSensorNum = 9; +constexpr unsigned int kWalleyeSkinSensorNum = 13; constexpr auto kWalleyeSkinSensorType = "back_therm"; -constexpr unsigned int kWalleyeTsensOffset = 11; +constexpr unsigned int kWalleyeTsensOffset = 15; constexpr unsigned int kWalleyeSkinThrottlingThreshold = 40; constexpr unsigned int kWalleyeSkinShutdownThreshold = 56; constexpr unsigned int kWalleyeVrThrottledBelowMin = 52; -constexpr unsigned int kTaimenRabSkinSensorNum = 8; +constexpr unsigned int kTaimenRabSkinSensorNum = 12; constexpr auto kTaimenRabSkinSensorType = "bd_therm"; -constexpr unsigned int kTaimenRabTsensOffset = 9; +constexpr unsigned int kTaimenRabTsensOffset = 13; constexpr unsigned int kTaimenRabSkinThrottlingThreshold = 49; constexpr unsigned int kTaimenRabSkinShutdownThreshold = 66; constexpr unsigned int kTaimenRabVrThrottledBelowMin = 62; -constexpr unsigned int kTaimenRcSkinSensorNum = 8; +constexpr unsigned int kTaimenRcSkinSensorNum = 12; constexpr auto kTaimenRcSkinSensorType = "bd_therm2"; -constexpr unsigned int kTaimenRcTsensOffset = 9; +constexpr unsigned int kTaimenRcTsensOffset = 13; constexpr unsigned int kTaimenRcSkinThrottlingThreshold = 38; constexpr unsigned int kTaimenRcSkinShutdownThreshold = 54; constexpr unsigned int kTaimenRcVrThrottledBelowMin = 50; - -constexpr unsigned int kBatterySensorNum = 0; constexpr unsigned int kUsbcSensorNum = 5; +constexpr unsigned int kBatterySensorNum = 4; constexpr unsigned int kGpuTsensOffset = 11; constexpr unsigned int kCpuNum = 8; From f3002a2656bb8d267685826a608caeaba35a2361 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 19 Mar 2018 22:31:14 -0700 Subject: [PATCH 196/300] wahoo: dumpstate: dump cpuidle for all cores Bug: 75974794 Test: take BR Change-Id: Iefb52e369db72621554926e59725b5fa4dc74cd7 --- dumpstate/DumpstateDevice.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 363f3343..0b1efcc7 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -245,14 +245,11 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "SMD Log", "/d/ipc_logging/smd/log"); RunCommandToFd(fd, "ION HEAPS", {"/vendor/bin/sh", "-c", "for d in $(ls -d /d/ion/*); do for f in $(ls $d); do echo --- $d/$f; cat $d/$f; done; done"}); DumpFileToFd(fd, "dmabuf info", "/d/dma_buf/bufinfo"); - RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", "for f in `ls /sys/class/thermal` ; do type=`cat /sys/class/thermal/$f/type` ; temp=`cat /sys/class/thermal/$f/temp` ; echo \"$type: $temp\" ; done"}); RunCommandToFd(fd, "Easel debug info", {"/vendor/bin/sh", "-c", "for f in `ls /sys/bus/i2c/devices/9-0008/@(*curr|temperature|vbat|total_power)`; do echo \"$f: `cat $f`\" ; done; file=/sys/devices/virtual/misc/mnh_sm/state; echo \"$file: `cat $file`\""}); - DumpFileToFd(fd, "cpu0-3 time-in-state", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state"); - RunCommandToFd(fd, "cpu0-3 cpuidle", {"/vendor/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu0/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"}); - DumpFileToFd(fd, "cpu4-7 time-in-state", "/sys/devices/system/cpu/cpu4/cpufreq/stats/time_in_state"); - RunCommandToFd(fd, "cpu4-7 cpuidle", {"/vendor/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu4/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"}); - DumpFileToFd(fd, "cpu0-3 thermal limit", "/sys/devices/virtual/thermal/cooling_device0/cur_state"); - DumpFileToFd(fd, "cpu4-7 thermal limit", "/sys/devices/virtual/thermal/cooling_device1/cur_state"); + RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/thermal* ; do type=`cat $f/type` ; temp=`cat $f/temp` ; echo \"$type: $temp\" ; done"}); + RunCommandToFd(fd, "Cooling Device Current State", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; do type=`cat $f/type` ; temp=`cat $f/cur_state` ; echo \"$type: $temp\" ; done"}); + RunCommandToFd(fd, "CPU time-in-state", {"/vendor/bin/sh", "-c", "for cpu in /sys/devices/system/cpu/cpu*; do f=$cpu/cpufreq/stats/time_in_state; if [ ! -f $f ]; then continue; fi; echo $f:; cat $f; done"}); + RunCommandToFd(fd, "CPU cpuidle", {"/vendor/bin/sh", "-c", "for cpu in /sys/devices/system/cpu/cpu*; do for d in $cpu/cpuidle/state*; do if [ ! -d $d ]; then continue; fi; echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done; done"}); DumpFileToFd(fd, "MDP xlogs", "/data/vendor/display/mdp_xlog"); DumpFileToFd(fd, "TCPM logs", "/d/tcpm/usbpd0"); DumpFileToFd(fd, "PD Engine", "/d/pd_engine/usbpd0"); From 792da138c3525ff1d810d890ad4e1dc736baf490 Mon Sep 17 00:00:00 2001 From: Petri Gynther Date: Mon, 19 Mar 2018 18:02:57 -0700 Subject: [PATCH 197/300] Walleye/Taimen: fix "Bluetooth keeps stopping" on GSI image Generic System Image does not set any of: - ro.bt.bdaddr_path - persist.service.bdroid.bdaddr - ro.boot.btmacaddr Set ro.bt.bdaddr_path property on the vendor partition, so that it is available when GSI image is installed and booted on the system side. Bug: 71814221 Change-Id: Id9a84e9995f94cc02cb97fedbd4fe289348e73c6 --- device.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device.mk b/device.mk index 73f54729..6d5c14af 100755 --- a/device.mk +++ b/device.mk @@ -331,6 +331,10 @@ PRODUCT_PACKAGES += \ android.hardware.bluetooth@1.0-service-qti \ android.hardware.bluetooth@1.0-service-qti.rc +# Property for loading BDA from bdaddress module in kernel +PRODUCT_PROPERTY_OVERRIDES += \ + ro.bt.bdaddr_path=/sys/module/bdaddress/parameters/bdaddress + # DRM HAL PRODUCT_PACKAGES += \ android.hardware.drm@1.0-impl:32 \ From c1ba4bc4fa8ae07407c860e63ff095f4a99425e7 Mon Sep 17 00:00:00 2001 From: Ye Wen Date: Wed, 14 Mar 2018 10:32:45 -0700 Subject: [PATCH 198/300] Remove runtime permission exception for AiAi. Given default permission granting as TextClassifier service role, this exception is not needed any more. Test: Manually tested to confirm permissions were not granted by default without TC service role. Bug: 72222560 Change-Id: I99c8d929b247cda40f4418997be83830d512aea4 --- default-permissions.xml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/default-permissions.xml b/default-permissions.xml index 8182d179..ab898f17 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -96,21 +96,4 @@ - - - - - - - - - - - - - - - From 73a538096815c69af45e5c7fca22e725098a451c Mon Sep 17 00:00:00 2001 From: mike dooley Date: Mon, 19 Mar 2018 18:26:32 +0100 Subject: [PATCH 199/300] Allow RecogntionConfig data to be accessed on the DSP Test: manual test with SoundTriggerTestApp on crosshatch Bug: 75496083 Change-Id: Ibbd6ff0a401abab9704280ccef381bf8a6752973 --- sound_trigger_platform_info.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound_trigger_platform_info.xml b/sound_trigger_platform_info.xml index 30944a80..0ce2d6ab 100644 --- a/sound_trigger_platform_info.xml +++ b/sound_trigger_platform_info.xml @@ -62,6 +62,7 @@ + @@ -70,6 +71,7 @@ + From 4533ba3a0d6cec936f1b676ae99bf03dcd88748a Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Mon, 19 Mar 2018 23:41:50 +0000 Subject: [PATCH 200/300] Add alanstokes as an owner. Test: n/a Bug: 72643420 Change-Id: Ib329b002231068ce0222530e656167806570c37b --- sepolicy/OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/OWNERS b/sepolicy/OWNERS index 6fa0acc6..9d3f1b17 100644 --- a/sepolicy/OWNERS +++ b/sepolicy/OWNERS @@ -1,3 +1,4 @@ +alanstokes@google.com bowgotsai@google.com dcashman@google.com jbires@google.com From bc68f7f6e0b4412654b20b624a172562c9364fff Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 20 Mar 2018 16:19:12 -0700 Subject: [PATCH 201/300] Renamed config_dozeAfterScreenOff New name is config_dozeAfterScreenOffByDefault Bug: 73178121 Change-Id: Icf2123d45b2b4727092103632d1bd6f024161c8a --- overlay/frameworks/base/core/res/res/values/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index ead9b5fa..c7730ddd 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -229,7 +229,7 @@ - true + true true From ab8d91f947944487adcc54ceeb8add84ea971504 Mon Sep 17 00:00:00 2001 From: Thierry Strudel Date: Thu, 15 Mar 2018 18:42:55 -0700 Subject: [PATCH 202/300] dumpstate: dump SRAM & power supply properties Bug: 74954924 Change-Id: I4e2ba0efaf453d0f713d8859945e61e5f5d9ed8d Signed-off-by: Thierry Strudel --- dumpstate/DumpstateDevice.cpp | 7 +++++-- init.hardware.rc | 14 +++++++++----- sepolicy/vendor/dumpstate.te | 3 --- sepolicy/vendor/file.te | 1 + sepolicy/vendor/genfs_contexts | 2 +- sepolicy/vendor/hal_dumpstate_impl.te | 8 ++++++++ 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 1b3fabe8..e7e0bb67 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -255,13 +255,16 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "PD Engine", "/d/pd_engine/usbpd0"); DumpFileToFd(fd, "smblib-usb logs", "/d/ipc_logging/smblib/log"); DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports"); - DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); DumpTouch(fd); RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"}); RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "cat /d/tzdbg/qsee_log"}); - DumpFileToFd(fd, "Battery type", "/sys/class/power_supply/bms/battery_type"); + RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in /sys/class/power_supply/*/uevent ; do echo \"\n------ $f\" ; cat $f ; done"}); RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"}); + RunCommandToFd(fd, "QCOM FG SRAM", {"/vendor/bin/sh", "-c", "echo 0 > /d/fg/sram/address ; echo 500 > /d/fg/sram/count ; cat /d/fg/sram/data"}); + + DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); + return Void(); }; diff --git a/init.hardware.rc b/init.hardware.rc index 4b5be71f..f344807b 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -466,10 +466,6 @@ on boot # Wifi firmware reload path chown wifi wifi /sys/module/wlan/parameters/fwpath - # Allow system to write to cycle_count_id to iterate and get stats - chown system system /sys/class/power_supply/bms/cycle_count_id - chmod 0666 /sys/class/power_supply/bms/cycle_count_id - # default country code setprop ro.boot.wificountrycode 00 @@ -590,7 +586,7 @@ on property:sys.boot_completed=1 # UFS health chmod 755 /sys/kernel/debug/ufshcd0 - chown 644 /sys/kernel/debug/ufshcd0/err_state + chmod 644 /sys/kernel/debug/ufshcd0/err_state chmod 644 /sys/kernel/debug/ufshcd0/power_mode chmod 644 /sys/kernel/debug/ufshcd0/host_regs chmod 644 /sys/kernel/debug/ufshcd0/show_hba @@ -601,6 +597,14 @@ on property:sys.boot_completed=1 chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats + # QCOM FG SRAM dump for dumpstate + chown system system /d/fg/sram/data + chown system system /d/fg/sram/count + chown system system /d/fg/sram/address + + # com.google.android.hardwareinfo needs to be able to read cycle counts + chmod 0666 /sys/class/power_supply/bms/cycle_count_id + trigger sys-boot-completed-set # We want one opportunity per boot to enable zram, so we diff --git a/sepolicy/vendor/dumpstate.te b/sepolicy/vendor/dumpstate.te index e2bdda42..6892e27f 100644 --- a/sepolicy/vendor/dumpstate.te +++ b/sepolicy/vendor/dumpstate.te @@ -10,9 +10,6 @@ userdebug_or_eng(` binder_call(dumpstate, per_mgr) ') -allow hal_dumpstate sysfs_batteryinfo:dir search; -allow hal_dumpstate sysfs_batteryinfo:file rw_file_perms; - # For collecting bugreports. allow dumpstate sysfs_scsi_devices_0000:file r_file_perms; allow dumpstate sysfs_scsi_devices_other:file r_file_perms; diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index cc99f23f..467eb297 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -31,6 +31,7 @@ type debugfs_wlan, debugfs_type, fs_type; type debugfs_mdp, debugfs_type, fs_type; type debugfs_icnss, debugfs_type, fs_type; type debugfs_ufs, debugfs_type, fs_type; +type debugfs_fg_sram, debugfs_type, fs_type; type debugfs_dma_bufinfo, debugfs_type, fs_type; type debugfs_tzdbg, debugfs_type, fs_type; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index fa561efb..fda77c2f 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -96,6 +96,6 @@ genfscon debugfs /mdp u:object_r:debugfs_mdp:s0 genfscon debugfs /rmt_storage u:object_r:debugfs_rmt_storage:s0 genfscon debugfs /icnss u:object_r:debugfs_icnss:s0 genfscon debugfs /ufshcd0 u:object_r:debugfs_ufs:s0 - +genfscon debugfs /fg/sram u:object_r:debugfs_fg_sram:s0 genfscon debugfs /dma_buf/bufinfo u:object_r:debugfs_dma_bufinfo:s0 genfscon debugfs /tzdbg u:object_r:debugfs_tzdbg:s0 diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index 8a60bfa5..95155077 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -72,3 +72,11 @@ allow hal_dumpstate_impl sysfs_scsi_devices_0000:file r_file_perms; allow hal_dumpstate_impl shell_data_file:file getattr; userdebug_or_eng(`allow hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms;') dontaudit hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms; + +# Query and dump power supply nodes +allow hal_dumpstate_impl sysfs_batteryinfo:dir search; +allow hal_dumpstate_impl sysfs_batteryinfo:file rw_file_perms; + +# Dump QCOM FG content +allow hal_dumpstate_impl debugfs_fg_sram:dir search; +allow hal_dumpstate_impl debugfs_fg_sram:file rw_file_perms; From e671f7473c1d63207ef268e48f315c31a16c5103 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 29 Jan 2018 12:34:14 -0800 Subject: [PATCH 203/300] wahoo: power: add dumpstate support in Power HAL Test: Capture bugreport and check: lshal-debug/android.hardware.power@1.2::IPower_default.txt Bug: 72071908 Change-Id: I0220ce80e69636381d0901c69896b7ce96fde323 --- power-libperfmgr/Power.cpp | 28 ++++++++++++++++++++++++++++ power-libperfmgr/Power.h | 1 + sepolicy/vendor/hal_power_default.te | 9 ++++++--- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index d76321b1..4c621d9d 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -21,6 +21,8 @@ #include #include #include +#include + #include #include @@ -442,6 +444,32 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { return Void(); } +constexpr const char* boolToString(bool b) { + return b ? "true" : "false"; +} + +Return Power::debug(const hidl_handle& handle, const hidl_vec&) { + if (handle != nullptr && handle->numFds >= 1) { + int fd = handle->data[0]; + + std::string buf(android::base::StringPrintf("HintManager Running: %s\n" + "VRMode: %s\n" + "SustainedPerformanceMode: %s\n" + "VideoEncodeMode: %s\n", + boolToString(mHintManager->IsRunning()), + boolToString(mVRModeOn), + boolToString(mSustainedPerfModeOn), + boolToString(mEncoderModeOn))); + // Dump nodes through libperfmgr + mHintManager->DumpToFd(fd); + if (!android::base::WriteStringToFd(buf, fd)) { + PLOG(ERROR) << "Failed to dump state to fd"; + } + fsync(fd); + } + return Void(); +} + } // namespace implementation } // namespace V1_2 } // namespace power diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h index d1eccbe4..a39323f2 100644 --- a/power-libperfmgr/Power.h +++ b/power-libperfmgr/Power.h @@ -62,6 +62,7 @@ struct Power : public IPower { Return powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override; // Methods from ::android::hidl::base::V1_0::IBase follow. + Return debug(const hidl_handle& fd, const hidl_vec& args) override; private: static bool isSupportedGovernor(); diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te index 48009432..c5dfcc1f 100644 --- a/sepolicy/vendor/hal_power_default.te +++ b/sepolicy/vendor/hal_power_default.te @@ -8,9 +8,12 @@ allow hal_power_default debugfs_wlan:file r_file_perms; # To do powerhint on nodes defined in powerhint.json allow hal_power_default sysfs_msm_subsys:dir search; -allow hal_power_default sysfs_msm_subsys:file w_file_perms; -allow hal_power_default sysfs_devices_system_cpu:file w_file_perms; -allow hal_power_default latency_device:chr_file w_file_perms; +allow hal_power_default sysfs_msm_subsys:file rw_file_perms; +allow hal_power_default sysfs_devices_system_cpu:file rw_file_perms; +allow hal_power_default latency_device:chr_file rw_file_perms; # To get/set powerhal state property set_prop(hal_power_default, power_prop) + +# To dump +allow hal_power_default cgroup:file read; From 9b95b34ea8a4aa76cadbb72a0f188d9b2d9e4ad9 Mon Sep 17 00:00:00 2001 From: Tim Murray Date: Wed, 21 Mar 2018 11:13:57 -0700 Subject: [PATCH 204/300] wahoo: disable mem_latency governor Unclear if advantages are worth cumulative power draw. bug 73364974 Test: boot taimen, memlat is powersave Change-Id: I7b5eb176d0f22281e687b9577f5eedf311fb4a11 --- init.power.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/init.power.sh b/init.power.sh index a610afbe..949eae70 100755 --- a/init.power.sh +++ b/init.power.sh @@ -34,12 +34,12 @@ done write /sys/class/devfreq/soc:qcom,mincpubw/governor "cpufreq" # Enable memlat governor -for memlat in /sys/class/devfreq/*qcom,memlat-cpu* -do - write $memlat/governor "mem_latency" - write $memlat/polling_interval 10 - write $memlat/mem_latency/ratio_ceil 400 -done +#for memlat in /sys/class/devfreq/*qcom,memlat-cpu* +#do +# write $memlat/governor "mem_latency" +# write $memlat/polling_interval 10 +# write $memlat/mem_latency/ratio_ceil 400 +#done # Signal perfd that boot has completed setprop sys.post_boot.parsed 1 From cf65303db1186236d02036313027cd5a3a200482 Mon Sep 17 00:00:00 2001 From: Mehdi Alizadeh Date: Fri, 16 Mar 2018 14:12:52 -0700 Subject: [PATCH 205/300] Removes wifi offload HAL service from Wahoo Removes wifi offload HAL service from Wahoo devices by removing related entries from wahoo/device.mk and wahoo/manifest.xml Bug: 74549432 Test: Check logs and verify offload HAL service is not running Change-Id: I45799d07e49c03bac73037867fd0b1db95da495a --- device.mk | 1 - manifest.xml | 9 --------- 2 files changed, 10 deletions(-) diff --git a/device.mk b/device.mk index 6d5c14af..636e0195 100755 --- a/device.mk +++ b/device.mk @@ -442,7 +442,6 @@ PRODUCT_PACKAGES += $(WPA) # Wifi PRODUCT_PACKAGES += \ android.hardware.wifi@1.0-service \ - android.hardware.wifi.offload@1.0-service \ wificond \ wifilogd \ libwpa_client diff --git a/manifest.xml b/manifest.xml index 2c00afc8..07002526 100644 --- a/manifest.xml +++ b/manifest.xml @@ -393,15 +393,6 @@ default - - android.hardware.wifi.offload - hwbinder - 1.0 - - IOffload - default - - com.qualcomm.qti.ims.radio hwbinder From ba729c2dac4f922cd92e4e514b70dbd8fc0e7e97 Mon Sep 17 00:00:00 2001 From: Michael Groover Date: Wed, 21 Mar 2018 16:04:29 -0700 Subject: [PATCH 206/300] Report Verified Boot support on Pixel 2 devices Bug: 63657226 Test: adb shell am instrument -w -e class android.security.cts.VerifiedBootTest android.security.cts/android.support.test.runner.AndroidJUnitRunner Change-Id: I0d4ab6b59567f721dfa7b67f40e526dd1686a320 --- device.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 636e0195..3534b1ad 100755 --- a/device.mk +++ b/device.mk @@ -22,7 +22,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_COPY_FILES += \ device/google/wahoo/default-permissions.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default-permissions/default-permissions.xml \ - frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml + frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \ + frameworks/native/data/etc/android.software.verified_boot.xml:system/etc/permissions/android.software.verified_boot.xml # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ From 274196bca441761fd5b706fe6908be45d80bb0aa Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Thu, 22 Mar 2018 18:11:45 +0900 Subject: [PATCH 207/300] Namespace ramdump_prop with vendor prefix (2/7) debug.ramdump.* and persist.sys.crash_rcu should be renamed to vendor.debug.ramdump.* and persist.vendor.sys.crash_rcu repectively because they are vendor-specific properties. Bug: 74266614 Test: succeeded building and tested with taimen Change-Id: I4d277207b68000160e101456e110656aa483eb83 --- init.hardware.diag.rc.userdebug | 2 +- sepolicy/vendor/property.te | 2 +- sepolicy/vendor/property_contexts | 4 ++-- sepolicy/vendor/ramdump.te | 2 +- sepolicy/vendor/ramdump_app.te | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 234ea230..1f44c84c 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -76,7 +76,7 @@ service vendor.cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cn disabled oneshot -on property:debug.ramdump.force_crash=true +on property:vendor.debug.ramdump.force_crash=true write /proc/sysrq-trigger "c" on property:sys.logger.bluetooth=true diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index 401dbb3f..09fa6df0 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -3,7 +3,7 @@ type cnd_prop, property_type; type ims_prop, property_type; type keymaster_prop, property_type; type net_rmnet_prop, property_type; -type ramdump_prop, property_type; +type vendor_ramdump_prop, property_type; type post_boot_prop, property_type; type public_vendor_default_prop, property_type; type public_vendor_system_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 9f8c01c9..8e5c0ce9 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -10,8 +10,8 @@ persist.net.doxlat u:object_r:vendor_net_radio_prop:s0 sys.post_boot. u:object_r:post_boot_prop:s0 radio. u:object_r:vendor_radio_prop:s0 rcs.publish.status u:object_r:vendor_radio_prop:s0 -debug.ramdump. u:object_r:ramdump_prop:s0 -persist.sys.crash_rcu u:object_r:ramdump_prop:s0 +vendor.debug.ramdump. u:object_r:vendor_ramdump_prop:s0 +persist.vendor.sys.crash_rcu u:object_r:vendor_ramdump_prop:s0 debug.ssrdump u:object_r:ssr_prop:s0 persist.sys.cnss. u:object_r:cnss_diag_prop:s0 sys.listeners.registered u:object_r:tee_listener_prop:s0 diff --git a/sepolicy/vendor/ramdump.te b/sepolicy/vendor/ramdump.te index d150fbfd..7514dead 100644 --- a/sepolicy/vendor/ramdump.te +++ b/sepolicy/vendor/ramdump.te @@ -4,7 +4,7 @@ userdebug_or_eng(` type ramdump, domain; init_daemon_domain(ramdump) - set_prop(ramdump, ramdump_prop) + set_prop(ramdump, vendor_ramdump_prop) allow ramdump self:capability sys_rawio; diff --git a/sepolicy/vendor/ramdump_app.te b/sepolicy/vendor/ramdump_app.te index e9c4f056..c3edcd55 100644 --- a/sepolicy/vendor/ramdump_app.te +++ b/sepolicy/vendor/ramdump_app.te @@ -9,6 +9,6 @@ userdebug_or_eng(` allow ramdump_app ramdump_vendor_data_file:file create_file_perms; allow ramdump_app ramdump_vendor_data_file:dir create_dir_perms; - set_prop(ramdump_app, ramdump_prop); + set_prop(ramdump_app, vendor_ramdump_prop); get_prop(system_app, ssr_prop) ') From d433e0ea146a3a74544868e24d64d33f256f4dcf Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 22 Mar 2018 08:33:17 -0700 Subject: [PATCH 208/300] wpa_supplicant(overlay): Increase max bss count Qcom's driver can support a max of 512 scan results. Ensure that wpa_supplicant is in sync with that number. Bug: 74724482 Test: Device boots up and connects to wifi networks. Change-Id: I62dbd2bd3789c454e9683320d3a58f67019ea7ee --- wpa_supplicant_overlay.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/wpa_supplicant_overlay.conf b/wpa_supplicant_overlay.conf index e1f530db..bb1906c3 100644 --- a/wpa_supplicant_overlay.conf +++ b/wpa_supplicant_overlay.conf @@ -1,3 +1,4 @@ disable_scan_offload=1 p2p_disabled=1 tdls_external_control=1 +bss_max_count=512 From 0569fc68527b8273c55f486b530b8b5b8a8c6a7f Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 22 Mar 2018 16:42:23 -0700 Subject: [PATCH 209/300] Specify DEVICE_FRAMEWORK_COMPAT_MATRIX Test: builds (check vintf metadata) Bug: 65028233 Change-Id: I6a0b6b7377a511be5a35a013712fd28795861b93 --- BoardConfig.mk | 2 +- device_framework_matrix.xml | 66 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 device_framework_matrix.xml diff --git a/BoardConfig.mk b/BoardConfig.mk index a0c27247..1ffacc2c 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -151,7 +151,7 @@ BOARD_CHARGER_ENABLE_SUSPEND := true DEVICE_MANIFEST_FILE := device/google/wahoo/manifest.xml DEVICE_MATRIX_FILE := device/google/wahoo/compatibility_matrix.xml DEVICE_FRAMEWORK_MANIFEST_FILE := device/google/wahoo/framework_manifest.xml - +DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := device/google/wahoo/device_framework_matrix.xml BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true # Use mke2fs to create ext4 images diff --git a/device_framework_matrix.xml b/device_framework_matrix.xml new file mode 100644 index 00000000..917ae5c9 --- /dev/null +++ b/device_framework_matrix.xml @@ -0,0 +1,66 @@ + + + vendor.qti.atcmdfwd + 1.0 + + IAtCmdFwd + AtCmdFwdService + + + + vendor.qti.qcril.am + 1.0 + + IQcRilAudio + slot1 + + + + com.qualcomm.qti.ims.radio + 1.1 + + IImsRadio + imsradio0 + + + + com.qualcomm.qti.imsrtpservice + 1.0 + + IRTPService + imsrtpservice + + + + com.qualcomm.qti.qcril.qcrilhook + 1.0 + + IQtiOemHook + oemhook0 + + + + com.qualcomm.qti.uceservice + 1.0 + + IUceService + com.qualcomm.qti.uceservice + + + + com.quicinc.cne.api + 1.0 + + IApiService + cnd + + + + com.quicinc.cne.server + 1.0 + + IServer + cnd + + + From c5ec9e09d1e11b1f24b7519af505dd956d048631 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Tue, 6 Mar 2018 12:46:40 -0800 Subject: [PATCH 210/300] Set VID/PID for diag functions persist.vendor.usb.config stores the vendor specific functions that are enabled in the target when ro.bootmode is set to usbradio through the adb command. Since its a persistent property, the oem functions are persisted once enabled. Alternatively, store the oem functions in vendor.usb.config. vendor.usb.config is not persisted though. vendor.usb.config will also reflect the enabled oem functions. Configurations supported in this CL: 1. diag 2. diag,serial_cdev,rmnet_gsi This would work irrespective of when ADB is not or not. Bug: 74603740 Test: Made sure the QXDM recognized wahoo when adb is enabled/ disabled for diag and diag,serial_cdev,rmnet_gsi Change-Id: Icbbe177e3f8958efc36f67692b9ec935b718fb03 --- init.hardware.diag.rc.userdebug | 6 ++ usb/UsbGadget.cpp | 114 +++++++++++++++++++++++++++----- usb/UsbGadget.h | 2 + 3 files changed, 107 insertions(+), 15 deletions(-) diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 234ea230..070b2d74 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -92,3 +92,9 @@ on property:persist.bluetooth.btsnoopenable=true on property:persist.bluetooth.btsnoopenable=false setprop persist.service.bdroid.soclog false + +on property:vendor.usb.config=* + start usbd + +on property:persist.vendor.usb.usbradio.config=* + start usbd diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp index 33944433..05608e2a 100644 --- a/usb/UsbGadget.cpp +++ b/usb/UsbGadget.cpp @@ -32,6 +32,7 @@ constexpr int EPOLL_EVENTS = 10; constexpr bool DEBUG = false; constexpr int DISCONNECT_WAIT_US = 10000; +#define BUILD_TYPE "ro.build.type" #define GADGET_PATH "/config/usb_gadget/g1/" #define PULLUP_PATH GADGET_PATH "UDC" #define GADGET_NAME "a800000.dwc3" @@ -49,6 +50,9 @@ constexpr int DISCONNECT_WAIT_US = 10000; #define FUNCTION_PATH CONFIG_PATH FUNCTION_NAME #define RNDIS_PATH FUNCTIONS_PATH "gsi.rndis" +#define PERSISTENT_VENDOR_CONFIG "persist.vendor.usb.usbradio.config" +#define VENDOR_CONFIG "vendor.usb.config" + namespace android { namespace hardware { namespace usb { @@ -165,10 +169,8 @@ static void *monitorFfs(void *param) { } UsbGadget::UsbGadget() - : mMonitorCreated(false), - mCurrentUsbFunctionsApplied(false) { - if (access(OS_DESC_PATH, R_OK) != 0) - ALOGE("configfs setup not done yet"); + : mMonitorCreated(false), mCurrentUsbFunctionsApplied(false) { + if (access(OS_DESC_PATH, R_OK) != 0) ALOGE("configfs setup not done yet"); } static int unlinkFunctions(const char *path) { @@ -277,40 +279,115 @@ static V1_0::Status setVidPid(const char *vid, const char *pid) { return Status::SUCCESS; } +static std::string getVendorFunctions() { + if (GetProperty(BUILD_TYPE, "") == "user") return "user"; + + std::string bootMode = GetProperty(PERSISTENT_BOOT_MODE, ""); + std::string persistVendorFunctions = + GetProperty(PERSISTENT_VENDOR_CONFIG, ""); + std::string vendorFunctions = GetProperty(VENDOR_CONFIG, ""); + std::string ret = ""; + + if (vendorFunctions != "") { + ret = vendorFunctions; + } else if (bootMode == "usbradio") { + if (persistVendorFunctions != "") + ret = persistVendorFunctions; + else + ret = "diag"; + // vendor.usb.config will reflect the current configured functions + SetProperty(VENDOR_CONFIG, ret); + } + + return ret; +} + static V1_0::Status validateAndSetVidPid(uint64_t functions) { V1_0::Status ret = Status::SUCCESS; + std::string vendorFunctions = getVendorFunctions(); + switch (functions) { case static_cast(GadgetFunction::MTP): - ret = setVidPid("0x18d1", "0x4ee1"); + if (vendorFunctions == "diag") { + ret = setVidPid("0x05C6", "0x901B"); + } else { + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x4ee1"); + } break; case GadgetFunction::ADB | GadgetFunction::MTP: - ret = setVidPid("0x18d1", "0x4ee2"); + if (vendorFunctions == "diag") { + ret = setVidPid("0x05C6", "0x903A"); + } else { + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x4ee2"); + } break; case static_cast(GadgetFunction::RNDIS): - ret = setVidPid("0x18d1", "0x4ee3"); + if (vendorFunctions == "diag") { + ret = setVidPid("0x05C6", "0x902C"); + } else if (vendorFunctions == "serial_cdev,diag") { + ret = setVidPid("0x05C6", "0x90B5"); + } else { + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x4ee3"); + } break; case GadgetFunction::ADB | GadgetFunction::RNDIS: - ret = setVidPid("0x18d1", "0x4ee4"); + if (vendorFunctions == "diag") { + ret = setVidPid("0x05C6", "0x902D"); + } else if (vendorFunctions == "serial_cdev,diag") { + ret = setVidPid("0x05C6", "0x90B6"); + } else { + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x4ee4"); + } break; case static_cast(GadgetFunction::PTP): + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = setVidPid("0x18d1", "0x4ee5"); break; case GadgetFunction::ADB | GadgetFunction::PTP: + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = setVidPid("0x18d1", "0x4ee6"); break; case static_cast(GadgetFunction::ADB): - ret = setVidPid("0x18d1", "0x4ee7"); + if (vendorFunctions == "diag") { + ret = setVidPid("0x05C6", "0x901D"); + } else if (vendorFunctions == "diag,serial_cdev,rmnet_gsi") { + ret = setVidPid("0x05C6", "0x9091"); + } else if (vendorFunctions == "diag,serial_cdev") { + ret = setVidPid("0x05C6", "0x901F"); + } else { + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x4ee7"); + } break; case static_cast(GadgetFunction::MIDI): + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = setVidPid("0x18d1", "0x4ee8"); break; case GadgetFunction::ADB | GadgetFunction::MIDI: + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = setVidPid("0x18d1", "0x4ee9"); break; case static_cast(GadgetFunction::ACCESSORY): + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = setVidPid("0x18d1", "0x2d00"); break; case GadgetFunction::ADB | GadgetFunction::ACCESSORY: + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = setVidPid("0x18d1", "0x2d01"); break; default: @@ -344,7 +421,6 @@ V1_0::Status UsbGadget::setupFunctions( if (inotify_add_watch(inotifyFd, "/dev/usb-ffs/mtp/", IN_ALL_EVENTS) == -1) return Status::ERROR; - if (linkFunction("ffs.mtp", i++)) return Status::ERROR; // Add endpoints to be monitored. @@ -355,7 +431,7 @@ V1_0::Status UsbGadget::setupFunctions( if ((functions & GadgetFunction::MIDI) != 0) { ALOGI("setCurrentUsbFunctions MIDI"); - if (linkFunction("midi.gs5", i++)) return Status::ERROR;; + if (linkFunction("midi.gs5", i++)) return Status::ERROR; } if ((functions & GadgetFunction::ACCESSORY) != 0) { @@ -368,11 +444,19 @@ V1_0::Status UsbGadget::setupFunctions( if (linkFunction("gsi.rndis", i++)) return Status::ERROR; } - if (bootMode == "usbradio") { + std::string vendorFunctions = getVendorFunctions(); + if (vendorFunctions != "") { ALOGI("enable usbradio debug functions"); - if (linkFunction("diag.diag", i++)) return Status::ERROR; - if (linkFunction("cser.dun.0", i++)) return Status::ERROR; - if (linkFunction("gsi.rmnet", i++)) return Status::ERROR; + char *function = strtok(const_cast(vendorFunctions.c_str()), ","); + while (function != NULL) { + if (string(function) == "diag" && linkFunction("diag.diag", i++)) + return Status::ERROR; + if (string(function) == "serial_cdev" && linkFunction("cser.dun.0", i++)) + return Status::ERROR; + if (string(function) == "rmnet_gsi" && linkFunction("gsi.rmnet", i++)) + return Status::ERROR; + function = strtok(NULL, ","); + } } if ((functions & GadgetFunction::ADB) != 0) { diff --git a/usb/UsbGadget.h b/usb/UsbGadget.h index ef2ea4dc..9a2c4dd3 100644 --- a/usb/UsbGadget.h +++ b/usb/UsbGadget.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ namespace implementation { using ::android::sp; using ::android::base::GetProperty; +using ::android::base::SetProperty; using ::android::base::unique_fd; using ::android::base::WriteStringToFile; using ::android::hardware::hidl_array; From 8c941829182602e02ce8b6d99e2d5d2459e8769d Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Tue, 13 Mar 2018 10:35:11 -0700 Subject: [PATCH 211/300] set usb oem functions to diag,serial_cdev,rmnet_gsi by default Bug: 74603740 Test: Did a clean flash and checked to see if persist.vendor.usb.config was set to diag,serial_cdev,rmnet_gsi. Change-Id: Ie5e4a723b2fe810fd8e365bc768a25d96379f807 --- device.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/device.mk b/device.mk index 73f54729..20d72ff3 100755 --- a/device.mk +++ b/device.mk @@ -642,3 +642,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.camera.notify_nfc=1 +# default usb oem functions +ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) + PRODUCT_PROPERTY_OVERRIDES += \ + persist.vendor.usb.usbradio.config=diag +endif From 21dbcfd27d57f0c44ef5db1c858ddbc9251a2446 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 26 Mar 2018 17:01:34 +0000 Subject: [PATCH 212/300] Revert "Remove drm@1.1::I*/default and widevine from the manifest." This reverts commit d1fc766d4d483119b44c5d41c21d0149403e69ce. 1.1 clearkey was kept in the old format, but because this manifest is target-level 2, it should have been 1.0 default to be kept in the old format. Bug: b/73556059 Reason for revert: b/76227590 Test: boot Test: vts_treble_vintf_test Test: update from PPR1.180315.002 -> (ToT + this) succeeds Change-Id: I6a437bd77c66a4be679da9cb9b44c5a80cb7a9b4 --- manifest.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.xml b/manifest.xml index 2c00afc8..5745cb1b 100644 --- a/manifest.xml +++ b/manifest.xml @@ -86,16 +86,16 @@ 1.1 ICryptoFactory + default + widevine clearkey IDrmFactory + default + widevine clearkey - @1.0::ICryptoFactory/default - @1.0::IDrmFactory/default - @1.0::ICryptoFactory/widevine - @1.0::IDrmFactory/widevine android.hardware.dumpstate From 296546cdc73ca68e9a0dd662fd277efe6638bdce Mon Sep 17 00:00:00 2001 From: Ecco Park Date: Fri, 23 Mar 2018 17:14:39 -0700 Subject: [PATCH 213/300] wifi: create the sys property for wlan driver/firmware Bug: 76220544 Test: No denial error found for selinux Signed-off-by: Ecco Park Change-Id: If379812a7c8df7fd84beec6734313459938d540e --- device.mk | 1 + init.hardware.rc | 11 +++++++++++ init.qcom.wlan.sh | 6 ++++++ sepolicy/vendor/file.te | 1 + sepolicy/vendor/file_contexts | 1 + sepolicy/vendor/genfs_contexts | 1 + sepolicy/vendor/init-wlan-sh.te | 14 ++++++++++++++ sepolicy/vendor/property.te | 1 + sepolicy/vendor/property_contexts | 2 ++ sepolicy/vendor/ssr_detector.te | 1 + 10 files changed, 39 insertions(+) create mode 100644 init.qcom.wlan.sh create mode 100644 sepolicy/vendor/init-wlan-sh.te diff --git a/device.mk b/device.mk index 636e0195..33eb2826 100755 --- a/device.mk +++ b/device.mk @@ -72,6 +72,7 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/uinput-fpc.idc:system/usr/idc/uinput-fpc.idc \ $(LOCAL_PATH)/init.qcom.devstart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.devstart.sh \ $(LOCAL_PATH)/init.qcom.ipastart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.ipastart.sh \ + $(LOCAL_PATH)/init.qcom.wlan.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.wlan.sh \ $(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \ $(LOCAL_PATH)/init.ramoops.sh:$(TARGET_COPY_OUT_SYSTEM)/bin/init.ramoops.sh \ frameworks/native/services/vr/virtual_touchpad/idc/vr-virtual-touchpad-0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/vr-virtual-touchpad-0.idc \ diff --git a/init.hardware.rc b/init.hardware.rc index f344807b..ce0af9d3 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -826,6 +826,13 @@ service vendor.devstart_sh /vendor/bin/init.qcom.devstart.sh disabled oneshot +service vendor.wlan_sh /vendor/bin/init.qcom.wlan.sh + class main + user root + group root + disabled + oneshot + service vendor.ipastart_sh /vendor/bin/init.qcom.ipastart.sh class main user system @@ -861,3 +868,7 @@ on property:sys.vdso=64 on property:sys.vdso=32 write /sys/module/vdso/parameters/enable_64 0 + +on property:wlan.driver.status=ok + # Get the wlan driver/fw version + start vendor.wlan_sh diff --git a/init.qcom.wlan.sh b/init.qcom.wlan.sh new file mode 100644 index 00000000..78587015 --- /dev/null +++ b/init.qcom.wlan.sh @@ -0,0 +1,6 @@ +#! /vendor/bin/sh + +wlan_driver_version=`cat /sys/kernel/wifi/wlan/driver_version` +setprop sys.wlan.driver.version "$wlan_driver_version" +wlan_fw_version=`cat /sys/kernel/wifi/wlan/fw/0/version` +setprop sys.wlan.firmware.version "$wlan_fw_version" diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 467eb297..9017790f 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -8,6 +8,7 @@ type sysfs_laser, sysfs_type, fs_type; type sysfs_mdss_mdp_caps, sysfs_type, fs_type; type sysfs_msm_subsys, sysfs_type, fs_type; type sysfs_msm_subsys_restart, sysfs_type, fs_type; +type sysfs_msm_wlan, sysfs_type, fs_type; type sysfs_rmtfs, sysfs_type, fs_type; type sysfs_soc, sysfs_type, fs_type; type sysfs_scsi_devices_0000, sysfs_type, fs_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index ddca8dec..9c6901f9 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -178,6 +178,7 @@ /vendor/bin/imsrcsd u:object_r:hal_rcsservice_exec:s0 /vendor/bin/init\.qcom\.devstart\.sh u:object_r:init-qcom-devstart-sh_exec:s0 /vendor/bin/init\.qcom\.ipastart\.sh u:object_r:init-qcom-ipastart-sh_exec:s0 +/vendor/bin/init\.qcom\.wlan\.sh u:object_r:init-qcom-wlan-sh_exec:s0 /vendor/bin/init\.insmod\.sh u:object_r:init-insmod-sh_exec:s0 /vendor/etc/init\.insmod\.cfg u:object_r:init-insmod-sh_exec:s0 /vendor/bin/init\.power\.sh u:object_r:init_power_exec:s0 diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index fda77c2f..dd1ad28a 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -67,6 +67,7 @@ genfscon sysfs /bus/msm_subsys u:object genfscon sysfs /module/subsystem_restart u:object_r:sysfs_msm_subsys_restart:s0 genfscon sysfs /kernel/boot_adsp/boot u:object_r:sysfs_msm_subsys:s0 genfscon sysfs /kernel/boot_slpi/boot u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /kernel/wifi/wlan u:object_r:sysfs_msm_wlan:s0 genfscon sysfs /kernel/memory_state_time u:object_r:sysfs_power:s0 genfscon sysfs /devices/soc/c1b7000.i2c/i2c-9/9-0008 u:object_r:sysfs_easel:s0 genfscon sysfs /class/typec u:object_r:sysfs_usb_c:s0 diff --git a/sepolicy/vendor/init-wlan-sh.te b/sepolicy/vendor/init-wlan-sh.te new file mode 100644 index 00000000..36179ef6 --- /dev/null +++ b/sepolicy/vendor/init-wlan-sh.te @@ -0,0 +1,14 @@ +type init-qcom-wlan-sh, domain; +type init-qcom-wlan-sh_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(init-qcom-wlan-sh) + +allow init-qcom-wlan-sh vendor_shell_exec:file rx_file_perms; +allow init-qcom-wlan-sh vendor_toolbox_exec:file rx_file_perms; + +# Set the sys.wlan.driver.version and sys.wlan.firmware.version property +set_prop(init-qcom-wlan-sh, vendor_wifi_version) + +# /sys/kernel/wifi/wlan/driver_version and /sys/kernel/wifi/wlan/fw/0/version +allow init-qcom-wlan-sh sysfs_msm_wlan:dir r_dir_perms; +allow init-qcom-wlan-sh sysfs_msm_wlan:file r_file_perms; diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index 09fa6df0..909b57cf 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -20,3 +20,4 @@ type bluetooth_log_prop, property_type; type power_prop, property_type; type vendor_net_radio_prop, property_type; type vendor_radio_prop, property_type; +type vendor_wifi_version, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 8e5c0ce9..be8a5772 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -28,6 +28,8 @@ persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 vendor.powerhal.state u:object_r:power_prop:s0 vendor.powerhal.audio u:object_r:power_prop:s0 +sys.wlan.driver.version u:object_r:vendor_wifi_version:s0 +sys.wlan.firmware.version u:object_r:vendor_wifi_version:s0 # public_vendor_default_prop # They are public_vendor_default_props for vendor-specific extension. diff --git a/sepolicy/vendor/ssr_detector.te b/sepolicy/vendor/ssr_detector.te index 27882d51..9144b1ff 100644 --- a/sepolicy/vendor/ssr_detector.te +++ b/sepolicy/vendor/ssr_detector.te @@ -7,6 +7,7 @@ userdebug_or_eng(` allow ssr_detector_app ramdump_vendor_data_file:dir r_dir_perms; allow ssr_detector_app ramdump_vendor_data_file:file r_file_perms; get_prop(ssr_detector_app, ssr_prop) + get_prop(ssr_detector_app, vendor_wifi_version) ') allow ssr_detector_app app_api_service:service_manager find; From 0e8c276eb30c2ca9a00ebbbca50210b8083f1f4a Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 26 Mar 2018 13:04:26 -0700 Subject: [PATCH 214/300] DRM: specify exact interfaces used. Leaving 1.0 in the old format and 1.1 in the new format since this is agaisnt FCM 2 which requires 1.0 (this makes sure that OTAs work). Bug: 73556059 Test: vts_treble_vintf_test (DRM served in 'HalsAreServed') Test: ota 3/15/2018 build -> ToT + this Change-Id: I82e6f9fe0b29b15c2e79e92eb9b2abdbab615a71 --- manifest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.xml b/manifest.xml index 9e54b83a..a64c9a56 100644 --- a/manifest.xml +++ b/manifest.xml @@ -83,19 +83,19 @@ android.hardware.drm hwbinder - 1.1 + 1.0 ICryptoFactory default widevine - clearkey IDrmFactory default widevine - clearkey + @1.1::ICryptoFactory/clearkey + @1.1::IDrmFactory/clearkey android.hardware.dumpstate From d1028fde357c6db935d745b55b53fb6c82e26c8d Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Mon, 26 Mar 2018 16:32:49 -0700 Subject: [PATCH 215/300] Enable TCPM, pd_engine logs on user build. Bug: 75396562 Test: User build bugreports had tcpm and pd_engine logs Change-Id: I77fae102202aa66aa14f6a44fd5bcb3a8531790a --- sepolicy/vendor/hal_dumpstate_impl.te | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index bcfc2673..5d4a4460 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -52,7 +52,7 @@ allow hal_dumpstate_impl debugfs_ufs:file r_file_perms; allow hal_dumpstate_impl sysfs:dir r_dir_perms; # rpm stat # usb logs -userdebug_or_eng(`allow hal_dumpstate_impl debugfs_usb:file r_file_perms;') +allow hal_dumpstate_impl debugfs_usb:file r_file_perms; #Access display debug data allow hal_dumpstate_impl display_vendor_data_file:dir r_dir_perms; From e8a3dcb674d9fc597d9c6dbd0156fa69ee9b630b Mon Sep 17 00:00:00 2001 From: Jie Song Date: Mon, 19 Mar 2018 16:54:46 -0700 Subject: [PATCH 216/300] Add SELinux permissions for vendor usb config Bug: 74603740 Change-Id: I72adb62f6dc8c85ce265616cb13fc638a131e253 --- sepolicy/vendor/hal_usb_impl.te | 2 ++ sepolicy/vendor/logger_app.te | 2 ++ sepolicy/vendor/property.te | 1 + sepolicy/vendor/property_contexts | 2 ++ 4 files changed, 7 insertions(+) diff --git a/sepolicy/vendor/hal_usb_impl.te b/sepolicy/vendor/hal_usb_impl.te index ddbf8f33..98587dca 100644 --- a/sepolicy/vendor/hal_usb_impl.te +++ b/sepolicy/vendor/hal_usb_impl.te @@ -12,3 +12,5 @@ allow hal_usb_impl sysfs_usb_c:file w_file_perms; allow hal_usb_impl sysfs_usb_device:dir r_dir_perms; allow hal_usb_impl sysfs_usb_device:file rw_file_perms; allow hal_usb_impl configfs:file create_file_perms; + +set_prop(hal_usb_impl, vendor_usb_config_prop) diff --git a/sepolicy/vendor/logger_app.te b/sepolicy/vendor/logger_app.te index 46874dae..c5262ba6 100644 --- a/sepolicy/vendor/logger_app.te +++ b/sepolicy/vendor/logger_app.te @@ -19,4 +19,6 @@ userdebug_or_eng(` set_prop(logger_app, cnss_diag_prop) set_prop(logger_app, modem_diag_prop) set_prop(logger_app, bluetooth_log_prop) + + get_prop(logger_app, vendor_usb_config_prop) ') diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index 909b57cf..ced04a3a 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -21,3 +21,4 @@ type power_prop, property_type; type vendor_net_radio_prop, property_type; type vendor_radio_prop, property_type; type vendor_wifi_version, property_type; +type vendor_usb_config_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index be8a5772..266ffbd5 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -30,6 +30,8 @@ vendor.powerhal.state u:object_r:power_prop:s0 vendor.powerhal.audio u:object_r:power_prop:s0 sys.wlan.driver.version u:object_r:vendor_wifi_version:s0 sys.wlan.firmware.version u:object_r:vendor_wifi_version:s0 +persist.vendor.usb.config u:object_r:vendor_usb_config_prop:s0 +vendor.usb.config u:object_r:vendor_usb_config_prop:s0 # public_vendor_default_prop # They are public_vendor_default_props for vendor-specific extension. From c3015d8fb4f6e39f7be843515bdd3e62131a0f88 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Tue, 27 Mar 2018 15:57:47 +0200 Subject: [PATCH 217/300] Taimen/Walleye: Disable sdm rotator downscaler Rotator down scaler is causing additional delays that are better handled by GL composition. Test: Open app, no jank Bug: 73640835 Change-Id: I6ea9baa28acc222afcf365f3bf107149bc8974d9 --- device.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device.mk b/device.mk index 33eb2826..df66d5dc 100755 --- a/device.mk +++ b/device.mk @@ -206,6 +206,10 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.qcom.adreno.qgl.ShaderStorageImageExtendedFormats=0 +# b/73640835 +PRODUCT_PROPERTY_OVERRIDES += \ + sdm.debug.rotator_downscale=1 + # Enable camera EIS3.0 PRODUCT_PROPERTY_OVERRIDES += \ persist.camera.is_type=5 \ From 050d1035b403c431fcd58d9f062158db33e64bd3 Mon Sep 17 00:00:00 2001 From: Miguel de Dios Date: Tue, 27 Mar 2018 10:42:19 -0700 Subject: [PATCH 218/300] Fix the thermal zone numbers for thermalHAL in wahoo. There is a new thermal zone called usb. We need to increment the thermalHAL thermal zone numbers to correspond with this change. Bug: 76107808 Test: manual - manually check thermal zone types on walleye and taimen. Change-Id: If4a867269870ce08fc94b9e541f6ee1a0c3069ac --- thermal/thermal-helper.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h index be3ae861..46fc8349 100644 --- a/thermal/thermal-helper.h +++ b/thermal/thermal-helper.h @@ -46,29 +46,30 @@ constexpr const char *kTemperatureFileFormat = "/sys/class/thermal/thermal_zone% constexpr const char *kCpuOnlineFileFormat = "/sys/devices/system/cpu/cpu%d/online"; // thermal-engine.conf -constexpr unsigned int kWalleyeSkinSensorNum = 13; +constexpr unsigned int kWalleyeSkinSensorNum = 14; constexpr auto kWalleyeSkinSensorType = "back_therm"; -constexpr unsigned int kWalleyeTsensOffset = 15; +constexpr unsigned int kWalleyeTsensOffset = 16; constexpr unsigned int kWalleyeSkinThrottlingThreshold = 40; constexpr unsigned int kWalleyeSkinShutdownThreshold = 56; constexpr unsigned int kWalleyeVrThrottledBelowMin = 52; -constexpr unsigned int kTaimenRabSkinSensorNum = 12; +constexpr unsigned int kTaimenRabSkinSensorNum = 13; constexpr auto kTaimenRabSkinSensorType = "bd_therm"; -constexpr unsigned int kTaimenRabTsensOffset = 13; +constexpr unsigned int kTaimenRabTsensOffset = 14; constexpr unsigned int kTaimenRabSkinThrottlingThreshold = 49; constexpr unsigned int kTaimenRabSkinShutdownThreshold = 66; constexpr unsigned int kTaimenRabVrThrottledBelowMin = 62; -constexpr unsigned int kTaimenRcSkinSensorNum = 12; +constexpr unsigned int kTaimenRcSkinSensorNum = 13; constexpr auto kTaimenRcSkinSensorType = "bd_therm2"; -constexpr unsigned int kTaimenRcTsensOffset = 13; +constexpr unsigned int kTaimenRcTsensOffset = 14; constexpr unsigned int kTaimenRcSkinThrottlingThreshold = 38; constexpr unsigned int kTaimenRcSkinShutdownThreshold = 54; constexpr unsigned int kTaimenRcVrThrottledBelowMin = 50; -constexpr unsigned int kUsbcSensorNum = 5; -constexpr unsigned int kBatterySensorNum = 4; +constexpr unsigned int kUsbcSensorNum = 6; +constexpr unsigned int kBatterySensorNum = 5; +// The gpu thermal sensor is tsens_tz_sensor13. constexpr unsigned int kGpuTsensOffset = 11; constexpr unsigned int kCpuNum = 8; From 42c2ddbdfe3fff49570ce97a883a401be4159cfc Mon Sep 17 00:00:00 2001 From: Siddharth Ray Date: Tue, 27 Mar 2018 15:32:16 -0700 Subject: [PATCH 219/300] Reduced GPS Debug for W/T Debug level to 2 for W/T. Level 3 is too chatty (b/74565767). BUG:74566204 Change-Id: I1856be42bf4c93e2db3929366ddfd3c0f72890dd --- gps.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gps.conf b/gps.conf index 54482b19..4e8fffa7 100644 --- a/gps.conf +++ b/gps.conf @@ -26,7 +26,7 @@ NTP_SERVER = time.google.com # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info # 4 - Debug, 5 - Verbose # If DEBUG_LEVEL is commented, Android's logging levels will be used -DEBUG_LEVEL = 3 +DEBUG_LEVEL = 2 # Intermediate position report, 1=enable, 0=disable INTERMEDIATE_POS=0 From 8fa09289ec18a05b45228639daac40bff2bb2eb1 Mon Sep 17 00:00:00 2001 From: Thierry Strudel Date: Mon, 26 Mar 2018 17:25:56 -0700 Subject: [PATCH 220/300] sepolicy: add type for persist.vendor.charge. Bug: 73647497 Change-Id: I169195f97e2fd42c4106723023e523fd70f255e9 Signed-off-by: Thierry Strudel --- sepolicy/vendor/property.te | 1 + sepolicy/vendor/property_contexts | 1 + sepolicy/vendor/vendor_init.te | 1 + 3 files changed, 3 insertions(+) diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index ced04a3a..eeb2b6d9 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -22,3 +22,4 @@ type vendor_net_radio_prop, property_type; type vendor_radio_prop, property_type; type vendor_wifi_version, property_type; type vendor_usb_config_prop, property_type; +type vendor_charge_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 266ffbd5..ec1c1030 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -32,6 +32,7 @@ sys.wlan.driver.version u:object_r:vendor_wifi_version:s0 sys.wlan.firmware.version u:object_r:vendor_wifi_version:s0 persist.vendor.usb.config u:object_r:vendor_usb_config_prop:s0 vendor.usb.config u:object_r:vendor_usb_config_prop:s0 +persist.vendor.charge. u:object_r:vendor_charge_prop:s0 # public_vendor_default_prop # They are public_vendor_default_props for vendor-specific extension. diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 549a668f..4e85f7c6 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -31,3 +31,4 @@ set_prop(vendor_init, power_prop) set_prop(vendor_init, public_vendor_default_prop) set_prop(vendor_init, vendor_radio_prop) set_prop(vendor_init, thermal_prop) +set_prop(vendor_init, vendor_charge_prop) From ff1557a9ebc0d3a14e0f99cb881e746ec50e9a9c Mon Sep 17 00:00:00 2001 From: Miguel de Dios Date: Tue, 27 Mar 2018 17:52:28 -0700 Subject: [PATCH 221/300] Allow thermalHAL on Wahoo to look up thermistors by name. Instead of hardcoding thermal zone numbers, make thermalHAL look up thermistors by name. This is a backport of the way thermalHAL keeps track of thermal zones in b1c1. Bug: 75972023 Test: VtsHalThermalV1_0TargetTest passes Test: VtsHalThermalV1_1TargetTest passes Test: manual - flash device and check logcat for thermalHAL output. Change-Id: I24194ea6dd0372b52f525ac288108ee9da30258a --- thermal/Android.bp | 1 + thermal/Thermal.cpp | 7 +- thermal/Thermal.h | 1 - thermal/sensors.cpp | 100 +++++++++++++++ thermal/sensors.h | 76 +++++++++++ thermal/thermal-helper.cpp | 251 ++++++++++++++++--------------------- thermal/thermal-helper.h | 22 +--- 7 files changed, 295 insertions(+), 163 deletions(-) create mode 100644 thermal/sensors.cpp create mode 100644 thermal/sensors.h diff --git a/thermal/Android.bp b/thermal/Android.bp index be1e7039..43c003ea 100644 --- a/thermal/Android.bp +++ b/thermal/Android.bp @@ -5,6 +5,7 @@ cc_library { vendor: true, relative_install_path: "hw", srcs: [ + "sensors.cpp", "Thermal.cpp", "thermal-helper.cpp", ], diff --git a/thermal/Thermal.cpp b/thermal/Thermal.cpp index a9bd3715..7b29b29d 100644 --- a/thermal/Thermal.cpp +++ b/thermal/Thermal.cpp @@ -55,6 +55,8 @@ Return Thermal::getTemperatures(getTemperatures_cb _hidl_cb) { hidl_vec temperatures; temperatures.resize(kTemperatureNum); + LOG(INFO) << "ThermalHAL enabled: " << enabled; + if (!enabled) { status.code = ThermalStatusCode::FAILURE; status.debugMessage = "Unsupported hardware"; @@ -62,10 +64,9 @@ Return Thermal::getTemperatures(getTemperatures_cb _hidl_cb) { return Void(); } - ssize_t ret = fillTemperatures(&temperatures); - if (ret < 0) { + if (fillTemperatures(&temperatures) != kTemperatureNum) { status.code = ThermalStatusCode::FAILURE; - status.debugMessage = strerror(-ret); + status.debugMessage = "Error reading thermal sensors."; } _hidl_cb(status, temperatures); diff --git a/thermal/Thermal.h b/thermal/Thermal.h index a62b9e32..d3ac2f9a 100644 --- a/thermal/Thermal.h +++ b/thermal/Thermal.h @@ -54,7 +54,6 @@ struct Thermal : public IThermal { // Methods from ::android::hardware::thermal::V1_1::IThermal follow. Return registerThermalCallback( const sp& callback) override; - private: bool enabled; }; diff --git a/thermal/sensors.cpp b/thermal/sensors.cpp new file mode 100644 index 00000000..7df880bd --- /dev/null +++ b/thermal/sensors.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2018 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 + +#include +#include +#include +#include +#include "sensors.h" + +namespace android { +namespace hardware { +namespace thermal { +namespace V1_1 { +namespace implementation { + +std::string Sensors::getSensorPath(const std::string& sensor_name) { + if (sensor_name_to_data_map_.find(sensor_name) != + sensor_name_to_data_map_.end()) { + return std::get<0>(sensor_name_to_data_map_.at(sensor_name)); + } + return ""; +} + +bool Sensors::addSensor( + const std::string& sensor_name, const std::string& path, + const float throttling_threshold, const float shutdown_threshold, + const float vr_threshold, const TemperatureType& type) { + return sensor_name_to_data_map_.emplace( + sensor_name, std::make_tuple( + path, throttling_threshold, shutdown_threshold, + vr_threshold, type)).second; +} + +bool Sensors::readSensorFile( + const std::string& sensor_name, std::string* data, + std::string* file_path) const { + std::string sensor_reading; + if (sensor_name_to_data_map_.find(sensor_name) == + sensor_name_to_data_map_.end()) { + *data = ""; + *file_path = ""; + return false; + } + + android::base::ReadFileToString( + std::get<0>(sensor_name_to_data_map_.at(sensor_name)), &sensor_reading); + // Strip the newline. + *data = ::android::base::Trim(sensor_reading); + *file_path = std::get<0>(sensor_name_to_data_map_.at(sensor_name)); + return true; +} + +bool Sensors::readTemperature( + const std::string& sensor_name, const float mult, + Temperature* out) const { + if (sensor_name_to_data_map_.find(sensor_name) == + sensor_name_to_data_map_.end()) { + return false; + } + + std::string sensor_reading; + std::string path; + readSensorFile(sensor_name, &sensor_reading, &path); + + auto sensor = sensor_name_to_data_map_.at(sensor_name); + out->name = sensor_name; + out->currentValue = std::stoi(sensor_reading) * mult; + out->throttlingThreshold = std::get<1>(sensor); + out->shutdownThreshold = std::get<2>(sensor); + out->vrThrottlingThreshold = std::get<3>(sensor); + out->type = std::get<4>(sensor); + + LOG(DEBUG) << android::base::StringPrintf( + "readTemperature: %s, %d, %s, %g, %g, %g, %g", + path.c_str(), out->type, out->name.c_str(), out->currentValue, + out->throttlingThreshold, out->shutdownThreshold, + out->vrThrottlingThreshold); + return true; +} + +} // namespace implementation +} // namespace V1_1 +} // namespace thermal +} // namespace hardware +} // namespace android diff --git a/thermal/sensors.h b/thermal/sensors.h new file mode 100644 index 00000000..4924ac27 --- /dev/null +++ b/thermal/sensors.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __SENSORS_H__ +#define __SENSORS_H__ + +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace thermal { +namespace V1_1 { +namespace implementation { + +using ::android::hardware::thermal::V1_0::Temperature; +using ::android::hardware::thermal::V1_0::TemperatureType; + +class Sensors { + public: + Sensors() = default; + ~Sensors() = default; + Sensors(const Sensors&) = delete; + void operator=(const Sensors&) = delete; + + std::string getSensorPath(const std::string& sensor_name); + // Returns true if add was successful, false otherwise. + bool addSensor( + const std::string& sensor_name, const std::string& path, + const float throttling_threshold, const float shutdown_threshold, + const float vr_threshold, const TemperatureType& type); + // If sensor is not found in the sensor names to path map, this will set + // data and file path to empty and return false. If the sensor is found, + // this function will fill in data and file_path accordingly then return + // true. + bool readSensorFile( + const std::string& sensor_name, std::string* data, + std::string* file_path) const; + bool readTemperature( + const std::string& sensor_name, const float mult, + Temperature* out) const; + size_t getNumSensors() const { return sensor_name_to_data_map_.size(); } + + private: + // A map containing sensor names along with its thermal zone number, its + // thresholds, and its type. The tuple is formatted as such: + // + std::unordered_map> + sensor_name_to_data_map_; +}; + +} // namespace implementation +} // namespace V1_1 +} // namespace thermal +} // namespace hardware +} // namespace android + +#endif // __SENSORS_H__ + diff --git a/thermal/thermal-helper.cpp b/thermal/thermal-helper.cpp index 163f0fd0..6e9cf17d 100644 --- a/thermal/thermal-helper.cpp +++ b/thermal/thermal-helper.cpp @@ -20,11 +20,17 @@ #include #include #include +#include +#include +#include +#include #include #include +#include #include +#include "sensors.h" #include "thermal-helper.h" namespace android { @@ -33,14 +39,102 @@ namespace thermal { namespace V1_1 { namespace implementation { +constexpr const char kThermalSensorsRoot[] = "/sys/class/thermal"; +constexpr char kThermalZoneDirSuffix[] = "thermal_zone"; +constexpr char kSensorTypeFileSuffix[] = "type"; +constexpr char kTemperatureFileSuffix[] = "temp"; +// This is a golden set of thermal sensor names, their types, and their +// multiplier. Used when we read in sensor values. The tuple value stored is +// formatted as such: +// +const std::unordered_map> +kValidThermalSensorsMap = { + {"tsens_tz_sensor1", {TemperatureType::CPU, 0.1}}, // CPU0 + {"tsens_tz_sensor2", {TemperatureType::CPU, 0.1}}, // CPU1 + {"tsens_tz_sensor4", {TemperatureType::CPU, 0.1}}, // CPU2 + {"tsens_tz_sensor3", {TemperatureType::CPU, 0.1}}, // CPU3 + {"tsens_tz_sensor7", {TemperatureType::CPU, 0.1}}, // CPU4 + {"tsens_tz_sensor8", {TemperatureType::CPU, 0.1}}, // CPU5 + {"tsens_tz_sensor9", {TemperatureType::CPU, 0.1}}, // CPU6 + {"tsens_tz_sensor10", {TemperatureType::CPU, 0.1}}, // CPU7 + // GPU thermal sensor. + {"tsens_tz_sensor13", {TemperatureType::GPU, 0.1}}, + // Battery thermal sensor. + {"battery", {TemperatureType::BATTERY, 0.001}}, + // Skin thermal sensors. We use back_therm for walleye. For taimen we use + // bd_therm and bd_therm2. + {"back_therm", {TemperatureType::SKIN, 1.}}, + {"bd_therm", {TemperatureType::SKIN, 1.}}, + {"bd_therm2", {TemperatureType::SKIN, 1.}}, + // USBC thermal sensor. + {"usb_port_temp", {TemperatureType::UNKNOWN, 0.1}}, +}; + +namespace { + using ::android::hardware::thermal::V1_0::TemperatureType; -static unsigned int gSkinSensorNum; static std::string gSkinSensorType; -static unsigned int gTsensOffset; static unsigned int gSkinThrottlingThreshold; static unsigned int gSkinShutdownThreshold; static unsigned int gVrThrottledBelowMin; +Sensors gSensors; + +// A map containing hardcoded thresholds per sensor type. Its not const +// because initThermal() will modify the skin sensor thresholds depending on the +// hardware type. The tuple is formatted as follows: +// +std::unordered_map> +gSensorTypeToThresholdsMap = { + {TemperatureType::CPU, {kCpuThrottlingThreshold, kCpuShutdownThreshold, + kCpuThrottlingThreshold}}, + {TemperatureType::GPU, {NAN, NAN, NAN}}, + {TemperatureType::BATTERY, {NAN, kBatteryShutdownThreshold, NAN}}, + {TemperatureType::SKIN, {NAN, NAN, NAN}}, + {TemperatureType::UNKNOWN, {NAN, NAN, NAN}} +}; + +bool initializeSensors() { + auto thermal_zone_dir = std::unique_ptr( + opendir(kThermalSensorsRoot), closedir); + struct dirent* dp; + size_t num_thermal_zones = 0; + while ((dp = readdir(thermal_zone_dir.get())) != nullptr) { + std::string dir_name(dp->d_name); + if (dir_name.find(kThermalZoneDirSuffix) != std::string::npos) { + ++num_thermal_zones; + } + } + + for (size_t sensor_zone_num = 0; sensor_zone_num < num_thermal_zones; + ++sensor_zone_num) { + std::string path = android::base::StringPrintf("%s/%s%zu", + kThermalSensorsRoot, + kThermalZoneDirSuffix, + sensor_zone_num); + std::string sensor_name; + if (android::base::ReadFileToString( + path + "/" + kSensorTypeFileSuffix, &sensor_name)) { + sensor_name = android::base::Trim(sensor_name); + if (kValidThermalSensorsMap.find(sensor_name) != + kValidThermalSensorsMap.end()) { + TemperatureType type = std::get<0>( + kValidThermalSensorsMap.at(sensor_name)); + auto thresholds = gSensorTypeToThresholdsMap.at(type); + if (!gSensors.addSensor( + sensor_name, path + "/" + kTemperatureFileSuffix, + std::get<0>(thresholds), std::get<1>(thresholds), + std::get<2>(thresholds), type)) { + LOG(ERROR) << "Could not add " << sensor_name + << "to sensors map"; + } + } + } + } + return (gSensors.getNumSensors() == kTemperatureNum); +} + +} // namespace /** * Initialization constants based on platform @@ -51,9 +145,6 @@ bool initThermal() { std::string hardware = android::base::GetProperty("ro.hardware", ""); if (hardware == "walleye") { LOG(ERROR) << "Initialization on Walleye"; - gSkinSensorNum = kWalleyeSkinSensorNum; - gSkinSensorType = kWalleyeSkinSensorType; - gTsensOffset = kWalleyeTsensOffset; gSkinThrottlingThreshold = kWalleyeSkinThrottlingThreshold; gSkinShutdownThreshold = kWalleyeSkinShutdownThreshold; gVrThrottledBelowMin = kWalleyeVrThrottledBelowMin; @@ -61,17 +152,11 @@ bool initThermal() { std::string rev = android::base::GetProperty("ro.revision", ""); if (rev == "rev_a" || rev == "rev_b") { LOG(ERROR) << "Initialization on Taimen pre revision C"; - gSkinSensorNum = kTaimenRabSkinSensorNum; - gSkinSensorType = kTaimenRabSkinSensorType; - gTsensOffset = kTaimenRabTsensOffset; gSkinThrottlingThreshold = kTaimenRabSkinThrottlingThreshold; gSkinShutdownThreshold = kTaimenRabSkinShutdownThreshold; gVrThrottledBelowMin = kTaimenRabVrThrottledBelowMin; } else { LOG(ERROR) << "Initialization on Taimen revision C and later"; - gSkinSensorNum = kTaimenRcSkinSensorNum; - gSkinSensorType = kTaimenRcSkinSensorType; - gTsensOffset = kTaimenRcTsensOffset; gSkinThrottlingThreshold = kTaimenRcSkinThrottlingThreshold; gSkinShutdownThreshold = kTaimenRcSkinShutdownThreshold; gVrThrottledBelowMin = kTaimenRcVrThrottledBelowMin; @@ -80,139 +165,25 @@ bool initThermal() { LOG(ERROR) << "Unsupported hardware: " << hardware; return false; } - return true; + gSensorTypeToThresholdsMap[TemperatureType::SKIN] = + std::make_tuple(gSkinThrottlingThreshold, gSkinShutdownThreshold, + gVrThrottledBelowMin); + return initializeSensors(); } -/** - * Reads device temperature. - * - * @param sensor_num Number of sensor file with temperature. - * @param type Device temperature type. - * @param name Device temperature name. - * @param mult Multiplier used to translate temperature to Celsius. - * @param throttling_threshold Throttling threshold for the temperature. - * @param shutdown_threshold Shutdown threshold for the temperature. - * @param out Pointer to temperature_t structure that will be filled with current - * values. - * - * @return 0 on success or negative value -errno on error. - */ -static ssize_t readTemperature(int sensor_num, TemperatureType type, const char *name, float mult, - float throttling_threshold, float shutdown_threshold, - float vr_throttling_threshold, Temperature *out) { - FILE *file; - char file_name[PATH_MAX]; - float temp; - - sprintf(file_name, kTemperatureFileFormat, sensor_num); - file = fopen(file_name, "r"); - if (file == NULL) { - PLOG(ERROR) << "readTemperature: failed to open file (" << file_name << ")"; - return -errno; - } - if (1 != fscanf(file, "%f", &temp)) { - fclose(file); - PLOG(ERROR) << "readTemperature: failed to read a float"; - return errno ? -errno : -EIO; - } - - fclose(file); - - (*out).type = type; - (*out).name = name; - (*out).currentValue = temp * mult; - (*out).throttlingThreshold = throttling_threshold; - (*out).shutdownThreshold = shutdown_threshold; - (*out).vrThrottlingThreshold = vr_throttling_threshold; - - LOG(DEBUG) << android::base::StringPrintf( - "readTemperature: %d, %d, %s, %g, %g, %g, %g", - sensor_num, type, name, temp * mult, throttling_threshold, - shutdown_threshold, vr_throttling_threshold); - - return 0; -} - -static ssize_t getCpuTemperatures(hidl_vec *temperatures) { - size_t cpu; - - for (cpu = 0; cpu < kCpuNum; cpu++) { - if (cpu >= temperatures->size()) { - break; - } - // temperature in decidegrees Celsius. - ssize_t result = readTemperature(kCpuTsensOffset[cpu] + gTsensOffset, TemperatureType::CPU, kCpuLabel[cpu], - 0.1, kCpuThrottlingThreshold, kCpuShutdownThreshold, kCpuThrottlingThreshold, - &(*temperatures)[cpu]); - if (result != 0) { - return result; +ssize_t fillTemperatures(hidl_vec* temperatures) { + temperatures->resize(gSensors.getNumSensors()); + ssize_t current_index = 0; + for (const auto& name_type_mult_pair : kValidThermalSensorsMap) { + Temperature temp; + if (gSensors.readTemperature(name_type_mult_pair.first, + std::get<1>(name_type_mult_pair.second), + &temp)) { + (*temperatures)[current_index] = temp; + ++current_index; } } - return cpu; -} - -ssize_t fillTemperatures(hidl_vec *temperatures) { - ssize_t result = 0; - size_t current_index = 0; - - if (temperatures == NULL || temperatures->size() < kTemperatureNum) { - LOG(ERROR) << "fillTemperatures: incorrect buffer"; - return -EINVAL; - } - - result = getCpuTemperatures(temperatures); - if (result < 0) { - return result; - } - current_index += result; - - // GPU temperature. - if (current_index < temperatures->size()) { - // temperature in decidegrees Celsius. - result = readTemperature(gTsensOffset + kGpuTsensOffset, TemperatureType::GPU, kGpuLabel, 0.1, - NAN, NAN, NAN, &(*temperatures)[current_index]); - if (result < 0) { - return result; - } - current_index++; - } - - // Battery temperature. - if (current_index < temperatures->size()) { - // battery: temperature in millidegrees Celsius. - result = readTemperature(kBatterySensorNum, TemperatureType::BATTERY, kBatteryLabel, - 0.001, NAN, kBatteryShutdownThreshold, NAN, - &(*temperatures)[current_index]); - if (result < 0) { - return result; - } - current_index++; - } - - // Skin temperature. - if (current_index < temperatures->size()) { - // temperature in Celsius. - result = readTemperature(gSkinSensorNum, TemperatureType::SKIN, kSkinLabel, 1., - gSkinThrottlingThreshold, gSkinShutdownThreshold, gVrThrottledBelowMin, - &(*temperatures)[current_index]); - if (result < 0) { - return result; - } - current_index++; - } - - // USB-C temperature. - if (current_index < temperatures->size()) { - // temperature in Celsius. - result = readTemperature( - kUsbcSensorNum, TemperatureType::UNKNOWN, kUsbcLabel, 0.1, NAN, NAN, - NAN, &(*temperatures)[current_index]); - if (result < 0) { - return result; - } - current_index++; - } - return kTemperatureNum; + return current_index; } ssize_t fillCpuUsages(hidl_vec *cpuUsages) { diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h index 46fc8349..ef0b61ff 100644 --- a/thermal/thermal-helper.h +++ b/thermal/thermal-helper.h @@ -40,45 +40,29 @@ namespace implementation { using ::android::hardware::thermal::V1_0::CpuUsage; using ::android::hardware::thermal::V1_0::Temperature; +using ::android::hardware::thermal::V1_0::TemperatureType; constexpr const char *kCpuUsageFile = "/proc/stat"; constexpr const char *kTemperatureFileFormat = "/sys/class/thermal/thermal_zone%d/temp"; constexpr const char *kCpuOnlineFileFormat = "/sys/devices/system/cpu/cpu%d/online"; // thermal-engine.conf -constexpr unsigned int kWalleyeSkinSensorNum = 14; -constexpr auto kWalleyeSkinSensorType = "back_therm"; -constexpr unsigned int kWalleyeTsensOffset = 16; constexpr unsigned int kWalleyeSkinThrottlingThreshold = 40; constexpr unsigned int kWalleyeSkinShutdownThreshold = 56; constexpr unsigned int kWalleyeVrThrottledBelowMin = 52; -constexpr unsigned int kTaimenRabSkinSensorNum = 13; -constexpr auto kTaimenRabSkinSensorType = "bd_therm"; -constexpr unsigned int kTaimenRabTsensOffset = 14; constexpr unsigned int kTaimenRabSkinThrottlingThreshold = 49; constexpr unsigned int kTaimenRabSkinShutdownThreshold = 66; constexpr unsigned int kTaimenRabVrThrottledBelowMin = 62; -constexpr unsigned int kTaimenRcSkinSensorNum = 13; -constexpr auto kTaimenRcSkinSensorType = "bd_therm2"; -constexpr unsigned int kTaimenRcTsensOffset = 14; constexpr unsigned int kTaimenRcSkinThrottlingThreshold = 38; constexpr unsigned int kTaimenRcSkinShutdownThreshold = 54; constexpr unsigned int kTaimenRcVrThrottledBelowMin = 50; -constexpr unsigned int kUsbcSensorNum = 6; -constexpr unsigned int kBatterySensorNum = 5; -// The gpu thermal sensor is tsens_tz_sensor13. -constexpr unsigned int kGpuTsensOffset = 11; constexpr unsigned int kCpuNum = 8; -constexpr const char *kGpuLabel = "GPU"; -constexpr const char *kBatteryLabel = "battery"; -constexpr const char *kSkinLabel = "skin"; -constexpr const char *kUsbcLabel = "usbc"; -constexpr const char *kCpuLabel[kCpuNum] = {"CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7"}; -constexpr int kCpuTsensOffset[kCpuNum] = {1, 2, 4, 3, 5, 6, 7, 8}; +constexpr const char *kCpuLabel[kCpuNum] = { + "CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7"}; // Sum of kCpuNum + 4 for GPU, BATTERY, SKIN, and USB-C. constexpr unsigned int kTemperatureNum = 4 + kCpuNum; From c3241f81d839758564a6cfb43987e0366a178334 Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Wed, 28 Mar 2018 13:57:50 -0700 Subject: [PATCH 222/300] Update SVN to 10 for RoW Walleye/Taimen May 2018 Build Bug: 74345861 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 654393b8..626091c5 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=9 + ro.vendor.build.svn=10 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 9eefc3d002a7680d97101b171085c80730b0b31a Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Fri, 19 Jan 2018 10:24:12 -0800 Subject: [PATCH 223/300] Add default permission grant for Settings Intelligence. As a result of adding an alternative permission UI flow into the prebuilt upon interaction with the notification, we are allowed to be pre-granted this permission. Bug: 72946884 Test: App doesn't break/crash upon using permission. Change-Id: I4a4ca1b78f059e67dff3b91368710e0b0f23ca02 (cherry picked from commit 09854c4f88c113a6257a91b4c5dbb363f56c0512) --- default-permissions.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/default-permissions.xml b/default-permissions.xml index ab898f17..a2993ec7 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -96,4 +96,28 @@ + + + + + + + + + + + + + + + + + + + + + + From 7d957045ac8ca1c65fb4f0388402f4d2cdbfa1d9 Mon Sep 17 00:00:00 2001 From: Jan Althaus Date: Mon, 5 Mar 2018 11:08:23 +0100 Subject: [PATCH 224/300] Allowing GmsCore to register DnD rules This is necessary because the driving DnD rules will be migrated from Pixel Ambient Services to GmsCore. Pre-granting this permission is necessary to avoid a feature regression when compared to Pixel 2. Bug: 74115747 Test: Manually confirmed config change in Pixel 2 build Change-Id: Icb595b6a31787c18eef38da50f5a256ada5c05f2 (cherry picked from commit e30688631fde6032d9655637a18ee419087ab39b) --- overlay/frameworks/base/core/res/res/values/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index c7730ddd..5650b993 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -332,5 +332,5 @@ true - com.google.android.GoogleCamera:com.google.intelligence.sense + com.google.android.gms:com.google.android.GoogleCamera:com.google.intelligence.sense From 4efb56f28642015fdaaf0c177b94103f81751e7a Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Wed, 28 Mar 2018 13:42:31 -0700 Subject: [PATCH 225/300] Add SettingsIntelligence to Wahoo DND Access config. This is set in the nexus_overlay and no differences existed until GMSCore was added to the nexus_overlay. GMSCore only exists in the Wahoo overlay and the overlay currently crushes our config which applies to all Google devices. By re-adding it to this overlaid overlay, we gain our powers back. Bug: 72663665 Test: Manual Change-Id: I9794a212b782028f12cd87793ab5723030b8ed95 --- overlay/frameworks/base/core/res/res/values/config.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 5650b993..1440933a 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -332,5 +332,6 @@ true - com.google.android.gms:com.google.android.GoogleCamera:com.google.intelligence.sense + com.google.android.gms:com.google.android.GoogleCamera:com.google.intelligence.sense:com.google.android.settings.intelligence + From e3894648febfd3a9fee500747f06b9f704ba1986 Mon Sep 17 00:00:00 2001 From: Edwin Wong Date: Wed, 21 Mar 2018 17:38:20 -0700 Subject: [PATCH 226/300] Rename Widevine HIDL service to v1.1. Widevine HIDL service added new v1.1 media APIs, the service version is updated to 1.1. Test: Netflix and Play Movies & TV (streaming and offline playback) Test: GTS WidevineH264PlaybackTests test e.g. ANDROID_BUILD_TOP= ./android-gts/toolsefed run gts -m GtsMediaTestCases --test com.google.android.media.gts.WidevineH264PlaybackTests#testL1With480P30 bug: 69674645 Change-Id: I287d48bf7cef5b3bb30e21b3794cc7422701ca6c --- CleanSpec.mk | 7 +++++++ device.mk | 2 +- manifest.xml | 4 ++-- sepolicy/vendor/file_contexts | 2 +- sepolicy/vendor/hal_drm_widevine.te | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index 7f0654ab..f735633e 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -176,3 +176,10 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/*) # Remove android.hardware.audio*@2.0 implementation $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.audio*@2.0-impl.so) +# Remove Clearkey HAL 1.0 +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.drm@1.0-service.clearkey.rc) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@1.0-service.clearkey) + +# Remove Widevine HAL 1.0 +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.drm@1.0-service.widevine.rc) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@1.0-service.widevine) diff --git a/device.mk b/device.mk index 636e0195..a8416607 100755 --- a/device.mk +++ b/device.mk @@ -339,7 +339,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PACKAGES += \ android.hardware.drm@1.0-impl:32 \ android.hardware.drm@1.0-service \ - android.hardware.drm@1.0-service.widevine \ + android.hardware.drm@1.1-service.widevine \ android.hardware.drm@1.1-service.clearkey \ move_widevine_data.sh diff --git a/manifest.xml b/manifest.xml index a64c9a56..cb4066fe 100644 --- a/manifest.xml +++ b/manifest.xml @@ -87,15 +87,15 @@ ICryptoFactory default - widevine IDrmFactory default - widevine @1.1::ICryptoFactory/clearkey @1.1::IDrmFactory/clearkey + @1.1::ICryptoFactory/widevine + @1.1::IDrmFactory/widevine android.hardware.dumpstate diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index ddca8dec..02f1244e 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -184,7 +184,7 @@ /vendor/bin/init\.radio\.sh u:object_r:init_radio_exec:s0 /vendor/bin/hw/android\.hardware\.bluetooth@1\.0-service-qti u:object_r:hal_bluetooth_default_exec:s0 -/vendor/bin/hw/android\.hardware\.drm@1\.0-service\.widevine u:object_r:hal_drm_widevine_exec:s0 +/vendor/bin/hw/android\.hardware\.drm@1\.1-service\.widevine u:object_r:hal_drm_widevine_exec:s0 /vendor/bin/hw/android\.hardware\.drm@1\.1-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 /vendor/bin/hw/android\.hardware\.vibrator@1\.2-service\.wahoo u:object_r:hal_vibrator_default_exec:s0 /vendor/bin/hw/android\.hardware\.health@2\.0-service\.wahoo u:object_r:hal_health_default_exec:s0 diff --git a/sepolicy/vendor/hal_drm_widevine.te b/sepolicy/vendor/hal_drm_widevine.te index a8750c6c..f2725022 100644 --- a/sepolicy/vendor/hal_drm_widevine.te +++ b/sepolicy/vendor/hal_drm_widevine.te @@ -1,4 +1,4 @@ -# policy for /vendor/bin/hw/android.hardware.drm@1.0-service.widevine +# policy for /vendor/bin/hw/android.hardware.drm@1.1-service.widevine type hal_drm_widevine, domain; type hal_drm_widevine_exec, exec_type, vendor_file_type, file_type; From b67512ba68715903eab62ea0951640a62ee88ef3 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 30 Mar 2018 10:53:12 -0700 Subject: [PATCH 227/300] ThermalHAL: add dump into bugreport lshal-debug/android.hardware.thermal@1.1::IThermal_default.txt: getTemperatures: Name: usb_port_temp Type: UNKNOWN CurrentValue: 30.7 ThrottlingThreshold: nan ShutdownThreshold: nan VrThrottlingThreshold: nan Name: back_therm Type: SKIN CurrentValue: 30 ThrottlingThreshold: 40 ShutdownThreshold: 56 VrThrottlingThreshold: 52 Name: tsens_tz_sensor4 Type: CPU CurrentValue: 42.7 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 Name: tsens_tz_sensor2 Type: CPU CurrentValue: 43 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 Name: battery Type: BATTERY CurrentValue: 28 ThrottlingThreshold: nan ShutdownThreshold: 60 VrThrottlingThreshold: nan Name: tsens_tz_sensor13 Type: GPU CurrentValue: 40.8 ThrottlingThreshold: nan ShutdownThreshold: nan VrThrottlingThreshold: nan Name: tsens_tz_sensor10 Type: CPU CurrentValue: 42.1 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 Name: tsens_tz_sensor9 Type: CPU CurrentValue: 42.4 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 Name: tsens_tz_sensor3 Type: CPU CurrentValue: 42.4 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 Name: tsens_tz_sensor8 Type: CPU CurrentValue: 41.7 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 Name: tsens_tz_sensor7 Type: CPU CurrentValue: 42.1 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 Name: tsens_tz_sensor1 Type: CPU CurrentValue: 43.3 ThrottlingThreshold: 95 ShutdownThreshold: 115 VrThrottlingThreshold: 95 getCpuUsages: Name: CPU0 Active: 3144 Total: 6725 IsOnline: 1 Name: CPU1 Active: 3128 Total: 6943 IsOnline: 1 Name: CPU2 Active: 2128 Total: 6692 IsOnline: 1 Name: CPU3 Active: 1936 Total: 6893 IsOnline: 1 Name: CPU4 Active: 2165 Total: 7027 IsOnline: 1 Name: CPU5 Active: 2356 Total: 7046 IsOnline: 1 Name: CPU6 Active: 3757 Total: 7022 IsOnline: 1 Name: CPU7 Active: 3748 Total: 7049 IsOnline: 1 Test: take BR Bug: 77301612 Bug: 72071908 Change-Id: Ib10ab86731df4cee3c7523c54c5dce51f2038156 --- thermal/Thermal.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++-- thermal/Thermal.h | 2 ++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/thermal/Thermal.cpp b/thermal/Thermal.cpp index 7b29b29d..b47a54d8 100644 --- a/thermal/Thermal.cpp +++ b/thermal/Thermal.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include "Thermal.h" @@ -55,12 +56,11 @@ Return Thermal::getTemperatures(getTemperatures_cb _hidl_cb) { hidl_vec temperatures; temperatures.resize(kTemperatureNum); - LOG(INFO) << "ThermalHAL enabled: " << enabled; - if (!enabled) { status.code = ThermalStatusCode::FAILURE; status.debugMessage = "Unsupported hardware"; _hidl_cb(status, temperatures); + LOG(ERROR) << "ThermalHAL not initialized properly."; return Void(); } @@ -93,6 +93,7 @@ Return Thermal::getCpuUsages(getCpuUsages_cb _hidl_cb) { status.code = ThermalStatusCode::FAILURE; status.debugMessage = "Unsupported hardware"; _hidl_cb(status, cpuUsages); + LOG(ERROR) << "ThermalHAL not initialized properly."; return Void(); } @@ -123,6 +124,7 @@ Return Thermal::getCoolingDevices(getCoolingDevices_cb _hidl_cb) { status.code = ThermalStatusCode::FAILURE; status.debugMessage = "Unsupported hardware"; _hidl_cb(status, coolingDevices); + LOG(ERROR) << "ThermalHAL not initialized properly."; return Void(); } @@ -177,6 +179,58 @@ void Thermal::notifyThrottling( } } +Return Thermal::debug(const hidl_handle& handle, const hidl_vec&) { + if (handle != nullptr && handle->numFds >= 1) { + int fd = handle->data[0]; + std::ostringstream dump_buf; + + if (!enabled) { + dump_buf << "ThermalHAL not initialized properly." << std::endl; + } else { + hidl_vec temperatures; + hidl_vec cpu_usages; + cpu_usages.resize(kCpuNum); + temperatures.resize(kTemperatureNum); + + dump_buf << "getTemperatures:" << std::endl; + if (fillTemperatures(&temperatures) != kTemperatureNum) { + dump_buf << "Failed to read thermal sensors." << std::endl; + } else { + for (const auto& t : temperatures) { + dump_buf << "Name: " << t.name + << " Type: " << android::hardware::thermal::V1_0::toString(t.type) + << " CurrentValue: " << t.currentValue + << " ThrottlingThreshold: " << t.throttlingThreshold + << " ShutdownThreshold: " << t.shutdownThreshold + << " VrThrottlingThreshold: " << t.vrThrottlingThreshold + << std::endl; + } + } + + dump_buf << "getCpuUsages:" << std::endl; + ssize_t ret = fillCpuUsages(&cpu_usages); + if (ret < 0) { + dump_buf << "Failed to get CPU usages." << std::endl; + } else { + for (const auto& usage : cpu_usages) { + dump_buf << "Name: " << usage.name + << " Active: " << usage.active + << " Total: " << usage.total + << " IsOnline: " << usage.isOnline + << std::endl; + } + } + + } + std::string buf = dump_buf.str(); + if (!android::base::WriteStringToFd(buf, fd)) { + PLOG(ERROR) << "Failed to dump state to fd"; + } + fsync(fd); + } + return Void(); +} + } // namespace implementation } // namespace V1_1 } // namespace thermal diff --git a/thermal/Thermal.h b/thermal/Thermal.h index d3ac2f9a..270f0663 100644 --- a/thermal/Thermal.h +++ b/thermal/Thermal.h @@ -54,6 +54,8 @@ struct Thermal : public IThermal { // Methods from ::android::hardware::thermal::V1_1::IThermal follow. Return registerThermalCallback( const sp& callback) override; + // Methods from ::android::hidl::base::V1_0::IBase follow. + Return debug(const hidl_handle& fd, const hidl_vec& args) override; private: bool enabled; }; From caf274c10e87c95881d9ecfee24f73de0832dcd5 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 2 Apr 2018 16:07:53 -0700 Subject: [PATCH 228/300] dumpstate: add vendor property dump and fix tzlog timeout Bug: 77489941 Bug: 77277669 Test: take BR Change-Id: I037c17ec6ce4f80f86e157ac9b9e0602fa8ecd68 --- dumpstate/DumpstateDevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index e7e0bb67..c206465f 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -228,7 +228,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { int fdModem = handle->data[1]; dumpModem(fd, fdModem); } - + RunCommandToFd(fd, "VENDOR PROPERTIES", {"/vendor/bin/getprop"}); DumpFileToFd(fd, "SoC serial number", "/sys/devices/soc0/serial_number"); DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present"); DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online"); @@ -257,8 +257,8 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports"); DumpTouch(fd); RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"}); - RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "cat /d/tzdbg/qsee_log"}); - + // Timeout after 3s + RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "/vendor/bin/timeout 3 cat /d/tzdbg/qsee_log"}); RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in /sys/class/power_supply/*/uevent ; do echo \"\n------ $f\" ; cat $f ; done"}); RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"}); RunCommandToFd(fd, "QCOM FG SRAM", {"/vendor/bin/sh", "-c", "echo 0 > /d/fg/sram/address ; echo 500 > /d/fg/sram/count ; cat /d/fg/sram/data"}); From 847e28f86e226e49bb9253823df9d238bf10e31f Mon Sep 17 00:00:00 2001 From: Ruchi Kandoi Date: Fri, 30 Mar 2018 15:24:37 -0700 Subject: [PATCH 229/300] Add support for NFC 1.1 Supresses the following denials: denied { add } for interface=vendor.nxp.nxpnfc::INxpNfc pid=5675 scontext=u:r:hal_nfc_default:s0 tcontext=u:object_r:default_android_hwservice:s0 tclass=hwservice_manager permissive=0 denied { find } for interface=vendor.nxp.nxpese::INxpEse pid=5675 scontext=u:r:hal_nfc_default:s0 tcontext=u:object_r:default_android_hwservice:s0 tclass=hwservice_manager permissive=0 Test: Enable/Disable NFC, Tag reading Bug: 75980364 Change-Id: I337810ff89d61f796cb213cd931a7b665870029e --- device.mk | 7 +- manifest.xml | 2 +- nfc/libnfc-nci.conf | 311 ----------------------------- sepolicy/vendor/hal_nfc_default.te | 3 + sepolicy/vendor/hwservice.te | 2 + sepolicy/vendor/hwservice_contexts | 2 + 6 files changed, 12 insertions(+), 315 deletions(-) diff --git a/device.mk b/device.mk index ab122afe..9fdecf09 100755 --- a/device.mk +++ b/device.mk @@ -354,11 +354,12 @@ PRODUCT_PACKAGES += \ # NFC packages PRODUCT_PACKAGES += \ - nfc_nci.msm8998 \ NfcNci \ Tag \ - android.hardware.nfc@1.0-impl:64 \ - android.hardware.nfc@1.0-service + android.hardware.nfc@1.1-service \ + +PRODUCT_PACKAGES += \ + SecureElement PRODUCT_COPY_FILES += \ device/google/wahoo/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_SYSTEM)/etc/libnfc-nci.conf \ diff --git a/manifest.xml b/manifest.xml index a64c9a56..c7a119ed 100644 --- a/manifest.xml +++ b/manifest.xml @@ -221,7 +221,7 @@ android.hardware.nfc hwbinder - 1.0 + 1.1 INfc default diff --git a/nfc/libnfc-nci.conf b/nfc/libnfc-nci.conf index c1ba35a9..3db7084f 100644 --- a/nfc/libnfc-nci.conf +++ b/nfc/libnfc-nci.conf @@ -1,179 +1,23 @@ -###################### Start of libnfc-brcm.conf ####################### - ############################################################################### # Application options NFC_DEBUG_ENABLED=0 -############################################################################### -# performance measurement -# Change this setting to control how often USERIAL log the performance (throughput) -# data on read/write/poll -# defailt is to log performance dara for every 100 read or write -#REPORT_PERFORMANCE_MEASURE=100 - ############################################################################### # File used for NFA storage NFA_STORAGE="/data/nfc" -############################################################################### -# Snooze Mode Settings -# -# By default snooze mode is enabled. Set SNOOZE_MODE_CFG byte[0] to 0 -# to disable. -# -# If SNOOZE_MODE_CFG is not provided, the default settings are used: -# They are as follows: -# 8 Sleep Mode (0=Disabled 1=UART 8=SPI/I2C) -# 0 Idle Threshold Host -# 0 Idle Threshold HC -# 0 NFC Wake active mode (0=ActiveLow 1=ActiveHigh) -# 1 Host Wake active mode (0=ActiveLow 1=ActiveHigh) -# -#SNOOZE_MODE_CFG={08:00:00:00:01} - -############################################################################### -# Insert a delay in milliseconds after NFC_WAKE and before write to NFCC -#NFC_WAKE_DELAY=20 - -############################################################################### -# Various Delay settings (in ms) used in USERIAL -# POWER_ON_DELAY -# Delay after turning on chip, before writing to transport (default 300) -# PRE_POWER_OFF_DELAY -# Delay after deasserting NFC-Wake before turn off chip (default 0) -# POST_POWER_OFF_DELAY -# Delay after turning off chip, before USERIAL_close returns (default 0) -# -#POWER_ON_DELAY=300 -#PRE_POWER_OFF_DELAY=0 -#POST_POWER_OFF_DELAY=0 - -############################################################################### -# Maximum time (ms) to wait for RESET NTF after setting REG_PU to high -# The default is 1000. -#NFCC_ENABLE_TIMEOUT=0 - -############################################################################### -# LPTD mode configuration -# byte[0] is the length of the remaining bytes in this value -# if set to 0, LPTD params will NOT be sent to NFCC (i.e. disabled). -# byte[1] is the param id it should be set to B9. -# byte[2] is the length of the LPTD parameters -# byte[3] indicates if LPTD is enabled -# if set to 0, LPTD will be disabled (parameters will still be sent). -# byte[4-n] are the LPTD parameters. -# By default, LPTD is enabled and default settings are used. -# See nfc_hal_dm_cfg.c for defaults -#LPTD_CFG={23:B9:21:01:02:FF:FF:04:A0:0F:40:00:80:02:02:10:00:00:00:31:0C:30:00:00:00:00:00:00:00:00:00:00:00:00:00:00} - -############################################################################### -# Startup Configuration (100 bytes maximum) -# -# For the 0xCA parameter, byte[9] (marked by 'AA') is for UICC0, and byte[10] (marked by BB) is -# for UICC1. The values are defined as: -# 0 : UICCx only supports ISO_DEP in low power mode. -# 2 : UICCx only supports Mifare in low power mode. -# 3 : UICCx supports both ISO_DEP and Mifare in low power mode. -# -# AA BB -#NFA_DM_START_UP_CFG={1F:CB:01:01:A5:01:01:CA:14:00:00:00:00:06:E8:03:00:00:00:00:00:00:00:00:00:00:00:00:00:80:01:01} - -############################################################################### -# Startup Vendor Specific Configuration (100 bytes maximum); -# byte[0] TLV total len = 0x5 -# byte[1] NCI_MTS_CMD|NCI_GID_PROP = 0x2f -# byte[2] NCI_MSG_FRAME_LOG = 0x9 -# byte[3] 2 -# byte[4] 0=turn off RF frame logging; 1=turn on -# byte[5] 0=turn off SWP frame logging; 1=turn on -# NFA_DM_START_UP_VSC_CFG={05:2F:09:02:01:01} - -############################################################################### -# Antenna Configuration - This data is used when setting 0xC8 config item -# at startup (before discovery is started). If not used, no value is sent. -# -# The settings for this value are documented here: -# http://wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/ -# Design/Doc/PHY%20register%20settings/BCM20791-B2-1027-02_PHY_Recommended_Reg_Settings.xlsx -# This document is maintained by Paul Forshaw. -# -# The values marked as ?? should be tweaked per antenna or customer/app: -# {20:C8:1E:06:??:00:??:??:??:00:??:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:??:01:00:00:40:04} -# array[0] = 0x20 is length of the payload from array[1] to the end -# array[1] = 0xC8 is PREINIT_DSP_CFG -#PREINIT_DSP_CFG={20:C8:1E:06:1F:00:0F:03:3C:00:04:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:48:01:00:00:40:04} - -############################################################################### -# Configure crystal frequency when internal LPO can't detect the frequency. -#XTAL_FREQUENCY=0 -############################################################################### -# Configure the default Destination Gate used by HCI (the default is 4, which -# is the ETSI loopback gate. -NFA_HCI_DEFAULT_DEST_GATE=0xF0 - -############################################################################### -# Configure the single default SE to use. The default is to use the first -# SE that is detected by the stack. This value might be used when the phone -# supports multiple SE (e.g. 0xF3 and 0xF4) but you want to force it to use -# one of them (e.g. 0xF4). -#ACTIVE_SE=0xF3 - -############################################################################### -# Configure the default NfcA/IsoDep techology and protocol route. Can be -# either a secure element (e.g. 0xF4) or the host (0x00) -#DEFAULT_ISODEP_ROUTE=0x00 - -############################################################################### -# Configure the NFC Extras to open and use a static pipe. If the value is -# not set or set to 0, then the default is use a dynamic pipe based on a -# destination gate (see NFA_HCI_DEFAULT_DEST_GATE). Note there is a value -# for each UICC (where F3="UICC0" and F4="UICC1") -#NFA_HCI_STATIC_PIPE_ID_F3=0x70 -#NFA_HCI_STATIC_PIPE_ID_01=0x19 -NFA_HCI_STATIC_PIPE_ID_C0=0x19 -############################################################################### -# When disconnecting from Oberthur secure element, perform a warm-reset of -# the secure element to deselect the applet. -# The default hex value of the command is 0x3. If this variable is undefined, -# then this feature is not used. -#OBERTHUR_WARM_RESET_COMMAND=0x03 - ############################################################################### # Force UICC to only listen to the following technology(s). # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h. # Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B | NFA_TECHNOLOGY_MASK_F UICC_LISTEN_TECH_MASK=0x07 -############################################################################### -# Force HOST listen feature enable or disable. -# 0: Disable -# 1: Enable -HOST_LISTEN_ENABLE=0x01 - -############################################################################### -# Enabling/Disabling Forward functionality -# Disable 0x00 -# Enable 0x01 -NXP_FWD_FUNCTIONALITY_ENABLE=0x01 - -############################################################################### -# Allow UICC to be powered off if there is no traffic. -# Timeout is in ms. If set to 0, then UICC will not be powered off. -#UICC_IDLE_TIMEOUT=30000 -UICC_IDLE_TIMEOUT=0 - ############################################################################### # AID for Empty Select command # If specified, this AID will be substituted when an Empty SELECT command is # detected. The first byte is the length of the AID. Maximum length is 16. AID_FOR_EMPTY_SELECT={08:A0:00:00:01:51:00:00:00} -############################################################################### -# This setting allows you to disable registering the T4t Virtual SE that causes -# the NFCC to send PPSE requests to the DH. -# The default setting is enabled (i.e. T4t Virtual SE is registered). -#REGISTER_VIRTUAL_SE=1 - ############################################################################### # When screen is turned off, specify the desired power state of the controller. # 0: power-off-sleep state; DEFAULT @@ -181,120 +25,6 @@ AID_FOR_EMPTY_SELECT={08:A0:00:00:01:51:00:00:00} # 2: screen-off card-emulation (CE4/CE3/CE1 modes are used) SCREEN_OFF_POWER_STATE=1 -############################################################################### -# Firmware patch file -# If the value is not set then patch download is disabled. -#FW_PATCH="/vendor/firmware/bcm2079x_firmware.ncd" - -############################################################################### -# Firmware pre-patch file (sent before the above patch file) -# If the value is not set then pre-patch is not used. -#FW_PRE_PATCH="/vendor/firmware/bcm2079x_pre_firmware.ncd" - -############################################################################### -# Firmware patch format -# 1 = HCD -# 2 = NCD (default) -#NFA_CONFIG_FORMAT=2 - -############################################################################### -# SPD Debug mode -# If set to 1, any failure of downloading a patch will trigger a hard-stop -#SPD_DEBUG=0 - -############################################################################### -# SPD Max Retry Count -# The number of attempts to download a patch before giving up (defualt is 3). -# Note, this resets after a power-cycle. -#SPD_MAX_RETRY_COUNT=3 - -############################################################################### -# transport driver -# -# TRANSPORT_DRIVER= -# -# where can be, for example: -# "/dev/ttyS" (UART) -# "/dev/bcmi2cnfc" (I2C) -# "hwtun" (HW Tunnel) -# "/dev/bcmspinfc" (SPI) -# "/dev/btusb0" (BT USB) -#TRANSPORT_DRIVER="/dev/bcm2079x-i2c" - -############################################################################### -# power control driver -# Specify a kernel driver that support ioctl commands to control NFC_EN and -# NFC_WAKE gpio signals. -# -# POWER_CONTRL_DRIVER= -# where can be, for example: -# "/dev/nfcpower" -# "/dev/bcmi2cnfc" (I2C) -# "/dev/bcmspinfc" (SPI) -# i2c and spi driver may be used to control NFC_EN and NFC_WAKE signal -#POWER_CONTROL_DRIVER="/dev/bcm2079x-i2c" - -############################################################################### -# I2C transport driver options -# Mako does not support 10-bit I2C addresses -# Revert to 7-bit address -#BCMI2CNFC_ADDRESS=0x77 - -############################################################################### -# I2C transport driver try to read multiple packets in read() if data is available -# remove the comment below to enable this feature -#READ_MULTIPLE_PACKETS=1 - -############################################################################### -# SPI transport driver options -#SPI_NEGOTIATION={0A:F0:00:01:00:00:00:FF:FF:00:00} - -############################################################################### -# UART transport driver options -# -# PORT=1,2,3,... -# BAUD=115200, 19200, 9600, 4800, -# DATABITS=8, 7, 6, 5 -# PARITY="even" | "odd" | "none" -# STOPBITS="0" | "1" | "1.5" | "2" - -#UART_PORT=2 -#UART_BAUD=115200 -#UART_DATABITS=8 -#UART_PARITY="none" -#UART_STOPBITS="1" - -############################################################################### -# Insert a delay in microseconds per byte after a write to NFCC. -# after writing a block of data to the NFCC, delay this an amopunt of time before -# writing next block of data. the delay is calculated as below -# NFC_WRITE_DELAY * (number of byte written) / 1000 milliseconds -# e.g. after 259 bytes is written, delay (259 * 20 / 1000) 5 ms before next write -#NFC_WRITE_DELAY=20 - -############################################################################### -# Maximum Number of Credits to be allowed by the NFCC -# This value overrides what the NFCC specifices allowing the host to have -# the control to work-around transport limitations. If this value does -# not exist or is set to 0, the NFCC will provide the number of credits. -MAX_RF_DATA_CREDITS=1 - -############################################################################### -# Default poll duration (in ms) -# The defualt is 500ms if not set (see nfc_target.h) -#NFA_DM_DISC_DURATION_POLL=333 - -############################################################################### -# Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1. -# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm -# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block -# 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re-activate -# 3 NFA_RW_PRES_CHK_RB_CH0; Type-4 tag protocol's ReadBinary command on channel 0 -# 4 NFA_RW_PRES_CHK_RB_CH3; Type-4 tag protocol's ReadBinary command on channel 3 -# 5 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check -# command is sent waiting for rsp and ntf. -PRESENCE_CHECK_ALGORITHM=5 - ############################################################################### # Force tag polling for the following technology(s). # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h. @@ -331,7 +61,6 @@ PRESERVE_STORAGE=0x01 # The value is set to 3 by default as it assumes we will discover 0xF2, # 0xF3, and 0xF4. If a platform will exclude and SE, this value can be reduced # so that the stack will not wait any longer than necessary. - # Maximum EE supported number # NXP PN547C2 0x02 # NXP PN65T 0x03 @@ -339,15 +68,6 @@ PRESERVE_STORAGE=0x01 # NXP PN66T 0x03 NFA_MAX_EE_SUPPORTED=0x02 -############################################################################### -# NCI Hal Module name -NCI_HAL_MODULE="nfc_nci" - -############################################################################## -# Deactivate notification wait time out in seconds used in ETSI Reader mode -# 0 - Infinite wait -#NFA_DM_DISC_NTF_TIMEOUT=0 - ############################################################################### # AID_MATCHING constants # AID_MATCHING_EXACT_ONLY 0x00 @@ -355,34 +75,3 @@ NCI_HAL_MODULE="nfc_nci" # AID_MATCHING_PREFIX_ONLY 0x02 # AID_MATCHING_EXACT_OR_SUBSET_OR_PREFIX 0x03 AID_MATCHING_MODE=0x03 - -############################################################################### -# Default Secure Element route id -DEFAULT_OFFHOST_ROUTE=0x02 - -############################################################################### -# Vendor Specific Proprietary Protocol & Discovery Configuration -# Set to 0xFF if unsupported -# byte[0] NCI_PROTOCOL_18092_ACTIVE -# byte[1] NCI_PROTOCOL_B_PRIME -# byte[2] NCI_PROTOCOL_DUAL -# byte[3] NCI_PROTOCOL_15693 -# byte[4] NCI_PROTOCOL_KOVIO -# byte[5] NCI_PROTOCOL_MIFARE -# byte[6] NCI_DISCOVERY_TYPE_POLL_KOVIO -# byte[7] NCI_DISCOVERY_TYPE_POLL_B_PRIME -# byte[8] NCI_DISCOVERY_TYPE_LISTEN_B_PRIME -NFA_PROPRIETARY_CFG={05:FF:FF:06:81:80:70:FF:FF} - -############################################################################### -# Bail out mode -# If set to 1, NFCC is using bail out mode for either Type A or Type B poll. -NFA_POLL_BAIL_OUT_MODE=0x01 -############################################################################### -# Enable/Disable Block Route feature. -# Block Route will restrict routing to first matched rule -# Block Route enable 0x01 -# Block Route disable 0x00 -NFA_BLOCK_ROUTE=0x00 -# Extended APDU length for ISO_DEP -ISO_DEP_MAX_TRANSCEIVE=0xFEFF diff --git a/sepolicy/vendor/hal_nfc_default.te b/sepolicy/vendor/hal_nfc_default.te index 3044f1d5..7367b5a6 100644 --- a/sepolicy/vendor/hal_nfc_default.te +++ b/sepolicy/vendor/hal_nfc_default.te @@ -1,3 +1,6 @@ # Data file accesses. allow hal_nfc_default nfc_vendor_data_file:dir create_dir_perms; allow hal_nfc_default nfc_vendor_data_file:file create_file_perms; + +dontaudit hal_nfc_default nxpese_hwservice:hwservice_manager find; +dontaudit hal_nfc_default nxpnfc_hwservice:hwservice_manager add; diff --git a/sepolicy/vendor/hwservice.te b/sepolicy/vendor/hwservice.te index 4e13ddb1..18fbc442 100644 --- a/sepolicy/vendor/hwservice.te +++ b/sepolicy/vendor/hwservice.te @@ -3,3 +3,5 @@ type vnd_qcrilhook_hwservice, hwservice_manager_type; type vnd_atcmdfwd_hwservice, hwservice_manager_type; type hal_imsrtp_hwservice, hwservice_manager_type; type hal_ipacm_hwservice, hwservice_manager_type; +type nxpnfc_hwservice, hwservice_manager_type; +type nxpese_hwservice, hwservice_manager_type; diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts index 89f75101..50ab7748 100644 --- a/sepolicy/vendor/hwservice_contexts +++ b/sepolicy/vendor/hwservice_contexts @@ -8,3 +8,5 @@ android.hardware.tetheroffload.config::IOffloadConfig u:object_r:hal_t android.hardware.tetheroffload.control::IOffloadControl u:object_r:hal_tetheroffload_hwservice:s0 com.quicinc.cne.api::IApiService u:object_r:hal_cne_hwservice:s0 com.quicinc.cne.server::IServer u:object_r:hal_cne_hwservice:s0 +vendor.nxp.nxpnfc::INxpNfc u:object_r:nxpnfc_hwservice:s0 +vendor.nxp.nxpese::INxpEse u:object_r:nxpese_hwservice:s0 From 4d35724ee40266004a8254e9ba8e94332d70fc2a Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Thu, 22 Mar 2018 15:59:02 -0700 Subject: [PATCH 230/300] Add sysfs_type attr to sysfs_irq Tests in aosp/646548 assert that genfs_contexts labeled filesystems use the correct attributes such as files in /sys having sysfs_type. Bug: 74182216 Test: build with aosp/646548 - these are build-time tests. Change-Id: If82fe17632f0c28e481eb7e831730c6ba22d3877 Merged-In: If82fe17632f0c28e481eb7e831730c6ba22d3877 (cherry picked from commit 4abb3d041332dcb7cd29ad1d38408c57432a5ca9) --- sepolicy/vendor/file.te | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 9017790f..3e50f620 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -96,5 +96,5 @@ typeattribute sysfs_batteryinfo mlstrustedobject; # msm_irqbalance type proc_irq, fs_type; -type sysfs_irq, fs_type; +type sysfs_irq, sysfs_type, fs_type; type irqbalance_socket, file_type; From 0662668209e314a33e5a48824d90e479c9fee689 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Tue, 27 Mar 2018 16:35:44 -0700 Subject: [PATCH 231/300] wahoo: Mark proc_* types with proc_type attribute. Bug: 74182216 Test: build policy Change-Id: I6e541d0111639a213b80d755adc546f653531103 Merged-In: I6e541d0111639a213b80d755adc546f653531103 (cherry picked from commit ece77653a531cf55f25304964e6c047a641c85da) --- sepolicy/vendor/file.te | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 3e50f620..821859af 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -37,7 +37,7 @@ type debugfs_dma_bufinfo, debugfs_type, fs_type; type debugfs_tzdbg, debugfs_type, fs_type; # /proc -type proc_wifi_dbg, fs_type; +type proc_wifi_dbg, fs_type, proc_type; type qmuxd_socket, file_type; type netmgrd_socket, file_type; @@ -95,6 +95,6 @@ type keylayout_file, file_type, vendor_file_type; typeattribute sysfs_batteryinfo mlstrustedobject; # msm_irqbalance -type proc_irq, fs_type; +type proc_irq, fs_type, proc_type; type sysfs_irq, sysfs_type, fs_type; type irqbalance_socket, file_type; From fe3e7a0a2ef9c1cba18ef02a55312b4deda42473 Mon Sep 17 00:00:00 2001 From: Thierry Strudel Date: Tue, 3 Apr 2018 16:17:57 -0700 Subject: [PATCH 232/300] init.hardware.rc: map sys.retaildemo to persist.vendor.charge.*.level Bug: 75293289 Bug: 75301885 Change-Id: If1d12aff9807c4f32982ad3b2ad4eb0d78213d78 Signed-off-by: Thierry Strudel --- init.hardware.rc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.hardware.rc b/init.hardware.rc index ce0af9d3..50f8c27a 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -872,3 +872,14 @@ on property:sys.vdso=32 on property:wlan.driver.status=ok # Get the wlan driver/fw version start vendor.wlan_sh + +# charger driver exposes now finer grain control, map demo mode to those properties +# demo mode can only be exit wipping data which will also reset the persist properties +on property:sys.retaildemo.enabled=1 + setprop persist.vendor.charge.stop.level 35 + setprop persist.vendor.charge.start.level 30 + +# system will not set the sys.retaildemo.enabled to 0 but this is used to set back to default charging +on property:sys.retaildemo.enabled=0 + setprop persist.vendor.charge.stop.level 100 + setprop persist.vendor.charge.start.level 0 From fa1279bd6bbab0b2ff07e5079da45a082efd3622 Mon Sep 17 00:00:00 2001 From: Thierry Strudel Date: Tue, 3 Apr 2018 17:22:55 -0700 Subject: [PATCH 233/300] battery cycle counts: backup/restore + update dumpstate Tests: - pts-tradefed run pts -a arm64-v8a -m PtsHardwareInfoHostTestCases - adb bugreport - no "avc: denied" on health vendor service - cycle count stored in /persist/battery/qcom_cycle_counts_bins Bug: 72776338 Bug: 77498107 Change-Id: Ia1a58441fff511c60278b5d97806655c34aec610 Signed-off-by: Thierry Strudel --- dumpstate/DumpstateDevice.cpp | 2 +- health/Android.bp | 1 + health/CycleCountBackupRestore.cpp | 132 ++++++++++++++++++++++++++ health/CycleCountBackupRestore.h | 54 +++++++++++ health/HealthService.cpp | 42 +++++++- init.hardware.rc | 9 ++ sepolicy/vendor/file.te | 1 + sepolicy/vendor/file_contexts | 1 + sepolicy/vendor/genfs_contexts | 2 +- sepolicy/vendor/hal_dumpstate_impl.te | 2 +- sepolicy/vendor/hal_health_default.te | 5 + sepolicy/vendor/hardware_info_app.te | 3 +- 12 files changed, 246 insertions(+), 8 deletions(-) create mode 100644 health/CycleCountBackupRestore.cpp create mode 100644 health/CycleCountBackupRestore.h diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index e7e0bb67..750d4e6a 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -260,7 +260,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "cat /d/tzdbg/qsee_log"}); RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in /sys/class/power_supply/*/uevent ; do echo \"\n------ $f\" ; cat $f ; done"}); - RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"}); + DumpFileToFd(fd, "Battery cycle count", "/sys/class/power_supply/bms/device/cycle_counts_bins"); RunCommandToFd(fd, "QCOM FG SRAM", {"/vendor/bin/sh", "-c", "echo 0 > /d/fg/sram/address ; echo 500 > /d/fg/sram/count ; cat /d/fg/sram/data"}); DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); diff --git a/health/Android.bp b/health/Android.bp index e1d9bd3a..ba241482 100644 --- a/health/Android.bp +++ b/health/Android.bp @@ -20,6 +20,7 @@ cc_binary { relative_install_path: "hw", srcs: [ "HealthService.cpp", + "CycleCountBackupRestore.cpp", ], cflags: [ diff --git a/health/CycleCountBackupRestore.cpp b/health/CycleCountBackupRestore.cpp new file mode 100644 index 00000000..b9f83df0 --- /dev/null +++ b/health/CycleCountBackupRestore.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2018 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 "CycleCountBackupRestore.h" + +namespace device { +namespace google { +namespace wahoo { +namespace health { + +static constexpr char kCycCntFile[] = "sys/class/power_supply/bms/device/cycle_counts_bins"; +static constexpr char kSysPersistFile[] = "/persist/battery/qcom_cycle_counts_bins"; +static constexpr int kBuffSize = 256; + +CycleCountBackupRestore::CycleCountBackupRestore() { } + +void CycleCountBackupRestore::Restore() +{ + ReadFromStorage(); + ReadFromSRAM(); + UpdateAndSave(); +} + +void CycleCountBackupRestore::Backup() +{ + ReadFromSRAM(); + UpdateAndSave(); +} + +void CycleCountBackupRestore::ReadFromStorage() +{ + std::string buffer; + + if (!android::base::ReadFileToString(std::string(kSysPersistFile), &buffer)) { + LOG(ERROR) << "Cannot read the storage file"; + return; + } + + if (sscanf(buffer.c_str(), "%d %d %d %d %d %d %d %d", + &sw_bins_[0], &sw_bins_[1], &sw_bins_[2], &sw_bins_[3], + &sw_bins_[4], &sw_bins_[5], &sw_bins_[6], &sw_bins_[7]) + != kBucketCount) + LOG(ERROR) << "data format is wrong in the storage file: " << buffer; + else + LOG(INFO) << "Storage data: " << buffer; +} + +void CycleCountBackupRestore::SaveToStorage() +{ + char strData[kBuffSize]; + + snprintf(strData, kBuffSize, "%d %d %d %d %d %d %d %d", + sw_bins_[0], sw_bins_[1], sw_bins_[2], sw_bins_[3], + sw_bins_[4], sw_bins_[5], sw_bins_[6], sw_bins_[7]); + + LOG(INFO) << "Save to Storage: " << strData; + + if (!android::base::WriteStringToFile(strData, std::string(kSysPersistFile))) + LOG(ERROR) << "Write file error: " << strerror(errno); +} + +void CycleCountBackupRestore::ReadFromSRAM() +{ + std::string buffer; + + if (!android::base::ReadFileToString(std::string(kCycCntFile), &buffer)) { + LOG(ERROR) << "Read cycle counter error: " << strerror(errno); + return; + } + + buffer = android::base::Trim(buffer); + + if (sscanf(buffer.c_str(), "%d %d %d %d %d %d %d %d", + &hw_bins_[0], &hw_bins_[1], &hw_bins_[2], &hw_bins_[3], + &hw_bins_[4], &hw_bins_[5], &hw_bins_[6], &hw_bins_[7]) + != kBucketCount) + LOG(ERROR) << "Failed to parse SRAM bins: " << buffer; + else + LOG(INFO) << "SRAM data: " << buffer; +} + +void CycleCountBackupRestore::SaveToSRAM() +{ + char strData[kBuffSize]; + + snprintf(strData, kBuffSize, "%d %d %d %d %d %d %d %d", + hw_bins_[0], hw_bins_[1], hw_bins_[2], hw_bins_[3], + hw_bins_[4], hw_bins_[5], hw_bins_[6], hw_bins_[7]); + + LOG(INFO) << "Save to SRAM: " << strData ; + + if (!android::base::WriteStringToFile(strData, std::string(kCycCntFile))) + LOG(ERROR) << "Write data error: " << strerror(errno); +} + + +void CycleCountBackupRestore::UpdateAndSave() +{ + bool backup = false; + bool restore = false; + for (int i = 0; i < kBucketCount; i++) { + if (hw_bins_[i] < sw_bins_[i]) { + hw_bins_[i] = sw_bins_[i]; + restore = true; + } else if (hw_bins_[i] > sw_bins_[i]) { + sw_bins_[i] = hw_bins_[i]; + backup = true; + } + } + if (restore) + SaveToSRAM(); + if (backup) + SaveToStorage(); +} + +} // namespace health +} // namespace wahoo +} // namespace google +} // namespace device diff --git a/health/CycleCountBackupRestore.h b/health/CycleCountBackupRestore.h new file mode 100644 index 00000000..e113c323 --- /dev/null +++ b/health/CycleCountBackupRestore.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef DEVICE_GOOGLE_WAHOO_HEALTH_CYCLECOUNTBACKUPRESTORE_H +#define DEVICE_GOOGLE_WAHOO_HEALTH_CYCLECOUNTBACKUPRESTORE_H + +#include +#include +#include +#include + +namespace device { +namespace google { +namespace wahoo { +namespace health { + +static constexpr int kBucketCount = 8; + +class CycleCountBackupRestore { +public: + CycleCountBackupRestore(); + void Restore(); + void Backup(); + +private: + int sw_bins_[kBucketCount]; + int hw_bins_[kBucketCount]; + + void ReadFromStorage(); + void SaveToStorage(); + void ReadFromSRAM(); + void SaveToSRAM(); + void UpdateAndSave(); +}; + +} // namespace health +} // namespace wahoo +} // namespace google +} // namespace device + +#endif // #ifndef DEVICE_GOOGLE_WAHOO_HEALTH_CYCLECOUNTBACKUPRESTORE_H diff --git a/health/HealthService.cpp b/health/HealthService.cpp index 1e7b4508..45d18c30 100644 --- a/health/HealthService.cpp +++ b/health/HealthService.cpp @@ -27,14 +27,50 @@ #include #include +#include "CycleCountBackupRestore.h" + using android::hardware::health::V2_0::StorageInfo; using android::hardware::health::V2_0::DiskStats; +using ::device::google::wahoo::health::CycleCountBackupRestore; -void healthd_board_init(struct healthd_config*) { +static constexpr int kBackupTrigger = 20; +static CycleCountBackupRestore ccBackupRestore; + +int cycle_count_backup(int battery_level) +{ + static int saved_soc = 0; + static int soc_inc = 0; + static bool is_first = true; + + if (is_first) { + is_first = false; + saved_soc = battery_level; + return 0; + } + + if (battery_level > saved_soc) { + soc_inc += battery_level - saved_soc; + } + + saved_soc = battery_level; + + if (soc_inc >= kBackupTrigger) { + ccBackupRestore.Backup(); + soc_inc = 0; + } + return 0; } -int healthd_board_battery_update(struct android::BatteryProperties*) { - return 0; +// See : hardware/interfaces/health/2.0/README + +void healthd_board_init(struct healthd_config*) +{ + ccBackupRestore.Restore(); +} + +int healthd_board_battery_update(struct android::BatteryProperties *props) +{ + return cycle_count_backup(props->batteryLevel); } const char kUFSHealthFile[] = "/sys/kernel/debug/ufshcd0/dump_health_desc"; diff --git a/init.hardware.rc b/init.hardware.rc index 50f8c27a..d1c20db2 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -187,6 +187,10 @@ on fs chmod 0770 /persist/rfs/apq chmod 0770 /persist/rfs/apq/gnss chmod 0770 /persist/hlos_rfs + + # for android.hardware.health@2.0-service.marlin cycle count backup + mkdir /persist/battery 0700 system system + restorecon_recursive /persist # Start HW service manager early @@ -425,6 +429,11 @@ on early-boot chown system system /sys/class/leds/blue/rgb_start chown system system /sys/class/graphics/fb0/msm_fb_persist_mode + # dumpstate needs to read, vendor.health-hal needs to be able to RW + chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins + # HardwareInfo needs to be able to read CC bins + chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins + on boot mkdir /dev/socket/qmux_radio 0770 radio radio chmod 2770 /dev/socket/qmux_radio diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 821859af..108b7361 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -63,6 +63,7 @@ type persist_haptics_file, file_type; type persist_rfs_file, file_type; type persist_sensors_file, file_type; type persist_time_file, file_type; +type persist_battery_file, file_type; type netmgr_data_file, file_type, data_file_type; type ipa_vendor_data_file, file_type, data_file_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 8a9359a0..f08778fe 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -286,6 +286,7 @@ /persist/rfs(/.*)? u:object_r:persist_rfs_file:s0 /persist/sensors(/.*)? u:object_r:persist_sensors_file:s0 /persist/time(/.*)? u:object_r:persist_time_file:s0 +/persist/battery(/.*)? u:object_r:persist_battery_file:s0 /metadata u:object_r:rootfs:s0 /metadata/.* u:object_r:vold_data_file:s0 diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index dd1ad28a..e9b72e6a 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -61,7 +61,7 @@ genfscon sysfs /devices/soc/8c0000.qcom,msm-cam u:object genfscon sysfs /devices/soc0 u:object_r:sysfs_soc:s0 genfscon sysfs /devices/soc/caa0000.qcom,jpeg u:object_r:sysfs_camera:s0 genfscon sysfs /devices/soc/caa4000.qcom,fd u:object_r:sysfs_camera:s0 -genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg u:object_r:sysfs_batteryinfo:s0 genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply u:object_r:sysfs_batteryinfo:s0 genfscon sysfs /bus/msm_subsys u:object_r:sysfs_msm_subsys:s0 genfscon sysfs /module/subsystem_restart u:object_r:sysfs_msm_subsys_restart:s0 diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index 26d29cf9..39a89957 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -75,7 +75,7 @@ dontaudit hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms; # Query and dump power supply nodes allow hal_dumpstate_impl sysfs_batteryinfo:dir search; -allow hal_dumpstate_impl sysfs_batteryinfo:file rw_file_perms; +allow hal_dumpstate_impl sysfs_batteryinfo:file r_file_perms; # Dump QCOM FG content allow hal_dumpstate_impl debugfs_fg_sram:dir search; diff --git a/sepolicy/vendor/hal_health_default.te b/sepolicy/vendor/hal_health_default.te index 9f7f6815..bb3a65a7 100644 --- a/sepolicy/vendor/hal_health_default.te +++ b/sepolicy/vendor/hal_health_default.te @@ -4,3 +4,8 @@ allow hal_health_default debugfs_ufs:dir search; allow hal_health_default sysfs_scsi_devices_0000:dir search; allow hal_health_default debugfs_ufs:file { getattr open read }; allow hal_health_default sysfs_scsi_devices_0000:file { getattr open read }; + +allow hal_health_default persist_battery_file:file create_file_perms; +allow hal_health_default persist_battery_file:dir rw_dir_perms; +allow hal_health_default persist_file:dir search; +allow hal_health_default sysfs_batteryinfo:file rw_file_perms; diff --git a/sepolicy/vendor/hardware_info_app.te b/sepolicy/vendor/hardware_info_app.te index ba57b624..27ce4405 100644 --- a/sepolicy/vendor/hardware_info_app.te +++ b/sepolicy/vendor/hardware_info_app.te @@ -14,8 +14,7 @@ allow hardware_info_app shell_data_file:file { open read }; # SysFS allow hardware_info_app sysfs_batteryinfo:dir search; -allow hardware_info_app sysfs_batteryinfo:file { getattr open read write }; -allow hardware_info_app sysfs_batteryinfo:file write; +allow hardware_info_app sysfs_batteryinfo:file { getattr open read }; allow hardware_info_app sysfs_camera:dir search; allow hardware_info_app sysfs_camera:file { getattr open read }; allow hardware_info_app sysfs_msm_subsys:dir search; From f6acbc6276c746b01246cf91eac3910ce04fd8db Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 4 Apr 2018 13:45:33 -0700 Subject: [PATCH 234/300] Wait for hwservicemanager ready before running fsck As property service is part of init, and if init is busy with built-in command e.g. fsck, the propety_set() won't go through until the built-in command is finished. Move the start of hwservicemanager earlier and wait for its done after launches bootanim and its dependencies (there is not wait time during boot but the command is as a safeguard). Bug: 74437368 Test: boot with simulated long fsck and bootanim shown early Test: boot see 'start_waiting_for_property("hwservicemanager.ready", "true"): already set' Change-Id: Iab4b857a51e0e6b8b059d063c1f0d65a0e987622 --- init.hardware.rc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index d1c20db2..385fd2eb 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -160,6 +160,8 @@ on init write /proc/sys/vm/page-cluster 0 on fs + # Start HW service manager early + start hwservicemanager mount_all /vendor/etc/fstab.${ro.hardware} --early mkdir /persist/data 0700 system system @@ -193,9 +195,6 @@ on fs restorecon_recursive /persist - # Start HW service manager early - start hwservicemanager - on late-fs # Start devices by sysfs trigger start vendor.devstart_sh @@ -206,6 +205,10 @@ on late-fs start vendor.configstore-hal-1-0 start vendor.gralloc-2-0 + # Wait for hwservicemanager ready since fsck might be triggered in mount_all --late + # In such case, init won't responce the property_set from hwservicemanager and then + # cause services for bootanim not running. + wait_for_prop hwservicemanager.ready true # Mount RW partitions which need run fsck mount_all /vendor/etc/fstab.${ro.hardware} --late From 6c41af4807fb8bb103ce0872f73384ceb5cb99eb Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 5 Apr 2018 13:44:32 -0700 Subject: [PATCH 235/300] health HAL: overrides healthd. healthd should not be installed on the device Test: lshal -i | grep IHealth/backup fails Test: lshal debug android.hardware.health@2.0::IHealth/backup shows nothing Test: vts_treble_vintf_test shows nothing about /backup instance Bug: 77541952 Change-Id: I1479da3394ee7bb0f3fba8b6bcb4e12b50ed8190 --- BoardConfig.mk | 3 +++ CleanSpec.mk | 4 ++++ health/Android.bp | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 1ffacc2c..bc4793c6 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -154,6 +154,9 @@ DEVICE_FRAMEWORK_MANIFEST_FILE := device/google/wahoo/framework_manifest.xml DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := device/google/wahoo/device_framework_matrix.xml BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true +# Remove health /backup instance +DEVICE_FRAMEWORK_MANIFEST_FILE += system/libhidl/vintfdata/manifest_healthd_exclude.xml + # Use mke2fs to create ext4 images TARGET_USES_MKE2FS := true diff --git a/CleanSpec.mk b/CleanSpec.mk index f735633e..fe253e4d 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -183,3 +183,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@ # Remove Widevine HAL 1.0 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.drm@1.0-service.widevine.rc) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@1.0-service.widevine) + +# Remove healthd +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/healthd) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/healthd.rc) diff --git a/health/Android.bp b/health/Android.bp index ba241482..6d9c2a85 100644 --- a/health/Android.bp +++ b/health/Android.bp @@ -46,4 +46,8 @@ cc_binary { ], header_libs: ["libhealthd_headers"], + + overrides: [ + "healthd", + ], } From 4aca1f81e114846018bcfc4b352fc9deb989747e Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 5 Apr 2018 19:07:36 -0700 Subject: [PATCH 236/300] Fix health service write to kernel log Test: see battery level in kernel log without healthd Bug: 77661605 Change-Id: I9ca81a1e24990b508daf5ae04f8ee09720e29cc0 --- health/android.hardware.health@2.0-service.wahoo.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/health/android.hardware.health@2.0-service.wahoo.rc b/health/android.hardware.health@2.0-service.wahoo.rc index 2897b5e7..2949265d 100644 --- a/health/android.hardware.health@2.0-service.wahoo.rc +++ b/health/android.hardware.health@2.0-service.wahoo.rc @@ -2,3 +2,4 @@ service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service class hal user system group system + file /dev/kmsg w From a60f2873a57992f371967d31ef3305ae7360efd1 Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Tue, 6 Mar 2018 09:27:56 +0000 Subject: [PATCH 237/300] Add /sys/kernel/memory_state_time to sysfs_power. This allows system_server to access it for determining battery stats (see KernelMemoryBandwidthStats.java). batterystats-wo: type=1400 audit(0.0:429): avc: denied { read } for name="show_stat" dev="sysfs" ino=48071 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0 Bug: 72643420 Bug: 73947096 Test: Policy still builds. Change-Id: I2a31178f3fb2b5761050896579650a062ea026d2 --- sepolicy/vendor/genfs_contexts | 1 - 1 file changed, 1 deletion(-) diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index e9b72e6a..bf0e65b2 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -68,7 +68,6 @@ genfscon sysfs /module/subsystem_restart u:object genfscon sysfs /kernel/boot_adsp/boot u:object_r:sysfs_msm_subsys:s0 genfscon sysfs /kernel/boot_slpi/boot u:object_r:sysfs_msm_subsys:s0 genfscon sysfs /kernel/wifi/wlan u:object_r:sysfs_msm_wlan:s0 -genfscon sysfs /kernel/memory_state_time u:object_r:sysfs_power:s0 genfscon sysfs /devices/soc/c1b7000.i2c/i2c-9/9-0008 u:object_r:sysfs_easel:s0 genfscon sysfs /class/typec u:object_r:sysfs_usb_c:s0 genfscon sysfs /class/typec/usbc0 u:object_r:sysfs_usb_c:s0 From d4235d2c5ac7f235595d4c6e5639fedeff6b8db5 Mon Sep 17 00:00:00 2001 From: Chenbo Feng Date: Fri, 6 Apr 2018 12:59:15 -0700 Subject: [PATCH 238/300] Allow RILD to read xt_qtaguid iface stats on wahoo The RILD process on W/T need to get the per iface stats from proc/net/xt_qtaguid/iface_stat_fmt file. So we have to grant it the permission since there is no native API for that. Bug: 68774956 Test: device boot without selinux violation Change-Id: Ib86916951cb8f340bfef55814ae8c4fef0f51338 --- sepolicy/vendor/rild.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te index 3d54a40b..c704c128 100644 --- a/sepolicy/vendor/rild.te +++ b/sepolicy/vendor/rild.te @@ -30,3 +30,6 @@ allow rild radio_vendor_data_file:file create_file_perms; get_prop(rild, tel_mon_prop) get_prop(rild, vendor_radio_prop) + +# Allow vendor native process to read the proc file of xt_qtaguid +allow rild proc_qtaguid_stat:file r_file_perms; From 97121bbe703197bde1752f28b8bbb4f9c519903d Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Mon, 9 Apr 2018 13:31:09 +0900 Subject: [PATCH 239/300] Apply whitelist of bluetooth_prop and wifi_prop (2/2) Bug: 77633703 Test: succeeded building and tested with Pixels Change-Id: I440603705f5cbf6701c8521873792b9448fa5c7d --- sepolicy/vendor/bluetooth.te | 1 + sepolicy/vendor/hal_bluetooth_default.te | 1 + sepolicy/vendor/property.te | 1 + sepolicy/vendor/property_contexts | 14 +++++++++++--- sepolicy/vendor/system_app.te | 1 + sepolicy/vendor/vendor_init.te | 2 +- sepolicy/vendor/wcnss_filter.te | 2 +- 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sepolicy/vendor/bluetooth.te b/sepolicy/vendor/bluetooth.te index 5a8371dd..6d70fab6 100644 --- a/sepolicy/vendor/bluetooth.te +++ b/sepolicy/vendor/bluetooth.te @@ -1,3 +1,4 @@ +set_prop(bluetooth, vendor_bluetooth_prop) set_prop(bluetooth, wc_prop) # Allow access to net_admin ioctls diff --git a/sepolicy/vendor/hal_bluetooth_default.te b/sepolicy/vendor/hal_bluetooth_default.te index fa6ba605..6ac8201d 100644 --- a/sepolicy/vendor/hal_bluetooth_default.te +++ b/sepolicy/vendor/hal_bluetooth_default.te @@ -6,6 +6,7 @@ allow hal_bluetooth_default wcnss_filter:unix_stream_socket connectto; allow hal_bluetooth fwk_scheduler_hwservice:hwservice_manager find; allow hal_bluetooth system_server:binder call; +set_prop(hal_bluetooth_default, vendor_bluetooth_prop) set_prop(hal_bluetooth_default, wc_prop) userdebug_or_eng(` diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index eeb2b6d9..ae95e892 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -18,6 +18,7 @@ type sys_time_prop, property_type; type atfwd_start_prop, property_type; type bluetooth_log_prop, property_type; type power_prop, property_type; +type vendor_bluetooth_prop, property_type; type vendor_net_radio_prop, property_type; type vendor_radio_prop, property_type; type vendor_wifi_version, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index ec1c1030..a6b760b6 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -147,9 +147,6 @@ ro.alarm_boot u:object_r:vendor_default_prop:s0 ro.boot.factoryota u:object_r:vendor_default_prop:s0 ro.boot.mid u:object_r:vendor_default_prop:s0 ro.boot.temp_protect_ignore u:object_r:vendor_default_prop:s0 -ro.bluetooth.a4wp u:object_r:vendor_default_prop:s0 -ro.bluetooth.emb_wp_mode u:object_r:vendor_default_prop:s0 -ro.bluetooth.wipower u:object_r:vendor_default_prop:s0 ro.camera.wrapper.hal3TrebleMinorVersion u:object_r:vendor_default_prop:s0 ro.fota.oem u:object_r:vendor_default_prop:s0 ro.lean u:object_r:vendor_default_prop:s0 @@ -194,3 +191,14 @@ persist.radio.snapshot_timer u:object_r:vendor_radio_prop:s0 persist.radio.videopause.mode u:object_r:vendor_radio_prop:s0 persist.radio.VT_ENABLE u:object_r:vendor_radio_prop:s0 persist.radio.VT_HYBRID_ENABLE u:object_r:vendor_radio_prop:s0 + +# vendor_bluetooth_prop +persist.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 +persist.bluetooth.csoc.cnt u:object_r:vendor_bluetooth_prop:s0 +persist.service.bdroid.fwsnoop u:object_r:vendor_bluetooth_prop:s0 +persist.service.bdroid.sibs u:object_r:vendor_bluetooth_prop:s0 +persist.service.bdroid.soclog u:object_r:vendor_bluetooth_prop:s0 +persist.service.bdroid.ssrlvl u:object_r:vendor_bluetooth_prop:s0 +ro.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 +ro.bluetooth.emb_wp_mode u:object_r:vendor_bluetooth_prop:s0 +ro.bluetooth.wipower u:object_r:vendor_bluetooth_prop:s0 diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te index 5e5eb62f..ac4ef9b6 100644 --- a/sepolicy/vendor/system_app.te +++ b/sepolicy/vendor/system_app.te @@ -9,4 +9,5 @@ set_prop(system_app, camera_prop) allow system_app elabel_data_file:dir r_dir_perms; allow system_app elabel_data_file:file r_file_perms; +set_prop(system_app, vendor_bluetooth_prop) set_prop(system_app, public_vendor_system_prop) diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 4e85f7c6..c85a281f 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -24,7 +24,7 @@ userdebug_or_eng(` allow vendor_init proc_sysrq:file w_file_perms; ') -set_prop(vendor_init, bluetooth_prop) +set_prop(vendor_init, vendor_bluetooth_prop) set_prop(vendor_init, camera_prop) set_prop(vendor_init, modem_diag_prop) set_prop(vendor_init, power_prop) diff --git a/sepolicy/vendor/wcnss_filter.te b/sepolicy/vendor/wcnss_filter.te index 910fb0ea..aa2c71ab 100644 --- a/sepolicy/vendor/wcnss_filter.te +++ b/sepolicy/vendor/wcnss_filter.te @@ -4,7 +4,7 @@ type wcnss_filter_exec, exec_type, vendor_file_type, file_type; init_daemon_domain(wcnss_filter) set_prop(wcnss_filter, wc_prop) -set_prop(wcnss_filter, bluetooth_prop) +set_prop(wcnss_filter, vendor_bluetooth_prop) allow wcnss_filter hci_attach_dev:chr_file rw_file_perms; From 6a9651b762d064260dee2e73fd59707977802b78 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 5 Apr 2018 10:40:13 -0700 Subject: [PATCH 240/300] Track vendor_init SELinux denial. This should help fix presubmit tests. Bug: 77635294 Test: Built policy. Change-Id: I884ee75106c055aa7eb7af9f373d18e828a9f4e9 (cherry picked from commit 1c81d19b818ca93b64b05ebeced80048da8c3233) --- sepolicy/vendor/bug_map | 1 + 1 file changed, 1 insertion(+) create mode 100644 sepolicy/vendor/bug_map diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map new file mode 100644 index 00000000..f21b0fe6 --- /dev/null +++ b/sepolicy/vendor/bug_map @@ -0,0 +1 @@ +vendor_init unlabeled dir 77635294 From 7a12e2e56a76fa8f4ead0184f22f39ae3d1f8e29 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Tue, 10 Apr 2018 15:38:35 +0900 Subject: [PATCH 241/300] Correct misspelled "perist." with "persist." (5/5) Bug: 77725358 Test: succeeded building Change-Id: I8fbf7a8718f409f87410a7b9b1b45ab122620417 --- sepolicy/vendor/property_contexts | 1 - 1 file changed, 1 deletion(-) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index ec1c1030..121dd960 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -85,7 +85,6 @@ mm.enable.qcom_parser u:object_r:vendor_default_prop:s0 mm.enable.smoothstreaming u:object_r:vendor_default_prop:s0 perflocks.predefined_clust_map u:object_r:vendor_default_prop:s0 perflocks.predefined_freq_map u:object_r:vendor_default_prop:s0 -perist.vendor. u:object_r:vendor_default_prop:s0 persist.audio.calfile0 u:object_r:vendor_default_prop:s0 persist.audio.dualmic.config u:object_r:vendor_default_prop:s0 persist.audio.fluence. u:object_r:vendor_default_prop:s0 From fba20e1b4b8ce512e87a089fb92fb713ed15c961 Mon Sep 17 00:00:00 2001 From: Eran Messeri Date: Wed, 11 Apr 2018 17:19:06 +0100 Subject: [PATCH 242/300] Indicate Walleye supports Device ID attestation Bug: 72642093 Bug: 73448533 Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.DeviceOwnerTest#testKeyManagement -l DEBUG Change-Id: I1f932f7d4052bc999a98fb9eb9d40217929678fb --- device.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device.mk b/device.mk index 877a97bf..79894547 100755 --- a/device.mk +++ b/device.mk @@ -553,6 +553,10 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy +# Keymaster configuration +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.software.device_id_attestation.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.device_id_attestation.xml + ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) # Subsystem ramdump PRODUCT_PROPERTY_OVERRIDES += \ From daa6fec44fc33fb2dd5b69b417c898c085cb97f1 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Tue, 10 Apr 2018 12:46:55 -0700 Subject: [PATCH 243/300] Handle some diag-related denials. This allows the behavior on userdebug and eng builds and hides it on user builds. Bug: 77908806 Test: Boot device. Change-Id: I936f08283bcd03ef88c55b3849f54d2dab5a5d64 (cherry picked from commit 3e3da1baaac981a17c5e40ae7d20110a113d5c63) --- sepolicy/vendor/hal_gnss_qti.te | 2 ++ sepolicy/vendor/qti.te | 2 ++ sepolicy/vendor/radio.te | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/sepolicy/vendor/hal_gnss_qti.te b/sepolicy/vendor/hal_gnss_qti.te index d2638aff..2264399b 100644 --- a/sepolicy/vendor/hal_gnss_qti.te +++ b/sepolicy/vendor/hal_gnss_qti.te @@ -32,8 +32,10 @@ allow hal_gnss_qti self:netlink_route_socket { bind create nlmsg_read read write userdebug_or_eng(` allow hal_gnss_qti diag_device:chr_file rw_file_perms; + r_dir_file(hal_gnss_qti, sysfs_diag) ') dontaudit hal_gnss_qti diag_device:chr_file rw_file_perms; +dontaudit hal_gnss_qti sysfs_diag:dir search; # Most HALs are not allowed to use network sockets. Qcom library # libqdi is used across multiple processes which are clients of diff --git a/sepolicy/vendor/qti.te b/sepolicy/vendor/qti.te index e71ac822..be32d8c1 100644 --- a/sepolicy/vendor/qti.te +++ b/sepolicy/vendor/qti.te @@ -17,5 +17,7 @@ r_dir_file(qti, sysfs_msm_subsys) userdebug_or_eng(` allow qti diag_device:chr_file rw_file_perms; + r_dir_file(qti, sysfs_diag) ') dontaudit qti diag_device:chr_file rw_file_perms; +dontaudit qti sysfs_diag:dir search; diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index 5e3bdd82..0cb6607b 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -25,6 +25,11 @@ allow radio avtimer_device:chr_file r_file_perms; binder_call(radio, hal_imsrtp) +userdebug_or_eng(` + allow radio diag_device:chr_file rw_file_perms; +') +dontaudit radio diag_device:chr_file rw_file_perms; + # read /proc/cmdline allow radio proc_cmdline:file r_file_perms; From e2be8c24de86b5688cd9fce7c8bdd3ff6fd5b059 Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Wed, 11 Apr 2018 10:54:51 -0700 Subject: [PATCH 244/300] Track spurious hal_imrsc selinux denial Caused by changes in b/77725358. Track: avc: denied { read } for comm="ims_rtp_daemon" name="u:object_r:default_prop:s0" scontext=u:r:hal_imsrtp:s0 context=u:object_r:default_prop:s0 tclass=file Bug: 77725358 Test: build/boot Taimen Change-Id: Ic6234905e1694cab4bb8ef385f3dbe5455ef35b6 --- sepolicy/vendor/bug_map | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index f21b0fe6..25df9284 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -1 +1,2 @@ vendor_init unlabeled dir 77635294 +hal_imsrtp default_prop file 77725358 From 8424d3b945ebcc26b7019eb8769bd660fd3ad4fa Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Wed, 11 Apr 2018 14:57:58 -0700 Subject: [PATCH 245/300] hal_tetheroffload: move hwservice mapping to core policy Addresses: avc: denied { find } for interface=android.hardware.tetheroffload.config::IOffloadConfig scontext=u:r:system_server:s0 tcontext=u:object_r:default_android_hwservice:s0 tclass=hwservice_manager Bug: 77855688 Test: build/boot Sailfish, turn on tethering, no selinux denial Change-Id: I97cae0928b5311a4da41d19cbd5c863c3137a49f --- sepolicy/vendor/hwservice_contexts | 2 -- 1 file changed, 2 deletions(-) diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts index 50ab7748..1fc05615 100644 --- a/sepolicy/vendor/hwservice_contexts +++ b/sepolicy/vendor/hwservice_contexts @@ -4,8 +4,6 @@ com.qualcomm.qti.uceservice::IUceService u:object_r:hal_i vendor.qti.atcmdfwd::IAtCmdFwd u:object_r:vnd_atcmdfwd_hwservice:s0 vendor.qti.qcril.am::IQcRilAudio u:object_r:vnd_qcrilhook_hwservice:s0 com.qualcomm.qti.imsrtpservice::IRTPService u:object_r:hal_imsrtp_hwservice:s0 -android.hardware.tetheroffload.config::IOffloadConfig u:object_r:hal_tetheroffload_hwservice:s0 -android.hardware.tetheroffload.control::IOffloadControl u:object_r:hal_tetheroffload_hwservice:s0 com.quicinc.cne.api::IApiService u:object_r:hal_cne_hwservice:s0 com.quicinc.cne.server::IServer u:object_r:hal_cne_hwservice:s0 vendor.nxp.nxpnfc::INxpNfc u:object_r:nxpnfc_hwservice:s0 From 9f5e50beb77773e68fa1ef55f709ee6dd1b1d5bc Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 11 Apr 2018 18:47:36 -0700 Subject: [PATCH 246/300] sepolicy: Fix denial when dump powerhal Bug: 77919134 Test: Build Change-Id: Ie49fcc4593c48ad109be45fdce7949b3cd39eeed --- sepolicy/vendor/hal_power_default.te | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te index c5dfcc1f..1ec5f632 100644 --- a/sepolicy/vendor/hal_power_default.te +++ b/sepolicy/vendor/hal_power_default.te @@ -11,9 +11,8 @@ allow hal_power_default sysfs_msm_subsys:dir search; allow hal_power_default sysfs_msm_subsys:file rw_file_perms; allow hal_power_default sysfs_devices_system_cpu:file rw_file_perms; allow hal_power_default latency_device:chr_file rw_file_perms; +allow hal_power_default cgroup:dir search; +allow hal_power_default cgroup:file rw_file_perms; # To get/set powerhal state property set_prop(hal_power_default, power_prop) - -# To dump -allow hal_power_default cgroup:file read; From aa293f7fa90eff91af04bd0df517fbde86d919cd Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 12 Apr 2018 11:02:02 -0700 Subject: [PATCH 247/300] Suppress hal_wifi_default module loading denials. This suppresses the following denials: avc: denied { module_request } for comm="android.hardwar" kmod="netdev-wlan0" scontext=u:r:hal_wifi_default:s0 tcontext=u:r:kernel:s0 tclass=system avc: denied { sys_module } for comm="android.hardwar" capability=16 scontext=u:r:hal_wifi_default:s0 tcontext=u:r:hal_wifi_default:s0 tclass=capability Bug: 77973826 Test: Boot device. Change-Id: I2eb4789892172cb119f50084cfe9718d8ead647d (cherry picked from commit 82ee41e471025be3d4ce161f2b484481b583abde) --- sepolicy/vendor/hal_wifi_default.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sepolicy/vendor/hal_wifi_default.te b/sepolicy/vendor/hal_wifi_default.te index ca0e8c58..a0155584 100644 --- a/sepolicy/vendor/hal_wifi_default.te +++ b/sepolicy/vendor/hal_wifi_default.te @@ -11,6 +11,9 @@ allow hal_wifi_default wlan_device:chr_file w_file_perms; # Allow wifi hal to read debug info from the driver. r_dir_file(hal_wifi_default, proc_wifi_dbg) +dontaudit hal_wifi_default kernel:system module_request; +dontaudit hal_wifi_default self:capability sys_module; + userdebug_or_eng(` # debugfs entries are only needed in user-debug or eng builds From 659079a8620715434bd97842d9681014ded1a7da Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Thu, 12 Apr 2018 17:37:12 -0700 Subject: [PATCH 248/300] vendor_init permissions for unencrypted_data_file are now global So they can be removed from this device specific policy. Bug: 77850279 Test: walleye + more restrictions continues to have FBE work Change-Id: Ib77abd81ae886b40f5a078c379d352a53d865e31 --- sepolicy/vendor/vendor_init.te | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 549a668f..b5ea70bf 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -7,14 +7,9 @@ allow vendor_init { ramoops_data_file system_data_file tombstone_data_file - unencrypted_data_file wifi_data_file }:dir { create search getattr open read setattr ioctl write add_name remove_name rmdir relabelfrom }; -allow vendor_init { - unencrypted_data_file -}:file { create getattr open read write setattr relabelfrom unlink }; - allow vendor_init debugfs_clk:file w_file_perms; allow vendor_init proc_uid_cpupower:file write; dontaudit vendor_init kernel:system module_request; From 625265a03fd4559b6ea6b74ac1ec0bf1617fea13 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Mon, 26 Mar 2018 07:13:43 -0700 Subject: [PATCH 249/300] Advertise Vulkan 1.1 system feature Bug: 66875961 Test: atest VulkanFeaturesTest Change-Id: I58f904984320dee174637ba0ddfecdd343fab7e6 --- device.mk | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/device.mk b/device.mk index 877a97bf..391586db 100755 --- a/device.mk +++ b/device.mk @@ -170,7 +170,7 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.vr.high_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vr.high_performance.xml \ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \ frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ - frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ + frameworks/native/data/etc/android.hardware.vulkan.version-1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ frameworks/native/data/etc/android.hardware.telephony.carrierlock.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.carrierlock.xml \ # power HAL @@ -202,10 +202,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.opengles.version=196610 -# b/68017541 -PRODUCT_PROPERTY_OVERRIDES += \ - ro.qcom.adreno.qgl.ShaderStorageImageExtendedFormats=0 - # b/73640835 PRODUCT_PROPERTY_OVERRIDES += \ sdm.debug.rotator_downscale=1 From b19ca9ab95a59e31b3ceff64a03dee790ce432ea Mon Sep 17 00:00:00 2001 From: Jie Song Date: Thu, 12 Apr 2018 18:43:32 -0700 Subject: [PATCH 250/300] Namespace ssrdump properties with vendor prefix Bug: 77553553 Change-Id: I5d0f8204f5ab310846deeaf9e91d28fe50cc0ad9 --- sepolicy/vendor/hal_bluetooth_default.te | 2 +- sepolicy/vendor/property.te | 2 +- sepolicy/vendor/property_contexts | 2 +- sepolicy/vendor/ramdump_app.te | 2 +- sepolicy/vendor/ssr_detector.te | 2 +- sepolicy/vendor/subsystem_ramdump.te | 2 +- sepolicy/vendor/wcnss_filter.te | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sepolicy/vendor/hal_bluetooth_default.te b/sepolicy/vendor/hal_bluetooth_default.te index fa6ba605..d66f3764 100644 --- a/sepolicy/vendor/hal_bluetooth_default.te +++ b/sepolicy/vendor/hal_bluetooth_default.te @@ -15,7 +15,7 @@ userdebug_or_eng(` allow hal_bluetooth_default sysfs_timestamp_switch:file r_file_perms; r_dir_file(hal_bluetooth_default, debugfs_ipc) r_dir_file(hal_bluetooth_default, sysfs_diag) - set_prop(hal_bluetooth_default, ssr_prop) + set_prop(hal_bluetooth_default, vendor_ssr_prop) ') dontaudit hal_bluetooth_default diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index eeb2b6d9..0bfd2ee7 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -7,7 +7,7 @@ type vendor_ramdump_prop, property_type; type post_boot_prop, property_type; type public_vendor_default_prop, property_type; type public_vendor_system_prop, property_type; -type ssr_prop, property_type; +type vendor_ssr_prop, property_type; type cnss_diag_prop, property_type; type tee_listener_prop, property_type; type wc_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 121dd960..15c0dde8 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -12,7 +12,7 @@ radio. u:object_r:vendor_radio_prop:s0 rcs.publish.status u:object_r:vendor_radio_prop:s0 vendor.debug.ramdump. u:object_r:vendor_ramdump_prop:s0 persist.vendor.sys.crash_rcu u:object_r:vendor_ramdump_prop:s0 -debug.ssrdump u:object_r:ssr_prop:s0 +vendor.debug.ssrdump u:object_r:vendor_ssr_prop:s0 persist.sys.cnss. u:object_r:cnss_diag_prop:s0 sys.listeners.registered u:object_r:tee_listener_prop:s0 wc_transport. u:object_r:wc_prop:s0 diff --git a/sepolicy/vendor/ramdump_app.te b/sepolicy/vendor/ramdump_app.te index c3edcd55..ed9bf33b 100644 --- a/sepolicy/vendor/ramdump_app.te +++ b/sepolicy/vendor/ramdump_app.te @@ -10,5 +10,5 @@ userdebug_or_eng(` allow ramdump_app ramdump_vendor_data_file:dir create_dir_perms; set_prop(ramdump_app, vendor_ramdump_prop); - get_prop(system_app, ssr_prop) + get_prop(system_app, vendor_ssr_prop) ') diff --git a/sepolicy/vendor/ssr_detector.te b/sepolicy/vendor/ssr_detector.te index 9144b1ff..a5ffd3b3 100644 --- a/sepolicy/vendor/ssr_detector.te +++ b/sepolicy/vendor/ssr_detector.te @@ -6,7 +6,7 @@ app_domain(ssr_detector_app) userdebug_or_eng(` allow ssr_detector_app ramdump_vendor_data_file:dir r_dir_perms; allow ssr_detector_app ramdump_vendor_data_file:file r_file_perms; - get_prop(ssr_detector_app, ssr_prop) + get_prop(ssr_detector_app, vendor_ssr_prop) get_prop(ssr_detector_app, vendor_wifi_version) ') diff --git a/sepolicy/vendor/subsystem_ramdump.te b/sepolicy/vendor/subsystem_ramdump.te index 60a0a6d7..fada78ec 100644 --- a/sepolicy/vendor/subsystem_ramdump.te +++ b/sepolicy/vendor/subsystem_ramdump.te @@ -13,5 +13,5 @@ userdebug_or_eng(` allow subsystem_ramdump ramdump_vendor_data_file:dir rw_dir_perms; allow subsystem_ramdump ramdump_vendor_data_file:file create_file_perms; - set_prop(subsystem_ramdump, ssr_prop); + set_prop(subsystem_ramdump, vendor_ssr_prop); ') diff --git a/sepolicy/vendor/wcnss_filter.te b/sepolicy/vendor/wcnss_filter.te index 910fb0ea..98dfb00a 100644 --- a/sepolicy/vendor/wcnss_filter.te +++ b/sepolicy/vendor/wcnss_filter.te @@ -15,7 +15,7 @@ userdebug_or_eng(` allow wcnss_filter sysfs_timestamp_switch:file r_file_perms; r_dir_file(wcnss_filter, debugfs_ipc) r_dir_file(wcnss_filter, sysfs_diag) - set_prop(wcnss_filter, ssr_prop) + set_prop(wcnss_filter, vendor_ssr_prop) ') #allow wakelock From 4398397246896e27cdf350535133afee458702e1 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 12 Apr 2018 17:06:49 -0700 Subject: [PATCH 251/300] Allow some denials we have seen. This addresses the following denials: avc: denied { module_request } for comm="dnsmasq" kmod="netdev-bt-pan" scontext=u:r:dnsmasq:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0 avc: denied { module_request } for comm="allocator@2.0-s" kmod="crypto-heh(aes)" scontext=u:r:hal_graphics_allocator_default:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0 avc: denied { module_request } for comm="android.hardwar" kmod="crypto-hmac(sha256)" scontext=u:r:hal_graphics_composer_default:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0 avc: denied { sigkill } for comm="netmgrd" scontext=u:r:netmgrd:s0 tcontext=u:r:netutils_wrapper:s0 tclass=process permissive=0 avc: denied { sys_module } for comm="android.fg" capability=16 scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=capability permissive=0 avc: denied { search } for comm="cnss-daemon" name="net" dev="sysfs" scontext=u:r:wcnss_service:s0 tcontext=u:object_r:sysfs_net:s0 tclass=dir permissive=0 Bug: 78117980 Test: Build. Change-Id: I7e201147271a32ea8420406af221aa7678374d78 (cherry picked from commit cd761300c1cc67cb2be3e001b95317e8a865c5fe) --- sepolicy/vendor/dnsmasq.te | 1 + sepolicy/vendor/hal_graphics_allocator_default.te | 1 + sepolicy/vendor/hal_graphics_composer_default.te | 2 ++ sepolicy/vendor/netmgrd.te | 1 + sepolicy/vendor/system_server.te | 2 ++ sepolicy/vendor/wcnss_service.te | 2 ++ 6 files changed, 9 insertions(+) create mode 100644 sepolicy/vendor/dnsmasq.te create mode 100644 sepolicy/vendor/hal_graphics_allocator_default.te diff --git a/sepolicy/vendor/dnsmasq.te b/sepolicy/vendor/dnsmasq.te new file mode 100644 index 00000000..35f58fb6 --- /dev/null +++ b/sepolicy/vendor/dnsmasq.te @@ -0,0 +1 @@ +dontaudit dnsmasq kernel:system module_request; diff --git a/sepolicy/vendor/hal_graphics_allocator_default.te b/sepolicy/vendor/hal_graphics_allocator_default.te new file mode 100644 index 00000000..102fe8b3 --- /dev/null +++ b/sepolicy/vendor/hal_graphics_allocator_default.te @@ -0,0 +1 @@ +dontaudit hal_graphics_allocator_default kernel:system module_request; diff --git a/sepolicy/vendor/hal_graphics_composer_default.te b/sepolicy/vendor/hal_graphics_composer_default.te index d9cb26aa..42aa3935 100644 --- a/sepolicy/vendor/hal_graphics_composer_default.te +++ b/sepolicy/vendor/hal_graphics_composer_default.te @@ -34,3 +34,5 @@ userdebug_or_eng(` allow hal_graphics_composer_default diag_device:chr_file rw_file_perms; ') dontaudit hal_graphics_composer_default diag_device:chr_file rw_file_perms; + +dontaudit hal_graphics_composer_default kernel:system module_request; diff --git a/sepolicy/vendor/netmgrd.te b/sepolicy/vendor/netmgrd.te index 32fc7ec0..c2454527 100644 --- a/sepolicy/vendor/netmgrd.te +++ b/sepolicy/vendor/netmgrd.te @@ -35,6 +35,7 @@ wakelock_use(netmgrd) #Allow netutils usage domain_auto_trans(netmgrd, netutils_wrapper_exec, netutils_wrapper) +allow netmgrd netutils_wrapper:process sigkill; #Allow diag logging allow netmgrd sysfs_timestamp_switch:file { read open }; diff --git a/sepolicy/vendor/system_server.te b/sepolicy/vendor/system_server.te index d8a99b71..8e38725d 100644 --- a/sepolicy/vendor/system_server.te +++ b/sepolicy/vendor/system_server.te @@ -24,3 +24,5 @@ dontaudit system_server hal_audio_default:file write; dontaudit system_server appdomain:file write; set_prop(system_server, public_vendor_system_prop) + +dontaudit system_server self:capability sys_module; diff --git a/sepolicy/vendor/wcnss_service.te b/sepolicy/vendor/wcnss_service.te index db2d1292..a6f143c2 100644 --- a/sepolicy/vendor/wcnss_service.te +++ b/sepolicy/vendor/wcnss_service.te @@ -40,3 +40,5 @@ allow wcnss_service sysfs_soc:file r_file_perms; # request_firmware causes a denial for /firmware. It can be safely ignored dontaudit wcnss_service firmware_file:dir search; + +r_dir_file(wcnss_service, sysfs_net) From 267d8aeabf1cb1a841b7a03002797a0345e56a2a Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 16 Apr 2018 10:34:15 -0700 Subject: [PATCH 252/300] Add bug_map entries for bugs we've seen. This adds numerous bug_map entries to try to annotate all denials we've seen. Bug: 78117980 Test: Build Change-Id: I78923ebeb8837e09920941450d40504da3924022 (cherry picked from commit e97c886ed97b2474785642f9e8ac56be89e34d38) --- sepolicy/vendor/bug_map | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index 25df9284..05275a7b 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -1,2 +1,24 @@ -vendor_init unlabeled dir 77635294 +cnd vendor_shell_exec file 77922167 +drmserver app_data_file dir 77869200 +drmserver sdcardfs dir 77869200 +dumpstate sysfs file 77919159 +hal_audio_default default_prop file 77926553 +hal_audio_default priv_app fd 77926553 +hal_camera_default camera_vendor_data_file dir 77865891 +hal_camera_default debugfs dir 77865891 +hal_camera_default radio_prop file 77865891 hal_imsrtp default_prop file 77725358 +hal_neuralnetworks_hvx default_prop file 77916944 +hal_power_default cgroup file 77919134 +init_power init_power capability 77915310 +installd media_rw_data_file file 77926261 +netutils_wrapper oemfs dir 77871509 +netutils_wrapper sysfs_timestamp_switch file 77871509 +netutils_wrapper tmpfs dir 77871509 +netutils_wrapper vendor_app_file dir 77871509 +netutils_wrapper vendor_framework_file dir 77871509 +radio vendor_default_prop file 77915129 +rfs_access unlabeled file 78019660 +rild system_prop file 77960261 +thermal-engine thermal-engine capability 78019417 +vendor_init unlabeled dir 77635294 From 6c9343559862892699213e51ae87e9bf4695c98c Mon Sep 17 00:00:00 2001 From: Siddharth Ray Date: Mon, 16 Apr 2018 17:46:13 -0700 Subject: [PATCH 253/300] Increased GPS debug ag/3907575 reduces logging for "I". This change increases debug level to 3. BUG:70270197 Change-Id: If1c50e5823f563dfaeb3b394091b36eddceff104 --- gps.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gps.conf b/gps.conf index 4e8fffa7..54482b19 100644 --- a/gps.conf +++ b/gps.conf @@ -26,7 +26,7 @@ NTP_SERVER = time.google.com # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info # 4 - Debug, 5 - Verbose # If DEBUG_LEVEL is commented, Android's logging levels will be used -DEBUG_LEVEL = 2 +DEBUG_LEVEL = 3 # Intermediate position report, 1=enable, 0=disable INTERMEDIATE_POS=0 From 98e3e69245a067d6ccbd48631cb9f7d1fe088861 Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Mon, 16 Apr 2018 19:00:39 -0700 Subject: [PATCH 254/300] Give access persist.radio access Give persist.radio access to connectivity monitor Bug: 73953318 Test: verified that connectivy monitor works fine Change-Id: Idbcb87f45f809aa9fef00b8a6f2e191cf7e562f8 --- sepolicy/vendor/con_monitor.te | 2 +- sepolicy/vendor/property_contexts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te index 534cff00..dd760518 100644 --- a/sepolicy/vendor/con_monitor.te +++ b/sepolicy/vendor/con_monitor.te @@ -3,7 +3,7 @@ type con_monitor_app, domain; app_domain(con_monitor_app) -set_prop(con_monitor_app, tel_mon_prop) +set_prop(con_monitor_app, radio_prop) allow con_monitor_app app_api_service:service_manager find; allow con_monitor_app radio_vendor_data_file:dir rw_dir_perms; allow con_monitor_app radio_vendor_data_file:file create_file_perms; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 121dd960..6c1459e8 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -20,9 +20,6 @@ sys.qcom.thermalcfg u:object_r:thermal_prop:s0 ctl.vendor.thermal-engine u:object_r:thermal_prop:s0 persist.sys.modem.diag. u:object_r:modem_diag_prop:s0 sys.modem.diag. u:object_r:modem_diag_prop:s0 -persist.radio.enable_tel_mon u:object_r:tel_mon_prop:s0 -persist.radio.poweranomaly.start u:object_r:tel_mon_prop:s0 -persist.radio.lowpowermonitor.start u:object_r:tel_mon_prop:s0 sys.time.set u:object_r:sys_time_prop:s0 persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 From b2509f8bc5a103692099e1a60aa3d384b05a2fd1 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 16 Apr 2018 20:28:51 -0700 Subject: [PATCH 255/300] powerhint.json: change to use Value directly Bug: 77282526 Test: Boot Change-Id: I2d546baf7581a4f74c77448ab66bd41e73966105 --- powerhint.json | 210 ++++++++++++++++++++++++------------------------- 1 file changed, 105 insertions(+), 105 deletions(-) mode change 100755 => 100644 powerhint.json diff --git a/powerhint.json b/powerhint.json old mode 100755 new mode 100644 index 2c2b785e..f0789744 --- a/powerhint.json +++ b/powerhint.json @@ -140,314 +140,314 @@ { "PowerHint": "VIDEO_ENCODE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "1958400" }, { "PowerHint": "SUSTAINED_PERFORMANCE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 4, - "Duration": 0 + "Duration": 0, + "Value": "1267200" }, { "PowerHint": "SUSTAINED_PERFORMANCE", "Node": "CPULittleClusterMaxFreq", - "ValueIndex": 3, - "Duration": 0 + "Duration": 0, + "Value": "1248000" }, { "PowerHint": "SUSTAINED_PERFORMANCE", "Node": "GPUMaxFreq", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "342000000" }, { "PowerHint": "VR_MODE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 2, - "Duration": 0 + "Duration": 0, + "Value": "1574400" }, { "PowerHint": "VR_MODE", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "1574400" }, { "PowerHint": "VR_MODE", "Node": "CPULittleClusterMaxFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "1555200" }, { "PowerHint": "VR_MODE", "Node": "CPULittleClusterMinFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "1555200" }, { "PowerHint": "VR_MODE", "Node": "GPUMaxFreq", - "ValueIndex": 2, - "Duration": 0 + "Duration": 0, + "Value": "515000000" }, { "PowerHint": "VR_MODE", "Node": "GPUMinFreq", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "515000000" }, { "PowerHint": "VR_MODE", "Node": "GPUBusMinFreq", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "11863" }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 3, - "Duration": 0 + "Duration": 0, + "Value": "1344000" }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 3, - "Duration": 0 + "Duration": 0, + "Value": "1344000" }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "CPULittleClusterMaxFreq", - "ValueIndex": 2, - "Duration": 0 + "Duration": 0, + "Value": "1478400" }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "CPULittleClusterMinFreq", - "ValueIndex": 3, - "Duration": 0 + "Duration": 0, + "Value": "1478400" }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "GPUMaxFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "414000000" }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "GPUMinFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "414000000" }, { "PowerHint": "VR_SUSTAINED_PERFORMANCE", "Node": "GPUBusMinFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "7759" }, { "PowerHint": "INTERACTION", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 4, - "Duration": 0 + "Duration": 0, + "Value": "1132800" }, { "PowerHint": "INTERACTION", "Node": "CPULittleClusterMinFreq", - "ValueIndex": 4, - "Duration": 0 + "Duration": 0, + "Value": "1134000" }, { "PowerHint": "INTERACTION", "Node": "TASchedtuneBoost", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "50" }, { "PowerHint": "INTERACTION", "Node": "CPUBWHystTriggerCount", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "0" }, { "PowerHint": "INTERACTION", "Node": "CPUBWHystLength", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "0" }, { "PowerHint": "INTERACTION", "Node": "CPUBWHistMemory", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "0" }, { "PowerHint": "INTERACTION", "Node": "CPUBWMinFreq", - "ValueIndex": 1, - "Duration": 0 + "Duration": 0, + "Value": "5195" }, { "PowerHint": "LAUNCH", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "2457600" }, { "PowerHint": "LAUNCH", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "2457600" }, { "PowerHint": "LAUNCH", "Node": "CPULittleClusterMinFreq", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "1900800" }, { "PowerHint": "LAUNCH", "Node": "PMQoSCpuDmaLatency", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "44" }, { "PowerHint": "LAUNCH", "Node": "CPUBWHystTriggerCount", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "0" }, { "PowerHint": "LAUNCH", "Node": "CPUBWHystLength", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "0" }, { "PowerHint": "LAUNCH", "Node": "CPUBWHistMemory", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "0" }, { "PowerHint": "LAUNCH", "Node": "CPUBWMinFreq", - "ValueIndex": 0, - "Duration": 5000 + "Duration": 5000, + "Value": "13763" }, { "PowerHint": "CAMERA_LAUNCH", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "2457600" }, { "PowerHint": "CAMERA_LAUNCH", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "2457600" }, { "PowerHint": "CAMERA_LAUNCH", "Node": "CPULittleClusterMinFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "1900800" }, { "PowerHint": "CAMERA_LAUNCH", "Node": "PMQoSCpuDmaLatency", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "44" }, { "PowerHint": "CAMERA_STREAMING", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "2457600" }, { "PowerHint": "CAMERA_STREAMING", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "2457600" }, { "PowerHint": "CAMERA_STREAMING", "Node": "CPULittleClusterMinFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "1900800" }, { "PowerHint": "CAMERA_STREAMING", "Node": "PMQoSCpuDmaLatency", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "44" }, { "PowerHint": "CAMERA_SHOT", "Node": "CPUBigClusterMaxFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "2457600" }, { "PowerHint": "CAMERA_SHOT", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "2457600" }, { "PowerHint": "CAMERA_SHOT", "Node": "CPULittleClusterMinFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "1900800" }, { "PowerHint": "CAMERA_SHOT", "Node": "PMQoSCpuDmaLatency", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "44" }, { "PowerHint": "CAMERA_SHOT", "Node": "CPUBWHystTriggerCount", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "0" }, { "PowerHint": "CAMERA_SHOT", "Node": "CPUBWHystLength", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "0" }, { "PowerHint": "CAMERA_SHOT", "Node": "CPUBWHistMemory", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "0" }, { "PowerHint": "CAMERA_SHOT", "Node": "CPUBWMinFreq", - "ValueIndex": 0, - "Duration": 1000 + "Duration": 1000, + "Value": "13763" }, { "PowerHint": "AUDIO_STREAMING", "Node": "CPUBigClusterMinFreq", - "ValueIndex": 2, - "Duration": 2000 + "Duration": 2000, + "Value": "1420800" }, { "PowerHint": "AUDIO_STREAMING", "Node": "PMQoSCpuDmaLatency", - "ValueIndex": 0, - "Duration": 2000 + "Duration": 2000, + "Value": "44" }, { "PowerHint": "AUDIO_LOW_LATENCY", "Node": "PMQoSCpuDmaLatency", - "ValueIndex": 0, - "Duration": 0 + "Duration": 0, + "Value": "44" } ] -} +} \ No newline at end of file From 811d138338cdc049749487963e48abe55b0b6093 Mon Sep 17 00:00:00 2001 From: David Lin Date: Tue, 17 Apr 2018 10:29:18 -0700 Subject: [PATCH 256/300] haptics: Implement constant effect for heavy click This patch implements support for heavy click effect which has the following UX requirements: - 8 ms in square wave and full amplitude for Walleye - 12 ms in square wave and full amplitude for Taimen Bug: 77863933 Test: manual long press test Change-Id: Ibc30117fecb234a6b400123e5f18a7c100ae36cb Signed-off-by: David Lin --- sepolicy/vendor/property_contexts | 1 + vibrator/Vibrator.cpp | 16 +++++++++++++--- vibrator/Vibrator.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 6c1459e8..451d77db 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -164,6 +164,7 @@ ro.vendor.build.svn u:object_r:vendor_default_prop:s0 ro.vendor.extension_library u:object_r:vendor_default_prop:s0 ro.vibrator.hal.click.duration u:object_r:vendor_default_prop:s0 ro.vibrator.hal.tick.duration u:object_r:vendor_default_prop:s0 +ro.vibrator.hal.heavyclick.duration u:object_r:vendor_default_prop:s0 sdm. u:object_r:vendor_default_prop:s0 sys.disable_ext_animation u:object_r:vendor_default_prop:s0 sys.display.low_persistence_mode_brightness u:object_r:vendor_default_prop:s0 diff --git a/vibrator/Vibrator.cpp b/vibrator/Vibrator.cpp index 20ae48b0..96576848 100644 --- a/vibrator/Vibrator.cpp +++ b/vibrator/Vibrator.cpp @@ -42,18 +42,22 @@ static constexpr int8_t MIN_RTP_INPUT = 0; static constexpr char RTP_MODE[] = "rtp"; static constexpr char WAVEFORM_MODE[] = "waveform"; -// Use effect #1 in the waveform library +// Use effect #1 in the waveform library for CLICK effect static constexpr char WAVEFORM_CLICK_EFFECT_SEQ[] = "1 0"; static constexpr int32_t WAVEFORM_CLICK_EFFECT_MS = 6; -// Use effect #2 in the waveform library +// Use effect #2 in the waveform library for TICK effect static constexpr char WAVEFORM_TICK_EFFECT_SEQ[] = "2 0"; static constexpr int32_t WAVEFORM_TICK_EFFECT_MS = 2; -// Use effect #3 in the waveform library +// Use effect #3 in the waveform library for DOUBLE_CLICK effect static constexpr char WAVEFORM_DOUBLE_CLICK_EFFECT_SEQ[] = "3 0"; static constexpr uint32_t WAVEFORM_DOUBLE_CLICK_EFFECT_MS = 135; +// Use effect #4 in the waveform library for HEAVY_CLICK effect +static constexpr char WAVEFORM_HEAVY_CLICK_EFFECT_SEQ[] = "4 0"; +static constexpr uint32_t WAVEFORM_HEAVY_CLICK_EFFECT_MS = 8; + // Timeout threshold for selecting open or closed loop mode static constexpr int8_t LOOP_MODE_THRESHOLD_MS = 20; @@ -76,6 +80,8 @@ Vibrator::Vibrator(std::ofstream&& activate, std::ofstream&& duration, mClickDuration = property_get_int32("ro.vibrator.hal.click.duration", WAVEFORM_CLICK_EFFECT_MS); mTickDuration = property_get_int32("ro.vibrator.hal.tick.duration", WAVEFORM_TICK_EFFECT_MS); + mHeavyClickDuration = property_get_int32( + "ro.vibrator.hal.heavyclick.duration", WAVEFORM_HEAVY_CLICK_EFFECT_MS); // This enables effect #1 from the waveform library to be triggered by SLPI // while the AP is in suspend mode @@ -199,6 +205,10 @@ Return Vibrator::performEffect(Effect effect, EffectStrength strength, per mSequencer << WAVEFORM_TICK_EFFECT_SEQ << std::endl; timeMS = mTickDuration; break; + case Effect::HEAVY_CLICK: + mSequencer << WAVEFORM_HEAVY_CLICK_EFFECT_SEQ << std::endl; + timeMS = mHeavyClickDuration; + break; default: _hidl_cb(Status::UNSUPPORTED_OPERATION, 0); return Void(); diff --git a/vibrator/Vibrator.h b/vibrator/Vibrator.h index 2f0ed082..f9daf7cd 100644 --- a/vibrator/Vibrator.h +++ b/vibrator/Vibrator.h @@ -62,6 +62,7 @@ private: std::ofstream mLpTriggerEffect; int32_t mClickDuration; int32_t mTickDuration; + int32_t mHeavyClickDuration; }; } // namespace implementation } // namespace V1_2 From aa1b4ab5eeba9d40fcd73362adb0e745af9c4284 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Fri, 13 Apr 2018 16:37:21 -0700 Subject: [PATCH 257/300] Remove default VR brightness implementation in lights.c There already exists adjustable, default values in the java layer for this stuff so we will leverage that instead. Test: Ensure that going into VR mode still sets the value to correct default. Bug: 73090564 Change-Id: Id9929f074219fee74f93def5227e92ea9b6f55a0 --- liblight/lights.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/liblight/lights.c b/liblight/lights.c index c2de6d34..d5717488 100644 --- a/liblight/lights.c +++ b/liblight/lights.c @@ -39,8 +39,6 @@ #define LIGHTS_SUPPORT_BATTERY 0 #define CG_COLOR_ID_PROPERTY "ro.boot.hardware.color" -#define LP_MODE_BRIGHTNESS_PROPERTY "sys.display.low_persistence_mode_brightness" - static pthread_once_t g_init = PTHREAD_ONCE_INIT; static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; static struct light_state_t g_notification; @@ -196,12 +194,6 @@ set_light_backlight(struct light_device_t* dev, ALOGE("%s: Failed to write to %s: %s\n", __FUNCTION__, PERSISTENCE_FILE, strerror(errno)); } - if (lpEnabled != 0) { - // Try to get the brigntess though property, otherwise it will - // set the default brightness, which is defined in BoardConfig.mk. - brightness = property_get_int32(LP_MODE_BRIGHTNESS_PROPERTY, - DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS); - } } g_last_backlight_mode = state->brightnessMode; From bd8b3857d05fa0b098b4fc2a49bc27d9ba431e74 Mon Sep 17 00:00:00 2001 From: Tim Murray Date: Fri, 13 Apr 2018 11:04:57 -0700 Subject: [PATCH 258/300] wahoo: add restricted cpuset bug 78197570 Test: CTS Change-Id: I29b20c99500c009049a7d229a3325b299738385c --- init.hardware.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/init.hardware.rc b/init.hardware.rc index 385fd2eb..7aba1069 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -586,6 +586,7 @@ on property:sys.boot_completed=1 write /dev/cpuset/foreground/cpus 0-3,6-7 write /dev/cpuset/background/cpus 0-1 write /dev/cpuset/system-background/cpus 0-3 + write /dev/cpuset/restricted/cpus 0-3 # Update DVR cpusets to runtime values. write /dev/cpuset/kernel/cpus 2,3 From 8f67a323289e0762a6f0df7a446847476e3caf52 Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Wed, 18 Apr 2018 14:40:34 -0700 Subject: [PATCH 259/300] Update SVN to 11 for June Tmo Walleye/Taimen build Bug: 78240102 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 626091c5..c0ebfe95 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=10 + ro.vendor.build.svn=11 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From b296bbf7f09d5b73e5f14abcb1bd5b9668ac0074 Mon Sep 17 00:00:00 2001 From: Kelly Rossmoyer Date: Wed, 11 Apr 2018 01:00:05 -0700 Subject: [PATCH 260/300] Add temp workaround Easel power stats on 2017 While snapshot Easel power data is captured in bugreports via dumpstate, Easel does not provide low power stats on a recurring basis via PowerHAL, which is the type of data need to detect the presence and scope of power drain issues in the field. As a temporary workaround, this set of changes keeps cumulative counts of the number of times PowerHAL saw Easel's state (an existing sysfs node) as "on" (state 1) or "not on" (state 0 or 2), and logs the "on" count as cumulative count and the "not on" count as cumulative duration. This does not sufficiently address the long term need for cumulative stats, since this will just be comprised of essentially random snapshots of Easel's current state. However, for the known issue already being investigated, this should be enough to gauge the scope of the issue. sepolicy updates allow hal_power to search/read the directory/file containing Easel's current state: /sys/devices/virtual/misc/mnh_sm/state Bug: 77208137 Bug: 36576572 Test: Installed on taimen, used camera for various functions, used easel debug commands and properties to force it into different states, captured a bugreport and verified the content against observed "current state" values from monitoring the state file while performing similar camera functions. Change-Id: Ib1ee92db477d2a6c9d6f293fb4fcc2f753b8335a --- power-libperfmgr/Power.cpp | 101 ++++++++++++++++++++++----- power-libperfmgr/power-helper.c | 45 ++++++++++++ power-libperfmgr/power-helper.h | 2 + sepolicy/vendor/hal_power_default.te | 4 ++ 4 files changed, 134 insertions(+), 18 deletions(-) diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index 4c621d9d..c0fadac3 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include #include @@ -279,21 +281,21 @@ done: return Void(); } -static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) { - +static int get_wlan_low_power_stats(struct PowerStateSubsystem *subsystem) { uint64_t stats[WLAN_POWER_PARAMS_COUNT] = {0}; struct PowerStateSubsystemSleepState *state; - int ret; - ret = extract_wlan_stats(stats); - if (ret) - return ret; + subsystem->name = "wlan"; - subsystem.name = "wlan"; - subsystem.states.resize(WLAN_STATES_COUNT); + if (extract_wlan_stats(stats) != 0) { + subsystem->states.resize(0); + return -1; + } + + subsystem->states.resize(WLAN_STATES_COUNT); /* Update statistics for Active State */ - state = &subsystem.states[WLAN_STATE_ACTIVE]; + state = &subsystem->states[WLAN_STATE_ACTIVE]; state->name = "Active"; state->residencyInMsecSinceBoot = stats[CUMULATIVE_TOTAL_ON_TIME_MS]; state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER]; @@ -301,7 +303,7 @@ static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) { state->supportedOnlyInSuspend = false; /* Update statistics for Deep-Sleep state */ - state = &subsystem.states[WLAN_STATE_DEEP_SLEEP]; + state = &subsystem->states[WLAN_STATE_DEEP_SLEEP]; state->name = "Deep-Sleep"; state->residencyInMsecSinceBoot = stats[CUMULATIVE_SLEEP_TIME_MS]; state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER]; @@ -311,22 +313,85 @@ static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) { return 0; } +enum easel_state { + EASEL_OFF = 0, + EASEL_ON, + EASEL_SUSPENDED, + NUM_EASEL_STATES +}; + +// Get low power stats for easel subsystem +static int get_easel_low_power_stats(struct PowerStateSubsystem *subsystem) { + // This implementation is a workaround to provide minimal visibility into + // Easel state behavior until canonical low power stats are supported. + // It takes an "external observer" snapshot of the current Easel state every + // time it is called, and synthesizes an artificial sleep state that will + // behave similarly to real stats if Easel gets "wedged" in the "on" state. + static std::mutex statsLock; + static uint64_t totalOnSnapshotCount = 0; + static uint64_t totalNotOnSnapshotCount = 0; + unsigned long currentState; + struct PowerStateSubsystemSleepState *state; + + subsystem->name = "Easel"; + + if (get_easel_state(¤tState) != 0) { + subsystem->states.resize(0); + return -1; + } + + if (currentState >= NUM_EASEL_STATES) { + ALOGE("%s: unrecognized Easel state(%lu)", __func__, currentState); + return -1; + } + + subsystem->states.resize(1); + + // Since we are storing stats locally but can have multiple parallel + // callers, locking is required to ensure stats are not corrupted. + std::lock_guard lk(statsLock); + + // Update statistics for synthetic sleep state. We combine OFF and + // SUSPENDED to act as a composite "not on" state so the numbers will behave + // like a real sleep state. + if ((currentState == EASEL_OFF) || (currentState == EASEL_SUSPENDED)) { + totalNotOnSnapshotCount++; + } else { + totalOnSnapshotCount++; + } + + // Update statistics for synthetic sleep state, where + // totalTransitions = cumulative count of Easel state0 (as seen by PowerHAL) + // residencyInMsecsSinceBoot = cumulative count of Easel state1 (as seen by + // PowerHAL) + // lastEntryTimestampMs = cumulative count of Easel state2 (as seen by + // PowerHAL) + state = &subsystem->states[0]; + state->name = "SyntheticSleep"; + state->totalTransitions = totalOnSnapshotCount; + state->residencyInMsecSinceBoot = totalNotOnSnapshotCount; + state->lastEntryTimestampMs = 0; // No added value for the workaround + state->supportedOnlyInSuspend = false; + + return 0; +} + // Methods from ::android::hardware::power::V1_1::IPower follow. Return Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) { - hidl_vec subsystems; - int ret; subsystems.resize(SUBSYSTEM_COUNT); - //We currently have only one Subsystem for WLAN - ret = get_wlan_low_power_stats(subsystems[SUBSYSTEM_WLAN]); - if (ret != 0) - goto done; + // Get WLAN subsystem low power stats. + if (get_wlan_low_power_stats(&subsystems[SUBSYSTEM_WLAN]) != 0) { + ALOGE("%s: failed to process wlan stats", __func__); + } - //Add query for other subsystems here + // Get Easel subsystem low power stats. + if (get_easel_low_power_stats(&subsystems[SUBSYSTEM_EASEL]) != 0) { + ALOGE("%s: failed to process Easel stats", __func__); + } -done: _hidl_cb(subsystems, Status::SUCCESS); return Void(); } diff --git a/power-libperfmgr/power-helper.c b/power-libperfmgr/power-helper.c index e355710a..059e358c 100644 --- a/power-libperfmgr/power-helper.c +++ b/power-libperfmgr/power-helper.c @@ -51,6 +51,10 @@ #define WLAN_POWER_STAT "/d/wlan0/power_stats" #endif +#ifndef EASEL_STATE_FILE +#define EASEL_STATE_FILE "/sys/devices/virtual/misc/mnh_sm/state" +#endif + #define ARRAY_SIZE(x) (sizeof((x))/sizeof((x)[0])) #define LINE_SIZE 128 @@ -174,3 +178,44 @@ int extract_platform_stats(uint64_t *list) { int extract_wlan_stats(uint64_t *list) { return extract_stats(list, WLAN_POWER_STAT, wlan_stat_map, ARRAY_SIZE(wlan_stat_map)); } + +int get_easel_state(unsigned long *current_state) { + FILE *fp = NULL; + static const size_t EASEL_STATE_LINE_SIZE = 16; + char buffer[EASEL_STATE_LINE_SIZE]; + char *parse_end = buffer; + unsigned long state; + + if (current_state == NULL) { + ALOGD("%s: null current_state pointer from caller", __func__); + return -1; + } + + fp = fopen(EASEL_STATE_FILE, "re"); + if (fp == NULL) { + ALOGE("%s: failed to open: %s Error = %s", __func__, EASEL_STATE_FILE, + strerror(errno)); + return -errno; + } + + if (fgets(buffer, EASEL_STATE_LINE_SIZE, fp) == NULL) { + fclose(fp); + ALOGE("%s: failed to read: %s", __func__, EASEL_STATE_FILE); + return -1; + } + + fclose(fp); + + parse_end = buffer; + state = strtoul(buffer, &parse_end, 10); + if ((parse_end == buffer) || (state > 2)) { + ALOGE("%s: unrecognized format: %s '%s'", __func__, EASEL_STATE_FILE, + buffer); + return -1; + } + + *current_state = state; + + return 0; +} + diff --git a/power-libperfmgr/power-helper.h b/power-libperfmgr/power-helper.h index 60646464..0e12396b 100644 --- a/power-libperfmgr/power-helper.h +++ b/power-libperfmgr/power-helper.h @@ -53,6 +53,7 @@ enum stats_type { enum subsystem_type { SUBSYSTEM_WLAN = 0, + SUBSYSTEM_EASEL, //Don't add any lines after this line SUBSYSTEM_COUNT @@ -92,6 +93,7 @@ struct stat_pair { int extract_platform_stats(uint64_t *list); int extract_wlan_stats(uint64_t *list); +int get_easel_state(unsigned long *current_state); #ifdef __cplusplus } diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te index c5dfcc1f..cc12de1a 100644 --- a/sepolicy/vendor/hal_power_default.te +++ b/sepolicy/vendor/hal_power_default.te @@ -6,6 +6,10 @@ allow hal_power_default debugfs_rpm:file r_file_perms; allow hal_power_default debugfs_wlan:dir r_dir_perms; allow hal_power_default debugfs_wlan:file r_file_perms; +allow hal_power_default sysfs_easel:dir search; +allow hal_power_default sysfs_easel:file r_file_perms; + + # To do powerhint on nodes defined in powerhint.json allow hal_power_default sysfs_msm_subsys:dir search; allow hal_power_default sysfs_msm_subsys:file rw_file_perms; From 7c3e60f1fd7573220a980e26a81fd5cbd2819270 Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Wed, 18 Apr 2018 14:42:46 -0700 Subject: [PATCH 261/300] Update SVN to 12 for June RoW Walleye/Taimen build Bug:78240102 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index c0ebfe95..a200e0c0 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=11 + ro.vendor.build.svn=12 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 731a3272ad5c9b9087b0cca3b696b7b29aad55d1 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 23 Apr 2018 15:50:25 -0700 Subject: [PATCH 262/300] Handle radio diag-related denials. This allows the behavior on userdebug and eng builds and hides it on user builds. Bug: 77908806 Test: Build policy. Change-Id: I0d858a94bb1bab6069107209494536a62019788f (cherry picked from commit e7e22f5e8270b78c14700a77232044224426f278) --- sepolicy/vendor/radio.te | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index 0cb6607b..6a07eeb9 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -27,8 +27,10 @@ binder_call(radio, hal_imsrtp) userdebug_or_eng(` allow radio diag_device:chr_file rw_file_perms; + r_dir_file(radio, sysfs_diag) ') dontaudit radio diag_device:chr_file rw_file_perms; +dontaudit radio sysfs_diag:dir search; # read /proc/cmdline allow radio proc_cmdline:file r_file_perms; From 15730af3e909513fde27a80734d003dba705d1f8 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 5 Apr 2018 13:46:25 -0700 Subject: [PATCH 263/300] dumpstate: add interface into rc file Bug: 77489941 Test: Build Change-Id: I614014b31e1f5301a42bf85573f9f7495626ac33 --- dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc index bfd76177..4c024a0b 100644 --- a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc +++ b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc @@ -2,6 +2,7 @@ service vendor.dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-servi class hal user system group system + interface android.hardware.dumpstate@1.0::IDumpstateDevice default on boot chmod 0444 /sys/kernel/debug/tzdbg/qsee_log From 6c9599d865591172897c37c7c9f69650b8830e44 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Tue, 24 Apr 2018 10:17:17 -0700 Subject: [PATCH 264/300] Allow access to sysfs_timestamp_switch. We've seen these processes trying to access this file, so allow it. Note that this is likely why they needed the sysfs_diag permission we granted earlier. Bug: 77908806 Test: Build Change-Id: I60a2dae5a0635156070397242f13695678f1d00e (cherry picked from commit 2e41f0e3f09f8f7caedca37454d18fe0e8dd9891) --- sepolicy/vendor/hal_gnss_qti.te | 1 + sepolicy/vendor/qti.te | 1 + sepolicy/vendor/radio.te | 1 + 3 files changed, 3 insertions(+) diff --git a/sepolicy/vendor/hal_gnss_qti.te b/sepolicy/vendor/hal_gnss_qti.te index 2264399b..2729a96f 100644 --- a/sepolicy/vendor/hal_gnss_qti.te +++ b/sepolicy/vendor/hal_gnss_qti.te @@ -33,6 +33,7 @@ allow hal_gnss_qti self:netlink_route_socket { bind create nlmsg_read read write userdebug_or_eng(` allow hal_gnss_qti diag_device:chr_file rw_file_perms; r_dir_file(hal_gnss_qti, sysfs_diag) + allow hal_gnss_qti sysfs_timestamp_switch:file r_file_perms; ') dontaudit hal_gnss_qti diag_device:chr_file rw_file_perms; dontaudit hal_gnss_qti sysfs_diag:dir search; diff --git a/sepolicy/vendor/qti.te b/sepolicy/vendor/qti.te index be32d8c1..175db919 100644 --- a/sepolicy/vendor/qti.te +++ b/sepolicy/vendor/qti.te @@ -18,6 +18,7 @@ r_dir_file(qti, sysfs_msm_subsys) userdebug_or_eng(` allow qti diag_device:chr_file rw_file_perms; r_dir_file(qti, sysfs_diag) + allow qti sysfs_timestamp_switch:file r_file_perms; ') dontaudit qti diag_device:chr_file rw_file_perms; dontaudit qti sysfs_diag:dir search; diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index 6a07eeb9..0868a3d9 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -28,6 +28,7 @@ binder_call(radio, hal_imsrtp) userdebug_or_eng(` allow radio diag_device:chr_file rw_file_perms; r_dir_file(radio, sysfs_diag) + allow radio sysfs_timestamp_switch:file r_file_perms; ') dontaudit radio diag_device:chr_file rw_file_perms; dontaudit radio sysfs_diag:dir search; From accc78a8c016df8d864c4406bf50754fc628118c Mon Sep 17 00:00:00 2001 From: Stanley Tng Date: Thu, 19 Apr 2018 07:33:35 -0700 Subject: [PATCH 265/300] Disable Hearing Aid Profile for all platforms except Pixel Enable the Hearing Aid Profile for Taimen and Wally. Bug: 78142728 Test: Manual Pairing on various Pixel phones Change-Id: I1323387592bbedf69b4fc9185b121d616c96fd9e --- overlay/packages/apps/Bluetooth/res/values/config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/overlay/packages/apps/Bluetooth/res/values/config.xml b/overlay/packages/apps/Bluetooth/res/values/config.xml index 6db14c05..e4031055 100644 --- a/overlay/packages/apps/Bluetooth/res/values/config.xml +++ b/overlay/packages/apps/Bluetooth/res/values/config.xml @@ -29,4 +29,5 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> true + true From b4e0bb3e5af31e53c132a8cea89c61066a4db4b3 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 11 Apr 2018 14:25:11 -0700 Subject: [PATCH 266/300] Override config_availableColorModes List NATURAL, BOOSTED, and SATURATED. Bug: 73824924 Test: atest PtsConfigTestCases Change-Id: I5e57c4940b5fc32dc43684bb6e58b7af1097a4df --- overlay/frameworks/base/core/res/res/values/config.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 1440933a..5f42508a 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -66,6 +66,13 @@ true + + + 0 + 1 + 2 + + true From fb257f8c76c52bd51aa57d71f50f2228080396e6 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Wed, 25 Apr 2018 21:17:28 +0000 Subject: [PATCH 267/300] Revert "health HAL: overrides healthd." This reverts commit 6c41af4807fb8bb103ce0872f73384ceb5cb99eb. This is a partial revert; CleanSpec.mk is not reverted. Reason for revert: prevents boot with O-MR1 vendor + P system Test: boots Change-Id: Ib573f525da836f12201fd0f9793441a9fed31969 Fixes: 78550051 --- BoardConfig.mk | 3 --- health/Android.bp | 4 ---- 2 files changed, 7 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index bc4793c6..1ffacc2c 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -154,9 +154,6 @@ DEVICE_FRAMEWORK_MANIFEST_FILE := device/google/wahoo/framework_manifest.xml DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := device/google/wahoo/device_framework_matrix.xml BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true -# Remove health /backup instance -DEVICE_FRAMEWORK_MANIFEST_FILE += system/libhidl/vintfdata/manifest_healthd_exclude.xml - # Use mke2fs to create ext4 images TARGET_USES_MKE2FS := true diff --git a/health/Android.bp b/health/Android.bp index 6d9c2a85..ba241482 100644 --- a/health/Android.bp +++ b/health/Android.bp @@ -46,8 +46,4 @@ cc_binary { ], header_libs: ["libhealthd_headers"], - - overrides: [ - "healthd", - ], } From 2c67552cfddb01f78b909a3a9ffc79edc18da00a Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 26 Apr 2018 09:44:12 -0700 Subject: [PATCH 268/300] Hide denials caused by race with labeling. These denials seem to be caused by a race with the process that labels the files. Bug: 77635294 Test: Build policy. Change-Id: Ieed9c2be18a092e92ec90fc8a07fa17c8ec19308 --- sepolicy/vendor/bug_map | 1 - sepolicy/vendor/vendor_init.te | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index 05275a7b..3c1d0e5d 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -21,4 +21,3 @@ radio vendor_default_prop file 77915129 rfs_access unlabeled file 78019660 rild system_prop file 77960261 thermal-engine thermal-engine capability 78019417 -vendor_init unlabeled dir 77635294 diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 8ef4a118..ef333dbf 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -27,3 +27,6 @@ set_prop(vendor_init, public_vendor_default_prop) set_prop(vendor_init, vendor_radio_prop) set_prop(vendor_init, thermal_prop) set_prop(vendor_init, vendor_charge_prop) + +dontaudit vendor_init unlabeled:dir getattr; +dontaudit vendor_init unlabeled:file getattr; From 95156730279c22d156c52e1ac2eb784bacbe928e Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Mon, 23 Apr 2018 14:34:31 -0700 Subject: [PATCH 269/300] Add audio_source combinations to usb hal This allows android auto and accessory hid to both work, and matches functionality on other device in O. Bug: 74172000 Test: auto starts Change-Id: I786cd66bed015c5ad2a4ca668f0d0fbc9c8af507 --- usb/UsbGadget.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp index 56447458..603afbba 100644 --- a/usb/UsbGadget.cpp +++ b/usb/UsbGadget.cpp @@ -390,6 +390,27 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = setVidPid("0x18d1", "0x2d01"); break; + case static_cast(GadgetFunction::AUDIO_SOURCE): + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x2d02"); + break; + case GadgetFunction::ADB | GadgetFunction::AUDIO_SOURCE: + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x2d03"); + break; + case GadgetFunction::ACCESSORY | GadgetFunction::AUDIO_SOURCE: + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x2d04"); + break; + case GadgetFunction::ADB | GadgetFunction::ACCESSORY | + GadgetFunction::AUDIO_SOURCE: + if (!(vendorFunctions == "user" || vendorFunctions == "")) + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = setVidPid("0x18d1", "0x2d05"); + break; default: ALOGE("Combination not supported"); ret = Status::CONFIGURATION_NOT_SUPPORTED; @@ -453,6 +474,11 @@ V1_0::Status UsbGadget::setupFunctions( if (linkFunction("accessory.gs2", i++)) return Status::ERROR; } + if ((functions & GadgetFunction::AUDIO_SOURCE) != 0) { + ALOGI("setCurrentUsbFunctions Audio Source"); + if (linkFunction("audio_source.gs3", i++)) return Status::ERROR; + } + if ((functions & GadgetFunction::RNDIS) != 0) { ALOGI("setCurrentUsbFunctions rndis"); if (linkFunction("gsi.rndis", i++)) return Status::ERROR; From a9c681f94fa785c792b068fe958ecaea2b7ddc18 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Tue, 1 May 2018 18:07:51 -0700 Subject: [PATCH 270/300] Whitelist audio vendor property audio.usb.enable.debug is used to dump information of the audio usb device connected in the vendor implementation. Bug: 77926553 Test: atest VtsHalAudioV4_0TargetTest without sepolicy errors Signed-off-by: Kevin Rocard Change-Id: Ia36823fab7087c3dd77eade28fe14dc6805a1551 --- sepolicy/vendor/property_contexts | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 017b8b5b..a365f64a 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -61,6 +61,7 @@ audio_hal.period_multiplier u:object_r:vendor_default_prop:s0 audio_hal.period_size u:object_r:vendor_default_prop:s0 audio.adm. u:object_r:vendor_default_prop:s0 audio.snd_card.open.retries u:object_r:vendor_default_prop:s0 +audio.usb.enable.debug u:object_r:vendor_default_prop:s0 audio.volume.headset.gain.depcal u:object_r:vendor_default_prop:s0 audio.volume.listener.dump u:object_r:vendor_default_prop:s0 boost_override u:object_r:vendor_default_prop:s0 From e3c5c6ef310ab847a85a366fe2c16f8a87e92c03 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Tue, 1 May 2018 10:17:31 -0700 Subject: [PATCH 271/300] Try to fix thermal-engine dac_override denial. We saw a similar denial on Marlin where thermal_engine was trying to access /dev/diag. This ports that fix to Wahoo to try to fix its denial. Bug: 78019417 Test: Build policy. Change-Id: I3702e705ea4f99a58f4b96008d236d33ecd8045c (cherry picked from commit 200ded4ed8b53434236b7c50cba599c7f0b00ed9) --- init.hardware.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.hardware.rc b/init.hardware.rc index 7aba1069..fef62570 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -528,7 +528,7 @@ service vendor.perfd /vendor/bin/perfd service vendor.thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf} class hal user root - group root system + group root system diag socket thermal-send-client stream 0666 system system socket thermal-recv-client stream 0660 system system socket thermal-recv-passive-client stream 0666 system system From ef265d934ff8c77232fafbdae2172cf417178919 Mon Sep 17 00:00:00 2001 From: hsuvictor Date: Wed, 9 May 2018 19:21:40 +0800 Subject: [PATCH 272/300] p2p: enable VHT mode when operating as GO After disabling vendor driver override, supplicant needs to specify the max channel width and pass it to driver. Bug: 79236591 Test: manually check channel width is HT80 when operating as GO on walleye add p2p_go_vht=1, ch_width should be 80MHz Note: need HIDL wpas_p2p_connect argument fix Change-Id: I14d04556470c5efa66287f2327d7c6324885e822 --- p2p_supplicant_overlay.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/p2p_supplicant_overlay.conf b/p2p_supplicant_overlay.conf index b5e89e03..b8902bf9 100644 --- a/p2p_supplicant_overlay.conf +++ b/p2p_supplicant_overlay.conf @@ -1,2 +1,3 @@ disable_scan_offload=1 p2p_no_group_iface=1 +p2p_go_vht=1 From 4eb8b24b0708831ad4690931b6d41812b402bc9e Mon Sep 17 00:00:00 2001 From: Andrew Chant Date: Wed, 9 May 2018 11:23:09 -0700 Subject: [PATCH 273/300] Change USB autosuspend delay to 7s by commandline. b/71936484 has audio accessories failing to connect when there's a transition to suspend when they're attempting to enumerate. Avoid this problem by increasing autosuspend delay from the default 2s to 7s. The longest I've seen a device take to enumerate after vbus is ~3 seconds, this gives a 2x margin. Test: booted on Walleye, saw no more messages: [ 472.412555] c0 5675 msm-dwc3 a800000.ssusb: DWC3 in low power mode between device connection and enumeration. Bug: 71936484 Change-Id: Ic655f2ce6dec429510cc7c00452da4d49f2392b0 --- BoardConfig.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 1ffacc2c..fbf60e28 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -35,6 +35,7 @@ BOARD_KERNEL_CMDLINE += swiotlb=2048 BOARD_KERNEL_CMDLINE += firmware_class.path=/vendor/firmware BOARD_KERNEL_CMDLINE += loop.max_part=7 BOARD_KERNEL_CMDLINE += raid=noautodetect +BOARD_KERNEL_CMDLINE += usbcore.autosuspend=7 BOARD_KERNEL_BASE := 0x00000000 BOARD_KERNEL_PAGESIZE := 4096 From 977eefd71107c373f240df76e4c9f8d87f7bc624 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Thu, 10 May 2018 13:20:27 +0900 Subject: [PATCH 274/300] Move ro.adb.secure declaration into device/* (1/2) Bug: 79115842 Test: succeeded building and tested with taimen Change-Id: I963a68b1b53ca3412027b357e25fffd6391ef9ff --- device.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/device.mk b/device.mk index c065d8c4..2932820b 100755 --- a/device.mk +++ b/device.mk @@ -20,6 +20,9 @@ PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := true PRODUCT_PROPERTY_OVERRIDES += \ keyguard.no_require_sim=true +PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ + ro.adb.secure=1 + PRODUCT_COPY_FILES += \ device/google/wahoo/default-permissions.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default-permissions/default-permissions.xml \ frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \ From 04cfd2ae4fd50b4ea293508e658ff86113e8b20b Mon Sep 17 00:00:00 2001 From: Przemyslaw Szczepaniak Date: Thu, 10 May 2018 12:50:54 +0100 Subject: [PATCH 275/300] Disable hvx NN service for pi-dev Bug: 78249699 Test: manual, cts Change-Id: Ic0b7a8ab8e1ca854069544e35f5e4139d800c4f3 --- device.mk | 4 ---- manifest.xml | 9 --------- 2 files changed, 13 deletions(-) diff --git a/device.mk b/device.mk index c065d8c4..2790bdcc 100755 --- a/device.mk +++ b/device.mk @@ -349,10 +349,6 @@ PRODUCT_PACKAGES += \ android.hardware.drm@1.1-service.clearkey \ move_widevine_data.sh -# NeuralNetworks HAL -PRODUCT_PACKAGES += \ - android.hardware.neuralnetworks@1.0-service-hvx - # NFC packages PRODUCT_PACKAGES += \ NfcNci \ diff --git a/manifest.xml b/manifest.xml index cf2b763b..8a7986d8 100644 --- a/manifest.xml +++ b/manifest.xml @@ -209,15 +209,6 @@ default - - android.hardware.neuralnetworks - hwbinder - 1.0 - - IDevice - hvx - - android.hardware.nfc hwbinder From 2fa48ee4fec4aca518270f64a534b88e7d6eadb3 Mon Sep 17 00:00:00 2001 From: Jack Wu Date: Mon, 7 May 2018 11:57:40 +0800 Subject: [PATCH 276/300] battery learned capacity: backup/restore to/from persist data Test: - delete file /persist/battery/qcom_charge_full - adb logcat to check code flow related health@2.0 - adb bugreport - no "avc: denied" on health vendor service - check learned capacity in both /sys/class/power_supply/bms/charge_full /persist/battery/qcom_charge_full -- decrease /sys/class/power_supply/bms/charge_full to check backup to /persist/battery/qcom_charge_full -- increase /sys/class/power_supply/bms/charge_full to check restore from /persist/battery/qcom_charge_full (simluate the reset condition) Bug: 78883741 Change-Id: Ib17bc0938d3a4b78376140a8a1008b4fc82220af Signed-off-by: Jack Wu --- health/Android.bp | 1 + health/HealthService.cpp | 8 +- health/LearnedCapacityBackupRestore.cpp | 114 ++++++++++++++++++++++++ health/LearnedCapacityBackupRestore.h | 52 +++++++++++ init.hardware.rc | 5 ++ 5 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 health/LearnedCapacityBackupRestore.cpp create mode 100644 health/LearnedCapacityBackupRestore.h diff --git a/health/Android.bp b/health/Android.bp index ba241482..d78a7c04 100644 --- a/health/Android.bp +++ b/health/Android.bp @@ -21,6 +21,7 @@ cc_binary { srcs: [ "HealthService.cpp", "CycleCountBackupRestore.cpp", + "LearnedCapacityBackupRestore.cpp", ], cflags: [ diff --git a/health/HealthService.cpp b/health/HealthService.cpp index 45d18c30..677ca659 100644 --- a/health/HealthService.cpp +++ b/health/HealthService.cpp @@ -28,13 +28,16 @@ #include #include "CycleCountBackupRestore.h" +#include "LearnedCapacityBackupRestore.h" using android::hardware::health::V2_0::StorageInfo; using android::hardware::health::V2_0::DiskStats; using ::device::google::wahoo::health::CycleCountBackupRestore; +using ::device::google::wahoo::health::LearnedCapacityBackupRestore; static constexpr int kBackupTrigger = 20; static CycleCountBackupRestore ccBackupRestore; +static LearnedCapacityBackupRestore lcBackupRestore; int cycle_count_backup(int battery_level) { @@ -66,11 +69,14 @@ int cycle_count_backup(int battery_level) void healthd_board_init(struct healthd_config*) { ccBackupRestore.Restore(); + lcBackupRestore.Restore(); } int healthd_board_battery_update(struct android::BatteryProperties *props) { - return cycle_count_backup(props->batteryLevel); + cycle_count_backup(props->batteryLevel); + lcBackupRestore.Backup(); + return 0; } const char kUFSHealthFile[] = "/sys/kernel/debug/ufshcd0/dump_health_desc"; diff --git a/health/LearnedCapacityBackupRestore.cpp b/health/LearnedCapacityBackupRestore.cpp new file mode 100644 index 00000000..48fe4610 --- /dev/null +++ b/health/LearnedCapacityBackupRestore.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2018 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 "LearnedCapacityBackupRestore.h" + +namespace device { +namespace google { +namespace wahoo { +namespace health { + +static constexpr char kChgFullFile[] = "sys/class/power_supply/bms/charge_full"; +static constexpr char kSysCFPersistFile[] = "/persist/battery/qcom_charge_full"; +static constexpr int kBuffSize = 256; + +LearnedCapacityBackupRestore::LearnedCapacityBackupRestore() {} + +void LearnedCapacityBackupRestore::Restore() { + ReadFromStorage(); + ReadFromSRAM(); + UpdateAndSave(); +} + +void LearnedCapacityBackupRestore::Backup() { + ReadFromSRAM(); + UpdateAndSave(); +} + +void LearnedCapacityBackupRestore::ReadFromStorage() { + std::string buffer; + + if (!android::base::ReadFileToString(std::string(kSysCFPersistFile), &buffer)) { + LOG(ERROR) << "Cannot read the storage file"; + return; + } + + if (sscanf(buffer.c_str(), "%d", &sw_cap_) < 1) + LOG(ERROR) << "data format is wrong in the storage file: " << buffer; + else + LOG(INFO) << "Storage data: " << buffer; +} + +void LearnedCapacityBackupRestore::SaveToStorage() { + char strData[kBuffSize]; + + snprintf(strData, kBuffSize, "%d", sw_cap_); + + LOG(INFO) << "Save to Storage: " << strData; + + if (!android::base::WriteStringToFile(strData, std::string(kSysCFPersistFile))) + LOG(ERROR) << "Write file error: " << strerror(errno); +} + +void LearnedCapacityBackupRestore::ReadFromSRAM() { + std::string buffer; + + if (!android::base::ReadFileToString(std::string(kChgFullFile), &buffer)) { + LOG(ERROR) << "Read cycle counter error: " << strerror(errno); + return; + } + + buffer = android::base::Trim(buffer); + + if (sscanf(buffer.c_str(), "%d", &hw_cap_) < 1) + LOG(ERROR) << "Failed to parse SRAM bins: " << buffer; + else + LOG(INFO) << "SRAM data: " << buffer; +} + +void LearnedCapacityBackupRestore::SaveToSRAM() { + char strData[kBuffSize]; + + snprintf(strData, kBuffSize, "%d", hw_cap_); + + LOG(INFO) << "Save to SRAM: " << strData; + + if (!android::base::WriteStringToFile(strData, std::string(kChgFullFile))) + LOG(ERROR) << "Write data error: " << strerror(errno); +} + +void LearnedCapacityBackupRestore::UpdateAndSave() { + bool backup = false; + bool restore = false; + if (hw_cap_) { + if ((hw_cap_ < sw_cap_) || (sw_cap_ == 0)) { + sw_cap_ = hw_cap_; + backup = true; + } else if (hw_cap_ > sw_cap_) { + hw_cap_ = sw_cap_; + restore = true; + } + } + if (restore) + SaveToSRAM(); + if (backup) + SaveToStorage(); +} + +} // namespace health +} // namespace wahoo +} // namespace google +} // namespace device diff --git a/health/LearnedCapacityBackupRestore.h b/health/LearnedCapacityBackupRestore.h new file mode 100644 index 00000000..13d38e25 --- /dev/null +++ b/health/LearnedCapacityBackupRestore.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H +#define DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H + +#include +#include +#include +#include + +namespace device { +namespace google { +namespace wahoo { +namespace health { + +class LearnedCapacityBackupRestore { + public: + LearnedCapacityBackupRestore(); + void Restore(); + void Backup(); + + private: + int sw_cap_; + int hw_cap_; + + void ReadFromStorage(); + void SaveToStorage(); + void ReadFromSRAM(); + void SaveToSRAM(); + void UpdateAndSave(); +}; + +} // namespace health +} // namespace wahoo +} // namespace google +} // namespace device + +#endif // #ifndef DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H diff --git a/init.hardware.rc b/init.hardware.rc index fef62570..ed6eb202 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -437,6 +437,11 @@ on early-boot # HardwareInfo needs to be able to read CC bins chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins + # dumpstate needs to read, vendor.health-hal needs to be able to RW + chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full + # HardwareInfo needs to be able to read charge_full + chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full + on boot mkdir /dev/socket/qmux_radio 0770 radio radio chmod 2770 /dev/socket/qmux_radio From 28607db79b7495818f9f1ea7a65e9e6d4e77a283 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Fri, 11 May 2018 07:37:15 -0700 Subject: [PATCH 277/300] Track per_proxy SELinux denial. This should help fix presubmit tests. Bug: 79541095 Test: Built policy. Change-Id: Ide4401527cce5473288092a6c44fc446e9c1fc27 (cherry picked from commit 703a55c3a9b40c560e91c7bc3128f8949e48fa14) --- sepolicy/vendor/bug_map | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index 3c1d0e5d..0c866589 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -17,6 +17,7 @@ netutils_wrapper sysfs_timestamp_switch file 77871509 netutils_wrapper tmpfs dir 77871509 netutils_wrapper vendor_app_file dir 77871509 netutils_wrapper vendor_framework_file dir 77871509 +per_proxy exported3_system_prop file 79541095 radio vendor_default_prop file 77915129 rfs_access unlabeled file 78019660 rild system_prop file 77960261 From 84f819c57f94fe0cbad197750ec262cc8b671d4c Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Tue, 8 May 2018 16:47:20 -0700 Subject: [PATCH 278/300] wahoo: Update sepolicy for LA.UM.6.4.9.C2.07.00.00.386.031 Bug: 79426077 Test: CTS, PTS pending Change-Id: Ic5b7c473deec50a8e48c8db0130666093e5562b8 --- sepolicy/vendor/file_contexts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index f08778fe..c8141e48 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -220,7 +220,7 @@ # To test: run cts -m CtsRenderscriptTestCases /vendor/lib(64)?/libRSDriver_adreno\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/libCB\.so u:object_r:same_process_hal_file:s0 -/vendor/lib(64)?/libllvm-qgl\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libllvm-glnext\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/libbccQTI\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/libllvm-qcom\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/librs_adreno\.so u:object_r:same_process_hal_file:s0 @@ -231,9 +231,6 @@ # needed by radio /vendor/lib(64)?/libimsmedia_jni\.so u:object_r:same_process_hal_file:s0 -# libGLESv2_adreno depends on this -/vendor/lib(64)?/libllvm-glnext\.so u:object_r:same_process_hal_file:s0 - # Hexagon DSP host runtime and DSP-side executable needed for Halide operation /vendor/lib(64)?/libadsprpc\.so u:object_r:same_process_hal_file:s0 /vendor/lib/dsp/fastrpc_shell_0 u:object_r:hexagon_halide_file:s0 From 2f1fec3c6ffacda7fc033926d7d86abf01ea3ba2 Mon Sep 17 00:00:00 2001 From: Shawn Willden Date: Fri, 11 May 2018 16:50:09 -0600 Subject: [PATCH 279/300] Remove keymaster4 Wahoo devices don't have keymaster4 hardware, just a software implementation that was used for testing. Bug: 77307896 Test: Check that the KM4 binary and RC are no longer on the device Change-Id: I607937921c09bf24bb971bb7ef089aab2346debd --- CleanSpec.mk | 5 +++++ device.mk | 4 ---- manifest.xml | 9 --------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index fe253e4d..aa65532f 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -187,3 +187,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@ # Remove healthd $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/healthd) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/healthd.rc) + +# Remove android.hardware.keymaster@4.0-service +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.keymaster@4.0-service) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.keymaster@4.0-service.rc) + diff --git a/device.mk b/device.mk index 8cc5ffc9..59753cf3 100755 --- a/device.mk +++ b/device.mk @@ -188,10 +188,6 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ android.hardware.health@2.0-service.wahoo -# Keymaster 4 (software only) -PRODUCT_PACKAGES += \ - android.hardware.keymaster@4.0-service - # Audio fluence, ns, aec property, voice and media volume steps PRODUCT_PROPERTY_OVERRIDES += \ ro.qc.sdk.audio.fluencetype=fluencepro \ diff --git a/manifest.xml b/manifest.xml index 8a7986d8..a1a0322a 100644 --- a/manifest.xml +++ b/manifest.xml @@ -169,15 +169,6 @@ default - - android.hardware.keymaster - hwbinder - 4.0 - - IKeymasterDevice - default - - android.hardware.light hwbinder From 3550ada6f73c05e5527449f467e552141d661bb6 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 11 May 2018 20:13:27 -0700 Subject: [PATCH 280/300] wahoo: add bug_map for b/79617173 AU031 graphics drivers introduce SELinux denials for "vendor_default_prop". Pending a proper fix, tracking this bug so the new graphics driver can be merged. Test: Check that presubmit succeeds. Bug: 79426077 Change-Id: I775de870c6fae32f35acaa7017192ef12254dd7f --- sepolicy/vendor/bug_map | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index 0c866589..4f06e831 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -1,3 +1,4 @@ +bootanim vendor_default_prop file 79617173 cnd vendor_shell_exec file 77922167 drmserver app_data_file dir 77869200 drmserver sdcardfs dir 77869200 @@ -18,7 +19,12 @@ netutils_wrapper tmpfs dir 77871509 netutils_wrapper vendor_app_file dir 77871509 netutils_wrapper vendor_framework_file dir 77871509 per_proxy exported3_system_prop file 79541095 +priv_app vendor_default_prop file 79617173 +platform_app vendor_default_prop file 79617173 radio vendor_default_prop file 77915129 rfs_access unlabeled file 78019660 rild system_prop file 77960261 +surfaceflinger vendor_default_prop file 79617173 +system_app vendor_default_prop file 79617173 thermal-engine thermal-engine capability 78019417 +untrusted_app vendor_default_prop file 79617173 From 9cafa9a1914322c31fd6bb8a672b0650b1a64add Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Sat, 12 May 2018 09:05:43 -0700 Subject: [PATCH 281/300] Track nfc SELinux denial. This should help fix presubmit tests. Bug: 79617173 Test: Built policy. Change-Id: Ia6b55c7aa329366bde2390939883fb8f4770eff1 --- sepolicy/vendor/bug_map | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map index 4f06e831..a008919e 100644 --- a/sepolicy/vendor/bug_map +++ b/sepolicy/vendor/bug_map @@ -18,6 +18,7 @@ netutils_wrapper sysfs_timestamp_switch file 77871509 netutils_wrapper tmpfs dir 77871509 netutils_wrapper vendor_app_file dir 77871509 netutils_wrapper vendor_framework_file dir 77871509 +nfc vendor_default_prop file 79617173 per_proxy exported3_system_prop file 79541095 priv_app vendor_default_prop file 79617173 platform_app vendor_default_prop file 79617173 From 4d865e6af86a2ee98be7063aaa28dd3b6c238068 Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Fri, 11 May 2018 18:15:54 +0900 Subject: [PATCH 282/300] Remove PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE for test Setting PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE to true blocks System-only-OTA from OMR1 devices because it does not allow some propertis set by the OMR1 vendor partition. Only if we include the VNDK snapshot v27 to wahoo devices, remove PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE from wahoo as well as ag/3694012 for rild. Bug: 74505580 Test: Check if Bluetooth could be turned on in P-OMR1 walleye device. Change-Id: I5113988b10f0cdde394ed2fc31ebc9d1ea811e1c --- device.mk | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 3ab33df0..83da9889 100755 --- a/device.mk +++ b/device.mk @@ -14,7 +14,13 @@ # limitations under the License. # +ifneq (,$(filter 27, $(PRODUCT_EXTRA_VNDK_VERSIONS))) + _vndk_test := true +endif + +ifeq (,$(_vndk_test)) PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true +endif PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := true PRODUCT_PROPERTY_OVERRIDES += \ @@ -236,8 +242,15 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.radio.sib16_support=1 \ persist.radio.data_con_rprt=true \ persist.radio.always_send_plmn=false\ - persist.rcs.supported=1 \ + persist.rcs.supported=1 + +ifeq (,$(_vndk_test)) +PRODUCT_PROPERTY_OVERRIDES += \ vendor.rild.libpath=/vendor/lib64/libril-qc-qmi-1.so +else +PRODUCT_PROPERTY_OVERRIDES += \ + rild.libpath=/vendor/lib64/libril-qc-qmi-1.so +endif # Disable snapshot timer PRODUCT_PROPERTY_OVERRIDES += \ From 8e5694d2c07e603214c43a04eaa77738fcca0b59 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 14 May 2018 15:07:08 -0700 Subject: [PATCH 283/300] Remove perfd We have moved to new PowerHAL implementation. Test: build and boot Bug: 62041945 Change-Id: If8deaf131ccc829653932c8d3310b4c2ecd4a7ac --- init.hardware.rc | 7 - init.power.sh | 3 - power/Android.mk | 60 --- power/InteractionHandler.cpp | 257 ---------- power/InteractionHandler.h | 67 --- power/Power.cpp | 233 --------- power/Power.h | 71 --- ...ndroid.hardware.power@1.2-service.wahoo.rc | 4 - power/hint-data.c | 49 -- power/hint-data.h | 55 --- power/list.c | 145 ------ power/list.h | 41 -- power/metadata-defs.h | 54 --- power/metadata-parser.c | 126 ----- power/performance.h | 264 ---------- power/power-8998.c | 372 --------------- power/power-common.h | 55 --- power/power-helper.c | 450 ------------------ power/power-helper.h | 115 ----- power/powerhintparser.c | 174 ------- power/powerhintparser.h | 57 --- power/service.cpp | 67 --- power/utils.c | 327 ------------- power/utils.h | 62 --- 24 files changed, 3115 deletions(-) delete mode 100644 power/Android.mk delete mode 100644 power/InteractionHandler.cpp delete mode 100644 power/InteractionHandler.h delete mode 100644 power/Power.cpp delete mode 100644 power/Power.h delete mode 100644 power/android.hardware.power@1.2-service.wahoo.rc delete mode 100644 power/hint-data.c delete mode 100644 power/hint-data.h delete mode 100644 power/list.c delete mode 100644 power/list.h delete mode 100644 power/metadata-defs.h delete mode 100644 power/metadata-parser.c delete mode 100755 power/performance.h delete mode 100644 power/power-8998.c delete mode 100644 power/power-common.h delete mode 100644 power/power-helper.c delete mode 100644 power/power-helper.h delete mode 100644 power/powerhintparser.c delete mode 100644 power/powerhintparser.h delete mode 100644 power/service.cpp delete mode 100644 power/utils.c delete mode 100644 power/utils.h diff --git a/init.hardware.rc b/init.hardware.rc index ed6eb202..11755f1a 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -523,13 +523,6 @@ on property:init.svc.zygote=running on property:init.svc.zygote=stopped stop vendor.folio_daemon -service vendor.perfd /vendor/bin/perfd - class main - user root - group root readproc system - socket perfd seqpacket 0666 root system - disabled - service vendor.thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf} class hal user root diff --git a/init.power.sh b/init.power.sh index 949eae70..586608d0 100755 --- a/init.power.sh +++ b/init.power.sh @@ -41,9 +41,6 @@ write /sys/class/devfreq/soc:qcom,mincpubw/governor "cpufreq" # write $memlat/mem_latency/ratio_ceil 400 #done -# Signal perfd that boot has completed -setprop sys.post_boot.parsed 1 - # On debuggable builds, enable console_suspend if uart is enabled to save power # Otherwise, disable console_suspend to get better logging for kernel crashes if [[ $(getprop ro.debuggable) == "1" && ! -e /sys/class/tty/ttyMSM0 ]] diff --git a/power/Android.mk b/power/Android.mk deleted file mode 100644 index 2d935abf..00000000 --- a/power/Android.mk +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_MODULE_OWNER := qcom -LOCAL_MODULE_TAGS := optional - -LOCAL_MODULE := android.hardware.power@1.2-service.wahoo -LOCAL_INIT_RC := android.hardware.power@1.2-service.wahoo.rc -LOCAL_SRC_FILES := service.cpp \ - Power.cpp \ - InteractionHandler.cpp \ - power-helper.c \ - metadata-parser.c \ - utils.c \ - list.c \ - hint-data.c \ - powerhintparser.c - -LOCAL_C_INCLUDES := external/libxml2/include \ - external/icu/icu4c/source/common - -# Include target-specific files. -LOCAL_SRC_FILES += power-8998.c - - -# Enable interaction boost all the time -LOCAL_CFLAGS += -DINTERACTION_BOOST -Werror - -LOCAL_SHARED_LIBRARIES := \ - libbase \ - liblog \ - libcutils \ - libdl \ - libxml2 \ - libhidlbase \ - libhidltransport \ - libhardware \ - libutils \ - android.hardware.power@1.0 \ - android.hardware.power@1.1 \ - android.hardware.power@1.2 \ - -include $(BUILD_EXECUTABLE) diff --git a/power/InteractionHandler.cpp b/power/InteractionHandler.cpp deleted file mode 100644 index ca142a92..00000000 --- a/power/InteractionHandler.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -//#define LOG_NDEBUG 0 - -#define LOG_TAG "PowerInteractionHandler" -#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL) - -#include -#include -#include -#include -#include -#include -#include - -#include "InteractionHandler.h" -#include "power-common.h" -#include "power-helper.h" -#include "powerhintparser.h" -#include "hint-data.h" -#include "utils.h" - -#define FB_IDLE_PATH "/sys/class/graphics/fb0/idle_state" -#define MAX_LENGTH 64 - -#define MSINSEC 1000L -#define USINMS 1000000L - -InteractionHandler::InteractionHandler() - : mState(INTERACTION_STATE_UNINITIALIZED), - mWaitMs(100), - mMinDurationMs(1400), - mMaxDurationMs(5650), - mDurationMs(0), - mHandle(0) { -} - -InteractionHandler::~InteractionHandler() { - Exit(); -} - -bool InteractionHandler::Init() { - std::lock_guard lk(mLock); - - if (mState != INTERACTION_STATE_UNINITIALIZED) - return true; - - mIdleFd = open(FB_IDLE_PATH, O_RDONLY); - if (mIdleFd < 0) { - ALOGE("Unable to open idle state path (%d)", errno); - return false; - } - - mEventFd = eventfd(0, EFD_NONBLOCK); - if (mEventFd < 0) { - ALOGE("Unable to create event fd (%d)", errno); - close(mIdleFd); - return false; - } - - mState = INTERACTION_STATE_IDLE; - mThread = std::unique_ptr( - new std::thread(&InteractionHandler::Routine, this)); - - return true; -} - -void InteractionHandler::Exit() { - std::unique_lock lk(mLock); - if (mState == INTERACTION_STATE_UNINITIALIZED) - return; - - AbortWaitLocked(); - mState = INTERACTION_STATE_UNINITIALIZED; - lk.unlock(); - - mCond.notify_all(); - mThread->join(); - - close(mEventFd); - close(mIdleFd); -} - -void InteractionHandler::PerfLock() { - int *resource_values; - int num_resources; - - resource_values = getPowerhint(INTERACTION_HINT_ID, &num_resources); - if (resource_values != NULL) { - ALOGV("%s: acquiring perf lock", __func__); - mHandle = interaction_with_handle(mHandle, 0, num_resources, resource_values); - ATRACE_INT("interaction_lock", 1); - } -} - -void InteractionHandler::PerfRel() { - ALOGV("%s: releasing perf lock", __func__); - release_request(mHandle); - ATRACE_INT("interaction_lock", 0); -} - -long long InteractionHandler::CalcTimespecDiffMs(struct timespec start, - struct timespec end) { - long long diff_in_us = 0; - diff_in_us += (end.tv_sec - start.tv_sec) * MSINSEC; - diff_in_us += (end.tv_nsec - start.tv_nsec) / USINMS; - return diff_in_us; -} - -void InteractionHandler::Acquire(int32_t duration) { - if (is_perf_hint_active(SUSTAINED_PERF_HINT_ID) || - is_perf_hint_active(VR_MODE_HINT_ID)) { - ALOGV("%s: ignoring due to other active perf hints", __func__); - return; - } - - ATRACE_CALL(); - - std::lock_guard lk(mLock); - if (mState == INTERACTION_STATE_UNINITIALIZED) { - ALOGW("%s: called while uninitialized", __func__); - return; - } - - int inputDuration = duration + 650; - int finalDuration; - if (inputDuration > mMaxDurationMs) - finalDuration = mMaxDurationMs; - else if (inputDuration > mMinDurationMs) - finalDuration = inputDuration; - else - finalDuration = mMinDurationMs; - - struct timespec cur_timespec; - clock_gettime(CLOCK_MONOTONIC, &cur_timespec); - if (mState != INTERACTION_STATE_IDLE && finalDuration <= mDurationMs) { - long long elapsed_time = CalcTimespecDiffMs(mLastTimespec, cur_timespec); - // don't hint if previous hint's duration covers this hint's duration - if (elapsed_time <= (mDurationMs - finalDuration)) { - ALOGV("%s: Previous duration (%d) cover this (%d) elapsed: %lld", - __func__, mDurationMs, finalDuration, elapsed_time); - return; - } - } - mLastTimespec = cur_timespec; - mDurationMs = finalDuration; - - ALOGV("%s: input: %d final duration: %d", __func__, - duration, finalDuration); - - if (mState == INTERACTION_STATE_WAITING) - AbortWaitLocked(); - else if (mState == INTERACTION_STATE_IDLE) - PerfLock(); - - mState = INTERACTION_STATE_INTERACTION; - mCond.notify_one(); -} - -void InteractionHandler::Release() { - std::lock_guard lk(mLock); - if (mState == INTERACTION_STATE_WAITING) { - ATRACE_CALL(); - PerfRel(); - mState = INTERACTION_STATE_IDLE; - } else { - // clear any wait aborts pending in event fd - uint64_t val; - ssize_t ret = read(mEventFd, &val, sizeof(val)); - - ALOGW_IF(ret < 0, "%s: failed to clear eventfd (%zd, %d)", - __func__, ret, errno); - } -} - -// should be called while locked -void InteractionHandler::AbortWaitLocked() { - uint64_t val = 1; - ssize_t ret = write(mEventFd, &val, sizeof(val)); - if (ret != sizeof(val)) - ALOGW("Unable to write to event fd (%zd)", ret); -} - -void InteractionHandler::WaitForIdle(int32_t wait_ms, int32_t timeout_ms) { - char data[MAX_LENGTH]; - ssize_t ret; - struct pollfd pfd[2]; - - ATRACE_CALL(); - - ALOGV("%s: wait:%d timeout:%d", __func__, wait_ms, timeout_ms); - - pfd[0].fd = mEventFd; - pfd[0].events = POLLIN; - pfd[1].fd = mIdleFd; - pfd[1].events = POLLPRI | POLLERR; - - ret = poll(pfd, 1, wait_ms); - if (ret > 0) { - ALOGV("%s: wait aborted", __func__); - return; - } else if (ret < 0) { - ALOGE("%s: error in poll while waiting", __func__); - return; - } - - ret = pread(mIdleFd, data, sizeof(data), 0); - if (!ret) { - ALOGE("%s: Unexpected EOF!", __func__); - return; - } - - if (!strncmp(data, "idle", 4)) { - ALOGV("%s: already idle", __func__); - return; - } - - ret = poll(pfd, 2, timeout_ms); - if (ret < 0) - ALOGE("%s: Error on waiting for idle (%zd)", __func__, ret); - else if (ret == 0) - ALOGV("%s: timed out waiting for idle", __func__); - else if (pfd[0].revents) - ALOGV("%s: wait for idle aborted", __func__); - else if (pfd[1].revents) - ALOGV("%s: idle detected", __func__); -} - -void InteractionHandler::Routine() { - std::unique_lock lk(mLock, std::defer_lock); - - while (true) { - lk.lock(); - mCond.wait(lk, [&] { return mState != INTERACTION_STATE_IDLE; }); - if (mState == INTERACTION_STATE_UNINITIALIZED) - return; - mState = INTERACTION_STATE_WAITING; - lk.unlock(); - - WaitForIdle(mWaitMs, mDurationMs); - Release(); - } -} diff --git a/power/InteractionHandler.h b/power/InteractionHandler.h deleted file mode 100644 index a7f14f3f..00000000 --- a/power/InteractionHandler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INTERACTIONHANDLER_H -#define INTERACTIONHANDLER_H - -#include -#include -#include - -enum interaction_state { - INTERACTION_STATE_UNINITIALIZED, - INTERACTION_STATE_IDLE, - INTERACTION_STATE_INTERACTION, - INTERACTION_STATE_WAITING, -}; - -struct InteractionHandler { - InteractionHandler(); - ~InteractionHandler(); - bool Init(); - void Exit(); - void Acquire(int32_t duration); - - private: - void Release(); - void WaitForIdle(int32_t wait_ms, int32_t timeout_ms); - void AbortWaitLocked(); - void Routine(); - - void PerfLock(); - void PerfRel(); - - long long CalcTimespecDiffMs(struct timespec start, struct timespec end); - - enum interaction_state mState; - - int mIdleFd; - int mEventFd; - - int32_t mWaitMs; - int32_t mMinDurationMs; - int32_t mMaxDurationMs; - int32_t mDurationMs; - - struct timespec mLastTimespec; - - std::unique_ptr mThread; - std::mutex mLock; - std::condition_variable mCond; - int mHandle; -}; - -#endif //INTERACTIONHANDLER_H diff --git a/power/Power.cpp b/power/Power.cpp deleted file mode 100644 index 700663a5..00000000 --- a/power/Power.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "android.hardware.power@1.2-service.wahoo" - -#include -#include -#include -#include -#include -#include "Power.h" -#include "power-common.h" -#include "power-helper.h" - -/* RPM runs at 19.2Mhz. Divide by 19200 for msec */ -#define RPM_CLK 19200 - -extern struct stat_pair rpm_stat_map[]; - -namespace android { -namespace hardware { -namespace power { -namespace V1_2 { -namespace implementation { - -using ::android::hardware::power::V1_0::Feature; -using ::android::hardware::power::V1_0::PowerStatePlatformSleepState; -using ::android::hardware::power::V1_0::Status; -using ::android::hardware::power::V1_1::PowerStateSubsystem; -using ::android::hardware::power::V1_1::PowerStateSubsystemSleepState; -using ::android::hardware::hidl_vec; -using ::android::hardware::Return; -using ::android::hardware::Void; - -Power::Power() { - power_init(); - mInteractionHandler.Init(); -} - -// Methods from ::android::hardware::power::V1_0::IPower follow. -Return Power::setInteractive(bool interactive) { - if (!isSupportedGovernor()) { - return Void(); - } - power_set_interactive(interactive ? 1 : 0); - return Void(); -} - -Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { - if (android::base::GetProperty("init.svc.vendor.perfd", "") != "running") { - LOG(WARNING) << "perfd is not started"; - return Void(); - } - - power_hint_t h = static_cast(hint); - if (!isSupportedGovernor()) { - return Void(); - } - if (h == POWER_HINT_INTERACTION) { - mInteractionHandler.Acquire(data); - return Void(); - } - power_hint(h, data ? &data : NULL); - return Void(); -} - -Return Power::setFeature(Feature /*feature*/, bool /*activate*/) { - //Nothing to do - return Void(); -} - -Return Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) { - - hidl_vec states; - uint64_t stats[MAX_PLATFORM_STATS * MAX_RPM_PARAMS] = {0}; - uint64_t *values; - struct PowerStatePlatformSleepState *state; - int ret; - - states.resize(PLATFORM_SLEEP_MODES_COUNT); - - ret = extract_platform_stats(stats); - if (ret != 0) { - states.resize(0); - goto done; - } - - /* Update statistics for XO_shutdown */ - state = &states[RPM_MODE_XO]; - state->name = "XO_shutdown"; - values = stats + (RPM_MODE_XO * MAX_RPM_PARAMS); - - state->residencyInMsecSinceBoot = values[1]; - state->totalTransitions = values[0]; - state->supportedOnlyInSuspend = false; - state->voters.resize(XO_VOTERS); - for(size_t i = 0; i < XO_VOTERS; i++) { - int voter = static_cast(i + XO_VOTERS_START); - state->voters[i].name = rpm_stat_map[voter].label; - values = stats + (voter * MAX_RPM_PARAMS); - state->voters[i].totalTimeInMsecVotedForSinceBoot = values[0] / RPM_CLK; - state->voters[i].totalNumberOfTimesVotedSinceBoot = values[1]; - } - - /* Update statistics for VMIN state */ - state = &states[RPM_MODE_VMIN]; - state->name = "VMIN"; - values = stats + (RPM_MODE_VMIN * MAX_RPM_PARAMS); - - state->residencyInMsecSinceBoot = values[1]; - state->totalTransitions = values[0]; - state->supportedOnlyInSuspend = false; - state->voters.resize(VMIN_VOTERS); - //Note: No filling of state voters since VMIN_VOTERS = 0 - -done: - _hidl_cb(states, Status::SUCCESS); - return Void(); -} - -static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) { - - uint64_t stats[WLAN_POWER_PARAMS_COUNT] = {0}; - struct PowerStateSubsystemSleepState *state; - int ret; - - ret = extract_wlan_stats(stats); - if (ret) - return ret; - - subsystem.name = "wlan"; - subsystem.states.resize(WLAN_STATES_COUNT); - - /* Update statistics for Active State */ - state = &subsystem.states[WLAN_STATE_ACTIVE]; - state->name = "Active"; - state->residencyInMsecSinceBoot = stats[CUMULATIVE_TOTAL_ON_TIME_MS]; - state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER]; - state->lastEntryTimestampMs = 0; //FIXME need a new value from Qcom - state->supportedOnlyInSuspend = false; - - /* Update statistics for Deep-Sleep state */ - state = &subsystem.states[WLAN_STATE_DEEP_SLEEP]; - state->name = "Deep-Sleep"; - state->residencyInMsecSinceBoot = stats[CUMULATIVE_SLEEP_TIME_MS]; - state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER]; - state->lastEntryTimestampMs = stats[LAST_DEEP_SLEEP_ENTER_TSTAMP_MS]; - state->supportedOnlyInSuspend = false; - - return 0; -} - -// Methods from ::android::hardware::power::V1_1::IPower follow. -Return Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) { - - hidl_vec subsystems; - int ret; - - subsystems.resize(SUBSYSTEM_COUNT); - - //We currently have only one Subsystem for WLAN - ret = get_wlan_low_power_stats(subsystems[SUBSYSTEM_WLAN]); - if (ret != 0) - goto done; - - //Add query for other subsystems here - -done: - _hidl_cb(subsystems, Status::SUCCESS); - return Void(); -} - -bool Power::isSupportedGovernor() { - std::string buf; - if (android::base::ReadFileToString(SCALING_GOVERNOR_PATH, &buf)) { - buf = android::base::Trim(buf); - } - // Only support EAS 1.2, legacy EAS and HMP - if (buf == SCHEDUTIL_GOVERNOR || buf == SCHED_GOVERNOR || buf == INTERACTIVE_GOVERNOR) { - return true; - } else { - LOG(ERROR) << "Governor not supported by powerHAL, skipping"; - return false; - } -} - -Return Power::powerHintAsync(PowerHint_1_0 hint, int32_t data) { - // just call the normal power hint in this oneway function - return powerHint(hint, data); -} - -// Methods from ::android::hardware::power::V1_2::IPower follow. -Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { - switch(hint) { - case PowerHint_1_2::AUDIO_LOW_LATENCY: - process_audio_low_latency_hint(data); - break; - case PowerHint_1_2::AUDIO_STREAMING: - process_audio_streaming_hint(data); - break; - case PowerHint_1_2::CAMERA_LAUNCH: - process_camera_launch_hint(data); - break; - case PowerHint_1_2::CAMERA_STREAMING: - process_camera_streaming_hint(data); - break; - case PowerHint_1_2::CAMERA_SHOT: - process_camera_shot_hint(data); - break; - default: - return powerHint(static_cast(hint), data); - } - return Void(); -} - -} // namespace implementation -} // namespace V1_2 -} // namespace power -} // namespace hardware -} // namespace android diff --git a/power/Power.h b/power/Power.h deleted file mode 100644 index 650a5181..00000000 --- a/power/Power.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_POWER_V1_2_POWER_H -#define ANDROID_HARDWARE_POWER_V1_2_POWER_H - -#include -#include -#include -#include - -#include "InteractionHandler.h" - -namespace android { -namespace hardware { -namespace power { -namespace V1_2 { -namespace implementation { - -using ::android::hardware::power::V1_0::Feature; -using ::android::hardware::power::V1_2::IPower; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::InteractionHandler; -using PowerHint_1_0 = ::android::hardware::power::V1_0::PowerHint; -using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint; - -struct Power : public IPower { - // Methods from ::android::hardware::power::V1_0::IPower follow. - - Power(); - - Return setInteractive(bool interactive) override; - Return powerHint(PowerHint_1_0 hint, int32_t data) override; - Return setFeature(Feature feature, bool activate) override; - Return getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override; - - // Methods from ::android::hardware::power::V1_1::IPower follow. - Return getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override; - Return powerHintAsync(PowerHint_1_0 hint, int32_t data) override; - - // Methods from ::android::hardware::power::V1_2::IPower follow. - Return powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override; - - // Methods from ::android::hidl::base::V1_0::IBase follow. - - private: - InteractionHandler mInteractionHandler; - static bool isSupportedGovernor(); -}; - -} // namespace implementation -} // namespace V1_2 -} // namespace power -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_POWER_V1_2_POWER_H diff --git a/power/android.hardware.power@1.2-service.wahoo.rc b/power/android.hardware.power@1.2-service.wahoo.rc deleted file mode 100644 index dd5537c7..00000000 --- a/power/android.hardware.power@1.2-service.wahoo.rc +++ /dev/null @@ -1,4 +0,0 @@ -service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.wahoo - class hal - user system - group system diff --git a/power/hint-data.c b/power/hint-data.c deleted file mode 100644 index f3403b7c..00000000 --- a/power/hint-data.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2012, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include "hint-data.h" - -int hint_compare(struct hint_data *first_hint, - struct hint_data *other_hint) { - if (first_hint == other_hint) { - return 0; - } else if ((first_hint && other_hint) && - (first_hint->hint_id == other_hint->hint_id)) { - return 0; - } else { - return 1; - } -} - -void hint_dump(struct hint_data *hint) -{ - ALOGV("hint_id: %lu", hint->hint_id); -} diff --git a/power/hint-data.h b/power/hint-data.h deleted file mode 100644 index 6885396a..00000000 --- a/power/hint-data.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2012, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* Default use-case hint IDs */ -#define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00) -#define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00) -#define DISPLAY_STATE_HINT_ID (0x0C00) -#define DISPLAY_STATE_HINT_ID_2 (0x0D00) -#define CAM_PREVIEW_HINT_ID (0x0E00) -#define SUSTAINED_PERF_HINT_ID (0x0F00) -#define VR_MODE_HINT_ID (0x1000) -#define VR_MODE_SUSTAINED_PERF_HINT_ID (0x1001) -#define INTERACTION_HINT_ID (0x1A00) -#define BOOST_HINT_ID (0x1B00) - -#define CAMERA_LAUNCH_HINT_ID (0x0B0A) -#define CAMERA_STREAMING_HINT_ID (0x0C0A) -#define CAMERA_SHOT_HINT_ID (0x0D0A) -#define AUDIO_STREAMING_HINT_ID (0x0E0A) -#define AUDIO_LOW_LATENCY_HINT_ID (0x0F0A) - -struct hint_data { - unsigned long hint_id; /* This is our key. */ - unsigned long perflock_handle; -}; - -int hint_compare(struct hint_data *first_hint, - struct hint_data *other_hint); -void hint_dump(struct hint_data *hint); diff --git a/power/list.c b/power/list.c deleted file mode 100644 index 30a16943..00000000 --- a/power/list.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2012, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include - -#include "list.h" -#include - -int init_list_head(struct list_node *head) -{ - if (head == NULL) - return -1; - - memset(head, 0, sizeof(*head)); - - return 0; -} - -struct list_node *add_list_node(struct list_node *head, void *data) -{ - /* Create a new list_node. And put 'data' into it. */ - struct list_node *new_node; - - if (head == NULL) { - return NULL; - } - - if (!(new_node = malloc(sizeof(struct list_node)))) { - return NULL; - } - - new_node->data = data; - new_node->next = head->next; - new_node->compare = head->compare; - new_node->dump = head->dump; - head->next = new_node; - - return new_node; -} - -int is_list_empty(struct list_node *head) -{ - return (head == NULL || head->next == NULL); -} - -/* - * Delink and de-allocate 'node'. - */ -int remove_list_node(struct list_node *head, struct list_node *del_node) -{ - struct list_node *current_node; - struct list_node *saved_node; - - if (head == NULL || head->next == NULL) { - return -1; - } - - current_node = head->next; - saved_node = head; - - while (current_node && current_node != del_node) { - saved_node = current_node; - current_node = current_node->next; - } - - if (saved_node) { - if (current_node) { - saved_node->next = current_node->next; - } else { - /* Node not found. */ - return -1; - } - } - - if (del_node) { - free(del_node); - } - - return 0; -} - -void dump_list(struct list_node *head) -{ - struct list_node *current_node = head; - - if (head == NULL) - return; - - ALOGV("List:\n"); - - while ((current_node = current_node->next)) { - if (current_node->dump) { - current_node->dump(current_node->data); - } - } -} - -struct list_node *find_node(struct list_node *head, void *comparison_data) -{ - struct list_node *current_node = head; - - if (head == NULL) - return NULL; - - while ((current_node = current_node->next)) { - if (current_node->compare) { - if (current_node->compare(current_node->data, - comparison_data) == 0) { - /* Match found. Return current_node. */ - return current_node; - } - } - } - - /* No match found. */ - return NULL; -} diff --git a/power/list.h b/power/list.h deleted file mode 100644 index d68c3df1..00000000 --- a/power/list.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2012, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -struct list_node { - struct list_node *next; - void *data; - int (*compare)(void *data1, void *data2); - void (*dump)(void *data); -}; - -int init_list_head(struct list_node *head); -struct list_node * add_list_node(struct list_node *head, void *data); -int remove_list_node(struct list_node *head, struct list_node *del_node); -void dump_list(struct list_node *head); -struct list_node *find_node(struct list_node *head, void *comparison_data); diff --git a/power/metadata-defs.h b/power/metadata-defs.h deleted file mode 100644 index e3ce944d..00000000 --- a/power/metadata-defs.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#define ATTRIBUTE_VALUE_DELIM ('=') -#define ATTRIBUTE_STRING_DELIM (";") - -#define METADATA_PARSING_ERR (-1) -#define METADATA_PARSING_CONTINUE (0) -#define METADATA_PARSING_DONE (1) - -#define MIN(x,y) (((x)>(y))?(y):(x)) - -struct video_encode_metadata_t { - int hint_id; - int state; -}; - -struct video_decode_metadata_t { - int hint_id; - int state; -}; - -int parse_metadata(char *metadata, char **metadata_saveptr, - char *attribute, unsigned int attribute_size, char *value, unsigned int value_size); -int parse_video_encode_metadata(char *metadata, - struct video_encode_metadata_t *video_encode_metadata); -int parse_video_decode_metadata(char *metadata, - struct video_decode_metadata_t *video_decode_metadata); diff --git a/power/metadata-parser.c b/power/metadata-parser.c deleted file mode 100644 index ffe092b5..00000000 --- a/power/metadata-parser.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include - -#include "metadata-defs.h" - -int parse_metadata(char *metadata, char **metadata_saveptr, - char *attribute, unsigned int attribute_size, char *value, unsigned int value_size) -{ - char *attribute_string; - char *attribute_value_delim; - unsigned int bytes_to_copy; - - attribute_string = strtok_r(metadata, ATTRIBUTE_STRING_DELIM, - metadata_saveptr); - - if (attribute_string == NULL) - return METADATA_PARSING_DONE; - - attribute[0] = value[0] = '\0'; - - if ((attribute_value_delim = strchr(attribute_string, - ATTRIBUTE_VALUE_DELIM)) != NULL) { - unsigned int attribute_len = (unsigned int) (attribute_value_delim - attribute_string); - /* copy only attribute len + NUL character, or as much as can be fit */ - bytes_to_copy = MIN(attribute_len + 1, attribute_size); - - strlcpy(attribute, attribute_string, bytes_to_copy); - strlcpy(value, attribute_value_delim + 1, value_size); - } - - return METADATA_PARSING_CONTINUE; -} - -int parse_video_encode_metadata(char *metadata, - struct video_encode_metadata_t *video_encode_metadata) -{ - char attribute[1024], value[1024], *saveptr; - char *temp_metadata = metadata; - int parsing_status; - - while ((parsing_status = parse_metadata(temp_metadata, &saveptr, - attribute, sizeof(attribute), value, sizeof(value))) == METADATA_PARSING_CONTINUE) { - if (strlen(attribute) == strlen("hint_id") && - (strncmp(attribute, "hint_id", strlen("hint_id")) == 0)) { - if (strlen(value) > 0) { - video_encode_metadata->hint_id = atoi(value); - } - } - - if (strlen(attribute) == strlen("state") && - (strncmp(attribute, "state", strlen("state")) == 0)) { - if (strlen(value) > 0) { - video_encode_metadata->state = atoi(value); - } - } - - temp_metadata = NULL; - } - - if (parsing_status == METADATA_PARSING_ERR) - return -1; - - return 0; -} - -int parse_video_decode_metadata(char *metadata, - struct video_decode_metadata_t *video_decode_metadata) -{ - char attribute[1024], value[1024], *saveptr; - char *temp_metadata = metadata; - int parsing_status; - - while ((parsing_status = parse_metadata(temp_metadata, &saveptr, - attribute, sizeof(attribute), value, sizeof(value))) == METADATA_PARSING_CONTINUE) { - if (strlen(attribute) == strlen("hint_id") && - (strncmp(attribute, "hint_id", strlen("hint_id")) == 0)) { - if (strlen(value) > 0) { - video_decode_metadata->hint_id = atoi(value); - } - } - - if (strlen(attribute) == strlen("state") && - (strncmp(attribute, "state", strlen("state")) == 0)) { - if (strlen(value) > 0) { - video_decode_metadata->state = atoi(value); - } - } - - temp_metadata = NULL; - } - - if (parsing_status == METADATA_PARSING_ERR) - return -1; - - return 0; -} diff --git a/power/performance.h b/power/performance.h deleted file mode 100755 index 85a611d3..00000000 --- a/power/performance.h +++ /dev/null @@ -1,264 +0,0 @@ -/* Copyright (c) 2012, 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define FAILED -1 -#define SUCCESS 0 -#define INDEFINITE_DURATION 0 - -enum SCREEN_DISPLAY_TYPE { - DISPLAY_OFF = 0x00FF, -}; - -enum PWR_CLSP_TYPE { - ALL_CPUS_PWR_CLPS_DIS = 0x101, -}; - -/* For CPUx min freq, the leftmost byte - * represents the CPU and the - * rightmost byte represents the frequency - * All intermediate frequencies on the - * device are supported. The hex value - * passed into PerfLock will be multiplied - * by 10^5. This frequency or the next - * highest frequency available will be set - * - * For example, if 1.4 Ghz is required on - * CPU0, use 0x20E - * - * If the highest available frequency - * on the device is required, use - * CPUx_MIN_FREQ_TURBO_MAX - * where x represents the CPU - */ -enum CPU0_MIN_FREQ_LVL { - CPU0_MIN_FREQ_NONTURBO_MAX = 0x20A, - CPU0_MIN_FREQ_TURBO_MAX = 0x2FE, -}; - -enum CPU1_MIN_FREQ_LVL { - CPU1_MIN_FREQ_NONTURBO_MAX = 0x30A, - CPU1_MIN_FREQ_TURBO_MAX = 0x3FE, -}; - -enum CPU2_MIN_FREQ_LVL { - CPU2_MIN_FREQ_NONTURBO_MAX = 0x40A, - CPU2_MIN_FREQ_TURBO_MAX = 0x4FE, -}; - -enum CPU3_MIN_FREQ_LVL { - CPU3_MIN_FREQ_NONTURBO_MAX = 0x50A, - CPU3_MIN_FREQ_TURBO_MAX = 0x5FE, -}; - -enum CPU0_MAX_FREQ_LVL { - CPU0_MAX_FREQ_NONTURBO_MAX = 0x150A, -}; - -enum CPU1_MAX_FREQ_LVL { - CPU1_MAX_FREQ_NONTURBO_MAX = 0x160A, -}; - -enum CPU2_MAX_FREQ_LVL { - CPU2_MAX_FREQ_NONTURBO_MAX = 0x170A, -}; - -enum CPU3_MAX_FREQ_LVL { - CPU3_MAX_FREQ_NONTURBO_MAX = 0x180A, -}; - -enum MIN_CPUS_ONLINE_LVL { - CPUS_ONLINE_MIN_2 = 0x702, - CPUS_ONLINE_MIN_3 = 0x703, - CPUS_ONLINE_MIN_4 = 0x704, - CPUS_ONLINE_MPD_OVERRIDE = 0x777, - CPUS_ONLINE_MAX = 0x7FF, -}; - -enum MAX_CPUS_ONLINE_LVL { - CPUS_ONLINE_MAX_LIMIT_1 = 0x8FE, - CPUS_ONLINE_MAX_LIMIT_2 = 0x8FD, - CPUS_ONLINE_MAX_LIMIT_3 = 0x8FC, - CPUS_ONLINE_MAX_LIMIT_4 = 0x8FB, - CPUS_ONLINE_MAX_LIMIT_MAX = 0x8FB, -}; - -enum SAMPLING_RATE_LVL { - MS_500 = 0xBCD, - MS_50 = 0xBFA, - MS_20 = 0xBFD, -}; - -enum ONDEMAND_IO_BUSY_LVL { - IO_BUSY_OFF = 0xC00, - IO_BUSY_ON = 0xC01, -}; - -enum ONDEMAND_SAMPLING_DOWN_FACTOR_LVL { - SAMPLING_DOWN_FACTOR_1 = 0xD01, - SAMPLING_DOWN_FACTOR_4 = 0xD04, -}; - -enum INTERACTIVE_TIMER_RATE_LVL { - TR_MS_500 = 0xECD, - TR_MS_100 = 0xEF5, - TR_MS_50 = 0xEFA, - TR_MS_30 = 0xEFC, - TR_MS_20 = 0xEFD, -}; - -/* This timer rate applicable to cpu0 - across 8939 series chipset */ -enum INTERACTIVE_TIMER_RATE_LVL_CPU0_8939 { - TR_MS_CPU0_500 = 0x30CD, - TR_MS_CPU0_100 = 0x30F5, - TR_MS_CPU0_50 = 0x30FA, - TR_MS_CPU0_30 = 0x30FC, - TR_MS_CPU0_20 = 0x30FD, -}; - -/* This timer rate applicable to cpu4 - across 8939 series chipset */ -enum INTERACTIVE_TIMER_RATE_LVL_CPU4_8939 { - TR_MS_CPU4_500 = 0x3BCD, - TR_MS_CPU4_100 = 0x3BF5, - TR_MS_CPU4_50 = 0x3BFA, - TR_MS_CPU4_30 = 0x3BFC, - TR_MS_CPU4_20 = 0x3BFD, -}; - -/* This timer rate applicable to big.little arch */ -enum INTERACTIVE_TIMER_RATE_LVL_BIG_LITTLE { - BIG_LITTLE_TR_MS_100 = 0x64, - BIG_LITTLE_TR_MS_50 = 0x32, - BIG_LITTLE_TR_MS_40 = 0x28, - BIG_LITTLE_TR_MS_30 = 0x1E, - BIG_LITTLE_TR_MS_20 = 0x14, -}; - -/* INTERACTIVE opcodes */ -enum INTERACTIVE_OPCODES { - INT_OP_CLUSTER0_TIMER_RATE = 0x41424000, - INT_OP_CLUSTER1_TIMER_RATE = 0x41424100, - INT_OP_CLUSTER0_USE_SCHED_LOAD = 0x41430000, - INT_OP_CLUSTER1_USE_SCHED_LOAD = 0x41430100, - INT_OP_CLUSTER0_USE_MIGRATION_NOTIF = 0x41434000, - INT_OP_CLUSTER1_USE_MIGRATION_NOTIF = 0x41434100, - INT_OP_NOTIFY_ON_MIGRATE = 0x4241C000 -}; - -enum INTERACTIVE_HISPEED_FREQ_LVL { - HS_FREQ_1026 = 0xF0A, -}; - -enum INTERACTIVE_HISPEED_LOAD_LVL { - HISPEED_LOAD_90 = 0x105A, -}; - -enum SYNC_FREQ_LVL { - SYNC_FREQ_300 = 0x1103, - SYNC_FREQ_600 = 0X1106, - SYNC_FREQ_384 = 0x1103, - SYNC_FREQ_NONTURBO_MAX = 0x110A, - SYNC_FREQ_TURBO = 0x110F, -}; - -enum OPTIMAL_FREQ_LVL { - OPTIMAL_FREQ_300 = 0x1203, - OPTIMAL_FREQ_600 = 0x1206, - OPTIMAL_FREQ_384 = 0x1203, - OPTIMAL_FREQ_NONTURBO_MAX = 0x120A, - OPTIMAL_FREQ_TURBO = 0x120F, -}; - -enum SCREEN_PWR_CLPS_LVL { - PWR_CLPS_DIS = 0x1300, - PWR_CLPS_ENA = 0x1301, -}; - -enum THREAD_MIGRATION_LVL { - THREAD_MIGRATION_SYNC_OFF = 0x1400, -}; - -enum SCHED_GUIDED_LVL { - INTERACTIVE_USE_SCHED_LOAD_OFF = 0x5201, - INTERACTIVE_USE_MIGRATION_NOTIF_OFF = 0x5301 -}; - -enum INTERACTIVE_IO_BUSY_LVL { - INTERACTIVE_IO_BUSY_OFF = 0x1B00, - INTERACTIVE_IO_BUSY_ON = 0x1B01, -}; - -enum SCHED_BOOST_LVL { - SCHED_BOOST_ON = 0x1E01, -}; - -enum CPU4_MIN_FREQ_LVL { - CPU4_MIN_FREQ_NONTURBO_MAX = 0x1F0A, - CPU4_MIN_FREQ_TURBO_MAX = 0x1FFE, -}; - -enum CPU5_MIN_FREQ_LVL { - CPU5_MIN_FREQ_NONTURBO_MAX = 0x200A, - CPU5_MIN_FREQ_TURBO_MAX = 0x20FE, -}; - -enum CPU6_MIN_FREQ_LVL { - CPU6_MIN_FREQ_NONTURBO_MAX = 0x210A, - CPU6_MIN_FREQ_TURBO_MAX = 0x21FE, -}; - -enum CPU7_MIN_FREQ_LVL { - CPU7_MIN_FREQ_NONTURBO_MAX = 0x220A, - CPU7_MIN_FREQ_TURBO_MAX = 0x22FE, -}; - -enum CPU4_MAX_FREQ_LVL { - CPU4_MAX_FREQ_NONTURBO_MAX = 0x230A, -}; - -enum CPU5_MAX_FREQ_LVL { - CPU5_MAX_FREQ_NONTURBO_MAX = 0x240A, -}; - -enum CPU6_MAX_FREQ_LVL { - CPU6_MAX_FREQ_NONTURBO_MAX = 0x250A, -}; - -enum CPU7_MAX_FREQ_LVL { - CPU7_MAX_FREQ_NONTURBO_MAX = 0x260A, -}; - -#ifdef __cplusplus -} -#endif diff --git a/power/power-8998.c b/power/power-8998.c deleted file mode 100644 index 3c68a279..00000000 --- a/power/power-8998.c +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#define LOG_NIDEBUG 0 - -#include -#include -#include -#include -#include -#include -#include - -#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL) -#define LOG_TAG "QCOM PowerHAL" -#include -#include -#include -#include - -#include "utils.h" -#include "metadata-defs.h" -#include "hint-data.h" -#include "performance.h" -#include "power-common.h" -#include "powerhintparser.h" - -static int sustained_mode_handle = 0; -static int vr_mode_handle = 0; -static int launch_handle = 0; -static int sustained_performance_mode = 0; -static int vr_mode = 0; -static int launch_mode = 0; -#define CHECK_HANDLE(x) (((x)>0) && ((x)!=-1)) - -int is_perf_hint_active(int hint) -{ - switch (hint) { - case SUSTAINED_PERF_HINT_ID: - return sustained_performance_mode != 0; - case VR_MODE_HINT_ID: - return vr_mode != 0; - case VR_MODE_SUSTAINED_PERF_HINT_ID: - return vr_mode != 0 && sustained_performance_mode != 0; - } - return 0; -} - -static int process_sustained_perf_hint(void *data) -{ - int duration = 0; - int *resource_values = NULL; - int resources = 0; - - if (data && sustained_performance_mode == 0) { - if (vr_mode == 0) { // Sustained mode only. - resource_values = getPowerhint(SUSTAINED_PERF_HINT_ID, &resources); - if (!resource_values) { - ALOGE("Can't get sustained perf hints from xml "); - return HINT_NONE; - } - sustained_mode_handle = interaction_with_handle( - sustained_mode_handle, duration, resources, resource_values); - if (!CHECK_HANDLE(sustained_mode_handle)) { - ALOGE("Failed interaction_with_handle for sustained_mode_handle"); - return HINT_NONE; - } - } else if (vr_mode == 1) { // Sustained + VR mode. - release_request(vr_mode_handle); - resource_values = getPowerhint(VR_MODE_SUSTAINED_PERF_HINT_ID, &resources); - if (!resource_values) { - ALOGE("Can't get VR mode sustained perf hints from xml "); - return HINT_NONE; - } - sustained_mode_handle = interaction_with_handle( - sustained_mode_handle, duration, resources, resource_values); - if (!CHECK_HANDLE(sustained_mode_handle)) { - ALOGE("Failed interaction_with_handle for sustained_mode_handle"); - return HINT_NONE; - } - } - sustained_performance_mode = 1; - } else if (sustained_performance_mode == 1) { - release_request(sustained_mode_handle); - if (vr_mode == 1) { // Switch back to VR Mode. - resource_values = getPowerhint(VR_MODE_HINT_ID, &resources); - if (!resource_values) { - ALOGE("Can't get VR mode perf hints from xml "); - return HINT_NONE; - } - vr_mode_handle = interaction_with_handle( - vr_mode_handle, duration, resources, resource_values); - if (!CHECK_HANDLE(vr_mode_handle)) { - ALOGE("Failed interaction_with_handle for vr_mode_handle"); - return HINT_NONE; - } - } - sustained_performance_mode = 0; - } - return HINT_HANDLED; -} - -static int process_vr_mode_hint(void *data) -{ - int duration = 0; - int *resource_values = NULL; - int resources = 0; - - if (data && vr_mode == 0) { - if (sustained_performance_mode == 0) { // VR mode only. - resource_values = getPowerhint(VR_MODE_HINT_ID, &resources); - if (!resource_values) { - ALOGE("Can't get VR mode perf hints from xml "); - return HINT_NONE; - } - vr_mode_handle = interaction_with_handle( - vr_mode_handle, duration, resources, resource_values); - if (!CHECK_HANDLE(vr_mode_handle)) { - ALOGE("Failed interaction_with_handle for vr_mode_handle"); - return HINT_NONE; - } - } else if (sustained_performance_mode == 1) { // Sustained + VR mode. - release_request(sustained_mode_handle); - resource_values = getPowerhint(VR_MODE_SUSTAINED_PERF_HINT_ID, &resources); - if (!resource_values) { - ALOGE("Can't get VR mode sustained perf hints from xml "); - return HINT_NONE; - } - vr_mode_handle = interaction_with_handle( - vr_mode_handle, duration, resources, resource_values); - if (!CHECK_HANDLE(vr_mode_handle)) { - ALOGE("Failed interaction_with_handle for vr_mode_handle"); - return HINT_NONE; - } - } - vr_mode = 1; - } else if (vr_mode == 1) { - release_request(vr_mode_handle); - if (sustained_performance_mode == 1) { // Switch back to sustained Mode. - resource_values = getPowerhint(SUSTAINED_PERF_HINT_ID, &resources); - if (!resource_values) { - ALOGE("Can't get sustained perf hints from xml "); - return HINT_NONE; - } - sustained_mode_handle = interaction_with_handle( - sustained_mode_handle, duration, resources, resource_values); - if (!CHECK_HANDLE(sustained_mode_handle)) { - ALOGE("Failed interaction_with_handle for sustained_mode_handle"); - return HINT_NONE; - } - } - vr_mode = 0; - } - - return HINT_HANDLED; -} - -static int process_boost(int hint_id, int boost_handle, int duration) -{ - int *resource_values; - int resources; - - resource_values = getPowerhint(hint_id, &resources); - - if (resource_values != NULL) { - boost_handle = interaction_with_handle( - boost_handle, duration, resources, resource_values); - if (!CHECK_HANDLE(boost_handle)) { - ALOGE("Failed interaction_with_handle for hint_id %d", hint_id); - } - } - - return boost_handle; -} - -static int process_video_encode_hint(void *data) -{ - if (data) { - int *resource_values = NULL; - int resources = 0; - resource_values = getPowerhint(DEFAULT_VIDEO_ENCODE_HINT_ID, &resources); - if (resource_values != NULL) - perform_hint_action(DEFAULT_VIDEO_ENCODE_HINT_ID, resource_values, resources); - ALOGD("Video Encode hint start"); - return HINT_HANDLED; - } else { - undo_hint_action(DEFAULT_VIDEO_ENCODE_HINT_ID); - ALOGD("Video Encode hint stop"); - return HINT_HANDLED; - } - return HINT_NONE; -} - -int process_camera_launch_hint(int32_t duration) -{ - static int cam_launch_handle = -1; - static int boost_handle = -1; - - if (duration > 0) { - cam_launch_handle = process_boost(CAMERA_LAUNCH_HINT_ID, cam_launch_handle, duration); - ALOGD("CAMERA LAUNCH ON: %d MS", duration); - // boosts 2.5s for launching - boost_handle = process_boost(BOOST_HINT_ID, boost_handle, 2500); - return HINT_HANDLED; - } else if (duration == 0) { - release_request(cam_launch_handle); - ALOGD("CAMERA LAUNCH OFF"); - return HINT_HANDLED; - } else { - ALOGE("CAMERA LAUNCH INVALID DATA: %d", duration); - } - return HINT_NONE; -} - -int process_camera_streaming_hint(int32_t duration) -{ - static int cam_streaming_handle = -1; - - if (duration > 0) { - cam_streaming_handle = process_boost(CAMERA_STREAMING_HINT_ID, cam_streaming_handle, duration); - ALOGD("CAMERA STREAMING ON: %d MS", duration); - return HINT_HANDLED; - } else if (duration == 0) { - release_request(cam_streaming_handle); - ALOGD("CAMERA STREAMING OFF"); - return HINT_HANDLED; - } else { - ALOGE("CAMERA STREAMING INVALID DATA: %d", duration); - } - return HINT_NONE; -} - -int process_camera_shot_hint(int32_t duration) -{ - static int cam_shot_handle = -1; - - if (duration > 0) { - cam_shot_handle = process_boost(CAMERA_SHOT_HINT_ID, cam_shot_handle, duration); - ALOGD("CAMERA SHOT ON: %d MS", duration); - return HINT_HANDLED; - } else if (duration == 0) { - release_request(cam_shot_handle); - ALOGD("CAMERA SHOT OFF"); - return HINT_HANDLED; - } else { - ALOGE("CAMERA SHOT INVALID DATA: %d", duration); - } - return HINT_NONE; -} - -int process_audio_streaming_hint(int32_t duration) -{ - static int audio_streaming_handle = -1; - - if (duration > 0) { - // set max duration 2s for starting audio - audio_streaming_handle = process_boost(AUDIO_STREAMING_HINT_ID, audio_streaming_handle, 2000); - ALOGD("AUDIO STREAMING ON"); - return HINT_HANDLED; - } else if (duration == 0) { - release_request(audio_streaming_handle); - ALOGD("AUDIO STREAMING OFF"); - return HINT_HANDLED; - } else { - ALOGE("AUDIO STREAMING INVALID DATA: %d", duration); - } - return HINT_NONE; -} - -int process_audio_low_latency_hint(int32_t data) -{ - static int audio_low_latency_handle = -1; - - if (data) { - // Hint until canceled - audio_low_latency_handle = process_boost(AUDIO_LOW_LATENCY_HINT_ID, audio_low_latency_handle, 0); - ALOGD("AUDIO LOW LATENCY ON"); - } else { - release_request(audio_low_latency_handle); - ALOGD("AUDIO LOW LATENCY OFF"); - return HINT_HANDLED; - } - return HINT_HANDLED; -} - -static int process_activity_launch_hint(void *data) -{ - // boost will timeout in 5s - int duration = 5000; - ATRACE_BEGIN("launch"); - if (sustained_performance_mode || vr_mode) { - ATRACE_END(); - return HINT_HANDLED; - } - - ALOGD("LAUNCH HINT: %s", data ? "ON" : "OFF"); - // restart the launch hint if the framework has not yet released - // this shouldn't happen, but we've seen bugs where it could - if (data) { - launch_handle = process_boost(BOOST_HINT_ID, launch_handle, duration); - if (launch_handle > 0) { - launch_mode = 1; - ALOGD("Activity launch hint handled"); - ATRACE_INT("launch_lock", 1); - ATRACE_END(); - return HINT_HANDLED; - } else { - ATRACE_END(); - return HINT_NONE; - } - } else if (data == NULL && launch_mode == 1) { - release_request(launch_handle); - ATRACE_INT("launch_lock", 0); - launch_mode = 0; - ATRACE_END(); - return HINT_HANDLED; - } - ATRACE_END(); - return HINT_NONE; -} - -int power_hint_override(power_hint_t hint, void *data) -{ - int ret_val = HINT_NONE; - switch(hint) { - case POWER_HINT_VIDEO_ENCODE: - ret_val = process_video_encode_hint(data); - break; - case POWER_HINT_SUSTAINED_PERFORMANCE: - ret_val = process_sustained_perf_hint(data); - break; - case POWER_HINT_VR_MODE: - ret_val = process_vr_mode_hint(data); - break; - case POWER_HINT_LAUNCH: - ret_val = process_activity_launch_hint(data); - break; - default: - break; - } - return ret_val; -} - -int set_interactive_override(int UNUSED(on)) -{ - return HINT_HANDLED; /* Don't excecute this code path, not in use */ -} diff --git a/power/power-common.h b/power/power-common.h deleted file mode 100644 index aff3cd24..00000000 --- a/power/power-common.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#define NODE_MAX (64) - -#define SCALING_GOVERNOR_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" -#define DCVS_CPU0_SLACK_MAX_NODE "/sys/module/msm_dcvs/cores/cpu0/slack_time_max_us" -#define DCVS_CPU0_SLACK_MIN_NODE "/sys/module/msm_dcvs/cores/cpu0/slack_time_min_us" -#define MPDECISION_SLACK_MAX_NODE "/sys/module/msm_mpdecision/slack_time_max_us" -#define MPDECISION_SLACK_MIN_NODE "/sys/module/msm_mpdecision/slack_time_min_us" -#define SCALING_MIN_FREQ "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq" -#define ONDEMAND_GOVERNOR "ondemand" -#define INTERACTIVE_GOVERNOR "interactive" -#define SCHEDUTIL_GOVERNOR "schedutil" -#define SCHED_GOVERNOR "sched" - -#define MSMDCVS_GOVERNOR "msm-dcvs" -#define SCHED_GOVERNOR "sched" - -#define HINT_HANDLED (0) -#define HINT_NONE (-1) - -enum CPU_GOV_CHECK { - CPU0 = 0, - CPU1 = 1, - CPU2 = 2, - CPU3 = 3 -}; - -#define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) diff --git a/power/power-helper.c b/power/power-helper.c deleted file mode 100644 index e449ac1f..00000000 --- a/power/power-helper.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define LOG_NIDEBUG 0 - -#include -#include -#include -#include -#include -#include -#include -#include - -#define LOG_TAG "QCOM PowerHAL" -#include -#include - -#include "utils.h" -#include "metadata-defs.h" -#include "hint-data.h" -#include "performance.h" -#include "power-common.h" -#include "power-helper.h" - -#ifndef RPM_SYSTEM_STAT -#define RPM_SYSTEM_STAT "/d/system_stats" -#endif - -#ifndef WLAN_POWER_STAT -#define WLAN_POWER_STAT "/d/wlan0/power_stats" -#endif - -#define ARRAY_SIZE(x) (sizeof((x))/sizeof((x)[0])) -#define LINE_SIZE 128 - -const char *rpm_stat_params[MAX_RPM_PARAMS] = { - "count", - "actual last sleep(msec)", -}; - -const char *master_stat_params[MAX_RPM_PARAMS] = { - "Accumulated XO duration", - "XO Count", -}; - -struct stat_pair rpm_stat_map[] = { - { RPM_MODE_XO, "RPM Mode:vlow", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) }, - { RPM_MODE_VMIN, "RPM Mode:vmin", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) }, - { VOTER_APSS, "APSS", master_stat_params, ARRAY_SIZE(master_stat_params) }, - { VOTER_MPSS, "MPSS", master_stat_params, ARRAY_SIZE(master_stat_params) }, - { VOTER_ADSP, "ADSP", master_stat_params, ARRAY_SIZE(master_stat_params) }, - { VOTER_SLPI, "SLPI", master_stat_params, ARRAY_SIZE(master_stat_params) }, -}; - - -const char *wlan_power_stat_params[] = { - "cumulative_sleep_time_ms", - "cumulative_total_on_time_ms", - "deep_sleep_enter_counter", - "last_deep_sleep_enter_tstamp_ms" -}; - -struct stat_pair wlan_stat_map[] = { - { WLAN_POWER_DEBUG_STATS, "POWER DEBUG STATS", wlan_power_stat_params, ARRAY_SIZE(wlan_power_stat_params) }, -}; - -static int saved_dcvs_cpu0_slack_max = -1; -static int saved_dcvs_cpu0_slack_min = -1; -static int saved_mpdecision_slack_max = -1; -static int saved_mpdecision_slack_min = -1; -static int saved_interactive_mode = -1; -static int slack_node_rw_failed = 0; -static int display_hint_sent; - -void power_init(void) -{ - ALOGI("QCOM power HAL initing."); -} - -int __attribute__ ((weak)) power_hint_override(power_hint_t UNUSED(hint), - void *UNUSED(data)) -{ - return HINT_NONE; -} - -/* Declare function before use */ -void interaction(int duration, int num_args, int opt_list[]); - -void power_hint(power_hint_t hint, void *data) -{ - /* Check if this hint has been overridden. */ - if (power_hint_override(hint, data) == HINT_HANDLED) { - /* The power_hint has been handled. We can skip the rest. */ - return; - } - - switch(hint) { - case POWER_HINT_VSYNC: - break; - case POWER_HINT_SUSTAINED_PERFORMANCE: - ALOGD("Sustained perf power hint not handled in power_hint_override"); - break; - case POWER_HINT_VR_MODE: - ALOGD("VR mode power hint not handled in power_hint_override"); - break; - case POWER_HINT_INTERACTION: - { - int resources[] = {0x702, 0x20F, 0x30F}; - int duration = 3000; - - interaction(duration, sizeof(resources)/sizeof(resources[0]), resources); - } - break; - default: - break; - } -} - -int __attribute__ ((weak)) is_perf_hint_active(int UNUSED(hint)) -{ - return 0; -} - -int __attribute__ ((weak)) set_interactive_override(int UNUSED(on)) -{ - return HINT_NONE; -} - -void power_set_interactive(int on) -{ - char governor[80]; - char tmp_str[NODE_MAX]; - struct video_encode_metadata_t video_encode_metadata; - int rc = 0; - - if (set_interactive_override(on) == HINT_HANDLED) { - return; - } - - ALOGD("Got set_interactive hint"); - - if (get_scaling_governor(governor, sizeof(governor)) == -1) { - ALOGE("Can't obtain scaling governor."); - - return; - } - - if (!on) { - /* Display off. */ - if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) && - (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) { - int resource_values[] = {DISPLAY_OFF, MS_500, THREAD_MIGRATION_SYNC_OFF}; - - if (!display_hint_sent) { - perform_hint_action(DISPLAY_STATE_HINT_ID, - resource_values, sizeof(resource_values)/sizeof(resource_values[0])); - display_hint_sent = 1; - } - } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) && - (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { - int resource_values[] = {TR_MS_50, THREAD_MIGRATION_SYNC_OFF}; - - if (!display_hint_sent) { - perform_hint_action(DISPLAY_STATE_HINT_ID, - resource_values, sizeof(resource_values)/sizeof(resource_values[0])); - display_hint_sent = 1; - } - } else if ((strncmp(governor, MSMDCVS_GOVERNOR, strlen(MSMDCVS_GOVERNOR)) == 0) && - (strlen(governor) == strlen(MSMDCVS_GOVERNOR))) { - if (saved_interactive_mode == 1){ - /* Display turned off. */ - if (sysfs_read(DCVS_CPU0_SLACK_MAX_NODE, tmp_str, NODE_MAX - 1)) { - if (!slack_node_rw_failed) { - ALOGE("Failed to read from %s", DCVS_CPU0_SLACK_MAX_NODE); - } - - rc = 1; - } else { - saved_dcvs_cpu0_slack_max = atoi(tmp_str); - } - - if (sysfs_read(DCVS_CPU0_SLACK_MIN_NODE, tmp_str, NODE_MAX - 1)) { - if (!slack_node_rw_failed) { - ALOGE("Failed to read from %s", DCVS_CPU0_SLACK_MIN_NODE); - } - - rc = 1; - } else { - saved_dcvs_cpu0_slack_min = atoi(tmp_str); - } - - if (sysfs_read(MPDECISION_SLACK_MAX_NODE, tmp_str, NODE_MAX - 1)) { - if (!slack_node_rw_failed) { - ALOGE("Failed to read from %s", MPDECISION_SLACK_MAX_NODE); - } - - rc = 1; - } else { - saved_mpdecision_slack_max = atoi(tmp_str); - } - - if (sysfs_read(MPDECISION_SLACK_MIN_NODE, tmp_str, NODE_MAX - 1)) { - if(!slack_node_rw_failed) { - ALOGE("Failed to read from %s", MPDECISION_SLACK_MIN_NODE); - } - - rc = 1; - } else { - saved_mpdecision_slack_min = atoi(tmp_str); - } - - /* Write new values. */ - if (saved_dcvs_cpu0_slack_max != -1) { - snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_dcvs_cpu0_slack_max); - - if (sysfs_write(DCVS_CPU0_SLACK_MAX_NODE, tmp_str) != 0) { - if (!slack_node_rw_failed) { - ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MAX_NODE); - } - - rc = 1; - } - } - - if (saved_dcvs_cpu0_slack_min != -1) { - snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_dcvs_cpu0_slack_min); - - if (sysfs_write(DCVS_CPU0_SLACK_MIN_NODE, tmp_str) != 0) { - if(!slack_node_rw_failed) { - ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MIN_NODE); - } - - rc = 1; - } - } - - if (saved_mpdecision_slack_max != -1) { - snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_mpdecision_slack_max); - - if (sysfs_write(MPDECISION_SLACK_MAX_NODE, tmp_str) != 0) { - if(!slack_node_rw_failed) { - ALOGE("Failed to write to %s", MPDECISION_SLACK_MAX_NODE); - } - - rc = 1; - } - } - - if (saved_mpdecision_slack_min != -1) { - snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_mpdecision_slack_min); - - if (sysfs_write(MPDECISION_SLACK_MIN_NODE, tmp_str) != 0) { - if(!slack_node_rw_failed) { - ALOGE("Failed to write to %s", MPDECISION_SLACK_MIN_NODE); - } - - rc = 1; - } - } - } - - slack_node_rw_failed = rc; - } - } else { - /* Display on. */ - if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) && - (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) { - undo_hint_action(DISPLAY_STATE_HINT_ID); - display_hint_sent = 0; - } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) && - (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { - undo_hint_action(DISPLAY_STATE_HINT_ID); - display_hint_sent = 0; - } else if ((strncmp(governor, MSMDCVS_GOVERNOR, strlen(MSMDCVS_GOVERNOR)) == 0) && - (strlen(governor) == strlen(MSMDCVS_GOVERNOR))) { - if (saved_interactive_mode == -1 || saved_interactive_mode == 0) { - /* Display turned on. Restore if possible. */ - if (saved_dcvs_cpu0_slack_max != -1) { - snprintf(tmp_str, NODE_MAX, "%d", saved_dcvs_cpu0_slack_max); - - if (sysfs_write(DCVS_CPU0_SLACK_MAX_NODE, tmp_str) != 0) { - if (!slack_node_rw_failed) { - ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MAX_NODE); - } - - rc = 1; - } - } - - if (saved_dcvs_cpu0_slack_min != -1) { - snprintf(tmp_str, NODE_MAX, "%d", saved_dcvs_cpu0_slack_min); - - if (sysfs_write(DCVS_CPU0_SLACK_MIN_NODE, tmp_str) != 0) { - if (!slack_node_rw_failed) { - ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MIN_NODE); - } - - rc = 1; - } - } - - if (saved_mpdecision_slack_max != -1) { - snprintf(tmp_str, NODE_MAX, "%d", saved_mpdecision_slack_max); - - if (sysfs_write(MPDECISION_SLACK_MAX_NODE, tmp_str) != 0) { - if (!slack_node_rw_failed) { - ALOGE("Failed to write to %s", MPDECISION_SLACK_MAX_NODE); - } - - rc = 1; - } - } - - if (saved_mpdecision_slack_min != -1) { - snprintf(tmp_str, NODE_MAX, "%d", saved_mpdecision_slack_min); - - if (sysfs_write(MPDECISION_SLACK_MIN_NODE, tmp_str) != 0) { - if (!slack_node_rw_failed) { - ALOGE("Failed to write to %s", MPDECISION_SLACK_MIN_NODE); - } - - rc = 1; - } - } - } - - slack_node_rw_failed = rc; - } - } - - saved_interactive_mode = !!on; -} - - -static int parse_stats(const char **params, size_t params_size, - uint64_t *list, FILE *fp) { - ssize_t nread; - size_t len = LINE_SIZE; - char *line; - size_t params_read = 0; - size_t i; - - line = malloc(len); - if (!line) { - ALOGE("%s: no memory to hold line", __func__); - return -ENOMEM; - } - - while ((params_read < params_size) && - (nread = getline(&line, &len, fp) > 0)) { - char *key = line + strspn(line, " \t"); - char *value = strchr(key, ':'); - if (!value || (value > (line + len))) - continue; - *value++ = '\0'; - - for (i = 0; i < params_size; i++) { - if (!strcmp(key, params[i])) { - list[i] = strtoull(value, NULL, 0); - params_read++; - break; - } - } - } - free(line); - - return 0; -} - - -static int extract_stats(uint64_t *list, char *file, - struct stat_pair *map, size_t map_size) { - FILE *fp; - ssize_t read; - size_t len = LINE_SIZE; - char *line; - size_t i, stats_read = 0; - int ret = 0; - - fp = fopen(file, "re"); - if (fp == NULL) { - ALOGE("%s: failed to open: %s Error = %s", __func__, file, strerror(errno)); - return -errno; - } - - line = malloc(len); - if (!line) { - ALOGE("%s: no memory to hold line", __func__); - fclose(fp); - return -ENOMEM; - } - - while ((stats_read < map_size) && (read = getline(&line, &len, fp) != -1)) { - size_t begin = strspn(line, " \t"); - - for (i = 0; i < map_size; i++) { - if (!strncmp(line + begin, map[i].label, strlen(map[i].label))) { - stats_read++; - break; - } - } - - if (i == map_size) - continue; - - ret = parse_stats(map[i].parameters, map[i].num_parameters, - &list[map[i].stat * MAX_RPM_PARAMS], fp); - if (ret < 0) - break; - } - free(line); - fclose(fp); - - return ret; -} - -int extract_platform_stats(uint64_t *list) { - return extract_stats(list, RPM_SYSTEM_STAT, rpm_stat_map, ARRAY_SIZE(rpm_stat_map)); -} - -int extract_wlan_stats(uint64_t *list) { - return extract_stats(list, WLAN_POWER_STAT, wlan_stat_map, ARRAY_SIZE(wlan_stat_map)); -} diff --git a/power/power-helper.h b/power/power-helper.h deleted file mode 100644 index 6117caba..00000000 --- a/power/power-helper.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2017, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __POWER_HELPER_H__ -#define __POWER_HELPER_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "hardware/power.h" - - -enum stats_type { - //Platform Stats - RPM_MODE_XO = 0, - RPM_MODE_VMIN, - RPM_MODE_MAX, - XO_VOTERS_START = RPM_MODE_MAX, - VOTER_APSS = XO_VOTERS_START, - VOTER_MPSS, - VOTER_ADSP, - VOTER_SLPI, - MAX_PLATFORM_STATS, - - //WLAN Stats - WLAN_POWER_DEBUG_STATS = 0, - MAX_WLAN_STATS, -}; - -enum subsystem_type { - SUBSYSTEM_WLAN = 0, - - //Don't add any lines after this line - SUBSYSTEM_COUNT -}; - -enum wlan_sleep_states { - WLAN_STATE_ACTIVE = 0, - WLAN_STATE_DEEP_SLEEP, - - //Don't add any lines after this line - WLAN_STATES_COUNT -}; - -enum wlan_power_params { - CUMULATIVE_SLEEP_TIME_MS = 0, - CUMULATIVE_TOTAL_ON_TIME_MS, - DEEP_SLEEP_ENTER_COUNTER, - LAST_DEEP_SLEEP_ENTER_TSTAMP_MS, - - //Don't add any lines after this line - WLAN_POWER_PARAMS_COUNT -}; - - -#define PLATFORM_SLEEP_MODES_COUNT RPM_MODE_MAX - -#define MAX_RPM_PARAMS 2 -#define XO_VOTERS (MAX_PLATFORM_STATS - XO_VOTERS_START) -#define VMIN_VOTERS 0 - -struct stat_pair { - enum stats_type stat; - const char *label; - const char **parameters; - size_t num_parameters; -}; - - -void power_init(void); -void power_hint(power_hint_t hint, void *data); -void power_set_interactive(int on); -int extract_platform_stats(uint64_t *list); -int extract_wlan_stats(uint64_t *list); - -int is_perf_hint_active(int hint); - -int process_camera_launch_hint(int32_t duration); -int process_camera_streaming_hint(int32_t duration); -int process_camera_shot_hint(int32_t duration); -int process_audio_streaming_hint(int32_t duration); -int process_audio_low_latency_hint(int32_t data); - -#ifdef __cplusplus -} -#endif - -#endif //__POWER_HELPER_H__ diff --git a/power/powerhintparser.c b/power/powerhintparser.c deleted file mode 100644 index 31d9625a..00000000 --- a/power/powerhintparser.c +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#define LOG_TAG "QCOM PowerHAL" - -#include -#include -#include -#include "powerhintparser.h" - -int parsePowerhintXML() { - - xmlDocPtr doc; - xmlNodePtr currNode; - const char *opcode_str, *value_str, *type_str; - int opcode = 0, value = 0, type = 0; - int numParams = 0; - static int hintCount; - - if(access(POWERHINT_XML, F_OK) < 0) { - return -1; - } - - doc = xmlReadFile(POWERHINT_XML, "UTF-8", XML_PARSE_RECOVER); - if(!doc) { - ALOGE("Document not parsed successfully"); - return -1; - } - - currNode = xmlDocGetRootElement(doc); - if(!currNode) { - ALOGE("Empty document"); - xmlFreeDoc(doc); - xmlCleanupParser(); - return -1; - } - - // Confirm the root-element of the tree - if(xmlStrcmp(currNode->name, BAD_CAST "Powerhint")) { - ALOGE("document of the wrong type, root node != root"); - xmlFreeDoc(doc); - xmlCleanupParser(); - return -1; - } - - currNode = currNode->xmlChildrenNode; - - for(; currNode != NULL; currNode=currNode->next) { - - if(currNode->type != XML_ELEMENT_NODE) - continue; - - xmlNodePtr node = currNode; - - if(hintCount == MAX_HINT) { - ALOGE("Number of hints exceeded the max count of %d\n",MAX_HINT); - break; - } - - if(!xmlStrcmp(node->name, BAD_CAST "Hint")) { - if(xmlHasProp(node, BAD_CAST "type")) { - type_str = (const char*)xmlGetProp(node, BAD_CAST "type"); - if (type_str == NULL) - { - ALOGE("xmlGetProp failed on type"); - xmlFreeDoc(doc); - xmlCleanupParser(); - return -1; - } - type = strtol(type_str, NULL, 16); - } - - node = node->children; - while(node != NULL) { - if(!xmlStrcmp(node->name, BAD_CAST "Resource")) { - - if(xmlHasProp(node, BAD_CAST "opcode")) { - opcode_str = (const char*)xmlGetProp(node, BAD_CAST "opcode"); - if (opcode_str == NULL) - { - ALOGE("xmlGetProp failed on opcode"); - xmlFreeDoc(doc); - xmlCleanupParser(); - return -1; - } - opcode = strtol(opcode_str, NULL, 16); - } - if(xmlHasProp(node, BAD_CAST "value")) { - value_str = (const char*)xmlGetProp(node, BAD_CAST "value"); - if (value_str == NULL) - { - ALOGE("xmlGetProp failed on value"); - xmlFreeDoc(doc); - xmlCleanupParser(); - return -1; - } - value = strtol(value_str, NULL, 16); - } - if(opcode > 0) { - if(numParams < (MAX_PARAM-1)) { - powerhint[hintCount].paramList[numParams++] = opcode; - powerhint[hintCount].paramList[numParams++] = value; - } else { - ALOGE("Maximum parameters exceeded for Hint ID %x\n",type); - opcode = value = 0; - break; - } - } - - opcode = value = 0; - } - node = node->next; - } - powerhint[hintCount].type = type; - powerhint[hintCount].numParams = numParams; - numParams = 0; - } - hintCount++; - } - - xmlFreeDoc(doc); - xmlCleanupParser(); - return 0; -} - -int* getPowerhint(int hint_id, int *params) { - - int *result = NULL; - - if(!hint_id) - return result; - - ALOGV("Powerhal hint received=%x\n",hint_id); - - if(!powerhint[0].numParams) { - parsePowerhintXML(); - } - - for(int i = 0; i < MAX_HINT; i++) { - if(hint_id == powerhint[i].type) { - *params = powerhint[i].numParams; - result = powerhint[i].paramList; - break; - } - } - - return result; -} diff --git a/power/powerhintparser.h b/power/powerhintparser.h deleted file mode 100644 index 971a472a..00000000 --- a/power/powerhintparser.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2016, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __POWERHINTPARSER__ -#define __POWERHINTPARSER__ - -#define POWERHINT_XML "/vendor/etc/powerhint.xml" -#define MAX_HINT 16 -#define MAX_PARAM 30 - -typedef struct perflock_param_t { - int type; - int numParams; - int paramList[MAX_PARAM];//static limit on number of hints - 15 -}perflock_param_t; - -static perflock_param_t powerhint[MAX_HINT]; - -int parsePowerhintXML(); - -#ifdef __cplusplus -extern "C" { -#endif - -int *getPowerhint(int, int *); - -#ifdef __cplusplus -} -#endif - -#endif /* __POWERHINTPARSER__ */ diff --git a/power/service.cpp b/power/service.cpp deleted file mode 100644 index 54e6d826..00000000 --- a/power/service.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "android.hardware.power@1.2-service.wahoo" - -#include -#include -#include -#include "Power.h" - -using android::sp; -using android::status_t; -using android::OK; - -// libhwbinder: -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -// Generated HIDL files -using android::hardware::power::V1_2::IPower; -using android::hardware::power::V1_2::implementation::Power; - -int main() { - - status_t status; - android::sp service = nullptr; - - ALOGI("Power HAL Service 1.2 for Wahoo is starting."); - - service = new Power(); - if (service == nullptr) { - ALOGE("Can not create an instance of Power HAL Iface, exiting."); - - goto shutdown; - } - - configureRpcThreadpool(1, true /*callerWillJoin*/); - - status = service->registerAsService(); - if (status != OK) { - ALOGE("Could not register service for Power HAL Iface (%d).", status); - goto shutdown; - } - - ALOGI("Power Service is ready"); - joinRpcThreadpool(); - //Should not pass this line - -shutdown: - // In normal operation, we don't expect the thread pool to exit - - ALOGE("Power Service is shutting down"); - return 1; -} diff --git a/power/utils.c b/power/utils.c deleted file mode 100644 index 9661e5ea..00000000 --- a/power/utils.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2012-2013,2015-2016, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#define LOG_NIDEBUG 0 - -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "list.h" -#include "hint-data.h" -#include "power-common.h" - -#define LOG_TAG "QCOM PowerHAL" -#include - -static void *qcopt_handle; -static int (*perf_lock_acq)(unsigned long handle, int duration, - int list[], int numArgs); -static int (*perf_lock_rel)(unsigned long handle); -static struct list_node active_hint_list_head; - -static void *get_qcopt_handle() -{ - char qcopt_lib_path[PATH_MAX] = {0}; - void *handle = NULL; - - dlerror(); - - if (property_get("ro.vendor.extension_library", qcopt_lib_path, - NULL)) { - handle = dlopen(qcopt_lib_path, RTLD_NOW); - if (!handle) { - ALOGE("Unable to open %s: %s\n", qcopt_lib_path, - dlerror()); - } - } - - return handle; -} - -static void __attribute__ ((constructor)) initialize(void) -{ - qcopt_handle = get_qcopt_handle(); - - if (!qcopt_handle) { - ALOGE("Failed to get qcopt handle.\n"); - } else { - /* - * qc-opt handle obtained. Get the perflock acquire/release - * function pointers. - */ - perf_lock_acq = dlsym(qcopt_handle, "perf_lock_acq"); - - if (!perf_lock_acq) { - ALOGE("Unable to get perf_lock_acq function handle.\n"); - } - - perf_lock_rel = dlsym(qcopt_handle, "perf_lock_rel"); - - if (!perf_lock_rel) { - ALOGE("Unable to get perf_lock_rel function handle.\n"); - } - } -} - -static void __attribute__ ((destructor)) cleanup(void) -{ - if (qcopt_handle) { - if (dlclose(qcopt_handle)) - ALOGE("Error occurred while closing qc-opt library."); - } -} - -int sysfs_read(char *path, char *s, int num_bytes) -{ - char buf[80]; - int count; - int ret = 0; - int fd = open(path, O_RDONLY); - - if (fd < 0) { - strerror_r(errno, buf, sizeof(buf)); - ALOGE("Error opening %s: %s\n", path, buf); - - return -1; - } - - if ((count = read(fd, s, num_bytes - 1)) < 0) { - strerror_r(errno, buf, sizeof(buf)); - ALOGE("Error writing to %s: %s\n", path, buf); - - ret = -1; - } else { - s[count] = '\0'; - } - - close(fd); - - return ret; -} - -int sysfs_write(char *path, char *s) -{ - char buf[80]; - int len; - int ret = 0; - int fd = open(path, O_WRONLY); - - if (fd < 0) { - strerror_r(errno, buf, sizeof(buf)); - ALOGE("Error opening %s: %s\n", path, buf); - return -1 ; - } - - len = write(fd, s, strlen(s)); - if (len < 0) { - strerror_r(errno, buf, sizeof(buf)); - ALOGE("Error writing to %s: %s\n", path, buf); - - ret = -1; - } - - close(fd); - - return ret; -} - -int get_scaling_governor(char governor[], int size) -{ - if (sysfs_read(SCALING_GOVERNOR_PATH, governor, - size) == -1) { - // Can't obtain the scaling governor. Return. - return -1; - } else { - // Strip newline at the end. - int len = strlen(governor); - - len--; - - while (len >= 0 && (governor[len] == '\n' || governor[len] == '\r')) - governor[len--] = '\0'; - } - - return 0; -} - -int is_interactive_governor(char* governor) { - if (strncmp(governor, INTERACTIVE_GOVERNOR, (strlen(INTERACTIVE_GOVERNOR)+1)) == 0) - return 1; - return 0; -} - -void interaction(int duration, int num_args, int opt_list[]) -{ -#ifdef INTERACTION_BOOST - static int lock_handle = 0; - - if (duration < 0 || num_args < 1 || opt_list[0] == 0) - return; - - if (qcopt_handle) { - if (perf_lock_acq) { - lock_handle = perf_lock_acq(lock_handle, duration, opt_list, num_args); - if (lock_handle == -1) - ALOGE("Failed to acquire lock."); - } - } -#endif -} - -int interaction_with_handle(int lock_handle, int duration, int num_args, int opt_list[]) -{ -#ifdef INTERACTION_BOOST - if (duration < 0 || num_args < 1 || opt_list[0] == 0) - return 0; - - if (qcopt_handle) { - if (perf_lock_acq) { - lock_handle = perf_lock_acq(lock_handle, duration, opt_list, num_args); - if (lock_handle == -1) - ALOGE("Failed to acquire lock."); - } - } - return lock_handle; -#else - return 0; -#endif -} - -void release_request(int lock_handle) { - if (qcopt_handle && perf_lock_rel) - perf_lock_rel(lock_handle); -} - -void perform_hint_action(int hint_id, int resource_values[], int num_resources) -{ - if (qcopt_handle) { - struct hint_data temp_hint_data = { - .hint_id = hint_id - }; - struct list_node *found_node = find_node(&active_hint_list_head, - &temp_hint_data); - if (found_node) { - ALOGE("hint ID %d already active", hint_id); - return; - } - if (perf_lock_acq) { - /* Acquire an indefinite lock for the requested resources. */ - int lock_handle = perf_lock_acq(0, 0, resource_values, - num_resources); - - if (lock_handle == -1) { - ALOGE("%s: Failed to acquire lock.", __func__); - } else { - /* Add this handle to our internal hint-list. */ - struct hint_data *new_hint = - (struct hint_data *)malloc(sizeof(struct hint_data)); - - if (new_hint) { - if (!active_hint_list_head.compare) { - active_hint_list_head.compare = - (int (*)(void *, void *))hint_compare; - active_hint_list_head.dump = (void (*)(void *))hint_dump; - } - - new_hint->hint_id = hint_id; - new_hint->perflock_handle = lock_handle; - - if (add_list_node(&active_hint_list_head, new_hint) == NULL) { - free(new_hint); - /* Can't keep track of this lock. Release it. */ - if (perf_lock_rel) - perf_lock_rel(lock_handle); - - ALOGE("Failed to process hint."); - } - } else { - /* Can't keep track of this lock. Release it. */ - if (perf_lock_rel) - perf_lock_rel(lock_handle); - - ALOGE("Failed to process hint."); - } - } - } - } -} - -void undo_hint_action(int hint_id) -{ - if (qcopt_handle) { - if (perf_lock_rel) { - /* Get hint-data associated with this hint-id */ - struct list_node *found_node; - struct hint_data temp_hint_data = { - .hint_id = hint_id - }; - - found_node = find_node(&active_hint_list_head, - &temp_hint_data); - - if (found_node) { - /* Release this lock. */ - struct hint_data *found_hint_data = - (struct hint_data *)(found_node->data); - - if (found_hint_data) { - if (perf_lock_rel(found_hint_data->perflock_handle) == -1) - ALOGE("Perflock release failed: %d", hint_id); - } - - if (found_node->data) { - /* We can free the hint-data for this node. */ - free(found_node->data); - } - - remove_list_node(&active_hint_list_head, found_node); - ALOGV("Undo of hint ID %d succeeded", hint_id); - } else { - ALOGE("Invalid hint ID: %d", hint_id); - } - } - } -} - -/* - * Used to release initial lock holding - * two cores online when the display is on - */ -void undo_initial_hint_action() -{ - if (qcopt_handle) { - if (perf_lock_rel) { - perf_lock_rel(1); - } - } -} diff --git a/power/utils.h b/power/utils.h deleted file mode 100644 index fb7aa113..00000000 --- a/power/utils.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2012-2013,2015-2016, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#ifndef UTILS_H -#define UTILS_H -#include - -#ifdef __cplusplus -extern "C" { -#endif - -int sysfs_read(char *path, char *s, int num_bytes); -int sysfs_write(char *path, char *s); -int get_scaling_governor(char governor[], int size); -int get_scaling_governor_check_cores(char governor[], int size, int core_num); -int is_interactive_governor(char *); - -void vote_ondemand_io_busy_off(); -void unvote_ondemand_io_busy_off(); -void vote_ondemand_sdf_low(); -void unvote_ondemand_sdf_low(); -void perform_hint_action(int hint_id, int resource_values[], - int num_resources); -void undo_hint_action(int hint_id); -void release_request(int lock_handle); -int interaction_with_handle(int lock_handle, - int duration, - int num_args, - int opt_list[]); - -#ifdef __cplusplus -} -#endif - -#endif //UTILS_H \ No newline at end of file From 3ee4e77674ecce82dadfcf5c64d87ce6d65a88b0 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Tue, 15 May 2018 12:06:48 +0900 Subject: [PATCH 284/300] Temporarily whitelisting system domains writing vendor props system properties must not be used as a communication channel in between system and vendor processes. However, there has been no enforcement on this: system process could write system properties that are owned and read by vendor processes and vice versa. Such communication should be done over hwbinder and should be formally specified in HIDL. Until we finish migrating the existing use cases of sysprops to HIDL, whitelisting them in system_writes_vendor_properties_violators so that the violators are clearly tracked. These violators are allowed only for P, but not for Q. Bug: 78598545 Test: m -j selinux_policy Change-Id: I60b12f1232c77ad997c8c87e6d91baa14c626e94 --- sepolicy/private/ramoops.te | 1 + sepolicy/vendor/bluetooth.te | 1 + sepolicy/vendor/cameraserver.te | 1 + sepolicy/vendor/charger.te | 1 + sepolicy/vendor/gatekeeperd.te | 1 + sepolicy/vendor/healthd.te | 1 + sepolicy/vendor/radio.te | 1 + sepolicy/vendor/surfaceflinger.te | 1 + sepolicy/vendor/system_app.te | 1 + sepolicy/vendor/system_server.te | 1 + 10 files changed, 10 insertions(+) diff --git a/sepolicy/private/ramoops.te b/sepolicy/private/ramoops.te index c7cea81d..534fa656 100644 --- a/sepolicy/private/ramoops.te +++ b/sepolicy/private/ramoops.te @@ -11,6 +11,7 @@ allow ramoops shell_exec:file rx_file_perms; allow ramoops toolbox_exec:file rx_file_perms; # Set the sys.ramoops.decrypted property +typeattribute ramoops system_writes_vendor_properties_violators; set_prop(ramoops, ramoops_prop); allow ramoops sysfs_pstore:file rw_file_perms; diff --git a/sepolicy/vendor/bluetooth.te b/sepolicy/vendor/bluetooth.te index 6d70fab6..a71c1450 100644 --- a/sepolicy/vendor/bluetooth.te +++ b/sepolicy/vendor/bluetooth.te @@ -1,3 +1,4 @@ +typeattribute bluetooth system_writes_vendor_properties_violators; set_prop(bluetooth, vendor_bluetooth_prop) set_prop(bluetooth, wc_prop) diff --git a/sepolicy/vendor/cameraserver.te b/sepolicy/vendor/cameraserver.te index d29d473d..594f22a9 100644 --- a/sepolicy/vendor/cameraserver.te +++ b/sepolicy/vendor/cameraserver.te @@ -1,5 +1,6 @@ allow cameraserver gpu_device:chr_file rw_file_perms; +typeattribute cameraserver system_writes_vendor_properties_violators; set_prop(cameraserver, camera_prop) allow cameraserver sysfs_camera:file r_file_perms; diff --git a/sepolicy/vendor/charger.te b/sepolicy/vendor/charger.te index 3f30f35d..e8472810 100644 --- a/sepolicy/vendor/charger.te +++ b/sepolicy/vendor/charger.te @@ -1 +1,2 @@ +typeattribute charger system_writes_vendor_properties_violators; set_prop(charger, public_vendor_system_prop) diff --git a/sepolicy/vendor/gatekeeperd.te b/sepolicy/vendor/gatekeeperd.te index 647ede2a..e4bef11b 100644 --- a/sepolicy/vendor/gatekeeperd.te +++ b/sepolicy/vendor/gatekeeperd.te @@ -1 +1,2 @@ +typeattribute gatekeeperd system_writes_vendor_properties_violators; set_prop(gatekeeperd, keymaster_prop) diff --git a/sepolicy/vendor/healthd.te b/sepolicy/vendor/healthd.te index 5032bba8..6b22ced3 100644 --- a/sepolicy/vendor/healthd.te +++ b/sepolicy/vendor/healthd.te @@ -1 +1,2 @@ +typeattribute healthd system_writes_vendor_properties_violators; set_prop(healthd, public_vendor_system_prop) diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index 0868a3d9..b287bbbb 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -1,4 +1,5 @@ get_prop(radio, ims_prop) +typeattribute radio system_writes_vendor_properties_violators; userdebug_or_eng(`set_prop(radio, tel_mon_prop)') allow radio qmuxd_socket:dir search; diff --git a/sepolicy/vendor/surfaceflinger.te b/sepolicy/vendor/surfaceflinger.te index 349151b6..636d98b4 100644 --- a/sepolicy/vendor/surfaceflinger.te +++ b/sepolicy/vendor/surfaceflinger.te @@ -3,4 +3,5 @@ dontaudit surfaceflinger vendor_file:file read; dontaudit surfaceflinger kernel:system module_request; allow surfaceflinger debugfs_ion:dir search; +typeattribute surfaceflinger system_writes_vendor_properties_violators; set_prop(surfaceflinger, public_vendor_system_prop) diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te index ac4ef9b6..c1ede120 100644 --- a/sepolicy/vendor/system_app.te +++ b/sepolicy/vendor/system_app.te @@ -3,6 +3,7 @@ userdebug_or_eng(`set_prop(system_app, tel_mon_prop)') # Needed by Settings app's CameraHalHdrplusPreferenceController +typeattribute system_app system_writes_vendor_properties_violators; set_prop(system_app, camera_prop) # read regulatory info diff --git a/sepolicy/vendor/system_server.te b/sepolicy/vendor/system_server.te index 8e38725d..bcba87c3 100644 --- a/sepolicy/vendor/system_server.te +++ b/sepolicy/vendor/system_server.te @@ -23,6 +23,7 @@ dontaudit system_server untrusted_app:file write; dontaudit system_server hal_audio_default:file write; dontaudit system_server appdomain:file write; +typeattribute system_server system_writes_vendor_properties_violators; set_prop(system_server, public_vendor_system_prop) dontaudit system_server self:capability sys_module; From b7e3d9f3defac20a0123f9df3052e62c96b31131 Mon Sep 17 00:00:00 2001 From: Ruchi Kandoi Date: Mon, 14 May 2018 14:14:51 -0700 Subject: [PATCH 285/300] Add dontaudit rules for nfc.persist properties Since NFC has a common vendor library, adding dontaudit rules for properties which are not used by this product. type=1400 audit(0.0:35): avc: denied { read } for comm="nfc@1.1-service" name="u:object_r:default_prop:s0" dev="tmpfs" ino=17612 scontext=u:r:hal_nfc_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0 Test: check logcat Bug: 79417308 Change-Id: If2d0a1d3403851d819305f18c96c18eca35db7a8 --- sepolicy/vendor/hal_nfc_default.te | 1 + sepolicy/vendor/property.te | 1 + sepolicy/vendor/property_contexts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/sepolicy/vendor/hal_nfc_default.te b/sepolicy/vendor/hal_nfc_default.te index 7367b5a6..21614c4f 100644 --- a/sepolicy/vendor/hal_nfc_default.te +++ b/sepolicy/vendor/hal_nfc_default.te @@ -4,3 +4,4 @@ allow hal_nfc_default nfc_vendor_data_file:file create_file_perms; dontaudit hal_nfc_default nxpese_hwservice:hwservice_manager find; dontaudit hal_nfc_default nxpnfc_hwservice:hwservice_manager add; +dontaudit hal_nfc_default persist_nfc_prop:file read; diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index 9687886a..cb25a31e 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -24,3 +24,4 @@ type vendor_radio_prop, property_type; type vendor_wifi_version, property_type; type vendor_usb_config_prop, property_type; type vendor_charge_prop, property_type; +type persist_nfc_prop, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 6c88cb5d..7f364b38 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -200,3 +200,6 @@ persist.service.bdroid.ssrlvl u:object_r:vendor_bluetooth_prop:s0 ro.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 ro.bluetooth.emb_wp_mode u:object_r:vendor_bluetooth_prop:s0 ro.bluetooth.wipower u:object_r:vendor_bluetooth_prop:s0 + +# persist_nfc_prop +persist.nfc. u:object_r:persist_nfc_prop:s0 From 6a54985cc8f3020c4e0f9a30f446741712eed697 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Tue, 19 Sep 2017 17:47:51 -0700 Subject: [PATCH 286/300] media: update codec performance data (PPR1.180514.002) Performance data based on releases PPR1.180405.004 and PPR1.180514.002. Bug: 79258572 Change-Id: I58d05f475e38ac017a0d545f85db78f7b558e228 --- media_codecs_performance.xml | 186 ++++++++++++++++++----------------- 1 file changed, 98 insertions(+), 88 deletions(-) diff --git a/media_codecs_performance.xml b/media_codecs_performance.xml index 7f1b2545..d496f912 100644 --- a/media_codecs_performance.xml +++ b/media_codecs_performance.xml @@ -1,5 +1,5 @@ - - + - - - + + + - - - - + + + + - - - - - + + + + + + - - - - + + + + + - - - - + + + + + + - - + + - - - - - - - - + + + + + + + + - + + - - - - - - - - - - + + + + + - - + + + - - - - + + + + - - - - - - + + + + + + + + - - + + + - - - - + + + + + + - - - - - + + + + + + - + + - - - - - + + + + + + - - - - - - + + + + + + + - + + - - - - - + + + - - - - + + + + + From 96a0fe5fce6b323441f18e475fe28792fe495bfc Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Wed, 16 May 2018 16:14:54 -0700 Subject: [PATCH 287/300] "Update SVN to 13 for July T-Mobile/Fi Walleye/Taimen Build Bug: 79883349" --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index a200e0c0..34ef0a01 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=12 + ro.vendor.build.svn=13 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 6df16ac39c34c6bda93dc1d16dd61836f80486e6 Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Wed, 16 May 2018 16:16:49 -0700 Subject: [PATCH 288/300] "Update SVN to 14 for July RoW Walleye/Taimen Build Bug: 79883349" --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 34ef0a01..daba697d 100755 --- a/device.mk +++ b/device.mk @@ -23,7 +23,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=13 + ro.vendor.build.svn=14 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From bda628fe83f10a29f6293e259c9ddb808c28d68d Mon Sep 17 00:00:00 2001 From: Petri Gynther Date: Wed, 16 May 2018 20:36:53 -0700 Subject: [PATCH 289/300] wahoo: sepolicy: add missing vendor_bluetooth_prop Add missing vendor_bluetooth_prop: persist.service.bdroid.snooplog Usage: 1. vendor/qcom/sdm845/proprietary/bluetooth/ hidl_transport/bt/1.0/default/logger.cpp: property_get("persist.service.bdroid.snooplog", ...) 2. init.hardware.diag.rc.userdebug: on property:sys.logger.bluetooth=true setprop persist.service.bdroid.snooplog true on property:sys.logger.bluetooth=false setprop persist.service.bdroid.snooplog false Bug: 77633703 Test: Manual Change-Id: I781fe8b8b5937a706eccc55f027255ccebe67a5c --- sepolicy/vendor/property_contexts | 1 + 1 file changed, 1 insertion(+) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 7f364b38..69450233 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -195,6 +195,7 @@ persist.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 persist.bluetooth.csoc.cnt u:object_r:vendor_bluetooth_prop:s0 persist.service.bdroid.fwsnoop u:object_r:vendor_bluetooth_prop:s0 persist.service.bdroid.sibs u:object_r:vendor_bluetooth_prop:s0 +persist.service.bdroid.snooplog u:object_r:vendor_bluetooth_prop:s0 persist.service.bdroid.soclog u:object_r:vendor_bluetooth_prop:s0 persist.service.bdroid.ssrlvl u:object_r:vendor_bluetooth_prop:s0 ro.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 From 11540c9dbe713a06dd99fe4e74d4c1bc8ce58f6b Mon Sep 17 00:00:00 2001 From: Artem Iglikov Date: Fri, 4 May 2018 13:32:50 +0100 Subject: [PATCH 290/300] Add call logs and sms permissions for pixelmigrate Bug: 79186791 Bug: 79240969 Bug: 79532995 Test: n/a Change-Id: Iac6f75a3fbac15caafefc8fa70755316ed6e14b2 --- default-permissions.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/default-permissions.xml b/default-permissions.xml index a2993ec7..7c653b51 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -49,6 +49,12 @@ + + + + + + Date: Sat, 19 May 2018 19:01:21 -0700 Subject: [PATCH 291/300] Bring perfd boot_complete signal back Bug: 79879586 Test: Build Change-Id: I0faef27bd94d6ee48971b723f9a5473a6258fbcb --- init.power.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.power.sh b/init.power.sh index 586608d0..949eae70 100755 --- a/init.power.sh +++ b/init.power.sh @@ -41,6 +41,9 @@ write /sys/class/devfreq/soc:qcom,mincpubw/governor "cpufreq" # write $memlat/mem_latency/ratio_ceil 400 #done +# Signal perfd that boot has completed +setprop sys.post_boot.parsed 1 + # On debuggable builds, enable console_suspend if uart is enabled to save power # Otherwise, disable console_suspend to get better logging for kernel crashes if [[ $(getprop ro.debuggable) == "1" && ! -e /sys/class/tty/ttyMSM0 ]] From 5cb44010b24e23f7839848c97e575f70113adcab Mon Sep 17 00:00:00 2001 From: Paul Crowley Date: Mon, 21 May 2018 12:01:22 -0700 Subject: [PATCH 292/300] Remove device-specific metadata policy that's now in platform. Bug: 79781913 Test: compiles Change-Id: Ie632d1a4c44f491415ae9bb2ceb1264f0cfa5096 --- BoardConfig.mk | 2 +- sepolicy/vendor/file_contexts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index fbf60e28..b502a35b 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -79,7 +79,7 @@ TARGET_COPY_OUT_VENDOR := vendor # Install odex files into the other system image BOARD_USES_SYSTEM_OTHER_ODEX := true -BOARD_ROOT_EXTRA_FOLDERS := persist firmware metadata +BOARD_ROOT_EXTRA_FOLDERS := persist firmware BOARD_SEPOLICY_DIRS += device/google/wahoo/sepolicy/vendor BOARD_PLAT_PUBLIC_SEPOLICY_DIR := device/google/wahoo/sepolicy/public diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index c8141e48..1649712a 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -285,8 +285,5 @@ /persist/time(/.*)? u:object_r:persist_time_file:s0 /persist/battery(/.*)? u:object_r:persist_battery_file:s0 -/metadata u:object_r:rootfs:s0 -/metadata/.* u:object_r:vold_data_file:s0 - # b/70518189 vDSO experiments /sys/module/vdso/parameters u:object_r:sysfs_vdso:s0 From 906e91433b7b849219d859dae6fe71f32d76c842 Mon Sep 17 00:00:00 2001 From: Petri Gynther Date: Fri, 11 May 2018 16:35:43 -0700 Subject: [PATCH 293/300] Adjust for QCOM BT HAL property name changes Bug: 36513925 Test: Manual Bluetooth test Change-Id: I492fde56b7f10395869ac32e8d6dd20268ce5230 --- device.mk | 14 ++++++++++---- init.hardware.diag.rc.userdebug | 12 ++++++------ sepolicy/vendor/property_contexts | 19 +++++++++---------- system.prop | 10 ---------- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/device.mk b/device.mk index 4454eb3a..8690df31 100755 --- a/device.mk +++ b/device.mk @@ -345,9 +345,18 @@ PRODUCT_PACKAGES += \ android.hardware.bluetooth@1.0-service-qti \ android.hardware.bluetooth@1.0-service-qti.rc +# Bluetooth SoC +PRODUCT_PROPERTY_OVERRIDES += \ + vendor.qcom.bluetooth.soc=cherokee + # Property for loading BDA from bdaddress module in kernel PRODUCT_PROPERTY_OVERRIDES += \ - ro.bt.bdaddr_path=/sys/module/bdaddress/parameters/bdaddress + ro.vendor.bt.bdaddr_path=/sys/module/bdaddress/parameters/bdaddress + +# Bluetooth WiPower +PRODUCT_PROPERTY_OVERRIDES += \ + ro.vendor.bluetooth.emb_wp_mode=false \ + ro.vendor.bluetooth.wipower=false # DRM HAL PRODUCT_PACKAGES += \ @@ -609,9 +618,6 @@ PRODUCT_ENFORCE_RRO_TARGETS := framework-res PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapgrowthlimit=256m -PRODUCT_PROPERTY_OVERRIDES += \ - qcom.bluetooth.soc=cherokee - # Privileged permissions whitelist PRODUCT_COPY_FILES += \ device/google/wahoo/permissions/privapp-permissions-aosp_wahoo.xml:system/etc/permissions/privapp-permissions-aosp_wahoo.xml diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug index 8db3cec6..6977fc63 100644 --- a/init.hardware.diag.rc.userdebug +++ b/init.hardware.diag.rc.userdebug @@ -80,18 +80,18 @@ on property:vendor.debug.ramdump.force_crash=true write /proc/sysrq-trigger "c" on property:sys.logger.bluetooth=true - setprop persist.service.bdroid.snooplog true - setprop persist.service.bdroid.fwsnoop true + setprop persist.vendor.service.bdroid.snooplog true + setprop persist.vendor.service.bdroid.fwsnoop true on property:sys.logger.bluetooth=false - setprop persist.service.bdroid.snooplog false - setprop persist.service.bdroid.fwsnoop false + setprop persist.vendor.service.bdroid.snooplog false + setprop persist.vendor.service.bdroid.fwsnoop false on property:persist.bluetooth.btsnoopenable=true - setprop persist.service.bdroid.soclog true + setprop persist.vendor.service.bdroid.soclog true on property:persist.bluetooth.btsnoopenable=false - setprop persist.service.bdroid.soclog false + setprop persist.vendor.service.bdroid.soclog false on property:vendor.usb.config=* start usbd diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 69450233..a10b6762 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -191,16 +191,15 @@ persist.radio.VT_ENABLE u:object_r:vendor_radio_prop:s0 persist.radio.VT_HYBRID_ENABLE u:object_r:vendor_radio_prop:s0 # vendor_bluetooth_prop -persist.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 -persist.bluetooth.csoc.cnt u:object_r:vendor_bluetooth_prop:s0 -persist.service.bdroid.fwsnoop u:object_r:vendor_bluetooth_prop:s0 -persist.service.bdroid.sibs u:object_r:vendor_bluetooth_prop:s0 -persist.service.bdroid.snooplog u:object_r:vendor_bluetooth_prop:s0 -persist.service.bdroid.soclog u:object_r:vendor_bluetooth_prop:s0 -persist.service.bdroid.ssrlvl u:object_r:vendor_bluetooth_prop:s0 -ro.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 -ro.bluetooth.emb_wp_mode u:object_r:vendor_bluetooth_prop:s0 -ro.bluetooth.wipower u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.bluetooth.csoc.cnt u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.fwsnoop u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.sibs u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.snooplog u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.soclog u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.ssrlvl u:object_r:vendor_bluetooth_prop:s0 +ro.vendor.bluetooth.emb_wp_mode u:object_r:vendor_bluetooth_prop:s0 +ro.vendor.bluetooth.wipower u:object_r:vendor_bluetooth_prop:s0 # persist_nfc_prop persist.nfc. u:object_r:persist_nfc_prop:s0 diff --git a/system.prop b/system.prop index 98af2088..20d70340 100644 --- a/system.prop +++ b/system.prop @@ -69,13 +69,3 @@ persist.data.df.dev_name=rmnet_usb0 #ro.use_data_netmgrd=true persist.data.netmgrd.qos.enable=true persist.data.mode=concurrent - -#system prop for A4WP profile support -ro.bluetooth.a4wp=false - -#system prop for wipower support -ro.bluetooth.emb_wp_mode=false -ro.bluetooth.wipower=false - -# Property for loading BDA from bdaddress module in kernel -ro.bt.bdaddr_path=/sys/module/bdaddress/parameters/bdaddress From 484b83c96ce47ad06de204702b0b27599c818134 Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Mon, 21 May 2018 17:53:52 -0700 Subject: [PATCH 294/300] sepolicy: cleanup tel_mon_prop as its no more used Test: Verified connectivity monitor app works without denial Bug: 79255514 Change-Id: Id8ebac2f3453a8fc175a91d60caad173734aa6cd --- sepolicy/vendor/property.te | 1 - sepolicy/vendor/radio.te | 1 - sepolicy/vendor/rild.te | 1 - sepolicy/vendor/system_app.te | 4 ---- 4 files changed, 7 deletions(-) diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index cb25a31e..7651a235 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -13,7 +13,6 @@ type tee_listener_prop, property_type; type wc_prop, property_type; type thermal_prop, property_type; type modem_diag_prop, property_type; -type tel_mon_prop, property_type; type sys_time_prop, property_type; type atfwd_start_prop, property_type; type bluetooth_log_prop, property_type; diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te index b287bbbb..30a7838f 100644 --- a/sepolicy/vendor/radio.te +++ b/sepolicy/vendor/radio.te @@ -1,6 +1,5 @@ get_prop(radio, ims_prop) typeattribute radio system_writes_vendor_properties_violators; -userdebug_or_eng(`set_prop(radio, tel_mon_prop)') allow radio qmuxd_socket:dir search; allow radio qmuxd_socket:sock_file write; diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te index c704c128..609bf2f7 100644 --- a/sepolicy/vendor/rild.te +++ b/sepolicy/vendor/rild.te @@ -28,7 +28,6 @@ dontaudit rild diag_device:chr_file rw_file_perms; allow rild radio_vendor_data_file:dir rw_dir_perms; allow rild radio_vendor_data_file:file create_file_perms; -get_prop(rild, tel_mon_prop) get_prop(rild, vendor_radio_prop) # Allow vendor native process to read the proc file of xt_qtaguid diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te index c1ede120..61cc5338 100644 --- a/sepolicy/vendor/system_app.te +++ b/sepolicy/vendor/system_app.te @@ -1,7 +1,3 @@ -# Needed by Settings app's TelephonyMonitorPreferenceController, available only on a subset of -# userdebug and eng devices -userdebug_or_eng(`set_prop(system_app, tel_mon_prop)') - # Needed by Settings app's CameraHalHdrplusPreferenceController typeattribute system_app system_writes_vendor_properties_violators; set_prop(system_app, camera_prop) From d804dac1844b5a79e9b2d6ea617a12ae345847a0 Mon Sep 17 00:00:00 2001 From: Hung-ying Tyan Date: Wed, 23 May 2018 23:59:13 +0800 Subject: [PATCH 295/300] configstore: uprev configstore (1.0 -> 1.1) Bug: 69691076 Test: Built and tested on walleye Change-Id: I16f06827ef83711c9e29698540ffcec658081fda --- init.hardware.rc | 2 +- manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/init.hardware.rc b/init.hardware.rc index 11755f1a..5fcd03ad 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -202,7 +202,7 @@ on late-fs start surfaceflinger start bootanim start vendor.hwcomposer-2-1 - start vendor.configstore-hal-1-0 + start vendor.configstore-hal start vendor.gralloc-2-0 # Wait for hwservicemanager ready since fsck might be triggered in mount_all --late diff --git a/manifest.xml b/manifest.xml index a1a0322a..2409a728 100644 --- a/manifest.xml +++ b/manifest.xml @@ -65,7 +65,7 @@ android.hardware.configstore hwbinder - 1.0 + 1.1 ISurfaceFlingerConfigs default From da2016576ae6d4ded0408f632d742a0a1a4b44ab Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Wed, 23 May 2018 10:01:28 +0900 Subject: [PATCH 296/300] Fix access denials for libEGL props vendor.debug.egl.changepixelformat and vendor.debug.prerotation.disable are used by libEGL (one of same-process HALs). So they should be public-readable because libEGL can be loaded from almost everywhere. Bug: 80135368 Test: succeeded building and tested with taimen Change-Id: I2e9c0809a4868329ab76a94800a144283f523579 Merged-In: I2e9c0809a4868329ab76a94800a144283f523579 (cherry picked from commit 52ca941f7a0235cc07f7df606f36c46e02eeff14) --- sepolicy/vendor/property_contexts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index a10b6762..80239a48 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -46,6 +46,8 @@ ro.boot.ddrsize u:object_r:public_vendor_default_prop:s0 ro.boot.hardware.ddr u:object_r:public_vendor_default_prop:s0 ro.boot.hardware.ufs u:object_r:public_vendor_default_prop:s0 ro.qcom.adreno. u:object_r:public_vendor_default_prop:s0 +vendor.debug.egl.changepixelformat u:object_r:public_vendor_default_prop:s0 +vendor.debug.prerotation.disable u:object_r:public_vendor_default_prop:s0 # public_vendor_system_prop # They are public_vendor_system_props for vendor-specific extension. From 57b429087cec9cb63e5de8e31cd79216adbab746 Mon Sep 17 00:00:00 2001 From: Adam Seaton Date: Fri, 25 May 2018 09:30:22 -0700 Subject: [PATCH 297/300] Update SVN to 17 for Pi release Bug:80225397 Anticipating the need for SVN to be set to 15/16 for backpocket OC-MR1 builds in August, setting this to 17. --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 8690df31..7e4864c6 100755 --- a/device.mk +++ b/device.mk @@ -36,7 +36,7 @@ PRODUCT_COPY_FILES += \ # Set the SVN for the targeted MR release PRODUCT_PROPERTY_OVERRIDES += \ - ro.vendor.build.svn=14 + ro.vendor.build.svn=17 # Enforce privapp-permissions whitelist PRODUCT_PROPERTY_OVERRIDES += \ From 42daa6d00dfe75d9ab92a33d2c314534827b51cd Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 31 May 2018 12:27:12 -0700 Subject: [PATCH 298/300] con_monitor is hal_power client Before it had permissions to use hal_power_hwservice, but it didn't declare itself to be an hal_power_client. Bug: 80319537 Test: boot + sanity Change-Id: I7d82dd2d5692aa1efe75146beb567d166d3b4824 --- sepolicy/vendor/con_monitor.te | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te index dd760518..8730e566 100644 --- a/sepolicy/vendor/con_monitor.te +++ b/sepolicy/vendor/con_monitor.te @@ -7,7 +7,6 @@ set_prop(con_monitor_app, radio_prop) allow con_monitor_app app_api_service:service_manager find; allow con_monitor_app radio_vendor_data_file:dir rw_dir_perms; allow con_monitor_app radio_vendor_data_file:file create_file_perms; -allow con_monitor_app hal_power_hwservice:hwservice_manager find; -allow con_monitor_app hal_power_default:binder call; allow con_monitor_app radio_service:service_manager find; allow con_monitor_app audioserver_service:service_manager find; +hal_client_domain(con_monitor_app, hal_power); \ No newline at end of file From 591308e3bfe14aebeb380e946fa850ef034fed3b Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Tue, 5 Jun 2018 09:26:02 +0900 Subject: [PATCH 299/300] Fix access denials for Render script props ro.vendor.graphics.memory and vendor.debug.rs.* are used by Render script (one of same-process HALs). So they should be public-readable because Render script can be loaded from almost everywhere. Bug: 109653662 Test: succeeded building and tested with taimen Change-Id: I5c6d6dd2f2406feaec60c965a763215c4a064f52 --- sepolicy/vendor/property_contexts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 80239a48..112fcfa4 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -46,8 +46,10 @@ ro.boot.ddrsize u:object_r:public_vendor_default_prop:s0 ro.boot.hardware.ddr u:object_r:public_vendor_default_prop:s0 ro.boot.hardware.ufs u:object_r:public_vendor_default_prop:s0 ro.qcom.adreno. u:object_r:public_vendor_default_prop:s0 +ro.vendor.graphics.memory u:object_r:public_vendor_default_prop:s0 vendor.debug.egl.changepixelformat u:object_r:public_vendor_default_prop:s0 vendor.debug.prerotation.disable u:object_r:public_vendor_default_prop:s0 +vendor.debug.rs. u:object_r:public_vendor_default_prop:s0 # public_vendor_system_prop # They are public_vendor_system_props for vendor-specific extension. From 6799a52d08e1fad1073e62ad0020416bb8f76cdd Mon Sep 17 00:00:00 2001 From: Stanley Tng Date: Thu, 7 Jun 2018 11:57:37 -0700 Subject: [PATCH 300/300] Disable the Hearing Aid profile for Pixel 2 Bug: 109880029 Test: Compile Change-Id: I7c641444e85be61f8737fa7172ef7a0c849e79f2 --- overlay/packages/apps/Bluetooth/res/values/config.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/overlay/packages/apps/Bluetooth/res/values/config.xml b/overlay/packages/apps/Bluetooth/res/values/config.xml index e4031055..6db14c05 100644 --- a/overlay/packages/apps/Bluetooth/res/values/config.xml +++ b/overlay/packages/apps/Bluetooth/res/values/config.xml @@ -29,5 +29,4 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> true - true