diff options
-rw-r--r-- | Android.bp | 1 | ||||
-rw-r--r-- | apex/blobstore/framework/Android.bp | 40 | ||||
-rw-r--r-- | apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java | 41 | ||||
-rw-r--r-- | apex/blobstore/framework/java/android/app/blob/BlobStoreManagerFrameworkInitializer.java | 34 | ||||
-rw-r--r-- | apex/blobstore/framework/java/android/app/blob/IBlobStoreManager.aidl | 20 | ||||
-rw-r--r-- | apex/blobstore/service/Android.bp | 27 | ||||
-rw-r--r-- | apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java | 39 | ||||
-rw-r--r-- | api/test-current.txt | 1 | ||||
-rw-r--r-- | config/preloaded-classes | 1 | ||||
-rw-r--r-- | core/java/android/app/SystemServiceRegistry.java | 3 | ||||
-rw-r--r-- | core/java/android/content/Context.java | 14 | ||||
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 6 |
12 files changed, 227 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp index 3721947fa4a6..190649af2dc7 100644 --- a/Android.bp +++ b/Android.bp @@ -212,6 +212,7 @@ filegroup { name: "framework-non-updatable-sources", srcs: [ // Java/AIDL sources under frameworks/base + ":framework-blobstore-sources", ":framework-core-sources", ":framework-drm-sources", ":framework-graphics-sources", diff --git a/apex/blobstore/framework/Android.bp b/apex/blobstore/framework/Android.bp new file mode 100644 index 000000000000..24693511117c --- /dev/null +++ b/apex/blobstore/framework/Android.bp @@ -0,0 +1,40 @@ +// Copyright (C) 2019 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. + +filegroup { + name: "framework-blobstore-sources", + srcs: [ + "java/**/*.java", + "java/**/*.aidl" + ], + path: "java", +} + +java_library { + name: "blobstore-framework", + installable: false, + compile_dex: true, + sdk_version: "core_platform", + srcs: [ + ":framework-blobstore-sources", + ], + aidl: { + export_include_dirs: [ + "java", + ], + }, + libs: [ + "framework-minus-apex", + ], +} diff --git a/apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java b/apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java new file mode 100644 index 000000000000..1ed188e69881 --- /dev/null +++ b/apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019 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 android.app.blob; + +import android.annotation.SystemService; +import android.content.Context; + +/** + * This class provides access to the blob store maintained by the system. + * + * Apps can publish data blobs which might be useful for other apps on the device to be + * maintained by the system and apps that would like to access these data blobs can do so + * by addressing them via their cryptographically secure hashes. + * + * TODO: make this public once the APIs are added. + * @hide + */ +@SystemService(Context.BLOB_STORE_SERVICE) +public class BlobStoreManager { + private final Context mContext; + private final IBlobStoreManager mService; + + /** @hide */ + public BlobStoreManager(Context context, IBlobStoreManager service) { + mContext = context; + mService = service; + } +} diff --git a/apex/blobstore/framework/java/android/app/blob/BlobStoreManagerFrameworkInitializer.java b/apex/blobstore/framework/java/android/app/blob/BlobStoreManagerFrameworkInitializer.java new file mode 100644 index 000000000000..6e6d6aee60fa --- /dev/null +++ b/apex/blobstore/framework/java/android/app/blob/BlobStoreManagerFrameworkInitializer.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019 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 android.app.blob; + +import android.app.SystemServiceRegistry; +import android.content.Context; + +/** + * This is where the BlobStoreManagerService wrapper is registered. + * + * @hide + */ +public class BlobStoreManagerFrameworkInitializer { + /** Register the BlobStoreManager wrapper class */ + public static void initialize() { + SystemServiceRegistry.registerCachedService( + Context.BLOB_STORE_SERVICE, BlobStoreManager.class, + (context, service) -> + new BlobStoreManager(context, IBlobStoreManager.Stub.asInterface(service))); + } +} diff --git a/apex/blobstore/framework/java/android/app/blob/IBlobStoreManager.aidl b/apex/blobstore/framework/java/android/app/blob/IBlobStoreManager.aidl new file mode 100644 index 000000000000..00c1ed4daa27 --- /dev/null +++ b/apex/blobstore/framework/java/android/app/blob/IBlobStoreManager.aidl @@ -0,0 +1,20 @@ +/** + * Copyright 2019, 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 android.app.blob; + +/** {@hide} */ +interface IBlobStoreManager { +}
\ No newline at end of file diff --git a/apex/blobstore/service/Android.bp b/apex/blobstore/service/Android.bp new file mode 100644 index 000000000000..019f98937df3 --- /dev/null +++ b/apex/blobstore/service/Android.bp @@ -0,0 +1,27 @@ +// Copyright (C) 2019 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. + +java_library { + name: "blobstore-service", + installable: true, + + srcs: [ + "java/**/*.java", + ], + + libs: [ + "framework", + "services.core", + ], +}
\ No newline at end of file diff --git a/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java b/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java new file mode 100644 index 000000000000..d7cab5998881 --- /dev/null +++ b/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java @@ -0,0 +1,39 @@ +/* + * Copyright 2019 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 com.android.server.blob; + +import android.app.blob.IBlobStoreManager; +import android.content.Context; + +import com.android.server.SystemService; + +/** + * Service responsible for maintaining and facilitating access to data blobs published by apps. + */ +public class BlobStoreManagerService extends SystemService { + + public BlobStoreManagerService(Context context) { + super(context); + } + + @Override + public void onStart() { + publishBinderService(Context.BLOB_STORE_SERVICE, new Stub()); + } + + private class Stub extends IBlobStoreManager.Stub { + } +} diff --git a/api/test-current.txt b/api/test-current.txt index 466320ba4403..e4f24093fb10 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -701,6 +701,7 @@ package android.content { method public int getUserId(); method public void setAutofillOptions(@Nullable android.content.AutofillOptions); method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions); + field public static final String BLOB_STORE_SERVICE = "blob_store"; field public static final String BUGREPORT_SERVICE = "bugreport"; field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture"; field public static final String DEVICE_IDLE_CONTROLLER = "deviceidle"; diff --git a/config/preloaded-classes b/config/preloaded-classes index 1b9898a3cd68..ab98e5b1f87a 100644 --- a/config/preloaded-classes +++ b/config/preloaded-classes @@ -546,6 +546,7 @@ android.app.backup.IBackupManager$Stub$Proxy android.app.backup.IBackupManager$Stub android.app.backup.IBackupManager android.app.backup.SharedPreferencesBackupHelper +android.app.blob.BlobStoreManagerFrameworkInitializer android.app.contentsuggestions.ContentSuggestionsManager android.app.job.IJobCallback$Stub$Proxy android.app.job.IJobCallback$Stub diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 36d899ea611f..1e87ab1a2866 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -21,6 +21,7 @@ import android.accounts.IAccountManager; import android.app.ContextImpl.ServiceInitializationState; import android.app.admin.DevicePolicyManager; import android.app.admin.IDevicePolicyManager; +import android.app.blob.BlobStoreManagerFrameworkInitializer; import android.app.contentsuggestions.ContentSuggestionsManager; import android.app.contentsuggestions.IContentSuggestionsManager; import android.app.job.JobSchedulerFrameworkInitializer; @@ -1311,6 +1312,8 @@ public final class SystemServiceRegistry { JobSchedulerFrameworkInitializer.initialize(); DeviceIdleFrameworkInitializer.initialize(); + + BlobStoreManagerFrameworkInitializer.initialize(); } /** diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 0b0fe798190c..6e583832c22e 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -4782,6 +4782,20 @@ public abstract class Context { public static final String DYNAMIC_SYSTEM_SERVICE = "dynamic_system"; /** + * Use with {@link #getSystemService(String)} to retrieve a {@link + * android.app.blob.BlobStoreManager} for contributing and accessing data blobs + * from the blob store maintained by the system. + * + * @see #getSystemService(String) + * @see android.app.blob.BlobStoreManager + * + * TODO: make this public once BlobStoreManager is ready. + * @hide + */ + @TestApi + public static final String BLOB_STORE_SERVICE = "blob_store"; + + /** * Use with {@link #getSystemService(String)} to retrieve an * {@link TelephonyRegistryManager}. * @hide diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index ef9e69df01df..2a364e6e4aae 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -277,6 +277,8 @@ public final class SystemServer { "com.android.server.contentsuggestions.ContentSuggestionsManagerService"; private static final String DEVICE_IDLE_CONTROLLER_CLASS = "com.android.server.DeviceIdleController"; + private static final String BLOB_STORE_MANAGER_SERVICE_CLASS = + "com.android.server.blob.BlobStoreManagerService"; private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst"; @@ -1902,6 +1904,10 @@ public final class SystemServer { mSystemServiceManager.startService(ClipboardService.class); t.traceEnd(); + t.traceBegin("StartBlobStoreManagerService"); + mSystemServiceManager.startService(BLOB_STORE_MANAGER_SERVICE_CLASS); + t.traceEnd(); + t.traceBegin("AppServiceManager"); mSystemServiceManager.startService(AppBindingService.Lifecycle.class); t.traceEnd(); |