List of usage examples for android.app.admin DevicePolicyManager ENCRYPTION_STATUS_UNSUPPORTED
int ENCRYPTION_STATUS_UNSUPPORTED
To view the source code for android.app.admin DevicePolicyManager ENCRYPTION_STATUS_UNSUPPORTED.
Click Source Link
From source file:com.teclib.flyvemdm.TabSecurityPolicies.java
@TargetApi(11) private int getDeviceEncryptionStatus() { int status = DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED; if (Build.VERSION.SDK_INT >= 11) { final DevicePolicyManager dpm = (DevicePolicyManager) mContext .getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm != null) { status = dpm.getStorageEncryptionStatus(); }//www .ja v a 2 s . c o m } return status; }
From source file:com.android.exchange.adapter.ProvisionParser.java
private boolean deviceSupportsEncryption() { DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE); int status = dpm.getStorageEncryptionStatus(); return status != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED; }
From source file:org.wso2.emm.agent.services.operation.OperationManagerCOSU.java
@Override public void encryptStorage(Operation operation) throws AndroidAgentException { boolean doEncrypt = operation.isEnabled(); JSONObject result = new JSONObject(); if (doEncrypt && getDevicePolicyManager() .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED && (getDevicePolicyManager() .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE)) { getDevicePolicyManager().setStorageEncryption(getCdmDeviceAdmin(), doEncrypt); Intent intent = new Intent(DevicePolicyManager.ACTION_START_ENCRYPTION); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); } else if (!doEncrypt && getDevicePolicyManager() .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED && (getDevicePolicyManager() .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE || getDevicePolicyManager() .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING)) { getDevicePolicyManager().setStorageEncryption(getCdmDeviceAdmin(), doEncrypt); }/*from w w w . j av a 2s . c om*/ try { String status; if (getDevicePolicyManager() .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED) { status = getContextResources().getString(R.string.shared_pref_default_status); result.put(getContextResources().getString(R.string.operation_status), status); } else { status = getContextResources().getString(R.string.shared_pref_false_status); result.put(getContextResources().getString(R.string.operation_status), status); } } catch (JSONException e) { operation.setStatus(getContextResources().getString(R.string.operation_value_error)); operation.setOperationResponse("Error in parsing ENCRYPT payload."); getResultBuilder().build(operation); throw new AndroidAgentException("Issue in parsing json", e); } operation.setPayLoad(result.toString()); operation.setStatus(getContextResources().getString(R.string.operation_value_completed)); getResultBuilder().build(operation); if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Encryption process started"); } }
From source file:org.wso2.iot.agent.services.operation.OperationManagerCOSU.java
@Override public void encryptStorage(Operation operation) throws AndroidAgentException { boolean doEncrypt = operation.isEnabled(); JSONObject result = new JSONObject(); if (doEncrypt && getDevicePolicyManager() .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED && (getDevicePolicyManager() .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE)) { getDevicePolicyManager().setStorageEncryption(getCdmDeviceAdmin(), doEncrypt); Intent intent = new Intent(DevicePolicyManager.ACTION_START_ENCRYPTION); intent.setFlags(FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); } else if (!doEncrypt && getDevicePolicyManager() .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED && (getDevicePolicyManager() .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE || getDevicePolicyManager() .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING)) { getDevicePolicyManager().setStorageEncryption(getCdmDeviceAdmin(), doEncrypt); }/*from w ww . j a v a 2 s . com*/ try { String status; if (getDevicePolicyManager() .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED) { status = getContextResources().getString(R.string.shared_pref_default_status); result.put(getContextResources().getString(R.string.operation_status), status); } else { status = getContextResources().getString(R.string.shared_pref_false_status); result.put(getContextResources().getString(R.string.operation_status), status); } } catch (JSONException e) { operation.setStatus(getContextResources().getString(R.string.operation_value_error)); operation.setOperationResponse("Error in parsing ENCRYPT payload."); getResultBuilder().build(operation); throw new AndroidAgentException("Issue in parsing json", e); } operation.setPayLoad(result.toString()); operation.setStatus(getContextResources().getString(R.string.operation_value_completed)); getResultBuilder().build(operation); if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Encryption process started"); } }
From source file:com.silentcircle.silenttext.util.DeviceUtils.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static boolean isFullDiskEncryptionSupportedHoneycomb(Context context) { DevicePolicyManager policy = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); int status = policy.getStorageEncryptionStatus(); return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED != status; }
From source file:org.wso2.mdm.agent.services.Operation.java
/** * Encrypt/Decrypt device storage./*from w w w.j a v a 2s . com*/ * @param code - Operation code. * @param data - Data required(Encryption enable/disable switch). * @param requestMode - Request mode(Normal mode or policy bundle mode). */ public void encryptStorage(String code, String data) throws AndroidAgentException { boolean doEncrypt = true; try { JSONObject encryptData = new JSONObject(data); if (!encryptData.isNull(resources.getString(R.string.intent_extra_function)) && encryptData.get(resources.getString(R.string.intent_extra_function)).toString() .equalsIgnoreCase(resources.getString(R.string.intent_extra_encrypt))) { doEncrypt = true; } else if (!encryptData.isNull(resources.getString(R.string.intent_extra_function)) && encryptData.get(resources.getString(R.string.intent_extra_function)).toString() .equalsIgnoreCase(resources.getString(R.string.intent_extra_decrypt))) { doEncrypt = false; } else if (!encryptData.isNull(resources.getString(R.string.intent_extra_function))) { doEncrypt = Boolean.parseBoolean( encryptData.get(resources.getString(R.string.intent_extra_function)).toString()); } } catch (JSONException e) { throw new AndroidAgentException("Invalid JSON format.", e); } ComponentName admin = new ComponentName(context, AgentDeviceAdminReceiver.class); if (doEncrypt && devicePolicyManager .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED && (devicePolicyManager .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE)) { devicePolicyManager.setStorageEncryption(admin, doEncrypt); Intent intent = new Intent(DevicePolicyManager.ACTION_START_ENCRYPTION); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } else if (!doEncrypt && devicePolicyManager .getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED && (devicePolicyManager.getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE || devicePolicyManager .getStorageEncryptionStatus() == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING)) { devicePolicyManager.setStorageEncryption(admin, doEncrypt); } String status; if (devicePolicyManager.getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED) { status = resources.getString(R.string.shared_pref_default_status); } else { status = resources.getString(R.string.shared_pref_false_status); } resultBuilder.build(code, status); }