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

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

Merge "Remove two TODOs from HotpulgDetectionAction."

parents c769c1c8 26dc71e7
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -911,12 +911,14 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    final void removeCecDevice(int address) {
    final void removeCecDevice(int address) {
        assertRunOnServiceThread();
        assertRunOnServiceThread();
        HdmiCecDeviceInfo info = removeDeviceInfo(address);
        HdmiCecDeviceInfo info = removeDeviceInfo(address);
        handleRemoveActiveRoutingPath(info.getPhysicalAddress());

        mCecMessageCache.flushMessagesFrom(address);
        mCecMessageCache.flushMessagesFrom(address);
        mService.invokeDeviceEventListeners(info, false);
        mService.invokeDeviceEventListeners(info, false);
    }
    }


    private void handleRemoveActiveRoutingPath(int path) {
    @ServiceThreadOnly
    void handleRemoveActiveRoutingPath(int path) {
        assertRunOnServiceThread();
        // Seq #23
        // Seq #23
        if (isTailOfActivePath(path, getActivePath())) {
        if (isTailOfActivePath(path, getActivePath())) {
            removeAction(RoutingControlAction.class);
            removeAction(RoutingControlAction.class);
+6 −7
Original line number Original line Diff line number Diff line
@@ -34,6 +34,7 @@ import java.util.List;
 * If system audio is on, check hot-plug for audio system every 5 secs.
 * If system audio is on, check hot-plug for audio system every 5 secs.
 * For other devices, keep 15 secs period.
 * For other devices, keep 15 secs period.
 */
 */
// #Seq 3
final class HotplugDetectionAction extends FeatureAction {
final class HotplugDetectionAction extends FeatureAction {
    private static final String TAG = "HotPlugDetectionAction";
    private static final String TAG = "HotPlugDetectionAction";


@@ -193,14 +194,12 @@ final class HotplugDetectionAction extends FeatureAction {
    }
    }


    private void addDevice(int addedAddress) {
    private void addDevice(int addedAddress) {
        // Send <Give Physical Address>.
        // Sending <Give Physical Address> will initiate new device action.
        sendCommand(HdmiCecMessageBuilder.buildGivePhysicalAddress(getSourceAddress(),
        sendCommand(HdmiCecMessageBuilder.buildGivePhysicalAddress(getSourceAddress(),
                addedAddress));
                addedAddress));
    }
    }


    private void removeDevice(int removedAddress) {
    private void removeDevice(int removedAddress) {
        // TODO: move the following logic to local device once move many logic to
        //       local device.
        mayChangeRoutingPath(removedAddress);
        mayChangeRoutingPath(removedAddress);
        mayCancelDeviceSelect(removedAddress);
        mayCancelDeviceSelect(removedAddress);
        mayCancelOneTouchRecord(removedAddress);
        mayCancelOneTouchRecord(removedAddress);
@@ -210,10 +209,10 @@ final class HotplugDetectionAction extends FeatureAction {
    }
    }


    private void mayChangeRoutingPath(int address) {
    private void mayChangeRoutingPath(int address) {
        // TODO: if removed address is current active source, it should change active source
        HdmiCecDeviceInfo info = tv().getDeviceInfo(address);
        // path new one. we can keep previous selection or can choose default input,
        if (info != null) {
        // such as internal tuner. Consider send intent to app so that app
            tv().handleRemoveActiveRoutingPath(info.getPhysicalAddress());
        // can handle it.
        }
    }
    }


    private void mayCancelDeviceSelect(int address) {
    private void mayCancelDeviceSelect(int address) {