aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-09-03 09:15:45 +0200
committerChristian Schneppe <christian@pix-art.de>2016-09-03 13:14:54 +0200
commit52f230a6b54dfd8eafe844a6c473ecee0d957a7e (patch)
tree3c7fbfa95c2d63d161147cb9e03ae8201a4b97f0 /src/main/java/de
parent101b05b24d8c8baaf1217bf85ef19ea08cbce053 (diff)
keep CPU awake while compressing video
fixes #94
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index c00803d1c..75231f037 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -154,7 +154,7 @@ public class XmppConnectionService extends Service {
private final List<Conversation> conversations = new CopyOnWriteArrayList<>();
private final IqGenerator mIqGenerator = new IqGenerator(this);
private final List<String> mInProgressAvatarFetches = new ArrayList<>();
-
+ private WakeLock wakeLock;
private long mLastActivity = 0;
public DatabaseBackend databaseBackend;
@@ -363,7 +363,6 @@ public class XmppConnectionService extends Service {
};
private OpenPgpServiceConnection pgpServiceConnection;
private PgpEngine mPgpEngine = null;
- private WakeLock wakeLock;
private PowerManager pm;
private LruCache<String, Bitmap> mBitmapCache;
private EventReceiver mEventReceiver = new EventReceiver();
@@ -581,12 +580,16 @@ public class XmppConnectionService extends Service {
@Override
protected Boolean doInBackground(String... params) {
+ PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
+ wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"CompressPixArtMessengerVideo");
+ wakeLock.acquire();
return MediaController.getInstance().convertVideo(originalpath, compressedpath);
}
@Override
protected void onPostExecute(Boolean compressed) {
super.onPostExecute(compressed);
+ wakeLock.release();
if (mListener != null) {
mListener.videocompressed(compressed);
Log.d(Config.LOGTAG, "Compression successfully!");