Implement retransmission of cec request.
BUG: 16218422 Change-Id: I4a6692ba8815e9a0ae26c872656b31b678d54fd6 Conflicts: services/core/java/com/android/server/hdmi/HdmiCecController.java
This commit is contained in:
@@ -533,16 +533,25 @@ final class HdmiCecController {
|
||||
@Override
|
||||
public void run() {
|
||||
byte[] body = buildBody(cecMessage.getOpcode(), cecMessage.getParams());
|
||||
final int error = nativeSendCecCommand(mNativePtr, cecMessage.getSource(),
|
||||
cecMessage.getDestination(), body);
|
||||
if (error != Constants.SEND_RESULT_SUCCESS) {
|
||||
int i = 0;
|
||||
int errorCode = Constants.SEND_RESULT_SUCCESS;
|
||||
do {
|
||||
errorCode = nativeSendCecCommand(mNativePtr, cecMessage.getSource(),
|
||||
cecMessage.getDestination(), body);
|
||||
if (errorCode == Constants.SEND_RESULT_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
} while (i++ < HdmiConfig.RETRANSMISSION_COUNT);
|
||||
|
||||
final int finalError = errorCode;
|
||||
if (finalError != Constants.SEND_RESULT_SUCCESS) {
|
||||
Slog.w(TAG, "Failed to send " + cecMessage);
|
||||
}
|
||||
if (callback != null) {
|
||||
runOnServiceThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
callback.onSendCompleted(error);
|
||||
callback.onSendCompleted(finalError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,5 +39,12 @@ final class HdmiConfig {
|
||||
// Number of retries for polling each device in address allocation mechanism.
|
||||
static final int ADDRESS_ALLOCATION_RETRY = 3;
|
||||
|
||||
// CEC spec said that it should try retransmission at least once.
|
||||
// The actual number of send request for a single command will be at most
|
||||
// RETRANSMISSION_COUNT + 1. Note that it affects only to normal commands
|
||||
// and polling message for logical address allocation and device discovery
|
||||
// action. They will have their own retransmission count.
|
||||
static final int RETRANSMISSION_COUNT = 1;
|
||||
|
||||
private HdmiConfig() { /* cannot be instantiated */ }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user