From 8f2b6b521fd295969951ec48e273168382fb8424 Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Mon, 13 Jun 2022 01:28:14 +0200 Subject: [PATCH 1/3] [android] Silenced warning Signed-off-by: Alexander Borsuk --- 3party/opening_hours/opening_hours.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/3party/opening_hours/opening_hours.cpp b/3party/opening_hours/opening_hours.cpp index fc201da04f..db3116dacf 100644 --- a/3party/opening_hours/opening_hours.cpp +++ b/3party/opening_hours/opening_hours.cpp @@ -22,9 +22,16 @@ THE SOFTWARE. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif // __clang__ #include "opening_hours.hpp" #include "rules_evaluation.hpp" #include "parse_opening_hours.hpp" +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // __clang__ #include #include -- 2.45.3 From 49f350620647dde76a6b9233558c27d15f239578 Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Mon, 13 Jun 2022 01:33:46 +0200 Subject: [PATCH 2/3] [android] R8 fixes to enable optimizations Signed-off-by: Alexander Borsuk --- android/proguard-mwm.txt | 40 +------------------ .../src/com/mapswithme/maps/MwmActivity.java | 5 ++- .../com/mapswithme/maps/MwmApplication.java | 4 +- .../maps/api/ParsedRoutingData.java | 3 ++ .../maps/api/ParsedSearchRequest.java | 3 +- .../mapswithme/maps/api/ParsingResult.java | 2 + .../com/mapswithme/maps/api/RoutePoint.java | 3 ++ .../maps/bookmarks/data/Bookmark.java | 3 +- .../maps/bookmarks/data/BookmarkCategory.java | 4 +- .../maps/bookmarks/data/BookmarkInfo.java | 2 + .../maps/bookmarks/data/BookmarkManager.java | 3 +- .../bookmarks/data/BookmarkSharingResult.java | 2 + .../bookmarks/data/DistanceAndAzimut.java | 3 ++ .../maps/bookmarks/data/ElevationInfo.java | 4 +- .../maps/bookmarks/data/FeatureId.java | 2 + .../maps/bookmarks/data/MapObject.java | 2 + .../maps/bookmarks/data/SortedBlock.java | 2 + .../mapswithme/maps/downloader/ChunkTask.java | 4 +- .../maps/downloader/CountryItem.java | 2 + .../maps/downloader/MapManager.java | 3 +- .../maps/downloader/UpdateInfo.java | 3 ++ .../maps/editor/data/HoursMinutes.java | 2 + .../maps/editor/data/LocalizedName.java | 2 + .../maps/editor/data/LocalizedStreet.java | 2 + .../maps/editor/data/NamesDataSource.java | 3 ++ .../mapswithme/maps/editor/data/Timespan.java | 3 ++ .../maps/editor/data/Timetable.java | 2 + .../maps/location/PlatformSocket.java | 2 + .../maps/maplayer/traffic/TrafficState.java | 3 +- .../maps/routing/RouteMarkData.java | 2 + .../maps/routing/RoutePointInfo.java | 2 + .../mapswithme/maps/routing/RoutingInfo.java | 2 + .../maps/routing/SingleLaneInfo.java | 3 ++ .../maps/routing/TransitRouteInfo.java | 2 + .../maps/routing/TransitStepInfo.java | 2 + .../maps/search/NativeMapSearchListener.java | 3 ++ .../mapswithme/maps/search/Popularity.java | 2 + .../maps/search/SearchFragment.java | 5 +-- .../mapswithme/maps/search/SearchResult.java | 5 ++- .../src/com/mapswithme/util/BatteryState.java | 2 + android/src/com/mapswithme/util/Gsonable.java | 7 ---- .../util/HttpBackgroundUploader.java | 2 + .../src/com/mapswithme/util/HttpClient.java | 3 ++ .../src/com/mapswithme/util/HttpPayload.java | 2 + .../src/com/mapswithme/util/HttpUploader.java | 3 ++ android/src/com/mapswithme/util/KeyValue.java | 2 + android/src/com/mapswithme/util/Language.java | 2 + .../com/mapswithme/util/NetworkPolicy.java | 2 + .../com/mapswithme/util/SecureStorage.java | 2 + android/src/com/mapswithme/util/Utils.java | 2 + 50 files changed, 112 insertions(+), 63 deletions(-) delete mode 100644 android/src/com/mapswithme/util/Gsonable.java diff --git a/android/proguard-mwm.txt b/android/proguard-mwm.txt index 9562c5bb3b..5fba5e887e 100644 --- a/android/proguard-mwm.txt +++ b/android/proguard-mwm.txt @@ -1,38 +1,2 @@ -# obfuscate supportV7 menu subclasses. it fixes bug with some Samsung and other devices ROMS based on android 4.2.2. -# more details here : https://code.google.com/p/android/issues/detail?id=78377 -# For some reason, this line disables optimizations and avoids crashes due to missing @Keep attributes. -# Looks like R8 keeps EVERYTHING except that unused support lib :) -# TODO: Remove this line after properly marking all JNI-called classes and methods with @Keep. -# Also remove everything else what is not needed. --keep class !android.support.v7.internal.view.menu.**,** {*;} - -# Gson support --keep class com.mapswithme.util.Gsonable --keep class * implements com.mapswithme.util.Gsonable - --keepclassmembernames class * implements com.mapswithme.util.Gsonable { - !transient ; -} - -# Enabling shrinking causes -# Execution failed for task ':minifyFdroidReleaseWithR8'. -# > com.android.tools.r8.CompilationFailedException: Compilation failed to complete -# Optimizing leads to crashes like -# No pending exception expected: java.lang.ClassNotFoundException: Didn't find class "com.mapswithme.util.HttpClient" -# It requires to manually mark all methods and classes called from NDK. --dontoptimize - --keepnames class * implements com.mapswithme.util.Gsonable { - !transient ; -} - --keepclassmembers class * implements com.mapswithme.util.Gsonable { - (...); -} - --dontwarn com.google.android.material.** --keep class com.google.android.material.** { *; } - --dontwarn androidx.** --keep class androidx.** { *; } --keep interface androidx.** { *; } +# Every JNI-called class and method should have a @Keep annotation to properly work and to avoid +# being manually added as -keep in this file. diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index b68a14a012..68cd2f6b6f 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -18,6 +18,7 @@ import android.view.ViewTreeObserver; import android.view.WindowManager; import androidx.annotation.CallSuper; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StyleRes; @@ -1115,7 +1116,7 @@ public class MwmActivity extends BaseMwmFragmentActivity } // Called from JNI. - @Override + @Override @Keep public void onPlacePageActivated(@NonNull PlacePageData data) { if (data instanceof MapObject) @@ -1138,7 +1139,7 @@ public class MwmActivity extends BaseMwmFragmentActivity } // Called from JNI. - @Override + @Override @Keep public void onPlacePageDeactivated(boolean switchFullScreenMode) { if (switchFullScreenMode) diff --git a/android/src/com/mapswithme/maps/MwmApplication.java b/android/src/com/mapswithme/maps/MwmApplication.java index b809ea6544..98aa8b4661 100644 --- a/android/src/com/mapswithme/maps/MwmApplication.java +++ b/android/src/com/mapswithme/maps/MwmApplication.java @@ -6,6 +6,7 @@ import android.content.SharedPreferences; import android.os.Handler; import android.os.Message; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.mapswithme.maps.background.AppBackgroundTracker; import com.mapswithme.maps.background.NotificationChannelFactory; @@ -246,8 +247,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker. Counters.resetAppSessionCounters(context); } - // Called from jni - @SuppressWarnings("unused") + @SuppressWarnings("unused") @Keep void forwardToMainThread(final long taskPointer) { Message m = Message.obtain(mMainLoopHandler, () -> nativeProcessTask(taskPointer)); diff --git a/android/src/com/mapswithme/maps/api/ParsedRoutingData.java b/android/src/com/mapswithme/maps/api/ParsedRoutingData.java index 206b46786e..58f3257f86 100644 --- a/android/src/com/mapswithme/maps/api/ParsedRoutingData.java +++ b/android/src/com/mapswithme/maps/api/ParsedRoutingData.java @@ -1,10 +1,13 @@ package com.mapswithme.maps.api; +import androidx.annotation.Keep; + import com.mapswithme.maps.Framework; /** * Represents Framework::ParsedRoutingData from core. */ +@Keep public class ParsedRoutingData { public final RoutePoint[] mPoints; diff --git a/android/src/com/mapswithme/maps/api/ParsedSearchRequest.java b/android/src/com/mapswithme/maps/api/ParsedSearchRequest.java index d9f748412f..68b1710356 100644 --- a/android/src/com/mapswithme/maps/api/ParsedSearchRequest.java +++ b/android/src/com/mapswithme/maps/api/ParsedSearchRequest.java @@ -1,13 +1,14 @@ package com.mapswithme.maps.api; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; /** * Represents url_scheme::SearchRequest from core. */ - +@Keep public final class ParsedSearchRequest { @NonNull diff --git a/android/src/com/mapswithme/maps/api/ParsingResult.java b/android/src/com/mapswithme/maps/api/ParsingResult.java index 6f44493be9..538ec4c896 100644 --- a/android/src/com/mapswithme/maps/api/ParsingResult.java +++ b/android/src/com/mapswithme/maps/api/ParsingResult.java @@ -1,10 +1,12 @@ package com.mapswithme.maps.api; import androidx.annotation.IntDef; +import androidx.annotation.Keep; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +@Keep public class ParsingResult { @Retention(RetentionPolicy.SOURCE) diff --git a/android/src/com/mapswithme/maps/api/RoutePoint.java b/android/src/com/mapswithme/maps/api/RoutePoint.java index cad6c0ce68..7cbbf55610 100644 --- a/android/src/com/mapswithme/maps/api/RoutePoint.java +++ b/android/src/com/mapswithme/maps/api/RoutePoint.java @@ -1,8 +1,11 @@ package com.mapswithme.maps.api; +import androidx.annotation.Keep; + /** * Represents url_scheme::RoutePoint from core. */ +@Keep public class RoutePoint { public final double mLat; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java b/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java index d203fc6759..25fee62fdf 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; import android.os.Parcel; import androidx.annotation.IntRange; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -13,7 +14,7 @@ import com.mapswithme.maps.search.Popularity; import com.mapswithme.util.Constants; // TODO consider refactoring to remove hack with MapObject unmarshalling itself and Bookmark at the same time. -@SuppressLint("ParcelCreator") +@SuppressLint("ParcelCreator") @Keep public class Bookmark extends MapObject { private Icon mIcon; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java index 34a2d534aa..2b3aa7409e 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java @@ -1,17 +1,17 @@ package com.mapswithme.maps.bookmarks.data; -import android.content.Context; -import android.content.res.Resources; import android.os.Parcel; import android.os.Parcelable; import androidx.annotation.DrawableRes; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.PluralsRes; import androidx.annotation.StringRes; import com.mapswithme.maps.R; +@Keep public class BookmarkCategory implements Parcelable { private final long mId; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java index 94920ffcf3..6610a5d366 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java @@ -1,11 +1,13 @@ package com.mapswithme.maps.bookmarks.data; import androidx.annotation.IntRange; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.mapswithme.maps.Framework; import com.mapswithme.util.GeoUtils; +@Keep public class BookmarkInfo { private final long mCategoryId; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java index e4aa25efa0..81f96613eb 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java @@ -7,6 +7,7 @@ import android.provider.OpenableColumns; import androidx.annotation.IntDef; import androidx.annotation.IntRange; +import androidx.annotation.Keep; import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -28,7 +29,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -@MainThread +@MainThread @Keep public enum BookmarkManager { INSTANCE; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkSharingResult.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkSharingResult.java index a0d7a81a57..829a4d203d 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkSharingResult.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkSharingResult.java @@ -1,11 +1,13 @@ package com.mapswithme.maps.bookmarks.data; import androidx.annotation.IntDef; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +@Keep public class BookmarkSharingResult { @Retention(RetentionPolicy.SOURCE) diff --git a/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java b/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java index 4b87715638..fa2e8f0afb 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java @@ -1,5 +1,8 @@ package com.mapswithme.maps.bookmarks.data; +import androidx.annotation.Keep; + +@Keep public class DistanceAndAzimut { private final String mDistance; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/ElevationInfo.java b/android/src/com/mapswithme/maps/bookmarks/data/ElevationInfo.java index a5f5c65ae9..4624adca4d 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/ElevationInfo.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/ElevationInfo.java @@ -3,8 +3,8 @@ package com.mapswithme.maps.bookmarks.data; import android.os.Parcel; import android.os.Parcelable; +import androidx.annotation.Keep; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.mapswithme.maps.widget.placepage.PlacePageData; @@ -13,6 +13,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +@Keep public class ElevationInfo implements PlacePageData { private final long mId; @@ -132,6 +133,7 @@ public class ElevationInfo implements PlacePageData dest.writeTypedList(mPoints); } + @Keep public static class Point implements Parcelable { private final double mDistance; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java b/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java index cd383fbbea..914a195c0d 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java @@ -4,8 +4,10 @@ import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; +import androidx.annotation.Keep; import androidx.annotation.NonNull; +@Keep public class FeatureId implements Parcelable { public static final Creator CREATOR = new Creator() diff --git a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java index bb58af8fc5..3737e1823c 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java @@ -4,6 +4,7 @@ import android.os.Parcel; import android.text.TextUtils; import androidx.annotation.IntDef; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -20,6 +21,7 @@ import java.util.List; // TODO(yunikkk): Refactor. Displayed information is different from edited information, and it's better to // separate them. Simple getters from jni place_page::Info and osm::EditableFeature should be enough. +@Keep public class MapObject implements PopularityProvider, PlacePageData { // Order must correspond indexer/map_object.hpp diff --git a/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java b/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java index cb51e97ddb..f4a380d508 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java @@ -1,11 +1,13 @@ package com.mapswithme.maps.bookmarks.data; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +@Keep public class SortedBlock { @NonNull diff --git a/android/src/com/mapswithme/maps/downloader/ChunkTask.java b/android/src/com/mapswithme/maps/downloader/ChunkTask.java index be6107effe..792fea16b9 100644 --- a/android/src/com/mapswithme/maps/downloader/ChunkTask.java +++ b/android/src/com/mapswithme/maps/downloader/ChunkTask.java @@ -3,6 +3,8 @@ package com.mapswithme.maps.downloader; import android.os.AsyncTask; import android.util.Base64; +import androidx.annotation.Keep; + import com.mapswithme.util.Constants; import com.mapswithme.util.StringUtils; import com.mapswithme.util.Utils; @@ -19,7 +21,7 @@ import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.Executors; -@SuppressWarnings("unused") +@SuppressWarnings("unused") @Keep class ChunkTask extends AsyncTask { private static final String TAG = ChunkTask.class.getSimpleName(); diff --git a/android/src/com/mapswithme/maps/downloader/CountryItem.java b/android/src/com/mapswithme/maps/downloader/CountryItem.java index a55debeede..64caa1f257 100644 --- a/android/src/com/mapswithme/maps/downloader/CountryItem.java +++ b/android/src/com/mapswithme/maps/downloader/CountryItem.java @@ -2,6 +2,7 @@ package com.mapswithme.maps.downloader; import android.text.TextUtils; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -9,6 +10,7 @@ import androidx.annotation.Nullable; * Class representing a single item in countries hierarchy. * Fields are filled by native code. */ +@Keep public final class CountryItem implements Comparable { private static String sRootId; diff --git a/android/src/com/mapswithme/maps/downloader/MapManager.java b/android/src/com/mapswithme/maps/downloader/MapManager.java index 5b300b6fae..dbfb868f44 100644 --- a/android/src/com/mapswithme/maps/downloader/MapManager.java +++ b/android/src/com/mapswithme/maps/downloader/MapManager.java @@ -5,6 +5,7 @@ import android.app.Application; import android.content.DialogInterface; import android.text.TextUtils; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; @@ -21,7 +22,7 @@ import java.util.List; @UiThread public final class MapManager { - @SuppressWarnings("unused") + @SuppressWarnings("unused") @Keep public static class StorageCallbackData { public final String countryId; diff --git a/android/src/com/mapswithme/maps/downloader/UpdateInfo.java b/android/src/com/mapswithme/maps/downloader/UpdateInfo.java index 2481c71ad7..9d0c375a36 100644 --- a/android/src/com/mapswithme/maps/downloader/UpdateInfo.java +++ b/android/src/com/mapswithme/maps/downloader/UpdateInfo.java @@ -1,8 +1,11 @@ package com.mapswithme.maps.downloader; +import androidx.annotation.Keep; + /** * Info about data to be updated. Created by native code. */ +@Keep public final class UpdateInfo { public final int filesCount; diff --git a/android/src/com/mapswithme/maps/editor/data/HoursMinutes.java b/android/src/com/mapswithme/maps/editor/data/HoursMinutes.java index 1ea3b4b9fd..f9d556f9b5 100644 --- a/android/src/com/mapswithme/maps/editor/data/HoursMinutes.java +++ b/android/src/com/mapswithme/maps/editor/data/HoursMinutes.java @@ -4,12 +4,14 @@ import android.os.Parcel; import android.os.Parcelable; import androidx.annotation.IntRange; +import androidx.annotation.Keep; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Locale; +@Keep public class HoursMinutes implements Parcelable { public final long hours; diff --git a/android/src/com/mapswithme/maps/editor/data/LocalizedName.java b/android/src/com/mapswithme/maps/editor/data/LocalizedName.java index e984e8a0ec..c5dc9676fb 100644 --- a/android/src/com/mapswithme/maps/editor/data/LocalizedName.java +++ b/android/src/com/mapswithme/maps/editor/data/LocalizedName.java @@ -1,7 +1,9 @@ package com.mapswithme.maps.editor.data; +import androidx.annotation.Keep; import androidx.annotation.NonNull; +@Keep public class LocalizedName { public int code; diff --git a/android/src/com/mapswithme/maps/editor/data/LocalizedStreet.java b/android/src/com/mapswithme/maps/editor/data/LocalizedStreet.java index 40ae98f682..ce5223792a 100644 --- a/android/src/com/mapswithme/maps/editor/data/LocalizedStreet.java +++ b/android/src/com/mapswithme/maps/editor/data/LocalizedStreet.java @@ -1,7 +1,9 @@ package com.mapswithme.maps.editor.data; +import androidx.annotation.Keep; import androidx.annotation.NonNull; +@Keep public class LocalizedStreet { public final String defaultName; diff --git a/android/src/com/mapswithme/maps/editor/data/NamesDataSource.java b/android/src/com/mapswithme/maps/editor/data/NamesDataSource.java index b121057efa..d206a6c59a 100644 --- a/android/src/com/mapswithme/maps/editor/data/NamesDataSource.java +++ b/android/src/com/mapswithme/maps/editor/data/NamesDataSource.java @@ -1,5 +1,7 @@ package com.mapswithme.maps.editor.data; +import androidx.annotation.Keep; + /** * Class which contains array of localized names with following priority: * 1. Names for Mwm languages; @@ -7,6 +9,7 @@ package com.mapswithme.maps.editor.data; * 3. Other names; * and mandatoryNamesCount - count of names which should be always shown. */ +@Keep public class NamesDataSource { private final LocalizedName[] mNames; diff --git a/android/src/com/mapswithme/maps/editor/data/Timespan.java b/android/src/com/mapswithme/maps/editor/data/Timespan.java index 17eb39f4bb..e8be8f6799 100644 --- a/android/src/com/mapswithme/maps/editor/data/Timespan.java +++ b/android/src/com/mapswithme/maps/editor/data/Timespan.java @@ -1,5 +1,8 @@ package com.mapswithme.maps.editor.data; +import androidx.annotation.Keep; + +@Keep public class Timespan { public final HoursMinutes start; diff --git a/android/src/com/mapswithme/maps/editor/data/Timetable.java b/android/src/com/mapswithme/maps/editor/data/Timetable.java index 9dbf69bf25..90573198ff 100644 --- a/android/src/com/mapswithme/maps/editor/data/Timetable.java +++ b/android/src/com/mapswithme/maps/editor/data/Timetable.java @@ -1,8 +1,10 @@ package com.mapswithme.maps.editor.data; import androidx.annotation.IntRange; +import androidx.annotation.Keep; import androidx.annotation.NonNull; +@Keep public class Timetable { public final Timespan workingTimespan; diff --git a/android/src/com/mapswithme/maps/location/PlatformSocket.java b/android/src/com/mapswithme/maps/location/PlatformSocket.java index a33abfcb42..cd502c7e86 100644 --- a/android/src/com/mapswithme/maps/location/PlatformSocket.java +++ b/android/src/com/mapswithme/maps/location/PlatformSocket.java @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; import android.net.SSLCertificateSocketFactory; import android.os.SystemClock; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mapswithme.maps.BuildConfig; @@ -28,6 +29,7 @@ import java.net.SocketTimeoutException; *

* All public methods are blocking and shouldn't be called from the main thread. */ +@Keep class PlatformSocket { private static final String TAG = PlatformSocket.class.getSimpleName(); diff --git a/android/src/com/mapswithme/maps/maplayer/traffic/TrafficState.java b/android/src/com/mapswithme/maps/maplayer/traffic/TrafficState.java index 8ba4c90ff6..4a3945b403 100644 --- a/android/src/com/mapswithme/maps/maplayer/traffic/TrafficState.java +++ b/android/src/com/mapswithme/maps/maplayer/traffic/TrafficState.java @@ -1,5 +1,6 @@ package com.mapswithme.maps.maplayer.traffic; +import androidx.annotation.Keep; import androidx.annotation.MainThread; import androidx.annotation.NonNull; @@ -90,7 +91,7 @@ enum TrafficState interface StateChangeListener { // This method is called from JNI layer. - @SuppressWarnings("unused") + @SuppressWarnings("unused") @Keep @MainThread void onTrafficStateChanged(int state); } diff --git a/android/src/com/mapswithme/maps/routing/RouteMarkData.java b/android/src/com/mapswithme/maps/routing/RouteMarkData.java index 3b35f9ce1c..bd8dc45aea 100644 --- a/android/src/com/mapswithme/maps/routing/RouteMarkData.java +++ b/android/src/com/mapswithme/maps/routing/RouteMarkData.java @@ -1,10 +1,12 @@ package com.mapswithme.maps.routing; +import androidx.annotation.Keep; import androidx.annotation.Nullable; /** * Represents RouteMarkData from core. */ +@Keep public class RouteMarkData { @Nullable diff --git a/android/src/com/mapswithme/maps/routing/RoutePointInfo.java b/android/src/com/mapswithme/maps/routing/RoutePointInfo.java index 6848830726..7230cd3a9f 100644 --- a/android/src/com/mapswithme/maps/routing/RoutePointInfo.java +++ b/android/src/com/mapswithme/maps/routing/RoutePointInfo.java @@ -4,10 +4,12 @@ import android.os.Parcel; import android.os.Parcelable; import androidx.annotation.IntDef; +import androidx.annotation.Keep; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +@Keep public class RoutePointInfo implements Parcelable { public static final Creator CREATOR = new Creator() diff --git a/android/src/com/mapswithme/maps/routing/RoutingInfo.java b/android/src/com/mapswithme/maps/routing/RoutingInfo.java index b12649f192..b0fcee36db 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingInfo.java +++ b/android/src/com/mapswithme/maps/routing/RoutingInfo.java @@ -3,10 +3,12 @@ package com.mapswithme.maps.routing; import android.widget.ImageView; import androidx.annotation.DrawableRes; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.mapswithme.maps.R; +@Keep public class RoutingInfo { // Target (end point of route). diff --git a/android/src/com/mapswithme/maps/routing/SingleLaneInfo.java b/android/src/com/mapswithme/maps/routing/SingleLaneInfo.java index 3babc54c43..9668fc77f5 100644 --- a/android/src/com/mapswithme/maps/routing/SingleLaneInfo.java +++ b/android/src/com/mapswithme/maps/routing/SingleLaneInfo.java @@ -1,5 +1,8 @@ package com.mapswithme.maps.routing; +import androidx.annotation.Keep; + +@Keep public class SingleLaneInfo { byte[] mLane; diff --git a/android/src/com/mapswithme/maps/routing/TransitRouteInfo.java b/android/src/com/mapswithme/maps/routing/TransitRouteInfo.java index ad91328b29..43686fe1a2 100644 --- a/android/src/com/mapswithme/maps/routing/TransitRouteInfo.java +++ b/android/src/com/mapswithme/maps/routing/TransitRouteInfo.java @@ -1,5 +1,6 @@ package com.mapswithme.maps.routing; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import java.util.ArrayList; @@ -9,6 +10,7 @@ import java.util.List; /** * Represents TransitRouteInfo from core. */ +@Keep public class TransitRouteInfo { @NonNull diff --git a/android/src/com/mapswithme/maps/routing/TransitStepInfo.java b/android/src/com/mapswithme/maps/routing/TransitStepInfo.java index 958225948e..259b28dfd8 100644 --- a/android/src/com/mapswithme/maps/routing/TransitStepInfo.java +++ b/android/src/com/mapswithme/maps/routing/TransitStepInfo.java @@ -1,6 +1,7 @@ package com.mapswithme.maps.routing; import androidx.annotation.IntDef; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -10,6 +11,7 @@ import java.lang.annotation.RetentionPolicy; /** * Represents TransitStepInfo from core. */ +@Keep public class TransitStepInfo { private static final int TRANSIT_TYPE_INTERMEDIATE_POINT = 0; diff --git a/android/src/com/mapswithme/maps/search/NativeMapSearchListener.java b/android/src/com/mapswithme/maps/search/NativeMapSearchListener.java index d89fb432e4..541099e9b3 100644 --- a/android/src/com/mapswithme/maps/search/NativeMapSearchListener.java +++ b/android/src/com/mapswithme/maps/search/NativeMapSearchListener.java @@ -1,7 +1,10 @@ package com.mapswithme.maps.search; +import androidx.annotation.Keep; + public interface NativeMapSearchListener { + @Keep class Result { public final String countryId; diff --git a/android/src/com/mapswithme/maps/search/Popularity.java b/android/src/com/mapswithme/maps/search/Popularity.java index cfca5d4791..aee841966b 100644 --- a/android/src/com/mapswithme/maps/search/Popularity.java +++ b/android/src/com/mapswithme/maps/search/Popularity.java @@ -3,8 +3,10 @@ package com.mapswithme.maps.search; import android.os.Parcel; import android.os.Parcelable; +import androidx.annotation.Keep; import androidx.annotation.NonNull; +@Keep public class Popularity implements Parcelable { @NonNull diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java index 7e6a0829f3..49dc34e6f3 100644 --- a/android/src/com/mapswithme/maps/search/SearchFragment.java +++ b/android/src/com/mapswithme/maps/search/SearchFragment.java @@ -11,10 +11,10 @@ import android.view.View; import android.view.ViewGroup; import androidx.annotation.CallSuper; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.LinearLayoutManager; @@ -22,7 +22,6 @@ import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.behavior.HideBottomViewOnScrollBehavior; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.tabs.TabLayout; import com.mapswithme.maps.Framework; @@ -492,7 +491,7 @@ public class SearchFragment extends BaseMwmFragment } // Called from JNI. - @SuppressWarnings("unused") + @SuppressWarnings("unused") @Keep @Override public void onResultsUpdate(@NonNull SearchResult[] results, long timestamp) { diff --git a/android/src/com/mapswithme/maps/search/SearchResult.java b/android/src/com/mapswithme/maps/search/SearchResult.java index 17f454768f..d0462675c7 100644 --- a/android/src/com/mapswithme/maps/search/SearchResult.java +++ b/android/src/com/mapswithme/maps/search/SearchResult.java @@ -1,5 +1,6 @@ package com.mapswithme.maps.search; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.mapswithme.maps.bookmarks.data.FeatureId; @@ -7,7 +8,7 @@ import com.mapswithme.maps.bookmarks.data.FeatureId; /** * Class instances are created from native code. */ -@SuppressWarnings("unused") +@SuppressWarnings("unused") @Keep public class SearchResult implements PopularityProvider { public static final int TYPE_SUGGEST = 0; @@ -20,7 +21,7 @@ public class SearchResult implements PopularityProvider public static final SearchResult EMPTY = new SearchResult("", "", 0, 0, new int[] {}); - + @Keep public static class Description { public final FeatureId featureId; diff --git a/android/src/com/mapswithme/util/BatteryState.java b/android/src/com/mapswithme/util/BatteryState.java index 4c077c5dc9..6bd3bd68dc 100644 --- a/android/src/com/mapswithme/util/BatteryState.java +++ b/android/src/com/mapswithme/util/BatteryState.java @@ -7,6 +7,7 @@ import android.os.BatteryManager; import androidx.annotation.IntDef; import androidx.annotation.IntRange; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.mapswithme.maps.MwmApplication; @@ -14,6 +15,7 @@ import com.mapswithme.maps.MwmApplication; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +@Keep public final class BatteryState { public static final byte CHARGING_STATUS_UNKNOWN = 0; diff --git a/android/src/com/mapswithme/util/Gsonable.java b/android/src/com/mapswithme/util/Gsonable.java deleted file mode 100644 index dce2d6667f..0000000000 --- a/android/src/com/mapswithme/util/Gsonable.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.mapswithme.util; - -/** - * Marker for classes that are (de)serializable from/to JSON using Google Gson library. - */ -public interface Gsonable -{} diff --git a/android/src/com/mapswithme/util/HttpBackgroundUploader.java b/android/src/com/mapswithme/util/HttpBackgroundUploader.java index 6d7634c999..c1daf4516d 100644 --- a/android/src/com/mapswithme/util/HttpBackgroundUploader.java +++ b/android/src/com/mapswithme/util/HttpBackgroundUploader.java @@ -1,5 +1,6 @@ package com.mapswithme.util; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.work.Constraints; import androidx.work.Data; @@ -9,6 +10,7 @@ import androidx.work.WorkManager; import com.google.gson.Gson; import com.mapswithme.util.log.Logger; +@Keep public class HttpBackgroundUploader extends AbstractHttpUploader { private static final String TAG = HttpBackgroundUploader.class.getSimpleName(); diff --git a/android/src/com/mapswithme/util/HttpClient.java b/android/src/com/mapswithme/util/HttpClient.java index 01df34f2f4..76a6038bb8 100644 --- a/android/src/com/mapswithme/util/HttpClient.java +++ b/android/src/com/mapswithme/util/HttpClient.java @@ -26,6 +26,7 @@ package com.mapswithme.util; import android.text.TextUtils; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.mapswithme.util.log.Logger; @@ -47,6 +48,7 @@ import java.util.Map; import java.util.zip.GZIPInputStream; import java.util.zip.InflaterInputStream; +@Keep public final class HttpClient { private static final String TAG = HttpClient.class.getSimpleName(); @@ -224,6 +226,7 @@ public final class HttpClient return in; } + @Keep private static class Params { public void setHeaders(@NonNull KeyValue[] array) diff --git a/android/src/com/mapswithme/util/HttpPayload.java b/android/src/com/mapswithme/util/HttpPayload.java index 5e94bc6d51..a0586a17de 100644 --- a/android/src/com/mapswithme/util/HttpPayload.java +++ b/android/src/com/mapswithme/util/HttpPayload.java @@ -1,5 +1,6 @@ package com.mapswithme.util; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.google.gson.annotations.SerializedName; @@ -8,6 +9,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +@Keep public class HttpPayload { @NonNull diff --git a/android/src/com/mapswithme/util/HttpUploader.java b/android/src/com/mapswithme/util/HttpUploader.java index 0014dbea7d..a26961e6b9 100644 --- a/android/src/com/mapswithme/util/HttpUploader.java +++ b/android/src/com/mapswithme/util/HttpUploader.java @@ -4,6 +4,7 @@ import android.os.Build; import android.text.TextUtils; import android.util.Base64; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mapswithme.util.log.Logger; @@ -24,6 +25,7 @@ import java.net.URL; import java.net.URLConnection; import java.util.List; +@Keep public final class HttpUploader extends AbstractHttpUploader { private static final String TAG = HttpUploader.class.getSimpleName(); @@ -234,6 +236,7 @@ public final class HttpUploader extends AbstractHttpUploader writer.flush(); } + @Keep static class Result { private final int mHttpCode; diff --git a/android/src/com/mapswithme/util/KeyValue.java b/android/src/com/mapswithme/util/KeyValue.java index fae0c8dff8..bedebd6558 100644 --- a/android/src/com/mapswithme/util/KeyValue.java +++ b/android/src/com/mapswithme/util/KeyValue.java @@ -1,11 +1,13 @@ package com.mapswithme.util; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.google.gson.annotations.SerializedName; import java.io.Serializable; +@Keep public final class KeyValue implements Serializable { private static final long serialVersionUID = -3079360274128509979L; diff --git a/android/src/com/mapswithme/util/Language.java b/android/src/com/mapswithme/util/Language.java index 19d342b9f2..7fdca04fd2 100644 --- a/android/src/com/mapswithme/util/Language.java +++ b/android/src/com/mapswithme/util/Language.java @@ -5,10 +5,12 @@ import android.text.TextUtils; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import java.util.Locale; +@Keep public class Language { // Locale.getLanguage() returns even 3-letter codes, not that we need in the C++ core, diff --git a/android/src/com/mapswithme/util/NetworkPolicy.java b/android/src/com/mapswithme/util/NetworkPolicy.java index f1084bd79e..e3570eac2f 100644 --- a/android/src/com/mapswithme/util/NetworkPolicy.java +++ b/android/src/com/mapswithme/util/NetworkPolicy.java @@ -1,5 +1,6 @@ package com.mapswithme.util; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.fragment.app.FragmentManager; @@ -7,6 +8,7 @@ import com.mapswithme.maps.widget.StackedButtonDialogFragment; import java.util.concurrent.TimeUnit; +@Keep public final class NetworkPolicy { public enum Type diff --git a/android/src/com/mapswithme/util/SecureStorage.java b/android/src/com/mapswithme/util/SecureStorage.java index 4cec771cdc..66634c2f27 100644 --- a/android/src/com/mapswithme/util/SecureStorage.java +++ b/android/src/com/mapswithme/util/SecureStorage.java @@ -3,10 +3,12 @@ package com.mapswithme.util; import android.content.Context; import android.content.SharedPreferences; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mapswithme.util.log.Logger; +@Keep public final class SecureStorage { private static final String TAG = SecureStorage.class.getSimpleName(); diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index 5e63ffd034..9f2be0da63 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -24,6 +24,7 @@ import android.widget.TextView; import android.widget.Toast; import androidx.annotation.DimenRes; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; @@ -53,6 +54,7 @@ import java.util.Locale; import java.util.Map; import java.util.TimeZone; +@Keep public class Utils { private static final String TAG = Utils.class.getSimpleName(); -- 2.45.3 From 5978773ebe9275e6171b4e612651f16254d767df Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Wed, 15 Jun 2022 01:00:36 +0300 Subject: [PATCH 3/3] [android] Add more @Keep rules for JNI used methods Signed-off-by: Konstantin Pastbin --- android/proguard-mwm.txt | 9 ++++++++- android/src/com/mapswithme/maps/Framework.java | 3 +++ android/src/com/mapswithme/maps/MwmActivity.java | 1 + android/src/com/mapswithme/maps/MwmApplication.java | 3 ++- .../mapswithme/maps/bookmarks/data/ParcelablePointD.java | 3 +++ .../src/com/mapswithme/maps/downloader/MapManager.java | 1 + .../src/com/mapswithme/maps/location/LocationState.java | 2 ++ android/src/com/mapswithme/maps/search/SearchEngine.java | 6 ++++++ android/src/com/mapswithme/util/ConnectionState.java | 2 ++ 9 files changed, 28 insertions(+), 2 deletions(-) diff --git a/android/proguard-mwm.txt b/android/proguard-mwm.txt index 5fba5e887e..fb73d540cb 100644 --- a/android/proguard-mwm.txt +++ b/android/proguard-mwm.txt @@ -1,2 +1,9 @@ # Every JNI-called class and method should have a @Keep annotation to properly work and to avoid -# being manually added as -keep in this file. +# being manually added as -keep in this file, for details see +# https://developer.android.com/studio/build/shrink-code#keep-code + +# Don't obfuscate to keep logs readable +-dontobfuscate + +# TODO: ATM leads to a build failure with an ERROR:R8: java.lang.NullPointerException +-dontoptimize \ No newline at end of file diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java index 5c60bc65db..b6e70b101d 100644 --- a/android/src/com/mapswithme/maps/Framework.java +++ b/android/src/com/mapswithme/maps/Framework.java @@ -6,6 +6,7 @@ import androidx.annotation.IntDef; import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.Keep; import androidx.annotation.Size; import com.mapswithme.maps.api.ParsedRoutingData; import com.mapswithme.maps.api.ParsedSearchRequest; @@ -73,6 +74,7 @@ public class Framework } @SuppressWarnings("unused") + @Keep public interface RoutingListener { @MainThread @@ -80,6 +82,7 @@ public class Framework } @SuppressWarnings("unused") + @Keep public interface RoutingProgressListener { @MainThread diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index 68cd2f6b6f..170c26d140 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -222,6 +222,7 @@ public class MwmActivity extends BaseMwmFragmentActivity runTasks(); } + @Keep @Override public void onRenderingInitializationFinished() { diff --git a/android/src/com/mapswithme/maps/MwmApplication.java b/android/src/com/mapswithme/maps/MwmApplication.java index 98aa8b4661..f1cd471a6c 100644 --- a/android/src/com/mapswithme/maps/MwmApplication.java +++ b/android/src/com/mapswithme/maps/MwmApplication.java @@ -247,7 +247,8 @@ public class MwmApplication extends Application implements AppBackgroundTracker. Counters.resetAppSessionCounters(context); } - @SuppressWarnings("unused") @Keep + @SuppressWarnings("unused") + @Keep void forwardToMainThread(final long taskPointer) { Message m = Message.obtain(mMainLoopHandler, () -> nativeProcessTask(taskPointer)); diff --git a/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePointD.java b/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePointD.java index 140b758503..af982ce041 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePointD.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePointD.java @@ -4,7 +4,10 @@ import android.graphics.Point; import android.os.Parcel; import android.os.Parcelable; +import androidx.annotation.Keep; + // TODO consider removal and usage of platform PointF +@Keep public class ParcelablePointD implements Parcelable { public double x; diff --git a/android/src/com/mapswithme/maps/downloader/MapManager.java b/android/src/com/mapswithme/maps/downloader/MapManager.java index dbfb868f44..343e51a588 100644 --- a/android/src/com/mapswithme/maps/downloader/MapManager.java +++ b/android/src/com/mapswithme/maps/downloader/MapManager.java @@ -47,6 +47,7 @@ public final class MapManager } @SuppressWarnings("unused") + @Keep interface CurrentCountryChangedListener { void onCurrentCountryChanged(String countryId); diff --git a/android/src/com/mapswithme/maps/location/LocationState.java b/android/src/com/mapswithme/maps/location/LocationState.java index 2cc0de5255..4964ceab64 100644 --- a/android/src/com/mapswithme/maps/location/LocationState.java +++ b/android/src/com/mapswithme/maps/location/LocationState.java @@ -1,5 +1,6 @@ package com.mapswithme.maps.location; +import androidx.annotation.Keep; import androidx.annotation.IntDef; import androidx.annotation.NonNull; @@ -8,6 +9,7 @@ import java.lang.annotation.RetentionPolicy; public final class LocationState { + @Keep interface ModeChangeListener { @SuppressWarnings("unused") diff --git a/android/src/com/mapswithme/maps/search/SearchEngine.java b/android/src/com/mapswithme/maps/search/SearchEngine.java index 86e4af915f..8c2e0961fa 100644 --- a/android/src/com/mapswithme/maps/search/SearchEngine.java +++ b/android/src/com/mapswithme/maps/search/SearchEngine.java @@ -2,6 +2,7 @@ package com.mapswithme.maps.search; import android.content.Context; +import androidx.annotation.Keep; import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -26,6 +27,7 @@ public enum SearchEngine implements NativeSearchListener, private String mQuery; @Override + @Keep public void onResultsUpdate(@NonNull final SearchResult[] results, final long timestamp) { UiThread.run( @@ -38,6 +40,7 @@ public enum SearchEngine implements NativeSearchListener, } @Override + @Keep public void onResultsEnd(final long timestamp) { UiThread.run( @@ -50,6 +53,7 @@ public enum SearchEngine implements NativeSearchListener, } @Override + @Keep public void onMapSearchResults(final NativeMapSearchListener.Result[] results, final long timestamp, final boolean isLast) { UiThread.run( @@ -61,6 +65,7 @@ public enum SearchEngine implements NativeSearchListener, }); } + @Keep public void onBookmarkSearchResultsUpdate(@Nullable long[] bookmarkIds, long timestamp) { for (NativeBookmarkSearchListener listener : mBookmarkListeners) @@ -68,6 +73,7 @@ public enum SearchEngine implements NativeSearchListener, mBookmarkListeners.finishIterate(); } + @Keep public void onBookmarkSearchResultsEnd(@Nullable long[] bookmarkIds, long timestamp) { for (NativeBookmarkSearchListener listener : mBookmarkListeners) diff --git a/android/src/com/mapswithme/util/ConnectionState.java b/android/src/com/mapswithme/util/ConnectionState.java index d61af90f9f..77b793467a 100644 --- a/android/src/com/mapswithme/util/ConnectionState.java +++ b/android/src/com/mapswithme/util/ConnectionState.java @@ -7,6 +7,7 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.telephony.TelephonyManager; +import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -143,6 +144,7 @@ public enum ConnectionState implements Initializable // Called from JNI. @SuppressWarnings("unused") + @Keep public static byte getConnectionState() { return INSTANCE.requestCurrentType().getNativeRepresentation(); -- 2.45.3