forked from upstream-mirrors/OpenTracks
Fixing some StrictMode violations, making it softer for others which the Android runtime itself triggers.
This commit is contained in:
@@ -316,6 +316,8 @@ public class TrackWriter {
|
|||||||
isLastValid = isValid;
|
isLastValid = isValid;
|
||||||
} while (locationsCursor.moveToNext());
|
} while (locationsCursor.moveToNext());
|
||||||
|
|
||||||
|
locationsCursor.close();
|
||||||
|
|
||||||
if (segmentOpen) {
|
if (segmentOpen) {
|
||||||
writer.writeCloseSegment();
|
writer.writeCloseSegment();
|
||||||
segmentOpen = false;
|
segmentOpen = false;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public class GingerbreadPlatformAdapter extends EclairPlatformAdapter {
|
|||||||
.detectDiskWrites()
|
.detectDiskWrites()
|
||||||
.detectNetwork()
|
.detectNetwork()
|
||||||
.penaltyLog()
|
.penaltyLog()
|
||||||
.penaltyDeath()
|
|
||||||
.build());
|
.build());
|
||||||
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
|
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
|
||||||
.detectAll()
|
.detectAll()
|
||||||
|
|||||||
+11
-7
@@ -824,14 +824,18 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
|||||||
@Override
|
@Override
|
||||||
public List<Track> getAllTracks() {
|
public List<Track> getAllTracks() {
|
||||||
Cursor cursor = getTracksCursor(null);
|
Cursor cursor = getTracksCursor(null);
|
||||||
if (cursor == null || !cursor.moveToFirst()) {
|
ArrayList<Track> tracks = new ArrayList<Track>();
|
||||||
return new ArrayList<Track>();
|
if (cursor != null) {
|
||||||
}
|
tracks.ensureCapacity(cursor.getCount());
|
||||||
|
|
||||||
List<Track> tracks = new ArrayList<Track>(cursor.getCount());
|
if (cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
tracks.add(createTrack(cursor));
|
tracks.add(createTrack(cursor));
|
||||||
} while(cursor.moveToNext());
|
} while(cursor.moveToNext());
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
return tracks;
|
return tracks;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user