diff options
author | Yuncheol Heo <ycheo@google.com> | 2014-08-12 15:30:49 +0900 |
---|---|---|
committer | Yuncheol Heo <ycheo@google.com> | 2014-08-12 15:55:52 +0900 |
commit | 7d9acc7a3eddb3e57c0b8312c3baf7ebb4f529d9 (patch) | |
tree | 04b53a60d9cccaf1e8265685ff7f3824c8ca62ed /services/core/java/com/android/server/hdmi | |
parent | 54662165b559e8df66ead95655a0cd886d4cff00 (diff) | |
download | frameworks_base-7d9acc7a3eddb3e57c0b8312c3baf7ebb4f529d9.zip frameworks_base-7d9acc7a3eddb3e57c0b8312c3baf7ebb4f529d9.tar.gz frameworks_base-7d9acc7a3eddb3e57c0b8312c3baf7ebb4f529d9.tar.bz2 |
Use the system property for the HdmiControlService configuration.
- We've used the system resoure overlay for this purpose, but we found
that it's hard for OEM which uses PDK to override this. Since the
resource was already compiled and provided as a binary, so it's hard
to change it.
Bug: 16965963
Change-Id: I868305d6f76c128d79c00ab6a8023656cd476c62
Diffstat (limited to 'services/core/java/com/android/server/hdmi')
-rw-r--r-- | services/core/java/com/android/server/hdmi/Constants.java | 5 | ||||
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiControlService.java | 22 |
2 files changed, 23 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/hdmi/Constants.java b/services/core/java/com/android/server/hdmi/Constants.java index b55cf62..591cf25 100644 --- a/services/core/java/com/android/server/hdmi/Constants.java +++ b/services/core/java/com/android/server/hdmi/Constants.java @@ -265,5 +265,10 @@ final class Constants { static final int MHL_CBUS_MODE_ECBUS_S = 2; static final int MHL_CBUS_MODE_ECBUS_D = 3; + // Property name for the local device configurations. + // TODO(OEM): OEM should provide this property, and the value is the comma separated integer + // values which denotes the device type in HDMI Spec 1.4. + static final String PROPERTY_DEVICE_TYPE = "ro.hdmi.device_type"; + private Constants() { /* cannot be instantiated */ } } diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 6f33f75..0e57afd 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -18,7 +18,6 @@ package com.android.server.hdmi; import static com.android.server.hdmi.Constants.DISABLED; import static com.android.server.hdmi.Constants.ENABLED; -import static com.android.server.hdmi.Constants.OPTION_CEC_AUTO_DEVICE_OFF; import static com.android.server.hdmi.Constants.OPTION_CEC_AUTO_WAKEUP; import static com.android.server.hdmi.Constants.OPTION_CEC_ENABLE; import static com.android.server.hdmi.Constants.OPTION_CEC_SERVICE_CONTROL; @@ -33,8 +32,8 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.ContentObserver; -import android.hardware.hdmi.HdmiDeviceInfo; import android.hardware.hdmi.HdmiControlManager; +import android.hardware.hdmi.HdmiDeviceInfo; import android.hardware.hdmi.HdmiHotplugEvent; import android.hardware.hdmi.HdmiPortInfo; import android.hardware.hdmi.IHdmiControlCallback; @@ -55,8 +54,10 @@ import android.os.Looper; import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; +import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings.Global; +import android.text.TextUtils; import android.util.ArraySet; import android.util.Slog; import android.util.SparseArray; @@ -244,11 +245,24 @@ public final class HdmiControlService extends SystemService { public HdmiControlService(Context context) { super(context); - mLocalDevices = HdmiUtils.asImmutableList(getContext().getResources().getIntArray( - com.android.internal.R.array.config_hdmiCecLogicalDeviceType)); + mLocalDevices = getIntList(SystemProperties.get(Constants.PROPERTY_DEVICE_TYPE)); mSettingsObserver = new SettingsObserver(mHandler); } + private static List<Integer> getIntList(String string) { + ArrayList<Integer> list = new ArrayList<>(); + TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter(','); + splitter.setString(string); + for (String item : splitter) { + try { + list.add(Integer.parseInt(item)); + } catch (NumberFormatException e) { + Slog.w(TAG, "Can't parseInt: " + item); + } + } + return Collections.unmodifiableList(list); + } + @Override public void onStart() { mIoThread.start(); |