自定义锁定屏幕后无法调用本机锁定屏幕

时间:2015-04-17 13:31:15

标签: java android

我正在使用ServiceBroadcastReceiver更改锁定屏幕。

它将原生锁定屏幕完全改为自定义,但我无法再次更改为原生。我该怎么做?我应该以某种方式禁用ServiceBroadcastReceiver

Service

内的代码
if(isMustBeLocked) {
    IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
    filter.addAction(Intent.ACTION_SCREEN_OFF);

    mReceiver = new LockScreenReceiver();
    registerReceiver(mReceiver, filter);
    super.onCreate();
}

code within 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)) {
    }
}

0 个答案:

没有答案