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


Java DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE属性代码示例

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


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

示例1: statusCodeToString

private String statusCodeToString(int newStatusCode) {
    int newStatus = R.string.encryption_status_unknown;
    switch (newStatusCode) {
        case DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED:
            newStatus = R.string.encryption_status_unsupported;
            break;
        case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE:
            newStatus = R.string.encryption_status_inactive;
            break;
        case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING:
            newStatus = R.string.encryption_status_activating;
            break;
        case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
            newStatus = R.string.encryption_status_active;
            break;
    }
    return mActivity.getString(newStatus);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:18,代码来源:DeviceAdminSample.java

示例2: isEncryptionEnabled

/**
 * This method is used to check the status of storage encryption.
 * @return Returns the current status.
 */
public boolean isEncryptionEnabled() {
	if (isDeviceAdminActive()) {
		switch (devicePolicyManager.getStorageEncryptionStatus()) {
			case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
				return true;
			case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE:
				return false;
			case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING:
				return false;
			default:
				return false;
		}
	}
	return false;
}
 
开发者ID:wso2-attic,项目名称:product-emm,代码行数:19,代码来源:DeviceInfo.java

示例3: runDeviceSecurityChecks

public static final boolean runDeviceSecurityChecks(Context context) {
    DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
    if (devicePolicyManager.getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE) {
        new AlertDialog.Builder(context)
                .setTitle(R.string.encryption_required_title)
                .setMessage(R.string.encryption_required_text)
                .setCancelable(false)
                .setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        // Kill app on OK
                        int pid = android.os.Process.myPid();
                        android.os.Process.killProcess(pid);
                    }
                })
                .show();
        return false;
    }
    return true;
}
 
开发者ID:DukeMobileTech,项目名称:AndroidSurvey,代码行数:19,代码来源:AppUtil.java

示例4: warning

private Warning warning()
{
    if (config.remindBackup())
        return Warning.BACKUP;
    else if (Build.VERSION.SDK_INT >= Constants.SDK_LOLLIPOP
            && devicePolicyManager.getStorageEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE)
        return Warning.STORAGE_ENCRYPTION;
    else
        return null;
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:10,代码来源:WalletTransactionsFragment.java

示例5: encryptStorage

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

    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");
    }
}
 
开发者ID:wso2-attic,项目名称:product-emm,代码行数:46,代码来源:OperationManagerOlderSdk.java

示例6: encryptStorage

/**
 * Encrypt/Decrypt device storage.
 * @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) {
	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) {
		Log.e(TAG, "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);

}
 
开发者ID:wso2-attic,项目名称:product-emm,代码行数:60,代码来源:Operation.java


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