From 6e70d465f27a0c2d9a18441f532acc61005097f1 Mon Sep 17 00:00:00 2001 From: Arne Date: Sun, 14 Apr 2024 19:16:54 +0200 Subject: [PATCH] Remove several threads fixes battery drain --- git/release/output-metadata.json | 90 +++++++++---------- .../services/XmppConnectionService.java | 4 +- .../ui/ConversationFragment.java | 4 - .../ui/ConversationsActivity.java | 7 +- .../ui/StartConversationActivity.java | 4 +- 5 files changed, 49 insertions(+), 60 deletions(-) diff --git a/git/release/output-metadata.json b/git/release/output-metadata.json index db2fb5e89d..e6a8ff55b3 100644 --- a/git/release/output-metadata.json +++ b/git/release/output-metadata.json @@ -11,48 +11,9 @@ "type": "UNIVERSAL", "filters": [], "attributes": [], - "versionCode": 170, - "versionName": "1.7.9.5.2", - "outputFile": "monocles chat-1.7.9.5.2-git-universal-release.apk" - }, - { - "type": "ONE_OF_MANY", - "filters": [ - { - "filterType": "ABI", - "value": "armeabi-v7a" - } - ], - "attributes": [], - "versionCode": 17001, - "versionName": "1.7.9.5.2", - "outputFile": "monocles chat-1.7.9.5.2-git-armeabi-v7a-release.apk" - }, - { - "type": "ONE_OF_MANY", - "filters": [ - { - "filterType": "ABI", - "value": "x86_64" - } - ], - "attributes": [], - "versionCode": 17003, - "versionName": "1.7.9.5.2", - "outputFile": "monocles chat-1.7.9.5.2-git-x86_64-release.apk" - }, - { - "type": "ONE_OF_MANY", - "filters": [ - { - "filterType": "ABI", - "value": "x86" - } - ], - "attributes": [], - "versionCode": 17002, - "versionName": "1.7.9.5.2", - "outputFile": "monocles chat-1.7.9.5.2-git-x86-release.apk" + "versionCode": 171, + "versionName": "1.7.9.5.3", + "outputFile": "monocles chat-1.7.9.5.3-git-universal-release.apk" }, { "type": "ONE_OF_MANY", @@ -63,9 +24,48 @@ } ], "attributes": [], - "versionCode": 17004, - "versionName": "1.7.9.5.2", - "outputFile": "monocles chat-1.7.9.5.2-git-arm64-v8a-release.apk" + "versionCode": 17104, + "versionName": "1.7.9.5.3", + "outputFile": "monocles chat-1.7.9.5.3-git-arm64-v8a-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86_64" + } + ], + "attributes": [], + "versionCode": 17103, + "versionName": "1.7.9.5.3", + "outputFile": "monocles chat-1.7.9.5.3-git-x86_64-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "armeabi-v7a" + } + ], + "attributes": [], + "versionCode": 17101, + "versionName": "1.7.9.5.3", + "outputFile": "monocles chat-1.7.9.5.3-git-armeabi-v7a-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86" + } + ], + "attributes": [], + "versionCode": 17102, + "versionName": "1.7.9.5.3", + "outputFile": "monocles chat-1.7.9.5.3-git-x86-release.apk" } ], "elementType": "File" diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index c2c1e9039b..e682ee9cdb 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2861,9 +2861,7 @@ public class XmppConnectionService extends Service { private void markChangedFiles(List infos) { final boolean[] changed = {false}; for (Conversation conversation : getConversations()) { - new Thread( new Runnable() { @Override public void run() { - changed[0] |= conversation.markAsChanged(infos); - } } ).start(); + changed[0] |= conversation.markAsChanged(infos); } if (changed[0]) { updateConversationUi(); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 2e5265ed54..bc14c588a3 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1945,7 +1945,6 @@ public class ConversationFragment extends XmppFragment public void LoadStickers() { - activity.runOnUiThread(() -> { if (!hasStoragePermission(activity)) return; // Load and show Stickers if (!dirStickers.exists()) { @@ -1990,11 +1989,9 @@ public class ConversationFragment extends XmppFragment return true; } }); - }); } public void LoadGifs() { - activity.runOnUiThread(() -> { if (!hasStoragePermission(activity)) return; // Load and show GIFs if (!dirGifs.exists()) { @@ -2039,7 +2036,6 @@ public class ConversationFragment extends XmppFragment return true; } }); - }); } protected void newThreadTutorialToast(String s) { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 43c541942e..4460e30bf9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -1331,11 +1331,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio @Override public void onRosterUpdate() { - new Thread( new Runnable() { @Override public void run() { - refreshForNewCaps = true; - refreshUi(); - } } ).start(); - + refreshForNewCaps = true; + refreshUi(); } @Override diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index a6f6d3cf70..bd892f6d9f 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -303,9 +303,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override public void onRosterUpdate() { - new Thread( new Runnable() { @Override public void run() { - refreshUi(); - } } ).start(); + refreshUi(); } @Override