summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/hdmi/Constants.java39
-rwxr-xr-xservices/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java1
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java10
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java7
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java19
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java13
6 files changed, 75 insertions, 14 deletions
diff --git a/services/core/java/com/android/server/hdmi/Constants.java b/services/core/java/com/android/server/hdmi/Constants.java
index 42dcbeb73fff..d0e7e459e7f2 100644
--- a/services/core/java/com/android/server/hdmi/Constants.java
+++ b/services/core/java/com/android/server/hdmi/Constants.java
@@ -507,6 +507,15 @@ final class Constants {
static final int ALL_DEVICE_TYPES_PLAYBACK = 4;
static final int ALL_DEVICE_TYPES_AUDIO_SYSTEM = 3;
static final int ALL_DEVICE_TYPES_SWITCH = 2;
+ @IntDef({
+ ALL_DEVICE_TYPES_TV,
+ ALL_DEVICE_TYPES_RECORDER,
+ ALL_DEVICE_TYPES_TUNER,
+ ALL_DEVICE_TYPES_PLAYBACK,
+ ALL_DEVICE_TYPES_AUDIO_SYSTEM,
+ ALL_DEVICE_TYPES_SWITCH
+ })
+ @interface DeviceType {}
static final int DEVICE_FEATURE_TV_SUPPORTS_RECORD_TV_SCREEN = 6;
static final int DEVICE_FEATURE_TV_SUPPORTS_SET_OSD_STRING = 5;
@@ -514,21 +523,51 @@ final class Constants {
static final int DEVICE_FEATURE_SUPPORTS_SET_AUDIO_RATE = 3;
static final int DEVICE_FEATURE_SINK_SUPPORTS_ARC_TX = 2;
static final int DEVICE_FEATURE_SOURCE_SUPPORTS_ARC_RX = 1;
+ @IntDef({
+ DEVICE_FEATURE_TV_SUPPORTS_RECORD_TV_SCREEN,
+ DEVICE_FEATURE_TV_SUPPORTS_SET_OSD_STRING,
+ DEVICE_FEATURE_SUPPORTS_DECK_CONTROL,
+ DEVICE_FEATURE_SUPPORTS_SET_AUDIO_RATE,
+ DEVICE_FEATURE_SINK_SUPPORTS_ARC_TX,
+ DEVICE_FEATURE_SOURCE_SUPPORTS_ARC_RX
+ })
+ @interface DeviceFeature {}
static final int RC_PROFILE_TV = 0;
static final int RC_PROFILE_SOURCE = 1;
+ @IntDef({
+ RC_PROFILE_TV,
+ RC_PROFILE_SOURCE
+ })
+ @interface RcProfile {}
static final int RC_PROFILE_TV_NONE = 0x0;
static final int RC_PROFILE_TV_ONE = 0x2;
static final int RC_PROFILE_TV_TWO = 0x6;
static final int RC_PROFILE_TV_THREE = 0xA;
static final int RC_PROFILE_TV_FOUR = 0xE;
+ @IntDef({
+ RC_PROFILE_TV_NONE,
+ RC_PROFILE_TV_ONE,
+ RC_PROFILE_TV_TWO,
+ RC_PROFILE_TV_THREE,
+ RC_PROFILE_TV_FOUR
+ })
+ @interface RcProfileTv {}
static final int RC_PROFILE_SOURCE_HANDLES_ROOT_MENU = 4;
static final int RC_PROFILE_SOURCE_HANDLES_SETUP_MENU = 3;
static final int RC_PROFILE_SOURCE_HANDLES_CONTENTS_MENU = 2;
static final int RC_PROFILE_SOURCE_HANDLES_TOP_MENU = 1;
static final int RC_PROFILE_SOURCE_HANDLES_MEDIA_CONTEXT_SENSITIVE_MENU = 0;
+ @IntDef({
+ RC_PROFILE_SOURCE_HANDLES_ROOT_MENU,
+ RC_PROFILE_SOURCE_HANDLES_SETUP_MENU,
+ RC_PROFILE_SOURCE_HANDLES_CONTENTS_MENU,
+ RC_PROFILE_SOURCE_HANDLES_TOP_MENU,
+ RC_PROFILE_SOURCE_HANDLES_MEDIA_CONTEXT_SENSITIVE_MENU
+ })
+ @interface RcProfileSource {}
private Constants() {
/* cannot be instantiated */
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
index fb71d9510627..1cbbe2dc5b6a 100755
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
@@ -554,6 +554,7 @@ abstract class HdmiCecLocalDevice {
return false;
}
+ @Constants.RcProfile
protected abstract int getRcProfile();
protected abstract List<Integer> getRcFeatures();
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
index 46b09dc07e61..a945c90d30ef 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
@@ -47,8 +47,6 @@ import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly;
import com.android.server.hdmi.HdmiUtils.CodecSad;
import com.android.server.hdmi.HdmiUtils.DeviceConfig;
-import com.google.android.collect.Lists;
-
import org.xmlpull.v1.XmlPullParserException;
import java.io.File;
@@ -179,7 +177,13 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
@Override
protected List<Integer> getDeviceFeatures() {
- return Lists.newArrayList(Constants.DEVICE_FEATURE_SOURCE_SUPPORTS_ARC_RX);
+ List<Integer> deviceFeatures = new ArrayList<>();
+
+ if (SystemProperties.getBoolean(Constants.PROPERTY_ARC_SUPPORT, true)) {
+ deviceFeatures.add(Constants.DEVICE_FEATURE_SOURCE_SUPPORTS_ARC_RX);
+ }
+
+ return deviceFeatures;
}
@Override
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java
index 3b3ac747db6c..59ebdd597279 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java
@@ -296,6 +296,7 @@ abstract class HdmiCecLocalDeviceSource extends HdmiCecLocalDevice {
// do nothing
}
+ @Constants.RcProfile
@Override
protected int getRcProfile() {
return Constants.RC_PROFILE_SOURCE;
@@ -303,10 +304,8 @@ abstract class HdmiCecLocalDeviceSource extends HdmiCecLocalDevice {
@Override
protected List<Integer> getRcFeatures() {
- return Lists.newArrayList(Constants.RC_PROFILE_SOURCE_HANDLES_CONTENTS_MENU,
- Constants.RC_PROFILE_SOURCE_HANDLES_ROOT_MENU,
- Constants.RC_PROFILE_SOURCE_HANDLES_SETUP_MENU,
- Constants.RC_PROFILE_SOURCE_HANDLES_TOP_MENU);
+ return Lists.newArrayList(Constants.RC_PROFILE_SOURCE_HANDLES_ROOT_MENU,
+ Constants.RC_PROFILE_SOURCE_HANDLES_SETUP_MENU);
}
@Override
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 8cf6c9757fe8..11e18c54b1e4 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -53,6 +53,7 @@ import com.android.server.hdmi.HdmiControlService.SendMessageCallback;
import com.google.android.collect.Lists;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -1480,6 +1481,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
return true;
}
+ @Constants.RcProfile
@Override
protected int getRcProfile() {
return Constants.RC_PROFILE_TV;
@@ -1492,8 +1494,21 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
@Override
protected List<Integer> getDeviceFeatures() {
- return Lists.newArrayList(Constants.DEVICE_FEATURE_SINK_SUPPORTS_ARC_TX,
- Constants.DEVICE_FEATURE_TV_SUPPORTS_RECORD_TV_SCREEN);
+ List<Integer> deviceFeatures = new ArrayList<>();
+
+ boolean hasArcPort = false;
+ List<HdmiPortInfo> ports = mService.getPortInfo();
+ for (HdmiPortInfo port : ports) {
+ if (isArcFeatureEnabled(port.getId())) {
+ hasArcPort = true;
+ break;
+ }
+ }
+ if (hasArcPort) {
+ deviceFeatures.add(Constants.DEVICE_FEATURE_SINK_SUPPORTS_ARC_TX);
+ }
+ deviceFeatures.add(Constants.DEVICE_FEATURE_TV_SUPPORTS_RECORD_TV_SCREEN);
+ return deviceFeatures;
}
@Override
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java b/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java
index 96303ce9a76c..0a8621b3e726 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java
@@ -697,8 +697,10 @@ public class HdmiCecMessageBuilder {
}
static HdmiCecMessage buildReportFeatures(int src,
- @HdmiControlManager.HdmiCecVersion int cecVersion, List<Integer> allDeviceTypes,
- int rcProfile, List<Integer> rcFeatures, List<Integer> deviceFeatures) {
+ @HdmiControlManager.HdmiCecVersion int cecVersion,
+ List<Integer> allDeviceTypes, @Constants.RcProfile int rcProfile,
+ List<Integer> rcFeatures,
+ List<Integer> deviceFeatures) {
byte cecVersionByte = (byte) (cecVersion & 0xFF);
byte deviceTypes = 0;
for (Integer deviceType : allDeviceTypes) {
@@ -708,16 +710,16 @@ public class HdmiCecMessageBuilder {
byte rcProfileByte = 0;
rcProfileByte |= rcProfile << 6;
if (rcProfile == Constants.RC_PROFILE_SOURCE) {
- for (Integer rcFeature : rcFeatures) {
+ for (@Constants.RcProfileSource Integer rcFeature : rcFeatures) {
rcProfileByte |= 1 << rcFeature;
}
} else {
- byte rcProfileTv = (byte) (rcFeatures.get(0) & 0xFFFF);
+ @Constants.RcProfileTv byte rcProfileTv = (byte) (rcFeatures.get(0) & 0xFFFF);
rcProfileByte |= rcProfileTv;
}
byte deviceFeaturesByte = 0;
- for (Integer deviceFeature : deviceFeatures) {
+ for (@Constants.DeviceFeature Integer deviceFeature : deviceFeatures) {
deviceFeaturesByte |= 1 << deviceFeature;
}
@@ -777,6 +779,7 @@ public class HdmiCecMessageBuilder {
};
}
+ @Constants.DeviceType
private static int hdmiDeviceInfoDeviceTypeToShiftValue(int deviceType) {
switch (deviceType) {
case HdmiDeviceInfo.DEVICE_TV: