From dbc82ad48335d452672e81425ff7a870cc9fef23 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 22 Sep 2021 08:34:34 +0000 Subject: [PATCH] HDMICEC: Edit device selection API Rename HdmiClient#deviceSelect to HdmiClient#selectDevice. Create HdmiClient#SelectedDeviceCallback. Document the parameter of the previously mentioned callback. These changes are part of the API Review. Bug: 196043550 Bug: 200698880 Test: m Change-Id: I7acf7a26ec688c6643c6f61d767272a71b1c8a36 --- core/api/system-current.txt | 6 +++++- core/java/android/hardware/hdmi/HdmiClient.java | 17 ++++++++++++++--- .../android/hardware/hdmi/HdmiTvClient.java | 9 +++------ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index e110341d44901..1ec56b3e45d51 100755 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -3320,13 +3320,17 @@ package android.hardware.display { package android.hardware.hdmi { public abstract class HdmiClient { - method public void deviceSelect(int, @NonNull android.hardware.hdmi.HdmiTvClient.SelectCallback); method public android.hardware.hdmi.HdmiDeviceInfo getActiveSource(); + method public void selectDevice(int, @NonNull android.hardware.hdmi.HdmiClient.SelectedDeviceCallback); method public void sendKeyEvent(int, boolean); method public void sendVendorCommand(int, byte[], boolean); method public void setVendorCommandListener(@NonNull android.hardware.hdmi.HdmiControlManager.VendorCommandListener); } + public static interface HdmiClient.SelectedDeviceCallback { + method public void onComplete(int); + } + public final class HdmiControlManager { method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void addHdmiCecEnabledChangeListener(@NonNull android.hardware.hdmi.HdmiControlManager.CecSettingChangeListener); method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void addHdmiCecEnabledChangeListener(@NonNull java.util.concurrent.Executor, @NonNull android.hardware.hdmi.HdmiControlManager.CecSettingChangeListener); diff --git a/core/java/android/hardware/hdmi/HdmiClient.java b/core/java/android/hardware/hdmi/HdmiClient.java index 1959ff81826ee..eb4cffda3af14 100644 --- a/core/java/android/hardware/hdmi/HdmiClient.java +++ b/core/java/android/hardware/hdmi/HdmiClient.java @@ -4,7 +4,6 @@ import android.annotation.NonNull; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.hardware.hdmi.HdmiControlManager.VendorCommandListener; -import android.hardware.hdmi.HdmiTvClient.SelectCallback; import android.os.RemoteException; import android.util.Log; @@ -28,6 +27,18 @@ public abstract class HdmiClient { mService = service; } + /** + * Callback interface used to get the result of {@link #selectDevice}. + */ + public interface SelectedDeviceCallback { + /** + * Called when the operation is finished. + * @param result the result value of {@link #selectDevice} and can have the values mentioned + * in {@link HdmiControlShellCommand#getResultString} + */ + void onComplete(int result); + } + /** * Selects a CEC logical device to be a new active source. * @@ -35,7 +46,7 @@ public abstract class HdmiClient { * @param callback callback to get the result with * @throws {@link IllegalArgumentException} if the {@code callback} is null */ - public void deviceSelect(int logicalAddress, @NonNull SelectCallback callback) { + public void selectDevice(int logicalAddress, @NonNull SelectedDeviceCallback callback) { if (callback == null) { throw new IllegalArgumentException("callback must not be null."); } @@ -49,7 +60,7 @@ public abstract class HdmiClient { /** * @hide */ - private static IHdmiControlCallback getCallbackWrapper(final SelectCallback callback) { + private static IHdmiControlCallback getCallbackWrapper(final SelectedDeviceCallback callback) { return new IHdmiControlCallback.Stub() { @Override public void onComplete(int result) { diff --git a/core/java/android/hardware/hdmi/HdmiTvClient.java b/core/java/android/hardware/hdmi/HdmiTvClient.java index 74cf001ebba47..575ad83bf35e5 100644 --- a/core/java/android/hardware/hdmi/HdmiTvClient.java +++ b/core/java/android/hardware/hdmi/HdmiTvClient.java @@ -60,7 +60,8 @@ public final class HdmiTvClient extends HdmiClient { } /** - * Callback interface used to get the result of {@link #deviceSelect}. + * Callback interface used to get the result of {@link #portSelect} and + * {@link #setSystemAudioMode}. */ public interface SelectCallback { /** @@ -77,7 +78,7 @@ public final class HdmiTvClient extends HdmiClient { * @param logicalAddress logical address of the device to select * @param callback callback to get the result with * @throws {@link IllegalArgumentException} if the {@code callback} is null - * @deprecated Please use {@link HdmiClient#deviceSelect()} instead. + * @deprecated Please use {@link HdmiClient#selectDevice} instead. */ @Deprecated public void deviceSelect(int logicalAddress, @NonNull SelectCallback callback) { @@ -91,10 +92,6 @@ public final class HdmiTvClient extends HdmiClient { } } - /** - * @deprecated Please use {@link HdmiClient#getCallbackWrapper()} instead. - */ - @Deprecated private static IHdmiControlCallback getCallbackWrapper(final SelectCallback callback) { return new IHdmiControlCallback.Stub() { @Override