mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-09 12:53:05 +02:00
An emergency fix for a NPE in the service.
This commit is contained in:
@@ -62,7 +62,6 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -228,7 +227,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return trackRecordingService.isRecording();
|
return trackRecordingService.isRecording();
|
||||||
} catch (RemoteException e) {
|
} catch (Exception e) { // TODO: Emergency fix.
|
||||||
Log.e(MyTracksConstants.TAG, "MyTracks: Remote exception.", e);
|
Log.e(MyTracksConstants.TAG, "MyTracks: Remote exception.", e);
|
||||||
|
|
||||||
// Fall back to alternative check method.
|
// Fall back to alternative check method.
|
||||||
@@ -908,7 +907,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker?");
|
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker?");
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (Exception e) { // TODO: Emergency fix.
|
||||||
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker.", e);
|
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker.", e);
|
||||||
@@ -948,7 +947,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?");
|
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?");
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (Exception e) { // TODO: Emergency fix.
|
||||||
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?", e);
|
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?", e);
|
||||||
@@ -1016,7 +1015,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
setSelectedTrackId(recordingTrackId);
|
setSelectedTrackId(recordingTrackId);
|
||||||
Toast.makeText(this, getString(R.string.status_now_recording),
|
Toast.makeText(this, getString(R.string.status_now_recording),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
} catch (RemoteException e) {
|
} catch (Exception e) { // TODO: Emergency fix.
|
||||||
Toast.makeText(this,
|
Toast.makeText(this,
|
||||||
getString(R.string.error_unable_to_start_recording),
|
getString(R.string.error_unable_to_start_recording),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
@@ -1049,7 +1048,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
long currentTrackId = recordingTrackId;
|
long currentTrackId = recordingTrackId;
|
||||||
try {
|
try {
|
||||||
trackRecordingService.endCurrentTrack();
|
trackRecordingService.endCurrentTrack();
|
||||||
} catch (RemoteException e) {
|
} catch (Exception e) { // TODO: Emergency fix.
|
||||||
Log.e(MyTracksConstants.TAG, "Unable to stop recording.", e);
|
Log.e(MyTracksConstants.TAG, "Unable to stop recording.", e);
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(MyTracks.this, MyTracksDetails.class);
|
Intent intent = new Intent(MyTracks.this, MyTracksDetails.class);
|
||||||
|
|||||||
@@ -725,7 +725,8 @@ public class TrackRecordingService extends Service implements LocationListener {
|
|||||||
locationManager = null;
|
locationManager = null;
|
||||||
notificationManager = null;
|
notificationManager = null;
|
||||||
providerUtils = null;
|
providerUtils = null;
|
||||||
binder.detachFromService();
|
// TODO: Emergency fix to avoid NPE for buggy activities.
|
||||||
|
//binder.detachFromService();
|
||||||
binder = null;
|
binder = null;
|
||||||
|
|
||||||
// This should be the last operation.
|
// This should be the last operation.
|
||||||
|
|||||||
Reference in New Issue
Block a user