[fenix] For https://github.com/mozilla-mobile/fenix/issues/11051 - added intent check for voice search

Also made the activity translucent so that it won't flicker when the user pressses the button and Google app is disabled
pull/600/head
Mihai Branescu 4 years ago committed by Mugurell
parent 90d7d5be15
commit 61b3f14592

@ -215,7 +215,8 @@
android:name=".crashes.CrashListActivity"
android:exported="false" />
<activity android:name=".widget.VoiceSearchActivity" />
<activity android:name=".widget.VoiceSearchActivity"
android:theme="@style/Theme.AppCompat.Translucent"/>
<activity
android:name=".settings.account.AuthCustomTabActivity"

@ -34,6 +34,11 @@ class VoiceSearchActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).resolveActivity(packageManager) == null) {
finish()
return
}
// Retrieve the previous intent from the saved state
previousIntent = savedInstanceState?.get(PREVIOUS_INTENT) as Intent?
if (previousIntent.isForSpeechProcessing()) {

Loading…
Cancel
Save