当前位置: 首页>>代码示例>>Java>>正文


Java DevicePolicyManager.getCameraDisabled方法代码示例

本文整理汇总了Java中android.app.admin.DevicePolicyManager.getCameraDisabled方法的典型用法代码示例。如果您正苦于以下问题:Java DevicePolicyManager.getCameraDisabled方法的具体用法?Java DevicePolicyManager.getCameraDisabled怎么用?Java DevicePolicyManager.getCameraDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.admin.DevicePolicyManager的用法示例。


在下文中一共展示了DevicePolicyManager.getCameraDisabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentState

import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
private State getCurrentState() {
    ComponentName componentName = componentName();
    DevicePolicyManager policyManager =
            (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    if (!policyManager.isAdminActive(componentName)) {
        return State.NEEDS_PERMISSIONS;
    }
    if (!policyManager.getCameraDisabled(componentName)) {
        return State.HAS_PERMISSIONS;
    }
    if (!policyManager.isDeviceOwnerApp(BuildConfig.APPLICATION_ID)) {
        return State.CAMERA_DISABLED;
    }
    // Apparently we can't query for user restrictions, so just always set them if they're not
    // already set. We know that we're allowed to because we're the device owner.
    policyManager.addUserRestriction(componentName, UserManager.DISALLOW_ADD_USER);
    policyManager.addUserRestriction(componentName, UserManager.DISALLOW_FACTORY_RESET);
    return State.IS_DEVICE_OWNER;
}
 
开发者ID:disablecamera,项目名称:disablecamera,代码行数:20,代码来源:DisableCameraActivity.java

示例2: checkCameraService

import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
public static void checkCameraService(Context context)
        throws CameraDisabledException, NoCameraException {
    // Check if device policy has disabled the camera.
    DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
            Context.DEVICE_POLICY_SERVICE);
    if (dpm.getCameraDisabled(null)) {
        throw new CameraDisabledException();
    }
    List<CameraMessage> cameraDatas = getAllCamerasData(false);
    if(cameraDatas.size() == 0) {
        throw new NoCameraException();
    }
}
 
开发者ID:wuyisheng,项目名称:libRtmp,代码行数:14,代码来源:AndroidUntil.java

示例3: throwIfCameraDisabled

import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
public static void throwIfCameraDisabled(Context context) throws CameraDisabledException {
    // Check if device policy has disabled the camera.
    DevicePolicyManager dpm =
            (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
    if (dpm.getCameraDisabled(null)) {
        throw new CameraDisabledException();
    }
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:9,代码来源:CameraUtil.java

示例4: throwIfCameraDisabled

import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
private static void throwIfCameraDisabled(Activity activity) throws CameraDisabledException {
    // Check if device policy has disabled the camera.
    DevicePolicyManager dpm = (DevicePolicyManager) activity.getSystemService(
            Context.DEVICE_POLICY_SERVICE);
    if (dpm.getCameraDisabled(null)) {
        throw new CameraDisabledException();
    }
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:9,代码来源:CameraUtil.java


注:本文中的android.app.admin.DevicePolicyManager.getCameraDisabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。