summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2023-06-26 19:53:17 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-06-26 19:53:17 +0000
commitec485c146425626b3891c47ad7a456daff1da08e (patch)
treeeba06dd7977dfb324f887c034c169e3ab1b8b982
parent6813a0f6dab5e7c3a50dc516aa6c463b230c6bf2 (diff)
parent1243723588d72b1a7fb0f5dc93468a16b23667ea (diff)
Merge "Fix USB power regression when connecting USB headset during phone/voip call." into udc-dev am: 37ccbe7384 am: 1243723588
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23810764 Change-Id: I16186f80a325618e03d32d838b21b940a2ebb56a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/usb/java/com/android/server/usb/UsbAlsaDevice.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbAlsaDevice.java b/services/usb/java/com/android/server/usb/UsbAlsaDevice.java
index 7fe8582f96de..c508fa968b14 100644
--- a/services/usb/java/com/android/server/usb/UsbAlsaDevice.java
+++ b/services/usb/java/com/android/server/usb/UsbAlsaDevice.java
@@ -59,6 +59,8 @@ public final class UsbAlsaDevice {
private String mDeviceName = "";
private String mDeviceDescription = "";
+ private boolean mHasJackDetect = true;
+
public UsbAlsaDevice(IAudioService audioService, int card, int device, String deviceAddress,
boolean hasOutput, boolean hasInput,
boolean isInputHeadset, boolean isOutputHeadset, boolean isDock) {
@@ -168,8 +170,14 @@ public final class UsbAlsaDevice {
if (mJackDetector != null) {
return;
}
+ if (!mHasJackDetect) {
+ return;
+ }
// If no jack detect capabilities exist, mJackDetector will be null.
mJackDetector = UsbAlsaJackDetector.startJackDetect(this);
+ if (mJackDetector == null) {
+ mHasJackDetect = false;
+ }
}
/** Stops a jack-detection thread. */
@@ -182,8 +190,8 @@ public final class UsbAlsaDevice {
/** Start using this device as the selected USB Audio Device. */
public synchronized void start() {
- startInput();
startOutput();
+ startInput();
}
/** Start using this device as the selected USB input device. */
@@ -208,8 +216,8 @@ public final class UsbAlsaDevice {
/** Stop using this device as the selected USB Audio Device. */
public synchronized void stop() {
- stopInput();
stopOutput();
+ stopInput();
}
/** Stop using this device as the selected USB input device. */