Loading services/core/java/com/android/server/audio/AudioDeviceInventory.java +0 −3 Original line number Diff line number Diff line Loading @@ -1376,9 +1376,6 @@ public class AudioDeviceInventory { case AudioSystem.DEVICE_OUT_USB_HEADSET: connType = AudioRoutesInfo.MAIN_USB; break; case AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET: connType = AudioRoutesInfo.MAIN_DOCK_SPEAKERS; break; } synchronized (mCurAudioRoutes) { Loading services/usb/java/com/android/server/usb/UsbAlsaDevice.java +18 −30 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ public final class UsbAlsaDevice { private final boolean mIsInputHeadset; private final boolean mIsOutputHeadset; private final boolean mIsDock; private boolean mSelected = false; private int mOutputState; Loading @@ -54,7 +53,7 @@ public final class UsbAlsaDevice { public UsbAlsaDevice(IAudioService audioService, int card, int device, String deviceAddress, boolean hasOutput, boolean hasInput, boolean isInputHeadset, boolean isOutputHeadset, boolean isDock) { boolean isInputHeadset, boolean isOutputHeadset) { mAudioService = audioService; mCardNum = card; mDeviceNum = device; Loading @@ -63,32 +62,31 @@ public final class UsbAlsaDevice { mHasInput = hasInput; mIsInputHeadset = isInputHeadset; mIsOutputHeadset = isOutputHeadset; mIsDock = isDock; } /** * @return the ALSA card number associated with this peripheral. * @returns the ALSA card number associated with this peripheral. */ public int getCardNum() { return mCardNum; } /** * @return the ALSA device number associated with this peripheral. * @returns the ALSA device number associated with this peripheral. */ public int getDeviceNum() { return mDeviceNum; } /** * @return the USB device device address associated with this peripheral. * @returns the USB device device address associated with this peripheral. */ public String getDeviceAddress() { return mDeviceAddress; } /** * @return the ALSA card/device address string. * @returns the ALSA card/device address string. */ public String getAlsaCardDeviceString() { if (mCardNum < 0 || mDeviceNum < 0) { Loading @@ -100,42 +98,35 @@ public final class UsbAlsaDevice { } /** * @return true if the device supports output. * @returns true if the device supports output. */ public boolean hasOutput() { return mHasOutput; } /** * @return true if the device supports input (recording). * @returns true if the device supports input (recording). */ public boolean hasInput() { return mHasInput; } /** * @return true if the device is a headset for purposes of input. * @returns true if the device is a headset for purposes of input. */ public boolean isInputHeadset() { return mIsInputHeadset; } /** * @return true if the device is a headset for purposes of output. * @returns true if the device is a headset for purposes of output. */ public boolean isOutputHeadset() { return mIsOutputHeadset; } /** * @return true if the device is a USB dock. */ public boolean isDock() { return mIsDock; } /** * @return true if input jack is detected or jack detection is not supported. * @returns true if input jack is detected or jack detection is not supported. */ private synchronized boolean isInputJackConnected() { if (mJackDetector == null) { Loading @@ -145,7 +136,7 @@ public final class UsbAlsaDevice { } /** * @return true if input jack is detected or jack detection is not supported. * @returns true if input jack is detected or jack detection is not supported. */ private synchronized boolean isOutputJackConnected() { if (mJackDetector == null) { Loading Loading @@ -199,10 +190,9 @@ public final class UsbAlsaDevice { try { // Output Device if (mHasOutput) { int device = mIsDock ? AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET : (mIsOutputHeadset int device = mIsOutputHeadset ? AudioSystem.DEVICE_OUT_USB_HEADSET : AudioSystem.DEVICE_OUT_USB_DEVICE); : AudioSystem.DEVICE_OUT_USB_DEVICE; if (DEBUG) { Slog.d(TAG, "pre-call device:0x" + Integer.toHexString(device) + " addr:" + alsaCardDeviceString Loading Loading @@ -241,7 +231,7 @@ public final class UsbAlsaDevice { /** * @Override * @return a string representation of the object. * @returns a string representation of the object. */ public synchronized String toString() { return "UsbAlsaDevice: [card: " + mCardNum Loading Loading @@ -283,7 +273,7 @@ public final class UsbAlsaDevice { /** * @Override * @return true if the objects are equivalent. * @returns true if the objects are equivalent. */ public boolean equals(Object obj) { if (!(obj instanceof UsbAlsaDevice)) { Loading @@ -295,13 +285,12 @@ public final class UsbAlsaDevice { && mHasOutput == other.mHasOutput && mHasInput == other.mHasInput && mIsInputHeadset == other.mIsInputHeadset && mIsOutputHeadset == other.mIsOutputHeadset && mIsDock == other.mIsDock); && mIsOutputHeadset == other.mIsOutputHeadset); } /** * @Override * @return a hash code generated from the object contents. * @returns a hash code generated from the object contents. */ public int hashCode() { final int prime = 31; Loading @@ -312,7 +301,6 @@ public final class UsbAlsaDevice { result = prime * result + (mHasInput ? 0 : 1); result = prime * result + (mIsInputHeadset ? 0 : 1); result = prime * result + (mIsOutputHeadset ? 0 : 1); result = prime * result + (mIsDock ? 0 : 1); return result; } Loading services/usb/java/com/android/server/usb/UsbAlsaManager.java +1 −2 Original line number Diff line number Diff line Loading @@ -237,7 +237,6 @@ public final class UsbAlsaManager { if (hasInput || hasOutput) { boolean isInputHeadset = parser.isInputHeadset(); boolean isOutputHeadset = parser.isOutputHeadset(); boolean isDock = parser.isDock(); if (mAudioService == null) { Slog.e(TAG, "no AudioService"); Loading @@ -247,7 +246,7 @@ public final class UsbAlsaManager { UsbAlsaDevice alsaDevice = new UsbAlsaDevice(mAudioService, cardRec.getCardNum(), 0 /*device*/, deviceAddress, hasOutput, hasInput, isInputHeadset, isOutputHeadset, isDock); isInputHeadset, isOutputHeadset); if (alsaDevice != null) { alsaDevice.setDeviceNameAndDescription( cardRec.getCardName(), cardRec.getCardDescription()); Loading services/usb/java/com/android/server/usb/UsbHostManager.java +5 −3 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public class UsbHostManager { pw.println("manfacturer:0x" + Integer.toHexString(deviceDescriptor.getVendorID()) + " product:" + Integer.toHexString(deviceDescriptor.getProductID())); pw.println("isHeadset[in: " + parser.isInputHeadset() + " , out: " + parser.isOutputHeadset() + "], isDock: " + parser.isDock()); + " , out: " + parser.isOutputHeadset() + "]"); } else { pw.println(formatTime() + " Disconnect " + mDeviceAddress); } Loading @@ -179,8 +179,9 @@ public class UsbHostManager { UsbDescriptorsTree descriptorTree = new UsbDescriptorsTree(); descriptorTree.parse(parser); descriptorTree.report(new TextReportCanvas(parser, stringBuilder)); stringBuilder.append("isHeadset[in: " + parser.isInputHeadset() + " , out: " + parser.isOutputHeadset() + "], isDock: " + parser.isDock()); + " , out: " + parser.isOutputHeadset() + "]"); pw.println(stringBuilder.toString()); } else { pw.println(formatTime() + " Disconnect " + mDeviceAddress); Loading @@ -197,8 +198,9 @@ public class UsbHostManager { descriptor.report(canvas); } pw.println(stringBuilder.toString()); pw.println("isHeadset[in: " + parser.isInputHeadset() + " , out: " + parser.isOutputHeadset() + "], isDock: " + parser.isDock()); + " , out: " + parser.isOutputHeadset() + "]"); } else { pw.println(formatTime() + " Disconnect " + mDeviceAddress); } Loading services/usb/java/com/android/server/usb/descriptors/UsbDescriptorParser.java +0 −31 Original line number Diff line number Diff line Loading @@ -870,35 +870,4 @@ public final class UsbDescriptorParser { return getOutputHeadsetProbability() >= OUT_HEADSET_TRIGGER; } /** * isDock() indicates if the connected USB output peripheral is a docking station with * audio output. * A valid audio dock must declare only one audio output control terminal of type * TERMINAL_EXTERN_DIGITAL. */ public boolean isDock() { if (hasMIDIInterface() || hasHIDInterface()) { return false; } ArrayList<UsbDescriptor> acDescriptors = getACInterfaceDescriptors(UsbACInterface.ACI_OUTPUT_TERMINAL, UsbACInterface.AUDIO_AUDIOCONTROL); if (acDescriptors.size() != 1) { return false; } if (acDescriptors.get(0) instanceof UsbACTerminal) { UsbACTerminal outDescr = (UsbACTerminal) acDescriptors.get(0); if (outDescr.getTerminalType() == UsbTerminalTypes.TERMINAL_EXTERN_DIGITAL) { return true; } } else { Log.w(TAG, "Undefined Audio Output terminal l: " + acDescriptors.get(0).getLength() + " t:0x" + Integer.toHexString(acDescriptors.get(0).getType())); } return false; } } Loading
services/core/java/com/android/server/audio/AudioDeviceInventory.java +0 −3 Original line number Diff line number Diff line Loading @@ -1376,9 +1376,6 @@ public class AudioDeviceInventory { case AudioSystem.DEVICE_OUT_USB_HEADSET: connType = AudioRoutesInfo.MAIN_USB; break; case AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET: connType = AudioRoutesInfo.MAIN_DOCK_SPEAKERS; break; } synchronized (mCurAudioRoutes) { Loading
services/usb/java/com/android/server/usb/UsbAlsaDevice.java +18 −30 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ public final class UsbAlsaDevice { private final boolean mIsInputHeadset; private final boolean mIsOutputHeadset; private final boolean mIsDock; private boolean mSelected = false; private int mOutputState; Loading @@ -54,7 +53,7 @@ public final class UsbAlsaDevice { public UsbAlsaDevice(IAudioService audioService, int card, int device, String deviceAddress, boolean hasOutput, boolean hasInput, boolean isInputHeadset, boolean isOutputHeadset, boolean isDock) { boolean isInputHeadset, boolean isOutputHeadset) { mAudioService = audioService; mCardNum = card; mDeviceNum = device; Loading @@ -63,32 +62,31 @@ public final class UsbAlsaDevice { mHasInput = hasInput; mIsInputHeadset = isInputHeadset; mIsOutputHeadset = isOutputHeadset; mIsDock = isDock; } /** * @return the ALSA card number associated with this peripheral. * @returns the ALSA card number associated with this peripheral. */ public int getCardNum() { return mCardNum; } /** * @return the ALSA device number associated with this peripheral. * @returns the ALSA device number associated with this peripheral. */ public int getDeviceNum() { return mDeviceNum; } /** * @return the USB device device address associated with this peripheral. * @returns the USB device device address associated with this peripheral. */ public String getDeviceAddress() { return mDeviceAddress; } /** * @return the ALSA card/device address string. * @returns the ALSA card/device address string. */ public String getAlsaCardDeviceString() { if (mCardNum < 0 || mDeviceNum < 0) { Loading @@ -100,42 +98,35 @@ public final class UsbAlsaDevice { } /** * @return true if the device supports output. * @returns true if the device supports output. */ public boolean hasOutput() { return mHasOutput; } /** * @return true if the device supports input (recording). * @returns true if the device supports input (recording). */ public boolean hasInput() { return mHasInput; } /** * @return true if the device is a headset for purposes of input. * @returns true if the device is a headset for purposes of input. */ public boolean isInputHeadset() { return mIsInputHeadset; } /** * @return true if the device is a headset for purposes of output. * @returns true if the device is a headset for purposes of output. */ public boolean isOutputHeadset() { return mIsOutputHeadset; } /** * @return true if the device is a USB dock. */ public boolean isDock() { return mIsDock; } /** * @return true if input jack is detected or jack detection is not supported. * @returns true if input jack is detected or jack detection is not supported. */ private synchronized boolean isInputJackConnected() { if (mJackDetector == null) { Loading @@ -145,7 +136,7 @@ public final class UsbAlsaDevice { } /** * @return true if input jack is detected or jack detection is not supported. * @returns true if input jack is detected or jack detection is not supported. */ private synchronized boolean isOutputJackConnected() { if (mJackDetector == null) { Loading Loading @@ -199,10 +190,9 @@ public final class UsbAlsaDevice { try { // Output Device if (mHasOutput) { int device = mIsDock ? AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET : (mIsOutputHeadset int device = mIsOutputHeadset ? AudioSystem.DEVICE_OUT_USB_HEADSET : AudioSystem.DEVICE_OUT_USB_DEVICE); : AudioSystem.DEVICE_OUT_USB_DEVICE; if (DEBUG) { Slog.d(TAG, "pre-call device:0x" + Integer.toHexString(device) + " addr:" + alsaCardDeviceString Loading Loading @@ -241,7 +231,7 @@ public final class UsbAlsaDevice { /** * @Override * @return a string representation of the object. * @returns a string representation of the object. */ public synchronized String toString() { return "UsbAlsaDevice: [card: " + mCardNum Loading Loading @@ -283,7 +273,7 @@ public final class UsbAlsaDevice { /** * @Override * @return true if the objects are equivalent. * @returns true if the objects are equivalent. */ public boolean equals(Object obj) { if (!(obj instanceof UsbAlsaDevice)) { Loading @@ -295,13 +285,12 @@ public final class UsbAlsaDevice { && mHasOutput == other.mHasOutput && mHasInput == other.mHasInput && mIsInputHeadset == other.mIsInputHeadset && mIsOutputHeadset == other.mIsOutputHeadset && mIsDock == other.mIsDock); && mIsOutputHeadset == other.mIsOutputHeadset); } /** * @Override * @return a hash code generated from the object contents. * @returns a hash code generated from the object contents. */ public int hashCode() { final int prime = 31; Loading @@ -312,7 +301,6 @@ public final class UsbAlsaDevice { result = prime * result + (mHasInput ? 0 : 1); result = prime * result + (mIsInputHeadset ? 0 : 1); result = prime * result + (mIsOutputHeadset ? 0 : 1); result = prime * result + (mIsDock ? 0 : 1); return result; } Loading
services/usb/java/com/android/server/usb/UsbAlsaManager.java +1 −2 Original line number Diff line number Diff line Loading @@ -237,7 +237,6 @@ public final class UsbAlsaManager { if (hasInput || hasOutput) { boolean isInputHeadset = parser.isInputHeadset(); boolean isOutputHeadset = parser.isOutputHeadset(); boolean isDock = parser.isDock(); if (mAudioService == null) { Slog.e(TAG, "no AudioService"); Loading @@ -247,7 +246,7 @@ public final class UsbAlsaManager { UsbAlsaDevice alsaDevice = new UsbAlsaDevice(mAudioService, cardRec.getCardNum(), 0 /*device*/, deviceAddress, hasOutput, hasInput, isInputHeadset, isOutputHeadset, isDock); isInputHeadset, isOutputHeadset); if (alsaDevice != null) { alsaDevice.setDeviceNameAndDescription( cardRec.getCardName(), cardRec.getCardDescription()); Loading
services/usb/java/com/android/server/usb/UsbHostManager.java +5 −3 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public class UsbHostManager { pw.println("manfacturer:0x" + Integer.toHexString(deviceDescriptor.getVendorID()) + " product:" + Integer.toHexString(deviceDescriptor.getProductID())); pw.println("isHeadset[in: " + parser.isInputHeadset() + " , out: " + parser.isOutputHeadset() + "], isDock: " + parser.isDock()); + " , out: " + parser.isOutputHeadset() + "]"); } else { pw.println(formatTime() + " Disconnect " + mDeviceAddress); } Loading @@ -179,8 +179,9 @@ public class UsbHostManager { UsbDescriptorsTree descriptorTree = new UsbDescriptorsTree(); descriptorTree.parse(parser); descriptorTree.report(new TextReportCanvas(parser, stringBuilder)); stringBuilder.append("isHeadset[in: " + parser.isInputHeadset() + " , out: " + parser.isOutputHeadset() + "], isDock: " + parser.isDock()); + " , out: " + parser.isOutputHeadset() + "]"); pw.println(stringBuilder.toString()); } else { pw.println(formatTime() + " Disconnect " + mDeviceAddress); Loading @@ -197,8 +198,9 @@ public class UsbHostManager { descriptor.report(canvas); } pw.println(stringBuilder.toString()); pw.println("isHeadset[in: " + parser.isInputHeadset() + " , out: " + parser.isOutputHeadset() + "], isDock: " + parser.isDock()); + " , out: " + parser.isOutputHeadset() + "]"); } else { pw.println(formatTime() + " Disconnect " + mDeviceAddress); } Loading
services/usb/java/com/android/server/usb/descriptors/UsbDescriptorParser.java +0 −31 Original line number Diff line number Diff line Loading @@ -870,35 +870,4 @@ public final class UsbDescriptorParser { return getOutputHeadsetProbability() >= OUT_HEADSET_TRIGGER; } /** * isDock() indicates if the connected USB output peripheral is a docking station with * audio output. * A valid audio dock must declare only one audio output control terminal of type * TERMINAL_EXTERN_DIGITAL. */ public boolean isDock() { if (hasMIDIInterface() || hasHIDInterface()) { return false; } ArrayList<UsbDescriptor> acDescriptors = getACInterfaceDescriptors(UsbACInterface.ACI_OUTPUT_TERMINAL, UsbACInterface.AUDIO_AUDIOCONTROL); if (acDescriptors.size() != 1) { return false; } if (acDescriptors.get(0) instanceof UsbACTerminal) { UsbACTerminal outDescr = (UsbACTerminal) acDescriptors.get(0); if (outDescr.getTerminalType() == UsbTerminalTypes.TERMINAL_EXTERN_DIGITAL) { return true; } } else { Log.w(TAG, "Undefined Audio Output terminal l: " + acDescriptors.get(0).getLength() + " t:0x" + Integer.toHexString(acDescriptors.get(0).getType())); } return false; } }