SettingsLib: Build with AAPT2
Bug:22775504
Change-Id: I2e5015235384d124418d32186daa190f38e1c5b3
diff --git a/packages/SettingsLib/Android.mk b/packages/SettingsLib/Android.mk
index 2189b55..1098a8e 100644
--- a/packages/SettingsLib/Android.mk
+++ b/packages/SettingsLib/Android.mk
@@ -1,24 +1,21 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
+
LOCAL_MODULE := SettingsLib
-LOCAL_STATIC_JAVA_LIBRARIES := \
+LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v4 \
android-support-v7-recyclerview \
android-support-v7-preference \
android-support-v7-appcompat \
android-support-v14-preference
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
- frameworks/support/v7/preference/res \
- frameworks/support/v14/preference/res \
- frameworks/support/v7/appcompat/res \
- frameworks/support/v7/recyclerview/res
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_AAPT_FLAGS := --auto-add-overlay \
- --extra-packages android.support.v7.preference:android.support.v14.preference:android.support.v17.preference:android.support.v7.appcompat:android.support.v7.recyclerview
-
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/packages/SettingsLib/common.mk b/packages/SettingsLib/common.mk
index b017047..cf0ba6c 100644
--- a/packages/SettingsLib/common.mk
+++ b/packages/SettingsLib/common.mk
@@ -13,6 +13,16 @@
# include frameworks/base/packages/SettingsLib/common.mk
#
+ifeq ($(LOCAL_USE_AAPT2),true)
+LOCAL_STATIC_ANDROID_LIBRARIES += \
+ android-support-annotations \
+ android-support-v4 \
+ SettingsLib
+else
LOCAL_RESOURCE_DIR += $(call my-dir)/res
LOCAL_AAPT_FLAGS += --auto-add-overlay --extra-packages com.android.settingslib
-LOCAL_STATIC_JAVA_LIBRARIES += SettingsLib
+LOCAL_STATIC_JAVA_LIBRARIES += \
+ android-support-annotations \
+ android-support-v4 \
+ SettingsLib
+endif
diff --git a/packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java b/packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java
index e69497a..b30de64 100644
--- a/packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java
+++ b/packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java
@@ -46,7 +46,8 @@
}
public RestrictedPreference(Context context, AttributeSet attrs) {
- this(context, attrs, TypedArrayUtils.getAttr(context, R.attr.preferenceStyle,
+ this(context, attrs, TypedArrayUtils.getAttr(context,
+ android.support.v7.preference.R.attr.preferenceStyle,
android.R.attr.preferenceStyle));
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/RestrictedSwitchPreference.java b/packages/SettingsLib/src/com/android/settingslib/RestrictedSwitchPreference.java
index f381286..0aabced 100644
--- a/packages/SettingsLib/src/com/android/settingslib/RestrictedSwitchPreference.java
+++ b/packages/SettingsLib/src/com/android/settingslib/RestrictedSwitchPreference.java
@@ -47,7 +47,8 @@
}
public RestrictedSwitchPreference(Context context, AttributeSet attrs) {
- this(context, attrs, TypedArrayUtils.getAttr(context, R.attr.switchPreferenceStyle,
+ this(context, attrs, TypedArrayUtils.getAttr(context,
+ android.support.v7.preference.R.attr.switchPreferenceStyle,
android.R.attr.switchPreferenceStyle));
}