For #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/35/head
Mihai Branescu 4 years ago committed by Mugurell
parent ea688cce09
commit 3e1bc524b9

@ -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