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

Commit 5fba96df authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

HdmiConfig class holding constants that may need customization

Put in one place some constants used in HdmiControlService that
may need customization. This makes it easy to do the job.

Bug: 16160911

Change-Id: I59786a48d336cfca722daa82c1f0dceb88c5e5e4
parent 2db72ad4
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -51,8 +51,6 @@ final class DeviceDiscoveryAction extends FeatureAction {
    // State in which the action is waiting for gathering vendor id of non-local devices.
    private static final int STATE_WAITING_FOR_VENDOR_ID = 4;

    private static final int DEVICE_POLLING_RETRY = 1;

    /**
     * Interface used to report result of device discovery.
     */
@@ -118,7 +116,7 @@ final class DeviceDiscoveryAction extends FeatureAction {
                startPhysicalAddressStage();
            }
        }, Constants.POLL_ITERATION_REVERSE_ORDER
            | Constants.POLL_STRATEGY_REMOTES_DEVICES, DEVICE_POLLING_RETRY);
            | Constants.POLL_STRATEGY_REMOTES_DEVICES, HdmiConfig.DEVICE_POLLING_RETRY);
        return true;
    }

@@ -154,7 +152,7 @@ final class DeviceDiscoveryAction extends FeatureAction {
            return;
        }
        sendCommand(HdmiCecMessageBuilder.buildGivePhysicalAddress(getSourceAddress(), address));
        addTimer(mState, TIMEOUT_MS);
        addTimer(mState, HdmiConfig.TIMEOUT_MS);
    }

    private void startOsdNameStage() {
@@ -177,7 +175,7 @@ final class DeviceDiscoveryAction extends FeatureAction {
            return;
        }
        sendCommand(HdmiCecMessageBuilder.buildGiveOsdNameCommand(getSourceAddress(), address));
        addTimer(mState, TIMEOUT_MS);
        addTimer(mState, HdmiConfig.TIMEOUT_MS);
    }

    private void startVendorIdStage() {
@@ -202,7 +200,7 @@ final class DeviceDiscoveryAction extends FeatureAction {
        }
        sendCommand(
                HdmiCecMessageBuilder.buildGiveDeviceVendorIdCommand(getSourceAddress(), address));
        addTimer(mState, TIMEOUT_MS);
        addTimer(mState, HdmiConfig.TIMEOUT_MS);
    }

    private boolean mayProcessMessageIfCached(int address, int opcode) {
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ final class DevicePowerStatusAction extends FeatureAction {
    boolean start() {
        queryDevicePowerStatus();
        mState = STATE_WAITING_FOR_REPORT_POWER_STATUS;
        addTimer(mState, FeatureAction.TIMEOUT_MS);
        addTimer(mState, HdmiConfig.TIMEOUT_MS);
        return true;
    }

+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ final class DeviceSelectAction extends FeatureAction {
            }
        });
        mState = STATE_WAIT_FOR_REPORT_POWER_STATUS;
        addTimer(mState, TIMEOUT_MS);
        addTimer(mState, HdmiConfig.TIMEOUT_MS);
    }

    @Override
+0 −4
Original line number Diff line number Diff line
@@ -47,10 +47,6 @@ abstract class FeatureAction {
    // Timer handler message used for timeout event
    protected static final int MSG_TIMEOUT = 100;

    // Default timeout for the incoming command to arrive in response to a request.
    // TODO: Consider reading this value from configuration to allow customization.
    protected static final int TIMEOUT_MS = 2000;

    // Default state used in common by all the feature actions.
    protected static final int STATE_NONE = 0;

+1 −4
Original line number Diff line number Diff line
@@ -77,8 +77,6 @@ final class HdmiCecController {

    private static final int NUM_LOGICAL_ADDRESS = 16;

    private static final int RETRY_COUNT_FOR_LOGICAL_ADDRESS_ALLOCATION = 3;

    // Predicate for whether the given logical address is remote device's one or not.
    private final Predicate<Integer> mRemoteDeviceAddressPredicate = new Predicate<Integer>() {
        @Override
@@ -198,8 +196,7 @@ final class HdmiCecController {
            int curAddress = (startAddress + i) % NUM_LOGICAL_ADDRESS;
            if (curAddress != Constants.ADDR_UNREGISTERED
                    && deviceType == HdmiUtils.getTypeFromAddress(curAddress)) {
                if (!sendPollMessage(curAddress, curAddress,
                        RETRY_COUNT_FOR_LOGICAL_ADDRESS_ALLOCATION)) {
                if (!sendPollMessage(curAddress, curAddress, HdmiConfig.ADDRESS_ALLOCATION_RETRY)) {
                    logicalAddress = curAddress;
                    break;
                }
Loading