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

Commit 0f43bf60 authored by Jungshik Jang's avatar Jungshik Jang Committed by Android (Google) Code Review
Browse files

Merge "Prevent hot plug detection action from multiple device polling" into lmp-dev

parents c71c42fd 8e93c847
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public final class HdmiPlaybackClient extends HdmiClient {
        }
    }

    @Override
    public int getDeviceType() {
        return HdmiCecDeviceInfo.DEVICE_PLAYBACK;
    }
@@ -93,7 +94,6 @@ public final class HdmiPlaybackClient extends HdmiClient {
     *         of the result
     */
    public void queryDisplayStatus(DisplayStatusCallback callback) {
        // TODO: PendingResult.
        try {
            mService.queryDisplayStatus(getCallbackWrapper(callback));
        } catch (RemoteException e) {
+0 −4
Original line number Diff line number Diff line
@@ -101,10 +101,6 @@ final class ActiveSourceHandler {
        return mSource.getDeviceInfo().getLogicalAddress();
    }

    private final int getSourcePath() {
        return mSource.getDeviceInfo().getPhysicalAddress();
    }

    private void invokeCallback(int result) {
        if (mCallback == null) {
            return;
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.hardware.hdmi.HdmiCecDeviceInfo;
/**
 * Defines constants related to HDMI-CEC protocol internal implementation.
 * If a constant will be used in the public api, it should be located in
 * {@link android.hardware.hdmi.HdmiCec}.
 * {@link android.hardware.hdmi.HdmiControlManager}.
 */
final class Constants {

+7 −7
Original line number Diff line number Diff line
@@ -17,19 +17,19 @@ package com.android.server.hdmi;
 */

import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.HdmiPlaybackClient;
import android.hardware.hdmi.HdmiPlaybackClient.DisplayStatusCallback;
import android.hardware.hdmi.IHdmiControlCallback;
import android.os.RemoteException;
import android.util.Slog;

/**
 * Feature action that queries the power status of other device.
 *
 * This action is initiated via {@link HdmiControlManager#queryDisplayStatus()} from
 * the Android system working as playback device to get the power status of TV device.
 *
 * <p>Package-private, accessed by {@link HdmiControlService} only.
 * Feature action that queries the power status of other device. This action is initiated via
 * {@link HdmiPlaybackClient#queryDisplayStatus(DisplayStatusCallback)} from the Android system
 * working as playback device to get the power status of TV device.
 * <p>
 * Package-private, accessed by {@link HdmiControlService} only.
 */

final class DevicePowerStatusAction extends FeatureAction {
    private static final String TAG = "DevicePowerStatusAction";

+10 −12
Original line number Diff line number Diff line
@@ -65,16 +65,6 @@ final class HdmiCecController {

    private static final byte[] EMPTY_BODY = EmptyArray.BYTE;

    // A message to pass cec send command to IO looper.
    private static final int MSG_SEND_CEC_COMMAND = 1;
    // A message to delegate logical allocation to IO looper.
    private static final int MSG_ALLOCATE_LOGICAL_ADDRESS = 2;

    // Message types to handle incoming message in main service looper.
    private final static int MSG_RECEIVE_CEC_COMMAND = 1;
    // A message to report allocated logical address to main control looper.
    private final static int MSG_REPORT_LOGICAL_ADDRESS = 2;

    private static final int NUM_LOGICAL_ADDRESS = 16;

    // Predicate for whether the given logical address is remote device's one or not.
@@ -196,7 +186,15 @@ final class HdmiCecController {
            int curAddress = (startAddress + i) % NUM_LOGICAL_ADDRESS;
            if (curAddress != Constants.ADDR_UNREGISTERED
                    && deviceType == HdmiUtils.getTypeFromAddress(curAddress)) {
                if (!sendPollMessage(curAddress, curAddress, HdmiConfig.ADDRESS_ALLOCATION_RETRY)) {
                int failedPollingCount = 0;
                for (int j = 0; j < HdmiConfig.ADDRESS_ALLOCATION_RETRY; ++j) {
                    if (!sendPollMessage(curAddress, curAddress, 1)) {
                        failedPollingCount++;
                    }
                }

                // Pick logical address if failed ratio is more than a half of all retries.
                if (failedPollingCount * 2 >  HdmiConfig.ADDRESS_ALLOCATION_RETRY) {
                    logicalAddress = curAddress;
                    break;
                }
Loading