aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-05-30 01:04:21 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-05-30 01:04:21 +0000
commit83d18a79429356c8122f94e26c9346aa24fdcaa5 (patch)
tree255b891c897a7dc584de678981f8cec93c1f4537
parentfcee7038af65ac27f5e04f971a4a2a62558b2dd3 (diff)
parent60aba8d30d021e792448aa3fd77fdb427dd3a63e (diff)
downloadrobolectric-shadows-android11-d1-release.tar.gz
Change-Id: Ic6a511c5c0235fe12c49a51576e6863546716dff
-rw-r--r--shadows/framework/src/main/java/org/robolectric/shadows/ShadowPersistentDataBlockManager.java42
-rw-r--r--shadows/framework/src/main/java/org/robolectric/shadows/ShadowServiceManager.java6
2 files changed, 48 insertions, 0 deletions
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowPersistentDataBlockManager.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowPersistentDataBlockManager.java
new file mode 100644
index 000000000..a48480df1
--- /dev/null
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowPersistentDataBlockManager.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.robolectric.shadows;
+
+import android.service.persistentdata.PersistentDataBlockManager;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+@Implements(PersistentDataBlockManager.class)
+public class ShadowPersistentDataBlockManager {
+ private static int sDataBlockSize = 0;
+
+ @Resetter
+ public static void reset() {
+ sDataBlockSize = 0;
+ }
+
+ @Implementation
+ protected int getDataBlockSize() {
+ return sDataBlockSize;
+ }
+
+ public static void setDataBlockSize(int dataBlockSize) {
+ sDataBlockSize = dataBlockSize;
+ }
+}
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowServiceManager.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowServiceManager.java
index 41b3f9cb0..d7dae9b36 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowServiceManager.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowServiceManager.java
@@ -52,6 +52,8 @@ import android.os.IUserManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.storage.IStorageManager;
+import android.service.persistentdata.IPersistentDataBlockService;
+
import com.android.internal.app.IAppOpsService;
import com.android.internal.app.IBatteryStats;
import com.android.internal.appwidget.IAppWidgetService;
@@ -166,6 +168,10 @@ public class ShadowServiceManager {
map.put(
Context.MEDIA_SESSION_SERVICE,
createDeepBinder(ISessionManager.class, "android.media.session.ISessionManager"));
+ map.put(
+ Context.PERSISTENT_DATA_BLOCK_SERVICE,
+ createBinder(IPersistentDataBlockService.class,
+ "android.service.persistentdata.IPersistentDataBlockService"));
}
if (RuntimeEnvironment.getApiLevel() >= M) {
map.put(