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

Commit b4a43d87 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use HdmiProperties class for ro.hdmi.device_type"

parents fa0a47ed 0cbc3786
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -306,10 +306,6 @@ final class Constants {
    static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback";
    static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv";

    // 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";

    // TODO(OEM): Set this to false to keep the playback device in sleep upon hotplug event.
    //            True by default.
+11 −1
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings.Global;
import android.sysprop.HdmiProperties;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Slog;
@@ -94,6 +95,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * Provides a service for sending and processing HDMI control messages,
@@ -435,7 +438,14 @@ public class HdmiControlService extends SystemService {

    public HdmiControlService(Context context) {
        super(context);
        mLocalDevices = getIntList(SystemProperties.get(Constants.PROPERTY_DEVICE_TYPE));
        List<Integer> deviceTypes = HdmiProperties.device_type();
        if (deviceTypes.contains(null)) {
            Slog.w(TAG, "Error parsing ro.hdmi.device.type: " + SystemProperties.get(
                    "ro.hdmi.device_type"));
            deviceTypes = deviceTypes.stream().filter(Objects::nonNull).collect(
                    Collectors.toList());
        }
        mLocalDevices = deviceTypes;
        mSettingsObserver = new SettingsObserver(mHandler);
    }