Search code examples
androidandroid-framework

Unlock automatically when android phone booted


I had caught phone boot event. On boot complete event I am writing following code

        KeyguardManager mKeyguardManager = (KeyguardManager) mContext.getSystemService(KEYGUARD_SERVICE);
        KeyguardLock mLock = mKeyguardManager.newKeyguardLock("MyApp");
        mLock.disableKeyguard();

but what happing I can able to see lock and after that screen is getting unlocked. But requirement is that lock should not be visible at all after booting. My guess is that I need to make modification in framework somewhere in setting file. But I don't know where to modify.


Solution

  • I have did it by commenting following code in KeyguardViewMediator

    private void showLocked() {
    
       /* if (DEBUG) Log.d(TAG, "showLocked");
    
        Message msg = mHandler.obtainMessage(SHOW);
    
        mHandler.sendMessage(msg);*/
    

    }