Back to project page nfcunlocker.
The source code is released under:
Apache License
If you think the Android project nfcunlocker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.steelrat.nfcunlocker.unlockmethods; // w w w .j av a 2s .co m import android.app.Activity; import android.app.admin.DevicePolicyManager; import android.content.Context; public abstract class DevicePolicyUnlockMethod extends UnlockMethod { DevicePolicyManager mDPM; public DevicePolicyUnlockMethod(Activity activity) { super(activity); } protected void clearPassword() { setPassword(getActivity(), ""); } protected void restorePassword() { setPassword(getActivity(), getPassword()); } private static DevicePolicyManager getPolicyManager(Context context) { return (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); } public static void setPassword(Context context, String password) { getPolicyManager(context).resetPassword(password, 0); } }