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
This commit is contained in:
kwaky
2020-02-05 12:51:46 -08:00
parent 6666041589
commit fffd182650

View File

@@ -643,9 +643,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
if (previewBefore != null) { if (previewBefore != null) {
mPreviewContainer.removeView(previewBefore); mPreviewContainer.removeView(previewBefore);
} }
if (mLeftIsVoiceAssist) { if (mLeftIsVoiceAssist) {
mLeftPreview = mPreviewInflater.inflatePreviewFromService( if (Dependency.get(AssistManager.class).getVoiceInteractorComponentName() != null) {
Dependency.get(AssistManager.class).getVoiceInteractorComponentName()); mLeftPreview = mPreviewInflater.inflatePreviewFromService(
Dependency.get(AssistManager.class).getVoiceInteractorComponentName());
}
} else { } else {
mLeftPreview = mPreviewInflater.inflatePreview(mLeftButton.getIntent()); mLeftPreview = mPreviewInflater.inflatePreview(mLeftButton.getIntent());
} }