Implement Android service framework for data sharing
This CL implements the framework for being able to access the
DataSharingService KeyedService from Java in the //chrome layer
seamlessly.
The JNI aspect of the API is hidden away from client code and
automatically setup through use of the profile keyed service factory.
Bug: b/301390275
Change-Id: Idb1049e0bc54440397e6ff61ce7499677c5e1c51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5174179
Reviewed-by: Min Qin <[email protected]>
Code-Coverage: [email protected] <[email protected]>
Commit-Queue: Tommy Nyquist <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1245600}
diff --git a/chrome/browser/data_sharing/BUILD.gn b/chrome/browser/data_sharing/BUILD.gn
new file mode 100644
index 0000000..3331f0d8
--- /dev/null
+++ b/chrome/browser/data_sharing/BUILD.gn
@@ -0,0 +1,48 @@
+# Copyright 2024 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+if (is_android) {
+ import("//build/config/android/config.gni")
+ import("//build/config/android/rules.gni")
+ import("//third_party/jni_zero/jni_zero.gni")
+}
+
+if (is_android) {
+ android_library("factory_java") {
+ srcjar_deps = [ ":jni_headers" ]
+ sources = [ "android/java/src/org/chromium/chrome/browser/data_sharing/DataSharingServiceFactory.java" ]
+
+ deps = [
+ "//base:base_java",
+ "//build/android:build_java",
+ "//chrome/browser/profiles/android:java",
+ "//components/data_sharing/public:public_java",
+ "//third_party/androidx:androidx_annotation_annotation_java",
+ "//third_party/jni_zero:jni_zero_java",
+ ]
+ }
+
+ android_library("javatests") {
+ testonly = true
+
+ sources = [ "android/java/src/org/chromium/chrome/browser/data_sharing/DataSharingServiceFactoryTest.java" ]
+ deps = [
+ "//base:base_java",
+ "//base:base_java_test_support",
+ "//chrome/browser/data_sharing:factory_java",
+ "//chrome/browser/flags:java",
+ "//chrome/browser/profiles/android:java",
+ "//chrome/test/android:chrome_java_integration_test_support",
+ "//components/data_sharing/public:public_java",
+ "//third_party/androidx:androidx_test_runner_java",
+ "//third_party/hamcrest:hamcrest_core_java",
+ "//third_party/hamcrest:hamcrest_library_java",
+ "//third_party/junit:junit",
+ ]
+ }
+
+ generate_jni("jni_headers") {
+ sources = [ "android/java/src/org/chromium/chrome/browser/data_sharing/DataSharingServiceFactory.java" ]
+ }
+}