summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorBenedict Wong <benedictwong@google.com>2020-08-18 19:49:17 -0700
committerBenedict Wong <benedictwong@google.com>2020-12-17 17:17:13 -0800
commitab1b484ac730afd72e756f504be652e36d2e206c (patch)
tree71d307e0c599ba3ab4e3170f3f8e0c1648ddfebc /core/java/android
parent264973663ce84e73a0a88aeff6b6ec1a7971afb0 (diff)
Add persistence for VcnConfig objects by Subscription Group
This commit adds the ability for the VcnManagementService to track/store VCN profiles by subscription groups, and saving/loading to/from disk. Bug: 163611304 Test: New tests added, passing Change-Id: Ifabf5e2be090d529cd29e2c68d55ece4858b2aad
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/net/vcn/VcnManager.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/java/android/net/vcn/VcnManager.java b/core/java/android/net/vcn/VcnManager.java
index 6769b9e46e4c..46d1c1c7a23a 100644
--- a/core/java/android/net/vcn/VcnManager.java
+++ b/core/java/android/net/vcn/VcnManager.java
@@ -23,6 +23,9 @@ import android.annotation.SystemService;
import android.content.Context;
import android.os.ParcelUuid;
import android.os.RemoteException;
+import android.os.ServiceSpecificException;
+
+import java.io.IOException;
/**
* VcnManager publishes APIs for applications to configure and manage Virtual Carrier Networks.
@@ -63,15 +66,20 @@ public final class VcnManager {
* @param config the configuration parameters for the VCN
* @throws SecurityException if the caller does not have carrier privileges, or is not running
* as the primary user
+ * @throws IOException if the configuration failed to be persisted. A caller encountering this
+ * exception should attempt to retry (possibly after a delay).
* @hide
*/
@RequiresPermission("carrier privileges") // TODO (b/72967236): Define a system-wide constant
- public void setVcnConfig(@NonNull ParcelUuid subscriptionGroup, @NonNull VcnConfig config) {
+ public void setVcnConfig(@NonNull ParcelUuid subscriptionGroup, @NonNull VcnConfig config)
+ throws IOException {
requireNonNull(subscriptionGroup, "subscriptionGroup was null");
requireNonNull(config, "config was null");
try {
mService.setVcnConfig(subscriptionGroup, config);
+ } catch (ServiceSpecificException e) {
+ throw new IOException(e);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -88,14 +96,18 @@ public final class VcnManager {
* @param subscriptionGroup the subscription group that the configuration should be applied to
* @throws SecurityException if the caller does not have carrier privileges, or is not running
* as the primary user
+ * @throws IOException if the configuration failed to be cleared. A caller encountering this
+ * exception should attempt to retry (possibly after a delay).
* @hide
*/
@RequiresPermission("carrier privileges") // TODO (b/72967236): Define a system-wide constant
- public void clearVcnConfig(@NonNull ParcelUuid subscriptionGroup) {
+ public void clearVcnConfig(@NonNull ParcelUuid subscriptionGroup) throws IOException {
requireNonNull(subscriptionGroup, "subscriptionGroup was null");
try {
mService.clearVcnConfig(subscriptionGroup);
+ } catch (ServiceSpecificException e) {
+ throw new IOException(e);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}