aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-14 13:07:05 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-14 13:07:05 +0100
commitbba3ad747bd456aec8e699c0986926de25f8a9a7 (patch)
tree11520666b17883741b2b0b6429f960613112c716 /src/main/java/de/pixart/messenger/services/XmppConnectionService.java
parent9580586ff08041f2047ea191094f1e66f526933a (diff)
reworked wakelock for video compression
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index a1fbf5314..1ce2b1922 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -171,6 +171,7 @@ public class XmppConnectionService extends Service {
public DatabaseBackend databaseBackend;
private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor(true);
private WakeLock wakeLock;
+ private WakeLock VideoCompressionWakeLock;
private long mLastActivity = 0;
private NotificationManager mNotifyManager;
private ContentObserver contactObserver = new ContentObserver(null) {
@@ -783,7 +784,7 @@ public class XmppConnectionService extends Service {
for (Account account : pingCandidates) {
final boolean lowTimeout = mLowPingTimeoutMode.contains(account.getJid().toBareJid());
account.getXmppConnection().sendPing();
- Log.d(Config.LOGTAG, account.getJid().toBareJid() + " send ping (action=" + action + ",lowTimeout=" + Boolean.toString(lowTimeout) + ")");
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + " send ping (action=" + action + ", lowTimeout=" + Boolean.toString(lowTimeout) + ")");
scheduleWakeUpCall(lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode());
}
}
@@ -1108,6 +1109,7 @@ public class XmppConnectionService extends Service {
this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
this.wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "XmppConnectionService");
+ this.VideoCompressionWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VideoCompression");
toggleForegroundService();
updateUnreadCountBadge();
toggleScreenEventReceiver();
@@ -4009,7 +4011,7 @@ public class XmppConnectionService extends Service {
protected void onPreExecute() {
super.onPreExecute();
Log.d(Config.LOGTAG, "Start video compression");
- wakeLock.acquire();
+ VideoCompressionWakeLock.acquire();
}
@Override
@@ -4020,7 +4022,6 @@ public class XmppConnectionService extends Service {
@Override
protected void onPostExecute(Boolean compressed) {
super.onPostExecute(compressed);
- wakeLock.release();
File video = new File(compressedpath);
if (mListener != null) {
if (video.exists() && video.length() > 0) {
@@ -4031,6 +4032,7 @@ public class XmppConnectionService extends Service {
Log.d(Config.LOGTAG, "Compression failed!");
}
}
+ VideoCompressionWakeLock.release();
}
}