Loading Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ LOCAL_SRC_FILES += \ core/java/android/hardware/hdmi/IHdmiDeviceEventListener.aidl \ core/java/android/hardware/hdmi/IHdmiHotplugEventListener.aidl \ core/java/android/hardware/hdmi/IHdmiInputChangeListener.aidl \ core/java/android/hardware/hdmi/IHdmiMhlScratchpadCommandListener.aidl \ core/java/android/hardware/hdmi/IHdmiMhlVendorCommandListener.aidl \ core/java/android/hardware/hdmi/IHdmiRecordListener.aidl \ core/java/android/hardware/hdmi/IHdmiSystemAudioModeChangeListener.aidl \ core/java/android/hardware/hdmi/IHdmiVendorCommandListener.aidl \ Loading core/java/android/hardware/hdmi/HdmiTvClient.java +22 −22 Original line number Diff line number Diff line Loading @@ -36,9 +36,9 @@ public final class HdmiTvClient extends HdmiClient { private static final String TAG = "HdmiTvClient"; /** * Size of MHL scratchpad register. * Size of MHL register for vendor command */ public static final int SCRATCHPAD_DATA_SIZE = 16; public static final int VENDOR_DATA_SIZE = 16; HdmiTvClient(IHdmiControlService service) { super(service); Loading Loading @@ -332,31 +332,31 @@ public final class HdmiTvClient extends HdmiClient { } /** * Interface used to get incoming MHL scratchpad command. * Interface used to get incoming MHL vendor command. */ public interface HdmiMhlScratchpadCommandListener { public interface HdmiMhlVendorCommandListener { void onReceived(int portId, int offset, int length, byte[] data); } /** * Set {@link HdmiMhlScratchpadCommandListener} to get incoming MHL sSratchpad command. * Set {@link HdmiMhlVendorCommandListener} to get incoming MHL vendor command. * * @param listener to receive incoming MHL Scratchpad command * @param listener to receive incoming MHL vendor command */ public void setHdmiMhlScratchpadCommandListener(HdmiMhlScratchpadCommandListener listener) { public void setHdmiMhlVendorCommandListener(HdmiMhlVendorCommandListener listener) { if (listener == null) { throw new IllegalArgumentException("listener must not be null."); } try { mService.addHdmiMhlScratchpadCommandListener(getListenerWrapper(listener)); mService.addHdmiMhlVendorCommandListener(getListenerWrapper(listener)); } catch (RemoteException e) { Log.e(TAG, "failed to set hdmi mhl scratchpad command listener: ", e); Log.e(TAG, "failed to set hdmi mhl vendor command listener: ", e); } } private IHdmiMhlScratchpadCommandListener getListenerWrapper( final HdmiMhlScratchpadCommandListener listener) { return new IHdmiMhlScratchpadCommandListener.Stub() { private IHdmiMhlVendorCommandListener getListenerWrapper( final HdmiMhlVendorCommandListener listener) { return new IHdmiMhlVendorCommandListener.Stub() { @Override public void onReceived(int portId, int offset, int length, byte[] data) { listener.onReceived(portId, offset, length, data); Loading @@ -365,29 +365,29 @@ public final class HdmiTvClient extends HdmiClient { } /** * Send MHL Scratchpad command to the device connected to a port of the given portId. * Send MHL vendor command to the device connected to a port of the given portId. * * @param portId id of port to send MHL Scratchpad command * @param portId id of port to send MHL vendor command * @param offset offset in the in given data * @param length length of data. offset + length should be bound to length of data. * @param data container for Scratchpad data. It should be 16 bytes. * @param data container for vendor command data. It should be 16 bytes. * @throws IllegalArgumentException if the given parameters are invalid */ public void sendScratchpadCommand(int portId, int offset, int length, byte[] data) { if (data == null || data.length != SCRATCHPAD_DATA_SIZE) { throw new IllegalArgumentException("Invalid scratchpad data."); public void sendMhlVendorCommand(int portId, int offset, int length, byte[] data) { if (data == null || data.length != VENDOR_DATA_SIZE) { throw new IllegalArgumentException("Invalid vendor command data."); } if (offset < 0 || offset >= SCRATCHPAD_DATA_SIZE) { if (offset < 0 || offset >= VENDOR_DATA_SIZE) { throw new IllegalArgumentException("Invalid offset:" + offset); } if (length < 0 || offset + length > SCRATCHPAD_DATA_SIZE) { if (length < 0 || offset + length > VENDOR_DATA_SIZE) { throw new IllegalArgumentException("Invalid length:" + length); } try { mService.sendScratchpadCommand(portId, offset, length, data); mService.sendMhlVendorCommand(portId, offset, length, data); } catch (RemoteException e) { Log.e(TAG, "failed to send scratchpad command: ", e); Log.e(TAG, "failed to send vendor command: ", e); } } } core/java/android/hardware/hdmi/IHdmiControlService.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.hardware.hdmi.IHdmiControlCallback; import android.hardware.hdmi.IHdmiDeviceEventListener; import android.hardware.hdmi.IHdmiHotplugEventListener; import android.hardware.hdmi.IHdmiInputChangeListener; import android.hardware.hdmi.IHdmiMhlScratchpadCommandListener; import android.hardware.hdmi.IHdmiMhlVendorCommandListener; import android.hardware.hdmi.IHdmiRecordListener; import android.hardware.hdmi.IHdmiSystemAudioModeChangeListener; import android.hardware.hdmi.IHdmiVendorCommandListener; Loading Loading @@ -67,6 +67,6 @@ interface IHdmiControlService { void stopOneTouchRecord(int recorderAddress); void startTimerRecording(int recorderAddress, int sourceType, in byte[] recordSource); void clearTimerRecording(int recorderAddress, int sourceType, in byte[] recordSource); void sendScratchpadCommand(int portId, int offset, int length, in byte[] data); void addHdmiMhlScratchpadCommandListener(IHdmiMhlScratchpadCommandListener listener); void sendMhlVendorCommand(int portId, int offset, int length, in byte[] data); void addHdmiMhlVendorCommandListener(IHdmiMhlVendorCommandListener listener); } core/java/android/hardware/hdmi/IHdmiMhlScratchpadCommandListener.aidl→core/java/android/hardware/hdmi/IHdmiMhlVendorCommandListener.aidl +2 −3 Original line number Diff line number Diff line Loading @@ -17,11 +17,10 @@ package android.hardware.hdmi; /** * Callback interface definition for MHL client to get the scratchpad * command. * Callback interface definition for MHL client to get the vendor command. * * @hide */ oneway interface IHdmiMhlScratchpadCommandListener { oneway interface IHdmiMhlVendorCommandListener { void onReceived(int portId, int offset, int length, in byte[] data); } services/core/java/com/android/server/hdmi/HdmiControlService.java +20 −21 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ import android.hardware.hdmi.IHdmiControlService; import android.hardware.hdmi.IHdmiDeviceEventListener; import android.hardware.hdmi.IHdmiHotplugEventListener; import android.hardware.hdmi.IHdmiInputChangeListener; import android.hardware.hdmi.IHdmiMhlScratchpadCommandListener; import android.hardware.hdmi.IHdmiMhlVendorCommandListener; import android.hardware.hdmi.IHdmiRecordListener; import android.hardware.hdmi.IHdmiSystemAudioModeChangeListener; import android.hardware.hdmi.IHdmiVendorCommandListener; Loading Loading @@ -247,10 +247,10 @@ public final class HdmiControlService extends SystemService { @GuardedBy("mLock") private boolean mMhlInputChangeEnabled; // List of records for MHL Scratchpad command listener to handle the caller killed in action. // List of records for MHL Vendor command listener to handle the caller killed in action. @GuardedBy("mLock") private final ArrayList<HdmiMhlScratchpadCommandListenerRecord> mScratchpadCommandListenerRecords = new ArrayList<>(); private final ArrayList<HdmiMhlVendorCommandListenerRecord> mMhlVendorCommandListenerRecords = new ArrayList<>(); @GuardedBy("mLock") private List<HdmiDeviceInfo> mMhlDevices; Loading Loading @@ -928,16 +928,16 @@ public final class HdmiControlService extends SystemService { return mMhlDevices; } private class HdmiMhlScratchpadCommandListenerRecord implements IBinder.DeathRecipient { private final IHdmiMhlScratchpadCommandListener mListener; private class HdmiMhlVendorCommandListenerRecord implements IBinder.DeathRecipient { private final IHdmiMhlVendorCommandListener mListener; public HdmiMhlScratchpadCommandListenerRecord(IHdmiMhlScratchpadCommandListener listener) { public HdmiMhlVendorCommandListenerRecord(IHdmiMhlVendorCommandListener listener) { mListener = listener; } @Override public void binderDied() { mScratchpadCommandListenerRecords.remove(this); mMhlVendorCommandListenerRecords.remove(this); } } Loading Loading @@ -1403,7 +1403,7 @@ public final class HdmiControlService extends SystemService { } @Override public void sendScratchpadCommand(final int portId, final int offset, final int length, public void sendMhlVendorCommand(final int portId, final int offset, final int length, final byte[] data) { enforceAccessPermission(); runOnServiceThread(new Runnable() { Loading @@ -1418,16 +1418,16 @@ public final class HdmiControlService extends SystemService { Slog.w(TAG, "Invalid port id:" + portId); return; } mMhlController.sendScratchpadCommand(portId, offset, length, data); mMhlController.sendVendorCommand(portId, offset, length, data); } }); } @Override public void addHdmiMhlScratchpadCommandListener( IHdmiMhlScratchpadCommandListener listener) { public void addHdmiMhlVendorCommandListener( IHdmiMhlVendorCommandListener listener) { enforceAccessPermission(); HdmiControlService.this.addHdmiMhlScratchpadCommandListener(listener); HdmiControlService.this.addHdmiMhlVendorCommandListener(listener); } @Override Loading Loading @@ -1880,9 +1880,9 @@ public final class HdmiControlService extends SystemService { } } private void addHdmiMhlScratchpadCommandListener(IHdmiMhlScratchpadCommandListener listener) { HdmiMhlScratchpadCommandListenerRecord record = new HdmiMhlScratchpadCommandListenerRecord(listener); private void addHdmiMhlVendorCommandListener(IHdmiMhlVendorCommandListener listener) { HdmiMhlVendorCommandListenerRecord record = new HdmiMhlVendorCommandListenerRecord(listener); try { listener.asBinder().linkToDeath(record, 0); } catch (RemoteException e) { Loading @@ -1891,18 +1891,17 @@ public final class HdmiControlService extends SystemService { } synchronized (mLock) { mScratchpadCommandListenerRecords.add(record); mMhlVendorCommandListenerRecords.add(record); } } void invokeScratchpadCommandListeners(int portId, int offest, int length, byte[] data) { void invokeMhlVendorCommandListeners(int portId, int offest, int length, byte[] data) { synchronized (mLock) { for (HdmiMhlScratchpadCommandListenerRecord record : mScratchpadCommandListenerRecords) { for (HdmiMhlVendorCommandListenerRecord record : mMhlVendorCommandListenerRecords) { try { record.mListener.onReceived(portId, offest, length, data); } catch (RemoteException e) { Slog.e(TAG, "Failed to notify scratchpad command", e); Slog.e(TAG, "Failed to notify MHL vendor command", e); } } } Loading Loading
Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ LOCAL_SRC_FILES += \ core/java/android/hardware/hdmi/IHdmiDeviceEventListener.aidl \ core/java/android/hardware/hdmi/IHdmiHotplugEventListener.aidl \ core/java/android/hardware/hdmi/IHdmiInputChangeListener.aidl \ core/java/android/hardware/hdmi/IHdmiMhlScratchpadCommandListener.aidl \ core/java/android/hardware/hdmi/IHdmiMhlVendorCommandListener.aidl \ core/java/android/hardware/hdmi/IHdmiRecordListener.aidl \ core/java/android/hardware/hdmi/IHdmiSystemAudioModeChangeListener.aidl \ core/java/android/hardware/hdmi/IHdmiVendorCommandListener.aidl \ Loading
core/java/android/hardware/hdmi/HdmiTvClient.java +22 −22 Original line number Diff line number Diff line Loading @@ -36,9 +36,9 @@ public final class HdmiTvClient extends HdmiClient { private static final String TAG = "HdmiTvClient"; /** * Size of MHL scratchpad register. * Size of MHL register for vendor command */ public static final int SCRATCHPAD_DATA_SIZE = 16; public static final int VENDOR_DATA_SIZE = 16; HdmiTvClient(IHdmiControlService service) { super(service); Loading Loading @@ -332,31 +332,31 @@ public final class HdmiTvClient extends HdmiClient { } /** * Interface used to get incoming MHL scratchpad command. * Interface used to get incoming MHL vendor command. */ public interface HdmiMhlScratchpadCommandListener { public interface HdmiMhlVendorCommandListener { void onReceived(int portId, int offset, int length, byte[] data); } /** * Set {@link HdmiMhlScratchpadCommandListener} to get incoming MHL sSratchpad command. * Set {@link HdmiMhlVendorCommandListener} to get incoming MHL vendor command. * * @param listener to receive incoming MHL Scratchpad command * @param listener to receive incoming MHL vendor command */ public void setHdmiMhlScratchpadCommandListener(HdmiMhlScratchpadCommandListener listener) { public void setHdmiMhlVendorCommandListener(HdmiMhlVendorCommandListener listener) { if (listener == null) { throw new IllegalArgumentException("listener must not be null."); } try { mService.addHdmiMhlScratchpadCommandListener(getListenerWrapper(listener)); mService.addHdmiMhlVendorCommandListener(getListenerWrapper(listener)); } catch (RemoteException e) { Log.e(TAG, "failed to set hdmi mhl scratchpad command listener: ", e); Log.e(TAG, "failed to set hdmi mhl vendor command listener: ", e); } } private IHdmiMhlScratchpadCommandListener getListenerWrapper( final HdmiMhlScratchpadCommandListener listener) { return new IHdmiMhlScratchpadCommandListener.Stub() { private IHdmiMhlVendorCommandListener getListenerWrapper( final HdmiMhlVendorCommandListener listener) { return new IHdmiMhlVendorCommandListener.Stub() { @Override public void onReceived(int portId, int offset, int length, byte[] data) { listener.onReceived(portId, offset, length, data); Loading @@ -365,29 +365,29 @@ public final class HdmiTvClient extends HdmiClient { } /** * Send MHL Scratchpad command to the device connected to a port of the given portId. * Send MHL vendor command to the device connected to a port of the given portId. * * @param portId id of port to send MHL Scratchpad command * @param portId id of port to send MHL vendor command * @param offset offset in the in given data * @param length length of data. offset + length should be bound to length of data. * @param data container for Scratchpad data. It should be 16 bytes. * @param data container for vendor command data. It should be 16 bytes. * @throws IllegalArgumentException if the given parameters are invalid */ public void sendScratchpadCommand(int portId, int offset, int length, byte[] data) { if (data == null || data.length != SCRATCHPAD_DATA_SIZE) { throw new IllegalArgumentException("Invalid scratchpad data."); public void sendMhlVendorCommand(int portId, int offset, int length, byte[] data) { if (data == null || data.length != VENDOR_DATA_SIZE) { throw new IllegalArgumentException("Invalid vendor command data."); } if (offset < 0 || offset >= SCRATCHPAD_DATA_SIZE) { if (offset < 0 || offset >= VENDOR_DATA_SIZE) { throw new IllegalArgumentException("Invalid offset:" + offset); } if (length < 0 || offset + length > SCRATCHPAD_DATA_SIZE) { if (length < 0 || offset + length > VENDOR_DATA_SIZE) { throw new IllegalArgumentException("Invalid length:" + length); } try { mService.sendScratchpadCommand(portId, offset, length, data); mService.sendMhlVendorCommand(portId, offset, length, data); } catch (RemoteException e) { Log.e(TAG, "failed to send scratchpad command: ", e); Log.e(TAG, "failed to send vendor command: ", e); } } }
core/java/android/hardware/hdmi/IHdmiControlService.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.hardware.hdmi.IHdmiControlCallback; import android.hardware.hdmi.IHdmiDeviceEventListener; import android.hardware.hdmi.IHdmiHotplugEventListener; import android.hardware.hdmi.IHdmiInputChangeListener; import android.hardware.hdmi.IHdmiMhlScratchpadCommandListener; import android.hardware.hdmi.IHdmiMhlVendorCommandListener; import android.hardware.hdmi.IHdmiRecordListener; import android.hardware.hdmi.IHdmiSystemAudioModeChangeListener; import android.hardware.hdmi.IHdmiVendorCommandListener; Loading Loading @@ -67,6 +67,6 @@ interface IHdmiControlService { void stopOneTouchRecord(int recorderAddress); void startTimerRecording(int recorderAddress, int sourceType, in byte[] recordSource); void clearTimerRecording(int recorderAddress, int sourceType, in byte[] recordSource); void sendScratchpadCommand(int portId, int offset, int length, in byte[] data); void addHdmiMhlScratchpadCommandListener(IHdmiMhlScratchpadCommandListener listener); void sendMhlVendorCommand(int portId, int offset, int length, in byte[] data); void addHdmiMhlVendorCommandListener(IHdmiMhlVendorCommandListener listener); }
core/java/android/hardware/hdmi/IHdmiMhlScratchpadCommandListener.aidl→core/java/android/hardware/hdmi/IHdmiMhlVendorCommandListener.aidl +2 −3 Original line number Diff line number Diff line Loading @@ -17,11 +17,10 @@ package android.hardware.hdmi; /** * Callback interface definition for MHL client to get the scratchpad * command. * Callback interface definition for MHL client to get the vendor command. * * @hide */ oneway interface IHdmiMhlScratchpadCommandListener { oneway interface IHdmiMhlVendorCommandListener { void onReceived(int portId, int offset, int length, in byte[] data); }
services/core/java/com/android/server/hdmi/HdmiControlService.java +20 −21 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ import android.hardware.hdmi.IHdmiControlService; import android.hardware.hdmi.IHdmiDeviceEventListener; import android.hardware.hdmi.IHdmiHotplugEventListener; import android.hardware.hdmi.IHdmiInputChangeListener; import android.hardware.hdmi.IHdmiMhlScratchpadCommandListener; import android.hardware.hdmi.IHdmiMhlVendorCommandListener; import android.hardware.hdmi.IHdmiRecordListener; import android.hardware.hdmi.IHdmiSystemAudioModeChangeListener; import android.hardware.hdmi.IHdmiVendorCommandListener; Loading Loading @@ -247,10 +247,10 @@ public final class HdmiControlService extends SystemService { @GuardedBy("mLock") private boolean mMhlInputChangeEnabled; // List of records for MHL Scratchpad command listener to handle the caller killed in action. // List of records for MHL Vendor command listener to handle the caller killed in action. @GuardedBy("mLock") private final ArrayList<HdmiMhlScratchpadCommandListenerRecord> mScratchpadCommandListenerRecords = new ArrayList<>(); private final ArrayList<HdmiMhlVendorCommandListenerRecord> mMhlVendorCommandListenerRecords = new ArrayList<>(); @GuardedBy("mLock") private List<HdmiDeviceInfo> mMhlDevices; Loading Loading @@ -928,16 +928,16 @@ public final class HdmiControlService extends SystemService { return mMhlDevices; } private class HdmiMhlScratchpadCommandListenerRecord implements IBinder.DeathRecipient { private final IHdmiMhlScratchpadCommandListener mListener; private class HdmiMhlVendorCommandListenerRecord implements IBinder.DeathRecipient { private final IHdmiMhlVendorCommandListener mListener; public HdmiMhlScratchpadCommandListenerRecord(IHdmiMhlScratchpadCommandListener listener) { public HdmiMhlVendorCommandListenerRecord(IHdmiMhlVendorCommandListener listener) { mListener = listener; } @Override public void binderDied() { mScratchpadCommandListenerRecords.remove(this); mMhlVendorCommandListenerRecords.remove(this); } } Loading Loading @@ -1403,7 +1403,7 @@ public final class HdmiControlService extends SystemService { } @Override public void sendScratchpadCommand(final int portId, final int offset, final int length, public void sendMhlVendorCommand(final int portId, final int offset, final int length, final byte[] data) { enforceAccessPermission(); runOnServiceThread(new Runnable() { Loading @@ -1418,16 +1418,16 @@ public final class HdmiControlService extends SystemService { Slog.w(TAG, "Invalid port id:" + portId); return; } mMhlController.sendScratchpadCommand(portId, offset, length, data); mMhlController.sendVendorCommand(portId, offset, length, data); } }); } @Override public void addHdmiMhlScratchpadCommandListener( IHdmiMhlScratchpadCommandListener listener) { public void addHdmiMhlVendorCommandListener( IHdmiMhlVendorCommandListener listener) { enforceAccessPermission(); HdmiControlService.this.addHdmiMhlScratchpadCommandListener(listener); HdmiControlService.this.addHdmiMhlVendorCommandListener(listener); } @Override Loading Loading @@ -1880,9 +1880,9 @@ public final class HdmiControlService extends SystemService { } } private void addHdmiMhlScratchpadCommandListener(IHdmiMhlScratchpadCommandListener listener) { HdmiMhlScratchpadCommandListenerRecord record = new HdmiMhlScratchpadCommandListenerRecord(listener); private void addHdmiMhlVendorCommandListener(IHdmiMhlVendorCommandListener listener) { HdmiMhlVendorCommandListenerRecord record = new HdmiMhlVendorCommandListenerRecord(listener); try { listener.asBinder().linkToDeath(record, 0); } catch (RemoteException e) { Loading @@ -1891,18 +1891,17 @@ public final class HdmiControlService extends SystemService { } synchronized (mLock) { mScratchpadCommandListenerRecords.add(record); mMhlVendorCommandListenerRecords.add(record); } } void invokeScratchpadCommandListeners(int portId, int offest, int length, byte[] data) { void invokeMhlVendorCommandListeners(int portId, int offest, int length, byte[] data) { synchronized (mLock) { for (HdmiMhlScratchpadCommandListenerRecord record : mScratchpadCommandListenerRecords) { for (HdmiMhlVendorCommandListenerRecord record : mMhlVendorCommandListenerRecords) { try { record.mListener.onReceived(portId, offest, length, data); } catch (RemoteException e) { Slog.e(TAG, "Failed to notify scratchpad command", e); Slog.e(TAG, "Failed to notify MHL vendor command", e); } } } Loading