From d445aaf1e2e4c9e98f03d0726cd513a34952a693 Mon Sep 17 00:00:00 2001 From: kwaky Date: Wed, 5 Feb 2020 12:51:46 -0800 Subject: Add null check for voiceInteractorComponentName. Voice Assistant can be disabled on a user-level. Adding this null check prevents crash for when Assistant is enabled for the system in general but disabled for a specific user. Bug: 149112015 Test: Manual -- Change config_disableLockscreenByDefault to true to emulate the environment in which Volvo observed the bug. Verify that switching to user0 through adb shell switch-user 0 causes the same crash. Verify that the crash does not happen with the new null check. Change-Id: I5b8ede1e5bd8c1bc047bc6d6220b425dea8f50ea Merged-in: I5b8ede1e5bd8c1bc047bc6d6220b425dea8f50ea --- .../android/systemui/statusbar/phone/KeyguardBottomAreaView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 80d36a1a4e54..c3244a4431d9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -641,9 +641,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL if (previewBefore != null) { mPreviewContainer.removeView(previewBefore); } - if (mLeftIsVoiceAssist) { - mLeftPreview = mPreviewInflater.inflatePreviewFromService( - mAssistManager.getVoiceInteractorComponentName()); + ComponentName voiceInteractorComponentName = + mAssistManager.getVoiceInteractorComponentName(); + if (mLeftIsVoiceAssist && voiceInteractorComponentName != null) { + mLeftPreview = mPreviewInflater.inflatePreviewFromService(voiceInteractorComponentName); } else { mLeftPreview = mPreviewInflater.inflatePreview(mLeftButton.getIntent()); } -- cgit v1.2.3-59-g8ed1b