summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2014-11-27 10:36:48 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-11-30 20:27:33 -0800
commit1011037364354a9371a39e407b98fae211e104d9 (patch)
tree69e3b222d84be040dfb34404fafc834a85854a7a
parentbbf8105892d0e8fea832a0c71d2acd471b1ade0f (diff)
downloadandroid_packages_apps_Snap-1011037364354a9371a39e407b98fae211e104d9.tar.gz
android_packages_apps_Snap-1011037364354a9371a39e407b98fae211e104d9.tar.bz2
android_packages_apps_Snap-1011037364354a9371a39e407b98fae211e104d9.zip
SnapdragonCamera: fix app crash when there is no map app
ActivityNotFoundException happened after click showOnMap menu when there is no map app. Catch the Exception to avoid app crash. CRs-Fixed: 753928 Change-Id: I1cf6e5f098f239719750840508b715a08e9a5e45
-rw-r--r--res/values-zh-rCN/strings.xml3
-rw-r--r--res/values/qcomstrings.xml3
-rw-r--r--src/com/android/camera/util/CameraUtil.java10
3 files changed, 14 insertions, 2 deletions
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 42a59a262..fc1e3c320 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -514,6 +514,9 @@
<string name="pref_camera_auto_hdr_entry_enable">开</string>
<string name="pref_camera_auto_hdr_entry_disable">关</string>
+ <!-- The message is shown in toast when click showOnMap Menu and there is no map app -->
+ <string name="map_activity_not_found_err">没有地图应用显示地理位置信息</string>
+
<!-- toast about switch storage -->
<string name="on_switch_save_path_to_sdcard">内部存储空间不足,已切换存储到SD卡</string>
</resources>
diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml
index c76f5c658..ba99a0c57 100644
--- a/res/values/qcomstrings.xml
+++ b/res/values/qcomstrings.xml
@@ -850,6 +850,9 @@
<string name="pref_camera_video_rotation_entry_180">180</string>
<string name="pref_camera_video_rotation_entry_270">270</string>
+ <!-- The message is shown in toast when click showOnMap Menu and there is no map app -->
+ <string name="map_activity_not_found_err">There is no map app for show location.</string>
+
<!-- Continous shot enable message -->
<string name="longshot_enable_message">
Advance features are not supported in continuous shot mode</string>
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index 4cfc211bc..fd9bc13b1 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -1035,8 +1035,14 @@ public class CameraUtil {
// Use the "geo intent" if no GMM is installed
Log.e(TAG, "GMM activity not found!", e);
String url = String.format(Locale.ENGLISH, "geo:%f,%f", latLong[0], latLong[1]);
- Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
- activity.startActivity(mapsIntent);
+ try {
+ Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ activity.startActivity(mapsIntent);
+ } catch (ActivityNotFoundException ex) {
+ Log.e(TAG, "Map view activity not found!", ex);
+ Toast.makeText(activity, activity.getString(R.string.map_activity_not_found_err),
+ Toast.LENGTH_SHORT).show();
+ }
}
}