TIF: fix wrong config comparison & confusing method name
TvStreamConfig should do deep comparison in TvInputHardwareManager
where the object gets created from binder calls. In addition to this
fix, modify [aA]ddStream to [aA]ddOrUpdateStream so that the method
name better reflects what it does.
Bug: 18027719
Change-Id: I43fa668f91cb9433beee97ee31b4b1f58f21bfcf
diff --git a/services/core/java/com/android/server/tv/TvInputHardwareManager.java b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
index 44e4ad1..7d031ea 100644
--- a/services/core/java/com/android/server/tv/TvInputHardwareManager.java
+++ b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
@@ -668,14 +668,14 @@
result = mHal.removeStream(mInfo.getDeviceId(), mActiveConfig);
mActiveConfig = null;
} else {
- if (config != mActiveConfig && mActiveConfig != null) {
+ if (!config.equals(mActiveConfig)) {
result = mHal.removeStream(mInfo.getDeviceId(), mActiveConfig);
if (result != TvInputHal.SUCCESS) {
mActiveConfig = null;
return false;
}
}
- result = mHal.addStream(mInfo.getDeviceId(), surface, config);
+ result = mHal.addOrUpdateStream(mInfo.getDeviceId(), surface, config);
if (result == TvInputHal.SUCCESS) {
mActiveConfig = config;
}
@@ -801,7 +801,7 @@
return false;
}
- int result = mHal.addStream(mInfo.getDeviceId(), surface, config);
+ int result = mHal.addOrUpdateStream(mInfo.getDeviceId(), surface, config);
return result == TvInputHal.SUCCESS;
}
}