diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index cb1a602862..a629a911d7 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -294,16 +294,6 @@
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"/>
-
-
-
-
-
-
-
-
diff --git a/android/res/values/donottranslate.xml b/android/res/values/donottranslate.xml
index 52c8adbf46..a0235e33b0 100644
--- a/android/res/values/donottranslate.xml
+++ b/android/res/values/donottranslate.xml
@@ -28,9 +28,6 @@
AutoDownloadMap
3D
3DBuildings
- TrackScreen
- TrackRecord
- TrackRecordTime
Osm profile
AutoZoom
LargeFontSize
diff --git a/android/res/xml/prefs_main.xml b/android/res/xml/prefs_main.xml
index 935de53239..385e7d8d3b 100644
--- a/android/res/xml/prefs_main.xml
+++ b/android/res/xml/prefs_main.xml
@@ -40,28 +40,6 @@
android:title="@string/whatsnew_transliteration_title"
android:defaultValue="false"
android:order="7"/>
-
-
-
-
-
-{
- INSTANCE;
-
- @NonNull
- private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.TRACK_RECORDER);
-
- private static final String TAG = TrackRecorder.class.getSimpleName();
-
- private static final long WAKEUP_INTERVAL_MS = 20000;
- private static final long STARTUP_AWAIT_INTERVAL_MS = 5000;
-
- private static final String LOCATION_TIMEOUT_STORED_KEY = "TrackRecordLastAwaitTimeout";
- private static final long LOCATION_TIMEOUT_MIN_MS = 5000;
- private static final long LOCATION_TIMEOUT_MAX_MS = 80000;
-
- private boolean mInitialized = false;
-
- @SuppressWarnings("NotNullFieldNotInitialized")
- @NonNull
- private Context mContext;
- @NonNull
- private AlarmManager mAlarmManager;
- @NonNull
- private final Runnable mStartupAwaitProc = this::restartAlarmIfEnabled;
- @NonNull
- private final LocationListener mLocationListener = new LocationListener.Simple()
- {
- @Override
- public void onLocationUpdated(Location location)
- {
- LOGGER.d(TAG, "onLocationUpdated()");
- setAwaitTimeout(LOCATION_TIMEOUT_MIN_MS);
- LocationHelper.INSTANCE.onLocationUpdated(location);
- TrackRecorderWakeService.stop();
- }
-
- @Override
- public void onLocationError(int errorCode)
- {
- LOGGER.e(TAG, "onLocationError() errorCode: " + errorCode);
- // Unrecoverable error occured: GPS disabled or inaccessible
- setEnabled(false);
- }
- };
-
- @Override
- public void initialize(@Nullable Context context)
- {
- LOGGER.d(TAG, "Initialization of track recorder and setting the listener for track changes");
- mContext = context;
- mAlarmManager = (AlarmManager) MwmApplication.from(context)
- .getSystemService(Context.ALARM_SERVICE);
-
- MwmApplication.backgroundTracker(context).addListener(foreground -> {
- LOGGER.d(TAG, "Transit to foreground: " + foreground);
-
- UiThread.cancelDelayedTasks(mStartupAwaitProc);
- if (foreground)
- TrackRecorderWakeService.stop();
- else
- restartAlarmIfEnabled();
- });
-
- if (nativeIsEnabled())
- UiThread.runLater(mStartupAwaitProc, STARTUP_AWAIT_INTERVAL_MS);
- else
- stop();
-
- mInitialized = true;
- }
-
- @Override
- public void destroy()
- {
- // No op.
- }
-
- private void checkInitialization()
- {
- if (!mInitialized)
- throw new AssertionError("Track recorder is not initialized!");
- }
-
- private PendingIntent getAlarmIntent()
- {
- Intent intent = new Intent(MwmApplication.from(mContext), TrackRecorderWakeReceiver.class);
- return PendingIntent.getBroadcast(MwmApplication.from(mContext), 0, intent, 0);
- }
-
- private void restartAlarmIfEnabled()
- {
- LOGGER.d(TAG, "restartAlarmIfEnabled()");
- if (nativeIsEnabled())
- mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + WAKEUP_INTERVAL_MS, getAlarmIntent());
- }
-
- private void stop()
- {
- LOGGER.d(TAG, "stop(). Cancel awake timer");
- mAlarmManager.cancel(getAlarmIntent());
- TrackRecorderWakeService.stop();
- }
-
- public boolean isEnabled()
- {
- checkInitialization();
- return nativeIsEnabled();
- }
-
- public void setEnabled(boolean enabled)
- {
- checkInitialization();
- LOGGER.d(TAG, "setEnabled(): " + enabled);
-
- setAwaitTimeout(LOCATION_TIMEOUT_MIN_MS);
- nativeSetEnabled(enabled);
-
- if (enabled)
- restartAlarmIfEnabled();
- else
- stop();
- }
-
- public int getDuration()
- {
- checkInitialization();
- return nativeGetDuration();
- }
-
- public void setDuration(int hours)
- {
- checkInitialization();
- nativeSetDuration(hours);
- }
-
- void onWakeAlarm()
- {
- LOGGER.d(TAG, "onWakeAlarm(). Enabled: " + nativeIsEnabled());
-
- UiThread.cancelDelayedTasks(mStartupAwaitProc);
-
- if (nativeIsEnabled() && !MwmApplication.backgroundTracker(mContext).isForeground())
- TrackRecorderWakeService.start(mContext);
- else
- stop();
- }
-
- long getAwaitTimeout()
- {
- return MwmApplication.prefs(mContext).getLong(LOCATION_TIMEOUT_STORED_KEY, LOCATION_TIMEOUT_MIN_MS);
- }
-
- private void setAwaitTimeout(long timeout)
- {
- LOGGER.d(TAG, "setAwaitTimeout(): " + timeout);
-
- if (timeout != getAwaitTimeout())
- MwmApplication.prefs(mContext).edit().putLong(LOCATION_TIMEOUT_STORED_KEY, timeout).apply();
- }
-
- void incrementAwaitTimeout()
- {
- long current = getAwaitTimeout();
- long next = current * 2;
- if (next > LOCATION_TIMEOUT_MAX_MS)
- next = LOCATION_TIMEOUT_MAX_MS;
-
- if (next != current)
- setAwaitTimeout(next);
- }
-
- void onServiceStarted()
- {
- LOGGER.d(TAG, "onServiceStarted(). Scheduled to be run on UI thread...");
-
- UiThread.run(() -> {
- LOGGER.d(TAG, "onServiceStarted(): actually runs here");
- LocationHelper.INSTANCE.addListener(mLocationListener, false);
- });
- }
-
- void onServiceStopped()
- {
- LOGGER.d(TAG, "onServiceStopped(). Scheduled to be run on UI thread...");
-
- UiThread.run(() -> {
- LOGGER.d(TAG, "onServiceStopped(): actually runs here");
- LocationHelper.INSTANCE.removeListener(mLocationListener);
-
- if (!MwmApplication.backgroundTracker(mContext).isForeground())
- restartAlarmIfEnabled();
- });
- }
-
- private native void nativeSetEnabled(boolean enable);
- private native boolean nativeIsEnabled();
- private native void nativeSetDuration(int hours);
- private native int nativeGetDuration();
-}
diff --git a/android/src/com/mapswithme/maps/location/TrackRecorderWakeReceiver.java b/android/src/com/mapswithme/maps/location/TrackRecorderWakeReceiver.java
deleted file mode 100644
index 6629812363..0000000000
--- a/android/src/com/mapswithme/maps/location/TrackRecorderWakeReceiver.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mapswithme.maps.location;
-
-import android.content.Context;
-import android.content.Intent;
-
-import androidx.annotation.NonNull;
-
-import com.mapswithme.maps.MwmBroadcastReceiver;
-
-public class TrackRecorderWakeReceiver extends MwmBroadcastReceiver
-{
- @Override
- public void onReceiveInitialized(@NonNull Context context, @NonNull Intent intent)
- {
- TrackRecorder.INSTANCE.onWakeAlarm();
- }
-}
diff --git a/android/src/com/mapswithme/maps/location/TrackRecorderWakeService.java b/android/src/com/mapswithme/maps/location/TrackRecorderWakeService.java
deleted file mode 100644
index 7b556ecfd2..0000000000
--- a/android/src/com/mapswithme/maps/location/TrackRecorderWakeService.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.mapswithme.maps.location;
-
-import android.app.job.JobInfo;
-import android.app.job.JobScheduler;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-
-import androidx.annotation.NonNull;
-import androidx.core.app.JobIntentService;
-
-import com.mapswithme.maps.MwmJobIntentService;
-import com.mapswithme.maps.scheduling.JobIdMap;
-import com.mapswithme.util.CrashlyticsUtils;
-import com.mapswithme.util.log.Logger;
-import com.mapswithme.util.log.LoggerFactory;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-public class TrackRecorderWakeService extends MwmJobIntentService
-{
- private static final String TAG = TrackRecorderWakeService.class.getSimpleName();
- private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.TRACK_RECORDER);
- private static final Object sLock = new Object();
- private static TrackRecorderWakeService sService;
- private final CountDownLatch mWaitMonitor = new CountDownLatch(1);
-
- @Override
- protected void onHandleWorkInitialized(@NonNull Intent intent)
- {
- synchronized (sLock)
- {
- sService = this;
- }
- TrackRecorder.INSTANCE.onServiceStarted();
-
- try
- {
- long timeout = TrackRecorder.INSTANCE.getAwaitTimeout();
- LOGGER.d(TAG, "Timeout: " + timeout);
-
- if (!mWaitMonitor.await(timeout, TimeUnit.MILLISECONDS))
- {
- LOGGER.d(TAG, "TIMEOUT awaiting coordinates");
- TrackRecorder.INSTANCE.incrementAwaitTimeout();
- }
- } catch (InterruptedException ignored) {}
-
- synchronized (sLock)
- {
- sService = null;
- }
-
- TrackRecorder.INSTANCE.onServiceStopped();
- }
-
- public static void start(@NonNull Context context)
- {
- Context app = context.getApplicationContext();
-
- Intent intent = new Intent(app, TrackRecorderWakeService.class);
- final int jobId = JobIdMap.getId(TrackRecorderWakeService.class);
- JobScheduler scheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
- Objects.requireNonNull(scheduler);
- List pendingJobs = scheduler.getAllPendingJobs();
- String jobsRepresentation = Arrays.toString(pendingJobs.toArray());
- for (JobInfo each : pendingJobs)
- {
- if (TrackRecorderWakeService.class.getName().equals(each.getService().getClassName()))
- {
- scheduler.cancel(each.getId());
- String logMsg = "Canceled job: " + each + ". All jobs: " + jobsRepresentation;
- CrashlyticsUtils.INSTANCE.log(Log.INFO, TAG, logMsg);
- }
- }
- JobIntentService.enqueueWork(app, TrackRecorderWakeService.class, jobId, intent);
- }
-
- public static void stop()
- {
- LOGGER.d(TAG, "SVC.stop()");
-
- synchronized (sLock)
- {
- if (sService != null)
- sService.mWaitMonitor.countDown();
- else
- LOGGER.d(TAG, "SVC.stop() SKIPPED because (sService == null)");
- }
- }
-}
diff --git a/android/src/com/mapswithme/maps/scheduling/JobIdMap.java b/android/src/com/mapswithme/maps/scheduling/JobIdMap.java
index 7cce57837e..41efffb72f 100644
--- a/android/src/com/mapswithme/maps/scheduling/JobIdMap.java
+++ b/android/src/com/mapswithme/maps/scheduling/JobIdMap.java
@@ -2,7 +2,6 @@ package com.mapswithme.maps.scheduling;
import com.mapswithme.maps.background.OsmUploadService;
import com.mapswithme.maps.background.SystemDownloadCompletedService;
-import com.mapswithme.maps.location.TrackRecorderWakeService;
import java.util.HashMap;
import java.util.Map;
@@ -12,7 +11,6 @@ public class JobIdMap
private static final Map, Integer> MAP = new HashMap<>();
static {
- MAP.put(TrackRecorderWakeService.class, calcIdentifier(MAP.size()));
MAP.put(SystemDownloadCompletedService.class, calcIdentifier(MAP.size()));
MAP.put(OsmUploadService.class, calcIdentifier(MAP.size()));
}
diff --git a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java
index 26cc887d7c..eaf3127c94 100644
--- a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java
+++ b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java
@@ -25,13 +25,11 @@ import androidx.preference.TwoStatePreference;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.R;
-import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.maps.downloader.MapManager;
import com.mapswithme.maps.downloader.OnmapDownloader;
import com.mapswithme.maps.editor.ProfileActivity;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.location.LocationProviderFactory;
-import com.mapswithme.maps.location.TrackRecorder;
import com.mapswithme.maps.sound.LanguageData;
import com.mapswithme.maps.sound.TtsPlayer;
import com.mapswithme.util.Config;
@@ -298,7 +296,6 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
initTransliterationPrefsCallbacks();
init3dModePrefsCallbacks();
initPerspectivePrefsCallbacks();
- initTrackRecordPrefsCallbacks();
initPlayServicesPrefsCallbacks();
initAutoZoomPrefsCallbacks();
initLoggingEnabledPrefsCallbacks();
@@ -347,7 +344,6 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
{
super.onResume();
- initTrackRecordPrefsCallbacks();
updateTts();
}
@@ -599,68 +595,6 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
}
}
- private void initTrackRecordPrefsCallbacks()
- {
- final ListPreference trackPref = findPreference(getString(R.string.pref_track_record));
- final Preference pref = findPreference(getString(R.string.pref_track_record_time));
- final Preference root = findPreference(getString(R.string.pref_track_screen));
- if (trackPref == null || pref == null)
- return;
-
- boolean enabled = TrackRecorder.INSTANCE.isEnabled();
- ((TwoStatePreference)pref).setChecked(enabled);
- trackPref.setEnabled(enabled);
- if (root != null)
- root.setSummary(enabled ? R.string.on : R.string.off);
- pref.setTitle(enabled ? R.string.on : R.string.off);
- pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
- {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue)
- {
- boolean enabled = (Boolean) newValue;
- TrackRecorder.INSTANCE.setEnabled(enabled);
- trackPref.setEnabled(enabled);
- if (root != null)
- root.setSummary(enabled ? R.string.on : R.string.off);
- pref.setTitle(enabled ? R.string.on : R.string.off);
- trackPref.performClick();
- return true;
- }
- });
-
- String value = (enabled ? String.valueOf(TrackRecorder.INSTANCE.getDuration()) : "0");
- trackPref.setValue(value);
- trackPref.setSummary(trackPref.getEntry());
- trackPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
- {
- @Override
- public boolean onPreferenceChange(final Preference preference, Object newValue)
- {
- int value = Integer.valueOf((String)newValue);
- boolean enabled = value != 0;
- if (enabled)
- TrackRecorder.INSTANCE.setDuration(value);
- TrackRecorder.INSTANCE.setEnabled(enabled);
- ((TwoStatePreference) pref).setChecked(enabled);
- trackPref.setEnabled(enabled);
- if (root != null)
- root.setSummary(enabled ? R.string.on : R.string.off);
- pref.setTitle(enabled ? R.string.on : R.string.off);
-
- UiThread.runLater(new Runnable()
- {
- @Override
- public void run()
- {
- trackPref.setSummary(trackPref.getEntry());
- }
- });
- return true;
- }
- });
- }
-
private void init3dModePrefsCallbacks()
{
final TwoStatePreference pref = findPreference(getString(R.string.pref_3d_buildings));
diff --git a/data/strings/strings.txt b/data/strings/strings.txt
index ff2105c36b..627409f338 100644
--- a/data/strings/strings.txt
+++ b/data/strings/strings.txt
@@ -5020,7 +5020,7 @@
[pref_track_record_title]
comment = Settings «Map» category: «Record track» title
- tags = ios,android
+ tags = ios
en = Recent track
ru = Недавний путь
ar = المسار الأخير
@@ -5282,6 +5282,7 @@
fa = 1 روز
[recent_track_help_text]
+ tags = ios
en = This option allows you to record traveled path for a certain period and see it on the map. Please note: activation of this function causes increased battery usage. The track will be removed automatically from the map after the time interval will expire.
ru = Эта функция позволяет записывать пройденный путь за определенный период времени и видеть его на карте. Внимание: активация этой функции может привести к повышенному расходу батареи. Записанный трек будет удален с карты по истечении этого срока.
ar = يتيح لك تسجيل مسار السفر لفترة معينة وعرضه على الخريطة. الرجاء ملاحظة: يؤدي تنشيط هذه الوظيفة إلى زيادة استهلاك البطارية. سوف تتم إزالة المسار تلقائيًا من الخريطة بعد انتهاء الفاصل الزمني.
@@ -18930,6 +18931,7 @@
fa = خواندن
[recent_track_background_dialog_title]
+ tags = ios
comment = iOS dialog for the case when recent track recording is on and the app comes back from background
en = Disable recording of your recently traveled route?
ru = Выключить запись недавно пройденого пути?
@@ -18962,6 +18964,7 @@
fa = غیرفعال سازی ذخیره مسیر اخیرا طی شده
[off_recent_track_background_button]
+ tags = ios
en = Disable
ru = Выключить
ar = تعطيل
@@ -19025,6 +19028,7 @@
fa = بررسی کنید
[continue_recent_track_background_button]
+ tags = ios
en = Continue
ru = Продолжить
ar = استمرار
@@ -19055,6 +19059,7 @@
fa = ادامه
[recent_track_background_dialog_message]
+ tags = ios
en = Organic Maps uses your geoposition in the background for recording your recently traveled route.
ru = Organic Maps использует вашу геопозицию в фоновом режиме для записи недавно пройденного пути.
ar = يستخدم Organic Maps موقعك الجغرافي في الخلفية لتسجيل مسار سفرك الأخير.