1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-01 16:51:16 +00:00

Binder failed - cannot create handler inside thread that has not called looper.prepare (fixes #149) (#150)

Fix Binder failed - cannot create handler inside thread that has not called looper.prepare (fixes #149)
This commit is contained in:
Catfriend1 2018-12-24 09:51:25 +01:00 committed by GitHub
parent 190826e660
commit d917ac5e73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -37,8 +37,8 @@ android {
applicationId "com.github.catfriend1.syncthingandroid"
minSdkVersion 16
targetSdkVersion 26
versionCode 4182
versionName "0.14.54.3"
versionCode 4183
versionName "0.14.54.4"
testApplicationId 'com.github.catfriend1.syncthingandroid.test'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
playAccountConfig = playAccountConfigs.defaultAccountConfig

View file

@ -15,6 +15,8 @@ import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
@ -49,7 +51,17 @@ public class RunConditionMonitor {
private final SyncStatusObserver mSyncStatusObserver = new SyncStatusObserver() {
@Override
public void onStatusChanged(int which) {
updateShouldRunDecision();
/**
* We need a Looper here, see issue https://github.com/Catfriend1/syncthing-android/issues/149
*/
Handler mainLooper = new Handler(Looper.getMainLooper());
Runnable updateShouldRunDecisionRunnable = new Runnable() {
@Override
public void run() {
updateShouldRunDecision();
}
};
mainLooper.post(updateShouldRunDecisionRunnable);
}
};