Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89a99379 authored by Jae Seo's avatar Jae Seo
Browse files

TIF: Update the internal input list with new TvInputInfo

Bug: 26864151, Bug: 26863281
Change-Id: I33e357aac74bceda50c794eb6057c363de9250b8
parent 44278472
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -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
+17 −7
Original line number Diff line number Diff line
@@ -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) {