diff options
author | Rubin Xu <rubinxu@google.com> | 2020-05-29 11:09:48 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-29 11:09:48 +0000 |
commit | 77e445eeaea5398ac2c2c1bedbda5bd7a447a4d4 (patch) | |
tree | 5a4c7b6708c9f40724e152d2d14f0173ccf1c228 /shadows | |
parent | 044dc357ca4503eaae5f9767ed6e04664ee379a2 (diff) | |
parent | 8b93ba74714532887548d8baf2c9a00dd1efa758 (diff) | |
download | robolectric-shadows-77e445eeaea5398ac2c2c1bedbda5bd7a447a4d4.tar.gz |
Add shadow for PersistentDataBlockManager am: 8b93ba7471
Change-Id: Ie33697a39b5bac0671ed2392696b2b505197230c
Diffstat (limited to 'shadows')
-rw-r--r-- | shadows/framework/src/main/java/org/robolectric/shadows/ShadowPersistentDataBlockManager.java | 42 | ||||
-rw-r--r-- | shadows/framework/src/main/java/org/robolectric/shadows/ShadowServiceManager.java | 6 |
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( |