Merge "Taimen/Walleye: Disable sdm rotator downscaler" into pi-dev
diff --git a/device.mk b/device.mk
index df66d5d..f69c5b8 100755
--- a/device.mk
+++ b/device.mk
@@ -650,3 +650,8 @@
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
diff --git a/gps.conf b/gps.conf
index 54482b1..4e8fffa 100644
--- a/gps.conf
+++ b/gps.conf
@@ -26,7 +26,7 @@
# 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
diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug
index 1f44c84..8db3cec 100644
--- a/init.hardware.diag.rc.userdebug
+++ b/init.hardware.diag.rc.userdebug
@@ -92,3 +92,9 @@
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/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te
index 9515507..26d29cf 100644
--- a/sepolicy/vendor/hal_dumpstate_impl.te
+++ b/sepolicy/vendor/hal_dumpstate_impl.te
@@ -54,7 +54,7 @@
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;
diff --git a/sepolicy/vendor/hal_usb_impl.te b/sepolicy/vendor/hal_usb_impl.te
index ddbf8f3..98587dc 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_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 46874da..c5262ba 100644
--- a/sepolicy/vendor/logger_app.te
+++ b/sepolicy/vendor/logger_app.te
@@ -19,4 +19,6 @@
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 909b57c..ced04a3 100644
--- a/sepolicy/vendor/property.te
+++ b/sepolicy/vendor/property.te
@@ -21,3 +21,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;
diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts
index be8a577..266ffbd 100644
--- a/sepolicy/vendor/property_contexts
+++ b/sepolicy/vendor/property_contexts
@@ -30,6 +30,8 @@
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.
diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h
index be3ae86..46fc834 100644
--- a/thermal/thermal-helper.h
+++ b/thermal/thermal-helper.h
@@ -46,29 +46,30 @@
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;
diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp
index 3ba0394..5644745 100644
--- a/usb/UsbGadget.cpp
+++ b/usb/UsbGadget.cpp
@@ -32,6 +32,7 @@
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 @@
#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 @@
}
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 @@
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<uint64_t>(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<uint64_t>(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<uint64_t>(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<uint64_t>(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<uint64_t>(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<uint64_t>(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:
@@ -343,7 +420,6 @@
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.
@@ -369,7 +445,7 @@
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) {
@@ -382,11 +458,19 @@
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<char *>(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 ef2ea4d..9a2c4dd 100644
--- a/usb/UsbGadget.h
+++ b/usb/UsbGadget.h
@@ -23,6 +23,7 @@
#include <android/hardware/usb/gadget/1.0/IUsbGadget.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include <string>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <thread>
@@ -40,6 +41,7 @@
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;