Merge "Rename HdmiCecDeviceInfo into HdmiDeviceInfo." into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9b5bd967e4
@@ -1,273 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.hdmi;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* A class to encapsulate device information for HDMI-CEC. This container
|
||||
* include basic information such as logical address, physical address and
|
||||
* device type, and additional information like vendor id and osd name.
|
||||
* Also used to keep the information of non-CEC devices for which only
|
||||
* port ID, physical address are meaningful.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public final class HdmiCecDeviceInfo implements Parcelable {
|
||||
|
||||
/** TV device type. */
|
||||
public static final int DEVICE_TV = 0;
|
||||
|
||||
/** Recording device type. */
|
||||
public static final int DEVICE_RECORDER = 1;
|
||||
|
||||
/** Device type reserved for future usage. */
|
||||
public static final int DEVICE_RESERVED = 2;
|
||||
|
||||
/** Tuner device type. */
|
||||
public static final int DEVICE_TUNER = 3;
|
||||
|
||||
/** Playback device type. */
|
||||
public static final int DEVICE_PLAYBACK = 4;
|
||||
|
||||
/** Audio system device type. */
|
||||
public static final int DEVICE_AUDIO_SYSTEM = 5;
|
||||
|
||||
/** @hide Pure CEC switch device type. */
|
||||
public static final int DEVICE_PURE_CEC_SWITCH = 6;
|
||||
|
||||
/** @hide Video processor device type. */
|
||||
public static final int DEVICE_VIDEO_PROCESSOR = 7;
|
||||
|
||||
// Value indicating the device is not an active source.
|
||||
public static final int DEVICE_INACTIVE = -1;
|
||||
|
||||
/**
|
||||
* Logical address used to indicate the source comes from internal device.
|
||||
* The logical address of TV(0) is used.
|
||||
*/
|
||||
public static final int ADDR_INTERNAL = 0;
|
||||
|
||||
/**
|
||||
* Physical address used to indicate the source comes from internal device.
|
||||
* The physical address of TV(0) is used.
|
||||
*/
|
||||
public static final int PATH_INTERNAL = 0x0000;
|
||||
|
||||
/** Invalid physical address (routing path) */
|
||||
public static final int PATH_INVALID = 0xFFFF;
|
||||
|
||||
/** Invalid port ID */
|
||||
public static final int PORT_INVALID = -1;
|
||||
|
||||
// Logical address, physical address, device type, vendor id and display name
|
||||
// are immutable value.
|
||||
private final int mLogicalAddress;
|
||||
private final int mPhysicalAddress;
|
||||
private final int mPortId;
|
||||
private final int mDeviceType;
|
||||
private final int mVendorId;
|
||||
private final String mDisplayName;
|
||||
private final boolean mIsCecDevice;
|
||||
|
||||
/**
|
||||
* A helper class to deserialize {@link HdmiCecDeviceInfo} for a parcel.
|
||||
*/
|
||||
public static final Parcelable.Creator<HdmiCecDeviceInfo> CREATOR =
|
||||
new Parcelable.Creator<HdmiCecDeviceInfo>() {
|
||||
@Override
|
||||
public HdmiCecDeviceInfo createFromParcel(Parcel source) {
|
||||
int logicalAddress = source.readInt();
|
||||
int physicalAddress = source.readInt();
|
||||
int portId = source.readInt();
|
||||
int deviceType = source.readInt();
|
||||
int vendorId = source.readInt();
|
||||
String displayName = source.readString();
|
||||
return new HdmiCecDeviceInfo(logicalAddress, physicalAddress, portId,
|
||||
deviceType, vendorId, displayName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HdmiCecDeviceInfo[] newArray(int size) {
|
||||
return new HdmiCecDeviceInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor. Used to initialize the instance for CEC device.
|
||||
*
|
||||
* @param logicalAddress logical address of HDMI-CEC device
|
||||
* @param physicalAddress physical address of HDMI-CEC device
|
||||
* @param portId HDMI port ID (1 for HDMI1)
|
||||
* @param deviceType type of device
|
||||
* @param vendorId vendor id of device. Used for vendor specific command.
|
||||
* @param displayName name of device
|
||||
* @hide
|
||||
*/
|
||||
public HdmiCecDeviceInfo(int logicalAddress, int physicalAddress, int portId, int deviceType,
|
||||
int vendorId, String displayName) {
|
||||
mLogicalAddress = logicalAddress;
|
||||
mPhysicalAddress = physicalAddress;
|
||||
mPortId = portId;
|
||||
mDeviceType = deviceType;
|
||||
mDisplayName = displayName;
|
||||
mVendorId = vendorId;
|
||||
mIsCecDevice = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Used to initialize the instance for non-CEC device.
|
||||
*
|
||||
* @param physicalAddress physical address of HDMI device
|
||||
* @param portId HDMI port ID (1 for HDMI1)
|
||||
* @hide
|
||||
*/
|
||||
public HdmiCecDeviceInfo(int physicalAddress, int portId) {
|
||||
mLogicalAddress = -1;
|
||||
mPhysicalAddress = physicalAddress;
|
||||
mPortId = portId;
|
||||
mDeviceType = DEVICE_RESERVED;
|
||||
mDisplayName = null;
|
||||
mVendorId = 0;
|
||||
mIsCecDevice = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the logical address of the device.
|
||||
*/
|
||||
public int getLogicalAddress() {
|
||||
return mLogicalAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the physical address of the device.
|
||||
*/
|
||||
public int getPhysicalAddress() {
|
||||
return mPhysicalAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the port ID.
|
||||
*/
|
||||
public int getPortId() {
|
||||
return mPortId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type of the device. For more details, refer constants between
|
||||
* {@link DEVICE_TV} and {@link DEVICE_INACTIVE}.
|
||||
*/
|
||||
public int getDeviceType() {
|
||||
return mDeviceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if the device is of a type that can be an input source.
|
||||
*/
|
||||
public boolean isSourceType() {
|
||||
return mDeviceType == DEVICE_PLAYBACK
|
||||
|| mDeviceType == DEVICE_RECORDER
|
||||
|| mDeviceType == DEVICE_TUNER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if the device represents an HDMI-CEC device. {@code false}
|
||||
* if the device is either MHL or non-CEC device.
|
||||
*/
|
||||
public boolean isCecDevice() {
|
||||
return mIsCecDevice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return display (OSD) name of the device.
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return mDisplayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vendor id of the device. Vendor id is used to distinguish devices
|
||||
* built by other manufactures. This is required for vendor-specific command
|
||||
* on CEC standard.
|
||||
*/
|
||||
public int getVendorId() {
|
||||
return mVendorId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe the kinds of special objects contained in this Parcelable's
|
||||
* marshalled representation.
|
||||
*/
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize this object into a {@link Parcel}.
|
||||
*
|
||||
* @param dest The Parcel in which the object should be written.
|
||||
* @param flags Additional flags about how the object should be written.
|
||||
* May be 0 or {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE}.
|
||||
*/
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(mLogicalAddress);
|
||||
dest.writeInt(mPhysicalAddress);
|
||||
dest.writeInt(mPortId);
|
||||
dest.writeInt(mDeviceType);
|
||||
dest.writeInt(mVendorId);
|
||||
dest.writeString(mDisplayName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer s = new StringBuffer();
|
||||
if (isCecDevice()) {
|
||||
s.append("CEC: ");
|
||||
s.append("logical_address: ").append(mLogicalAddress).append(", ");
|
||||
s.append("physical_address: ").append(mPhysicalAddress).append(", ");
|
||||
s.append("port_id: ").append(mPortId).append(", ");
|
||||
s.append("device_type: ").append(mDeviceType).append(", ");
|
||||
s.append("vendor_id: ").append(mVendorId).append(", ");
|
||||
s.append("display_name: ").append(mDisplayName);
|
||||
} else {
|
||||
s.append("Non-CEC: ");
|
||||
s.append("physical_address: ").append(mPhysicalAddress).append(", ");
|
||||
s.append("port_id: ").append(mPortId).append(", ");
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof HdmiCecDeviceInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HdmiCecDeviceInfo other = (HdmiCecDeviceInfo) obj;
|
||||
return mLogicalAddress == other.mLogicalAddress
|
||||
&& mPhysicalAddress == other.mPhysicalAddress
|
||||
&& mPortId == other.mPortId
|
||||
&& mDeviceType == other.mDeviceType
|
||||
&& mVendorId == other.mVendorId
|
||||
&& mDisplayName.equals(other.mDisplayName);
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,10 @@ public abstract class HdmiClient {
|
||||
/**
|
||||
* Returns the active source information.
|
||||
*
|
||||
* @return {@link HdmiCecDeviceInfo} object that describes the active source
|
||||
* @return {@link HdmiDeviceInfo} object that describes the active source
|
||||
* or active routing path
|
||||
*/
|
||||
public HdmiCecDeviceInfo getActiveSource() {
|
||||
public HdmiDeviceInfo getActiveSource() {
|
||||
try {
|
||||
return mService.getActiveSource();
|
||||
} catch (RemoteException e) {
|
||||
|
||||
@@ -228,8 +228,8 @@ public final class HdmiControlManager {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
mHasTvDevice = hasDeviceType(types, HdmiCecDeviceInfo.DEVICE_TV);
|
||||
mHasPlaybackDevice = hasDeviceType(types, HdmiCecDeviceInfo.DEVICE_PLAYBACK);
|
||||
mHasTvDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_TV);
|
||||
mHasPlaybackDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PLAYBACK);
|
||||
}
|
||||
|
||||
private static boolean hasDeviceType(int[] types, int type) {
|
||||
@@ -249,8 +249,8 @@ public final class HdmiControlManager {
|
||||
*
|
||||
* @param type CEC device type
|
||||
* @return {@link HdmiClient} instance. {@code null} on failure.
|
||||
* @see {@link HdmiCecDeviceInfo#DEVICE_PLAYBACK}
|
||||
* @see {@link HdmiCecDeviceInfo#DEVICE_TV}
|
||||
* See {@link HdmiDeviceInfo#DEVICE_PLAYBACK}
|
||||
* See {@link HdmiDeviceInfo#DEVICE_TV}
|
||||
*/
|
||||
@Nullable
|
||||
public HdmiClient getClient(int type) {
|
||||
@@ -258,9 +258,9 @@ public final class HdmiControlManager {
|
||||
return null;
|
||||
}
|
||||
switch (type) {
|
||||
case HdmiCecDeviceInfo.DEVICE_TV:
|
||||
case HdmiDeviceInfo.DEVICE_TV:
|
||||
return mHasTvDevice ? new HdmiTvClient(mService) : null;
|
||||
case HdmiCecDeviceInfo.DEVICE_PLAYBACK:
|
||||
case HdmiDeviceInfo.DEVICE_PLAYBACK:
|
||||
return mHasPlaybackDevice ? new HdmiPlaybackClient(mService) : null;
|
||||
default:
|
||||
return null;
|
||||
@@ -278,7 +278,7 @@ public final class HdmiControlManager {
|
||||
*/
|
||||
@Nullable
|
||||
public HdmiPlaybackClient getPlaybackClient() {
|
||||
return (HdmiPlaybackClient) getClient(HdmiCecDeviceInfo.DEVICE_PLAYBACK);
|
||||
return (HdmiPlaybackClient) getClient(HdmiDeviceInfo.DEVICE_PLAYBACK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +292,7 @@ public final class HdmiControlManager {
|
||||
*/
|
||||
@Nullable
|
||||
public HdmiTvClient getTvClient() {
|
||||
return (HdmiTvClient) getClient(HdmiCecDeviceInfo.DEVICE_TV);
|
||||
return (HdmiTvClient) getClient(HdmiDeviceInfo.DEVICE_TV);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,4 +16,4 @@
|
||||
|
||||
package android.hardware.hdmi;
|
||||
|
||||
parcelable HdmiCecDeviceInfo;
|
||||
parcelable HdmiDeviceInfo;
|
||||
411
core/java/android/hardware/hdmi/HdmiDeviceInfo.java
Normal file
411
core/java/android/hardware/hdmi/HdmiDeviceInfo.java
Normal file
@@ -0,0 +1,411 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.hdmi;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* A class to encapsulate device information for HDMI devices including CEC and MHL. In terms of
|
||||
* CEC, this container includes basic information such as logical address, physical address and
|
||||
* device type, and additional information like vendor id and osd name. In terms of MHL device, this
|
||||
* container includes adopter id and device type. Otherwise, it keeps the information of other type
|
||||
* devices for which only port ID, physical address are meaningful.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public class HdmiDeviceInfo implements Parcelable {
|
||||
|
||||
/** TV device type. */
|
||||
public static final int DEVICE_TV = 0;
|
||||
|
||||
/** Recording device type. */
|
||||
public static final int DEVICE_RECORDER = 1;
|
||||
|
||||
/** Device type reserved for future usage. */
|
||||
public static final int DEVICE_RESERVED = 2;
|
||||
|
||||
/** Tuner device type. */
|
||||
public static final int DEVICE_TUNER = 3;
|
||||
|
||||
/** Playback device type. */
|
||||
public static final int DEVICE_PLAYBACK = 4;
|
||||
|
||||
/** Audio system device type. */
|
||||
public static final int DEVICE_AUDIO_SYSTEM = 5;
|
||||
|
||||
/** @hide Pure CEC switch device type. */
|
||||
public static final int DEVICE_PURE_CEC_SWITCH = 6;
|
||||
|
||||
/** @hide Video processor device type. */
|
||||
public static final int DEVICE_VIDEO_PROCESSOR = 7;
|
||||
|
||||
// Value indicating the device is not an active source.
|
||||
public static final int DEVICE_INACTIVE = -1;
|
||||
|
||||
/**
|
||||
* Logical address used to indicate the source comes from internal device. The logical address
|
||||
* of TV(0) is used.
|
||||
*/
|
||||
public static final int ADDR_INTERNAL = 0;
|
||||
|
||||
/**
|
||||
* Physical address used to indicate the source comes from internal device. The physical address
|
||||
* of TV(0) is used.
|
||||
*/
|
||||
public static final int PATH_INTERNAL = 0x0000;
|
||||
|
||||
/** Invalid physical address (routing path) */
|
||||
public static final int PATH_INVALID = 0xFFFF;
|
||||
|
||||
/** Invalid port ID */
|
||||
public static final int PORT_INVALID = -1;
|
||||
|
||||
private static final int HDMI_DEVICE_TYPE_OTHER = 0;
|
||||
private static final int HDMI_DEVICE_TYPE_CEC = 1;
|
||||
private static final int HDMI_DEVICE_TYPE_MHL = 2;
|
||||
|
||||
// Common parameters for all device.
|
||||
private final int mHdmiDeviceType;
|
||||
private final int mPhysicalAddress;
|
||||
private final int mPortId;
|
||||
|
||||
// CEC only parameters.
|
||||
private final int mLogicalAddress;
|
||||
private final int mDeviceType;
|
||||
private final int mVendorId;
|
||||
private final String mDisplayName;
|
||||
private final int mDevicePowerStatus;
|
||||
|
||||
// MHL only parameters.
|
||||
private final int mDeviceId;
|
||||
private final int mAdopterId;
|
||||
|
||||
/**
|
||||
* A helper class to deserialize {@link HdmiDeviceInfo} for a parcel.
|
||||
*/
|
||||
public static final Parcelable.Creator<HdmiDeviceInfo> CREATOR =
|
||||
new Parcelable.Creator<HdmiDeviceInfo>() {
|
||||
@Override
|
||||
public HdmiDeviceInfo createFromParcel(Parcel source) {
|
||||
int hdmiDeviceType = source.readInt();
|
||||
int physicalAddress = source.readInt();
|
||||
int portId = source.readInt();
|
||||
|
||||
switch (hdmiDeviceType) {
|
||||
case HDMI_DEVICE_TYPE_CEC:
|
||||
int logicalAddress = source.readInt();
|
||||
int deviceType = source.readInt();
|
||||
int vendorId = source.readInt();
|
||||
int powerStatus = source.readInt();
|
||||
String displayName = source.readString();
|
||||
return new HdmiDeviceInfo(logicalAddress, physicalAddress, portId,
|
||||
deviceType, vendorId, displayName, powerStatus);
|
||||
case HDMI_DEVICE_TYPE_MHL:
|
||||
int deviceId = source.readInt();
|
||||
int adopterId = source.readInt();
|
||||
return new HdmiDeviceInfo(physicalAddress, portId, adopterId, deviceId);
|
||||
case HDMI_DEVICE_TYPE_OTHER:
|
||||
return new HdmiDeviceInfo(physicalAddress, portId);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HdmiDeviceInfo[] newArray(int size) {
|
||||
return new HdmiDeviceInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor. Used to initialize the instance for CEC device.
|
||||
*
|
||||
* @param logicalAddress logical address of HDMI-CEC device
|
||||
* @param physicalAddress physical address of HDMI-CEC device
|
||||
* @param portId HDMI port ID (1 for HDMI1)
|
||||
* @param deviceType type of device
|
||||
* @param vendorId vendor id of device. Used for vendor specific command.
|
||||
* @param displayName name of device
|
||||
* @param powerStatus device power status
|
||||
* @hide
|
||||
*/
|
||||
public HdmiDeviceInfo(int logicalAddress, int physicalAddress, int portId, int deviceType,
|
||||
int vendorId, String displayName, int powerStatus) {
|
||||
mHdmiDeviceType = HDMI_DEVICE_TYPE_CEC;
|
||||
mPhysicalAddress = physicalAddress;
|
||||
mPortId = portId;
|
||||
|
||||
mLogicalAddress = logicalAddress;
|
||||
mDeviceType = deviceType;
|
||||
mVendorId = vendorId;
|
||||
mDevicePowerStatus = powerStatus;
|
||||
mDisplayName = displayName;
|
||||
|
||||
mDeviceId = -1;
|
||||
mAdopterId = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Used to initialize the instance for CEC device.
|
||||
*
|
||||
* @param logicalAddress logical address of HDMI-CEC device
|
||||
* @param physicalAddress physical address of HDMI-CEC device
|
||||
* @param portId HDMI port ID (1 for HDMI1)
|
||||
* @param deviceType type of device
|
||||
* @param vendorId vendor id of device. Used for vendor specific command.
|
||||
* @param displayName name of device
|
||||
* @hide
|
||||
*/
|
||||
public HdmiDeviceInfo(int logicalAddress, int physicalAddress, int portId, int deviceType,
|
||||
int vendorId, String displayName) {
|
||||
this(logicalAddress, physicalAddress, portId, deviceType,
|
||||
vendorId, displayName, HdmiControlManager.POWER_STATUS_UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Used to initialize the instance for other device.
|
||||
*
|
||||
* @param physicalAddress physical address of HDMI device
|
||||
* @param portId HDMI port ID (1 for HDMI1)
|
||||
* @hide
|
||||
*/
|
||||
public HdmiDeviceInfo(int physicalAddress, int portId) {
|
||||
mHdmiDeviceType = HDMI_DEVICE_TYPE_OTHER;
|
||||
mPhysicalAddress = physicalAddress;
|
||||
mPortId = portId;
|
||||
|
||||
mLogicalAddress = -1;
|
||||
mDeviceType = DEVICE_RESERVED;
|
||||
mVendorId = 0;
|
||||
mDevicePowerStatus = HdmiControlManager.POWER_STATUS_UNKNOWN;
|
||||
mDisplayName = "HDMI" + portId;
|
||||
|
||||
mDeviceId = -1;
|
||||
mAdopterId = -1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Used to initialize the instance for MHL device.
|
||||
*
|
||||
* @param physicalAddress physical address of HDMI device
|
||||
* @param portId portId HDMI port ID (1 for HDMI1)
|
||||
* @param adopterId adopter id of MHL
|
||||
* @param deviceId device id of MHL
|
||||
* @hide
|
||||
*/
|
||||
public HdmiDeviceInfo(int physicalAddress, int portId, int adopterId, int deviceId) {
|
||||
mHdmiDeviceType = HDMI_DEVICE_TYPE_MHL;
|
||||
mPhysicalAddress = physicalAddress;
|
||||
mPortId = portId;
|
||||
|
||||
mLogicalAddress = -1;
|
||||
mDeviceType = DEVICE_RESERVED;
|
||||
mVendorId = 0;
|
||||
mDevicePowerStatus = HdmiControlManager.POWER_STATUS_UNKNOWN;
|
||||
mDisplayName = "MHL";
|
||||
|
||||
mDeviceId = adopterId;
|
||||
mAdopterId = deviceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the CEC logical address of the device.
|
||||
*/
|
||||
public int getLogicalAddress() {
|
||||
return mLogicalAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the physical address of the device.
|
||||
*/
|
||||
public int getPhysicalAddress() {
|
||||
return mPhysicalAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the port ID.
|
||||
*/
|
||||
public int getPortId() {
|
||||
return mPortId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return CEC type of the device. For more details, refer constants between {@link #DEVICE_TV}
|
||||
* and {@link #DEVICE_INACTIVE}.
|
||||
*/
|
||||
public int getDeviceType() {
|
||||
return mDeviceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return device's power status. It should be one of the following values.
|
||||
* <ul>
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_ON}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_STANDBY}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_ON}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_STANDBY}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_UNKNOWN}
|
||||
* </ul>
|
||||
*/
|
||||
public int getDevicePowerStatus() {
|
||||
return mDevicePowerStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return MHL device id. Return -1 for non-MHL device.
|
||||
*/
|
||||
public int getDeviceId() {
|
||||
return mDeviceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return MHL adopter id. Return -1 for non-MHL device.
|
||||
*/
|
||||
public int getAdopterId() {
|
||||
return mAdopterId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if the device is of a type that can be an input source.
|
||||
*/
|
||||
public boolean isSourceType() {
|
||||
return mDeviceType == DEVICE_PLAYBACK
|
||||
|| mDeviceType == DEVICE_RECORDER
|
||||
|| mDeviceType == DEVICE_TUNER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if the device represents an HDMI-CEC device. {@code false} if the device
|
||||
* is either MHL or other device.
|
||||
*/
|
||||
public boolean isCecDevice() {
|
||||
return mHdmiDeviceType == HDMI_DEVICE_TYPE_CEC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if the device represents an MHL device. {@code false} if the device is
|
||||
* either CEC or other device.
|
||||
*/
|
||||
public boolean isMhlDevice() {
|
||||
return mHdmiDeviceType == HDMI_DEVICE_TYPE_MHL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return display (OSD) name of the device.
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return mDisplayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vendor id of the device. Vendor id is used to distinguish devices built by other
|
||||
* manufactures. This is required for vendor-specific command on CEC standard.
|
||||
*/
|
||||
public int getVendorId() {
|
||||
return mVendorId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe the kinds of special objects contained in this Parcelable's marshalled
|
||||
* representation.
|
||||
*/
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize this object into a {@link Parcel}.
|
||||
*
|
||||
* @param dest The Parcel in which the object should be written.
|
||||
* @param flags Additional flags about how the object should be written. May be 0 or
|
||||
* {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE}.
|
||||
*/
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(mHdmiDeviceType);
|
||||
dest.writeInt(mPhysicalAddress);
|
||||
dest.writeInt(mPortId);
|
||||
switch (mHdmiDeviceType) {
|
||||
case HDMI_DEVICE_TYPE_CEC:
|
||||
dest.writeInt(mLogicalAddress);
|
||||
dest.writeInt(mDeviceType);
|
||||
dest.writeInt(mVendorId);
|
||||
dest.writeInt(mDevicePowerStatus);
|
||||
dest.writeString(mDisplayName);
|
||||
break;
|
||||
case HDMI_DEVICE_TYPE_MHL:
|
||||
dest.writeInt(mDeviceId);
|
||||
dest.writeInt(mAdopterId);
|
||||
break;
|
||||
default:
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer s = new StringBuffer();
|
||||
switch (mHdmiDeviceType) {
|
||||
case HDMI_DEVICE_TYPE_CEC:
|
||||
s.append("CEC: ");
|
||||
s.append("logical_address: ").append(mLogicalAddress).append(", ");
|
||||
s.append("device_type: ").append(mDeviceType).append(", ");
|
||||
s.append("vendor_id: ").append(mVendorId).append(", ");
|
||||
s.append("display_name: ").append(mDisplayName).append(", ");
|
||||
s.append("power_status: ").append(mDevicePowerStatus).append(", ");
|
||||
break;
|
||||
case HDMI_DEVICE_TYPE_MHL:
|
||||
s.append("MHL: ");
|
||||
break;
|
||||
|
||||
case HDMI_DEVICE_TYPE_OTHER:
|
||||
s.append("Other: ");
|
||||
s.append("device_id: ").append(mDeviceId).append(", ");
|
||||
s.append("adopter_id: ").append(mAdopterId).append(", ");
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
s.append("physical_address: ").append(mPhysicalAddress).append(", ");
|
||||
s.append("port_id: ").append(mPortId);
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof HdmiDeviceInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HdmiDeviceInfo other = (HdmiDeviceInfo) obj;
|
||||
return mHdmiDeviceType == other.mHdmiDeviceType
|
||||
&& mPhysicalAddress == other.mPhysicalAddress
|
||||
&& mPortId == other.mPortId
|
||||
&& mLogicalAddress == other.mLogicalAddress
|
||||
&& mDeviceType == other.mDeviceType
|
||||
&& mVendorId == other.mVendorId
|
||||
&& mDevicePowerStatus == other.mDevicePowerStatus
|
||||
&& mDisplayName.equals(other.mDisplayName)
|
||||
&& mDeviceId == other.mDeviceId
|
||||
&& mAdopterId == other.mAdopterId;
|
||||
}
|
||||
}
|
||||
@@ -52,12 +52,14 @@ public final class HdmiPlaybackClient extends HdmiClient {
|
||||
/**
|
||||
* Called when display device status is reported.
|
||||
*
|
||||
* @param status display device status
|
||||
* @see {@link HdmiControlManager#POWER_STATUS_ON}
|
||||
* @see {@link HdmiControlManager#POWER_STATUS_STANDBY}
|
||||
* @see {@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_ON}
|
||||
* @see {@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_STANDBY}
|
||||
* @see {@link HdmiControlManager#POWER_STATUS_UNKNOWN}
|
||||
* @param status display device status. It should be one of the following values.
|
||||
* <ul>
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_ON}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_STANDBY}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_ON}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_STANDBY}
|
||||
* <li>{@link HdmiControlManager#POWER_STATUS_UNKNOWN}
|
||||
* </ul>
|
||||
*/
|
||||
public void onComplete(int status);
|
||||
}
|
||||
@@ -84,7 +86,7 @@ public final class HdmiPlaybackClient extends HdmiClient {
|
||||
|
||||
@Override
|
||||
public int getDeviceType() {
|
||||
return HdmiCecDeviceInfo.DEVICE_PLAYBACK;
|
||||
return HdmiDeviceInfo.DEVICE_PLAYBACK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,7 @@ public final class HdmiTvClient extends HdmiClient {
|
||||
|
||||
@Override
|
||||
public int getDeviceType() {
|
||||
return HdmiCecDeviceInfo.DEVICE_TV;
|
||||
return HdmiDeviceInfo.DEVICE_TV;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.hardware.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiPortInfo;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
import android.hardware.hdmi.IHdmiDeviceEventListener;
|
||||
@@ -37,7 +37,7 @@ import java.util.List;
|
||||
*/
|
||||
interface IHdmiControlService {
|
||||
int[] getSupportedTypes();
|
||||
HdmiCecDeviceInfo getActiveSource();
|
||||
HdmiDeviceInfo getActiveSource();
|
||||
void oneTouchPlay(IHdmiControlCallback callback);
|
||||
void queryDisplayStatus(IHdmiControlCallback callback);
|
||||
void addHotplugEventListener(IHdmiHotplugEventListener listener);
|
||||
@@ -59,7 +59,7 @@ interface IHdmiControlService {
|
||||
void setSystemAudioVolume(int oldIndex, int newIndex, int maxIndex);
|
||||
void setSystemAudioMute(boolean mute);
|
||||
void setInputChangeListener(IHdmiInputChangeListener listener);
|
||||
List<HdmiCecDeviceInfo> getInputDevices();
|
||||
List<HdmiDeviceInfo> getInputDevices();
|
||||
void sendVendorCommand(int deviceType, int targetAddress, in byte[] params,
|
||||
boolean hasVendorId);
|
||||
void addVendorCommandListener(IHdmiVendorCommandListener listener, int deviceType);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.hardware.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
|
||||
/**
|
||||
* Callback interface definition for HDMI client to get informed of
|
||||
@@ -27,9 +27,9 @@ import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
oneway interface IHdmiDeviceEventListener {
|
||||
|
||||
/**
|
||||
* @param deviceInfo {@link HdmiCecDeviceInfo} of the logical device whose
|
||||
* @param deviceInfo {@link HdmiDeviceInfo} of the logical device whose
|
||||
* status has changed
|
||||
* @param activated true if the device gets activated
|
||||
*/
|
||||
void onStatusChanged(in HdmiCecDeviceInfo deviceInfo, in boolean activated);
|
||||
void onStatusChanged(in HdmiDeviceInfo deviceInfo, in boolean activated);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.hardware.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
|
||||
/**
|
||||
* Callback interface definition for TV to get informed of
|
||||
@@ -25,5 +25,5 @@ import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
* @hide
|
||||
*/
|
||||
oneway interface IHdmiInputChangeListener {
|
||||
void onChanged(in HdmiCecDeviceInfo device);
|
||||
void onChanged(in HdmiDeviceInfo device);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.media.tv;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.media.tv.ITvInputServiceCallback;
|
||||
import android.media.tv.ITvInputSessionCallback;
|
||||
import android.media.tv.TvInputHardwareInfo;
|
||||
@@ -35,6 +35,6 @@ oneway interface ITvInputService {
|
||||
// For hardware TvInputService
|
||||
void notifyHardwareAdded(in TvInputHardwareInfo hardwareInfo);
|
||||
void notifyHardwareRemoved(in TvInputHardwareInfo hardwareInfo);
|
||||
void notifyHdmiCecDeviceAdded(in HdmiCecDeviceInfo cecDeviceInfo);
|
||||
void notifyHdmiCecDeviceRemoved(in HdmiCecDeviceInfo cecDeviceInfo);
|
||||
void notifyHdmiCecDeviceAdded(in HdmiDeviceInfo deviceInfo);
|
||||
void notifyHdmiCecDeviceRemoved(in HdmiDeviceInfo deviceInfo);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -152,10 +152,10 @@ public final class TvInputInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* Create a new instance of the TvInputInfo class,
|
||||
* instantiating it from the given Context, ResolveInfo, and HdmiCecDeviceInfo.
|
||||
* instantiating it from the given Context, ResolveInfo, and HdmiDeviceInfo.
|
||||
*
|
||||
* @param service The ResolveInfo returned from the package manager about this TV input service.
|
||||
* @param cecInfo The HdmiCecDeviceInfo for a HDMI CEC logical device.
|
||||
* @param cecInfo The HdmiDeviceInfo for a HDMI CEC logical device.
|
||||
* @param parentId The ID of this TV input's parent input. {@code null} if none exists.
|
||||
* @param iconUri The {@link android.net.Uri} to load the icon image.
|
||||
* {@see android.content.ContentResolver#openInputStream}. If it is null, the application
|
||||
@@ -166,7 +166,7 @@ public final class TvInputInfo implements Parcelable {
|
||||
*/
|
||||
@SystemApi
|
||||
public static TvInputInfo createTvInputInfo(Context context, ResolveInfo service,
|
||||
HdmiCecDeviceInfo cecInfo, String parentId, String label, Uri iconUri)
|
||||
HdmiDeviceInfo cecInfo, String parentId, String label, Uri iconUri)
|
||||
throws XmlPullParserException, IOException {
|
||||
boolean isConnectedToHdmiSwitch = (cecInfo.getPhysicalAddress() & 0x0FFF) != 0;
|
||||
return createTvInputInfo(context, service, generateInputIdForHdmiCec(
|
||||
@@ -494,14 +494,14 @@ public final class TvInputInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to generate an input id from a ComponentName and HdmiCecDeviceInfo.
|
||||
* Used to generate an input id from a ComponentName and HdmiDeviceInfo.
|
||||
*
|
||||
* @param name the component name for generating an input id.
|
||||
* @param cecInfo HdmiCecDeviceInfo describing this TV input.
|
||||
* @param cecInfo HdmiDeviceInfo describing this TV input.
|
||||
* @return the generated input id for the given {@code name} and {@code cecInfo}.
|
||||
*/
|
||||
private static final String generateInputIdForHdmiCec(
|
||||
ComponentName name, HdmiCecDeviceInfo cecInfo) {
|
||||
ComponentName name, HdmiDeviceInfo cecInfo) {
|
||||
// Example of the format : "/CEC%04X%02X"
|
||||
String format = String.format("%s%s%%0%sX%%0%sX", DELIMITER_INFO_IN_ID, PREFIX_CEC_DEVICE,
|
||||
LENGTH_CEC_PHYSICAL_ADDRESS, LENGTH_CEC_LOGICAL_ADDRESS);
|
||||
|
||||
@@ -23,7 +23,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -142,13 +142,13 @@ public abstract class TvInputService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyHdmiCecDeviceAdded(HdmiCecDeviceInfo cecDeviceInfo) {
|
||||
public void notifyHdmiCecDeviceAdded(HdmiDeviceInfo cecDeviceInfo) {
|
||||
mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HDMI_CEC_TV_INPUT,
|
||||
cecDeviceInfo).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyHdmiCecDeviceRemoved(HdmiCecDeviceInfo cecDeviceInfo) {
|
||||
public void notifyHdmiCecDeviceRemoved(HdmiDeviceInfo cecDeviceInfo) {
|
||||
mServiceHandler.obtainMessage(ServiceHandler.DO_REMOVE_HDMI_CEC_TV_INPUT,
|
||||
cecDeviceInfo).sendToTarget();
|
||||
}
|
||||
@@ -206,11 +206,11 @@ public abstract class TvInputService extends Service {
|
||||
* {@code cecDeviceInfo}; otherwise, return {@code null}. Override to modify default behavior
|
||||
* of ignoring all HDMI CEC logical input device.
|
||||
*
|
||||
* @param cecDeviceInfo {@link HdmiCecDeviceInfo} object just added.
|
||||
* @param cecDeviceInfo {@link HdmiDeviceInfo} object just added.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public TvInputInfo onHdmiCecDeviceAdded(HdmiCecDeviceInfo cecDeviceInfo) {
|
||||
public TvInputInfo onHdmiCecDeviceAdded(HdmiDeviceInfo cecDeviceInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -219,11 +219,11 @@ public abstract class TvInputService extends Service {
|
||||
* otherwise, return {@code null}. Override to modify default behavior of ignoring all HDMI CEC
|
||||
* logical input device.
|
||||
*
|
||||
* @param cecDeviceInfo {@link HdmiCecDeviceInfo} object just removed.
|
||||
* @param cecDeviceInfo {@link HdmiDeviceInfo} object just removed.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public String onHdmiCecDeviceRemoved(HdmiCecDeviceInfo cecDeviceInfo) {
|
||||
public String onHdmiCecDeviceRemoved(HdmiDeviceInfo cecDeviceInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1287,7 +1287,7 @@ public abstract class TvInputService extends Service {
|
||||
return;
|
||||
}
|
||||
case DO_ADD_HDMI_CEC_TV_INPUT: {
|
||||
HdmiCecDeviceInfo cecDeviceInfo = (HdmiCecDeviceInfo) msg.obj;
|
||||
HdmiDeviceInfo cecDeviceInfo = (HdmiDeviceInfo) msg.obj;
|
||||
TvInputInfo inputInfo = onHdmiCecDeviceAdded(cecDeviceInfo);
|
||||
if (inputInfo != null) {
|
||||
broadcastAddHdmiCecTvInput(cecDeviceInfo.getLogicalAddress(), inputInfo);
|
||||
@@ -1295,7 +1295,7 @@ public abstract class TvInputService extends Service {
|
||||
return;
|
||||
}
|
||||
case DO_REMOVE_HDMI_CEC_TV_INPUT: {
|
||||
HdmiCecDeviceInfo cecDeviceInfo = (HdmiCecDeviceInfo) msg.obj;
|
||||
HdmiDeviceInfo cecDeviceInfo = (HdmiDeviceInfo) msg.obj;
|
||||
String inputId = onHdmiCecDeviceRemoved(cecDeviceInfo);
|
||||
if (inputId != null) {
|
||||
broadcastRemoveTvInput(inputId);
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.server.hdmi;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -66,7 +66,7 @@ final class ActiveSourceHandler {
|
||||
invokeCallback(HdmiControlManager.RESULT_SUCCESS);
|
||||
return;
|
||||
}
|
||||
HdmiCecDeviceInfo device = mService.getDeviceInfo(newActive.logicalAddress);
|
||||
HdmiDeviceInfo device = mService.getDeviceInfo(newActive.logicalAddress);
|
||||
if (device == null) {
|
||||
tv.startNewDeviceAction(newActive);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
|
||||
/**
|
||||
* Defines constants related to HDMI-CEC protocol internal implementation.
|
||||
@@ -80,7 +80,7 @@ final class Constants {
|
||||
public static final int ADDR_INVALID = -1;
|
||||
|
||||
/** Logical address used to indicate the source comes from internal device. */
|
||||
public static final int ADDR_INTERNAL = HdmiCecDeviceInfo.ADDR_INTERNAL;
|
||||
public static final int ADDR_INTERNAL = HdmiDeviceInfo.ADDR_INTERNAL;
|
||||
|
||||
static final int MESSAGE_FEATURE_ABORT = 0x00;
|
||||
static final int MESSAGE_IMAGE_VIEW_ON = 0x04;
|
||||
@@ -178,8 +178,8 @@ final class Constants {
|
||||
static final int ROUTING_PATH_TOP_MASK = 0xF000;
|
||||
static final int ROUTING_PATH_TOP_SHIFT = 12;
|
||||
|
||||
static final int INVALID_PORT_ID = HdmiCecDeviceInfo.PORT_INVALID;
|
||||
static final int INVALID_PHYSICAL_ADDRESS = HdmiCecDeviceInfo.PATH_INVALID;
|
||||
static final int INVALID_PORT_ID = HdmiDeviceInfo.PORT_INVALID;
|
||||
static final int INVALID_PHYSICAL_ADDRESS = HdmiDeviceInfo.PATH_INVALID;
|
||||
|
||||
// Send result codes. It should be consistent with hdmi_cec.h's send_message error code.
|
||||
static final int SEND_RESULT_SUCCESS = 0;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
@@ -60,7 +60,7 @@ final class DeviceDiscoveryAction extends FeatureAction {
|
||||
*
|
||||
* @param deviceInfos a list of all non-local devices. It can be empty list.
|
||||
*/
|
||||
void onDeviceDiscoveryDone(List<HdmiCecDeviceInfo> deviceInfos);
|
||||
void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos);
|
||||
}
|
||||
|
||||
// An internal container used to keep track of device information during
|
||||
@@ -72,14 +72,14 @@ final class DeviceDiscoveryAction extends FeatureAction {
|
||||
private int mPortId = Constants.INVALID_PORT_ID;
|
||||
private int mVendorId = Constants.UNKNOWN_VENDOR_ID;
|
||||
private String mDisplayName = "";
|
||||
private int mDeviceType = HdmiCecDeviceInfo.DEVICE_INACTIVE;
|
||||
private int mDeviceType = HdmiDeviceInfo.DEVICE_INACTIVE;
|
||||
|
||||
private DeviceInfo(int logicalAddress) {
|
||||
mLogicalAddress = logicalAddress;
|
||||
}
|
||||
|
||||
private HdmiCecDeviceInfo toHdmiCecDeviceInfo() {
|
||||
return new HdmiCecDeviceInfo(mLogicalAddress, mPhysicalAddress, mPortId, mDeviceType,
|
||||
private HdmiDeviceInfo toHdmiDeviceInfo() {
|
||||
return new HdmiDeviceInfo(mLogicalAddress, mPhysicalAddress, mPortId, mDeviceType,
|
||||
mVendorId, mDisplayName);
|
||||
}
|
||||
}
|
||||
@@ -314,9 +314,9 @@ final class DeviceDiscoveryAction extends FeatureAction {
|
||||
|
||||
private void wrapUpAndFinish() {
|
||||
Slog.v(TAG, "---------Wrap up Device Discovery:[" + mDevices.size() + "]---------");
|
||||
ArrayList<HdmiCecDeviceInfo> result = new ArrayList<>();
|
||||
ArrayList<HdmiDeviceInfo> result = new ArrayList<>();
|
||||
for (DeviceInfo info : mDevices) {
|
||||
HdmiCecDeviceInfo cecDeviceInfo = info.toHdmiCecDeviceInfo();
|
||||
HdmiDeviceInfo cecDeviceInfo = info.toHdmiDeviceInfo();
|
||||
Slog.v(TAG, " DeviceInfo: " + cecDeviceInfo);
|
||||
result.add(cecDeviceInfo);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.hardware.hdmi.HdmiTvClient;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
@@ -67,7 +67,7 @@ final class DeviceSelectAction extends FeatureAction {
|
||||
// before we give up and mark the action as failure.
|
||||
private static final int STATE_WAIT_FOR_ACTIVE_SOURCE = 4;
|
||||
|
||||
private final HdmiCecDeviceInfo mTarget;
|
||||
private final HdmiDeviceInfo mTarget;
|
||||
private final IHdmiControlCallback mCallback;
|
||||
private final HdmiCecMessage mGivePowerStatus;
|
||||
|
||||
@@ -81,7 +81,7 @@ final class DeviceSelectAction extends FeatureAction {
|
||||
* @param callback callback object
|
||||
*/
|
||||
public DeviceSelectAction(HdmiCecLocalDeviceTv source,
|
||||
HdmiCecDeviceInfo target, IHdmiControlCallback callback) {
|
||||
HdmiDeviceInfo target, IHdmiControlCallback callback) {
|
||||
super(source);
|
||||
mCallback = callback;
|
||||
mTarget = target;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
@@ -47,7 +47,7 @@ abstract class HdmiCecLocalDevice {
|
||||
protected final int mDeviceType;
|
||||
protected int mAddress;
|
||||
protected int mPreferredAddress;
|
||||
protected HdmiCecDeviceInfo mDeviceInfo;
|
||||
protected HdmiDeviceInfo mDeviceInfo;
|
||||
|
||||
static class ActiveSource {
|
||||
int logicalAddress;
|
||||
@@ -135,9 +135,9 @@ abstract class HdmiCecLocalDevice {
|
||||
// Factory method that returns HdmiCecLocalDevice of corresponding type.
|
||||
static HdmiCecLocalDevice create(HdmiControlService service, int deviceType) {
|
||||
switch (deviceType) {
|
||||
case HdmiCecDeviceInfo.DEVICE_TV:
|
||||
case HdmiDeviceInfo.DEVICE_TV:
|
||||
return new HdmiCecLocalDeviceTv(service);
|
||||
case HdmiCecDeviceInfo.DEVICE_PLAYBACK:
|
||||
case HdmiDeviceInfo.DEVICE_PLAYBACK:
|
||||
return new HdmiCecLocalDevicePlayback(service);
|
||||
default:
|
||||
return null;
|
||||
@@ -460,13 +460,13 @@ abstract class HdmiCecLocalDevice {
|
||||
}
|
||||
|
||||
@ServiceThreadOnly
|
||||
HdmiCecDeviceInfo getDeviceInfo() {
|
||||
HdmiDeviceInfo getDeviceInfo() {
|
||||
assertRunOnServiceThread();
|
||||
return mDeviceInfo;
|
||||
}
|
||||
|
||||
@ServiceThreadOnly
|
||||
void setDeviceInfo(HdmiCecDeviceInfo info) {
|
||||
void setDeviceInfo(HdmiDeviceInfo info) {
|
||||
assertRunOnServiceThread();
|
||||
mDeviceInfo = info;
|
||||
}
|
||||
@@ -604,7 +604,7 @@ abstract class HdmiCecLocalDevice {
|
||||
setActiveSource(newActive.logicalAddress, newActive.physicalAddress);
|
||||
}
|
||||
|
||||
void setActiveSource(HdmiCecDeviceInfo info) {
|
||||
void setActiveSource(HdmiDeviceInfo info) {
|
||||
setActiveSource(info.getLogicalAddress(), info.getPhysicalAddress());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
import android.os.RemoteException;
|
||||
@@ -34,7 +34,7 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice {
|
||||
private boolean mIsActiveSource = false;
|
||||
|
||||
HdmiCecLocalDevicePlayback(HdmiControlService service) {
|
||||
super(service, HdmiCecDeviceInfo.DEVICE_PLAYBACK);
|
||||
super(service, HdmiDeviceInfo.DEVICE_PLAYBACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ import static android.hardware.hdmi.HdmiControlManager.TIMER_RECORDING_TYPE_DIGI
|
||||
import static android.hardware.hdmi.HdmiControlManager.TIMER_RECORDING_TYPE_EXTERNAL;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.hardware.hdmi.HdmiRecordSources;
|
||||
import android.hardware.hdmi.HdmiTimerRecordSources;
|
||||
@@ -94,15 +94,15 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
|
||||
// Copy of mDeviceInfos to guarantee thread-safety.
|
||||
@GuardedBy("mLock")
|
||||
private List<HdmiCecDeviceInfo> mSafeAllDeviceInfos = Collections.emptyList();
|
||||
private List<HdmiDeviceInfo> mSafeAllDeviceInfos = Collections.emptyList();
|
||||
// All external cec input(source) devices. Does not include system audio device.
|
||||
@GuardedBy("mLock")
|
||||
private List<HdmiCecDeviceInfo> mSafeExternalInputs = Collections.emptyList();
|
||||
private List<HdmiDeviceInfo> mSafeExternalInputs = Collections.emptyList();
|
||||
|
||||
// Map-like container of all cec devices including local ones.
|
||||
// A logical address of device is used as key of container.
|
||||
// This is not thread-safe. For external purpose use mSafeDeviceInfos.
|
||||
private final SparseArray<HdmiCecDeviceInfo> mDeviceInfos = new SparseArray<>();
|
||||
private final SparseArray<HdmiDeviceInfo> mDeviceInfos = new SparseArray<>();
|
||||
|
||||
// If true, TV going to standby mode puts other devices also to standby.
|
||||
private boolean mAutoDeviceOff;
|
||||
@@ -117,7 +117,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
private final ArraySet<Integer> mCecSwitches = new ArraySet<Integer>();
|
||||
|
||||
HdmiCecLocalDeviceTv(HdmiControlService service) {
|
||||
super(service, HdmiCecDeviceInfo.DEVICE_TV);
|
||||
super(service, HdmiDeviceInfo.DEVICE_TV);
|
||||
mPrevPortId = Constants.INVALID_PORT_ID;
|
||||
mAutoDeviceOff = mService.readBooleanSetting(Global.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED,
|
||||
true);
|
||||
@@ -187,14 +187,14 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
return;
|
||||
}
|
||||
if (!mService.isControlEnabled()) {
|
||||
HdmiCecDeviceInfo info = getDeviceInfo(targetAddress);
|
||||
HdmiDeviceInfo info = getDeviceInfo(targetAddress);
|
||||
if (info != null) {
|
||||
setActiveSource(info);
|
||||
}
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
|
||||
return;
|
||||
}
|
||||
HdmiCecDeviceInfo targetDevice = getDeviceInfo(targetAddress);
|
||||
HdmiDeviceInfo targetDevice = getDeviceInfo(targetAddress);
|
||||
if (targetDevice == null) {
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_TARGET_NOT_AVAILABLE);
|
||||
return;
|
||||
@@ -279,10 +279,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
// Show OSD port change banner
|
||||
if (notifyInputChange) {
|
||||
ActiveSource activeSource = getActiveSource();
|
||||
HdmiCecDeviceInfo info = getDeviceInfo(activeSource.logicalAddress);
|
||||
HdmiDeviceInfo info = getDeviceInfo(activeSource.logicalAddress);
|
||||
if (info == null) {
|
||||
info = new HdmiCecDeviceInfo(Constants.ADDR_INVALID, path, portId,
|
||||
HdmiCecDeviceInfo.DEVICE_RESERVED, 0, null);
|
||||
info = new HdmiDeviceInfo(Constants.ADDR_INVALID, path, portId,
|
||||
HdmiDeviceInfo.DEVICE_RESERVED, 0, null);
|
||||
}
|
||||
mService.invokeInputChangeListener(info);
|
||||
}
|
||||
@@ -388,7 +388,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
if (portId != Constants.INVALID_PORT_ID) {
|
||||
// TODO: Do this only if TV is not showing multiview like PIP/PAP.
|
||||
|
||||
HdmiCecDeviceInfo inactiveSource = getDeviceInfo(message.getSource());
|
||||
HdmiDeviceInfo inactiveSource = getDeviceInfo(message.getSource());
|
||||
if (inactiveSource == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -440,11 +440,11 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
// Build cec switch list with pure CEC switch, AVR.
|
||||
if (address == Constants.ADDR_UNREGISTERED) {
|
||||
int type = message.getParams()[2];
|
||||
if (type == HdmiCecDeviceInfo.DEVICE_PURE_CEC_SWITCH) {
|
||||
if (type == HdmiDeviceInfo.DEVICE_PURE_CEC_SWITCH) {
|
||||
mCecSwitches.add(path);
|
||||
updateSafeDeviceInfoList();
|
||||
return true; // Pure switch does not need further processing. Return here.
|
||||
} else if (type == HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
} else if (type == HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
mCecSwitches.add(path);
|
||||
}
|
||||
}
|
||||
@@ -572,7 +572,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
@ServiceThreadOnly
|
||||
protected boolean handleSetOsdName(HdmiCecMessage message) {
|
||||
int source = message.getSource();
|
||||
HdmiCecDeviceInfo deviceInfo = getDeviceInfo(source);
|
||||
HdmiDeviceInfo deviceInfo = getDeviceInfo(source);
|
||||
// If the device is not in device list, ignore it.
|
||||
if (deviceInfo == null) {
|
||||
Slog.e(TAG, "No source device info for <Set Osd Name>." + message);
|
||||
@@ -591,7 +591,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
return true;
|
||||
}
|
||||
|
||||
addCecDevice(new HdmiCecDeviceInfo(deviceInfo.getLogicalAddress(),
|
||||
addCecDevice(new HdmiDeviceInfo(deviceInfo.getLogicalAddress(),
|
||||
deviceInfo.getPhysicalAddress(), deviceInfo.getPortId(),
|
||||
deviceInfo.getDeviceType(), deviceInfo.getVendorId(), osdName));
|
||||
return true;
|
||||
@@ -604,8 +604,8 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
DeviceDiscoveryAction action = new DeviceDiscoveryAction(this,
|
||||
new DeviceDiscoveryCallback() {
|
||||
@Override
|
||||
public void onDeviceDiscoveryDone(List<HdmiCecDeviceInfo> deviceInfos) {
|
||||
for (HdmiCecDeviceInfo info : deviceInfos) {
|
||||
public void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos) {
|
||||
for (HdmiDeviceInfo info : deviceInfos) {
|
||||
addCecDevice(info);
|
||||
}
|
||||
|
||||
@@ -638,7 +638,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
@ServiceThreadOnly
|
||||
private void clearDeviceInfoList() {
|
||||
assertRunOnServiceThread();
|
||||
for (HdmiCecDeviceInfo info : mSafeExternalInputs) {
|
||||
for (HdmiDeviceInfo info : mSafeExternalInputs) {
|
||||
invokeDeviceEventListener(info, false);
|
||||
}
|
||||
mDeviceInfos.clear();
|
||||
@@ -654,7 +654,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
|
||||
return;
|
||||
}
|
||||
HdmiCecDeviceInfo avr = getAvrDeviceInfo();
|
||||
HdmiDeviceInfo avr = getAvrDeviceInfo();
|
||||
if (avr == null) {
|
||||
setSystemAudioMode(false, true);
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_TARGET_NOT_AVAILABLE);
|
||||
@@ -758,7 +758,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
@ServiceThreadOnly
|
||||
private void startArcAction(boolean enabled) {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecDeviceInfo info = getAvrDeviceInfo();
|
||||
HdmiDeviceInfo info = getAvrDeviceInfo();
|
||||
if (info == null) {
|
||||
return;
|
||||
}
|
||||
@@ -814,7 +814,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
// Remove existing volume action.
|
||||
removeAction(VolumeControlAction.class);
|
||||
|
||||
HdmiCecDeviceInfo avr = getAvrDeviceInfo();
|
||||
HdmiDeviceInfo avr = getAvrDeviceInfo();
|
||||
addAndStartAction(VolumeControlAction.ofVolumeChange(this, avr.getLogicalAddress(),
|
||||
cecVolume, delta > 0));
|
||||
}
|
||||
@@ -828,7 +828,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
|
||||
// Remove existing volume action.
|
||||
removeAction(VolumeControlAction.class);
|
||||
HdmiCecDeviceInfo avr = getAvrDeviceInfo();
|
||||
HdmiDeviceInfo avr = getAvrDeviceInfo();
|
||||
addAndStartAction(VolumeControlAction.ofMute(this, avr.getLogicalAddress(), mute));
|
||||
}
|
||||
|
||||
@@ -934,19 +934,19 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link HdmiCecDeviceInfo}. It returns old device info which has the same
|
||||
* Add a new {@link HdmiDeviceInfo}. It returns old device info which has the same
|
||||
* logical address as new device info's.
|
||||
*
|
||||
* <p>Declared as package-private. accessed by {@link HdmiControlService} only.
|
||||
*
|
||||
* @param deviceInfo a new {@link HdmiCecDeviceInfo} to be added.
|
||||
* @return {@code null} if it is new device. Otherwise, returns old {@HdmiCecDeviceInfo}
|
||||
* @param deviceInfo a new {@link HdmiDeviceInfo} to be added.
|
||||
* @return {@code null} if it is new device. Otherwise, returns old {@HdmiDeviceInfo}
|
||||
* that has the same logical address as new one has.
|
||||
*/
|
||||
@ServiceThreadOnly
|
||||
private HdmiCecDeviceInfo addDeviceInfo(HdmiCecDeviceInfo deviceInfo) {
|
||||
private HdmiDeviceInfo addDeviceInfo(HdmiDeviceInfo deviceInfo) {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecDeviceInfo oldDeviceInfo = getDeviceInfo(deviceInfo.getLogicalAddress());
|
||||
HdmiDeviceInfo oldDeviceInfo = getDeviceInfo(deviceInfo.getLogicalAddress());
|
||||
if (oldDeviceInfo != null) {
|
||||
removeDeviceInfo(deviceInfo.getLogicalAddress());
|
||||
}
|
||||
@@ -957,17 +957,17 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
|
||||
/**
|
||||
* Remove a device info corresponding to the given {@code logicalAddress}.
|
||||
* It returns removed {@link HdmiCecDeviceInfo} if exists.
|
||||
* It returns removed {@link HdmiDeviceInfo} if exists.
|
||||
*
|
||||
* <p>Declared as package-private. accessed by {@link HdmiControlService} only.
|
||||
*
|
||||
* @param logicalAddress logical address of device to be removed
|
||||
* @return removed {@link HdmiCecDeviceInfo} it exists. Otherwise, returns {@code null}
|
||||
* @return removed {@link HdmiDeviceInfo} it exists. Otherwise, returns {@code null}
|
||||
*/
|
||||
@ServiceThreadOnly
|
||||
private HdmiCecDeviceInfo removeDeviceInfo(int logicalAddress) {
|
||||
private HdmiDeviceInfo removeDeviceInfo(int logicalAddress) {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecDeviceInfo deviceInfo = mDeviceInfos.get(logicalAddress);
|
||||
HdmiDeviceInfo deviceInfo = mDeviceInfos.get(logicalAddress);
|
||||
if (deviceInfo != null) {
|
||||
mDeviceInfos.remove(logicalAddress);
|
||||
}
|
||||
@@ -976,21 +976,21 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all {@link HdmiCecDeviceInfo}.
|
||||
* Return a list of all {@link HdmiDeviceInfo}.
|
||||
*
|
||||
* <p>Declared as package-private. accessed by {@link HdmiControlService} only.
|
||||
* This is not thread-safe. For thread safety, call {@link #getSafeExternalInputs} which
|
||||
* does not include local device.
|
||||
*/
|
||||
@ServiceThreadOnly
|
||||
List<HdmiCecDeviceInfo> getDeviceInfoList(boolean includelLocalDevice) {
|
||||
List<HdmiDeviceInfo> getDeviceInfoList(boolean includelLocalDevice) {
|
||||
assertRunOnServiceThread();
|
||||
if (includelLocalDevice) {
|
||||
return HdmiUtils.sparseArrayToList(mDeviceInfos);
|
||||
} else {
|
||||
ArrayList<HdmiCecDeviceInfo> infoList = new ArrayList<>();
|
||||
ArrayList<HdmiDeviceInfo> infoList = new ArrayList<>();
|
||||
for (int i = 0; i < mDeviceInfos.size(); ++i) {
|
||||
HdmiCecDeviceInfo info = mDeviceInfos.valueAt(i);
|
||||
HdmiDeviceInfo info = mDeviceInfos.valueAt(i);
|
||||
if (!isLocalDeviceAddress(info.getLogicalAddress())) {
|
||||
infoList.add(info);
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
/**
|
||||
* Return external input devices.
|
||||
*/
|
||||
List<HdmiCecDeviceInfo> getSafeExternalInputs() {
|
||||
List<HdmiDeviceInfo> getSafeExternalInputs() {
|
||||
synchronized (mLock) {
|
||||
return mSafeExternalInputs;
|
||||
}
|
||||
@@ -1011,8 +1011,8 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
@ServiceThreadOnly
|
||||
private void updateSafeDeviceInfoList() {
|
||||
assertRunOnServiceThread();
|
||||
List<HdmiCecDeviceInfo> copiedDevices = HdmiUtils.sparseArrayToList(mDeviceInfos);
|
||||
List<HdmiCecDeviceInfo> externalInputs = getInputDevices();
|
||||
List<HdmiDeviceInfo> copiedDevices = HdmiUtils.sparseArrayToList(mDeviceInfos);
|
||||
List<HdmiDeviceInfo> externalInputs = getInputDevices();
|
||||
synchronized (mLock) {
|
||||
mSafeAllDeviceInfos = copiedDevices;
|
||||
mSafeExternalInputs = externalInputs;
|
||||
@@ -1025,10 +1025,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
* <p>Note that this effectively excludes non-source devices like system audio,
|
||||
* secondary TV.
|
||||
*/
|
||||
private List<HdmiCecDeviceInfo> getInputDevices() {
|
||||
ArrayList<HdmiCecDeviceInfo> infoList = new ArrayList<>();
|
||||
private List<HdmiDeviceInfo> getInputDevices() {
|
||||
ArrayList<HdmiDeviceInfo> infoList = new ArrayList<>();
|
||||
for (int i = 0; i < mDeviceInfos.size(); ++i) {
|
||||
HdmiCecDeviceInfo info = mDeviceInfos.valueAt(i);
|
||||
HdmiDeviceInfo info = mDeviceInfos.valueAt(i);
|
||||
if (isLocalDeviceAddress(i)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1042,7 +1042,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
// Check if we are hiding CEC devices connected to a legacy (non-CEC) switch.
|
||||
// Returns true if the policy is set to true, and the device to check does not have
|
||||
// a parent CEC device (which should be the CEC-enabled switch) in the list.
|
||||
private boolean hideDevicesBehindLegacySwitch(HdmiCecDeviceInfo info) {
|
||||
private boolean hideDevicesBehindLegacySwitch(HdmiDeviceInfo info) {
|
||||
return HdmiConfig.HIDE_DEVICES_BEHIND_LEGACY_SWITCH
|
||||
&& !isConnectedToCecSwitch(info.getPhysicalAddress(), mCecSwitches);
|
||||
}
|
||||
@@ -1069,7 +1069,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void invokeDeviceEventListener(HdmiCecDeviceInfo info, boolean activated) {
|
||||
private void invokeDeviceEventListener(HdmiDeviceInfo info, boolean activated) {
|
||||
if (!hideDevicesBehindLegacySwitch(info)) {
|
||||
mService.invokeDeviceEventListeners(info, activated);
|
||||
}
|
||||
@@ -1087,23 +1087,23 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
}
|
||||
|
||||
@ServiceThreadOnly
|
||||
HdmiCecDeviceInfo getAvrDeviceInfo() {
|
||||
HdmiDeviceInfo getAvrDeviceInfo() {
|
||||
assertRunOnServiceThread();
|
||||
return getDeviceInfo(Constants.ADDR_AUDIO_SYSTEM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link HdmiCecDeviceInfo} corresponding to the given {@code logicalAddress}.
|
||||
* Return a {@link HdmiDeviceInfo} corresponding to the given {@code logicalAddress}.
|
||||
*
|
||||
* <p>Declared as package-private. accessed by {@link HdmiControlService} only.
|
||||
* This is not thread-safe. For thread safety, call {@link #getSafeDeviceInfo(int)}.
|
||||
*
|
||||
* @param logicalAddress logical address to be retrieved
|
||||
* @return {@link HdmiCecDeviceInfo} matched with the given {@code logicalAddress}.
|
||||
* @return {@link HdmiDeviceInfo} matched with the given {@code logicalAddress}.
|
||||
* Returns null if no logical address matched
|
||||
*/
|
||||
@ServiceThreadOnly
|
||||
HdmiCecDeviceInfo getDeviceInfo(int logicalAddress) {
|
||||
HdmiDeviceInfo getDeviceInfo(int logicalAddress) {
|
||||
assertRunOnServiceThread();
|
||||
return mDeviceInfos.get(logicalAddress);
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
return getSafeAvrDeviceInfo() != null;
|
||||
}
|
||||
|
||||
HdmiCecDeviceInfo getSafeAvrDeviceInfo() {
|
||||
HdmiDeviceInfo getSafeAvrDeviceInfo() {
|
||||
return getSafeDeviceInfo(Constants.ADDR_AUDIO_SYSTEM);
|
||||
}
|
||||
|
||||
@@ -1120,10 +1120,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
* Thread safe version of {@link #getDeviceInfo(int)}.
|
||||
*
|
||||
* @param logicalAddress logical address to be retrieved
|
||||
* @return {@link HdmiCecDeviceInfo} matched with the given {@code logicalAddress}.
|
||||
* @return {@link HdmiDeviceInfo} matched with the given {@code logicalAddress}.
|
||||
* Returns null if no logical address matched
|
||||
*/
|
||||
HdmiCecDeviceInfo getSafeDeviceInfo(int logicalAddress) {
|
||||
HdmiDeviceInfo getSafeDeviceInfo(int logicalAddress) {
|
||||
synchronized (mLock) {
|
||||
return mSafeAllDeviceInfos.get(logicalAddress);
|
||||
}
|
||||
@@ -1136,7 +1136,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
* @param info device info of a new device.
|
||||
*/
|
||||
@ServiceThreadOnly
|
||||
final void addCecDevice(HdmiCecDeviceInfo info) {
|
||||
final void addCecDevice(HdmiDeviceInfo info) {
|
||||
assertRunOnServiceThread();
|
||||
addDeviceInfo(info);
|
||||
if (info.getLogicalAddress() == mAddress) {
|
||||
@@ -1154,7 +1154,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
@ServiceThreadOnly
|
||||
final void removeCecDevice(int address) {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecDeviceInfo info = removeDeviceInfo(address);
|
||||
HdmiDeviceInfo info = removeDeviceInfo(address);
|
||||
|
||||
mCecMessageCache.flushMessagesFrom(address);
|
||||
invokeDeviceEventListener(info, false);
|
||||
@@ -1204,17 +1204,17 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link HdmiCecDeviceInfo} instance whose physical address matches
|
||||
* Returns the {@link HdmiDeviceInfo} instance whose physical address matches
|
||||
* the given routing path. CEC devices use routing path for its physical address to
|
||||
* describe the hierarchy of the devices in the network.
|
||||
*
|
||||
* @param path routing path or physical address
|
||||
* @return {@link HdmiCecDeviceInfo} if the matched info is found; otherwise null
|
||||
* @return {@link HdmiDeviceInfo} if the matched info is found; otherwise null
|
||||
*/
|
||||
@ServiceThreadOnly
|
||||
final HdmiCecDeviceInfo getDeviceInfoByPath(int path) {
|
||||
final HdmiDeviceInfo getDeviceInfoByPath(int path) {
|
||||
assertRunOnServiceThread();
|
||||
for (HdmiCecDeviceInfo info : getDeviceInfoList(false)) {
|
||||
for (HdmiDeviceInfo info : getDeviceInfoList(false)) {
|
||||
if (info.getPhysicalAddress() == path) {
|
||||
return info;
|
||||
}
|
||||
@@ -1234,7 +1234,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
@ServiceThreadOnly
|
||||
boolean isInDeviceList(int logicalAddress, int physicalAddress) {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecDeviceInfo device = getDeviceInfo(logicalAddress);
|
||||
HdmiDeviceInfo device = getDeviceInfo(logicalAddress);
|
||||
if (device == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -1332,7 +1332,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
@ServiceThreadOnly
|
||||
private void disableArcIfExist() {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecDeviceInfo avr = getAvrDeviceInfo();
|
||||
HdmiDeviceInfo avr = getAvrDeviceInfo();
|
||||
if (avr == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1422,10 +1422,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
}
|
||||
|
||||
private boolean checkRecorder(int recorderAddress) {
|
||||
HdmiCecDeviceInfo device = getDeviceInfo(recorderAddress);
|
||||
HdmiDeviceInfo device = getDeviceInfo(recorderAddress);
|
||||
return (device != null)
|
||||
&& (HdmiUtils.getTypeFromAddress(recorderAddress)
|
||||
== HdmiCecDeviceInfo.DEVICE_RECORDER);
|
||||
== HdmiDeviceInfo.DEVICE_RECORDER);
|
||||
}
|
||||
|
||||
private boolean checkRecordSource(byte[] recordSource) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
|
||||
@@ -268,9 +268,9 @@ public final class HdmiCecMessageValidator {
|
||||
* @return true if the given type is valid
|
||||
*/
|
||||
static boolean isValidType(int type) {
|
||||
return (HdmiCecDeviceInfo.DEVICE_TV <= type
|
||||
&& type <= HdmiCecDeviceInfo.DEVICE_VIDEO_PROCESSOR)
|
||||
&& type != HdmiCecDeviceInfo.DEVICE_RESERVED;
|
||||
return (HdmiDeviceInfo.DEVICE_TV <= type
|
||||
&& type <= HdmiDeviceInfo.DEVICE_VIDEO_PROCESSOR)
|
||||
&& type != HdmiDeviceInfo.DEVICE_RESERVED;
|
||||
}
|
||||
|
||||
private class PhysicalAddressValidator implements ParameterValidator {
|
||||
|
||||
@@ -22,7 +22,7 @@ import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.hardware.hdmi.HdmiHotplugEvent;
|
||||
import android.hardware.hdmi.HdmiPortInfo;
|
||||
@@ -317,7 +317,7 @@ public final class HdmiControlService extends SystemService {
|
||||
if (logicalAddress == Constants.ADDR_UNREGISTERED) {
|
||||
Slog.e(TAG, "Failed to allocate address:[device_type:" + deviceType + "]");
|
||||
} else {
|
||||
HdmiCecDeviceInfo deviceInfo = createDeviceInfo(logicalAddress, deviceType);
|
||||
HdmiDeviceInfo deviceInfo = createDeviceInfo(logicalAddress, deviceType);
|
||||
localDevice.setDeviceInfo(deviceInfo);
|
||||
mCecController.addLocalDevice(deviceType, localDevice);
|
||||
mCecController.addLogicalAddress(logicalAddress);
|
||||
@@ -467,7 +467,7 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
|
||||
@ServiceThreadOnly
|
||||
HdmiCecDeviceInfo getDeviceInfo(int logicalAddress) {
|
||||
HdmiDeviceInfo getDeviceInfo(int logicalAddress) {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecLocalDeviceTv tv = tv();
|
||||
if (tv == null) {
|
||||
@@ -646,10 +646,10 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
private HdmiCecDeviceInfo createDeviceInfo(int logicalAddress, int deviceType) {
|
||||
private HdmiDeviceInfo createDeviceInfo(int logicalAddress, int deviceType) {
|
||||
// TODO: find better name instead of model name.
|
||||
String displayName = Build.MODEL;
|
||||
return new HdmiCecDeviceInfo(logicalAddress,
|
||||
return new HdmiDeviceInfo(logicalAddress,
|
||||
getPhysicalAddress(), pathToPortId(getPhysicalAddress()), deviceType,
|
||||
getVendorId(), displayName);
|
||||
}
|
||||
@@ -747,7 +747,7 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HdmiCecDeviceInfo getActiveSource() {
|
||||
public HdmiDeviceInfo getActiveSource() {
|
||||
HdmiCecLocalDeviceTv tv = tv();
|
||||
if (tv == null) {
|
||||
Slog.w(TAG, "Local tv device not available");
|
||||
@@ -755,13 +755,13 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
ActiveSource activeSource = tv.getActiveSource();
|
||||
if (activeSource.isValid()) {
|
||||
return new HdmiCecDeviceInfo(activeSource.logicalAddress,
|
||||
activeSource.physicalAddress, HdmiCecDeviceInfo.PORT_INVALID,
|
||||
HdmiCecDeviceInfo.DEVICE_INACTIVE, 0, "");
|
||||
return new HdmiDeviceInfo(activeSource.logicalAddress,
|
||||
activeSource.physicalAddress, HdmiDeviceInfo.PORT_INVALID,
|
||||
HdmiDeviceInfo.DEVICE_INACTIVE, 0, "");
|
||||
}
|
||||
int activePath = tv.getActivePath();
|
||||
if (activePath != HdmiCecDeviceInfo.PATH_INVALID) {
|
||||
return new HdmiCecDeviceInfo(activePath, tv.getActivePortId());
|
||||
if (activePath != HdmiDeviceInfo.PATH_INVALID) {
|
||||
return new HdmiDeviceInfo(activePath, tv.getActivePortId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -943,7 +943,7 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HdmiCecDeviceInfo> getInputDevices() {
|
||||
public List<HdmiDeviceInfo> getInputDevices() {
|
||||
enforceAccessPermission();
|
||||
// No need to hold the lock for obtaining TV device as the local device instance
|
||||
// is preserved while the HDMI control is enabled.
|
||||
@@ -1212,7 +1212,7 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
void invokeDeviceEventListeners(HdmiCecDeviceInfo device, boolean activated) {
|
||||
void invokeDeviceEventListeners(HdmiDeviceInfo device, boolean activated) {
|
||||
synchronized (mLock) {
|
||||
for (IHdmiDeviceEventListener listener : mDeviceEventListeners) {
|
||||
try {
|
||||
@@ -1275,7 +1275,7 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
void invokeInputChangeListener(HdmiCecDeviceInfo info) {
|
||||
void invokeInputChangeListener(HdmiDeviceInfo info) {
|
||||
synchronized (mLock) {
|
||||
if (mInputChangeListener != null) {
|
||||
try {
|
||||
@@ -1384,7 +1384,7 @@ public final class HdmiControlService extends SystemService {
|
||||
}
|
||||
|
||||
private HdmiCecLocalDeviceTv tv() {
|
||||
return (HdmiCecLocalDeviceTv) mCecController.getLocalDevice(HdmiCecDeviceInfo.DEVICE_TV);
|
||||
return (HdmiCecLocalDeviceTv) mCecController.getLocalDevice(HdmiDeviceInfo.DEVICE_TV);
|
||||
}
|
||||
|
||||
boolean isTvDevice() {
|
||||
@@ -1393,7 +1393,7 @@ public final class HdmiControlService extends SystemService {
|
||||
|
||||
private HdmiCecLocalDevicePlayback playback() {
|
||||
return (HdmiCecLocalDevicePlayback)
|
||||
mCecController.getLocalDevice(HdmiCecDeviceInfo.DEVICE_PLAYBACK);
|
||||
mCecController.getLocalDevice(HdmiDeviceInfo.DEVICE_PLAYBACK);
|
||||
}
|
||||
|
||||
AudioManager getAudioManager() {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
|
||||
@@ -30,21 +30,21 @@ import java.util.List;
|
||||
final class HdmiUtils {
|
||||
|
||||
private static final int[] ADDRESS_TO_TYPE = {
|
||||
HdmiCecDeviceInfo.DEVICE_TV, // ADDR_TV
|
||||
HdmiCecDeviceInfo.DEVICE_RECORDER, // ADDR_RECORDER_1
|
||||
HdmiCecDeviceInfo.DEVICE_RECORDER, // ADDR_RECORDER_2
|
||||
HdmiCecDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_1
|
||||
HdmiCecDeviceInfo.DEVICE_PLAYBACK, // ADDR_PLAYBACK_1
|
||||
HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM, // ADDR_AUDIO_SYSTEM
|
||||
HdmiCecDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_2
|
||||
HdmiCecDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_3
|
||||
HdmiCecDeviceInfo.DEVICE_PLAYBACK, // ADDR_PLAYBACK_2
|
||||
HdmiCecDeviceInfo.DEVICE_RECORDER, // ADDR_RECORDER_3
|
||||
HdmiCecDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_4
|
||||
HdmiCecDeviceInfo.DEVICE_PLAYBACK, // ADDR_PLAYBACK_3
|
||||
HdmiCecDeviceInfo.DEVICE_RESERVED,
|
||||
HdmiCecDeviceInfo.DEVICE_RESERVED,
|
||||
HdmiCecDeviceInfo.DEVICE_TV, // ADDR_SPECIFIC_USE
|
||||
HdmiDeviceInfo.DEVICE_TV, // ADDR_TV
|
||||
HdmiDeviceInfo.DEVICE_RECORDER, // ADDR_RECORDER_1
|
||||
HdmiDeviceInfo.DEVICE_RECORDER, // ADDR_RECORDER_2
|
||||
HdmiDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_1
|
||||
HdmiDeviceInfo.DEVICE_PLAYBACK, // ADDR_PLAYBACK_1
|
||||
HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM, // ADDR_AUDIO_SYSTEM
|
||||
HdmiDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_2
|
||||
HdmiDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_3
|
||||
HdmiDeviceInfo.DEVICE_PLAYBACK, // ADDR_PLAYBACK_2
|
||||
HdmiDeviceInfo.DEVICE_RECORDER, // ADDR_RECORDER_3
|
||||
HdmiDeviceInfo.DEVICE_TUNER, // ADDR_TUNER_4
|
||||
HdmiDeviceInfo.DEVICE_PLAYBACK, // ADDR_PLAYBACK_3
|
||||
HdmiDeviceInfo.DEVICE_RESERVED,
|
||||
HdmiDeviceInfo.DEVICE_RESERVED,
|
||||
HdmiDeviceInfo.DEVICE_TV, // ADDR_SPECIFIC_USE
|
||||
};
|
||||
|
||||
private static final String[] DEFAULT_NAMES = {
|
||||
@@ -90,7 +90,7 @@ final class HdmiUtils {
|
||||
if (isValidAddress(address)) {
|
||||
return ADDRESS_TO_TYPE[address];
|
||||
}
|
||||
return HdmiCecDeviceInfo.DEVICE_INACTIVE;
|
||||
return HdmiDeviceInfo.DEVICE_INACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.server.hdmi.HdmiControlService.DevicePollingCallback;
|
||||
@@ -161,11 +161,11 @@ final class HotplugDetectionAction extends FeatureAction {
|
||||
}
|
||||
}
|
||||
|
||||
private static BitSet infoListToBitSet(List<HdmiCecDeviceInfo> infoList, boolean audioOnly) {
|
||||
private static BitSet infoListToBitSet(List<HdmiDeviceInfo> infoList, boolean audioOnly) {
|
||||
BitSet set = new BitSet(NUM_OF_ADDRESS);
|
||||
for (HdmiCecDeviceInfo info : infoList) {
|
||||
for (HdmiDeviceInfo info : infoList) {
|
||||
if (audioOnly) {
|
||||
if (info.getDeviceType() == HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
if (info.getDeviceType() == HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
set.set(info.getLogicalAddress());
|
||||
}
|
||||
} else {
|
||||
@@ -207,7 +207,7 @@ final class HotplugDetectionAction extends FeatureAction {
|
||||
}
|
||||
|
||||
private void mayChangeRoutingPath(int address) {
|
||||
HdmiCecDeviceInfo info = tv().getDeviceInfo(address);
|
||||
HdmiDeviceInfo info = tv().getDeviceInfo(address);
|
||||
if (info != null) {
|
||||
tv().handleRemoveActiveRoutingPath(info.getPhysicalAddress());
|
||||
}
|
||||
@@ -236,7 +236,7 @@ final class HotplugDetectionAction extends FeatureAction {
|
||||
}
|
||||
|
||||
private void mayDisableSystemAudioAndARC(int address) {
|
||||
if (HdmiUtils.getTypeFromAddress(address) != HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
if (HdmiUtils.getTypeFromAddress(address) != HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.server.hdmi.HdmiCecLocalDevice.ActiveSource;
|
||||
@@ -28,7 +28,7 @@ import java.io.UnsupportedEncodingException;
|
||||
* connected HDMI-CEC device broadcasts to announce its advent. Additional commands are issued in
|
||||
* this action to gather more information on the device such as OSD name and device vendor ID.
|
||||
*
|
||||
* <p>The result is made in the form of {@link HdmiCecDeviceInfo} object, and passed to service
|
||||
* <p>The result is made in the form of {@link HdmiDeviceInfo} object, and passed to service
|
||||
* for the management through its life cycle.
|
||||
*
|
||||
* <p>Package-private, accessed by {@link HdmiControlService} only.
|
||||
@@ -152,14 +152,14 @@ final class NewDeviceAction extends FeatureAction {
|
||||
if (mDisplayName == null) {
|
||||
mDisplayName = HdmiUtils.getDefaultDeviceName(mDeviceLogicalAddress);
|
||||
}
|
||||
tv().addCecDevice(new HdmiCecDeviceInfo(
|
||||
tv().addCecDevice(new HdmiDeviceInfo(
|
||||
mDeviceLogicalAddress, mDevicePhysicalAddress,
|
||||
tv().getPortId(mDevicePhysicalAddress),
|
||||
HdmiUtils.getTypeFromAddress(mDeviceLogicalAddress),
|
||||
mVendorId, mDisplayName));
|
||||
|
||||
if (HdmiUtils.getTypeFromAddress(mDeviceLogicalAddress)
|
||||
== HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
== HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
if (tv().getSystemAudioModeSetting()) {
|
||||
addAndStartAction(new SystemAudioAutoInitiationAction(localDevice(),
|
||||
mDeviceLogicalAddress));
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
|
||||
import android.util.Slog;
|
||||
|
||||
@@ -42,8 +42,8 @@ abstract class RequestArcAction extends FeatureAction {
|
||||
*/
|
||||
RequestArcAction(HdmiCecLocalDevice source, int avrAddress) {
|
||||
super(source);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiCecDeviceInfo.DEVICE_TV);
|
||||
HdmiUtils.verifyAddressType(avrAddress, HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiDeviceInfo.DEVICE_TV);
|
||||
HdmiUtils.verifyAddressType(avrAddress, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
|
||||
mAvrAddress = avrAddress;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
import android.os.RemoteException;
|
||||
@@ -155,7 +155,7 @@ final class RoutingControlAction extends FeatureAction {
|
||||
}
|
||||
switch (timeoutState) {
|
||||
case STATE_WAIT_FOR_ROUTING_INFORMATION:
|
||||
HdmiCecDeviceInfo device = tv().getDeviceInfoByPath(mCurrentRoutingPath);
|
||||
HdmiDeviceInfo device = tv().getDeviceInfoByPath(mCurrentRoutingPath);
|
||||
if (device != null && mQueryDevicePowerStatus) {
|
||||
int deviceLogicalAddress = device.getLogicalAddress();
|
||||
queryDevicePowerStatus(deviceLogicalAddress, new SendMessageCallback() {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.util.Slog;
|
||||
|
||||
/**
|
||||
@@ -44,8 +44,8 @@ final class SetArcTransmissionStateAction extends FeatureAction {
|
||||
SetArcTransmissionStateAction(HdmiCecLocalDevice source, int avrAddress,
|
||||
boolean enabled) {
|
||||
super(source);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiCecDeviceInfo.DEVICE_TV);
|
||||
HdmiUtils.verifyAddressType(avrAddress, HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiDeviceInfo.DEVICE_TV);
|
||||
HdmiUtils.verifyAddressType(avrAddress, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
|
||||
mAvrAddress = avrAddress;
|
||||
mEnabled = enabled;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
import android.os.RemoteException;
|
||||
@@ -65,7 +65,7 @@ abstract class SystemAudioAction extends FeatureAction {
|
||||
SystemAudioAction(HdmiCecLocalDevice source, int avrAddress, boolean targetStatus,
|
||||
IHdmiControlCallback callback) {
|
||||
super(source);
|
||||
HdmiUtils.verifyAddressType(avrAddress, HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM);
|
||||
HdmiUtils.verifyAddressType(avrAddress, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
|
||||
mAvrLogicalAddress = avrAddress;
|
||||
mTargetAudioStatus = targetStatus;
|
||||
mCallback = callback;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiControlManager;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
|
||||
@@ -37,7 +37,7 @@ final class SystemAudioActionFromAvr extends SystemAudioAction {
|
||||
SystemAudioActionFromAvr(HdmiCecLocalDevice source, int avrAddress,
|
||||
boolean targetStatus, IHdmiControlCallback callback) {
|
||||
super(source, avrAddress, targetStatus, callback);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiCecDeviceInfo.DEVICE_TV);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiDeviceInfo.DEVICE_TV);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.hdmi;
|
||||
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.IHdmiControlCallback;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ final class SystemAudioActionFromTv extends SystemAudioAction {
|
||||
SystemAudioActionFromTv(HdmiCecLocalDevice sourceAddress, int avrAddress,
|
||||
boolean targetStatus, IHdmiControlCallback callback) {
|
||||
super(sourceAddress, avrAddress, targetStatus, callback);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiCecDeviceInfo.DEVICE_TV);
|
||||
HdmiUtils.verifyAddressType(getSourceAddress(), HdmiDeviceInfo.DEVICE_TV);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ import static android.media.tv.TvInputManager.INPUT_STATE_DISCONNECTED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiHotplugEvent;
|
||||
import android.hardware.hdmi.IHdmiControlService;
|
||||
import android.hardware.hdmi.IHdmiDeviceEventListener;
|
||||
@@ -82,7 +82,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
private final TvInputHal mHal = new TvInputHal(this);
|
||||
private final SparseArray<Connection> mConnections = new SparseArray<>();
|
||||
private final List<TvInputHardwareInfo> mHardwareList = new ArrayList<>();
|
||||
private List<HdmiCecDeviceInfo> mHdmiCecDeviceList = new LinkedList<>();
|
||||
private List<HdmiDeviceInfo> mHdmiCecDeviceList = new LinkedList<>();
|
||||
/* A map from a device ID to the matching TV input ID. */
|
||||
private final SparseArray<String> mHardwareInputIdMap = new SparseArray<>();
|
||||
/* A map from a HDMI logical address to the matching TV input ID. */
|
||||
@@ -164,9 +164,9 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
TvInputHardwareInfo info = connection.getHardwareInfoLocked();
|
||||
if (info.getType() == TvInputHardwareInfo.TV_INPUT_TYPE_HDMI) {
|
||||
// Remove HDMI CEC devices linked with this hardware.
|
||||
for (Iterator<HdmiCecDeviceInfo> it = mHdmiCecDeviceList.iterator();
|
||||
for (Iterator<HdmiDeviceInfo> it = mHdmiCecDeviceList.iterator();
|
||||
it.hasNext(); ) {
|
||||
HdmiCecDeviceInfo deviceInfo = it.next();
|
||||
HdmiDeviceInfo deviceInfo = it.next();
|
||||
if (deviceInfo.getPortId() == info.getHdmiPortId()) {
|
||||
mHandler.obtainMessage(ListenerHandler.HDMI_CEC_DEVICE_REMOVED, 0, 0,
|
||||
deviceInfo).sendToTarget();
|
||||
@@ -220,7 +220,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
}
|
||||
}
|
||||
|
||||
public List<HdmiCecDeviceInfo> getHdmiCecInputDeviceList() {
|
||||
public List<HdmiDeviceInfo> getHdmiCecInputDeviceList() {
|
||||
synchronized (mLock) {
|
||||
return Collections.unmodifiableList(mHdmiCecDeviceList);
|
||||
}
|
||||
@@ -450,7 +450,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
private void processPendingHdmiDeviceEventsLocked() {
|
||||
for (Iterator<Message> it = mPendingHdmiDeviceEvents.iterator(); it.hasNext(); ) {
|
||||
Message msg = it.next();
|
||||
HdmiCecDeviceInfo deviceInfo = (HdmiCecDeviceInfo) msg.obj;
|
||||
HdmiDeviceInfo deviceInfo = (HdmiDeviceInfo) msg.obj;
|
||||
TvInputHardwareInfo hardwareInfo =
|
||||
findHardwareInfoForHdmiPortLocked(deviceInfo.getPortId());
|
||||
if (hardwareInfo != null) {
|
||||
@@ -864,8 +864,8 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
public void onStateChanged(String inputId, int state);
|
||||
public void onHardwareDeviceAdded(TvInputHardwareInfo info);
|
||||
public void onHardwareDeviceRemoved(TvInputHardwareInfo info);
|
||||
public void onHdmiCecDeviceAdded(HdmiCecDeviceInfo cecDevice);
|
||||
public void onHdmiCecDeviceRemoved(HdmiCecDeviceInfo cecDevice);
|
||||
public void onHdmiCecDeviceAdded(HdmiDeviceInfo cecDevice);
|
||||
public void onHdmiCecDeviceRemoved(HdmiDeviceInfo cecDevice);
|
||||
}
|
||||
|
||||
private class ListenerHandler extends Handler {
|
||||
@@ -895,12 +895,12 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
break;
|
||||
}
|
||||
case HDMI_CEC_DEVICE_ADDED: {
|
||||
HdmiCecDeviceInfo info = (HdmiCecDeviceInfo) msg.obj;
|
||||
HdmiDeviceInfo info = (HdmiDeviceInfo) msg.obj;
|
||||
mListener.onHdmiCecDeviceAdded(info);
|
||||
break;
|
||||
}
|
||||
case HDMI_CEC_DEVICE_REMOVED: {
|
||||
HdmiCecDeviceInfo info = (HdmiCecDeviceInfo) msg.obj;
|
||||
HdmiDeviceInfo info = (HdmiDeviceInfo) msg.obj;
|
||||
mListener.onHdmiCecDeviceRemoved(info);
|
||||
break;
|
||||
}
|
||||
@@ -936,7 +936,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
|
||||
private final class HdmiDeviceEventListener extends IHdmiDeviceEventListener.Stub {
|
||||
@Override
|
||||
public void onStatusChanged(HdmiCecDeviceInfo deviceInfo, boolean activated) {
|
||||
public void onStatusChanged(HdmiDeviceInfo deviceInfo, boolean activated) {
|
||||
synchronized (mLock) {
|
||||
if (activated) {
|
||||
if (!mHdmiCecDeviceList.contains(deviceInfo)) {
|
||||
@@ -966,7 +966,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
|
||||
|
||||
private final class HdmiInputChangeListener extends IHdmiInputChangeListener.Stub {
|
||||
@Override
|
||||
public void onChanged(HdmiCecDeviceInfo device) throws RemoteException {
|
||||
public void onChanged(HdmiDeviceInfo device) throws RemoteException {
|
||||
String inputId;
|
||||
synchronized (mLock) {
|
||||
if (device.isCecDevice()) {
|
||||
|
||||
@@ -38,7 +38,7 @@ import android.content.pm.ServiceInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.hdmi.HdmiCecDeviceInfo;
|
||||
import android.hardware.hdmi.HdmiDeviceInfo;
|
||||
import android.media.tv.ITvInputClient;
|
||||
import android.media.tv.ITvInputHardware;
|
||||
import android.media.tv.ITvInputHardwareCallback;
|
||||
@@ -1894,9 +1894,9 @@ public final class TvInputManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
List<HdmiCecDeviceInfo> cecDeviceInfoList =
|
||||
List<HdmiDeviceInfo> cecDeviceInfoList =
|
||||
mTvInputHardwareManager.getHdmiCecInputDeviceList();
|
||||
for (HdmiCecDeviceInfo cecDeviceInfo : cecDeviceInfoList) {
|
||||
for (HdmiDeviceInfo cecDeviceInfo : cecDeviceInfoList) {
|
||||
try {
|
||||
serviceState.mService.notifyHdmiCecDeviceAdded(cecDeviceInfo);
|
||||
} catch (RemoteException e) {
|
||||
@@ -2204,7 +2204,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHdmiCecDeviceAdded(HdmiCecDeviceInfo cecDeviceInfo) {
|
||||
public void onHdmiCecDeviceAdded(HdmiDeviceInfo cecDeviceInfo) {
|
||||
synchronized (mLock) {
|
||||
UserState userState = getUserStateLocked(mCurrentUserId);
|
||||
// Broadcast the event to all hardware inputs.
|
||||
@@ -2220,7 +2220,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHdmiCecDeviceRemoved(HdmiCecDeviceInfo cecDeviceInfo) {
|
||||
public void onHdmiCecDeviceRemoved(HdmiDeviceInfo cecDeviceInfo) {
|
||||
synchronized (mLock) {
|
||||
UserState userState = getUserStateLocked(mCurrentUserId);
|
||||
// Broadcast the event to all hardware inputs.
|
||||
|
||||
Reference in New Issue
Block a user