Merge "DO NOT MERGE: Merge Oreo MR1 into master"
diff --git a/Android.mk b/Android.mk
index 311f8c7..bcfc5d7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,17 +14,19 @@
LOCAL_PATH := $(call my-dir)
-
-# Build libphotoviewer linking non-statically against the libraries it needs.
-# This is to allow the library to be loaded dynamically in a context where
-# the required libraries already exist. You should only use this library
-# if you're certain that you need it; see go/extradex-design for more context.
-appcompat_res_dirs := appcompat/res res ../../../$(SUPPORT_LIBRARY_ROOT)/v7/appcompat/res ../../../$(SUPPORT_LIBRARY_ROOT)/compat/res
-
+##################################################
+# Build appcompat library
include $(CLEAR_VARS)
-LOCAL_MODULE := libphotoviewer_appcompat_dynamic
-LOCAL_JAVA_LIBRARIES := android-support-v4 \
+appcompat_res_dirs := appcompat/res res
+LOCAL_MODULE := libphotoviewer_appcompat
+
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-annotations \
+ android-support-compat \
+ android-support-core-ui \
+ android-support-core-utils \
+ android-support-fragment \
android-support-v7-appcompat
LOCAL_SDK_VERSION := current
@@ -34,20 +36,23 @@
$(call all-logtags-files-under, src)
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(appcompat_res_dirs))
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-LOCAL_AAPT_FLAGS += --extra-packages android.support.compat
+LOCAL_USE_AAPT2 := true
include $(BUILD_STATIC_JAVA_LIBRARY)
-# Dynamic version of non-appcompat library
-# You should only use this library if you're certain that you need it; see
-# go/extradex-design for more context.
+##################################################
+# Build non-appcompat library
include $(CLEAR_VARS)
-activity_res_dirs := activity/res res ../../../$(SUPPORT_LIBRARY_ROOT)/compat/res
-LOCAL_MODULE := libphotoviewer_dynamic
+activity_res_dirs := activity/res res
+LOCAL_MODULE := libphotoviewer
-LOCAL_JAVA_LIBRARIES := android-support-v4
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-annotations \
+ android-support-compat \
+ android-support-core-ui \
+ android-support-core-utils \
+ android-support-fragment
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := \
@@ -56,44 +61,7 @@
$(call all-logtags-files-under, src)
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(activity_res_dirs))
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-LOCAL_AAPT_FLAGS += --extra-packages android.support.compat
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-# Build the regular static libraries based on the above.
-include $(CLEAR_VARS)
-
-activity_res_dirs := activity/res res
-LOCAL_MODULE := libphotoviewer_appcompat
-
-LOCAL_STATIC_JAVA_LIBRARIES := libphotoviewer_appcompat_dynamic \
- android-support-v4 android-support-v7-appcompat
-
-LOCAL_SDK_VERSION := current
-LOCAL_SOURCE_FILES_ALL_GENERATED := true
-
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(appcompat_res_dirs))
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-LOCAL_AAPT_FLAGS += --extra-packages android.support.compat
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-include $(CLEAR_VARS)
-
-activity_res_dirs := activity/res res ../../../$(SUPPORT_LIBRARY_ROOT)/compat/res
-LOCAL_MODULE := libphotoviewer
-
-LOCAL_STATIC_JAVA_LIBRARIES := libphotoviewer_dynamic android-support-v4
-
-LOCAL_SDK_VERSION := current
-LOCAL_SOURCE_FILES_ALL_GENERATED := true
-
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(activity_res_dirs))
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-LOCAL_AAPT_FLAGS += --extra-packages android.support.compat
+LOCAL_USE_AAPT2 := true
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/sample/Android.mk b/sample/Android.mk
index b7724bd..a636898 100644
--- a/sample/Android.mk
+++ b/sample/Android.mk
@@ -14,10 +14,6 @@
LOCAL_PATH:= $(call my-dir)
-#Include res dir from photoviewer
-photo_dir := ../res ../activity/res
-res_dirs := $(photo_dir) res ../../../../$(SUPPORT_LIBRARY_ROOT)/compat/res
-
##################################################
# Build APK
include $(CLEAR_VARS)
@@ -25,39 +21,46 @@
src_dirs := src
LOCAL_PACKAGE_NAME := PhotoViewerSample
-LOCAL_STATIC_JAVA_LIBRARIES += libphotoviewer
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-annotations \
+ android-support-compat \
+ android-support-core-ui \
+ android-support-core-utils \
+ android-support-fragment \
+ libphotoviewer
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) \
$(call all-logtags-files-under, $(src_dirs))
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-LOCAL_AAPT_FLAGS += --extra-packages com.android.ex.photo:android.support.compat
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_USE_AAPT2 := true
include $(BUILD_PACKAGE)
##################################################
-
-#Include res dir from photoviewer
-photo_dir := ../res ../appcompat/res
-res_dirs := $(photo_dir) res ../../../../$(SUPPORT_LIBRARY_ROOT)/v7/appcompat/res ../../../../$(SUPPORT_LIBRARY_ROOT)/compat/res
-
# Build APK
include $(CLEAR_VARS)
src_dirs := src
LOCAL_PACKAGE_NAME := AppcompatPhotoViewerSample
-LOCAL_STATIC_JAVA_LIBRARIES += libphotoviewer_appcompat
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-annotations \
+ android-support-compat \
+ android-support-core-ui \
+ android-support-core-utils \
+ android-support-fragment \
+ android-support-media-compat \
+ android-support-v7-appcompat \
+ libphotoviewer_appcompat
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) \
$(call all-logtags-files-under, $(src_dirs))
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat:com.android.ex.photo:android.support.compat
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_USE_AAPT2 := true
include $(BUILD_PACKAGE)