Android Open Source - nfcunlocker Device Policy Unlock Method






From Project

Back to project page nfcunlocker.

License

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.

Java Source Code

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);
  }
}




Java Source Code List

com.steelrat.nfcunlocker.AddActivity.java
com.steelrat.nfcunlocker.DiscoveredActivity.java
com.steelrat.nfcunlocker.MainActivity.java
com.steelrat.nfcunlocker.NFCApplication.java
com.steelrat.nfcunlocker.helpers.AppDeviceAdminReceiver.java
com.steelrat.nfcunlocker.helpers.TagsStorage.java
com.steelrat.nfcunlocker.settingsactivity.SettingsActivityBase.java
com.steelrat.nfcunlocker.settingsactivity.SettingsActivityOA.java
com.steelrat.nfcunlocker.settingsactivity.SettingsActivity.java
com.steelrat.nfcunlocker.unlockmethods.DevicePolicyUnlockMethod.java
com.steelrat.nfcunlocker.unlockmethods.FlagUnlock.java
com.steelrat.nfcunlocker.unlockmethods.InputUnlock.java
com.steelrat.nfcunlocker.unlockmethods.KeyguardUnlock.java
com.steelrat.nfcunlocker.unlockmethods.UnlockMethodFactory.java
com.steelrat.nfcunlocker.unlockmethods.UnlockMethod.java