From 2e5166b8873bf801bca6a8f9f2ab95430b969524 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 6 Dec 2020 16:36:11 +0200 Subject: [PATCH] Combine connected app and plugin in UI and add plugin version --- .../osmand/aidlapi/IOsmAndAidlInterface.aidl | 3 ++ .../customization/CustomPluginParams.aidl | 3 ++ .../customization/CustomPluginParams.java | 48 +++++++++++++++++++ OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 15 +++++- .../net/osmand/aidl/OsmandAidlServiceV2.java | 20 +++++++- .../net/osmand/plus/CustomOsmandPlugin.java | 28 +++++++---- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 5 +- .../plus/activities/PluginsFragment.java | 28 ++++++++++- .../osmand/plus/importfiles/ImportHelper.java | 16 ++++--- .../plus/importfiles/SettingsImportTask.java | 23 +++++---- .../plus/importfiles/ZipImportTask.java | 2 +- .../backend/backup/PluginSettingsItem.java | 1 + .../backend/backup/SettingsHelper.java | 1 + 13 files changed, 159 insertions(+), 34 deletions(-) create mode 100644 OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.aidl create mode 100644 OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.java diff --git a/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl b/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl index e25e4338de..770cc32418 100644 --- a/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl +++ b/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl @@ -77,6 +77,7 @@ import net.osmand.aidlapi.customization.OsmandSettingsInfoParams; import net.osmand.aidlapi.customization.CustomizationInfoParams; import net.osmand.aidlapi.customization.ProfileSettingsParams; import net.osmand.aidlapi.customization.MapMarginsParams; +import net.osmand.aidlapi.customization.CustomPluginParams; import net.osmand.aidlapi.gpx.AGpxFile; import net.osmand.aidlapi.gpx.AGpxFileDetails; @@ -883,4 +884,6 @@ interface IOsmAndAidlInterface { * Is contect menu open. */ boolean isMenuOpen(); + + int getPluginVersion(in CustomPluginParams params); } \ No newline at end of file diff --git a/OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.aidl b/OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.aidl new file mode 100644 index 0000000000..9eeaa2e013 --- /dev/null +++ b/OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidlapi.customization; + +parcelable CustomPluginParams; \ No newline at end of file diff --git a/OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.java b/OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.java new file mode 100644 index 0000000000..a3b35a7dd4 --- /dev/null +++ b/OsmAnd-api/src/net/osmand/aidlapi/customization/CustomPluginParams.java @@ -0,0 +1,48 @@ +package net.osmand.aidlapi.customization; + +import android.os.Bundle; +import android.os.Parcel; + +import net.osmand.aidlapi.AidlParams; + + +public class CustomPluginParams extends AidlParams { + + public static final String PLUGIN_ID_KEY = "plugin_id"; + + private String pluginId; + + public CustomPluginParams(String pluginId) { + this.pluginId = pluginId; + } + + public CustomPluginParams(Parcel in) { + readFromParcel(in); + } + + public static final Creator CREATOR = new Creator() { + @Override + public CustomPluginParams createFromParcel(Parcel in) { + return new CustomPluginParams(in); + } + + @Override + public CustomPluginParams[] newArray(int size) { + return new CustomPluginParams[size]; + } + }; + + public String getPluginId() { + return pluginId; + } + + @Override + public void writeToBundle(Bundle bundle) { + bundle.putString(PLUGIN_ID_KEY, pluginId); + } + + @Override + protected void readFromBundle(Bundle bundle) { + pluginId = bundle.getString(PLUGIN_ID_KEY); + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 467ad76a0f..b0cb7cda78 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -50,6 +50,7 @@ import net.osmand.plus.AppInitializer.AppInitializeListener; import net.osmand.plus.AppInitializer.InitEvents; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuItem; +import net.osmand.plus.CustomOsmandPlugin; import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GpxSelectionHelper; @@ -125,6 +126,7 @@ import static net.osmand.aidl.ConnectedApp.AIDL_OBJECT_ID; import static net.osmand.aidl.ConnectedApp.AIDL_PACKAGE_NAME; import static net.osmand.aidl.ConnectedApp.AIDL_REMOVE_MAP_LAYER; import static net.osmand.aidl.ConnectedApp.AIDL_REMOVE_MAP_WIDGET; +import static net.osmand.aidlapi.OsmandAidlConstants.CANNOT_ACCESS_API_ERROR; import static net.osmand.aidlapi.OsmandAidlConstants.COPY_FILE_IO_ERROR; import static net.osmand.aidlapi.OsmandAidlConstants.COPY_FILE_MAX_LOCK_TIME_MS; import static net.osmand.aidlapi.OsmandAidlConstants.COPY_FILE_PARAMS_ERROR; @@ -140,6 +142,7 @@ import static net.osmand.plus.helpers.ExternalApiHelper.PARAM_NT_DIRECTION_TURN; import static net.osmand.plus.helpers.ExternalApiHelper.PARAM_NT_DISTANCE; import static net.osmand.plus.helpers.ExternalApiHelper.PARAM_NT_IMMINENT; import static net.osmand.plus.settings.backend.backup.SettingsHelper.REPLACE_KEY; +import static net.osmand.plus.settings.backend.backup.SettingsHelper.SILENT_IMPORT_KEY; public class OsmandAidlApi { @@ -2233,11 +2236,12 @@ public class OsmandAidlApi { } public boolean importProfileV2(final Uri profileUri, ArrayList settingsTypeKeys, boolean replace, - String latestChanges, int version) { + String latestChanges, int version) { if (profileUri != null) { Bundle bundle = new Bundle(); bundle.putStringArrayList(SettingsHelper.SETTINGS_TYPE_LIST_KEY, settingsTypeKeys); bundle.putBoolean(REPLACE_KEY, replace); + bundle.putBoolean(SILENT_IMPORT_KEY, true); bundle.putString(SettingsHelper.SETTINGS_LATEST_CHANGES_KEY, latestChanges); bundle.putInt(SettingsHelper.SETTINGS_VERSION_KEY, version); @@ -2324,6 +2328,15 @@ public class OsmandAidlApi { return mapActivity.getContextMenu().isVisible(); } + public int getPluginVersion(String pluginName) { + OsmandPlugin plugin = OsmandPlugin.getPlugin(pluginName); + if (plugin instanceof CustomOsmandPlugin) { + CustomOsmandPlugin customPlugin = (CustomOsmandPlugin) plugin; + return customPlugin.getVersion(); + } + return CANNOT_ACCESS_API_ERROR; + } + private static class FileCopyInfo { long startTime; long lastAccessTime; diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java index 78e7875d24..cac1426664 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java @@ -22,9 +22,9 @@ import net.osmand.aidlapi.contextmenu.ContextMenuButtonsParams; import net.osmand.aidlapi.contextmenu.RemoveContextMenuButtonsParams; import net.osmand.aidlapi.contextmenu.UpdateContextMenuButtonsParams; import net.osmand.aidlapi.copyfile.CopyFileParams; -import net.osmand.aidlapi.customization.MapMarginsParams; -import net.osmand.aidlapi.info.AppInfoParams; +import net.osmand.aidlapi.customization.CustomPluginParams; import net.osmand.aidlapi.customization.CustomizationInfoParams; +import net.osmand.aidlapi.customization.MapMarginsParams; import net.osmand.aidlapi.customization.OsmandSettingsInfoParams; import net.osmand.aidlapi.customization.OsmandSettingsParams; import net.osmand.aidlapi.customization.ProfileSettingsParams; @@ -48,6 +48,7 @@ import net.osmand.aidlapi.gpx.RemoveGpxParams; import net.osmand.aidlapi.gpx.ShowGpxParams; import net.osmand.aidlapi.gpx.StartGpxRecordingParams; import net.osmand.aidlapi.gpx.StopGpxRecordingParams; +import net.osmand.aidlapi.info.AppInfoParams; import net.osmand.aidlapi.lock.SetLockStateParams; import net.osmand.aidlapi.map.ALatLon; import net.osmand.aidlapi.map.SetMapLocationParams; @@ -1122,6 +1123,7 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener return UNKNOWN_API_ERROR; } } + @Override public long registerForKeyEvents(AKeyEventsParams params, final IOsmAndAidlCallback callback) { try { @@ -1356,6 +1358,20 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener return false; } } + + @Override + public int getPluginVersion(CustomPluginParams params) { + try { + OsmandAidlApi api = getApi("getPluginVersion"); + if (api != null) { + return api.getPluginVersion(params.getPluginId()); + } + } catch (Exception e) { + handleException(e); + return UNKNOWN_API_ERROR; + } + return CANNOT_ACCESS_API_ERROR; + } }; private void setCustomization(OsmandAidlApi api, CustomizationInfoParams params) { diff --git a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java index 9127fa0aef..9f3003e925 100644 --- a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java @@ -17,16 +17,6 @@ import net.osmand.PlatformUtil; import net.osmand.data.LatLon; import net.osmand.map.ITileSource; import net.osmand.map.WorldRegion; -import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.backup.SettingsHelper; -import net.osmand.plus.settings.backend.backup.AvoidRoadsSettingsItem; -import net.osmand.plus.settings.backend.backup.MapSourcesSettingsItem; -import net.osmand.plus.settings.backend.backup.PluginSettingsItem; -import net.osmand.plus.settings.backend.backup.PoiUiFiltersSettingsItem; -import net.osmand.plus.settings.backend.backup.ProfileSettingsItem; -import net.osmand.plus.settings.backend.backup.QuickActionsSettingsItem; -import net.osmand.plus.settings.backend.backup.SettingsHelper.SettingsCollectListener; -import net.osmand.plus.settings.backend.backup.SettingsItem; import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.DownloadResources; @@ -35,6 +25,16 @@ import net.osmand.plus.helpers.AvoidSpecificRoads; import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickActionRegistry; +import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.backup.AvoidRoadsSettingsItem; +import net.osmand.plus.settings.backend.backup.MapSourcesSettingsItem; +import net.osmand.plus.settings.backend.backup.PluginSettingsItem; +import net.osmand.plus.settings.backend.backup.PoiUiFiltersSettingsItem; +import net.osmand.plus.settings.backend.backup.ProfileSettingsItem; +import net.osmand.plus.settings.backend.backup.QuickActionsSettingsItem; +import net.osmand.plus.settings.backend.backup.SettingsHelper; +import net.osmand.plus.settings.backend.backup.SettingsHelper.SettingsCollectListener; +import net.osmand.plus.settings.backend.backup.SettingsItem; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; @@ -73,9 +73,12 @@ public class CustomOsmandPlugin extends OsmandPlugin { private List suggestedDownloadItems = new ArrayList<>(); private List customRegions = new ArrayList<>(); + private int version; + public CustomOsmandPlugin(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException { super(app); pluginId = json.getString("pluginId"); + version = json.optInt("version", -1); readAdditionalDataFromJson(json); readDependentFilesFromJson(json); loadResources(); @@ -86,6 +89,11 @@ public class CustomOsmandPlugin extends OsmandPlugin { return pluginId; } + @Override + public int getVersion() { + return version; + } + @Override public String getName() { return JsonUtils.getLocalizedResFromMap(app, names, app.getString(R.string.custom_osmand_plugin)); diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 54f45b7425..01203b6f72 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -123,8 +123,8 @@ public abstract class OsmandPlugin { return null; } - public String getVersion() { - return ""; + public int getVersion() { + return -1; } /** @@ -340,6 +340,7 @@ public abstract class OsmandPlugin { try { JSONObject json = new JSONObject(); json.put("pluginId", plugin.getId()); + json.put("version", plugin.getVersion()); plugin.writeAdditionalDataToJson(json); plugin.writeDependentFilesJson(json); itemsJson.put(json); diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java b/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java index 783e7791c5..e29139db23 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java @@ -42,6 +42,8 @@ import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenTyp import org.apache.commons.logging.Log; import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; public class PluginsFragment extends BaseOsmAndFragment implements PluginStateListener { @@ -138,6 +140,10 @@ public class PluginsFragment extends BaseOsmAndFragment implements PluginStateLi private void switchEnabled(@NonNull ConnectedApp connectedApp) { app.getAidlApi().switchEnabled(connectedApp); + OsmandPlugin plugin = OsmandPlugin.getPlugin(connectedApp.getPack()); + if (plugin != null) { + OsmandPlugin.enablePlugin(getActivity(), app, plugin, connectedApp.isEnabled()); + } adapter.notifyDataSetChanged(); } @@ -150,8 +156,26 @@ public class PluginsFragment extends BaseOsmAndFragment implements PluginStateLi PluginsListAdapter(Context context) { super(context, R.layout.plugins_list_item, new ArrayList<>()); - addAll(app.getAidlApi().getConnectedApps()); - addAll(OsmandPlugin.getVisiblePlugins()); + addAll(getFilteredPluginsAndApps()); + } + + private List getFilteredPluginsAndApps() { + List connectedApps = app.getAidlApi().getConnectedApps(); + List visiblePlugins = OsmandPlugin.getVisiblePlugins(); + + for (Iterator iterator = visiblePlugins.iterator(); iterator.hasNext(); ) { + OsmandPlugin plugin = iterator.next(); + for (ConnectedApp app : connectedApps) { + if (plugin.getId().equals(app.getPack())) { + iterator.remove(); + } + } + } + List list = new ArrayList<>(); + list.addAll(connectedApps); + list.addAll(visiblePlugins); + + return list; } @NonNull diff --git a/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java b/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java index c7cad00b0c..a46ae659b8 100644 --- a/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java @@ -70,6 +70,7 @@ import static net.osmand.plus.myplaces.FavoritesActivity.GPX_TAB; import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID; import static net.osmand.plus.settings.backend.backup.SettingsHelper.REPLACE_KEY; import static net.osmand.plus.settings.backend.backup.SettingsHelper.SETTINGS_TYPE_LIST_KEY; +import static net.osmand.plus.settings.backend.backup.SettingsHelper.SILENT_IMPORT_KEY; /** * @author Koen Rabaey @@ -210,7 +211,7 @@ public class ImportHelper { public static String getNameFromContentUri(OsmandApplication app, Uri contentUri) { try { String name; - Cursor returnCursor = app.getContentResolver().query(contentUri, new String[]{OpenableColumns.DISPLAY_NAME}, null, null, null); + Cursor returnCursor = app.getContentResolver().query(contentUri, new String[] {OpenableColumns.DISPLAY_NAME}, null, null, null); if (returnCursor != null && returnCursor.moveToFirst()) { int columnIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); if (columnIndex != -1) { @@ -267,6 +268,7 @@ public class ImportHelper { int version = extras.getInt(SettingsHelper.SETTINGS_VERSION_KEY, -1); String latestChanges = extras.getString(SettingsHelper.SETTINGS_LATEST_CHANGES_KEY); boolean replace = extras.getBoolean(REPLACE_KEY); + boolean silentImport = extras.getBoolean(SILENT_IMPORT_KEY); ArrayList settingsTypeKeys = extras.getStringArrayList(SETTINGS_TYPE_LIST_KEY); List settingsTypes = null; if (settingsTypeKeys != null) { @@ -275,18 +277,18 @@ public class ImportHelper { settingsTypes.add(ExportSettingsType.valueOf(key)); } } - handleOsmAndSettingsImport(intentUri, fileName, settingsTypes, replace, latestChanges, version, callback); + handleOsmAndSettingsImport(intentUri, fileName, settingsTypes, replace, silentImport, latestChanges, version, callback); } else { - handleOsmAndSettingsImport(intentUri, fileName, null, false, null, -1, + handleOsmAndSettingsImport(intentUri, fileName, null, false, false, null, -1, callback); } } protected void handleOsmAndSettingsImport(Uri uri, String name, final List settingsTypes, - final boolean replace, String latestChanges, int version, - CallbackWithObject> callback) { - executeImportTask(new SettingsImportTask(activity, uri, name, settingsTypes, replace, latestChanges, version, - callback)); + final boolean replace, boolean silentImport, String latestChanges, int version, + CallbackWithObject> callback) { + executeImportTask(new SettingsImportTask(activity, uri, name, settingsTypes, replace, silentImport, + latestChanges, version, callback)); } protected void handleXmlFileImport(Uri intentUri, String fileName, CallbackWithObject routingCallback) { diff --git a/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java b/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java index 75c8d55015..afd2a525c4 100644 --- a/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java +++ b/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java @@ -17,10 +17,10 @@ import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.BaseLoadAsyncTask; import net.osmand.plus.settings.backend.ExportSettingsType; -import net.osmand.plus.settings.backend.backup.SettingsHelper; -import net.osmand.plus.settings.backend.backup.SettingsHelper.CheckDuplicatesListener; import net.osmand.plus.settings.backend.backup.PluginSettingsItem; import net.osmand.plus.settings.backend.backup.ProfileSettingsItem; +import net.osmand.plus.settings.backend.backup.SettingsHelper; +import net.osmand.plus.settings.backend.backup.SettingsHelper.CheckDuplicatesListener; import net.osmand.plus.settings.backend.backup.SettingsHelper.SettingsCollectListener; import net.osmand.plus.settings.backend.backup.SettingsHelper.SettingsImportListener; import net.osmand.plus.settings.backend.backup.SettingsItem; @@ -42,19 +42,21 @@ class SettingsImportTask extends BaseLoadAsyncTask { private String name; private List settingsTypes; private boolean replace; + private boolean silentImport; private String latestChanges; private int version; private CallbackWithObject> callback; public SettingsImportTask(@NonNull FragmentActivity activity, @NonNull Uri uri, - @NonNull String name, List settingsTypes, - boolean replace, String latestChanges, int version, - CallbackWithObject> callback) { + @NonNull String name, List settingsTypes, + boolean replace, boolean silentImport, String latestChanges, int version, + CallbackWithObject> callback) { super(activity); this.uri = uri; this.name = name; this.settingsTypes = settingsTypes; this.replace = replace; + this.silentImport = silentImport; this.latestChanges = latestChanges; this.version = version; this.callback = callback; @@ -93,7 +95,7 @@ class SettingsImportTask extends BaseLoadAsyncTask { if (!pluginIndependentItems.isEmpty()) { if (settingsTypes == null) { FragmentActivity activity = activityRef.get(); - if (activity != null) { + if (!silentImport && activity != null) { FragmentManager fragmentManager = activity.getSupportFragmentManager(); ImportSettingsFragment.showInstance(fragmentManager, pluginIndependentItems, file); } @@ -141,7 +143,7 @@ class SettingsImportTask extends BaseLoadAsyncTask { ((MapActivity) activity).getMapLayers().getMapWidgetRegistry().updateVisibleWidgets(); ((MapActivity) activity).updateApplicationModeSettings(); } - if (file != null && activity != null) { + if (!silentImport && file != null && activity != null) { FragmentManager fm = activity.getSupportFragmentManager(); ImportCompleteFragment.showInstance(fm, items, file.getName()); } @@ -188,11 +190,14 @@ class SettingsImportTask extends BaseLoadAsyncTask { if (!Algorithms.isEmpty(plugin.getRouterNames())) { loadRoutingFiles(app, null); } - if (activity != null) { + if (!silentImport && activity != null) { plugin.onInstall(app, activity); } String pluginId = pluginItem.getPluginId(); - File pluginDir = new File(app.getAppPath(null), IndexConstants.PLUGINS_DIR + pluginId); + File pluginDir = app.getAppPath(IndexConstants.PLUGINS_DIR + pluginId); + if (!pluginDir.exists()) { + pluginDir.mkdirs(); + } app.getSettingsHelper().exportSettings(pluginDir, "items", null, items, false); } }; diff --git a/OsmAnd/src/net/osmand/plus/importfiles/ZipImportTask.java b/OsmAnd/src/net/osmand/plus/importfiles/ZipImportTask.java index afdb7a32f2..a086db3e6b 100644 --- a/OsmAnd/src/net/osmand/plus/importfiles/ZipImportTask.java +++ b/OsmAnd/src/net/osmand/plus/importfiles/ZipImportTask.java @@ -86,7 +86,7 @@ public class ZipImportTask extends BaseLoadAsyncTask { } else if (importType == ImportType.SETTINGS) { String name = createUniqueFileName(app, "settings", TEMP_DIR, OSMAND_SETTINGS_FILE_EXT); importHelper.handleOsmAndSettingsImport(uri, name + OSMAND_SETTINGS_FILE_EXT, - null, false, null, -1, null); + null, false, false, null, -1, null); } } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/PluginSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/PluginSettingsItem.java index 32d6a04e22..203ea37661 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/PluginSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/PluginSettingsItem.java @@ -99,6 +99,7 @@ public class PluginSettingsItem extends SettingsItem { @Override void writeToJson(@NonNull JSONObject json) throws JSONException { super.writeToJson(json); + json.put("version", plugin.getVersion()); plugin.writeAdditionalDataToJson(json); } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java index 6c3cf25178..059206401f 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -95,6 +95,7 @@ public class SettingsHelper { public static final String SETTINGS_TYPE_LIST_KEY = "settings_type_list_key"; public static final String REPLACE_KEY = "replace"; + public static final String SILENT_IMPORT_KEY = "silent_import"; public static final String SETTINGS_LATEST_CHANGES_KEY = "settings_latest_changes"; public static final String SETTINGS_VERSION_KEY = "settings_version";