diff --git a/android/.classpath b/android/.classpath index 6efcbb739a..1b4b1eed7e 100644 --- a/android/.classpath +++ b/android/.classpath @@ -3,5 +3,5 @@ - + diff --git a/android/android.make b/android/android.make index ec7ba32ea5..6180ef64da 100644 --- a/android/android.make +++ b/android/android.make @@ -27,9 +27,6 @@ $(CPUFEAT_BUILD)/cpu-features.o: $(CPUFEAT)/cpu-features.c .SECONDEXPANSION: # $$(OBJ) is not populated until after this .PHONY: apk classes clean dex dirs libs jar - -java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1)))) - # API version ANDROID_PLATFORM_VERSION=11 ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION) @@ -42,21 +39,27 @@ ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign KEYSTORE=$(HOME)/.android/debug.keystore ADB=$(ANDROID_SDK_PATH)/platform-tools/adb +CLASSPATH := $(BUILDDIR)/bin/classes + MANIFEST := $(BUILDDIR)/bin/AndroidManifest.xml MANIFEST_SRC := $(ANDROID_DIR)/AndroidManifest.xml R_JAVA := $(BUILDDIR)/gen/$(PACKAGE_PATH)/R.java -R_OBJ := $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class +R_OBJ := $(CLASSPATH)/$(PACKAGE_PATH)/R.class JAVA_SRC := $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/*.java) JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/Helper/*.java) JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/widgets/*.java) JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/monitors/*.java) -JAVA_OBJ := $(call java2class,$(subst $(ANDROID)/src/$(PACKAGE_PATH),$(ANDROID)/bin/$(PACKAGE_PATH),$(JAVA_SRC))) + +java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR)/src,$(CLASSPATH),$(1)))) + +JAVA_OBJ := $(call java2class,$(JAVA_SRC)) LIBS := $(BINLIB_DIR)/$(BINARY) $(BINLIB_DIR)/libmisc.so LIBS += $(addprefix $(BINLIB_DIR)/lib,$(patsubst %.codec,%.so,$(notdir $(CODECS)))) + TEMP_APK := $(BUILDDIR)/bin/_rockbox.apk TEMP_APK2 := $(BUILDDIR)/bin/__rockbox.apk DEX := $(BUILDDIR)/bin/classes.dex @@ -65,17 +68,17 @@ AP_ := $(BUILDDIR)/bin/resources.ap_ APK := $(BUILDDIR)/rockbox.apk _DIRS := $(BUILDDIR)/___/$(PACKAGE_PATH) -DIRS := $(subst ___,bin,$(_DIRS)) DIRS += $(subst ___,gen,$(_DIRS)) DIRS += $(subst ___,data,$(_DIRS)) DIRS += $(BUILDDIR)/libs/armeabi DIRS += $(CPUFEAT_BUILD) +DIRS += $(CLASSPATH) RES := $(wildcard $(ANDROID_DIR)/res/*/*) CLEANOBJS += bin gen libs data -JAVAC_OPTS += -implicit:none -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin +JAVAC_OPTS += -implicit:none -classpath $(ANDROID_PLATFORM)/android.jar:$(CLASSPATH) .PHONY: $(MANIFEST): $(MANIFEST_SRC) $(DIRS) @@ -86,21 +89,18 @@ $(R_JAVA) $(AP_): $(MANIFEST) $(RES) | $(DIRS) -J $(BUILDDIR)/gen -M $(MANIFEST) -S $(ANDROID_DIR)/res \ -I $(ANDROID_PLATFORM)/android.jar -F $(AP_) -$(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class: $(R_JAVA) +$(CLASSPATH)/$(PACKAGE_PATH)/R.class: $(R_JAVA) $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ - $(JAVAC_OPTS) \ - -sourcepath $(ANDROID_DIR)/gen $< + $(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/gen $< -$(BUILDDIR)/bin/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class - $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ - $(JAVAC_OPTS) \ - -sourcepath $(ANDROID_DIR)/src $< +$(CLASSPATH)/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(CLASSPATH)/$(PACKAGE_PATH)/R.class + $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(CLASSPATH) \ + $(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/src $< $(JAR): $(JAVA_SRC) $(R_JAVA) - $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$?))javac -d $(BUILDDIR)/bin \ - $(JAVAC_OPTS) \ - -sourcepath $(ANDROID_DIR)/src:$(ANDROID_DIR)/gen $? - $(call PRINTS,JAR $(subst $(BUILDDIR)/,,$@))jar cf $(JAR) -C $(BUILDDIR)/bin org + $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$?))javac -d $(CLASSPATH) \ + $(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/src:$(ANDROID_DIR)/gen $? + $(call PRINTS,JAR $(subst $(BUILDDIR)/,,$@))jar cf $(JAR) -C $(CLASSPATH) org jar: $(JAR) @@ -127,7 +127,7 @@ $(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip $(BINLIB_DIR)/lib%.so: $(BUILDDIR)/apps/codecs/%.codec $(call PRINTS,CP $(@F))cp $^ $@ -libs: $(LIBS) +libs: $(DIRS) $(LIBS) $(TEMP_APK): $(AP_) $(LIBS) $(DEX) | $(DIRS) $(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \ diff --git a/android/ant.properties b/android/ant.properties new file mode 100644 index 0000000000..55563df961 --- /dev/null +++ b/android/ant.properties @@ -0,0 +1,12 @@ +# Override some props according to android.make +# see $ANDROID_SDK_PATH/tools/ant/build.xml for what's overridable +# Once we can build signed *release* builds, we should have a different +# names for the debug builds + + +# the signed, unzipaligned file is bin/__rockbox.apk +out.packaged.file=bin/__${ant.project.name}.apk + +# the final file is rockbox.apk, in the build dir +out.packaged.file=${ant.project.name}.apk + diff --git a/android/build.xml b/android/build.xml new file mode 100644 index 0000000000..1f81b8d655 --- /dev/null +++ b/android/build.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/proguard.cfg b/android/proguard.cfg new file mode 100644 index 0000000000..b1cdf17b5b --- /dev/null +++ b/android/proguard.cfg @@ -0,0 +1,40 @@ +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontpreverify +-verbose +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* + +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class com.android.vending.licensing.ILicensingService + +-keepclasseswithmembernames class * { + native ; +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet); +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet, int); +} + +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} diff --git a/android/default.properties b/android/project.properties similarity index 74% rename from android/default.properties rename to android/project.properties index 510b0908b3..8da376af8d 100644 --- a/android/default.properties +++ b/android/project.properties @@ -1,11 +1,11 @@ # This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# +# # This file must be checked in Version Control Systems. -# +# # To customize properties used by the Ant build system use, -# "build.properties", and override values to adapt the script to your +# "ant.properties", and override values to adapt the script to your # project structure. # Project target. -target=android-11 +target=android-15