code: public void setStorageEncryptionStatus(int status) {
      switch (status) {
        case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
        case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE:
        case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING:
        case DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED:
          break;
        case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY:
          if (RuntimeEnvironment.getApiLevel() < M) {
            throw new IllegalArgumentException("status " + status + " requires API " + M);
          }
          break;
        case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER:
          if (RuntimeEnvironment.getApiLevel() < N) {
            throw new IllegalArgumentException("status " + status + " requires API " + N);
          }
          break;
        default:
          throw new IllegalArgumentException("Unknown status: " + status);
      }
  
      storageEncryptionStatus = status;
    }
docs: Setter for {@link DevicePolicyManager#getStorageEncryptionStatus()}.