Merge "Fix USB power regression when connecting USB headset during phone/voip call." into udc-dev am: 37ccbe7384

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23810764

Change-Id: I0be1406ea348ba691e2662affee5b771d32770e7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-06-26 19:09:57 +00:00
committed by Automerger Merge Worker

View File

@@ -59,6 +59,8 @@ public final class UsbAlsaDevice {
private String mDeviceName = ""; private String mDeviceName = "";
private String mDeviceDescription = ""; private String mDeviceDescription = "";
private boolean mHasJackDetect = true;
public UsbAlsaDevice(IAudioService audioService, int card, int device, String deviceAddress, public UsbAlsaDevice(IAudioService audioService, int card, int device, String deviceAddress,
boolean hasOutput, boolean hasInput, boolean hasOutput, boolean hasInput,
boolean isInputHeadset, boolean isOutputHeadset, boolean isDock) { boolean isInputHeadset, boolean isOutputHeadset, boolean isDock) {
@@ -168,8 +170,14 @@ public final class UsbAlsaDevice {
if (mJackDetector != null) { if (mJackDetector != null) {
return; return;
} }
if (!mHasJackDetect) {
return;
}
// If no jack detect capabilities exist, mJackDetector will be null. // If no jack detect capabilities exist, mJackDetector will be null.
mJackDetector = UsbAlsaJackDetector.startJackDetect(this); mJackDetector = UsbAlsaJackDetector.startJackDetect(this);
if (mJackDetector == null) {
mHasJackDetect = false;
}
} }
/** Stops a jack-detection thread. */ /** Stops a jack-detection thread. */
@@ -182,8 +190,8 @@ public final class UsbAlsaDevice {
/** Start using this device as the selected USB Audio Device. */ /** Start using this device as the selected USB Audio Device. */
public synchronized void start() { public synchronized void start() {
startInput();
startOutput(); startOutput();
startInput();
} }
/** Start using this device as the selected USB input device. */ /** 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. */ /** Stop using this device as the selected USB Audio Device. */
public synchronized void stop() { public synchronized void stop() {
stopInput();
stopOutput(); stopOutput();
stopInput();
} }
/** Stop using this device as the selected USB input device. */ /** Stop using this device as the selected USB input device. */