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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user