TIF: Update the internal input list with new TvInputInfo
Bug: 26864151, Bug: 26863281
Change-Id: I33e357aac74bceda50c794eb6057c363de9250b8
(cherry picked from commit 89a9937927)
This commit is contained in:
@@ -52,6 +52,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -502,7 +503,22 @@ public final class TvInputInfo implements Parcelable {
|
||||
}
|
||||
|
||||
TvInputInfo obj = (TvInputInfo) o;
|
||||
return mId.equals(obj.mId);
|
||||
return TextUtils.equals(mId, obj.mId)
|
||||
&& TextUtils.equals(mParentId, obj.mParentId)
|
||||
&& Objects.equals(mService, obj.mService)
|
||||
&& TextUtils.equals(mSetupActivity, obj.mSetupActivity)
|
||||
&& TextUtils.equals(mSettingsActivity, obj.mSettingsActivity)
|
||||
&& mType == obj.mType
|
||||
&& mTunerCount == obj.mTunerCount
|
||||
&& mCanRecord == obj.mCanRecord
|
||||
&& mIsHardwareInput == obj.mIsHardwareInput
|
||||
&& Objects.equals(mHdmiDeviceInfo, obj.mHdmiDeviceInfo)
|
||||
&& Objects.equals(mIcon, obj.mIcon)
|
||||
&& Objects.equals(mIconUri, obj.mIconUri)
|
||||
&& mLabelResId == obj.mLabelResId
|
||||
&& TextUtils.equals(mLabel, obj.mLabel)
|
||||
&& mIsConnectedToHdmiSwitch == obj.mIsConnectedToHdmiSwitch
|
||||
&& Objects.equals(mExtras, obj.mExtras);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -330,12 +330,12 @@ public final class TvInputManagerService extends SystemService {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "add " + info.getId());
|
||||
}
|
||||
TvInputState state = userState.inputMap.get(info.getId());
|
||||
if (state == null) {
|
||||
state = new TvInputState();
|
||||
TvInputState inputState = userState.inputMap.get(info.getId());
|
||||
if (inputState == null) {
|
||||
inputState = new TvInputState();
|
||||
inputState.info = info;
|
||||
}
|
||||
state.info = info;
|
||||
inputMap.put(info.getId(), state);
|
||||
inputMap.put(info.getId(), inputState);
|
||||
}
|
||||
|
||||
for (String inputId : inputMap.keySet()) {
|
||||
@@ -781,7 +781,17 @@ public final class TvInputManagerService extends SystemService {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "setTvInputInfoLocked(inputInfo=" + inputInfo + ")");
|
||||
}
|
||||
// TODO: Also update the internal input list.
|
||||
String inputId = inputInfo.getId();
|
||||
TvInputState inputState = userState.inputMap.get(inputId);
|
||||
if (inputState == null) {
|
||||
Slog.e(TAG, "failed to set input info - unknown input id " + inputId);
|
||||
return;
|
||||
}
|
||||
if (inputState.info.equals(inputInfo)) {
|
||||
return;
|
||||
}
|
||||
inputState.info = inputInfo;
|
||||
|
||||
for (ITvInputManagerCallback callback : userState.callbackSet) {
|
||||
try {
|
||||
callback.onTvInputInfoChanged(inputInfo);
|
||||
@@ -852,7 +862,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
}
|
||||
|
||||
final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(),
|
||||
Binder.getCallingUid(), userId, "setTvInputInfoChanged");
|
||||
Binder.getCallingUid(), userId, "setTvInputInfo");
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
synchronized (mLock) {
|
||||
|
||||
Reference in New Issue
Block a user