Merge "Add pending list of external source." am: 86806e9ce4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1801771 Change-Id: Ifc310e524f4a73029660c3d71b6c62cc91439591
This commit is contained in:
@@ -114,6 +114,8 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
|||||||
private final SparseBooleanArray mHdmiStateMap = new SparseBooleanArray();
|
private final SparseBooleanArray mHdmiStateMap = new SparseBooleanArray();
|
||||||
private final List<Message> mPendingHdmiDeviceEvents = new LinkedList<>();
|
private final List<Message> mPendingHdmiDeviceEvents = new LinkedList<>();
|
||||||
|
|
||||||
|
private final List<Message> mPendingTvinputInfoEvents = new LinkedList<>();
|
||||||
|
|
||||||
// Calls to mListener should happen here.
|
// Calls to mListener should happen here.
|
||||||
private final Handler mHandler = new ListenerHandler();
|
private final Handler mHandler = new ListenerHandler();
|
||||||
|
|
||||||
@@ -229,6 +231,15 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
|||||||
connection.getInputStateLocked(), 0, inputId).sendToTarget();
|
connection.getInputStateLocked(), 0, inputId).sendToTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Message msg = mHandler.obtainMessage(ListenerHandler.TVINPUT_INFO_ADDED,
|
||||||
|
deviceId, cableConnectionStatus, connection);
|
||||||
|
for (Iterator<Message> it = mPendingTvinputInfoEvents.iterator(); it.hasNext();) {
|
||||||
|
if (it.next().arg1 == deviceId) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mPendingTvinputInfoEvents.add(msg);
|
||||||
}
|
}
|
||||||
ITvInputHardwareCallback callback = connection.getCallbackLocked();
|
ITvInputHardwareCallback callback = connection.getCallbackLocked();
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
@@ -288,6 +299,8 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
|||||||
}
|
}
|
||||||
mHardwareInputIdMap.put(deviceId, info.getId());
|
mHardwareInputIdMap.put(deviceId, info.getId());
|
||||||
mInputMap.put(info.getId(), info);
|
mInputMap.put(info.getId(), info);
|
||||||
|
processPendingTvInputInfoEventsLocked();
|
||||||
|
Slog.d(TAG,"deviceId ="+ deviceId+", tvinputinfo = "+info);
|
||||||
|
|
||||||
// Process pending state changes
|
// Process pending state changes
|
||||||
|
|
||||||
@@ -530,6 +543,20 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void processPendingTvInputInfoEventsLocked() {
|
||||||
|
for (Iterator<Message> it = mPendingTvinputInfoEvents.iterator(); it.hasNext(); ) {
|
||||||
|
Message msg = it.next();
|
||||||
|
int deviceId = msg.arg1;
|
||||||
|
String inputId = mHardwareInputIdMap.get(deviceId);
|
||||||
|
if (inputId != null) {
|
||||||
|
msg.sendToTarget();
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updateVolume() {
|
private void updateVolume() {
|
||||||
mCurrentMaxIndex = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
mCurrentMaxIndex = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||||
mCurrentIndex = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
|
mCurrentIndex = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
|
||||||
@@ -1182,6 +1209,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
|||||||
private static final int HDMI_DEVICE_ADDED = 4;
|
private static final int HDMI_DEVICE_ADDED = 4;
|
||||||
private static final int HDMI_DEVICE_REMOVED = 5;
|
private static final int HDMI_DEVICE_REMOVED = 5;
|
||||||
private static final int HDMI_DEVICE_UPDATED = 6;
|
private static final int HDMI_DEVICE_UPDATED = 6;
|
||||||
|
private static final int TVINPUT_INFO_ADDED = 7;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void handleMessage(Message msg) {
|
public final void handleMessage(Message msg) {
|
||||||
@@ -1226,6 +1254,29 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TVINPUT_INFO_ADDED: {
|
||||||
|
int deviceId = msg.arg1;
|
||||||
|
int cableConnectionStatus = msg.arg2;
|
||||||
|
Connection connection =(Connection)msg.obj;
|
||||||
|
|
||||||
|
int previousConfigsLength = connection.getConfigsLengthLocked();
|
||||||
|
int previousCableConnectionStatus = connection.getInputStateLocked();
|
||||||
|
String inputId = mHardwareInputIdMap.get(deviceId);
|
||||||
|
|
||||||
|
if (inputId != null) {
|
||||||
|
if (connection.updateCableConnectionStatusLocked(cableConnectionStatus)) {
|
||||||
|
if (previousCableConnectionStatus != connection.getInputStateLocked()) {
|
||||||
|
mListener.onStateChanged(inputId, connection.getInputStateLocked());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((previousConfigsLength == 0)
|
||||||
|
!= (connection.getConfigsLengthLocked() == 0)) {
|
||||||
|
mListener.onStateChanged(inputId, connection.getInputStateLocked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
Slog.w(TAG, "Unhandled message: " + msg);
|
Slog.w(TAG, "Unhandled message: " + msg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user