Skip to content

Commit e5910f7

Browse files
Yuncheol HeoAndroid (Google) Code Review
authored andcommitted
Merge "Use the system property for the HdmiControlService configuration." into lmp-dev
2 parents 05182b2 + 7d9acc7 commit e5910f7

4 files changed

Lines changed: 23 additions & 18 deletions

File tree

core/res/res/values/config.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -470,19 +470,6 @@
470470
provide full support for multiple displays. -->
471471
<integer name="config_undockedHdmiRotation">-1</integer>
472472

473-
<!-- HDMI-CEC logical device types allowed on the system. Logical device types
474-
are defined in HDMI-CEC standard 1.4 as follows:
475-
0 TV
476-
1 Recording Device
477-
2 Reserved
478-
3 Tuner
479-
4 Playback
480-
5 Audio System
481-
6 Pure CEC Switch
482-
7 Video Processor -->
483-
<integer-array name="config_hdmiCecLogicalDeviceType">
484-
</integer-array>
485-
486473
<!-- Control the default UI mode type to use when there is no other type override
487474
happening. One of the following values (See Configuration.java):
488475
1 UI_MODE_TYPE_NORMAL

core/res/res/values/symbols.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,6 @@
13281328
<java-symbol type="anim" name="voice_activity_open_exit" />
13291329
<java-symbol type="anim" name="voice_activity_open_enter" />
13301330

1331-
<java-symbol type="array" name="config_hdmiCecLogicalDeviceType" />
13321331
<java-symbol type="array" name="config_keyboardTapVibePattern" />
13331332
<java-symbol type="array" name="config_longPressVibePattern" />
13341333
<java-symbol type="array" name="config_safeModeDisabledVibePattern" />

services/core/java/com/android/server/hdmi/Constants.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,10 @@ final class Constants {
265265
static final int MHL_CBUS_MODE_ECBUS_S = 2;
266266
static final int MHL_CBUS_MODE_ECBUS_D = 3;
267267

268+
// Property name for the local device configurations.
269+
// TODO(OEM): OEM should provide this property, and the value is the comma separated integer
270+
// values which denotes the device type in HDMI Spec 1.4.
271+
static final String PROPERTY_DEVICE_TYPE = "ro.hdmi.device_type";
272+
268273
private Constants() { /* cannot be instantiated */ }
269274
}

services/core/java/com/android/server/hdmi/HdmiControlService.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static com.android.server.hdmi.Constants.DISABLED;
2020
import static com.android.server.hdmi.Constants.ENABLED;
21-
import static com.android.server.hdmi.Constants.OPTION_CEC_AUTO_DEVICE_OFF;
2221
import static com.android.server.hdmi.Constants.OPTION_CEC_AUTO_WAKEUP;
2322
import static com.android.server.hdmi.Constants.OPTION_CEC_ENABLE;
2423
import static com.android.server.hdmi.Constants.OPTION_CEC_SERVICE_CONTROL;
@@ -33,8 +32,8 @@
3332
import android.content.Intent;
3433
import android.content.IntentFilter;
3534
import android.database.ContentObserver;
36-
import android.hardware.hdmi.HdmiDeviceInfo;
3735
import android.hardware.hdmi.HdmiControlManager;
36+
import android.hardware.hdmi.HdmiDeviceInfo;
3837
import android.hardware.hdmi.HdmiHotplugEvent;
3938
import android.hardware.hdmi.HdmiPortInfo;
4039
import android.hardware.hdmi.IHdmiControlCallback;
@@ -55,8 +54,10 @@
5554
import android.os.PowerManager;
5655
import android.os.RemoteException;
5756
import android.os.SystemClock;
57+
import android.os.SystemProperties;
5858
import android.os.UserHandle;
5959
import android.provider.Settings.Global;
60+
import android.text.TextUtils;
6061
import android.util.ArraySet;
6162
import android.util.Slog;
6263
import android.util.SparseArray;
@@ -244,11 +245,24 @@ public void onReceive(Context context, Intent intent) {
244245

245246
public HdmiControlService(Context context) {
246247
super(context);
247-
mLocalDevices = HdmiUtils.asImmutableList(getContext().getResources().getIntArray(
248-
com.android.internal.R.array.config_hdmiCecLogicalDeviceType));
248+
mLocalDevices = getIntList(SystemProperties.get(Constants.PROPERTY_DEVICE_TYPE));
249249
mSettingsObserver = new SettingsObserver(mHandler);
250250
}
251251

252+
private static List<Integer> getIntList(String string) {
253+
ArrayList<Integer> list = new ArrayList<>();
254+
TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
255+
splitter.setString(string);
256+
for (String item : splitter) {
257+
try {
258+
list.add(Integer.parseInt(item));
259+
} catch (NumberFormatException e) {
260+
Slog.w(TAG, "Can't parseInt: " + item);
261+
}
262+
}
263+
return Collections.unmodifiableList(list);
264+
}
265+
252266
@Override
253267
public void onStart() {
254268
mIoThread.start();

0 commit comments

Comments
 (0)