Merge "Resolve CEC related API requests from API Council" into qt-dev
This commit is contained in:
@@ -2002,15 +2002,15 @@ package android.hardware.hdmi {
|
||||
public final class HdmiControlManager {
|
||||
method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void addHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener);
|
||||
method @Nullable public android.hardware.hdmi.HdmiClient getClient(int);
|
||||
method @Nullable public java.util.List<android.hardware.hdmi.HdmiDeviceInfo> getConnectedDevicesList();
|
||||
method @NonNull public java.util.List<android.hardware.hdmi.HdmiDeviceInfo> getConnectedDevices();
|
||||
method public int getPhysicalAddress();
|
||||
method @Nullable public android.hardware.hdmi.HdmiPlaybackClient getPlaybackClient();
|
||||
method @Nullable public android.hardware.hdmi.HdmiSwitchClient getSwitchClient();
|
||||
method @Nullable public android.hardware.hdmi.HdmiTvClient getTvClient();
|
||||
method public boolean isRemoteDeviceConnected(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method public void powerOffRemoteDevice(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method public boolean isDeviceConnected(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method public void powerOffDevice(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void removeHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener);
|
||||
method public void requestRemoteDeviceToBecomeActiveSource(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method public void setActiveSource(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void setStandbyMode(boolean);
|
||||
field public static final String ACTION_OSD_MESSAGE = "android.hardware.hdmi.action.OSD_MESSAGE";
|
||||
field public static final int AVR_VOLUME_MUTED = 101; // 0x65
|
||||
|
||||
@@ -60,6 +60,18 @@ package android.content {
|
||||
|
||||
}
|
||||
|
||||
package android.hardware.hdmi {
|
||||
|
||||
public final class HdmiControlManager {
|
||||
method @Deprecated public java.util.List<android.hardware.hdmi.HdmiDeviceInfo> getConnectedDevicesList();
|
||||
method @Deprecated public boolean isRemoteDeviceConnected(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method @Deprecated public void powerOffRemoteDevice(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method @Deprecated public void powerOnRemoteDevice(android.hardware.hdmi.HdmiDeviceInfo);
|
||||
method @Deprecated public void requestRemoteDeviceToBecomeActiveSource(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.location {
|
||||
|
||||
public class LocationManager {
|
||||
|
||||
@@ -428,17 +428,33 @@ public final class HdmiControlManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a snapshot of the real-time status of the remote devices.
|
||||
* Get a snapshot of the real-time status of the devices on the CEC bus.
|
||||
*
|
||||
* <p>This only applies to devices with multiple HDMI inputs.
|
||||
* <p>This only applies to devices with switch functionality, which are devices with one
|
||||
* or more than one HDMI inputs.
|
||||
*
|
||||
* @return a list of {@link HdmiDeviceInfo} of the connected CEC devices. An empty
|
||||
* list will be returned if there is none.
|
||||
* @return a list of {@link HdmiDeviceInfo} of the connected CEC devices on the CEC bus. An
|
||||
* empty list will be returned if there is none.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
@SystemApi
|
||||
public List<HdmiDeviceInfo> getConnectedDevices() {
|
||||
try {
|
||||
return mService.getDeviceList();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @removed
|
||||
* @hide
|
||||
* @deprecated Please use {@link #getConnectedDevices()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
@Nullable
|
||||
public List<HdmiDeviceInfo> getConnectedDevicesList() {
|
||||
try {
|
||||
return mService.getDeviceList();
|
||||
@@ -448,7 +464,8 @@ public final class HdmiControlManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Power off the target device by sending CEC commands.
|
||||
* Power off the target device by sending CEC commands. Note that this device can't be the
|
||||
* current device itself.
|
||||
*
|
||||
* <p>The target device info can be obtained by calling {@link #getConnectedDevicesList()}.
|
||||
*
|
||||
@@ -457,6 +474,23 @@ public final class HdmiControlManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public void powerOffDevice(@NonNull HdmiDeviceInfo deviceInfo) {
|
||||
Preconditions.checkNotNull(deviceInfo);
|
||||
try {
|
||||
mService.powerOffRemoteDevice(
|
||||
deviceInfo.getLogicalAddress(), deviceInfo.getDevicePowerStatus());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @removed
|
||||
* @hide
|
||||
* @deprecated Please use {@link #powerOffDevice(deviceInfo)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
public void powerOffRemoteDevice(@NonNull HdmiDeviceInfo deviceInfo) {
|
||||
Preconditions.checkNotNull(deviceInfo);
|
||||
try {
|
||||
@@ -468,7 +502,8 @@ public final class HdmiControlManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Power on the target device by sending CEC commands.
|
||||
* Power on the target device by sending CEC commands. Note that this device can't be the
|
||||
* current device itself.
|
||||
*
|
||||
* <p>The target device info can be obtained by calling {@link #getConnectedDevicesList()}.
|
||||
*
|
||||
@@ -476,6 +511,23 @@ public final class HdmiControlManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void powerOnDevice(HdmiDeviceInfo deviceInfo) {
|
||||
Preconditions.checkNotNull(deviceInfo);
|
||||
try {
|
||||
mService.powerOnRemoteDevice(
|
||||
deviceInfo.getLogicalAddress(), deviceInfo.getDevicePowerStatus());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @removed
|
||||
* @hide
|
||||
* @deprecated Please use {@link #powerOnDevice(deviceInfo)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
public void powerOnRemoteDevice(HdmiDeviceInfo deviceInfo) {
|
||||
Preconditions.checkNotNull(deviceInfo);
|
||||
try {
|
||||
@@ -487,15 +539,35 @@ public final class HdmiControlManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the target device to be the new Active Source by sending CEC commands.
|
||||
* Request the target device to be the new Active Source by sending CEC commands. Note that
|
||||
* this device can't be the current device itself.
|
||||
*
|
||||
* <p>The target device info can be obtained by calling {@link #getConnectedDevicesList()}.
|
||||
*
|
||||
* <p>If the target device responds to the command, the users should see the target device
|
||||
* streaming on their TVs.
|
||||
*
|
||||
* @param deviceInfo HdmiDeviceInfo of the target device
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public void setActiveSource(@NonNull HdmiDeviceInfo deviceInfo) {
|
||||
Preconditions.checkNotNull(deviceInfo);
|
||||
try {
|
||||
mService.askRemoteDeviceToBecomeActiveSource(deviceInfo.getPhysicalAddress());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @removed
|
||||
* @hide
|
||||
* @deprecated Please use {@link #setActiveSource(deviceInfo)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
public void requestRemoteDeviceToBecomeActiveSource(@NonNull HdmiDeviceInfo deviceInfo) {
|
||||
Preconditions.checkNotNull(deviceInfo);
|
||||
try {
|
||||
@@ -556,7 +628,7 @@ public final class HdmiControlManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the target remote device is connected to the current device.
|
||||
* Check if the target device is connected to the current device.
|
||||
*
|
||||
* <p>The API also returns true if the current device is the target.
|
||||
*
|
||||
@@ -567,6 +639,27 @@ public final class HdmiControlManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean isDeviceConnected(@NonNull HdmiDeviceInfo targetDevice) {
|
||||
Preconditions.checkNotNull(targetDevice);
|
||||
mPhysicalAddress = getPhysicalAddress();
|
||||
if (mPhysicalAddress == INVALID_PHYSICAL_ADDRESS) {
|
||||
return false;
|
||||
}
|
||||
int targetPhysicalAddress = targetDevice.getPhysicalAddress();
|
||||
if (targetPhysicalAddress == INVALID_PHYSICAL_ADDRESS) {
|
||||
return false;
|
||||
}
|
||||
return HdmiUtils.getLocalPortFromPhysicalAddress(targetPhysicalAddress, mPhysicalAddress)
|
||||
!= HdmiUtils.TARGET_NOT_UNDER_LOCAL_DEVICE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @removed
|
||||
* @hide
|
||||
* @deprecated Please use {@link #isDeviceConnected(targetDevice)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
public boolean isRemoteDeviceConnected(@NonNull HdmiDeviceInfo targetDevice) {
|
||||
Preconditions.checkNotNull(targetDevice);
|
||||
mPhysicalAddress = getPhysicalAddress();
|
||||
|
||||
Reference in New Issue
Block a user