mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 03:11:30 +00:00
Revert "Disable sync if Android sync setting is disabled (fixes #588)."
This reverts commit 2daa601e36
.
This commit is contained in:
parent
f3abfb15f5
commit
17530bab6b
3 changed files with 0 additions and 17 deletions
|
@ -12,7 +12,6 @@
|
|||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<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"/>
|
||||
|
||||
<application
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.syncthing;
|
|||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -115,9 +114,6 @@ public class DeviceStateHolder extends BroadcastReceiver {
|
|||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP && pm.isPowerSaveMode()) {
|
||||
return false;
|
||||
}
|
||||
else if (!ContentResolver.getMasterSyncAutomatically()) {
|
||||
return false;
|
||||
}
|
||||
else if (SyncthingService.alwaysRunInBackground(mContext)) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
// Check wifi/charging state against preferences and start if ok.
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SyncStatusObserver;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
|
@ -129,14 +128,6 @@ public class SyncthingService extends Service implements
|
|||
private final HashSet<OnApiChangeListener> mOnApiChangeListeners =
|
||||
new HashSet<>();
|
||||
|
||||
private Object mSyncStatusHandle;
|
||||
private final SyncStatusObserver mSyncStatusObserver = new SyncStatusObserver() {
|
||||
@Override
|
||||
public void onStatusChanged(int i) {
|
||||
updateState();
|
||||
}
|
||||
};
|
||||
|
||||
private final BroadcastReceiver mPowerSaveModeChangedReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
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();
|
||||
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);
|
||||
sp.unregisterOnSharedPreferenceChangeListener(this);
|
||||
ContentResolver.removeStatusChangeListener(mSyncStatusHandle);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB)
|
||||
unregisterReceiver(mPowerSaveModeChangedReceiver);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue