diff options
author | Umashankar Godachi <umasha@codeaurora.org> | 2013-12-26 12:30:32 +0530 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-03-03 02:39:45 -0800 |
commit | fb6b2868899c3df745ef85d58ae46b44d694b31a (patch) | |
tree | 96a20129c820c23168580dd7f77000f4cb68284c | |
parent | 9f95938d15b77174ad1bdc376e2ee2507516303b (diff) | |
download | android_packages_apps_Dialer-fb6b2868899c3df745ef85d58ae46b44d694b31a.tar.gz android_packages_apps_Dialer-fb6b2868899c3df745ef85d58ae46b44d694b31a.tar.bz2 android_packages_apps_Dialer-fb6b2868899c3df745ef85d58ae46b44d694b31a.zip |
Fix dialer force close.
If there is no activity to handle the intent
ACTION_RECOGNIZE_SPEECH, it leads to dialer force close
on tapping voice search button.
Add try catch statement to avoid the dialer force close.
Change-Id: Ie59f06608af913cee3f50a03ebceca9616e6bc8f
CRs-Fixed: 592572
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index b4f730e64..414abf8ec 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -458,8 +458,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } break; case R.id.voice_search_button: - final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); - startActivityForResult(voiceIntent, ACTIVITY_REQUEST_CODE_VOICE_SEARCH); + try { + final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + startActivityForResult(voiceIntent, ACTIVITY_REQUEST_CODE_VOICE_SEARCH); + } catch (ActivityNotFoundException e) { + Log.w(TAG, e.toString()); + } break; default: { Log.wtf(TAG, "Unexpected onClick event from " + view); |