diff options
author | Yorke Lee <yorkelee@google.com> | 2014-04-07 15:39:48 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-04-07 15:39:48 -0700 |
commit | 3921359f3f01938768f0b0e731941542f0385787 (patch) | |
tree | c8265ba2f31618b1ec5bb764ef374545c2b43347 /src/com/android/dialer/CallDetailActivity.java | |
parent | ea8fa952d9024a136a401b5c1cf6a546c870d81f (diff) |
Catch activity not found exceptions
Instead of crashing when an ActivityNotFoundException is thrown,
display an error toast.
Bug: 13882939
Change-Id: I5cda14ba8a404ff0f5196fdbc382201c47f4b4c8
Diffstat (limited to 'src/com/android/dialer/CallDetailActivity.java')
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index e09e6f302..470c0b668 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -72,6 +72,7 @@ import com.android.dialer.calllog.PhoneNumberDisplayHelper; import com.android.dialer.calllog.PhoneNumberUtilsWrapper; import com.android.dialer.util.AsyncTaskExecutor; import com.android.dialer.util.AsyncTaskExecutors; +import com.android.dialer.util.DialerUtils; import com.android.dialer.voicemail.VoicemailPlaybackFragment; import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage; @@ -237,7 +238,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware if (finishPhoneNumerSelectedActionModeIfShown()) { return; } - startActivity(((ViewEntry) view.getTag()).primaryIntent); + DialerUtils.startActivityWithErrorToast(CallDetailActivity.this, + ((ViewEntry) view.getTag()).primaryIntent); } }; @@ -247,7 +249,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware if (finishPhoneNumerSelectedActionModeIfShown()) { return; } - startActivity(((ViewEntry) view.getTag()).secondaryIntent); + DialerUtils.startActivityWithErrorToast(CallDetailActivity.this, + ((ViewEntry) view.getTag()).secondaryIntent); } }; @@ -416,8 +419,10 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) { - startActivity(CallUtil.getCallIntent( - Uri.fromParts(CallUtil.SCHEME_TEL, mNumber, null))); + DialerUtils.startActivityWithErrorToast(this, + CallUtil.getCallIntent(Uri.fromParts(CallUtil.SCHEME_TEL, mNumber, + null)), + R.string.call_not_available); return true; } } @@ -659,13 +664,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware mMainActionPushLayerView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - try { - startActivity(actionIntent); - } catch (ActivityNotFoundException e) { - final Toast toast = Toast.makeText(CallDetailActivity.this, - R.string.add_contact_not_available, Toast.LENGTH_SHORT); - toast.show(); - } + DialerUtils.startActivityWithErrorToast(CallDetailActivity.this, actionIntent, + R.string.add_contact_not_available); } }); mMainActionPushLayerView.setContentDescription(actionDescription); @@ -840,7 +840,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware mStatusMessageAction.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - startActivity(new Intent(Intent.ACTION_VIEW, message.actionUri)); + DialerUtils.startActivityWithErrorToast(CallDetailActivity.this, + new Intent(Intent.ACTION_VIEW, message.actionUri)); } }); } else { |