它完全将原生锁定屏幕更改为自定义,但我无法再次更改为原生。我该怎么做?我应该以某种方式禁用Service
或BroadcastReceiver
?
我正在使用Service和BroadcastReceiver更改锁定屏幕。
服务中的代码
if(isMustBeLocked) {
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
mReceiver = new LockScreenReceiver();
registerReceiver(mReceiver, filter);
super.onCreate();
}
BroadcastReciever中的代码
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
if(!LockScreenService.isMustBeLocked) {
// need to do something here
}
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
Intent intent11 = new Intent(context,LockScreenActivity.class);
intent11.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
} else if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
}
}