diff options
author | Александр Зацепин <az@mapswithme.com> | 2019-12-23 17:25:09 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2019-12-23 18:22:37 +0300 |
commit | 38e532067881a3c00a618dfc203cdac0989c9031 (patch) | |
tree | 4f8d5a76d67bcb3a3490c6d76dd118794f4ee2cd /android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java | |
parent | 766818f2a464629501ce7b7a6800b56efa382743 (diff) |
[android] Fixed crash during access to C++ framework place page object while it's not intitialized. It may happen when the app was killed/dumped by OS when PP is opened (launched by incoming intent or deeplin) and then core doesn't have place page info and synchronization between platform and C++ framework is broken. So, we don't restore place page info from java map object and it's by design for a while.android-951
Diffstat (limited to 'android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java')
-rw-r--r-- | android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java index 871b583185..0b720e5a61 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java @@ -1,14 +1,13 @@ package com.mapswithme.maps.bookmarks.data; import androidx.annotation.IntDef; +import androidx.annotation.IntRange; import androidx.annotation.MainThread; import androidx.annotation.NonNull; -import androidx.annotation.IntRange; import androidx.annotation.Nullable; - +import com.mapswithme.maps.PrivateVariables; import com.mapswithme.maps.base.DataChangedListener; import com.mapswithme.maps.base.Observable; -import com.mapswithme.maps.PrivateVariables; import com.mapswithme.maps.metrics.UserActionsLogger; import com.mapswithme.util.KeyValue; import com.mapswithme.util.UTM; @@ -125,11 +124,15 @@ public enum BookmarkManager setVisibility(catId, !isVisible); } + @Nullable public Bookmark addNewBookmark(double lat, double lon) { final Bookmark bookmark = nativeAddBookmarkToLastEditedCategory(lat, lon); - UserActionsLogger.logAddToBookmarkEvent(); - Statistics.INSTANCE.trackBookmarkCreated(); + if (bookmark != null) + { + UserActionsLogger.logAddToBookmarkEvent(); + Statistics.INSTANCE.trackBookmarkCreated(); + } return bookmark; } @@ -466,7 +469,7 @@ public enum BookmarkManager nativeUploadToCatalog(rules.ordinal(), category.getId()); } - @NonNull + @Nullable public Bookmark updateBookmarkPlacePage(long bmkId) { return nativeUpdateBookmarkPlacePage(bmkId); @@ -930,7 +933,7 @@ public enum BookmarkManager private native int nativeGetTracksCount(long catId); - @NonNull + @Nullable private native Bookmark nativeUpdateBookmarkPlacePage(long bmkId); @Nullable @@ -974,7 +977,7 @@ public enum BookmarkManager private native void nativeShowBookmarkCategoryOnMap(long catId); - @NonNull + @Nullable private native Bookmark nativeAddBookmarkToLastEditedCategory(double lat, double lon); private native long nativeGetLastEditedCategory(); |