An emergency fix for a NPE in the service.

This commit is contained in:
Bartlomiej Niechwiej
2010-11-24 15:46:57 -08:00
parent 6661f91eb5
commit 4d80af4e06
2 changed files with 7 additions and 7 deletions
@@ -62,7 +62,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@@ -228,7 +227,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
}
try {
return trackRecordingService.isRecording();
} catch (RemoteException e) {
} catch (Exception e) { // TODO: Emergency fix.
Log.e(MyTracksConstants.TAG, "MyTracks: Remote exception.", e);
// 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?");
return -4;
}
} catch (RemoteException e) {
} catch (Exception e) { // TODO: Emergency fix.
Toast.makeText(this, R.string.error_unable_to_insert_marker,
Toast.LENGTH_LONG).show();
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?");
return -4;
}
} catch (RemoteException e) {
} catch (Exception e) { // TODO: Emergency fix.
Toast.makeText(this, R.string.error_unable_to_insert_marker,
Toast.LENGTH_LONG).show();
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?", e);
@@ -1016,7 +1015,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
setSelectedTrackId(recordingTrackId);
Toast.makeText(this, getString(R.string.status_now_recording),
Toast.LENGTH_SHORT).show();
} catch (RemoteException e) {
} catch (Exception e) { // TODO: Emergency fix.
Toast.makeText(this,
getString(R.string.error_unable_to_start_recording),
Toast.LENGTH_SHORT).show();
@@ -1049,7 +1048,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
long currentTrackId = recordingTrackId;
try {
trackRecordingService.endCurrentTrack();
} catch (RemoteException e) {
} catch (Exception e) { // TODO: Emergency fix.
Log.e(MyTracksConstants.TAG, "Unable to stop recording.", e);
}
Intent intent = new Intent(MyTracks.this, MyTracksDetails.class);
@@ -725,7 +725,8 @@ public class TrackRecordingService extends Service implements LocationListener {
locationManager = null;
notificationManager = null;
providerUtils = null;
binder.detachFromService();
// TODO: Emergency fix to avoid NPE for buggy activities.
//binder.detachFromService();
binder = null;
// This should be the last operation.