Java 类android.app.admin.DeviceAdminInfo 实例源码

项目:lockscreen    文件:DeviceAdminSample.java   
public void get_admin(){
    Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
    intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
            mDeviceAdminSample);
    intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
            "to lock screen");
    intent.putExtra("force-locked",
            DeviceAdminInfo.USES_POLICY_FORCE_LOCK);

    startActivityForResult(intent, 1);
}
项目:advanced-keyguard-manager    文件:OverviewFragment.java   
private boolean areOtherAdminsSet() {
    List<ComponentName> admins = dpm.getActiveAdmins();
    return Iterables.tryFind(admins, new Predicate<ComponentName>() {
        @Override
        public boolean apply(android.content.ComponentName c) {
            return !cn.equals(c) && dpm.hasGrantedPolicy(
                    c, DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD);
        }
    }).isPresent();
}