Code example for DevicePolicyManager

Methods: isAdminActive, resetPassword

0
        private OnClickListener mResetPasswordListener = new OnClickListener() {
            public void onClick(View v) { 
                if (mAM.isUserAMonkey()) { 
                    // Don't trust monkeys to do the right thing! 
                    AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this); 
                    builder.setMessage("You can't reset my password because you are a monkey!"); 
                    builder.setPositiveButton("I admit defeat", null); 
                    builder.show(); 
                    return; 
                } 
                boolean active = mDPM.isAdminActive(mDeviceAdminSample); 
                if (active) { 
                    mDPM.resetPassword(mPassword.getText().toString(), 
                            DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY); 
                } 
            } 
        }; 
 
        private OnClickListener mForceLockListener = new OnClickListener() {
            public void onClick(View v) { 
                if (mAM.isUserAMonkey()) {