From c172f1ade7a30cd7f722ac7287c05e8ffb173ef1 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 24 Jan 2020 16:00:15 +0100 Subject: try to heal Huawei's energy saving methods --- src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 98ca81bdc..5f4abb833 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -630,6 +630,7 @@ public class XmppConnectionService extends Service { MessageSearchTask.search(this, term, onSearchResultsAvailable); } + @SuppressLint("InvalidWakeLockTag") @Override public int onStartCommand(Intent intent, int flags, int startId) { final String action = intent == null ? null : intent.getAction(); @@ -764,6 +765,9 @@ public class XmppConnectionService extends Service { } } synchronized (this) { + if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M && Build.MANUFACTURER.equals("Huawei")) { + wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "LocationManagerService"); + } WakeLockHelper.acquire(wakeLock); boolean pingNow = ConnectivityManager.CONNECTIVITY_ACTION.equals(action) || (Config.POST_CONNECTIVITY_CHANGE_PING_INTERVAL > 0 && ACTION_POST_CONNECTIVITY_CHANGE.equals(action)); final HashSet pingCandidates = new HashSet<>(); -- cgit v1.2.3