Convert to Android.bp
See build/soong/README.md for more information.
Fixes: 122333482
Test: treehugger
Change-Id: Ie4ea31b8c2d1777b70f63ecb03f27b4ef4ec4705
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..9f771d0
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,50 @@
+android_app {
+ name: "Gallery2",
+
+ static_libs: [
+ "com.google.android.material_material",
+ "androidx.annotation_annotation",
+ "androidx.fragment_fragment",
+ "androidx.heifwriter_heifwriter",
+ "androidx.legacy_legacy-support-core-ui",
+ "androidx.core_core",
+ "androidx.legacy_legacy-support-v13",
+ "com.android.gallery3d.common2",
+ "xmp_toolkit",
+ "mp4parser",
+ ],
+
+ srcs: [
+ "src/**/*.java",
+ "src_pd/**/*.java",
+ ],
+
+ resource_dirs: ["res"],
+
+ privileged: true,
+ certificate: "platform",
+
+ system_ext_specific: true,
+
+ platform_apis: true,
+
+ overrides: [
+ "Gallery",
+ "Gallery3D",
+ "GalleryNew3D",
+ ],
+
+ jni_libs: [
+ "libjni_gallery_eglfence",
+ "libjni_gallery_filters",
+ "libjni_gallery_jpegstream",
+ ],
+
+ optimize: {
+ proguard_flags_files: ["proguard.flags"],
+ },
+
+ libs: ["telephony-common"] + ["org.apache.http.legacy"],
+
+ jarjar_rules: "jarjar-rules.txt",
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index d26d555..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,62 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_JAVA_LIBRARIES := telephony-common
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- com.google.android.material_material \
- androidx.annotation_annotation \
- androidx.fragment_fragment \
- androidx.heifwriter_heifwriter \
- androidx.legacy_legacy-support-core-ui \
- androidx.core_core \
- androidx.legacy_legacy-support-v13
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- com.android.gallery3d.common2 \
- xmp_toolkit \
- mp4parser
-
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src) \
- $(call all-java-files-under, src_pd)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_PACKAGE_NAME := Gallery2
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_CERTIFICATE := platform
-
-LOCAL_SYSTEM_EXT_MODULE := true
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_OVERRIDES_PACKAGES := Gallery Gallery3D GalleryNew3D
-
-LOCAL_JNI_SHARED_LIBRARIES := \
- libjni_gallery_eglfence \
- libjni_gallery_filters \
- libjni_gallery_jpegstream
-
-LOCAL_SHARED_LIBRARIES += \
- libjni_dualcamera \
- libjni_trueportrait \
- libjni_filtergenerator
-
-LOCAL_REQUIRED_MODULES := libts_detected_face_jni libts_face_beautify_jni
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-LOCAL_JAVA_LIBRARIES += org.apache.http.legacy
-
-LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make gallery test apk
-include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/gallerycommon/Android.bp b/gallerycommon/Android.bp
new file mode 100644
index 0000000..d92bba3
--- /dev/null
+++ b/gallerycommon/Android.bp
@@ -0,0 +1,20 @@
+// Copyright 2011, 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: "com.android.gallery3d.common2",
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ libs: ["org.apache.http.legacy"],
+}
diff --git a/gallerycommon/Android.mk b/gallerycommon/Android.mk
deleted file mode 100644
index bb62851..0000000
--- a/gallerycommon/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2011, 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Build the com.android.emailcommon static library. At the moment, this includes
-# the emailcommon files themselves plus everything under src/org (apache code). All of our
-# AIDL files are also compiled into the static library
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := com.android.gallery3d.common2
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_JAVA_LIBRARIES += org.apache.http.legacy
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/jni/Android.bp b/jni/Android.bp
new file mode 100644
index 0000000..b6971c6
--- /dev/null
+++ b/jni/Android.bp
@@ -0,0 +1,61 @@
+cc_defaults {
+ name: "gallery2_jni_defaults",
+ system_ext_specific: true,
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ sdk_version: "9",
+ shared_libs: ["liblog"],
+}
+
+cc_library_shared {
+ name: "libjni_gallery_eglfence",
+ defaults: ["gallery2_jni_defaults"],
+
+ cflags: ["-DEGL_EGLEXT_PROTOTYPES"],
+ shared_libs: ["libEGL"],
+ srcs: ["jni_egl_fence.cpp"],
+}
+
+// Filtershow
+cc_library_shared {
+ name: "libjni_gallery_filters",
+ defaults: ["gallery2_jni_defaults"],
+
+ srcs: [
+ "filters/gradient.c",
+ "filters/saturated.c",
+ "filters/exposure.c",
+ "filters/edge.c",
+ "filters/contrast.c",
+ "filters/hue.c",
+ "filters/shadows.c",
+ "filters/highlight.c",
+ "filters/hsv.c",
+ "filters/vibrance.c",
+ "filters/geometry.c",
+ "filters/negative.c",
+ "filters/redEyeMath.c",
+ "filters/fx.c",
+ "filters/wbalance.c",
+ "filters/redeye.c",
+ "filters/bwfilter.c",
+ "filters/tinyplanet.cc",
+ "filters/kmeans.cc",
+ ],
+
+ cflags: [
+ "-ffast-math",
+ "-O3",
+ "-funroll-loops",
+ ],
+ shared_libs: ["libjnigraphics"],
+ arch: {
+ arm: {
+ instruction_set: "arm",
+ },
+ },
+}
diff --git a/jni/Android.mk b/jni/Android.mk
deleted file mode 100644
index 067fd3f..0000000
--- a/jni/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_SRC_FILES := jni_egl_fence.cpp
-
-LOCAL_SDK_VERSION := 9
-
-LOCAL_SYSTEM_EXT_MODULE := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := libjni_gallery_eglfence
-
-LOCAL_LDLIBS := -llog -lEGL
-
-
-include $(BUILD_SHARED_LIBRARY)
-
-# Filtershow
-
-include $(CLEAR_VARS)
-
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_SDK_VERSION := 9
-LOCAL_SYSTEM_EXT_MODULE := true
-LOCAL_MODULE := libjni_gallery_filters
-LOCAL_SRC_FILES := filters/gradient.c \
- filters/saturated.c \
- filters/exposure.c \
- filters/edge.c \
- filters/contrast.c \
- filters/hue.c \
- filters/shadows.c \
- filters/highlight.c \
- filters/hsv.c \
- filters/vibrance.c \
- filters/geometry.c \
- filters/negative.c \
- filters/redEyeMath.c \
- filters/fx.c \
- filters/wbalance.c \
- filters/redeye.c \
- filters/bwfilter.c \
- filters/tinyplanet.cc \
- filters/kmeans.cc
-
-LOCAL_CFLAGS += -ffast-math -O3 -funroll-loops
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-LOCAL_LDLIBS := -llog -ljnigraphics
-LOCAL_ARM_MODE := arm
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/jni/Application.mk b/jni/Application.mk
deleted file mode 100644
index 22d188e..0000000
--- a/jni/Application.mk
+++ /dev/null
@@ -1 +0,0 @@
-APP_PLATFORM := android-9
diff --git a/jni_jpegstream/Android.bp b/jni_jpegstream/Android.bp
new file mode 100644
index 0000000..c196782
--- /dev/null
+++ b/jni_jpegstream/Android.bp
@@ -0,0 +1,36 @@
+// Jpeg Streaming native
+cc_library_shared {
+ name: "libjni_gallery_jpegstream",
+ system_ext_specific: true,
+
+ static_libs: ["libjpeg_static_ndk"],
+ shared_libs: ["liblog"],
+
+ arch: {
+ arm: {
+ instruction_set: "arm",
+ },
+ },
+ cflags: [
+ "-ffast-math",
+ "-O3",
+ "-funroll-loops",
+
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ local_include_dirs: ["src"],
+ sdk_version: "17",
+
+ srcs: [
+ "src/inputstream_wrapper.cpp",
+ "src/jpegstream.cpp",
+ "src/jerr_hook.cpp",
+ "src/jpeg_hook.cpp",
+ "src/jpeg_writer.cpp",
+ "src/jpeg_reader.cpp",
+ "src/outputstream_wrapper.cpp",
+ "src/stream_wrapper.cpp",
+ ],
+}
diff --git a/jni_jpegstream/Android.mk b/jni_jpegstream/Android.mk
deleted file mode 100644
index ac4aff9..0000000
--- a/jni_jpegstream/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# Jpeg Streaming native
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjni_gallery_jpegstream
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH) \
- $(LOCAL_PATH)/src
-
-LOCAL_STATIC_LIBRARIES := libjpeg_static_ndk
-
-LOCAL_SDK_VERSION := 17
-LOCAL_ARM_MODE := arm
-LOCAL_SYSTEM_EXT_MODULE := true
-LOCAL_CFLAGS += -ffast-math -O3 -funroll-loops
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-LOCAL_LDLIBS := -llog
-
-LOCAL_CPP_EXTENSION := .cpp
-LOCAL_SRC_FILES := \
- src/inputstream_wrapper.cpp \
- src/jpegstream.cpp \
- src/jerr_hook.cpp \
- src/jpeg_hook.cpp \
- src/jpeg_writer.cpp \
- src/jpeg_reader.cpp \
- src/outputstream_wrapper.cpp \
- src/stream_wrapper.cpp
-
-
-include $(BUILD_SHARED_LIBRARY)