Make libincident into a stable C API.

Test: atest GtsIncidentConfirmationTestCases GtsIncidentManagerTestCases libincident_test
Bug: 144187174
Change-Id: I65b5a13cfb6a57aa56f738e25a76c5ecb8e7a1a8
diff --git a/libs/incident/Android.bp b/libs/incident/Android.bp
index 150f6dc..512b8c4 100644
--- a/libs/incident/Android.bp
+++ b/libs/incident/Android.bp
@@ -12,8 +12,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-cc_library_shared {
-    name: "libincident",
+
+cc_defaults {
+    name: "libincidentpriv_defaults",
 
     cflags: [
         "-Wall",
@@ -50,6 +51,70 @@
         ":libincident_aidl",
         "src/IncidentReportArgs.cpp",
     ],
+}
+
+cc_library_shared {
+    name: "libincidentpriv",
+    defaults: ["libincidentpriv_defaults"],
+    export_include_dirs: ["include_priv"],
+}
+
+cc_library_shared {
+    name: "libincident",
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-missing-field-initializers",
+        "-Wno-unused-variable",
+        "-Wunused-parameter",
+    ],
+
+    shared_libs: [
+        "libbinder",
+        "liblog",
+        "libutils",
+        "libincidentpriv",
+    ],
+
+    srcs: [
+        "src/incident_report.cpp",
+    ],
 
     export_include_dirs: ["include"],
+
+    stubs: {
+        symbol_file: "libincident.map.txt",
+        versions: [
+            "30",
+        ],
+    },
 }
+
+cc_test {
+    name: "libincident_test",
+    defaults: ["libincidentpriv_defaults"],
+    test_suites: ["device-tests"],
+
+    include_dirs: [
+        "frameworks/base/libs/incident/include",
+        "frameworks/base/libs/incident/include_priv",
+    ],
+
+    srcs: [
+        "tests/IncidentReportArgs_test.cpp",
+        "tests/IncidentReportRequest_test.cpp",
+        "tests/c_api_compile_test.c",
+    ],
+
+    shared_libs: [
+        "libincident",
+    ],
+
+    static_libs: [
+        "libgmock",
+    ],
+}
+
+
+