aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-03 10:41:21 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-03 10:41:21 +0200
commit01925fb2cc977e7c929c859e78d1fb2f7c531369 (patch)
tree15fd4571bb5c148606573496dcc902036fd087eb /src/eu
parent2b8dfc2babfdbb9d63ddd3f83326940d5ed5817c (diff)
tryping to resolve the wake lock bug
Diffstat (limited to 'src/eu')
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java7
-rw-r--r--src/eu/siacs/conversations/utils/DNSHelper.java6
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java5
3 files changed, 9 insertions, 9 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 5a3ff045..8abe1f2a 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);
diff --git a/src/eu/siacs/conversations/utils/DNSHelper.java b/src/eu/siacs/conversations/utils/DNSHelper.java
index eb9680e9..cbd0c3cc 100644
--- a/src/eu/siacs/conversations/utils/DNSHelper.java
+++ b/src/eu/siacs/conversations/utils/DNSHelper.java
@@ -128,9 +128,9 @@ public class DNSHelper {
} catch (SocketTimeoutException e) {
Log.d("xmppService", "timeout during dns");
namePort.putString("error", "timeout");
- } catch (IOException e) {
- Log.d("xmppService","io exception during dns");
- namePort.putString("error", "timeout");
+ } catch (Exception e) {
+ Log.d("xmppService","unhandled exception in sub project");
+ namePort.putString("error", "unhandled");
}
return namePort;
}
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index e6538f58..4323e899 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -94,10 +94,9 @@ public class XmppConnection implements Runnable {
private OnTLSExceptionReceived tlsListener = null;
private OnBindListener bindListener = null;
- public XmppConnection(Account account, WakeLock wakeLock) {
+ public XmppConnection(Account account, PowerManager pm) {
this.account = account;
- this.wakeLock = wakeLock;
- tagReader = new XmlReader(wakeLock);
+ this.wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,account.getJid());
tagWriter = new TagWriter();
}