From 522882c0cc9175d8302b3e640be38fafeaa8cbea Mon Sep 17 00:00:00 2001 From: Josh Kasten Date: Wed, 28 Sep 2011 21:11:45 -0500 Subject: [PATCH] Added back throwing of IllegalStateExceptions to startNewTrack and endCurrentTrack so they still are thrown when called from the ServiceBinder methods. --- .../apps/mytracks/services/TrackRecordingService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java index 948a94a9f..f89f65e45 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java +++ b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java @@ -573,6 +573,9 @@ public class TrackRecordingService extends Service { public long startNewTrack() { Log.d(TAG, "TrackRecordingService.startNewTrack"); + if (isTrackInProgress()) { + throw new IllegalStateException("A track is already in progress!"); + } long startTime = System.currentTimeMillis(); acquireWakeLock(); @@ -1008,6 +1011,9 @@ public class TrackRecordingService extends Service { private void endCurrentTrack() { Log.d(TAG, "TrackRecordingService.endCurrentTrack"); + if (!isTrackInProgress()) { + throw new IllegalStateException("No recording track in progress!"); + } announcementExecutor.shutdown(); splitExecutor.shutdown();