TIF: Add Hardware prefix to method/member names for better readability
Also removed the infix 'Tv' to make those names consistent with other
names (e.g. mHdmiInputIdMap, inputList, etc.)
Change-Id: I40eff18f8ca795c080edaf293f4906848caed0ca
diff --git a/media/java/android/media/tv/ITvInputServiceCallback.aidl b/media/java/android/media/tv/ITvInputServiceCallback.aidl
index 74ab562..4fdc102 100644
--- a/media/java/android/media/tv/ITvInputServiceCallback.aidl
+++ b/media/java/android/media/tv/ITvInputServiceCallback.aidl
@@ -24,7 +24,7 @@
* @hide
*/
oneway interface ITvInputServiceCallback {
- void addHardwareTvInput(in int deviceId, in TvInputInfo inputInfo);
- void addHdmiTvInput(in int id, in TvInputInfo inputInfo);
- void removeTvInput(in String inputId);
+ void addHardwareInput(in int deviceId, in TvInputInfo inputInfo);
+ void addHdmiInput(in int id, in TvInputInfo inputInfo);
+ void removeHardwareInput(in String inputId);
}
diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java
index a2b6346..2a7013a 100644
--- a/media/java/android/media/tv/TvInputService.java
+++ b/media/java/android/media/tv/TvInputService.java
@@ -150,25 +150,25 @@
@Override
public void notifyHardwareAdded(TvInputHardwareInfo hardwareInfo) {
- mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HARDWARE_TV_INPUT,
+ mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HARDWARE_INPUT,
hardwareInfo).sendToTarget();
}
@Override
public void notifyHardwareRemoved(TvInputHardwareInfo hardwareInfo) {
- mServiceHandler.obtainMessage(ServiceHandler.DO_REMOVE_HARDWARE_TV_INPUT,
+ mServiceHandler.obtainMessage(ServiceHandler.DO_REMOVE_HARDWARE_INPUT,
hardwareInfo).sendToTarget();
}
@Override
public void notifyHdmiDeviceAdded(HdmiDeviceInfo deviceInfo) {
- mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HDMI_TV_INPUT,
+ mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HDMI_INPUT,
deviceInfo).sendToTarget();
}
@Override
public void notifyHdmiDeviceRemoved(HdmiDeviceInfo deviceInfo) {
- mServiceHandler.obtainMessage(ServiceHandler.DO_REMOVE_HDMI_TV_INPUT,
+ mServiceHandler.obtainMessage(ServiceHandler.DO_REMOVE_HDMI_INPUT,
deviceInfo).sendToTarget();
}
};
@@ -1934,42 +1934,42 @@
private static final int DO_CREATE_SESSION = 1;
private static final int DO_NOTIFY_SESSION_CREATED = 2;
private static final int DO_CREATE_RECORDING_SESSION = 3;
- private static final int DO_ADD_HARDWARE_TV_INPUT = 4;
- private static final int DO_REMOVE_HARDWARE_TV_INPUT = 5;
- private static final int DO_ADD_HDMI_TV_INPUT = 6;
- private static final int DO_REMOVE_HDMI_TV_INPUT = 7;
+ private static final int DO_ADD_HARDWARE_INPUT = 4;
+ private static final int DO_REMOVE_HARDWARE_INPUT = 5;
+ private static final int DO_ADD_HDMI_INPUT = 6;
+ private static final int DO_REMOVE_HDMI_INPUT = 7;
- private void broadcastAddHardwareTvInput(int deviceId, TvInputInfo inputInfo) {
+ private void broadcastAddHardwareInput(int deviceId, TvInputInfo inputInfo) {
int n = mCallbacks.beginBroadcast();
for (int i = 0; i < n; ++i) {
try {
- mCallbacks.getBroadcastItem(i).addHardwareTvInput(deviceId, inputInfo);
+ mCallbacks.getBroadcastItem(i).addHardwareInput(deviceId, inputInfo);
} catch (RemoteException e) {
- Log.e(TAG, "error in broadcastAddHardwareTvInput", e);
+ Log.e(TAG, "error in broadcastAddHardwareInput", e);
}
}
mCallbacks.finishBroadcast();
}
- private void broadcastAddHdmiTvInput(int id, TvInputInfo inputInfo) {
+ private void broadcastAddHdmiInput(int id, TvInputInfo inputInfo) {
int n = mCallbacks.beginBroadcast();
for (int i = 0; i < n; ++i) {
try {
- mCallbacks.getBroadcastItem(i).addHdmiTvInput(id, inputInfo);
+ mCallbacks.getBroadcastItem(i).addHdmiInput(id, inputInfo);
} catch (RemoteException e) {
- Log.e(TAG, "error in broadcastAddHdmiTvInput", e);
+ Log.e(TAG, "error in broadcastAddHdmiInput", e);
}
}
mCallbacks.finishBroadcast();
}
- private void broadcastRemoveTvInput(String inputId) {
+ private void broadcastRemoveHardwareInput(String inputId) {
int n = mCallbacks.beginBroadcast();
for (int i = 0; i < n; ++i) {
try {
- mCallbacks.getBroadcastItem(i).removeTvInput(inputId);
+ mCallbacks.getBroadcastItem(i).removeHardwareInput(inputId);
} catch (RemoteException e) {
- Log.e(TAG, "error in broadcastRemoveTvInput", e);
+ Log.e(TAG, "error in broadcastRemoveHardwareInput", e);
}
}
mCallbacks.finishBroadcast();
@@ -2075,35 +2075,35 @@
recordingSessionImpl.initialize(cb);
return;
}
- case DO_ADD_HARDWARE_TV_INPUT: {
+ case DO_ADD_HARDWARE_INPUT: {
TvInputHardwareInfo hardwareInfo = (TvInputHardwareInfo) msg.obj;
TvInputInfo inputInfo = onHardwareAdded(hardwareInfo);
if (inputInfo != null) {
- broadcastAddHardwareTvInput(hardwareInfo.getDeviceId(), inputInfo);
+ broadcastAddHardwareInput(hardwareInfo.getDeviceId(), inputInfo);
}
return;
}
- case DO_REMOVE_HARDWARE_TV_INPUT: {
+ case DO_REMOVE_HARDWARE_INPUT: {
TvInputHardwareInfo hardwareInfo = (TvInputHardwareInfo) msg.obj;
String inputId = onHardwareRemoved(hardwareInfo);
if (inputId != null) {
- broadcastRemoveTvInput(inputId);
+ broadcastRemoveHardwareInput(inputId);
}
return;
}
- case DO_ADD_HDMI_TV_INPUT: {
+ case DO_ADD_HDMI_INPUT: {
HdmiDeviceInfo deviceInfo = (HdmiDeviceInfo) msg.obj;
TvInputInfo inputInfo = onHdmiDeviceAdded(deviceInfo);
if (inputInfo != null) {
- broadcastAddHdmiTvInput(deviceInfo.getId(), inputInfo);
+ broadcastAddHdmiInput(deviceInfo.getId(), inputInfo);
}
return;
}
- case DO_REMOVE_HDMI_TV_INPUT: {
+ case DO_REMOVE_HDMI_INPUT: {
HdmiDeviceInfo deviceInfo = (HdmiDeviceInfo) msg.obj;
String inputId = onHdmiDeviceRemoved(deviceInfo);
if (inputId != null) {
- broadcastRemoveTvInput(inputId);
+ broadcastRemoveHardwareInput(inputId);
}
return;
}
diff --git a/services/core/java/com/android/server/tv/TvInputHardwareManager.java b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
index 578428b..4e96d71 100644
--- a/services/core/java/com/android/server/tv/TvInputHardwareManager.java
+++ b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
@@ -266,7 +266,7 @@
return (configs.length > 0) ? INPUT_STATE_CONNECTED_STANDBY : INPUT_STATE_DISCONNECTED;
}
- public void addHardwareTvInput(int deviceId, TvInputInfo info) {
+ public void addHardwareInput(int deviceId, TvInputInfo info) {
synchronized (mLock) {
String oldInputId = mHardwareInputIdMap.get(deviceId);
if (oldInputId != null) {
@@ -325,7 +325,7 @@
return false;
}
- public void addHdmiTvInput(int id, TvInputInfo info) {
+ public void addHdmiInput(int id, TvInputInfo info) {
if (info.getType() != TvInputInfo.TYPE_HDMI) {
throw new IllegalArgumentException("info (" + info + ") has non-HDMI type.");
}
@@ -346,7 +346,7 @@
}
}
- public void removeTvInput(String inputId) {
+ public void removeHardwareInput(String inputId) {
synchronized (mLock) {
mInputMap.remove(inputId);
int hardwareIndex = indexOfEqualValue(mHardwareInputIdMap, inputId);
diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java
index 318f966..b065e85 100644
--- a/services/core/java/com/android/server/tv/TvInputManagerService.java
+++ b/services/core/java/com/android/server/tv/TvInputManagerService.java
@@ -311,7 +311,7 @@
userState.serviceStateMap.put(component, serviceState);
updateServiceConnectionLocked(component, userId);
} else {
- inputList.addAll(serviceState.inputList);
+ inputList.addAll(serviceState.hardwareInputList);
}
} else {
try {
@@ -2018,7 +2018,7 @@
private final ServiceConnection connection;
private final ComponentName component;
private final boolean isHardware;
- private final List<TvInputInfo> inputList = new ArrayList<>();
+ private final List<TvInputInfo> hardwareInputList = new ArrayList<>();
private ITvInputService service;
private ServiceCallback callback;
@@ -2215,39 +2215,36 @@
}
}
- private void addTvInputLocked(TvInputInfo inputInfo) {
+ private void addHardwareInputLocked(TvInputInfo inputInfo) {
ServiceState serviceState = getServiceStateLocked(mComponent, mUserId);
- serviceState.inputList.add(inputInfo);
+ serviceState.hardwareInputList.add(inputInfo);
buildTvInputListLocked(mUserId, null);
}
- @Override
- public void addHardwareTvInput(int deviceId, TvInputInfo inputInfo) {
+ public void addHardwareInput(int deviceId, TvInputInfo inputInfo) {
ensureHardwarePermission();
ensureValidInput(inputInfo);
synchronized (mLock) {
- mTvInputHardwareManager.addHardwareTvInput(deviceId, inputInfo);
- addTvInputLocked(inputInfo);
+ mTvInputHardwareManager.addHardwareInput(deviceId, inputInfo);
+ addHardwareInputLocked(inputInfo);
}
}
- @Override
- public void addHdmiTvInput(int id, TvInputInfo inputInfo) {
+ public void addHdmiInput(int id, TvInputInfo inputInfo) {
ensureHardwarePermission();
ensureValidInput(inputInfo);
synchronized (mLock) {
- mTvInputHardwareManager.addHdmiTvInput(id, inputInfo);
- addTvInputLocked(inputInfo);
+ mTvInputHardwareManager.addHdmiInput(id, inputInfo);
+ addHardwareInputLocked(inputInfo);
}
}
- @Override
- public void removeTvInput(String inputId) {
+ public void removeHardwareInput(String inputId) {
ensureHardwarePermission();
synchronized (mLock) {
ServiceState serviceState = getServiceStateLocked(mComponent, mUserId);
boolean removed = false;
- for (Iterator<TvInputInfo> it = serviceState.inputList.iterator();
+ for (Iterator<TvInputInfo> it = serviceState.hardwareInputList.iterator();
it.hasNext(); ) {
if (it.next().getId().equals(inputId)) {
it.remove();
@@ -2257,7 +2254,7 @@
}
if (removed) {
buildTvInputListLocked(mUserId, null);
- mTvInputHardwareManager.removeTvInput(inputId);
+ mTvInputHardwareManager.removeHardwareInput(inputId);
} else {
Slog.e(TAG, "failed to remove input " + inputId);
}