Buggy code:
private SavingTrackHelper savingTrackHelper ; private RoutingHelper routingHelper ; private boolean sensorRegistered = false ; private NotificationManager mNotificationManager ; private int APP_NOTIFICATION_ID ; private Handler uiHandler = new Handler ( ) ; private int currentScreenOrientation ; private Dialog progressDlg = null ; private OsmandSettings settings ; private Integer previousMapRotate = null ; private RouteAnimation routeAnimation = new RouteAnimation ( ) ; private boolean isMapLinkedToLocation = false ; private ProgressDialog startProgressDialog ; private List < DialogProvider > dialogProviders = new ArrayList < DialogProvider > ( 2 ) ; private Notification getNotification ( ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override protected void onResume ( ) { } private void notRestoreRoutingMode ( ) { } private void restoreRoutingMode ( final LatLon pointToNavigate ) { } OsmandApplication getMyApplication ( ) { } private void addDialogProvider ( DialogProvider dp ) { } @ Override protected Dialog onCreateDialog ( int id ) { } @ Override protected void onPrepareDialog ( int id , Dialog dialog ) { } public void changeZoom ( int newZoom ) { } public void backToMainMenu ( ) { } @ Override public boolean onKeyDown ( int keyCode , KeyEvent event ) { } public void setMapLocation ( double lat , double lon ) { } @ Override public boolean onTrackballEvent ( MotionEvent event ) { } @ Override protected void onStart ( ) { } protected void setProgressDlg ( Dialog progressDlg ) { } protected Dialog getProgressDlg ( ) { } @ Override protected void onStop ( ) { } @ Override protected void onDestroy ( ) { } private void registerUnregisterSensor ( Location location ) { } public void backToLocationImpl ( ) { } private void updateSpeedBearing ( Location location ) { } public void setLocation ( Location location ) { if ( Log . isLoggable ( TAG , DEBUG ) ) { Log . d ( TAG , ( "Location<seq2seq4repair_space>changed<seq2seq4repair_space>" + ( location . getProvider ( ) ) ) ) ; } if ( ( location != null ) && ( settings . SAVE_TRACK_TO_GPX . get ( ) ) ) { if ( ( ! ( location . hasAccuracy ( ) ) ) || ( ( location . getAccuracy ( ) ) < ( MapActivity . ACCURACY_FOR_GPX_AND_ROUTING ) ) ) { savingTrackHelper . insertData ( location . getLatitude ( ) , location . getLongitude ( ) , location . getAltitude ( ) , location . getSpeed ( ) , location . getAccuracy ( ) , location . getTime ( ) , settings ) ; } } registerUnregisterSensor ( location ) ; updateSpeedBearing ( location ) ; mapLayers . getLocationLayer ( ) . setLastKnownLocation ( location ) ; if ( routingHelper . isFollowingMode ( ) ) { if ( ( ( location == null ) || ( ! ( location . hasAccuracy ( ) ) ) ) || ( ( location . getAccuracy ( ) ) < ( MapActivity . ACCURACY_FOR_GPX_AND_ROUTING ) ) ) { routingHelper . setCurrentLocation ( location ) ; if ( ( location != null ) && ( ( routingHelper . getLeftDistance ( ) ) > 0 ) ) { Message msg = Message . obtain ( uiHandler , new Runnable ( ) { @ Override public void run ( ) { if ( ( ( routingHelper . getLeftDistance ( ) ) > 0 ) && ( settings . MAP_ACTIVITY_ENABLED . get ( ) ) ) { routingHelper . getVoiceRouter ( ) . gpsLocationLost ( ) ; } } } ) ; msg . what = MapActivity . LOST_LOCATION_MSG_ID ; uiHandler . removeMessages ( MapActivity . LOST_LOCATION_MSG_ID ) ; uiHandler . sendMessageDelayed ( msg , MapActivity . LOST_LOCATION_CHECK_DELAY ) ; } } } if ( location != null ) { if ( isMapLinkedToLocation ( ) ) { if ( ( settings . AUTO_ZOOM_MAP . get ( ) ) && ( location . hasSpeed ( ) ) ) { int z = defineZoomFromSpeed ( location . getSpeed ( ) , mapView . getZoom ( ) ) ; if ( ( ( mapView . getZoom ( ) ) != z ) && ( ! ( mapView . mapIsAnimating ( ) ) ) ) { <START_BUG> long now = SystemClock . elapsedRealtime ( ) ; <END_BUG> if ( ( ( Math . abs ( ( ( mapView . getZoom ( ) ) - z ) ) ) > 1 ) || ( ( ( lastTimeAutoZooming ) - now ) > 6500 ) ) { lastTimeAutoZooming = now ; mapView . setZoom ( z ) ; } } } int currentMapRotation = settings . ROTATE_MAP . get ( ) ; if ( ( location . hasBearing ( ) ) && ( currentMapRotation == ( OsmandSettings . ROTATE_MAP_BEARING ) ) ) { mapView . setRotate ( ( - ( location . getBearing ( ) ) ) ) ; } mapView . setLatLon ( location . getLatitude ( ) , location . getLongitude ( ) ) ; } else { if ( ! ( mapLayers . getMapInfoLayer ( ) . getBackToLocation ( ) . isEnabled ( ) ) ) { mapLayers . getMapInfoLayer ( ) . getBackToLocation ( ) . setEnabled ( true ) ; } } } else { if ( mapLayers . getMapInfoLayer ( ) . getBackToLocation ( ) . isEnabled ( ) ) { mapLayers . getMapInfoLayer ( ) . getBackToLocation ( ) . setEnabled ( false ) ; } } mapView . refreshMap ( ) ; } public int defineZoomFromSpeed ( float speed , int currentZoom ) { } public void navigateToPoint ( LatLon point ) { } public Location getLastKnownLocation ( ) { } public LatLon getMapLocation ( ) { } public LatLon getPointToNavigate ( ) { } public RoutingHelper getRoutingHelper ( ) { } private boolean isRunningOnEmulator ( ) { } private boolean useOnlyGPS ( ) { } private LocationListener networkListener = new LocationListener ( ) { @ Override public void onLocationChanged ( Location location ) { } @ Override public void onProviderDisabled ( String provider ) { }

Fix:
long now = System . currentTimeMillis ( ) ;