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

Commit e37628c0 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Android (Google) Code Review
Browse files

Merge "CEC: Expose API sendStandby()"

parents 9b58c855 8d115eb1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13982,6 +13982,7 @@ package android.hardware.hdmi {
    method public int getDeviceType();
    method public void oneTouchPlay(android.hardware.hdmi.HdmiPlaybackClient.OneTouchPlayCallback);
    method public void queryDisplayStatus(android.hardware.hdmi.HdmiPlaybackClient.DisplayStatusCallback);
    method public void sendStandby();
  }
  public static abstract interface HdmiPlaybackClient.DisplayStatusCallback {
@@ -14090,6 +14091,7 @@ package android.hardware.hdmi {
    method public int getDeviceType();
    method public void portSelect(int, android.hardware.hdmi.HdmiTvClient.SelectCallback);
    method public void sendMhlVendorCommand(int, int, int, byte[]);
    method public void sendStandby(int);
    method public void setHdmiMhlVendorCommandListener(android.hardware.hdmi.HdmiTvClient.HdmiMhlVendorCommandListener);
    method public void setInputChangeListener(android.hardware.hdmi.HdmiTvClient.InputChangeListener);
    method public void setRecordListener(android.hardware.hdmi.HdmiRecordListener);
+14 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ import android.util.Log;
public final class HdmiPlaybackClient extends HdmiClient {
    private static final String TAG = "HdmiPlaybackClient";

    // Logical address of TV. The secondary TV is not handled.
    private static final int ADDR_TV = 0;

    /**
     * Listener used by the client to get the result of one touch play operation.
     */
@@ -103,6 +106,17 @@ public final class HdmiPlaybackClient extends HdmiClient {
        }
    }

    /**
     * Sends a <Standby> command to TV.
     */
    public void sendStandby() {
        try {
            mService.sendStandby(getDeviceType(), HdmiDeviceInfo.idForCecDevice(ADDR_TV));
        } catch (RemoteException e) {
            Log.e(TAG, "sendStandby threw exception ", e);
        }
    }

    private IHdmiControlCallback getCallbackWrapper(final OneTouchPlayCallback callback) {
        return new IHdmiControlCallback.Stub() {
            @Override
+13 −0
Original line number Diff line number Diff line
@@ -211,6 +211,19 @@ public final class HdmiTvClient extends HdmiClient {
        }
    }

    /**
     * Sends a <Standby> command to other device.
     *
     * @param deviceId device id to send the command to
     */
    public void sendStandby(int deviceId) {
        try {
            mService.sendStandby(getDeviceType(), deviceId);
        } catch (RemoteException e) {
            Log.e(TAG, "sendStandby threw exception ", e);
        }
    }

    private static IHdmiRecordListener getListenerWrapper(final HdmiRecordListener callback) {
        return new IHdmiRecordListener.Stub() {
            @Override
+10 −0
Original line number Diff line number Diff line
@@ -252,6 +252,16 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice {
        return true;  // Broadcast message.
    }

    @Override
    @ServiceThreadOnly
    protected void sendStandby(int deviceId) {
        assertRunOnServiceThread();

        // Playback device can send <Standby> to TV only. Ignore the parameter.
        int targetAddress = Constants.ADDR_TV;
        mService.sendCecCommand(HdmiCecMessageBuilder.buildStandby(mAddress, targetAddress));
    }

    @Override
    @ServiceThreadOnly
    protected void disableDevice(boolean initiatedByCec, PendingActionClearedCallback callback) {