Snap for 12748980 from 06525b3713 to 25Q1-release

Change-Id: I6e162073f99f1874894d2ab0f88fff0050973a19
This commit is contained in:
Android Build Coastguard Worker 2024-12-05 00:04:49 +00:00
commit dc522b0c8d
9 changed files with 78 additions and 61 deletions

View file

@ -41,9 +41,15 @@ BOARD_KERNEL_CMDLINE += swiotlb=noforce
BOARD_KERNEL_CMDLINE += disable_dma32=on
BOARD_KERNEL_CMDLINE += sysctl.kernel.sched_pelt_multiplier=4
# Normal (non-_fullmte) builds should disable kasan
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
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
ifeq ($(filter memtag_heap,$(SANITIZE_TARGET)),)
SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap)

View file

@ -21,7 +21,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.vibrator</name>
<version>2</version>
<version>2-3</version>
<interface>
<name>IVibrator</name>
<instance>dual</instance>

View file

@ -21,7 +21,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.vibrator</name>
<version>2</version>
<version>2-3</version>
<interface>
<name>IVibrator</name>
<instance>dual</instance>

View file

@ -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>

View file

@ -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>

View file

@ -117,6 +117,12 @@ constexpr char kHost1StatePath[] = "/sys/bus/usb/devices/usb1/1-0:1.0/usb1-port1
constexpr char kHost2UeventRegex[] =
"/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 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 int kSamplingIntervalSec = 5;
void queryVersionHelper(android::hardware::usb::Usb *usb,
@ -536,10 +542,9 @@ static int getInternalHubUniqueId() {
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;
struct usb_device *device;
::aidl::android::hardware::usb::Usb *usb;
int value, index;
device = usb_device_open(devname);
@ -548,7 +553,6 @@ static Status tuneInternalHub(const char *devname, void* client_data) {
return Status::ERROR;
}
usb = (::aidl::android::hardware::usb::Usb *)client_data;
value = usb->mUsbHubVendorCmdValue;
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) {
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;
}
static int usbDeviceAdded(const char *devname, void* client_data) {
string pogoEnableHub;
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.
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
// port 1.
uniqueId = usb_device_get_unique_id_from_name(devname);
if (uniqueId == getInternalHubUniqueId())
tuneInternalHub(devname, client_data);
if (uniqueId == getInternalHubUniqueId()) {
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;
@ -612,9 +642,9 @@ Usb::Usb()
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
mPartnerUp(false),
mUsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath, kHost1UeventRegex, kHost1StatePath,
kHost2UeventRegex, kHost2StatePath, kDataRolePath,
std::bind(&updatePortStatus, this)),
mUsbDataSessionMonitor(new UsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath,
kHost1UeventRegex, kHost1StatePath, kHost2UeventRegex,
kHost2StatePath, kDataRolePath, std::bind(&updatePortStatus, this))),
mOverheat(ZoneInfo(TemperatureType::USB_PORT, kThermalZoneForTrip,
ThrottlingSeverity::CRITICAL),
{ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadPrimary,
@ -1200,7 +1230,7 @@ void queryUsbDataSession(android::hardware::usb::Usb *usb,
std::vector<PortStatus> *currentPortStatus) {
std::vector<ComplianceWarning> warnings;
usb->mUsbDataSessionMonitor.getComplianceWarnings(
usb->mUsbDataSessionMonitor->getComplianceWarnings(
(*currentPortStatus)[0].currentDataRole, &warnings);
(*currentPortStatus)[0].complianceWarnings.insert(
(*currentPortStatus)[0].complianceWarnings.end(),

View file

@ -126,7 +126,8 @@ struct Usb : public BnUsb {
bool mPartnerUp;
// 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
UsbOverheatEvent mOverheat;
// Temperature when connected

View file

@ -102,6 +102,7 @@ UsbDataSessionMonitor::UsbDataSessionMonitor(
const std::string &dataRolePath, std::function<void()> updatePortStatusCb) {
struct epoll_event ev;
std::string udc;
int pipefds[2];
unique_fd epollFd(epoll_create(8));
if (epollFd.get() == -1) {
@ -133,19 +134,28 @@ UsbDataSessionMonitor::UsbDataSessionMonitor(
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
* and driver architecture. It's ok for addEpollFile to fail here, the file
* will be monitored later when its presence is detected by uevent.
*/
mDeviceState.name = "udc";
mDeviceState.filePath = deviceStatePath;
mDeviceState.ueventRegex = deviceUeventRegex;
addEpollFile(epollFd.get(), mDeviceState.filePath, mDeviceState.fd);
mHost1State.name = "host1";
mHost1State.filePath = host1StatePath;
mHost1State.ueventRegex = host1UeventRegex;
addEpollFile(epollFd.get(), mHost1State.filePath, mHost1State.fd);
mHost2State.name = "host2";
mHost2State.filePath = host2StatePath;
mHost2State.ueventRegex = host2UeventRegex;
addEpollFile(epollFd.get(), mHost2State.filePath, mHost2State.fd);
@ -169,7 +179,15 @@ UsbDataSessionMonitor::UsbDataSessionMonitor(
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() {
std::vector<VendorUsbDataSessionEvent> events;
@ -307,11 +325,11 @@ void UsbDataSessionMonitor::handleDeviceStateEvent(struct usbDeviceState *device
n = read(deviceState->fd.get(), &state, USB_STATE_MAX_LEN);
if (kValidStates.find(state) == kValidStates.end()) {
ALOGE("Invalid state %s", state);
ALOGE("Invalid state %s: %s", deviceState->name.c_str(), state);
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->timestamps.push_back(boot_clock::now());
@ -484,7 +502,9 @@ void *UsbDataSessionMonitor::monitorThread(void *param) {
}
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();
} else if (events[n].data.fd == monitor->mTimerFd.get()) {
monitor->handleTimerEvent();

View file

@ -64,6 +64,8 @@ class UsbDataSessionMonitor {
private:
struct usbDeviceState {
// The name of the usb device, e.g. udc, host1, host2.
std::string name;
unique_fd fd;
std::string filePath;
std::string ueventRegex;
@ -86,6 +88,8 @@ class UsbDataSessionMonitor {
void updateUdcBindStatus(const std::string &devname);
pthread_t mMonitor;
unique_fd mPipefd0;
unique_fd mPipefd1;
unique_fd mEpollFd;
unique_fd mUeventFd;
unique_fd mTimerFd;