Merge "Resolve CEC related API requests from API Council" into qt-dev

am: 64b51f91ff

Change-Id: I8c9f89d3bd8c4124e4d09115684a02156e19e1fb
This commit is contained in:
Amy Zhang
2019-04-15 11:05:06 -07:00
committed by android-build-merger
3 changed files with 118 additions and 13 deletions

View File

@@ -2002,15 +2002,15 @@ package android.hardware.hdmi {
public final class HdmiControlManager { public final class HdmiControlManager {
method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void addHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener); 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 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 public int getPhysicalAddress();
method @Nullable public android.hardware.hdmi.HdmiPlaybackClient getPlaybackClient(); method @Nullable public android.hardware.hdmi.HdmiPlaybackClient getPlaybackClient();
method @Nullable public android.hardware.hdmi.HdmiSwitchClient getSwitchClient(); method @Nullable public android.hardware.hdmi.HdmiSwitchClient getSwitchClient();
method @Nullable public android.hardware.hdmi.HdmiTvClient getTvClient(); method @Nullable public android.hardware.hdmi.HdmiTvClient getTvClient();
method public boolean isRemoteDeviceConnected(@NonNull android.hardware.hdmi.HdmiDeviceInfo); method public boolean isDeviceConnected(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
method public void powerOffRemoteDevice(@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 @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); 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 String ACTION_OSD_MESSAGE = "android.hardware.hdmi.action.OSD_MESSAGE";
field public static final int AVR_VOLUME_MUTED = 101; // 0x65 field public static final int AVR_VOLUME_MUTED = 101; // 0x65

View File

@@ -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 { package android.location {
public class LocationManager { public class LocationManager {

View File

@@ -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 * @return a list of {@link HdmiDeviceInfo} of the connected CEC devices on the CEC bus. An
* list will be returned if there is none. * empty list will be returned if there is none.
* *
* @hide * @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 @SystemApi
@Nullable
public List<HdmiDeviceInfo> getConnectedDevicesList() { public List<HdmiDeviceInfo> getConnectedDevicesList() {
try { try {
return mService.getDeviceList(); 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()}. * <p>The target device info can be obtained by calling {@link #getConnectedDevicesList()}.
* *
@@ -457,6 +474,23 @@ public final class HdmiControlManager {
* @hide * @hide
*/ */
@SystemApi @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) { public void powerOffRemoteDevice(@NonNull HdmiDeviceInfo deviceInfo) {
Preconditions.checkNotNull(deviceInfo); Preconditions.checkNotNull(deviceInfo);
try { 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()}. * <p>The target device info can be obtained by calling {@link #getConnectedDevicesList()}.
* *
@@ -476,6 +511,23 @@ public final class HdmiControlManager {
* *
* @hide * @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) { public void powerOnRemoteDevice(HdmiDeviceInfo deviceInfo) {
Preconditions.checkNotNull(deviceInfo); Preconditions.checkNotNull(deviceInfo);
try { 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>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 * @param deviceInfo HdmiDeviceInfo of the target device
* *
* @hide * @hide
*/ */
@SystemApi @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) { public void requestRemoteDeviceToBecomeActiveSource(@NonNull HdmiDeviceInfo deviceInfo) {
Preconditions.checkNotNull(deviceInfo); Preconditions.checkNotNull(deviceInfo);
try { 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. * <p>The API also returns true if the current device is the target.
* *
@@ -567,6 +639,27 @@ public final class HdmiControlManager {
* @hide * @hide
*/ */
@SystemApi @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) { public boolean isRemoteDeviceConnected(@NonNull HdmiDeviceInfo targetDevice) {
Preconditions.checkNotNull(targetDevice); Preconditions.checkNotNull(targetDevice);
mPhysicalAddress = getPhysicalAddress(); mPhysicalAddress = getPhysicalAddress();