Loading core/java/android/hardware/hdmi/HdmiClient.java +28 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,29 @@ public abstract class HdmiClient { mService = service; } /** * Send a key event to other logical device. * * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}. * @param isPressed true if this is key press event */ public void sendKeyEvent(int keyCode, boolean isPressed) { try { mService.sendKeyEvent(getDeviceType(), keyCode, isPressed); } catch (RemoteException e) { Log.e(TAG, "queryDisplayStatus threw exception ", e); } } /** * Send vendor-specific command. * * @param targetAddress address of the target device * @param params vendor-specific parameter. For <Vendor Command With ID> do not * include the first 3 bytes (vendor ID). * @param hasVendorId {@code true} if the command type will be <Vendor Command With ID>. * {@code false} if the command will be <Vendor Command> */ public void sendVendorCommand(int targetAddress, byte[] params, boolean hasVendorId) { try { mService.sendVendorCommand(getDeviceType(), targetAddress, params, hasVendorId); Loading @@ -32,6 +55,11 @@ public abstract class HdmiClient { } } /** * Add a listener used to receive incoming vendor-specific command. * * @param listener listener object */ public void addVendorCommandListener(VendorCommandListener listener) { try { mService.addVendorCommandListener(getListenerWrapper(listener), getDeviceType()); Loading core/java/android/hardware/hdmi/IHdmiControlService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ interface IHdmiControlService { void addDeviceEventListener(IHdmiDeviceEventListener listener); void deviceSelect(int logicalAddress, IHdmiControlCallback callback); void portSelect(int portId, IHdmiControlCallback callback); void sendKeyEvent(int keyCode, boolean isPressed); void sendKeyEvent(int deviceType, int keyCode, boolean isPressed); List<HdmiPortInfo> getPortInfo(); boolean canChangeSystemAudioMode(); boolean getSystemAudioMode(); Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +12 −2 Original line number Diff line number Diff line Loading @@ -581,7 +581,7 @@ abstract class HdmiCecLocalDevice { * Called when the system started transition to standby mode. * * @param initiatedByCec true if this power sequence is initiated * by the reception the CEC messages like <StandBy> * by the reception the CEC messages like <StandBy> */ protected void onTransitionToStandby(boolean initiatedByCec) { // If there are no outstanding actions, we'll go to STANDBY state. Loading @@ -592,7 +592,17 @@ abstract class HdmiCecLocalDevice { * Called when the system goes to standby mode. * * @param initiatedByCec true if this power sequence is initiated * by the reception the CEC messages like <StandBy> * by the reception the CEC messages like <StandBy> */ protected void onStandBy(boolean initiatedByCec) {} /** * Send a key event to other device. * * @param keyCode key code defined in {@link android.os.KeyEvent} * @param isPressed {@code true} for key down event */ protected void sendKeyEvent(int keyCode, boolean isPressed) { Slog.w(TAG, "sendKeyEvent not implemented"); } } services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +3 −2 Original line number Diff line number Diff line Loading @@ -226,8 +226,9 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}. * @param isPressed true if this is key press event */ @Override @ServiceThreadOnly void sendKeyEvent(int keyCode, boolean isPressed) { protected void sendKeyEvent(int keyCode, boolean isPressed) { assertRunOnServiceThread(); List<SendKeyAction> action = getActions(SendKeyAction.class); if (!action.isEmpty()) { Loading services/core/java/com/android/server/hdmi/HdmiControlService.java +5 −7 Original line number Diff line number Diff line Loading @@ -691,19 +691,17 @@ public final class HdmiControlService extends SystemService { } @Override public void sendKeyEvent(final int keyCode, final boolean isPressed) { public void sendKeyEvent(final int deviceType, final int keyCode, final boolean isPressed) { enforceAccessPermission(); runOnServiceThread(new Runnable() { @Override public void run() { // TODO: sendKeyEvent is for TV device only for now. Allow other // local devices of different types to use this as well. HdmiCecLocalDeviceTv tv = tv(); if (tv == null) { Slog.w(TAG, "Local tv device not available"); HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(deviceType); if (localDevice == null) { Slog.w(TAG, "Local device not available"); return; } tv.sendKeyEvent(keyCode, isPressed); localDevice.sendKeyEvent(keyCode, isPressed); } }); } Loading Loading
core/java/android/hardware/hdmi/HdmiClient.java +28 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,29 @@ public abstract class HdmiClient { mService = service; } /** * Send a key event to other logical device. * * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}. * @param isPressed true if this is key press event */ public void sendKeyEvent(int keyCode, boolean isPressed) { try { mService.sendKeyEvent(getDeviceType(), keyCode, isPressed); } catch (RemoteException e) { Log.e(TAG, "queryDisplayStatus threw exception ", e); } } /** * Send vendor-specific command. * * @param targetAddress address of the target device * @param params vendor-specific parameter. For <Vendor Command With ID> do not * include the first 3 bytes (vendor ID). * @param hasVendorId {@code true} if the command type will be <Vendor Command With ID>. * {@code false} if the command will be <Vendor Command> */ public void sendVendorCommand(int targetAddress, byte[] params, boolean hasVendorId) { try { mService.sendVendorCommand(getDeviceType(), targetAddress, params, hasVendorId); Loading @@ -32,6 +55,11 @@ public abstract class HdmiClient { } } /** * Add a listener used to receive incoming vendor-specific command. * * @param listener listener object */ public void addVendorCommandListener(VendorCommandListener listener) { try { mService.addVendorCommandListener(getListenerWrapper(listener), getDeviceType()); Loading
core/java/android/hardware/hdmi/IHdmiControlService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ interface IHdmiControlService { void addDeviceEventListener(IHdmiDeviceEventListener listener); void deviceSelect(int logicalAddress, IHdmiControlCallback callback); void portSelect(int portId, IHdmiControlCallback callback); void sendKeyEvent(int keyCode, boolean isPressed); void sendKeyEvent(int deviceType, int keyCode, boolean isPressed); List<HdmiPortInfo> getPortInfo(); boolean canChangeSystemAudioMode(); boolean getSystemAudioMode(); Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +12 −2 Original line number Diff line number Diff line Loading @@ -581,7 +581,7 @@ abstract class HdmiCecLocalDevice { * Called when the system started transition to standby mode. * * @param initiatedByCec true if this power sequence is initiated * by the reception the CEC messages like <StandBy> * by the reception the CEC messages like <StandBy> */ protected void onTransitionToStandby(boolean initiatedByCec) { // If there are no outstanding actions, we'll go to STANDBY state. Loading @@ -592,7 +592,17 @@ abstract class HdmiCecLocalDevice { * Called when the system goes to standby mode. * * @param initiatedByCec true if this power sequence is initiated * by the reception the CEC messages like <StandBy> * by the reception the CEC messages like <StandBy> */ protected void onStandBy(boolean initiatedByCec) {} /** * Send a key event to other device. * * @param keyCode key code defined in {@link android.os.KeyEvent} * @param isPressed {@code true} for key down event */ protected void sendKeyEvent(int keyCode, boolean isPressed) { Slog.w(TAG, "sendKeyEvent not implemented"); } }
services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +3 −2 Original line number Diff line number Diff line Loading @@ -226,8 +226,9 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}. * @param isPressed true if this is key press event */ @Override @ServiceThreadOnly void sendKeyEvent(int keyCode, boolean isPressed) { protected void sendKeyEvent(int keyCode, boolean isPressed) { assertRunOnServiceThread(); List<SendKeyAction> action = getActions(SendKeyAction.class); if (!action.isEmpty()) { Loading
services/core/java/com/android/server/hdmi/HdmiControlService.java +5 −7 Original line number Diff line number Diff line Loading @@ -691,19 +691,17 @@ public final class HdmiControlService extends SystemService { } @Override public void sendKeyEvent(final int keyCode, final boolean isPressed) { public void sendKeyEvent(final int deviceType, final int keyCode, final boolean isPressed) { enforceAccessPermission(); runOnServiceThread(new Runnable() { @Override public void run() { // TODO: sendKeyEvent is for TV device only for now. Allow other // local devices of different types to use this as well. HdmiCecLocalDeviceTv tv = tv(); if (tv == null) { Slog.w(TAG, "Local tv device not available"); HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(deviceType); if (localDevice == null) { Slog.w(TAG, "Local device not available"); return; } tv.sendKeyEvent(keyCode, isPressed); localDevice.sendKeyEvent(keyCode, isPressed); } }); } Loading