From 01925fb2cc977e7c929c859e78d1fb2f7c531369 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 3 Apr 2014 10:41:21 +0200 Subject: tryping to resolve the wake lock bug --- src/eu/siacs/conversations/services/XmppConnectionService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/eu/siacs/conversations/services') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 5a3ff0453..8abe1f2a5 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -361,6 +361,7 @@ public class XmppConnectionService extends Service { private Intent pingIntent; private PendingIntent pendingPingIntent = null; private WakeLock wakeLock; + private PowerManager pm; public PgpEngine getPgpEngine() { if (pgpServiceConnection.isBound()) { @@ -528,9 +529,9 @@ public class XmppConnectionService extends Service { getApplicationContext(), "org.sufficientlysecure.keychain"); this.pgpServiceConnection.bindToService(); - PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); + this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE); this.wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, - "XmppConnection"); + "XmppConnectionService"); } @Override @@ -587,7 +588,7 @@ public class XmppConnectionService extends Service { SharedPreferences sharedPref = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); account.setResource(sharedPref.getString("resource", "mobile").toLowerCase(Locale.getDefault())); - XmppConnection connection = new XmppConnection(account, this.wakeLock); + XmppConnection connection = new XmppConnection(account, this.pm); connection.setOnMessagePacketReceivedListener(this.messageListener); connection.setOnStatusChangedListener(this.statusListener); connection.setOnPresencePacketReceivedListener(this.presenceListener); -- cgit v1.2.3