mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove now unneeded ScreenReceiver
This commit is contained in:
@@ -48,7 +48,6 @@ public class ApplicationDcContext extends DcContext {
|
||||
public static final int RECIPIENT_TYPE_CONTACT = 1;
|
||||
|
||||
public Context context;
|
||||
public volatile boolean isScreenOn = false;
|
||||
|
||||
public ApplicationDcContext(Context context) {
|
||||
super("Android "+BuildConfig.VERSION_NAME);
|
||||
@@ -82,18 +81,6 @@ public class ApplicationDcContext extends DcContext {
|
||||
BroadcastReceiver networkStateReceiver = new NetworkStateReceiver();
|
||||
context.registerReceiver(networkStateReceiver, new IntentFilter(android.net.ConnectivityManager.CONNECTIVITY_ACTION));
|
||||
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
BroadcastReceiver screenReceiver = new ScreenReceiver();
|
||||
context.registerReceiver(screenReceiver, filter);
|
||||
|
||||
try {
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
isScreenOn = pm.isScreenOn();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
KeepAliveService.startSelf(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package org.thoughtcrime.securesms.connect;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public class ScreenReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
ApplicationDcContext dcContext = DcHelper.getContext(context);
|
||||
|
||||
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
|
||||
Log.i("DeltaChat", "-------------------- Screen off --------------------");
|
||||
dcContext.isScreenOn = false;
|
||||
}
|
||||
else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
|
||||
Log.i("DeltaChat", "-------------------- Screen on --------------------");
|
||||
dcContext.isScreenOn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user