Fixed
Status Update
Comments
da...@google.com <da...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 4ff949b813f4954533390ed87672771c45d60bc4
Author: sambitp <sambitp@google.com>
Date: Fri Dec 11 11:02:03 2020
Create SpeechRecognizer in SearchFragment only when it is available
In case Speechrecognizer is not available make the SpeechOrb non
focusable.
Test: Added focus handling related unit tests and tested the sample
manully on an aosp cuttlefish instance.
Bug: 169936953
Change-Id: I96637b234072fe2ba5a8734a899a4aaf45f68a99
M leanback/leanback/src/androidTest/AndroidManifest.xml
M leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchFragmentTest.java
M leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchSupportFragmentTest.java
M leanback/leanback/src/main/java/androidx/leanback/app/SearchFragment.java
M leanback/leanback/src/main/java/androidx/leanback/app/SearchSupportFragment.java
https://android-review.googlesource.com/1525658
Branch: androidx-master-dev
commit 4ff949b813f4954533390ed87672771c45d60bc4
Author: sambitp <sambitp@google.com>
Date: Fri Dec 11 11:02:03 2020
Create SpeechRecognizer in SearchFragment only when it is available
In case Speechrecognizer is not available make the SpeechOrb non
focusable.
Test: Added focus handling related unit tests and tested the sample
manully on an aosp cuttlefish instance.
Bug: 169936953
Change-Id: I96637b234072fe2ba5a8734a899a4aaf45f68a99
M leanback/leanback/src/androidTest/AndroidManifest.xml
M leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchFragmentTest.java
M leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchSupportFragmentTest.java
M leanback/leanback/src/main/java/androidx/leanback/app/SearchFragment.java
M leanback/leanback/src/main/java/androidx/leanback/app/SearchSupportFragment.java
Description
Version used: androidx.leanback:leanback:1.1.0-alpha05
Devices/Android versions reproduced on: API 21+
The Crash happens in onPause in SearchSupportFragment
@Override
public void onPause() {
releaseRecognizer();
mIsPaused = true;
super.onPause();
}
particularly in releaseRecognizer();
Why's this happening?
When onResume is called the speechRecognizer is initialized but there's never a check whether the SpeechRecognizer is available, meaning
Inside the onResume function
@Override
public void onResume() {
super.onResume();
mIsPaused = false;
if (mSpeechRecognitionCallback == null && null == mSpeechRecognizer) {
mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(
getContext());
mSearchBar.setSpeechRecognizer(mSpeechRecognizer);
}
if (mPendingStartRecognitionWhenPaused) {
mPendingStartRecognitionWhenPaused = false;
mSearchBar.startRecognition();
} else {
// Ensure search bar state consistency when using external recognizer
mSearchBar.stopRecognition();
}
}
There should be a check whether
if(SpeechRecognizer.isRecognitionAvailable(requireContext())
{
initializeSpeechRecognizer(); // copy the function body in onResume
}
Where does this break?
Especially on Amazon TV devices since they lack this speech recognizer.