待研究中----

 

 requestWindowFeature(Window.FEATURE_NO_TITLE);取消标题。

private KeyguardManager.KeyguardLock mKeyguardLock;

       Window winP = getWindow();
        winP.addFlags(WindowManager.LayoutParams.FLAG_KEYEVENT_PASS_TO_USER);
        winP.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

        //winP.setLayout(WindowManager.LayoutParams.FILL_PARENT,
        //               WindowManager.LayoutParams.FILL_PARENT);
        //winP.setGravity(Gravity.CENTER);

        setContentView(R.layout.chargepoweroff);
        mImageView = (View) findViewById(R.id.charge);
        mImageView.setBackgroundResource(R.drawable.test_battery_charge);
        KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
        mKeyguardLock = km.newKeyguardLock(TAG);

开始的时候屏蔽键盘。
onStart    disableKeyguard(false);和   onStop调用这个方法。 disableKeyguard(false);

private void disableKeyguard(boolean disable) {
        if (disable) {
            mKeyguardLock.disableKeyguard();
        } else {
            mKeyguardLock.reenableKeyguard();
        }

    }

 

filter.addAction(Intent.ACTION_BATTERY_CHANGED);
        filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        filter.addAction(Intent.ACTION_SCREEN_ON);

你可能感兴趣的:(待研究中----)