summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/service/playback
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-03-29 11:09:47 +0100
committerdaniel oeh <daniel.oeh@gmail.com>2014-03-29 11:09:47 +0100
commitae849077c78770f096f40e9360250b9e32d14f40 (patch)
treecbc030c6c942d9ad42d633415a1cb0e1d79b5196 /src/de/danoeh/antennapod/service/playback
parentb5a3c72ac8cfa5b5c5f2af4321f851b5bb293d35 (diff)
parentb2de7512f4c871e882760bfe8bffa27d10c1c68a (diff)
downloadAntennaPod-ae849077c78770f096f40e9360250b9e32d14f40.zip
Merge branch 'develop'0.9.8.3
Diffstat (limited to 'src/de/danoeh/antennapod/service/playback')
-rw-r--r--src/de/danoeh/antennapod/service/playback/PlaybackService.java80
-rw-r--r--src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java44
-rw-r--r--src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java26
-rw-r--r--src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java12
4 files changed, 86 insertions, 76 deletions
diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackService.java b/src/de/danoeh/antennapod/service/playback/PlaybackService.java
index 6bc8c4127..fb2569bfd 100644
--- a/src/de/danoeh/antennapod/service/playback/PlaybackService.java
+++ b/src/de/danoeh/antennapod/service/playback/PlaybackService.java
@@ -22,7 +22,7 @@ import android.util.Log;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.AudioplayerActivity;
@@ -153,7 +153,7 @@ public class PlaybackService extends Service {
@Override
public boolean onUnbind(Intent intent) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received onUnbind event");
return super.onUnbind(intent);
}
@@ -196,7 +196,7 @@ public class PlaybackService extends Service {
@Override
public void onCreate() {
super.onCreate();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Service created.");
isRunning = true;
@@ -218,7 +218,7 @@ public class PlaybackService extends Service {
@Override
public void onDestroy() {
super.onDestroy();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Service is about to be destroyed");
isRunning = false;
started = false;
@@ -234,7 +234,7 @@ public class PlaybackService extends Service {
@Override
public IBinder onBind(Intent intent) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received onBind event");
return mBinder;
}
@@ -243,7 +243,7 @@ public class PlaybackService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "OnStartCommand called");
final int keycode = intent.getIntExtra(MediaButtonReceiver.EXTRA_KEYCODE, -1);
final Playable playable = intent.getParcelableExtra(EXTRA_PLAYABLE);
@@ -253,12 +253,12 @@ public class PlaybackService extends Service {
}
if ((flags & Service.START_FLAG_REDELIVERY) != 0) {
- if (AppConfig.DEBUG) Log.d(TAG, "onStartCommand is a redelivered intent, calling stopForeground now.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "onStartCommand is a redelivered intent, calling stopForeground now.");
stopForeground(true);
} else {
if (keycode != -1) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received media button event");
handleKeycode(keycode);
} else {
@@ -279,7 +279,7 @@ public class PlaybackService extends Service {
* Handles media button events
*/
private void handleKeycode(int keycode) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Handling keycode: " + keycode);
final PlayerStatus status = mediaPlayer.getPSMPInfo().playerStatus;
@@ -326,7 +326,7 @@ public class PlaybackService extends Service {
* mediaplayer.
*/
public void setVideoSurface(SurfaceHolder sh) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Setting display");
mediaPlayer.setVideoSurface(sh);
}
@@ -394,15 +394,18 @@ public class PlaybackService extends Service {
break;
case PLAYING:
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Audiofocus successfully requested");
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Resuming/Starting playback");
taskManager.startPositionSaver();
taskManager.startWidgetUpdater();
setupNotification(newInfo);
break;
+ case ERROR:
+ writePlaybackPreferencesNoMediaPlaying();
+ break;
}
@@ -451,7 +454,7 @@ public class PlaybackService extends Service {
mediaPlayer.pause(true, false);
}
sendNotificationBroadcast(NOTIFICATION_TYPE_ERROR, what);
- setCurrentlyPlayingMedia(PlaybackPreferences.NO_MEDIA_PLAYING);
+ writePlaybackPreferencesNoMediaPlaying();
stopSelf();
return true;
}
@@ -469,7 +472,7 @@ public class PlaybackService extends Service {
};
private void endPlayback(boolean playNextEpisode) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Playback ended");
final Playable media = mediaPlayer.getPSMPInfo().playable;
@@ -509,7 +512,7 @@ public class PlaybackService extends Service {
playNextEpisode = playNextEpisode && loadNextItem
&& UserPreferences.isFollowQueue();
if (loadNextItem) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Loading next item in queue");
nextMedia = nextItem.getMedia();
}
@@ -518,11 +521,11 @@ public class PlaybackService extends Service {
final boolean stream;
if (playNextEpisode) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Playback of next episode will start immediately.");
prepareImmediately = startWhenPrepared = true;
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "No more episodes available to play");
prepareImmediately = startWhenPrepared = false;
@@ -530,7 +533,7 @@ public class PlaybackService extends Service {
stopWidgetUpdater();
}
- writePlaybackPreferences();
+ writePlaybackPreferencesNoMediaPlaying();
if (nextMedia != null) {
stream = !media.localFileAvailable();
mediaPlayer.playMediaObject(nextMedia, stream, startWhenPrepared, prepareImmediately);
@@ -543,7 +546,7 @@ public class PlaybackService extends Service {
}
public void setSleepTimer(long waitingTime) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Setting sleep timer to " + Long.toString(waitingTime)
+ " milliseconds");
taskManager.setSleepTimer(waitingTime);
@@ -555,9 +558,22 @@ public class PlaybackService extends Service {
sendNotificationBroadcast(NOTIFICATION_TYPE_SLEEPTIMER_UPDATE, 0);
}
+ private void writePlaybackPreferencesNoMediaPlaying() {
+ SharedPreferences.Editor editor = PreferenceManager
+ .getDefaultSharedPreferences(getApplicationContext()).edit();
+ editor.putLong(PlaybackPreferences.PREF_CURRENTLY_PLAYING_MEDIA,
+ PlaybackPreferences.NO_MEDIA_PLAYING);
+ editor.putLong(PlaybackPreferences.PREF_CURRENTLY_PLAYING_FEED_ID,
+ PlaybackPreferences.NO_MEDIA_PLAYING);
+ editor.putLong(
+ PlaybackPreferences.PREF_CURRENTLY_PLAYING_FEEDMEDIA_ID,
+ PlaybackPreferences.NO_MEDIA_PLAYING);
+ editor.commit();
+ }
+
private void writePlaybackPreferences() {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Writing playback preferences");
SharedPreferences.Editor editor = PreferenceManager
@@ -641,7 +657,7 @@ public class PlaybackService extends Service {
@Override
protected Void doInBackground(Void... params) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Starting background work");
if (android.os.Build.VERSION.SDK_INT >= 11) {
if (info.playable != null) {
@@ -701,7 +717,7 @@ public class PlaybackService extends Service {
notification = notificationBuilder.getNotification();
}
startForeground(NOTIFICATION_ID, notification);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Notification set up");
}
}
@@ -728,7 +744,7 @@ public class PlaybackService extends Service {
float playbackSpeed = getCurrentPlaybackSpeed();
final Playable playable = mediaPlayer.getPSMPInfo().playable;
if (position != INVALID_TIME && duration != INVALID_TIME && playable != null) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Saving current position to " + position);
if (updatePlayedDuration && playable instanceof FeedMedia) {
FeedMedia m = (FeedMedia) playable;
@@ -738,7 +754,7 @@ public class PlaybackService extends Service {
if (FlattrUtils.hasToken() && UserPreferences.isAutoFlattr() && item.getPaymentLink() != null && item.getFlattrStatus().getUnflattred() &&
(m.getPlayedDuration() > UserPreferences.getPlayedDurationAutoflattrThreshold() * duration)) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "saveCurrentPosition: performing auto flattr since played duration " + Integer.toString(m.getPlayedDuration())
+ " is " + UserPreferences.getPlayedDurationAutoflattrThreshold() * 100 + "% of file duration " + Integer.toString(duration));
item.getFlattrStatus().setFlattrQueue();
@@ -832,7 +848,7 @@ public class PlaybackService extends Service {
editor.apply();
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "RemoteControlClient state was refreshed");
}
}
@@ -876,10 +892,10 @@ public class PlaybackService extends Service {
intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) {
int state = intent.getIntExtra("state", -1);
if (state != -1) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Headset plug event. State is " + state);
if (state == UNPLUGGED) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Headset was unplugged during playback.");
pauseIfPauseOnDisconnect();
}
@@ -895,7 +911,7 @@ public class PlaybackService extends Service {
@Override
public void onReceive(Context context, Intent intent) {
// sound is about to change, eg. bluetooth -> speaker
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Pausing playback because audio is becoming noisy");
pauseIfPauseOnDisconnect();
}
@@ -928,7 +944,7 @@ public class PlaybackService extends Service {
public void onReceive(Context context, Intent intent) {
if (intent.getAction() != null &&
intent.getAction().equals(ACTION_SKIP_CURRENT_EPISODE)) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Received SKIP_CURRENT_EPISODE intent");
mediaPlayer.endPlayback();
}
@@ -1028,10 +1044,4 @@ public class PlaybackService extends Service {
return mediaPlayer.getVideoSize();
}
- private void setCurrentlyPlayingMedia(long id) {
- SharedPreferences.Editor editor = PreferenceManager
- .getDefaultSharedPreferences(getApplicationContext()).edit();
- editor.putLong(PlaybackPreferences.PREF_CURRENTLY_PLAYING_MEDIA, id);
- editor.commit();
- }
}
diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java b/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java
index 30f6de458..82759a902 100644
--- a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java
+++ b/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java
@@ -7,7 +7,7 @@ import android.media.RemoteControlClient;
import android.util.Log;
import android.util.Pair;
import android.view.SurfaceHolder;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.Chapter;
import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.preferences.UserPreferences;
@@ -75,7 +75,7 @@ public class PlaybackServiceMediaPlayer {
new RejectedExecutionHandler() {
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
- if (AppConfig.DEBUG) Log.d(TAG, "Rejected execution of runnable");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Rejected execution of runnable");
}
});
@@ -116,7 +116,7 @@ public class PlaybackServiceMediaPlayer {
public void playMediaObject(final Playable playable, final boolean stream, final boolean startWhenPrepared, final boolean prepareImmediately) {
if (playable == null)
throw new IllegalArgumentException("playable = null");
- if (AppConfig.DEBUG) Log.d(TAG, "Play media object.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Play media object.");
executor.submit(new Runnable() {
@Override
public void run() {
@@ -245,10 +245,10 @@ public class PlaybackServiceMediaPlayer {
media.onPlaybackStart();
} else {
- if (AppConfig.DEBUG) Log.e(TAG, "Failed to request audio focus");
+ if (BuildConfig.DEBUG) Log.e(TAG, "Failed to request audio focus");
}
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Call to resume() was ignored because current state of PSMP object is " + playerStatus);
}
}
@@ -271,7 +271,7 @@ public class PlaybackServiceMediaPlayer {
playerLock.lock();
if (playerStatus == PlayerStatus.PLAYING) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Pausing playback.");
mediaPlayer.pause();
setPlayerStatus(PlayerStatus.PAUSED, media);
@@ -284,7 +284,7 @@ public class PlaybackServiceMediaPlayer {
reinit();
}
} else {
- if (AppConfig.DEBUG) Log.d(TAG, "Ignoring call to pause: Player is in " + playerStatus + " state");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Ignoring call to pause: Player is in " + playerStatus + " state");
}
playerLock.unlock();
@@ -305,7 +305,7 @@ public class PlaybackServiceMediaPlayer {
playerLock.lock();
if (playerStatus == PlayerStatus.INITIALIZED) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Preparing media player");
setPlayerStatus(PlayerStatus.PREPARING, media);
try {
@@ -333,7 +333,7 @@ public class PlaybackServiceMediaPlayer {
throw new IllegalStateException("Player is not in PREPARING state");
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Resource prepared");
if (mediaType == MediaType.VIDEO) {
@@ -346,7 +346,7 @@ public class PlaybackServiceMediaPlayer {
}
if (media.getDuration() == 0) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Setting duration of media");
media.setDuration(mediaPlayer.getDuration());
}
@@ -375,7 +375,7 @@ public class PlaybackServiceMediaPlayer {
} else if (mediaPlayer != null) {
mediaPlayer.reset();
} else {
- if (AppConfig.DEBUG) Log.d(TAG, "Call to reinit was ignored: media and mediaPlayer were null");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Call to reinit was ignored: media and mediaPlayer were null");
}
playerLock.unlock();
}
@@ -385,14 +385,13 @@ public class PlaybackServiceMediaPlayer {
/**
* Seeks to the specified position. If the PSMP object is in an invalid state, this method will do nothing.
- * Invalid time values (< 0) will be ignored.
+ * @param t The position to seek to in milliseconds. t < 0 will be interpreted as t = 0
* <p/>
* This method is executed on the caller's thread.
*/
private void seekToSync(int t) {
if (t < 0) {
- if (AppConfig.DEBUG) Log.d(TAG, "Received invalid value for t");
- return;
+ t = 0;
}
playerLock.lock();
@@ -535,7 +534,7 @@ public class PlaybackServiceMediaPlayer {
if (media != null && media.getMediaType() == MediaType.AUDIO) {
if (mediaPlayer.canSetSpeed()) {
mediaPlayer.setPlaybackSpeed((float) speed);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Playback speed was set to " + speed);
callback.playbackSpeedChanged(speed);
}
@@ -611,7 +610,7 @@ public class PlaybackServiceMediaPlayer {
@Override
public void run() {
playerLock.lock();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Resetting video surface");
mediaPlayer.setDisplay(null);
reinit();
@@ -666,7 +665,7 @@ public class PlaybackServiceMediaPlayer {
private synchronized void setPlayerStatus(PlayerStatus newStatus, Playable newMedia) {
if (newStatus == null)
throw new IllegalArgumentException("newStatus = null");
- if (AppConfig.DEBUG) Log.d(TAG, "Setting player status to " + newStatus);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Setting player status to " + newStatus);
this.playerStatus = newStatus;
this.media = newMedia;
@@ -697,13 +696,13 @@ public class PlaybackServiceMediaPlayer {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_LOSS:
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Lost audio focus");
pause(true, false);
callback.shouldStop();
break;
case AudioManager.AUDIOFOCUS_GAIN:
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Gained audio focus");
if (pausedBecauseOfTransientAudiofocusLoss) // we paused => play now
resume();
@@ -714,13 +713,13 @@ public class PlaybackServiceMediaPlayer {
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
if (playerStatus == PlayerStatus.PLAYING) {
if (!UserPreferences.shouldPauseForFocusLoss()) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Lost audio focus temporarily. Ducking...");
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_LOWER, 0);
pausedBecauseOfTransientAudiofocusLoss = false;
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Lost audio focus temporarily. Could duck, but won't, pausing...");
pause(false, false);
pausedBecauseOfTransientAudiofocusLoss = true;
@@ -729,7 +728,7 @@ public class PlaybackServiceMediaPlayer {
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
if (playerStatus == PlayerStatus.PLAYING) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Lost audio focus temporarily. Pausing...");
pause(false, false);
pausedBecauseOfTransientAudiofocusLoss = true;
@@ -756,6 +755,7 @@ public class PlaybackServiceMediaPlayer {
mediaPlayer.reset();
}
+ audioManager.abandonAudioFocus(audioFocusChangeListener);
callback.endPlayback(true);
playerLock.unlock();
diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java b/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java
index 0c1878e18..3ab06910a 100644
--- a/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java
+++ b/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java
@@ -2,7 +2,7 @@ package de.danoeh.antennapod.service.playback;
import android.content.Context;
import android.util.Log;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.storage.DBReader;
@@ -144,9 +144,9 @@ public class PlaybackServiceTaskManager {
positionSaverFuture = schedExecutor.scheduleWithFixedDelay(positionSaver, POSITION_SAVER_WAITING_INTERVAL,
POSITION_SAVER_WAITING_INTERVAL, TimeUnit.MILLISECONDS);
- if (AppConfig.DEBUG) Log.d(TAG, "Started PositionSaver");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Started PositionSaver");
} else {
- if (AppConfig.DEBUG) Log.d(TAG, "Call to startPositionSaver was ignored.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Call to startPositionSaver was ignored.");
}
}
@@ -163,7 +163,7 @@ public class PlaybackServiceTaskManager {
public synchronized void cancelPositionSaver() {
if (isPositionSaverActive()) {
positionSaverFuture.cancel(false);
- if (AppConfig.DEBUG) Log.d(TAG, "Cancelled PositionSaver");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Cancelled PositionSaver");
}
}
@@ -181,9 +181,9 @@ public class PlaybackServiceTaskManager {
widgetUpdaterFuture = schedExecutor.scheduleWithFixedDelay(widgetUpdater, WIDGET_UPDATER_NOTIFICATION_INTERVAL,
WIDGET_UPDATER_NOTIFICATION_INTERVAL, TimeUnit.MILLISECONDS);
- if (AppConfig.DEBUG) Log.d(TAG, "Started WidgetUpdater");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Started WidgetUpdater");
} else {
- if (AppConfig.DEBUG) Log.d(TAG, "Call to startWidgetUpdater was ignored.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Call to startWidgetUpdater was ignored.");
}
}
@@ -198,7 +198,7 @@ public class PlaybackServiceTaskManager {
if (waitingTime <= 0)
throw new IllegalArgumentException("waitingTime <= 0");
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Setting sleep timer to " + Long.toString(waitingTime)
+ " milliseconds");
if (isSleepTimerActive()) {
@@ -220,7 +220,7 @@ public class PlaybackServiceTaskManager {
*/
public synchronized void disableSleepTimer() {
if (isSleepTimerActive()) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Disabling sleep timer");
sleepTimerFuture.cancel(true);
}
@@ -251,7 +251,7 @@ public class PlaybackServiceTaskManager {
public synchronized void cancelWidgetUpdater() {
if (isWidgetUpdaterActive()) {
widgetUpdaterFuture.cancel(false);
- if (AppConfig.DEBUG) Log.d(TAG, "Cancelled WidgetUpdater");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Cancelled WidgetUpdater");
}
}
@@ -281,7 +281,7 @@ public class PlaybackServiceTaskManager {
Runnable chapterLoader = new Runnable() {
@Override
public void run() {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Chapter loader started");
if (media.getChapters() == null) {
media.loadChapterMarks();
@@ -289,7 +289,7 @@ public class PlaybackServiceTaskManager {
callback.onChapterLoaded(media);
}
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Chapter loader stopped");
}
};
@@ -335,7 +335,7 @@ public class PlaybackServiceTaskManager {
@Override
public void run() {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Starting");
while (waitingTime > 0) {
try {
@@ -343,7 +343,7 @@ public class PlaybackServiceTaskManager {
waitingTime -= UPDATE_INTERVALL;
if (waitingTime <= 0) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Waiting completed");
postExecute();
if (!Thread.currentThread().isInterrupted()) {
diff --git a/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java b/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java
index 90ad7a9fa..71bc40c2a 100644
--- a/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java
+++ b/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java
@@ -12,7 +12,7 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.RemoteViews;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.receiver.PlayerWidget;
@@ -33,7 +33,7 @@ public class PlayerWidgetService extends Service {
@Override
public void onCreate() {
super.onCreate();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Service created");
isUpdating = false;
}
@@ -41,7 +41,7 @@ public class PlayerWidgetService extends Service {
@Override
public void onDestroy() {
super.onDestroy();
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Service is about to be destroyed");
try {
unbindService(mConnection);
@@ -65,7 +65,7 @@ public class PlayerWidgetService extends Service {
startViewUpdaterIfNotRunning();
}
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"Service was called while updating. Ignoring update request");
}
@@ -146,7 +146,7 @@ public class PlayerWidgetService extends Service {
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Connection to service established");
playbackService = ((PlaybackService.LocalBinder) service)
.getService();
@@ -156,7 +156,7 @@ public class PlayerWidgetService extends Service {
@Override
public void onServiceDisconnected(ComponentName name) {
playbackService = null;
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Disconnected from service");
}