import static com.android.server.input.InputManagerService.SW_LINEOUT_INSERT_BIT;
import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT;
import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT_BIT;
+import static com.android.server.input.InputManagerService.SW_VIDEOOUT_INSERT;
+import static com.android.server.input.InputManagerService.SW_VIDEOOUT_INSERT_BIT;
import android.content.Context;
import android.media.AudioManager;
if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_LINEOUT_INSERT) == 1) {
switchValues |= SW_LINEOUT_INSERT_BIT;
}
+ if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_VIDEOOUT_INSERT) == 1) {
+ switchValues |= SW_VIDEOOUT_INSERT_BIT;
+ }
notifyWiredAccessoryChanged(0, switchValues,
- SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT);
+ SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT);
}
@Override
public void notifyWiredAccessoryChanged(long whenNanos, int switchValues, int switchMask) {
if (LOG) {
- Slog.v(TAG, "notifyWiredAccessoryChanged: when=" + whenNanos
+ Slog.i(TAG, "notifyWiredAccessoryChanged: when=" + whenNanos
+ " bits=" + switchCodeToString(switchValues, switchMask)
+ " mask=" + Integer.toHexString(switchMask));
}
int headset;
mSwitchValues = (mSwitchValues & ~switchMask) | switchValues;
switch (mSwitchValues &
- (SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT)) {
+ (SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT)) {
case 0:
headset = 0;
break;
headset = BIT_LINEOUT;
break;
+ case SW_VIDEOOUT_INSERT_BIT:
+ case SW_VIDEOOUT_INSERT_BIT | SW_LINEOUT_INSERT_BIT:
+ headset = BIT_HDMI_AUDIO;
+ break;
+
case SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT:
headset = BIT_HEADSET;
break;
}
updateLocked(NAME_H2W,
- (mHeadsetState & ~(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT)) | headset);
+ (mHeadsetState & ~(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT | BIT_HDMI_AUDIO)) | headset);
}
}
}
if (LOG) {
- Slog.v(TAG, "headsetName: " + headsetName +
+ Slog.i(TAG, "headsetName: " + headsetName +
(state == 1 ? " connected" : " disconnected"));
}
(switchValues & SW_MICROPHONE_INSERT_BIT) != 0) {
sb.append("SW_MICROPHONE_INSERT");
}
+ if ((switchMask & SW_LINEOUT_INSERT_BIT) != 0 &&
+ (switchValues & SW_LINEOUT_INSERT_BIT) != 0) {
+ sb.append("SW_LINEOUT_INSERT ");
+ }
+ if ((switchMask & SW_VIDEOOUT_INSERT_BIT) != 0 &&
+ (switchValues & SW_VIDEOOUT_INSERT_BIT) != 0) {
+ sb.append("SW_VIDEOOUT_INSERT ");
+ }
return sb.toString();
}