1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 11:21:29 +00:00

Revert "Disable sync if Android sync setting is disabled (fixes #588)."

This reverts commit 2daa601e36.
This commit is contained in:
Felix Ableitner 2016-08-24 22:30:49 +02:00
parent f3abfb15f5
commit 17530bab6b
3 changed files with 0 additions and 17 deletions

View file

@ -12,7 +12,6 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" tools:ignore="ProtectedPermissions"/> <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" tools:ignore="ProtectedPermissions"/>
<application <application

View file

@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.syncthing;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -115,9 +114,6 @@ public class DeviceStateHolder extends BroadcastReceiver {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP && pm.isPowerSaveMode()) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP && pm.isPowerSaveMode()) {
return false; return false;
} }
else if (!ContentResolver.getMasterSyncAutomatically()) {
return false;
}
else if (SyncthingService.alwaysRunInBackground(mContext)) { else if (SyncthingService.alwaysRunInBackground(mContext)) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
// Check wifi/charging state against preferences and start if ok. // Check wifi/charging state against preferences and start if ok.

View file

@ -10,7 +10,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SyncStatusObserver;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Environment; import android.os.Environment;
@ -129,14 +128,6 @@ public class SyncthingService extends Service implements
private final HashSet<OnApiChangeListener> mOnApiChangeListeners = private final HashSet<OnApiChangeListener> mOnApiChangeListeners =
new HashSet<>(); new HashSet<>();
private Object mSyncStatusHandle;
private final SyncStatusObserver mSyncStatusObserver = new SyncStatusObserver() {
@Override
public void onStatusChanged(int i) {
updateState();
}
};
private final BroadcastReceiver mPowerSaveModeChangedReceiver = new BroadcastReceiver() { private final BroadcastReceiver mPowerSaveModeChangedReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
@ -340,8 +331,6 @@ public class SyncthingService extends Service implements
new StartupTask(sp.getString("gui_user",""), sp.getString("gui_password","")).execute(); new StartupTask(sp.getString("gui_user",""), sp.getString("gui_password","")).execute();
sp.registerOnSharedPreferenceChangeListener(this); sp.registerOnSharedPreferenceChangeListener(this);
mSyncStatusHandle = ContentResolver.addStatusChangeListener(
ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS, mSyncStatusObserver);
} }
/** /**
@ -448,7 +437,6 @@ public class SyncthingService extends Service implements
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
sp.unregisterOnSharedPreferenceChangeListener(this); sp.unregisterOnSharedPreferenceChangeListener(this);
ContentResolver.removeStatusChangeListener(mSyncStatusHandle);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB)
unregisterReceiver(mPowerSaveModeChangedReceiver); unregisterReceiver(mPowerSaveModeChangedReceiver);
} }