本文整理汇总了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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}