Snap for 12748980 from 06525b3713
to 25Q1-release
Change-Id: I6e162073f99f1874894d2ab0f88fff0050973a19
This commit is contained in:
commit
dc522b0c8d
9 changed files with 78 additions and 61 deletions
|
@ -41,9 +41,15 @@ BOARD_KERNEL_CMDLINE += swiotlb=noforce
|
||||||
BOARD_KERNEL_CMDLINE += disable_dma32=on
|
BOARD_KERNEL_CMDLINE += disable_dma32=on
|
||||||
BOARD_KERNEL_CMDLINE += sysctl.kernel.sched_pelt_multiplier=4
|
BOARD_KERNEL_CMDLINE += sysctl.kernel.sched_pelt_multiplier=4
|
||||||
|
|
||||||
|
# Normal (non-_fullmte) builds should disable kasan
|
||||||
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
|
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
|
||||||
ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
|
|
||||||
BOARD_KERNEL_CMDLINE += kasan=off
|
BOARD_KERNEL_CMDLINE += kasan=off
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Enable a limited subset of MTE for "normal" (non-_fullmte) eng builds.
|
||||||
|
# Don't touch any settings for _fullmte builds. They are set somewhere else.
|
||||||
|
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
|
||||||
|
ifeq ($(TARGET_BUILD_VARIANT),eng)
|
||||||
BOARD_KERNEL_CMDLINE += bootloader.pixel.MTE_FORCE_ON
|
BOARD_KERNEL_CMDLINE += bootloader.pixel.MTE_FORCE_ON
|
||||||
ifeq ($(filter memtag_heap,$(SANITIZE_TARGET)),)
|
ifeq ($(filter memtag_heap,$(SANITIZE_TARGET)),)
|
||||||
SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap)
|
SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="aidl" optional="true">
|
<hal format="aidl" optional="true">
|
||||||
<name>android.hardware.vibrator</name>
|
<name>android.hardware.vibrator</name>
|
||||||
<version>2</version>
|
<version>2-3</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IVibrator</name>
|
<name>IVibrator</name>
|
||||||
<instance>dual</instance>
|
<instance>dual</instance>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="aidl" optional="true">
|
<hal format="aidl" optional="true">
|
||||||
<name>android.hardware.vibrator</name>
|
<name>android.hardware.vibrator</name>
|
||||||
<version>2</version>
|
<version>2-3</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IVibrator</name>
|
<name>IVibrator</name>
|
||||||
<instance>dual</instance>
|
<instance>dual</instance>
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
/**
|
|
||||||
* Copyright (c) 2020, The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
|
||||||
<!-- Content description of the data connection type 5G UW. [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="data_connection_5g_plus" translatable="false">5G UW</string>
|
|
||||||
</resources>
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
/**
|
|
||||||
* Copyright (c) 2020, The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
|
||||||
<!-- Content description of the data connection type 5G UW. [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="data_connection_5g_plus" translatable="false">5G UW</string>
|
|
||||||
</resources>
|
|
|
@ -117,6 +117,12 @@ constexpr char kHost1StatePath[] = "/sys/bus/usb/devices/usb1/1-0:1.0/usb1-port1
|
||||||
constexpr char kHost2UeventRegex[] =
|
constexpr char kHost2UeventRegex[] =
|
||||||
"/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.[0-9].auto/usb2/2-0:1.0";
|
"/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.[0-9].auto/usb2/2-0:1.0";
|
||||||
constexpr char kHost2StatePath[] = "/sys/bus/usb/devices/usb2/2-0:1.0/usb2-port1/state";
|
constexpr char kHost2StatePath[] = "/sys/bus/usb/devices/usb2/2-0:1.0/usb2-port1/state";
|
||||||
|
constexpr char kHubHost1UeventRegex[] =
|
||||||
|
"/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.[0-9].auto/usb1/1-1/1-1:1.0";
|
||||||
|
constexpr char kHubHost1StatePath[] = "/sys/bus/usb/devices/usb1/1-1/1-1:1.0/1-1-port1/state";
|
||||||
|
constexpr char kHubHost2UeventRegex[] =
|
||||||
|
"/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.[0-9].auto/usb1/1-1/1-1:1.0";
|
||||||
|
constexpr char kHubHost2StatePath[] = "/sys/bus/usb/devices/usb1/1-1/1-1:1.0/1-1-port2/state";
|
||||||
constexpr char kDataRolePath[] = "/sys/devices/platform/11210000.usb/new_data_role";
|
constexpr char kDataRolePath[] = "/sys/devices/platform/11210000.usb/new_data_role";
|
||||||
constexpr int kSamplingIntervalSec = 5;
|
constexpr int kSamplingIntervalSec = 5;
|
||||||
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
||||||
|
@ -536,10 +542,9 @@ static int getInternalHubUniqueId() {
|
||||||
return internalHubUniqueId;
|
return internalHubUniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Status tuneInternalHub(const char *devname, void* client_data) {
|
static Status tuneInternalHub(const char *devname, android::hardware::usb::Usb *usb) {
|
||||||
uint16_t vendorId, productId;
|
uint16_t vendorId, productId;
|
||||||
struct usb_device *device;
|
struct usb_device *device;
|
||||||
::aidl::android::hardware::usb::Usb *usb;
|
|
||||||
int value, index;
|
int value, index;
|
||||||
|
|
||||||
device = usb_device_open(devname);
|
device = usb_device_open(devname);
|
||||||
|
@ -548,7 +553,6 @@ static Status tuneInternalHub(const char *devname, void* client_data) {
|
||||||
return Status::ERROR;
|
return Status::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
usb = (::aidl::android::hardware::usb::Usb *)client_data;
|
|
||||||
value = usb->mUsbHubVendorCmdValue;
|
value = usb->mUsbHubVendorCmdValue;
|
||||||
index = usb->mUsbHubVendorCmdIndex;
|
index = usb->mUsbHubVendorCmdIndex;
|
||||||
|
|
||||||
|
@ -571,20 +575,46 @@ static Status tuneInternalHub(const char *devname, void* client_data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbDeviceRemoved(const char *devname, void* client_data) {
|
static int usbDeviceRemoved(const char *devname, void* client_data) {
|
||||||
|
string pogoEnableHub;
|
||||||
|
::aidl::android::hardware::usb::Usb *usb;
|
||||||
|
|
||||||
|
usb = (::aidl::android::hardware::usb::Usb *)client_data;
|
||||||
|
|
||||||
|
if (usb->mIntHubEnabled == true && ReadFileToString(kPogoEnableHub, &pogoEnableHub)
|
||||||
|
&& Trim(pogoEnableHub) == "0") {
|
||||||
|
ALOGI("Internal hub disabled");
|
||||||
|
usb->mIntHubEnabled = false;
|
||||||
|
usb->mUsbDataSessionMonitor.reset(new UsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath,
|
||||||
|
kHost1UeventRegex, kHost1StatePath, kHost2UeventRegex,
|
||||||
|
kHost2StatePath, kDataRolePath,
|
||||||
|
std::bind(&updatePortStatus, usb)));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbDeviceAdded(const char *devname, void* client_data) {
|
static int usbDeviceAdded(const char *devname, void* client_data) {
|
||||||
string pogoEnableHub;
|
string pogoEnableHub;
|
||||||
int uniqueId = 0;
|
int uniqueId = 0;
|
||||||
|
::aidl::android::hardware::usb::Usb *usb;
|
||||||
|
|
||||||
|
usb = (::aidl::android::hardware::usb::Usb *)client_data;
|
||||||
|
|
||||||
// Enable hub tuning when the pogo dock is connected.
|
// Enable hub tuning when the pogo dock is connected.
|
||||||
if (ReadFileToString(kPogoEnableHub, &pogoEnableHub) && Trim(pogoEnableHub) == "1") {
|
if (ReadFileToString(kPogoEnableHub, &pogoEnableHub) && Trim(pogoEnableHub) == "1") {
|
||||||
// If enable_hub is set to 1, the internal hub is the first enumearted device on bus 1 and
|
// If enable_hub is set to 1, the internal hub is the first enumearted device on bus 1 and
|
||||||
// port 1.
|
// port 1.
|
||||||
uniqueId = usb_device_get_unique_id_from_name(devname);
|
uniqueId = usb_device_get_unique_id_from_name(devname);
|
||||||
if (uniqueId == getInternalHubUniqueId())
|
if (uniqueId == getInternalHubUniqueId()) {
|
||||||
tuneInternalHub(devname, client_data);
|
ALOGI("Internal hub enabled");
|
||||||
|
usb->mIntHubEnabled = true;
|
||||||
|
tuneInternalHub(devname, usb);
|
||||||
|
usb->mUsbDataSessionMonitor.reset(new UsbDataSessionMonitor(kUdcUeventRegex,
|
||||||
|
kUdcStatePath, kHubHost1UeventRegex,
|
||||||
|
kHubHost1StatePath, kHubHost2UeventRegex,
|
||||||
|
kHubHost2StatePath, kDataRolePath,
|
||||||
|
std::bind(&updatePortStatus, usb)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -612,9 +642,9 @@ Usb::Usb()
|
||||||
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
|
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
|
||||||
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
|
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
|
||||||
mPartnerUp(false),
|
mPartnerUp(false),
|
||||||
mUsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath, kHost1UeventRegex, kHost1StatePath,
|
mUsbDataSessionMonitor(new UsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath,
|
||||||
kHost2UeventRegex, kHost2StatePath, kDataRolePath,
|
kHost1UeventRegex, kHost1StatePath, kHost2UeventRegex,
|
||||||
std::bind(&updatePortStatus, this)),
|
kHost2StatePath, kDataRolePath, std::bind(&updatePortStatus, this))),
|
||||||
mOverheat(ZoneInfo(TemperatureType::USB_PORT, kThermalZoneForTrip,
|
mOverheat(ZoneInfo(TemperatureType::USB_PORT, kThermalZoneForTrip,
|
||||||
ThrottlingSeverity::CRITICAL),
|
ThrottlingSeverity::CRITICAL),
|
||||||
{ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadPrimary,
|
{ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadPrimary,
|
||||||
|
@ -1200,7 +1230,7 @@ void queryUsbDataSession(android::hardware::usb::Usb *usb,
|
||||||
std::vector<PortStatus> *currentPortStatus) {
|
std::vector<PortStatus> *currentPortStatus) {
|
||||||
std::vector<ComplianceWarning> warnings;
|
std::vector<ComplianceWarning> warnings;
|
||||||
|
|
||||||
usb->mUsbDataSessionMonitor.getComplianceWarnings(
|
usb->mUsbDataSessionMonitor->getComplianceWarnings(
|
||||||
(*currentPortStatus)[0].currentDataRole, &warnings);
|
(*currentPortStatus)[0].currentDataRole, &warnings);
|
||||||
(*currentPortStatus)[0].complianceWarnings.insert(
|
(*currentPortStatus)[0].complianceWarnings.insert(
|
||||||
(*currentPortStatus)[0].complianceWarnings.end(),
|
(*currentPortStatus)[0].complianceWarnings.end(),
|
||||||
|
|
|
@ -126,7 +126,8 @@ struct Usb : public BnUsb {
|
||||||
bool mPartnerUp;
|
bool mPartnerUp;
|
||||||
|
|
||||||
// Report usb data session event and data incompliance warnings
|
// Report usb data session event and data incompliance warnings
|
||||||
UsbDataSessionMonitor mUsbDataSessionMonitor;
|
std::unique_ptr<UsbDataSessionMonitor> mUsbDataSessionMonitor;
|
||||||
|
bool mIntHubEnabled;
|
||||||
// Usb Overheat object for push suez event
|
// Usb Overheat object for push suez event
|
||||||
UsbOverheatEvent mOverheat;
|
UsbOverheatEvent mOverheat;
|
||||||
// Temperature when connected
|
// Temperature when connected
|
||||||
|
|
|
@ -102,6 +102,7 @@ UsbDataSessionMonitor::UsbDataSessionMonitor(
|
||||||
const std::string &dataRolePath, std::function<void()> updatePortStatusCb) {
|
const std::string &dataRolePath, std::function<void()> updatePortStatusCb) {
|
||||||
struct epoll_event ev;
|
struct epoll_event ev;
|
||||||
std::string udc;
|
std::string udc;
|
||||||
|
int pipefds[2];
|
||||||
|
|
||||||
unique_fd epollFd(epoll_create(8));
|
unique_fd epollFd(epoll_create(8));
|
||||||
if (epollFd.get() == -1) {
|
if (epollFd.get() == -1) {
|
||||||
|
@ -133,19 +134,28 @@ UsbDataSessionMonitor::UsbDataSessionMonitor(
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pipe(pipefds);
|
||||||
|
mPipefd0.reset(pipefds[0]);
|
||||||
|
mPipefd1.reset(pipefds[1]);
|
||||||
|
if (addEpollFd(epollFd, mPipefd0))
|
||||||
|
abort();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The device state file could be absent depending on the current data role
|
* The device state file could be absent depending on the current data role
|
||||||
* and driver architecture. It's ok for addEpollFile to fail here, the file
|
* and driver architecture. It's ok for addEpollFile to fail here, the file
|
||||||
* will be monitored later when its presence is detected by uevent.
|
* will be monitored later when its presence is detected by uevent.
|
||||||
*/
|
*/
|
||||||
|
mDeviceState.name = "udc";
|
||||||
mDeviceState.filePath = deviceStatePath;
|
mDeviceState.filePath = deviceStatePath;
|
||||||
mDeviceState.ueventRegex = deviceUeventRegex;
|
mDeviceState.ueventRegex = deviceUeventRegex;
|
||||||
addEpollFile(epollFd.get(), mDeviceState.filePath, mDeviceState.fd);
|
addEpollFile(epollFd.get(), mDeviceState.filePath, mDeviceState.fd);
|
||||||
|
|
||||||
|
mHost1State.name = "host1";
|
||||||
mHost1State.filePath = host1StatePath;
|
mHost1State.filePath = host1StatePath;
|
||||||
mHost1State.ueventRegex = host1UeventRegex;
|
mHost1State.ueventRegex = host1UeventRegex;
|
||||||
addEpollFile(epollFd.get(), mHost1State.filePath, mHost1State.fd);
|
addEpollFile(epollFd.get(), mHost1State.filePath, mHost1State.fd);
|
||||||
|
|
||||||
|
mHost2State.name = "host2";
|
||||||
mHost2State.filePath = host2StatePath;
|
mHost2State.filePath = host2StatePath;
|
||||||
mHost2State.ueventRegex = host2UeventRegex;
|
mHost2State.ueventRegex = host2UeventRegex;
|
||||||
addEpollFile(epollFd.get(), mHost2State.filePath, mHost2State.fd);
|
addEpollFile(epollFd.get(), mHost2State.filePath, mHost2State.fd);
|
||||||
|
@ -169,7 +179,15 @@ UsbDataSessionMonitor::UsbDataSessionMonitor(
|
||||||
usb_flags::enable_report_usb_data_compliance_warning());
|
usb_flags::enable_report_usb_data_compliance_warning());
|
||||||
}
|
}
|
||||||
|
|
||||||
UsbDataSessionMonitor::~UsbDataSessionMonitor() {}
|
UsbDataSessionMonitor::~UsbDataSessionMonitor() {
|
||||||
|
/*
|
||||||
|
* Write a character to the pipe to signal the monitor thread to exit.
|
||||||
|
* The character is not important, it can be any value.
|
||||||
|
*/
|
||||||
|
int c = 'q';
|
||||||
|
write(mPipefd1, &c, 1);
|
||||||
|
pthread_join(mMonitor, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void UsbDataSessionMonitor::reportUsbDataSessionMetrics() {
|
void UsbDataSessionMonitor::reportUsbDataSessionMetrics() {
|
||||||
std::vector<VendorUsbDataSessionEvent> events;
|
std::vector<VendorUsbDataSessionEvent> events;
|
||||||
|
@ -307,11 +325,11 @@ void UsbDataSessionMonitor::handleDeviceStateEvent(struct usbDeviceState *device
|
||||||
n = read(deviceState->fd.get(), &state, USB_STATE_MAX_LEN);
|
n = read(deviceState->fd.get(), &state, USB_STATE_MAX_LEN);
|
||||||
|
|
||||||
if (kValidStates.find(state) == kValidStates.end()) {
|
if (kValidStates.find(state) == kValidStates.end()) {
|
||||||
ALOGE("Invalid state %s", state);
|
ALOGE("Invalid state %s: %s", deviceState->name.c_str(), state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGI("Update USB device state: %s", state);
|
ALOGI("Update device state %s: %s", deviceState->name.c_str(), state);
|
||||||
|
|
||||||
deviceState->states.push_back(state);
|
deviceState->states.push_back(state);
|
||||||
deviceState->timestamps.push_back(boot_clock::now());
|
deviceState->timestamps.push_back(boot_clock::now());
|
||||||
|
@ -484,7 +502,9 @@ void *UsbDataSessionMonitor::monitorThread(void *param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int n = 0; n < nevents; ++n) {
|
for (int n = 0; n < nevents; ++n) {
|
||||||
if (events[n].data.fd == monitor->mUeventFd.get()) {
|
if (events[n].data.fd == monitor->mPipefd0.get()) {
|
||||||
|
return NULL;
|
||||||
|
} else if (events[n].data.fd == monitor->mUeventFd.get()) {
|
||||||
monitor->handleUevent();
|
monitor->handleUevent();
|
||||||
} else if (events[n].data.fd == monitor->mTimerFd.get()) {
|
} else if (events[n].data.fd == monitor->mTimerFd.get()) {
|
||||||
monitor->handleTimerEvent();
|
monitor->handleTimerEvent();
|
||||||
|
|
|
@ -64,6 +64,8 @@ class UsbDataSessionMonitor {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct usbDeviceState {
|
struct usbDeviceState {
|
||||||
|
// The name of the usb device, e.g. udc, host1, host2.
|
||||||
|
std::string name;
|
||||||
unique_fd fd;
|
unique_fd fd;
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
std::string ueventRegex;
|
std::string ueventRegex;
|
||||||
|
@ -86,6 +88,8 @@ class UsbDataSessionMonitor {
|
||||||
void updateUdcBindStatus(const std::string &devname);
|
void updateUdcBindStatus(const std::string &devname);
|
||||||
|
|
||||||
pthread_t mMonitor;
|
pthread_t mMonitor;
|
||||||
|
unique_fd mPipefd0;
|
||||||
|
unique_fd mPipefd1;
|
||||||
unique_fd mEpollFd;
|
unique_fd mEpollFd;
|
||||||
unique_fd mUeventFd;
|
unique_fd mUeventFd;
|
||||||
unique_fd mTimerFd;
|
unique_fd mTimerFd;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue