summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorYuncheol Heo <ycheo@google.com>2014-05-23 20:10:19 +0900
committerJungshik Jang <jayjang@google.com>2014-06-02 10:46:36 +0900
commit61ced38d61926bc28638d805436086db22b642c3 (patch)
treeb8434fb8b44873e78895ea83931bef9f80a6c73a /services
parent47927f756a0f694358567cec845b53ab3fc980e9 (diff)
downloadframeworks_base-61ced38d61926bc28638d805436086db22b642c3.zip
frameworks_base-61ced38d61926bc28638d805436086db22b642c3.tar.gz
frameworks_base-61ced38d61926bc28638d805436086db22b642c3.tar.bz2
DO NOT MERGE: Add the constants for the callback result of SendCecCommand().
- Move the send failure warning messages into HdmiCecController.sendCommand() from each Actions. - Stringfy with more detail messages for some opcodes. Change-Id: Ib7ce24dd2a1f290e6c3a0b26738772ef1d4a9630
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecController.java9
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiControlService.java11
-rw-r--r--services/core/java/com/android/server/hdmi/RequestArcInitiationAction.java5
-rw-r--r--services/core/java/com/android/server/hdmi/RequestArcTerminationAction.java4
-rw-r--r--services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java5
5 files changed, 16 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index 23044dd..7cad906 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -20,6 +20,7 @@ import android.hardware.hdmi.HdmiCec;
import android.hardware.hdmi.HdmiCecDeviceInfo;
import android.hardware.hdmi.HdmiCecMessage;
import android.os.Handler;
+import android.util.Slog;
import android.util.SparseArray;
import libcore.util.EmptyArray;
@@ -54,9 +55,6 @@ final class HdmiCecController {
private static final int NUM_LOGICAL_ADDRESS = 16;
- // TODO: define other constants for errors.
- private static final int ERROR_SUCCESS = 0;
-
// Handler instance to process synchronous I/O (mainly send) message.
private Handler mIoHandler;
@@ -195,7 +193,7 @@ final class HdmiCecController {
// it as logical address of the device.
int error = nativeSendCecCommand(mNativePtr, curAddress, curAddress,
EMPTY_BODY);
- if (error != ERROR_SUCCESS) {
+ if (error != HdmiControlService.SEND_RESULT_SUCCESS) {
logicalAddress = curAddress;
break;
}
@@ -394,6 +392,9 @@ final class HdmiCecController {
byte[] body = buildBody(cecMessage.getOpcode(), cecMessage.getParams());
final int error = nativeSendCecCommand(mNativePtr, cecMessage.getSource(),
cecMessage.getDestination(), body);
+ if (error != HdmiControlService.SEND_RESULT_SUCCESS) {
+ Slog.w(TAG, "Failed to send " + cecMessage);
+ }
if (callback != null) {
runOnServiceThread(new Runnable() {
@Override
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index d7a2c1c..2cd3eab 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -49,6 +49,10 @@ public final class HdmiControlService extends SystemService {
// TODO: Rename the permission to HDMI_CONTROL.
private static final String PERMISSION = "android.permission.HDMI_CEC";
+ static final int SEND_RESULT_SUCCESS = 0;
+ static final int SEND_RESULT_NAK = -1;
+ static final int SEND_RESULT_FAILURE = -2;
+
/**
* Interface to report send result.
*/
@@ -56,10 +60,11 @@ public final class HdmiControlService extends SystemService {
/**
* Called when {@link HdmiControlService#sendCecCommand} is completed.
*
- * @param error result of send request. 0 if succeed. Otherwise it will be
- * negative value
+ * @param error result of send request.
+ * @see {@link #SEND_RESULT_SUCCESS}
+ * @see {@link #SEND_RESULT_NAK}
+ * @see {@link #SEND_RESULT_FAILURE}
*/
- // TODO: define error code as constants and update javadoc.
void onSendCompleted(int error);
}
diff --git a/services/core/java/com/android/server/hdmi/RequestArcInitiationAction.java b/services/core/java/com/android/server/hdmi/RequestArcInitiationAction.java
index db9d28d..343aff7 100644
--- a/services/core/java/com/android/server/hdmi/RequestArcInitiationAction.java
+++ b/services/core/java/com/android/server/hdmi/RequestArcInitiationAction.java
@@ -17,7 +17,6 @@
package com.android.server.hdmi;
import android.hardware.hdmi.HdmiCecMessage;
-import android.util.Slog;
/**
* Feature action that handles ARC action initiated by TV devices.
@@ -43,12 +42,10 @@ final class RequestArcInitiationAction extends RequestArcAction {
sendCommand(command, new HdmiControlService.SendMessageCallback() {
@Override
public void onSendCompleted(int error) {
- // success.
- if (error == 0) {
+ if (error == HdmiControlService.SEND_RESULT_SUCCESS) {
mState = STATE_WATING_FOR_REQUEST_ARC_REQUEST_RESPONSE;
addTimer(mState, TIMEOUT_MS);
} else {
- Slog.w(TAG, "Failed to send <Request ARC Initiation>");
// If failed to send <Request ARC Initiation>, start "Disabled"
// ARC transmission action.
disableArcTransmission();
diff --git a/services/core/java/com/android/server/hdmi/RequestArcTerminationAction.java b/services/core/java/com/android/server/hdmi/RequestArcTerminationAction.java
index 7669f87..d4a35f8 100644
--- a/services/core/java/com/android/server/hdmi/RequestArcTerminationAction.java
+++ b/services/core/java/com/android/server/hdmi/RequestArcTerminationAction.java
@@ -17,7 +17,6 @@
package com.android.server.hdmi;
import android.hardware.hdmi.HdmiCecMessage;
-import android.util.Slog;
/**
* Feature action to handle <Request ARC Termination>.
@@ -43,11 +42,10 @@ final class RequestArcTerminationAction extends RequestArcAction {
sendCommand(command, new HdmiControlService.SendMessageCallback() {
@Override
public void onSendCompleted(int error) {
- if (error == 0) {
+ if (error == HdmiControlService.SEND_RESULT_SUCCESS) {
mState = STATE_WATING_FOR_REQUEST_ARC_REQUEST_RESPONSE;
addTimer(mState, TIMEOUT_MS);
} else {
- Slog.w(TAG, "Failed to send <Request ARC Initiation>");
// If failed to send <Request ARC Termination>, start "Disabled" ARC
// transmission action.
disableArcTransmission();
diff --git a/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java b/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java
index 94776a2..e3525d8 100644
--- a/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java
+++ b/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java
@@ -78,7 +78,7 @@ final class SetArcTransmissionStateAction extends FeatureAction {
sendCommand(command, new HdmiControlService.SendMessageCallback() {
@Override
public void onSendCompleted(int error) {
- if (error == 0) {
+ if (error == HdmiControlService.SEND_RESULT_SUCCESS) {
// Enable ARC status immediately after sending <Report Arc Initiated>.
// If AVR responds with <Feature Abort>, disable ARC status again.
// This is different from spec that says that turns ARC status to
@@ -94,9 +94,6 @@ final class SetArcTransmissionStateAction extends FeatureAction {
} else {
// If fails to send <Report ARC Initiated>, disable ARC and
// send <Report ARC Terminated> directly.
- Slog.w(TAG, "Failed to send <Report ARC Initiated>:[source:"
- + mSourceAddress
- + ", avr Address:" + mAvrAddress + "]");
setArcStatus(false);
finish();
}