diff options
author | Jungshik Jang <jayjang@google.com> | 2014-08-29 06:28:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-29 06:28:14 +0000 |
commit | f8a823b05a9db8b307817461b58bc0dda896241b (patch) | |
tree | 399f17410eda5d1e91046db794fe812241e63916 /services/core/java/com/android/server/hdmi | |
parent | 503a102143e7ecd25721313a4edad613a3688ada (diff) | |
parent | a7221ce87683fab16603290378408ce92f02e88a (diff) | |
download | frameworks_base-f8a823b05a9db8b307817461b58bc0dda896241b.zip frameworks_base-f8a823b05a9db8b307817461b58bc0dda896241b.tar.gz frameworks_base-f8a823b05a9db8b307817461b58bc0dda896241b.tar.bz2 |
Merge "Fix system audio mode failure in boot up" into lmp-dev
Diffstat (limited to 'services/core/java/com/android/server/hdmi')
4 files changed, 15 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java index 584ba6a..bb22b4d 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecController.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java @@ -449,7 +449,7 @@ final class HdmiCecController { allocated.add(address); } } - mIoThreadLogger.debug("DevicePollingResult:" + allocated); + mIoThreadLogger.debug("[P]:Allocated Address=" + allocated); if (callback != null) { runOnServiceThread(new Runnable() { @Override @@ -551,7 +551,7 @@ final class HdmiCecController { runOnIoThread(new Runnable() { @Override public void run() { - mIoThreadLogger.debug("SendCommand:" + cecMessage); + mIoThreadLogger.debug("[S]:" + cecMessage); byte[] body = buildBody(cecMessage.getOpcode(), cecMessage.getParams()); int i = 0; int errorCode = Constants.SEND_RESULT_SUCCESS; @@ -586,7 +586,7 @@ final class HdmiCecController { private void handleIncomingCecCommand(int srcAddress, int dstAddress, byte[] body) { assertRunOnServiceThread(); HdmiCecMessage command = HdmiCecMessageBuilder.of(srcAddress, dstAddress, body); - mServiceThreadLogger.debug("ReceiveCommand:" + command); + mServiceThreadLogger.debug("[R]:" + command); onReceiveCommand(command); } diff --git a/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java b/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java index 26d2cde..85f5be2 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java @@ -43,6 +43,9 @@ import java.util.List; */ abstract class HdmiCecFeatureAction { private static final String TAG = "HdmiCecFeatureAction"; + // As all actions run in the same thread (service thread), it's fine to have single logger. + // TODO: create global logger for each threads and use them. + protected static final HdmiLogger DLOGGER = new HdmiLogger(TAG); // Timer handler message used for timeout event protected static final int MSG_TIMEOUT = 100; diff --git a/services/core/java/com/android/server/hdmi/HdmiLogger.java b/services/core/java/com/android/server/hdmi/HdmiLogger.java index ee9379d..c7add75 100644 --- a/services/core/java/com/android/server/hdmi/HdmiLogger.java +++ b/services/core/java/com/android/server/hdmi/HdmiLogger.java @@ -42,7 +42,7 @@ final class HdmiLogger { private final String mTag; HdmiLogger(String tag) { - mTag = tag; + mTag = "HDMI:" + tag; } void warning(String logMessage) { diff --git a/services/core/java/com/android/server/hdmi/SystemAudioAction.java b/services/core/java/com/android/server/hdmi/SystemAudioAction.java index ac2c7b9..d15ffb0 100644 --- a/services/core/java/com/android/server/hdmi/SystemAudioAction.java +++ b/services/core/java/com/android/server/hdmi/SystemAudioAction.java @@ -73,9 +73,9 @@ abstract class SystemAudioAction extends HdmiCecFeatureAction { // Seq #27 protected void sendSystemAudioModeRequest() { - mState = STATE_CHECK_ROUTING_IN_PRGRESS; List<RoutingControlAction> routingActions = getActions(RoutingControlAction.class); if (!routingActions.isEmpty()) { + mState = STATE_CHECK_ROUTING_IN_PRGRESS; // Should have only one Routing Control Action RoutingControlAction routingAction = routingActions.get(0); routingAction.addOnFinishedCallback(this, new Runnable() { @@ -97,20 +97,21 @@ abstract class SystemAudioAction extends HdmiCecFeatureAction { sendCommand(command, new HdmiControlService.SendMessageCallback() { @Override public void onSendCompleted(int error) { - if (error == Constants.SEND_RESULT_SUCCESS) { - mState = STATE_WAIT_FOR_SET_SYSTEM_AUDIO_MODE; - addTimer(mState, mTargetAudioStatus ? ON_TIMEOUT_MS : OFF_TIMEOUT_MS); - } else { + if (error != Constants.SEND_RESULT_SUCCESS) { + DLOGGER.debug("Failed to send <System Audio Mode Request>:" + error); setSystemAudioMode(false); finishWithCallback(HdmiControlManager.RESULT_COMMUNICATION_FAILED); } } }); + mState = STATE_WAIT_FOR_SET_SYSTEM_AUDIO_MODE; + addTimer(mState, mTargetAudioStatus ? ON_TIMEOUT_MS : OFF_TIMEOUT_MS); } private void handleSendSystemAudioModeRequestTimeout() { if (!mTargetAudioStatus // Don't retry for Off case. || mSendRetryCount++ >= MAX_SEND_RETRY_COUNT) { + DLOGGER.debug("[T]:wait for <Set System Audio Mode>."); setSystemAudioMode(false); finishWithCallback(HdmiControlManager.RESULT_TIMEOUT); return; @@ -129,6 +130,7 @@ abstract class SystemAudioAction extends HdmiCecFeatureAction { if (cmd.getOpcode() == Constants.MESSAGE_FEATURE_ABORT && (cmd.getParams()[0] & 0xFF) == Constants.MESSAGE_SYSTEM_AUDIO_MODE_REQUEST) { + DLOGGER.debug("Failed to start system audio mode request."); setSystemAudioMode(false); finishWithCallback(HdmiControlManager.RESULT_EXCEPTION); return true; @@ -143,6 +145,7 @@ abstract class SystemAudioAction extends HdmiCecFeatureAction { startAudioStatusAction(); return true; } else { + DLOGGER.debug("Unexpected system audio mode request:" + receivedStatus); // Unexpected response, consider the request is newly initiated by AVR. // To return 'false' will initiate new SystemAudioActionFromAvr by the control // service. |