Rename CallReceiver
This commit is contained in:
parent
db33272fdc
commit
c26157e808
|
@ -115,7 +115,7 @@
|
|||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".CallReceiver"
|
||||
android:name=".PhoneStateBroadcastReceiver"
|
||||
android:directBootAware="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PHONE_STATE" />
|
||||
|
|
|
@ -28,7 +28,8 @@ public class CallMonitoringService extends Service {
|
|||
private static final Logger LOG = LoggerFactory.getLogger(CallMonitoringService.class);
|
||||
|
||||
private final MyPhoneStateListener phoneStateListener = new MyPhoneStateListener();
|
||||
private final CallReceiver callReceiver = new CallReceiver(
|
||||
private final PhoneStateBroadcastReceiver phoneStateBroadcastReceiver
|
||||
= new PhoneStateBroadcastReceiver(
|
||||
PhoneStateHandler.Source.PHONE_STATE_BROADCAST_RECEIVER_MONITORING);
|
||||
|
||||
private boolean monitoringStarted;
|
||||
|
@ -95,7 +96,7 @@ public class CallMonitoringService extends Service {
|
|||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(TelephonyManager.EXTRA_STATE_RINGING); // TODO: check
|
||||
intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
|
||||
registerReceiver(callReceiver, intentFilter);
|
||||
registerReceiver(phoneStateBroadcastReceiver, intentFilter);
|
||||
} catch (Exception e) {
|
||||
LOG.error("startMonitoring()", e);
|
||||
}
|
||||
|
@ -107,7 +108,7 @@ public class CallMonitoringService extends Service {
|
|||
try {
|
||||
getTelephonyManager().listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
|
||||
|
||||
unregisterReceiver(callReceiver);
|
||||
unregisterReceiver(phoneStateBroadcastReceiver);
|
||||
} catch (Exception e) {
|
||||
LOG.error("stopMonitoring()", e);
|
||||
}
|
||||
|
|
|
@ -13,18 +13,18 @@ import dummydomain.yetanothercallblocker.data.YacbHolder;
|
|||
|
||||
import static dummydomain.yetanothercallblocker.utils.StringUtils.quote;
|
||||
|
||||
public class CallReceiver extends BroadcastReceiver {
|
||||
public class PhoneStateBroadcastReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CallReceiver.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PhoneStateBroadcastReceiver.class);
|
||||
|
||||
private final PhoneStateHandler.Source source;
|
||||
|
||||
@SuppressWarnings({"unused", "RedundantSuppression"}) // required for BroadcastReceivers
|
||||
public CallReceiver() {
|
||||
public PhoneStateBroadcastReceiver() {
|
||||
this(PhoneStateHandler.Source.PHONE_STATE_BROADCAST_RECEIVER);
|
||||
}
|
||||
|
||||
public CallReceiver(PhoneStateHandler.Source source) {
|
||||
public PhoneStateBroadcastReceiver(PhoneStateHandler.Source source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
Loading…
Reference in New Issue