Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
5978773ebe [android] Add more @Keep rules for JNI used methods
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
2022-06-19 22:18:18 +03:00
Alexander Borsuk
49f3506206 [android] R8 fixes to enable optimizations
Signed-off-by: Alexander Borsuk <me@alex.bio>
2022-06-19 20:28:58 +03:00
Alexander Borsuk
8f2b6b521f [android] Silenced warning
Signed-off-by: Alexander Borsuk <me@alex.bio>
2022-06-19 20:23:21 +03:00
56 changed files with 142 additions and 60 deletions

View file

@ -22,9 +22,16 @@
THE SOFTWARE. THE SOFTWARE.
*/ */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif // __clang__
#include "opening_hours.hpp" #include "opening_hours.hpp"
#include "rules_evaluation.hpp" #include "rules_evaluation.hpp"
#include "parse_opening_hours.hpp" #include "parse_opening_hours.hpp"
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>

View file

@ -1,38 +1,9 @@
# obfuscate supportV7 menu subclasses. it fixes bug with some Samsung and other devices ROMS based on android 4.2.2. # Every JNI-called class and method should have a @Keep annotation to properly work and to avoid
# more details here : https://code.google.com/p/android/issues/detail?id=78377 # being manually added as -keep in this file, for details see
# For some reason, this line disables optimizations and avoids crashes due to missing @Keep attributes. # https://developer.android.com/studio/build/shrink-code#keep-code
# 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 # Don't obfuscate to keep logs readable
-keep class com.mapswithme.util.Gsonable -dontobfuscate
-keep class * implements com.mapswithme.util.Gsonable
-keepclassmembernames class * implements com.mapswithme.util.Gsonable { # TODO: ATM leads to a build failure with an ERROR:R8: java.lang.NullPointerException
!transient <fields>; -dontoptimize
}
# 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 <fields>;
}
-keepclassmembers class * implements com.mapswithme.util.Gsonable {
<init>(...);
}
-dontwarn com.google.android.material.**
-keep class com.google.android.material.** { *; }
-dontwarn androidx.**
-keep class androidx.** { *; }
-keep interface androidx.** { *; }

View file

@ -6,6 +6,7 @@ import androidx.annotation.IntDef;
import androidx.annotation.MainThread; import androidx.annotation.MainThread;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.Keep;
import androidx.annotation.Size; import androidx.annotation.Size;
import com.mapswithme.maps.api.ParsedRoutingData; import com.mapswithme.maps.api.ParsedRoutingData;
import com.mapswithme.maps.api.ParsedSearchRequest; import com.mapswithme.maps.api.ParsedSearchRequest;
@ -73,6 +74,7 @@ public class Framework
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Keep
public interface RoutingListener public interface RoutingListener
{ {
@MainThread @MainThread
@ -80,6 +82,7 @@ public class Framework
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Keep
public interface RoutingProgressListener public interface RoutingProgressListener
{ {
@MainThread @MainThread

View file

@ -18,6 +18,7 @@ import android.view.ViewTreeObserver;
import android.view.WindowManager; import android.view.WindowManager;
import androidx.annotation.CallSuper; import androidx.annotation.CallSuper;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StyleRes; import androidx.annotation.StyleRes;
@ -221,6 +222,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
runTasks(); runTasks();
} }
@Keep
@Override @Override
public void onRenderingInitializationFinished() public void onRenderingInitializationFinished()
{ {
@ -1115,7 +1117,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
} }
// Called from JNI. // Called from JNI.
@Override @Override @Keep
public void onPlacePageActivated(@NonNull PlacePageData data) public void onPlacePageActivated(@NonNull PlacePageData data)
{ {
if (data instanceof MapObject) if (data instanceof MapObject)
@ -1138,7 +1140,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
} }
// Called from JNI. // Called from JNI.
@Override @Override @Keep
public void onPlacePageDeactivated(boolean switchFullScreenMode) public void onPlacePageDeactivated(boolean switchFullScreenMode)
{ {
if (switchFullScreenMode) if (switchFullScreenMode)

View file

@ -6,6 +6,7 @@ import android.content.SharedPreferences;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.mapswithme.maps.background.AppBackgroundTracker; import com.mapswithme.maps.background.AppBackgroundTracker;
import com.mapswithme.maps.background.NotificationChannelFactory; import com.mapswithme.maps.background.NotificationChannelFactory;
@ -246,8 +247,8 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
Counters.resetAppSessionCounters(context); Counters.resetAppSessionCounters(context);
} }
// Called from jni
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Keep
void forwardToMainThread(final long taskPointer) void forwardToMainThread(final long taskPointer)
{ {
Message m = Message.obtain(mMainLoopHandler, () -> nativeProcessTask(taskPointer)); Message m = Message.obtain(mMainLoopHandler, () -> nativeProcessTask(taskPointer));

View file

@ -1,10 +1,13 @@
package com.mapswithme.maps.api; package com.mapswithme.maps.api;
import androidx.annotation.Keep;
import com.mapswithme.maps.Framework; import com.mapswithme.maps.Framework;
/** /**
* Represents Framework::ParsedRoutingData from core. * Represents Framework::ParsedRoutingData from core.
*/ */
@Keep
public class ParsedRoutingData public class ParsedRoutingData
{ {
public final RoutePoint[] mPoints; public final RoutePoint[] mPoints;

View file

@ -1,13 +1,14 @@
package com.mapswithme.maps.api; package com.mapswithme.maps.api;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Represents url_scheme::SearchRequest from core. * Represents url_scheme::SearchRequest from core.
*/ */
@Keep
public final class ParsedSearchRequest public final class ParsedSearchRequest
{ {
@NonNull @NonNull

View file

@ -1,10 +1,12 @@
package com.mapswithme.maps.api; package com.mapswithme.maps.api;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Keep;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@Keep
public class ParsingResult public class ParsingResult
{ {
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)

View file

@ -1,8 +1,11 @@
package com.mapswithme.maps.api; package com.mapswithme.maps.api;
import androidx.annotation.Keep;
/** /**
* Represents url_scheme::RoutePoint from core. * Represents url_scheme::RoutePoint from core.
*/ */
@Keep
public class RoutePoint public class RoutePoint
{ {
public final double mLat; public final double mLat;

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.os.Parcel; import android.os.Parcel;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -13,7 +14,7 @@ import com.mapswithme.maps.search.Popularity;
import com.mapswithme.util.Constants; import com.mapswithme.util.Constants;
// TODO consider refactoring to remove hack with MapObject unmarshalling itself and Bookmark at the same time. // 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 public class Bookmark extends MapObject
{ {
private Icon mIcon; private Icon mIcon;

View file

@ -1,17 +1,17 @@
package com.mapswithme.maps.bookmarks.data; package com.mapswithme.maps.bookmarks.data;
import android.content.Context;
import android.content.res.Resources;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.PluralsRes; import androidx.annotation.PluralsRes;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import com.mapswithme.maps.R; import com.mapswithme.maps.R;
@Keep
public class BookmarkCategory implements Parcelable public class BookmarkCategory implements Parcelable
{ {
private final long mId; private final long mId;

View file

@ -1,11 +1,13 @@
package com.mapswithme.maps.bookmarks.data; package com.mapswithme.maps.bookmarks.data;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.mapswithme.maps.Framework; import com.mapswithme.maps.Framework;
import com.mapswithme.util.GeoUtils; import com.mapswithme.util.GeoUtils;
@Keep
public class BookmarkInfo public class BookmarkInfo
{ {
private final long mCategoryId; private final long mCategoryId;

View file

@ -7,6 +7,7 @@ import android.provider.OpenableColumns;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Keep;
import androidx.annotation.MainThread; import androidx.annotation.MainThread;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -28,7 +29,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@MainThread @MainThread @Keep
public enum BookmarkManager public enum BookmarkManager
{ {
INSTANCE; INSTANCE;

View file

@ -1,11 +1,13 @@
package com.mapswithme.maps.bookmarks.data; package com.mapswithme.maps.bookmarks.data;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@Keep
public class BookmarkSharingResult public class BookmarkSharingResult
{ {
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)

View file

@ -1,5 +1,8 @@
package com.mapswithme.maps.bookmarks.data; package com.mapswithme.maps.bookmarks.data;
import androidx.annotation.Keep;
@Keep
public class DistanceAndAzimut public class DistanceAndAzimut
{ {
private final String mDistance; private final String mDistance;

View file

@ -3,8 +3,8 @@ package com.mapswithme.maps.bookmarks.data;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mapswithme.maps.widget.placepage.PlacePageData; import com.mapswithme.maps.widget.placepage.PlacePageData;
@ -13,6 +13,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Keep
public class ElevationInfo implements PlacePageData public class ElevationInfo implements PlacePageData
{ {
private final long mId; private final long mId;
@ -132,6 +133,7 @@ public class ElevationInfo implements PlacePageData
dest.writeTypedList(mPoints); dest.writeTypedList(mPoints);
} }
@Keep
public static class Point implements Parcelable public static class Point implements Parcelable
{ {
private final double mDistance; private final double mDistance;

View file

@ -4,8 +4,10 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@Keep
public class FeatureId implements Parcelable public class FeatureId implements Parcelable
{ {
public static final Creator<FeatureId> CREATOR = new Creator<FeatureId>() public static final Creator<FeatureId> CREATOR = new Creator<FeatureId>()

View file

@ -4,6 +4,7 @@ import android.os.Parcel;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; 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 // 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. // separate them. Simple getters from jni place_page::Info and osm::EditableFeature should be enough.
@Keep
public class MapObject implements PopularityProvider, PlacePageData public class MapObject implements PopularityProvider, PlacePageData
{ {
// Order must correspond indexer/map_object.hpp // Order must correspond indexer/map_object.hpp

View file

@ -4,7 +4,10 @@ import android.graphics.Point;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.Keep;
// TODO consider removal and usage of platform PointF // TODO consider removal and usage of platform PointF
@Keep
public class ParcelablePointD implements Parcelable public class ParcelablePointD implements Parcelable
{ {
public double x; public double x;

View file

@ -1,11 +1,13 @@
package com.mapswithme.maps.bookmarks.data; package com.mapswithme.maps.bookmarks.data;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@Keep
public class SortedBlock public class SortedBlock
{ {
@NonNull @NonNull

View file

@ -3,6 +3,8 @@ package com.mapswithme.maps.downloader;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.Base64; import android.util.Base64;
import androidx.annotation.Keep;
import com.mapswithme.util.Constants; import com.mapswithme.util.Constants;
import com.mapswithme.util.StringUtils; import com.mapswithme.util.StringUtils;
import com.mapswithme.util.Utils; import com.mapswithme.util.Utils;
@ -19,7 +21,7 @@ import java.util.Map;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@SuppressWarnings("unused") @SuppressWarnings("unused") @Keep
class ChunkTask extends AsyncTask<Void, byte[], Integer> class ChunkTask extends AsyncTask<Void, byte[], Integer>
{ {
private static final String TAG = ChunkTask.class.getSimpleName(); private static final String TAG = ChunkTask.class.getSimpleName();

View file

@ -2,6 +2,7 @@ package com.mapswithme.maps.downloader;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -9,6 +10,7 @@ import androidx.annotation.Nullable;
* Class representing a single item in countries hierarchy. * Class representing a single item in countries hierarchy.
* Fields are filled by native code. * Fields are filled by native code.
*/ */
@Keep
public final class CountryItem implements Comparable<CountryItem> public final class CountryItem implements Comparable<CountryItem>
{ {
private static String sRootId; private static String sRootId;

View file

@ -5,6 +5,7 @@ import android.app.Application;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
@ -21,7 +22,7 @@ import java.util.List;
@UiThread @UiThread
public final class MapManager public final class MapManager
{ {
@SuppressWarnings("unused") @SuppressWarnings("unused") @Keep
public static class StorageCallbackData public static class StorageCallbackData
{ {
public final String countryId; public final String countryId;
@ -46,6 +47,7 @@ public final class MapManager
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Keep
interface CurrentCountryChangedListener interface CurrentCountryChangedListener
{ {
void onCurrentCountryChanged(String countryId); void onCurrentCountryChanged(String countryId);

View file

@ -1,8 +1,11 @@
package com.mapswithme.maps.downloader; package com.mapswithme.maps.downloader;
import androidx.annotation.Keep;
/** /**
* Info about data to be updated. Created by native code. * Info about data to be updated. Created by native code.
*/ */
@Keep
public final class UpdateInfo public final class UpdateInfo
{ {
public final int filesCount; public final int filesCount;

View file

@ -4,12 +4,14 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Keep;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.Locale; import java.util.Locale;
@Keep
public class HoursMinutes implements Parcelable public class HoursMinutes implements Parcelable
{ {
public final long hours; public final long hours;

View file

@ -1,7 +1,9 @@
package com.mapswithme.maps.editor.data; package com.mapswithme.maps.editor.data;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@Keep
public class LocalizedName public class LocalizedName
{ {
public int code; public int code;

View file

@ -1,7 +1,9 @@
package com.mapswithme.maps.editor.data; package com.mapswithme.maps.editor.data;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@Keep
public class LocalizedStreet public class LocalizedStreet
{ {
public final String defaultName; public final String defaultName;

View file

@ -1,5 +1,7 @@
package com.mapswithme.maps.editor.data; package com.mapswithme.maps.editor.data;
import androidx.annotation.Keep;
/** /**
* Class which contains array of localized names with following priority: * Class which contains array of localized names with following priority:
* 1. Names for Mwm languages; * 1. Names for Mwm languages;
@ -7,6 +9,7 @@ package com.mapswithme.maps.editor.data;
* 3. Other names; * 3. Other names;
* and mandatoryNamesCount - count of names which should be always shown. * and mandatoryNamesCount - count of names which should be always shown.
*/ */
@Keep
public class NamesDataSource public class NamesDataSource
{ {
private final LocalizedName[] mNames; private final LocalizedName[] mNames;

View file

@ -1,5 +1,8 @@
package com.mapswithme.maps.editor.data; package com.mapswithme.maps.editor.data;
import androidx.annotation.Keep;
@Keep
public class Timespan public class Timespan
{ {
public final HoursMinutes start; public final HoursMinutes start;

View file

@ -1,8 +1,10 @@
package com.mapswithme.maps.editor.data; package com.mapswithme.maps.editor.data;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@Keep
public class Timetable public class Timetable
{ {
public final Timespan workingTimespan; public final Timespan workingTimespan;

View file

@ -1,5 +1,6 @@
package com.mapswithme.maps.location; package com.mapswithme.maps.location;
import androidx.annotation.Keep;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -8,6 +9,7 @@ import java.lang.annotation.RetentionPolicy;
public final class LocationState public final class LocationState
{ {
@Keep
interface ModeChangeListener interface ModeChangeListener
{ {
@SuppressWarnings("unused") @SuppressWarnings("unused")

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.net.SSLCertificateSocketFactory; import android.net.SSLCertificateSocketFactory;
import android.os.SystemClock; import android.os.SystemClock;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.mapswithme.maps.BuildConfig; import com.mapswithme.maps.BuildConfig;
@ -28,6 +29,7 @@ import java.net.SocketTimeoutException;
* <p> * <p>
* <b>All public methods are blocking and shouldn't be called from the main thread.</b> * <b>All public methods are blocking and shouldn't be called from the main thread.</b>
*/ */
@Keep
class PlatformSocket class PlatformSocket
{ {
private static final String TAG = PlatformSocket.class.getSimpleName(); private static final String TAG = PlatformSocket.class.getSimpleName();

View file

@ -1,5 +1,6 @@
package com.mapswithme.maps.maplayer.traffic; package com.mapswithme.maps.maplayer.traffic;
import androidx.annotation.Keep;
import androidx.annotation.MainThread; import androidx.annotation.MainThread;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -90,7 +91,7 @@ enum TrafficState
interface StateChangeListener interface StateChangeListener
{ {
// This method is called from JNI layer. // This method is called from JNI layer.
@SuppressWarnings("unused") @SuppressWarnings("unused") @Keep
@MainThread @MainThread
void onTrafficStateChanged(int state); void onTrafficStateChanged(int state);
} }

View file

@ -1,10 +1,12 @@
package com.mapswithme.maps.routing; package com.mapswithme.maps.routing;
import androidx.annotation.Keep;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Represents RouteMarkData from core. * Represents RouteMarkData from core.
*/ */
@Keep
public class RouteMarkData public class RouteMarkData
{ {
@Nullable @Nullable

View file

@ -4,10 +4,12 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Keep;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@Keep
public class RoutePointInfo implements Parcelable public class RoutePointInfo implements Parcelable
{ {
public static final Creator<RoutePointInfo> CREATOR = new Creator<RoutePointInfo>() public static final Creator<RoutePointInfo> CREATOR = new Creator<RoutePointInfo>()

View file

@ -3,10 +3,12 @@ package com.mapswithme.maps.routing;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.mapswithme.maps.R; import com.mapswithme.maps.R;
@Keep
public class RoutingInfo public class RoutingInfo
{ {
// Target (end point of route). // Target (end point of route).

View file

@ -1,5 +1,8 @@
package com.mapswithme.maps.routing; package com.mapswithme.maps.routing;
import androidx.annotation.Keep;
@Keep
public class SingleLaneInfo public class SingleLaneInfo
{ {
byte[] mLane; byte[] mLane;

View file

@ -1,5 +1,6 @@
package com.mapswithme.maps.routing; package com.mapswithme.maps.routing;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -9,6 +10,7 @@ import java.util.List;
/** /**
* Represents TransitRouteInfo from core. * Represents TransitRouteInfo from core.
*/ */
@Keep
public class TransitRouteInfo public class TransitRouteInfo
{ {
@NonNull @NonNull

View file

@ -1,6 +1,7 @@
package com.mapswithme.maps.routing; package com.mapswithme.maps.routing;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -10,6 +11,7 @@ import java.lang.annotation.RetentionPolicy;
/** /**
* Represents TransitStepInfo from core. * Represents TransitStepInfo from core.
*/ */
@Keep
public class TransitStepInfo public class TransitStepInfo
{ {
private static final int TRANSIT_TYPE_INTERMEDIATE_POINT = 0; private static final int TRANSIT_TYPE_INTERMEDIATE_POINT = 0;

View file

@ -1,7 +1,10 @@
package com.mapswithme.maps.search; package com.mapswithme.maps.search;
import androidx.annotation.Keep;
public interface NativeMapSearchListener public interface NativeMapSearchListener
{ {
@Keep
class Result class Result
{ {
public final String countryId; public final String countryId;

View file

@ -3,8 +3,10 @@ package com.mapswithme.maps.search;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@Keep
public class Popularity implements Parcelable public class Popularity implements Parcelable
{ {
@NonNull @NonNull

View file

@ -2,6 +2,7 @@ package com.mapswithme.maps.search;
import android.content.Context; import android.content.Context;
import androidx.annotation.Keep;
import androidx.annotation.MainThread; import androidx.annotation.MainThread;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -26,6 +27,7 @@ public enum SearchEngine implements NativeSearchListener,
private String mQuery; private String mQuery;
@Override @Override
@Keep
public void onResultsUpdate(@NonNull final SearchResult[] results, final long timestamp) public void onResultsUpdate(@NonNull final SearchResult[] results, final long timestamp)
{ {
UiThread.run( UiThread.run(
@ -38,6 +40,7 @@ public enum SearchEngine implements NativeSearchListener,
} }
@Override @Override
@Keep
public void onResultsEnd(final long timestamp) public void onResultsEnd(final long timestamp)
{ {
UiThread.run( UiThread.run(
@ -50,6 +53,7 @@ public enum SearchEngine implements NativeSearchListener,
} }
@Override @Override
@Keep
public void onMapSearchResults(final NativeMapSearchListener.Result[] results, final long timestamp, final boolean isLast) public void onMapSearchResults(final NativeMapSearchListener.Result[] results, final long timestamp, final boolean isLast)
{ {
UiThread.run( UiThread.run(
@ -61,6 +65,7 @@ public enum SearchEngine implements NativeSearchListener,
}); });
} }
@Keep
public void onBookmarkSearchResultsUpdate(@Nullable long[] bookmarkIds, long timestamp) public void onBookmarkSearchResultsUpdate(@Nullable long[] bookmarkIds, long timestamp)
{ {
for (NativeBookmarkSearchListener listener : mBookmarkListeners) for (NativeBookmarkSearchListener listener : mBookmarkListeners)
@ -68,6 +73,7 @@ public enum SearchEngine implements NativeSearchListener,
mBookmarkListeners.finishIterate(); mBookmarkListeners.finishIterate();
} }
@Keep
public void onBookmarkSearchResultsEnd(@Nullable long[] bookmarkIds, long timestamp) public void onBookmarkSearchResultsEnd(@Nullable long[] bookmarkIds, long timestamp)
{ {
for (NativeBookmarkSearchListener listener : mBookmarkListeners) for (NativeBookmarkSearchListener listener : mBookmarkListeners)

View file

@ -11,10 +11,10 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.CallSuper; import androidx.annotation.CallSuper;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -22,7 +22,6 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout; 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.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import com.mapswithme.maps.Framework; import com.mapswithme.maps.Framework;
@ -492,7 +491,7 @@ public class SearchFragment extends BaseMwmFragment
} }
// Called from JNI. // Called from JNI.
@SuppressWarnings("unused") @SuppressWarnings("unused") @Keep
@Override @Override
public void onResultsUpdate(@NonNull SearchResult[] results, long timestamp) public void onResultsUpdate(@NonNull SearchResult[] results, long timestamp)
{ {

View file

@ -1,5 +1,6 @@
package com.mapswithme.maps.search; package com.mapswithme.maps.search;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.mapswithme.maps.bookmarks.data.FeatureId; 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. * Class instances are created from native code.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused") @Keep
public class SearchResult implements PopularityProvider public class SearchResult implements PopularityProvider
{ {
public static final int TYPE_SUGGEST = 0; 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, public static final SearchResult EMPTY = new SearchResult("", "", 0, 0,
new int[] {}); new int[] {});
@Keep
public static class Description public static class Description
{ {
public final FeatureId featureId; public final FeatureId featureId;

View file

@ -7,6 +7,7 @@ import android.os.BatteryManager;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.MwmApplication;
@ -14,6 +15,7 @@ import com.mapswithme.maps.MwmApplication;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@Keep
public final class BatteryState public final class BatteryState
{ {
public static final byte CHARGING_STATUS_UNKNOWN = 0; public static final byte CHARGING_STATUS_UNKNOWN = 0;

View file

@ -7,6 +7,7 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -143,6 +144,7 @@ public enum ConnectionState implements Initializable<Context>
// Called from JNI. // Called from JNI.
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Keep
public static byte getConnectionState() public static byte getConnectionState()
{ {
return INSTANCE.requestCurrentType().getNativeRepresentation(); return INSTANCE.requestCurrentType().getNativeRepresentation();

View file

@ -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
{}

View file

@ -1,5 +1,6 @@
package com.mapswithme.util; package com.mapswithme.util;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.work.Constraints; import androidx.work.Constraints;
import androidx.work.Data; import androidx.work.Data;
@ -9,6 +10,7 @@ import androidx.work.WorkManager;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.Logger;
@Keep
public class HttpBackgroundUploader extends AbstractHttpUploader public class HttpBackgroundUploader extends AbstractHttpUploader
{ {
private static final String TAG = HttpBackgroundUploader.class.getSimpleName(); private static final String TAG = HttpBackgroundUploader.class.getSimpleName();

View file

@ -26,6 +26,7 @@ package com.mapswithme.util;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.Logger;
@ -47,6 +48,7 @@ import java.util.Map;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import java.util.zip.InflaterInputStream; import java.util.zip.InflaterInputStream;
@Keep
public final class HttpClient public final class HttpClient
{ {
private static final String TAG = HttpClient.class.getSimpleName(); private static final String TAG = HttpClient.class.getSimpleName();
@ -224,6 +226,7 @@ public final class HttpClient
return in; return in;
} }
@Keep
private static class Params private static class Params
{ {
public void setHeaders(@NonNull KeyValue[] array) public void setHeaders(@NonNull KeyValue[] array)

View file

@ -1,5 +1,6 @@
package com.mapswithme.util; package com.mapswithme.util;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@ -8,6 +9,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@Keep
public class HttpPayload public class HttpPayload
{ {
@NonNull @NonNull

View file

@ -4,6 +4,7 @@ import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Base64; import android.util.Base64;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.Logger;
@ -24,6 +25,7 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.List; import java.util.List;
@Keep
public final class HttpUploader extends AbstractHttpUploader public final class HttpUploader extends AbstractHttpUploader
{ {
private static final String TAG = HttpUploader.class.getSimpleName(); private static final String TAG = HttpUploader.class.getSimpleName();
@ -234,6 +236,7 @@ public final class HttpUploader extends AbstractHttpUploader
writer.flush(); writer.flush();
} }
@Keep
static class Result static class Result
{ {
private final int mHttpCode; private final int mHttpCode;

View file

@ -1,11 +1,13 @@
package com.mapswithme.util; package com.mapswithme.util;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.io.Serializable; import java.io.Serializable;
@Keep
public final class KeyValue implements Serializable public final class KeyValue implements Serializable
{ {
private static final long serialVersionUID = -3079360274128509979L; private static final long serialVersionUID = -3079360274128509979L;

View file

@ -5,10 +5,12 @@ import android.text.TextUtils;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.Locale; import java.util.Locale;
@Keep
public class Language public class Language
{ {
// Locale.getLanguage() returns even 3-letter codes, not that we need in the C++ core, // Locale.getLanguage() returns even 3-letter codes, not that we need in the C++ core,

View file

@ -1,5 +1,6 @@
package com.mapswithme.util; package com.mapswithme.util;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -7,6 +8,7 @@ import com.mapswithme.maps.widget.StackedButtonDialogFragment;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Keep
public final class NetworkPolicy public final class NetworkPolicy
{ {
public enum Type public enum Type

View file

@ -3,10 +3,12 @@ package com.mapswithme.util;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.Logger;
@Keep
public final class SecureStorage public final class SecureStorage
{ {
private static final String TAG = SecureStorage.class.getSimpleName(); private static final String TAG = SecureStorage.class.getSimpleName();

View file

@ -24,6 +24,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.DimenRes; import androidx.annotation.DimenRes;
import androidx.annotation.Keep;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
@ -53,6 +54,7 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
@Keep
public class Utils public class Utils
{ {
private static final String TAG = Utils.class.getSimpleName(); private static final String TAG = Utils.class.getSimpleName();