diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index be871995566a3c5de7fc4bbb8df3365b36fc9856..e07511c5e800effad99cca3451272513af28b111 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -69,14 +69,6 @@ http://www.gnu.org/licenses/gpl.html
android:enabled="true" />
-
-
-
-
-
-
diff --git a/app/src/main/java/foundation/e/drive/jobs/ScannerJob.java b/app/src/main/java/foundation/e/drive/jobs/ScannerJob.java
index 878f554b882119cefd4795e8131d2660ddcba33a..b62738bbe5ea0a7320741ddc305aecac32407eb5 100644
--- a/app/src/main/java/foundation/e/drive/jobs/ScannerJob.java
+++ b/app/src/main/java/foundation/e/drive/jobs/ScannerJob.java
@@ -11,9 +11,8 @@ package foundation.e.drive.jobs;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Intent;
-import android.content.IntentFilter;
import android.util.Log;
-import foundation.e.drive.receivers.ScreenOffReceiver;
+
import foundation.e.drive.services.ObserverService;
import foundation.e.drive.utils.CommonUtils;
@@ -27,11 +26,6 @@ public class ScannerJob extends JobService {
public boolean onStartJob(JobParameters params) {
Log.i(TAG, "onStartJob()");
- Log.d(TAG, "RegisterReceiver: screenOffReceiver");
- IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
- filter.addAction(Intent.ACTION_SCREEN_OFF);
- getApplicationContext().registerReceiver(ScreenOffReceiver.getInstance(), filter);
-
Intent observerServiceIntent = new Intent(this, ObserverService.class);
this.startService(observerServiceIntent);
jobFinished(params, false);
@@ -46,7 +40,6 @@ public class ScannerJob extends JobService {
@Override
public boolean onStopJob(JobParameters params) {
Log.i(TAG, "onStopJob");
- boolean unregisteredReceiver = CommonUtils.unregisterScreenOff(getApplicationContext());
Intent observerServiceIntent = new Intent(this, ObserverService.class);
this.stopService(observerServiceIntent);
return false;
diff --git a/app/src/main/java/foundation/e/drive/receivers/BatteryStateReceiver.java b/app/src/main/java/foundation/e/drive/receivers/BatteryStateReceiver.java
deleted file mode 100644
index a634635b1b327c8f0a7f2897809949fce8aaaac2..0000000000000000000000000000000000000000
--- a/app/src/main/java/foundation/e/drive/receivers/BatteryStateReceiver.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © Vincent Bourgmayer (/e/ foundation).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the GNU Public License v3.0
- * which accompanies this distribution, and is available at
- * http://www.gnu.org/licenses/gpl.html
- */
-
-package foundation.e.drive.receivers;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-
-/**
- * @author Vincent Bourgmayer
- */
-public class BatteryStateReceiver extends BroadcastReceiver {
- private final static String TAG = BatteryStateReceiver.class.getSimpleName();
-
- @Override
- public void onReceive(Context context, Intent intent) {
- Log.i(TAG, "onReceive");
-
- String intentAction = intent.getAction();
- if(intentAction == null) {
- Log.e(TAG, "intent Action is null");
- } else if ( intentAction.equals(Intent.ACTION_BATTERY_OKAY) ) {
- Log.d(TAG, "BATTERY is Okay. Synchronization job isn't reschedule anymore. Expected behaviour");
- }else if(intentAction.equals(Intent.ACTION_BATTERY_LOW)){
- try {
- context.unregisterReceiver(ScreenOffReceiver.getInstance());
- }catch(Exception e){
- Log.e(TAG, e.toString() );
- }
- }
- }
-}
diff --git a/app/src/main/java/foundation/e/drive/receivers/ScreenOffReceiver.java b/app/src/main/java/foundation/e/drive/receivers/ScreenOffReceiver.java
deleted file mode 100644
index 27d489598d6fb2b579ddd671612ac7a87c96541f..0000000000000000000000000000000000000000
--- a/app/src/main/java/foundation/e/drive/receivers/ScreenOffReceiver.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright © Vincent Bourgmayer (/e/ foundation).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the GNU Public License v3.0
- * which accompanies this distribution, and is available at
- * http://www.gnu.org/licenses/gpl.html
- */
-
-package foundation.e.drive.receivers;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-import foundation.e.drive.services.ObserverService;
-import foundation.e.drive.utils.CommonUtils;
-
-/**
- * @author Vincent Bourgmayer
- * This is a broadcast receiver which catch "ACTION_SCREEN_OFF" to start scanning at a moment
- * where the user won't need battery or network.
- */
-public class ScreenOffReceiver extends BroadcastReceiver {
- private final String TAG = ScreenOffReceiver.class.getSimpleName();
- private static ScreenOffReceiver instance;
-
- public static ScreenOffReceiver getInstance(){
- if(instance == null)
- instance = new ScreenOffReceiver();
- return instance;
- }
-
- /**
- * Private constructor
- */
- private ScreenOffReceiver(){}
-
- @Override
- public void onReceive(Context context, Intent intent) {
- Log.i(TAG, "onReceive");
- String intentAction = intent.getAction();
- if(intentAction == null){
- Log.e(TAG, "intent Action is null");
- } else if ( intent.getAction().equals(Intent.ACTION_SCREEN_OFF)
- && CommonUtils.haveNetworkConnexion( context ) ) {
- Log.d(TAG, "onReceive: ACTION_SCREEN_OFF");
- Intent cloudIntent = new Intent(context, ObserverService.class);
- context.startService(cloudIntent);
- }
- }
-}
diff --git a/app/src/main/java/foundation/e/drive/services/InitializerService.java b/app/src/main/java/foundation/e/drive/services/InitializerService.java
index aad54992b2d21ba546aad19df712fd5195296618..ad6822507535487a09b4e78b7ccb9c4a76c5b9c6 100644
--- a/app/src/main/java/foundation/e/drive/services/InitializerService.java
+++ b/app/src/main/java/foundation/e/drive/services/InitializerService.java
@@ -13,7 +13,6 @@ import android.accounts.AccountManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Environment;
@@ -33,7 +32,6 @@ import java.util.List;
import foundation.e.drive.models.SyncedFolder;
import foundation.e.drive.operations.CreateInitialFolderRemoteOperation;
-import foundation.e.drive.receivers.ScreenOffReceiver;
import foundation.e.drive.utils.AppConstants;
import foundation.e.drive.utils.CommonUtils;
@@ -284,16 +282,10 @@ public class InitializerService extends Service implements OnRemoteOperationList
//all folder have been created
- Log.d(TAG, "RegisterReceiver: screenOffReceiver");
- IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
- filter.addAction(Intent.ACTION_SCREEN_OFF);
- getApplicationContext().registerReceiver(ScreenOffReceiver.getInstance(), filter);
-
//Immediatly start ObserverService to not have to wait 30 minutes.
Intent observersServiceIntent = new Intent(getApplicationContext(), foundation.e.drive.services.ObserverService.class);
startService(observersServiceIntent);
-
stopSelf();
}
diff --git a/app/src/main/java/foundation/e/drive/services/ResetService.java b/app/src/main/java/foundation/e/drive/services/ResetService.java
index 2144c93582df1c8949d37bab3072ee426c1eecfb..7b7c9d4e6e2ccba4fbd980968addeafc2bf2022e 100644
--- a/app/src/main/java/foundation/e/drive/services/ResetService.java
+++ b/app/src/main/java/foundation/e/drive/services/ResetService.java
@@ -85,11 +85,8 @@ public class ResetService extends Service {
.apply();
}
- //5. Unregister screenOffReceiver
- result = CommonUtils.unregisterScreenOff(getApplicationContext());
- Log.d(TAG, "Unregistered ScreenOffReceiver: "+result);
- //6. Remove Cached File
+ //5. Remove Cached File
File[] cachedFiles = this.getApplicationContext().getExternalCacheDir().listFiles();
for(File f : cachedFiles){
f.delete();
diff --git a/app/src/main/java/foundation/e/drive/utils/CommonUtils.java b/app/src/main/java/foundation/e/drive/utils/CommonUtils.java
index 5ba7a072c956ccbd29df8d654ce4245fb40adf1f..6cfb785a4522dafe82f06d9608039d802d28ca81 100644
--- a/app/src/main/java/foundation/e/drive/utils/CommonUtils.java
+++ b/app/src/main/java/foundation/e/drive/utils/CommonUtils.java
@@ -32,7 +32,7 @@ import com.owncloud.android.lib.resources.files.FileUtils;
import java.io.File;
import java.util.concurrent.TimeUnit;
-import foundation.e.drive.receivers.ScreenOffReceiver;
+
import foundation.e.drive.work.FullScanWorker;
import static foundation.e.drive.utils.AppConstants.MEDIASYNC_PROVIDER_AUTHORITY;
@@ -70,23 +70,6 @@ public abstract class CommonUtils {
}
}
- /**
- * Unregister from screeOffReceiver component
- *
- * @param context app context
- * @return true if unregistration was successful or false if it encounter an exception
- */
- public static boolean unregisterScreenOff(Context context) {
- try {
- Log.d("TAG", "unregisterReceiver(screenOffReceiver)");
- context.unregisterReceiver(ScreenOffReceiver.getInstance());
- } catch (IllegalArgumentException e) {
- Log.w(TAG, "Can't unregister screenOffReceiver ");
- return false;
- }
- return true;
- }
-
/**
* This method retrieve Account corresponding to account's name and type