return ScopedAStatus::ok();
}
-Status queryMoistureDetectionStatus(android::hardware::usb::Usb *usb,
- std::vector<PortStatus> *currentPortStatus) {
+Status queryMoistureDetectionStatus(std::vector<PortStatus> *currentPortStatus) {
string enabled, status, path, DetectedPath;
for (int i = 0; i < currentPortStatus->size(); i++) {
(*currentPortStatus)[i].supportsEnableContaminantPresenceDetection = true;
(*currentPortStatus)[i].supportsEnableContaminantPresenceProtection = false;
- if (usb->mMoistureDetectionEnabled) {
+ if (GetProperty(DISABLE_CONTAMINANT_DETECTION, "") != "true") {
if (readFile(CONTAMINANT_DETECTION_PATH, &status)) {
ALOGE("Failed to open %s", CONTAMINANT_DETECTION_PATH);
return Status::ERROR;
: mLock(PTHREAD_MUTEX_INITIALIZER),
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
- mPartnerUp(false),
- mMoistureDetectionEnabled(false)
+ mPartnerUp(false)
{
pthread_condattr_t attr;
if (pthread_condattr_init(&attr)) {
Status status;
pthread_mutex_lock(&usb->mLock);
status = getPortStatusHelper(currentPortStatus);
- queryMoistureDetectionStatus(usb, currentPortStatus);
+ queryMoistureDetectionStatus(currentPortStatus);
if (usb->mCallback != NULL) {
ScopedAStatus ret = usb->mCallback->notifyPortStatusChange(*currentPortStatus,
status);
}
ScopedAStatus Usb::enableContaminantPresenceDetection(const string& in_portName,
- bool in_enable, int64_t in_transactionId) {
+ bool /* in_enable */, int64_t in_transactionId) {
std::vector<PortStatus> currentPortStatus;
std::string disable = GetProperty(DISABLE_CONTAMINANT_DETECTION, "");
- if (disable != "true")
- mMoistureDetectionEnabled = in_enable;
-
pthread_mutex_lock(&mLock);
if (mCallback != NULL) {
ScopedAStatus ret = mCallback->notifyContaminantEnabledStatus(
- in_portName, false, Status::SUCCESS, in_transactionId);
+ in_portName, true, Status::SUCCESS, in_transactionId);
if (!ret.isOk())
ALOGE("enableContaminantPresenceDetection error %s", ret.getDescription().c_str());
} else {