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

Commit d76888aa authored by Amy's avatar Amy Committed by Shubang Lu
Browse files

Add RoutingInformation CEC message builder.

ag/4918461

Test: atest com.android.server.hdmi
Change-Id: I945c23cf213986b2b26f2c233931c703f6303e8d
parent 6cef86ca
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -364,6 +364,20 @@ public class HdmiCecMessageBuilder {
                param);
                param);
    }
    }


    /**
     * Build <Routing Information> command.
     *
     * <p>This is a broadcast message sent to all devices on the bus.
     *
     * @param src source address of command
     * @param physicalAddress physical address of the new active routing path
     * @return newly created {@link HdmiCecMessage}
     */
    static HdmiCecMessage buildRoutingInformation(int src, int physicalAddress) {
        return buildCommand(src, Constants.ADDR_BROADCAST,
            Constants.MESSAGE_ROUTING_INFORMATION, physicalAddressToParam(physicalAddress));
    }

    /**
    /**
     * Build &lt;Give Device Power Status&gt; command.
     * Build &lt;Give Device Power Status&gt; command.
     *
     *
+9 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.hdmi;
import static com.android.server.hdmi.Constants.ADDR_AUDIO_SYSTEM;
import static com.android.server.hdmi.Constants.ADDR_AUDIO_SYSTEM;
import static com.android.server.hdmi.Constants.ADDR_PLAYBACK_1;
import static com.android.server.hdmi.Constants.ADDR_PLAYBACK_1;
import static com.android.server.hdmi.Constants.ADDR_TV;
import static com.android.server.hdmi.Constants.ADDR_TV;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertThat;


import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.HdmiDeviceInfo;
@@ -51,6 +52,14 @@ public class HdmiCecMessageBuilderTest {
        assertThat(message).isEqualTo(buildMessage("05:A4:06:01"));
        assertThat(message).isEqualTo(buildMessage("05:A4:06:01"));
    }
    }


    @Test
    public void buildRoutingInformation() {
        HdmiCecMessage message =
                HdmiCecMessageBuilder.buildRoutingInformation(
                        ADDR_AUDIO_SYSTEM, 0x2100);
        assertThat(message).isEqualTo(buildMessage("5F:81:21:00"));
    }

    /**
    /**
     * Build a CEC message from a hex byte string with bytes separated by {@code :}.
     * Build a CEC message from a hex byte string with bytes separated by {@code :}.
     *
     *