MuPDF: Add inline build support

* Prebuilt lib from https://maven.ghostscript.com/com/artifex/mupdf/fitz/1.20.2/fitz-1.20.2.aar

Change-Id: I768e47c9d630e739c38a02e284e08b74e5817720
diff --git a/.gitignore b/.gitignore
index d9bade0..4565aa6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
 *.iml
 android.keystore
 build
+jni
 local.properties
 MAVEN
 tags
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index cf17dfc..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "jni"]
-	path = jni
-	url = ../mupdf-android-fitz.git
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..7d39a66
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2022 The LeafOS 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.
+ */
+
+android_library {
+    name: "com.artifex.mupdf_viewer",
+    platform_apis: true,
+    system_ext_specific: true,
+    srcs: [
+        "jni/platform/java/src/**/*.java",
+        "lib/src/main/java/**/*.java",
+    ],
+    resource_dirs: [
+        "lib/src/main/res",
+    ],
+    static_libs: [
+        "androidx.appcompat_appcompat",
+        "com.artifex.mupdf_fitz",
+    ],
+    manifest: "lib/src/main/AndroidManifest.xml",
+    optimize: {
+        enabled: false,
+    },
+}
+
+android_app {
+    name: "MuPDF",
+    platform_apis: true,
+    system_ext_specific: true,
+    srcs: [
+        "app/src/main/java/**/*.java",
+    ],
+    resource_dirs: [
+        "app/src/main/res",
+    ],
+    static_libs: ["com.artifex.mupdf_viewer"],
+    jni_libs: ["libmupdf_java"],
+    manifest: "app/src/main/AndroidManifest.xml",
+    optimize: {
+        enabled: false,
+    },
+    aaptflags: [
+        "--rename-manifest-package",
+        "org.leafos.mupdf",
+    ],
+}
diff --git a/jni b/jni
deleted file mode 160000
index 598781a..0000000
--- a/jni
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 598781a3e78d4e39bb9ba50d5dee3e30e411ee6a
diff --git a/libs/Android.bp b/libs/Android.bp
new file mode 100644
index 0000000..fb2ecc0
--- /dev/null
+++ b/libs/Android.bp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022 The LeafOS 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.
+ */
+
+cc_prebuilt_library_shared {
+    name: "libmupdf_java",
+    sdk_version: "current",
+    system_ext_specific: true,
+    strip: {
+        none: true,
+    },
+    check_elf_files: false,
+    target: {
+        android_arm: {
+            srcs: ["com.artifex.mupdf_fitz/jni/armeabi-v7a/libmupdf_java.so"],
+        },
+        android_arm64: {
+            srcs: ["com.artifex.mupdf_fitz/jni/arm64-v8a/libmupdf_java.so"],
+        },
+        android_x86: {
+            srcs: ["com.artifex.mupdf_fitz/jni/x86/libmupdf_java.so"],
+        },
+        android_x86_64: {
+            srcs: ["com.artifex.mupdf_fitz/jni/x86_64/libmupdf_java.so"],
+        },
+    }
+}
+
+android_library_import {
+    name: "com.artifex.mupdf_fitz",
+    aars: ["com.artifex.mupdf_fitz.aar"],
+    sdk_version: "current",
+}
diff --git a/libs/com.artifex.mupdf_fitz.aar b/libs/com.artifex.mupdf_fitz.aar
new file mode 100644
index 0000000..a0395db
--- /dev/null
+++ b/libs/com.artifex.mupdf_fitz.aar
Binary files differ
diff --git a/libs/com.artifex.mupdf_fitz/jni/arm64-v8a/libmupdf_java.so b/libs/com.artifex.mupdf_fitz/jni/arm64-v8a/libmupdf_java.so
new file mode 100644
index 0000000..e0f34b4
--- /dev/null
+++ b/libs/com.artifex.mupdf_fitz/jni/arm64-v8a/libmupdf_java.so
Binary files differ
diff --git a/libs/com.artifex.mupdf_fitz/jni/armeabi-v7a/libmupdf_java.so b/libs/com.artifex.mupdf_fitz/jni/armeabi-v7a/libmupdf_java.so
new file mode 100644
index 0000000..f248129
--- /dev/null
+++ b/libs/com.artifex.mupdf_fitz/jni/armeabi-v7a/libmupdf_java.so
Binary files differ
diff --git a/libs/com.artifex.mupdf_fitz/jni/x86/libmupdf_java.so b/libs/com.artifex.mupdf_fitz/jni/x86/libmupdf_java.so
new file mode 100644
index 0000000..27d1123
--- /dev/null
+++ b/libs/com.artifex.mupdf_fitz/jni/x86/libmupdf_java.so
Binary files differ
diff --git a/libs/com.artifex.mupdf_fitz/jni/x86_64/libmupdf_java.so b/libs/com.artifex.mupdf_fitz/jni/x86_64/libmupdf_java.so
new file mode 100644
index 0000000..cf73aed
--- /dev/null
+++ b/libs/com.artifex.mupdf_fitz/jni/x86_64/libmupdf_java.so
Binary files differ