summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-11 15:25:33 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-11 15:25:33 +0000
commit3642ebcb915d2fdf5642c9d12bb2c53be1844314 (patch)
tree48823b5f79cce2cb654932dd59d9e9a993017c08
parent6e31c7c38aeabbc01cfbf5638bf5cd9a4f68afa7 (diff)
parented0143523b375b816b7ffa388903e61f1d66b6cc (diff)
downloadbarbet-android13-frc-scheduling-release.tar.gz
Snap for 8712302 from ed0143523b375b816b7ffa388903e61f1d66b6cc to tm-frc-scheduling-releaset_frc_sch_330443040t_frc_sch_330443010android13-frc-scheduling-release
Change-Id: Ic9cf044f331fb31ef180cd973fe792145095e65a
-rw-r--r--default-permissions.xml5
-rw-r--r--device-barbet.mk2
-rw-r--r--usb/usb/Usb.cpp42
-rw-r--r--usb/usb/Usb.h2
4 files changed, 27 insertions, 24 deletions
diff --git a/default-permissions.xml b/default-permissions.xml
index 53d515c..4df0673 100644
--- a/default-permissions.xml
+++ b/default-permissions.xml
@@ -123,4 +123,9 @@
<!-- Notifications -->
<permission name="android.permission.POST_NOTIFICATIONS" fixed="true"/>
</exception>
+ <exception
+ package="com.google.android.apps.turbo">
+ <!-- Notifications -->
+ <permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
+ </exception>
</exceptions>
diff --git a/device-barbet.mk b/device-barbet.mk
index a73b1ad..df66b56 100644
--- a/device-barbet.mk
+++ b/device-barbet.mk
@@ -38,7 +38,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/launch_with_ven
# Increment the SVN for any official public releases
PRODUCT_PROPERTY_OVERRIDES += \
- ro.vendor.build.svn=23
+ ro.vendor.build.svn=25
# Enable watchdog timeout loop breaker.
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp
index 6df1e9f..ed358cd 100644
--- a/usb/usb/Usb.cpp
+++ b/usb/usb/Usb.cpp
@@ -61,40 +61,41 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
int64_t in_transactionId) {
bool result = true;
std::vector<PortStatus> currentPortStatus;
+ string pullup;
ALOGI("Userspace turn %s USB data signaling. opID:%ld", in_enable ? "on" : "off",
in_transactionId);
if (in_enable) {
- if (!WriteStringToFile("1", USB_DATA_PATH)) {
- ALOGE("Not able to turn on usb connection notification");
- result = false;
+ if (ReadFileToString(PULLUP_PATH, &pullup)) {
+ pullup = Trim(pullup);
+ if (pullup != kGadgetName) {
+ if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) {
+ ALOGE("Gadget cannot be pulled up");
+ result = false;
+ }
+ }
}
- if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) {
- ALOGE("Gadget cannot be pulled up");
+ if (!WriteStringToFile("1", USB_DATA_PATH)) {
+ ALOGE("Not able to turn on usb connection notification");
result = false;
}
} else {
- if (!WriteStringToFile("1", ID_PATH)) {
- ALOGE("Not able to turn off host mode");
- result = false;
- }
-
- if (!WriteStringToFile("0", VBUS_PATH)) {
- ALOGE("Not able to set Vbus state");
- result = false;
+ if (ReadFileToString(PULLUP_PATH, &pullup)) {
+ pullup = Trim(pullup);
+ if (pullup == kGadgetName) {
+ if (!WriteStringToFile("none", PULLUP_PATH)) {
+ ALOGE("Gadget cannot be pulled down");
+ result = false;
+ }
+ }
}
if (!WriteStringToFile("0", USB_DATA_PATH)) {
ALOGE("Not able to turn on usb connection notification");
result = false;
}
-
- if (!WriteStringToFile("none", PULLUP_PATH)) {
- ALOGE("Gadget cannot be pulled down");
- result = false;
- }
}
if (result) {
@@ -367,7 +368,8 @@ Usb::Usb()
: mLock(PTHREAD_MUTEX_INITIALIZER),
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
- mPartnerUp(false) {
+ mPartnerUp(false),
+ mUsbDataEnabled(true) {
pthread_condattr_t attr;
if (pthread_condattr_init(&attr)) {
ALOGE("pthread_condattr_init failed: %s", strerror(errno));
@@ -732,8 +734,6 @@ static void uevent_event(uint32_t /*epevents*/, struct data *payload) {
pthread_cond_signal(&payload->usb->mPartnerCV);
pthread_mutex_unlock(&payload->usb->mPartnerLock);
} else if (!strncmp(cp, "DEVTYPE=typec_", strlen("DEVTYPE=typec_")) ||
- !strncmp(cp, "DRIVER=max77759tcpc",
- strlen("DRIVER=max77759tcpc")) ||
!strncmp(cp, "POWER_SUPPLY_MOISTURE_DETECTED",
strlen("POWER_SUPPLY_MOISTURE_DETECTED"))) {
std::vector<PortStatus> currentPortStatus;
diff --git a/usb/usb/Usb.h b/usb/usb/Usb.h
index 94fbecb..36a23bc 100644
--- a/usb/usb/Usb.h
+++ b/usb/usb/Usb.h
@@ -43,11 +43,9 @@ using ::std::shared_ptr;
using ::std::string;
constexpr char kGadgetName[] = "a600000.dwc3";
-#define ID_PATH SOC_PATH "id"
#define PULLUP_PATH "/config/usb_gadget/g1/UDC"
#define SOC_PATH "/sys/devices/platform/soc/a600000.ssusb/"
#define USB_DATA_PATH SOC_PATH "usb_data_enabled"
-#define VBUS_PATH SOC_PATH "b_sess"
#define USB_POWER_LIMIT_PATH "/sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/"
#define SINK_CURRENT_LIMIT_PATH USB_POWER_LIMIT_PATH "usb_limit_sink_current"