Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -11033,6 +11033,7 @@ package android.hardware.hdmi { public final class HdmiCecClient { method public boolean isTvOn(); method public void sendActiveSource(); method public void sendGiveDevicePowerStatus(int); method public void sendImageViewOn(); method public void sendInactiveSource(); method public void sendTextViewOn(); core/java/android/hardware/hdmi/HdmiCecClient.java +16 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,20 @@ public final class HdmiCecClient { } } /** * Send <Give Device Power Status> message. * * @param address logical address of the device to send the message to, such as * {@link HdmiCec#ADDR_TV}. */ public void sendGiveDevicePowerStatus(int address) { try { mService.sendGiveDevicePowerStatus(mBinder, address); } catch (RemoteException e) { Log.e(TAG, "sendGiveDevicePowerStatus threw exception ", e); } } /** * Returns true if the TV or attached display is powered on. * <p> Loading core/java/android/hardware/hdmi/IHdmiCecService.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ interface IHdmiCecService { void sendInactiveSource(IBinder b); void sendImageViewOn(IBinder b); void sendTextViewOn(IBinder b); void sendGiveDevicePowerStatus(IBinder b, int address); boolean isTvOn(IBinder b); void sendMessage(IBinder b, in HdmiCecMessage message); } Loading services/core/java/com/android/server/hdmi/HdmiCecDevice.java +39 −1 Original line number Diff line number Diff line Loading @@ -181,12 +181,50 @@ abstract class HdmiCecDevice { mIsActiveSource = state; } /** * Send <Active Source> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendActiveSource(int physicalAddress) { logWarning("<Active Source> not valid for the device type: " + mType + " address:" + physicalAddress); } /** * Send <Inactive Source> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendInactiveSource(int physicalAddress) { logWarning("<Inactive Source> not valid for the device type: " + mType + " address:" + physicalAddress); } /** * Send <Image View On> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendImageViewOn() { logWarning("<Image View On> not valid for the device type: " + mType); } /** * Send <Text View On> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendTextViewOn() { logWarning("<Text View On> not valid for the device type: " + mType); } /** * Check if the connected sink device is in powered-on state. The default implementation * simply returns false. Should be overriden by subclass to report the correct state. */ public boolean isSinkDeviceOn() { Log.w(TAG, "Not valid for the device type: " + mType); logWarning("isSinkDeviceOn() not valid for the device type: " + mType); return false; } private void logWarning(String msg) { Log.w(TAG, msg); } } services/core/java/com/android/server/hdmi/HdmiCecDevicePlayback.java +34 −3 Original line number Diff line number Diff line Loading @@ -66,14 +66,11 @@ final class HdmiCecDevicePlayback extends HdmiCecDevice { // 1) Response for the queried power status request arrives. Update the status. // 2) Broadcast or direct <Standby> command from TV, which is sent as TV itself is going // into standby mode too. // 3) Broadcast <Report Physical Address> command from TV, which is sent while it boots up. if (opcode == HdmiCec.MESSAGE_REPORT_POWER_STATUS) { mSinkDevicePowerStatus = params[0]; } else if (srcAddress == HdmiCec.ADDR_TV) { if (opcode == HdmiCec.MESSAGE_STANDBY) { mSinkDevicePowerStatus = HdmiCec.POWER_STATUS_STANDBY; } else if (opcode == HdmiCec.MESSAGE_REPORT_PHYSICAL_ADDRESS) { mSinkDevicePowerStatus = HdmiCec.POWER_STATUS_ON; } } super.handleMessage(srcAddress, dstAddress, opcode, params); Loading @@ -95,4 +92,38 @@ final class HdmiCecDevicePlayback extends HdmiCecDevice { public boolean isSinkDeviceOn() { return mSinkDevicePowerStatus == HdmiCec.POWER_STATUS_ON; } @Override public void sendActiveSource(int physicalAddress) { setIsActiveSource(true); byte[] param = new byte[] { (byte) ((physicalAddress >> 8) & 0xff), (byte) (physicalAddress & 0xff) }; getService().sendMessage(getType(), HdmiCec.ADDR_BROADCAST, HdmiCec.MESSAGE_ACTIVE_SOURCE, param); } @Override public void sendInactiveSource(int physicalAddress) { setIsActiveSource(false); byte[] param = new byte[] { (byte) ((physicalAddress >> 8) & 0xff), (byte) (physicalAddress & 0xff) }; getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_INACTIVE_SOURCE, param); } @Override public void sendImageViewOn() { getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_IMAGE_VIEW_ON, HdmiCecService.EMPTY_PARAM); } @Override public void sendTextViewOn() { getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_TEXT_VIEW_ON, HdmiCecService.EMPTY_PARAM); } } Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -11033,6 +11033,7 @@ package android.hardware.hdmi { public final class HdmiCecClient { method public boolean isTvOn(); method public void sendActiveSource(); method public void sendGiveDevicePowerStatus(int); method public void sendImageViewOn(); method public void sendInactiveSource(); method public void sendTextViewOn();
core/java/android/hardware/hdmi/HdmiCecClient.java +16 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,20 @@ public final class HdmiCecClient { } } /** * Send <Give Device Power Status> message. * * @param address logical address of the device to send the message to, such as * {@link HdmiCec#ADDR_TV}. */ public void sendGiveDevicePowerStatus(int address) { try { mService.sendGiveDevicePowerStatus(mBinder, address); } catch (RemoteException e) { Log.e(TAG, "sendGiveDevicePowerStatus threw exception ", e); } } /** * Returns true if the TV or attached display is powered on. * <p> Loading
core/java/android/hardware/hdmi/IHdmiCecService.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ interface IHdmiCecService { void sendInactiveSource(IBinder b); void sendImageViewOn(IBinder b); void sendTextViewOn(IBinder b); void sendGiveDevicePowerStatus(IBinder b, int address); boolean isTvOn(IBinder b); void sendMessage(IBinder b, in HdmiCecMessage message); } Loading
services/core/java/com/android/server/hdmi/HdmiCecDevice.java +39 −1 Original line number Diff line number Diff line Loading @@ -181,12 +181,50 @@ abstract class HdmiCecDevice { mIsActiveSource = state; } /** * Send <Active Source> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendActiveSource(int physicalAddress) { logWarning("<Active Source> not valid for the device type: " + mType + " address:" + physicalAddress); } /** * Send <Inactive Source> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendInactiveSource(int physicalAddress) { logWarning("<Inactive Source> not valid for the device type: " + mType + " address:" + physicalAddress); } /** * Send <Image View On> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendImageViewOn() { logWarning("<Image View On> not valid for the device type: " + mType); } /** * Send <Text View On> command. The default implementation does nothing. Should be * overriden by subclass. */ public void sendTextViewOn() { logWarning("<Text View On> not valid for the device type: " + mType); } /** * Check if the connected sink device is in powered-on state. The default implementation * simply returns false. Should be overriden by subclass to report the correct state. */ public boolean isSinkDeviceOn() { Log.w(TAG, "Not valid for the device type: " + mType); logWarning("isSinkDeviceOn() not valid for the device type: " + mType); return false; } private void logWarning(String msg) { Log.w(TAG, msg); } }
services/core/java/com/android/server/hdmi/HdmiCecDevicePlayback.java +34 −3 Original line number Diff line number Diff line Loading @@ -66,14 +66,11 @@ final class HdmiCecDevicePlayback extends HdmiCecDevice { // 1) Response for the queried power status request arrives. Update the status. // 2) Broadcast or direct <Standby> command from TV, which is sent as TV itself is going // into standby mode too. // 3) Broadcast <Report Physical Address> command from TV, which is sent while it boots up. if (opcode == HdmiCec.MESSAGE_REPORT_POWER_STATUS) { mSinkDevicePowerStatus = params[0]; } else if (srcAddress == HdmiCec.ADDR_TV) { if (opcode == HdmiCec.MESSAGE_STANDBY) { mSinkDevicePowerStatus = HdmiCec.POWER_STATUS_STANDBY; } else if (opcode == HdmiCec.MESSAGE_REPORT_PHYSICAL_ADDRESS) { mSinkDevicePowerStatus = HdmiCec.POWER_STATUS_ON; } } super.handleMessage(srcAddress, dstAddress, opcode, params); Loading @@ -95,4 +92,38 @@ final class HdmiCecDevicePlayback extends HdmiCecDevice { public boolean isSinkDeviceOn() { return mSinkDevicePowerStatus == HdmiCec.POWER_STATUS_ON; } @Override public void sendActiveSource(int physicalAddress) { setIsActiveSource(true); byte[] param = new byte[] { (byte) ((physicalAddress >> 8) & 0xff), (byte) (physicalAddress & 0xff) }; getService().sendMessage(getType(), HdmiCec.ADDR_BROADCAST, HdmiCec.MESSAGE_ACTIVE_SOURCE, param); } @Override public void sendInactiveSource(int physicalAddress) { setIsActiveSource(false); byte[] param = new byte[] { (byte) ((physicalAddress >> 8) & 0xff), (byte) (physicalAddress & 0xff) }; getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_INACTIVE_SOURCE, param); } @Override public void sendImageViewOn() { getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_IMAGE_VIEW_ON, HdmiCecService.EMPTY_PARAM); } @Override public void sendTextViewOn() { getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_TEXT_VIEW_ON, HdmiCecService.EMPTY_PARAM); } }