Merge "[TIAF] Add null checks to avoid NPEs" into udc-dev am: 3ede2ac6c1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23269989

Change-Id: I6ff6a6c64e795e45715224de22dfaaa5e7fce764
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shubang Lu
2023-05-18 05:53:30 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 0 deletions

View File

@@ -269,6 +269,10 @@ class TvInputHardwareManager implements TvInputHal.Callback {
@Override
public void onTvMessage(int deviceId, int type, Bundle data) {
synchronized (mLock) {
String inputId = mHardwareInputIdMap.get(deviceId);
if (inputId == null) {
return;
}
SomeArgs args = SomeArgs.obtain();
args.arg1 = mHardwareInputIdMap.get(deviceId);
args.arg2 = data;

View File

@@ -4152,6 +4152,10 @@ public final class TvInputManagerService extends SystemService {
synchronized (mLock) {
UserState userState = getOrCreateUserStateLocked(mCurrentUserId);
TvInputState inputState = userState.inputMap.get(inputId);
if (inputState == null) {
Slog.e(TAG, "failed to send TV message - unknown input id " + inputId);
return;
}
ServiceState serviceState = userState.serviceStateMap.get(inputState.info
.getComponent());
for (IBinder token : serviceState.sessionTokens) {