Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7912568 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

Remove BatteryStateReceiver

- Removed BatteryStateReceiver.java from foundation.e.drive.receivers package
- removed BatteryStateReceiver entry in AndroidManifest.xml
parent c616ea09
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -69,14 +69,6 @@ http://www.gnu.org/licenses/gpl.html
            android:enabled="true" />
        <service android:name=".services.OperationManagerService" />

        <receiver
            android:name=".receivers.BatteryStateReceiver"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.BATTERY_LOW" />
                <action android:name="android.intent.action.BATTERY_OKAY" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".receivers.PackageEventReceiver"
            android:enabled="true">
+0 −41
Original line number Diff line number Diff line
/*
 * 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.utils.JobUtils;

/**
 * @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) ) {
            JobUtils.scheduleScannerJob(context);
        }else if(intentAction.equals(Intent.ACTION_BATTERY_LOW)){
            JobUtils.stopScheduledJob(context, JobUtils.ScannerJobId);
            try {
                context.unregisterReceiver(ScreenOffReceiver.getInstance());
            }catch(Exception e){
                Log.e(TAG, e.toString() );
            }
        }
    }
}