Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d9acc7a authored by Yuncheol Heo's avatar Yuncheol Heo
Browse files

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
parent 54662165
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -470,19 +470,6 @@
         provide full support for multiple displays.  -->
    <integer name="config_undockedHdmiRotation">-1</integer>

    <!-- HDMI-CEC logical device types allowed on the system. Logical device types
         are defined in HDMI-CEC standard 1.4 as follows:
           0 TV
           1 Recording Device
           2 Reserved
           3 Tuner
           4 Playback
           5 Audio System
           6 Pure CEC Switch
           7 Video Processor    -->
    <integer-array name="config_hdmiCecLogicalDeviceType">
    </integer-array>

    <!-- Control the default UI mode type to use when there is no other type override
         happening.  One of the following values (See Configuration.java):
             1  UI_MODE_TYPE_NORMAL
+0 −1
Original line number Diff line number Diff line
@@ -1328,7 +1328,6 @@
  <java-symbol type="anim" name="voice_activity_open_exit" />
  <java-symbol type="anim" name="voice_activity_open_enter" />

  <java-symbol type="array" name="config_hdmiCecLogicalDeviceType" />
  <java-symbol type="array" name="config_keyboardTapVibePattern" />
  <java-symbol type="array" name="config_longPressVibePattern" />
  <java-symbol type="array" name="config_safeModeDisabledVibePattern" />
+5 −0
Original line number Diff line number Diff line
@@ -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 */ }
}
+18 −4
Original line number Diff line number Diff line
@@ -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();