Do not moisture detection when uart is enabled.

Bug: 128534822
Test: Tested with mock circuit. Moisture detection does not
reenable when serial uart is enabled.

Change-Id: Ieb85cb7843bae9bfb5aef79f7d2058b79b7823e6
(cherry picked from commit ccc09ed8a9b826d56f685d0e618e1f3cc0403c12)
This commit is contained in:
Badhri Jagan Sridharan
2019-03-22 14:33:32 -07:00
committed by Cyan_Hsieh
parent 0168619fcc
commit 9b4f79057d

View File

@@ -17,6 +17,7 @@
#define LOG_TAG "android.hardware.usb@1.2-service.sunfish"
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <assert.h>
#include <dirent.h>
#include <pthread.h>
@@ -35,6 +36,8 @@
#include "Usb.h"
using android::base::GetProperty;
namespace android {
namespace hardware {
namespace usb {
@@ -129,7 +132,10 @@ Status queryMoistureDetectionStatus(hidl_vec<PortStatus> *currentPortStatus_1_2)
Return<void> Usb::enableContaminantPresenceDetection(const hidl_string & /*portName*/,
bool enable) {
writeFile(kEnabledPath, enable ? "1" : "0");
std::string status = GetProperty("init.svc.console", "");
if (status != "running")
writeFile(kEnabledPath, enable ? "1" : "0");
hidl_vec<PortStatus> currentPortStatus_1_2;
queryVersionHelper(this, &currentPortStatus_1_2);