Bug 934646 - Part 3: Declare Android resource directories relative to $SRCDIR. r=glandium,gps,mfinkle
authorNick Alexander <nalexander@mozilla.com>
Wed, 11 Dec 2013 21:20:07 -0800
changeset 176104 8490d45f1525e4bd0b2ac3ff7925a90b247e5335
parent 176103 710003215a5c1edc5b5c8aa9f399f6da881be2d8
child 176105 9be250f7458f6057a5899195b5e44ac3cc975547
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, gps, mfinkle
bugs934646
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 934646 - Part 3: Declare Android resource directories relative to $SRCDIR. r=glandium,gps,mfinkle
build/mobile/robocop/moz.build
build/mobile/sutagent/android/fencp/moz.build
build/mobile/sutagent/android/ffxcp/moz.build
build/mobile/sutagent/android/moz.build
build/mobile/sutagent/android/watcher/moz.build
config/config.mk
config/makefiles/java-build.mk
js/src/config/config.mk
js/src/config/makefiles/java-build.mk
mobile/android/base/Makefile.in
mobile/android/base/android-services.mozbuild
mobile/android/base/crashreporter/res/drawable-mdpi/crash_reporter.png
mobile/android/base/crashreporter/res/layout/crash_reporter.xml
mobile/android/base/moz.build
mobile/android/base/resources/drawable-mdpi/crash_reporter.png
mobile/android/base/resources/layout/crash_reporter.xml
mobile/android/branding/aurora/content/fennec_144x144.png
mobile/android/branding/aurora/content/fennec_48x48.png
mobile/android/branding/aurora/content/fennec_72x72.png
mobile/android/branding/aurora/content/fennec_96x96.png
mobile/android/branding/aurora/res/drawable-hdpi/icon.png
mobile/android/branding/aurora/res/drawable-mdpi/icon.png
mobile/android/branding/aurora/res/drawable-xhdpi/icon.png
mobile/android/branding/aurora/res/drawable-xxhdpi/icon.png
mobile/android/branding/beta/content/fennec_144x144.png
mobile/android/branding/beta/content/fennec_48x48.png
mobile/android/branding/beta/content/fennec_72x72.png
mobile/android/branding/beta/content/fennec_96x96.png
mobile/android/branding/beta/res/drawable-hdpi/icon.png
mobile/android/branding/beta/res/drawable-mdpi/icon.png
mobile/android/branding/beta/res/drawable-xhdpi/icon.png
mobile/android/branding/beta/res/drawable-xxhdpi/icon.png
mobile/android/branding/nightly/content/fennec_144x144.png
mobile/android/branding/nightly/content/fennec_48x48.png
mobile/android/branding/nightly/content/fennec_72x72.png
mobile/android/branding/nightly/content/fennec_96x96.png
mobile/android/branding/nightly/res/drawable-hdpi/icon.png
mobile/android/branding/nightly/res/drawable-mdpi/icon.png
mobile/android/branding/nightly/res/drawable-xhdpi/icon.png
mobile/android/branding/nightly/res/drawable-xxhdpi/icon.png
mobile/android/branding/official/content/fennec_144x144.png
mobile/android/branding/official/content/fennec_48x48.png
mobile/android/branding/official/content/fennec_72x72.png
mobile/android/branding/official/content/fennec_96x96.png
mobile/android/branding/official/res/drawable-hdpi/icon.png
mobile/android/branding/official/res/drawable-mdpi/icon.png
mobile/android/branding/official/res/drawable-xhdpi/icon.png
mobile/android/branding/official/res/drawable-xxhdpi/icon.png
mobile/android/branding/unofficial/content/fennec_144x144.png
mobile/android/branding/unofficial/content/fennec_48x48.png
mobile/android/branding/unofficial/content/fennec_72x72.png
mobile/android/branding/unofficial/content/fennec_96x96.png
mobile/android/branding/unofficial/res/drawable-hdpi/icon.png
mobile/android/branding/unofficial/res/drawable-mdpi/icon.png
mobile/android/branding/unofficial/res/drawable-xhdpi/icon.png
mobile/android/branding/unofficial/res/drawable-xxhdpi/icon.png
mobile/android/tests/background/junit3/android-services.mozbuild
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/sandbox_symbols.py
toolkit/mozapps/installer/packager.mk
--- a/build/mobile/robocop/moz.build
+++ b/build/mobile/robocop/moz.build
@@ -1,11 +1,7 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-ANDROID_RESFILES = [
-    'res/values/strings.xml',
-]
-
 DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
--- a/build/mobile/sutagent/android/fencp/moz.build
+++ b/build/mobile/sutagent/android/fencp/moz.build
@@ -1,13 +1,5 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ANDROID_RESFILES = [
-    'res/drawable-hdpi/icon.png',
-    'res/drawable-ldpi/icon.png',
-    'res/drawable-mdpi/icon.png',
-    'res/layout/main.xml',
-    'res/values/strings.xml',
-]
--- a/build/mobile/sutagent/android/ffxcp/moz.build
+++ b/build/mobile/sutagent/android/ffxcp/moz.build
@@ -1,13 +1,5 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ANDROID_RESFILES = [
-    'res/drawable-hdpi/icon.png',
-    'res/drawable-ldpi/icon.png',
-    'res/drawable-mdpi/icon.png',
-    'res/layout/main.xml',
-    'res/values/strings.xml',
-]
--- a/build/mobile/sutagent/android/moz.build
+++ b/build/mobile/sutagent/android/moz.build
@@ -1,15 +1,5 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ANDROID_RESFILES = [
-    'res/drawable/ateamlogo.png',
-    'res/drawable/ic_stat_first.png',
-    'res/drawable/ic_stat_neterror.png',
-    'res/drawable/ic_stat_warning.png',
-    'res/drawable/icon.png',
-    'res/layout/main.xml',
-    'res/values/strings.xml',
-]
--- a/build/mobile/sutagent/android/watcher/moz.build
+++ b/build/mobile/sutagent/android/watcher/moz.build
@@ -1,16 +1,5 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ANDROID_RESFILES = [
-    'res/drawable-hdpi/ateamlogo.png',
-    'res/drawable-hdpi/icon.png',
-    'res/drawable-ldpi/ateamlogo.png',
-    'res/drawable-ldpi/icon.png',
-    'res/drawable-mdpi/ateamlogo.png',
-    'res/drawable-mdpi/icon.png',
-    'res/layout/main.xml',
-    'res/values/strings.xml',
-]
--- a/config/config.mk
+++ b/config/config.mk
@@ -30,17 +30,17 @@ endif
 -include $(DEPTH)/.mozconfig.mk
 
 # Integrate with mozbuild-generated make files. We first verify that no
 # variables provided by the automatically generated .mk files are
 # present. If they are, this is a violation of the separation of
 # responsibility between Makefile.in and mozbuild files.
 _MOZBUILD_EXTERNAL_VARIABLES := \
   ANDROID_GENERATED_RESFILES \
-  ANDROID_RESFILES \
+  ANDROID_RES_DIRS \
   CMSRCS \
   CMMSRCS \
   CPP_UNIT_TESTS \
   DIRS \
   EXTRA_PP_COMPONENTS \
   EXTRA_PP_JS_MODULES \
   FORCE_SHARED_LIB \
   FORCE_STATIC_LIB \
@@ -65,16 +65,17 @@ endif
   TEST_DIRS \
   TIERS \
   TOOL_DIRS \
   XPCSHELL_TESTS \
   XPIDL_MODULE \
   $(NULL)
 
 _DEPRECATED_VARIABLES := \
+  ANDROID_RESFILES \
   MOCHITEST_FILES_PARTS \
   MOCHITEST_BROWSER_FILES_PARTS \
   SHORT_LIBNAME \
   $(NULL)
 
 ifndef EXTERNALLY_MANAGED_MAKE_FILE
 # Using $(firstword) may not be perfect. But it should be good enough for most
 # scenarios.
--- a/config/makefiles/java-build.mk
+++ b/config/makefiles/java-build.mk
@@ -2,49 +2,27 @@
 # vim:set ts=8 sw=8 sts=8 noet:
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 ifndef INCLUDED_JAVA_BUILD_MK #{
 
-ifdef ANDROID_RESFILES #{
-ifndef IGNORE_ANDROID_RESFILES #{
-res-dep := .deps-copy-java-res
-
-GENERATED_DIRS += res
-GARBAGE        += $(res-dep)
-
-export:: $(res-dep)
-
-res-dep-preqs := \
-  $(addprefix $(srcdir)/,$(ANDROID_RESFILES)) \
-  $(call mkdir_deps,res) \
-  $(if $(IS_LANGUAGE_REPACK),FORCE) \
-  $(NULL)
-
-# nop-build: only copy res/ files when needed
-$(res-dep): $(res-dep-preqs)
-	$(call copy_dir,$(srcdir)/res,$(CURDIR)/res)
-	@$(TOUCH) $@
-endif #} IGNORE_ANDROID_RESFILES
-endif #} ANDROID_RESFILES
-
-
 ifdef JAVAFILES #{
 GENERATED_DIRS += classes
 
 export:: classes
 classes: $(call mkdir_deps,classes)
 endif #} JAVAFILES
 
 
 ifdef ANDROID_APK_NAME #{
-_ANDROID_RES_FLAG := -S $(or $(ANDROID_RES_DIR),res)
+android_res_dirs := $(addprefix $(srcdir)/,$(or $(ANDROID_RES_DIRS),res))
+_ANDROID_RES_FLAG := $(addprefix -S ,$(android_res_dirs))
 _ANDROID_ASSETS_FLAG := $(addprefix -A ,$(ANDROID_ASSETS_DIR))
 
 GENERATED_DIRS += classes
 
 classes.dex: $(call mkdir_deps,classes)
 classes.dex: R.java
 classes.dex: $(ANDROID_APK_NAME).ap_
 classes.dex: $(JAVAFILES)
@@ -52,17 +30,21 @@ classes.dex: $(JAVAFILES)
 	$(DX) --dex --output=$@ classes $(ANDROID_EXTRA_JARS)
 
 # R.java and $(ANDROID_APK_NAME).ap_ are both produced by aapt.  To
 # save an aapt invocation, we produce them both at the same time.
 
 R.java: .aapt.deps
 $(ANDROID_APK_NAME).ap_: .aapt.deps
 
-.aapt.deps: AndroidManifest.xml $(wildcard $(ANDROID_RES_DIR)) $(wildcard $(ANDROID_ASSETS_DIR))
+# This uses the fact that Android resource directories list all
+# resource files one subdirectory below the parent resource directory.
+android_res_files := $(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(android_res_dirs)))))
+
+.aapt.deps: AndroidManifest.xml $(android_res_files) $(wildcard $(ANDROID_ASSETS_DIR))
 	$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar $(_ANDROID_RES_FLAG) $(_ANDROID_ASSETS_FLAG) \
 		-J ${@D} \
 		-F $(ANDROID_APK_NAME).ap_
 	@$(TOUCH) $@
 
 $(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
 	cp $< $@
 	$(ZIP) -0 $@ classes.dex
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -30,17 +30,17 @@ endif
 -include $(DEPTH)/.mozconfig.mk
 
 # Integrate with mozbuild-generated make files. We first verify that no
 # variables provided by the automatically generated .mk files are
 # present. If they are, this is a violation of the separation of
 # responsibility between Makefile.in and mozbuild files.
 _MOZBUILD_EXTERNAL_VARIABLES := \
   ANDROID_GENERATED_RESFILES \
-  ANDROID_RESFILES \
+  ANDROID_RES_DIRS \
   CMSRCS \
   CMMSRCS \
   CPP_UNIT_TESTS \
   DIRS \
   EXTRA_PP_COMPONENTS \
   EXTRA_PP_JS_MODULES \
   FORCE_SHARED_LIB \
   FORCE_STATIC_LIB \
@@ -65,16 +65,17 @@ endif
   TEST_DIRS \
   TIERS \
   TOOL_DIRS \
   XPCSHELL_TESTS \
   XPIDL_MODULE \
   $(NULL)
 
 _DEPRECATED_VARIABLES := \
+  ANDROID_RESFILES \
   MOCHITEST_FILES_PARTS \
   MOCHITEST_BROWSER_FILES_PARTS \
   SHORT_LIBNAME \
   $(NULL)
 
 ifndef EXTERNALLY_MANAGED_MAKE_FILE
 # Using $(firstword) may not be perfect. But it should be good enough for most
 # scenarios.
--- a/js/src/config/makefiles/java-build.mk
+++ b/js/src/config/makefiles/java-build.mk
@@ -2,49 +2,27 @@
 # vim:set ts=8 sw=8 sts=8 noet:
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 ifndef INCLUDED_JAVA_BUILD_MK #{
 
-ifdef ANDROID_RESFILES #{
-ifndef IGNORE_ANDROID_RESFILES #{
-res-dep := .deps-copy-java-res
-
-GENERATED_DIRS += res
-GARBAGE        += $(res-dep)
-
-export:: $(res-dep)
-
-res-dep-preqs := \
-  $(addprefix $(srcdir)/,$(ANDROID_RESFILES)) \
-  $(call mkdir_deps,res) \
-  $(if $(IS_LANGUAGE_REPACK),FORCE) \
-  $(NULL)
-
-# nop-build: only copy res/ files when needed
-$(res-dep): $(res-dep-preqs)
-	$(call copy_dir,$(srcdir)/res,$(CURDIR)/res)
-	@$(TOUCH) $@
-endif #} IGNORE_ANDROID_RESFILES
-endif #} ANDROID_RESFILES
-
-
 ifdef JAVAFILES #{
 GENERATED_DIRS += classes
 
 export:: classes
 classes: $(call mkdir_deps,classes)
 endif #} JAVAFILES
 
 
 ifdef ANDROID_APK_NAME #{
-_ANDROID_RES_FLAG := -S $(or $(ANDROID_RES_DIR),res)
+android_res_dirs := $(addprefix $(srcdir)/,$(or $(ANDROID_RES_DIRS),res))
+_ANDROID_RES_FLAG := $(addprefix -S ,$(android_res_dirs))
 _ANDROID_ASSETS_FLAG := $(addprefix -A ,$(ANDROID_ASSETS_DIR))
 
 GENERATED_DIRS += classes
 
 classes.dex: $(call mkdir_deps,classes)
 classes.dex: R.java
 classes.dex: $(ANDROID_APK_NAME).ap_
 classes.dex: $(JAVAFILES)
@@ -52,17 +30,21 @@ classes.dex: $(JAVAFILES)
 	$(DX) --dex --output=$@ classes $(ANDROID_EXTRA_JARS)
 
 # R.java and $(ANDROID_APK_NAME).ap_ are both produced by aapt.  To
 # save an aapt invocation, we produce them both at the same time.
 
 R.java: .aapt.deps
 $(ANDROID_APK_NAME).ap_: .aapt.deps
 
-.aapt.deps: AndroidManifest.xml $(wildcard $(ANDROID_RES_DIR)) $(wildcard $(ANDROID_ASSETS_DIR))
+# This uses the fact that Android resource directories list all
+# resource files one subdirectory below the parent resource directory.
+android_res_files := $(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(android_res_dirs)))))
+
+.aapt.deps: AndroidManifest.xml $(android_res_files) $(wildcard $(ANDROID_ASSETS_DIR))
 	$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar $(_ANDROID_RES_FLAG) $(_ANDROID_ASSETS_FLAG) \
 		-J ${@D} \
 		-F $(ANDROID_APK_NAME).ap_
 	@$(TOUCH) $@
 
 $(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
 	cp $< $@
 	$(ZIP) -0 $@ classes.dex
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -49,27 +49,16 @@ GARBAGE += \
   javah.out \
   jni-stubs.inc \
   GeneratedJNIWrappers.cpp \
   GeneratedJNIWrappers.h \
   $(NULL)
 
 GARBAGE_DIRS += classes db jars res sync services generated
 
-# Bug 567884 - Need a way to find appropriate icons during packaging
-ifeq ($(MOZ_APP_NAME),fennec)
-ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
-ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
-ICON_PATH_XHDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_96x96.png
-ICON_PATH_XXHDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_144x144.png
-else
-ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
-ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
-endif
-
 JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
 
 ALL_JARS = \
   gecko-browser.jar \
   gecko-mozglue.jar \
   gecko-util.jar \
   sync-thirdparty.jar \
   websockets.jar \
@@ -164,76 +153,91 @@ PP_TARGETS += preprocessed
 
 preprocessed_package := $(addsuffix .in,$(subst $(android_package_dir)/,,$(filter $(android_package_dir)/%,$(PP_JAVAFILES))))
 
 preprocessed_package_PATH := $(android_package_dir)
 preprocessed_package_KEEP_PATH := 1
 
 PP_TARGETS += preprocessed_package
 
-res/drawable-mdpi/icon.png: $(ICON_PATH)
-	$(NSINSTALL) -D res/drawable-mdpi
-	cp $(ICON_PATH) $@
+include $(topsrcdir)/config/rules.mk
 
-res/drawable-hdpi/icon.png: $(ICON_PATH_HDPI)
-	$(NSINSTALL) -D res/drawable-hdpi
-	cp $(ICON_PATH_HDPI) $@
+# This uses the fact that Android resource directories list all
+# resource files one subdirectory below the parent resource directory.
+android_res_files := $(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(ANDROID_RES_DIRS)))))
 
-res/drawable-xhdpi/icon.png: $(ICON_PATH_XHDPI)
-	$(NSINSTALL) -D res/drawable-xhdpi
-	cp $(ICON_PATH_XHDPI) $@
+$(ANDROID_GENERATED_RESFILES): $(call mkdir_deps,$(sort $(dir $(ANDROID_GENERATED_RESFILES))))
 
-res/drawable-xxhdpi/icon.png: $(ICON_PATH_XXHDPI)
-	$(NSINSTALL) -D res/drawable-xxhdpi
-	cp $(ICON_PATH_XXHDPI) $@
-
-ANDROID_RESDIRS := $(subst resources/,res/,$(sort $(dir $(ANDROID_RESFILES))))
+# [Comment 1/3] We don't have correct dependencies for strings.xml at
+# this point, so we always recursively invoke the submake to check the
+# dependencies.  Sigh.  And, with multilocale builds, there will be
+# multiple strings.xml files, and we need to rebuild gecko.ap_ if any
+# of them change.  But!  mobile/android/base/locales does not have
+# enough information to actually build res/values/strings.xml during a
+# language repack.  So rather than adding rules into the main
+# makefile, and trying to work around the lack of information, we
+# force a rebuild of gecko.ap_ during packaging.  See below.
 
-$(call mkdir_deps,$(ANDROID_RESDIRS)): $(ANDROID_RESFILES) Makefile
-	$(RM) -r $(@D)
-	$(NSINSTALL) -D $(@D)
-	$(TOUCH) $@
-
-$(subst resources/,res/,$(ANDROID_RESFILES)): $(call mkdir_deps,$(ANDROID_RESDIRS)) $(ANDROID_RESFILES)
-	@echo 'creating $@'
-	$(NSINSTALL) $(subst res/,$(srcdir)/resources/,$@) $(dir $@)
-
-res/values/strings.xml: $(call mkdir_deps,res/values)
+res/values/strings.xml: FORCE
 	$(MAKE) -C locales
 
-# With multilocale builds, there will be multiple strings.xml files. We need to
-# rebuild gecko.ap_ if any of them change.
-MULTILOCALE_STRINGS_XML_FILES := $(wildcard res/values-*/strings.xml)
 all_resources = \
-  $(MULTILOCALE_STRINGS_XML_FILES) \
   AndroidManifest.xml \
-  $(subst resources/,res/,$(ANDROID_RESFILES)) \
+  $(android_res_files) \
   $(ANDROID_GENERATED_RESFILES) \
   $(NULL)
 
-# generated/org/mozilla/gecko/R.java and gecko.ap_ are both produced
-# by aapt; this saves an aapt invocation.
+# All of generated/org/mozilla/gecko/R.java, gecko.ap_, and R.txt are
+# produced by aapt; this saves aapt invocations.
 
 $(gecko_package_dir)/R.java: .aapt.deps
 gecko.ap_: .aapt.deps
+R.txt: .aapt.deps
 
-.aapt.deps: $(all_resources)
-	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res --custom-package org.mozilla.gecko --non-constant-id \
-		-J $(gecko_package_dir)/ \
-		-F gecko.ap_
-	@$(TOUCH) $@
+# [Comment 2/3] This tom-foolery provides a target that forces a
+# rebuild of gecko.ap_.  This is used during packaging to ensure that
+# resources are fresh.  The alternative would be complicated; see
+# [Comment 1/3].
+
+gecko-nodeps/R.java: .aapt.nodeps
+gecko-nodeps.ap_: .aapt.nodeps
+gecko-nodeps/R.txt: .aapt.nodeps
+
+# 1: target file.
+# 2: dependencies.
+# 3: name of ap_ file to write.
+# 4: directory to write R.java into.
+# 5: directory to write R.txt into.
+define aapt_command
+$(1): $$(call mkdir_deps,$(filter-out ./,$(dir $(3) $(4) $(5)))) $(2)
+	$$(AAPT) package -f -M AndroidManifest.xml -I $$(ANDROID_SDK)/android.jar \
+		--auto-add-overlay \
+		$$(addprefix -S ,$$(ANDROID_RES_DIRS)) \
+		--custom-package org.mozilla.gecko --non-constant-id \
+		-F $(3) \
+		-J $(4) \
+		--output-text-symbols $(5)
+	@$$(TOUCH) $$@
+endef
+
+# [Comment 3/3] The first of these rules is used during regular
+# builds.  The second writes an ap_ file that is only used during
+# packaging.  It doesn't write the normal ap_, or R.java, since we
+# don't want the packaging step to write anything that would make a
+# further no-op build do work.  See also
+# toolkit/mozapps/installer/packager.mk.
+
+# .aapt.deps: $(all_resources)
+$(eval $(call aapt_command,.aapt.deps,$(all_resources),gecko.ap_,$(gecko_package_dir)/,./))
+
+# .aapt.nodeps: FORCE
+$(eval $(call aapt_command,.aapt.nodeps,FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/))
 
 fennec_ids.txt: $(gecko_package_dir)/R.java fennec-ids-generator.py
 	$(PYTHON) $(topsrcdir)/mobile/android/base/fennec-ids-generator.py -i $< -o $@
 
-# We process ANDROID_RESFILES specially for now; the following flag
-# disables the default processing.
-IGNORE_ANDROID_RESFILES=1
-
-include $(topsrcdir)/config/rules.mk
-
 # Override the Java settings with some specific android settings
 include $(topsrcdir)/config/android-common.mk
 
 libs:: classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp fennec_ids.txt
 	$(INSTALL) classes.dex $(FINAL_TARGET)
 	@(diff jni-stubs.inc $(topsrcdir)/mozglue/android/jni-stubs.inc >/dev/null && diff GeneratedJNIWrappers.cpp $(topsrcdir)/widget/android/GeneratedJNIWrappers.cpp >/dev/null) || \
 	 (echo '*** Error: The generated JNI code has changed. Please run cp $(CURDIR)/jni-stubs.inc $(topsrcdir)/mozglue/android && cp $(CURDIR)/GeneratedJNIWrappers.* $(topsrcdir)/widget/android and repeat the build.' && exit 1)
--- a/mobile/android/base/android-services.mozbuild
+++ b/mobile/android/base/android-services.mozbuild
@@ -1,37 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-ANDROID_RESFILES += [
-    'resources/drawable-mdpi/sync_desktop.png',
-    'resources/drawable-mdpi/sync_mobile.png',
-    'resources/drawable/sync_pin_background.xml',
-    'resources/layout/sync_account.xml',
-    'resources/layout/sync_list_item.xml',
-    'resources/layout/sync_redirect_to_setup.xml',
-    'resources/layout/sync_send_tab.xml',
-    'resources/layout/sync_setup.xml',
-    'resources/layout/sync_setup_failure.xml',
-    'resources/layout/sync_setup_jpake_waiting.xml',
-    'resources/layout/sync_setup_nointernet.xml',
-    'resources/layout/sync_setup_pair.xml',
-    'resources/layout/sync_setup_success.xml',
-    'resources/layout/sync_setup_webview.xml',
-    'resources/values-large-v11/sync_styles.xml',
-    'resources/values-v11/sync_styles.xml',
-    'resources/values/sync_styles.xml',
-    'resources/xml/sync_authenticator.xml',
-    'resources/xml/sync_options.xml',
-    'resources/xml/sync_syncadapter.xml',
-]
-
 sync_thirdparty_java_files = [
     'ch/boye/httpclientandroidlib/androidextra/HttpClientAndroidLog.java',
     'ch/boye/httpclientandroidlib/annotation/GuardedBy.java',
     'ch/boye/httpclientandroidlib/annotation/Immutable.java',
     'ch/boye/httpclientandroidlib/annotation/NotThreadSafe.java',
     'ch/boye/httpclientandroidlib/annotation/ThreadSafe.java',
     'ch/boye/httpclientandroidlib/auth/AUTH.java',
     'ch/boye/httpclientandroidlib/auth/AuthenticationException.java',
rename from mobile/android/base/resources/drawable-mdpi/crash_reporter.png
rename to mobile/android/base/crashreporter/res/drawable-mdpi/crash_reporter.png
rename from mobile/android/base/resources/layout/crash_reporter.xml
rename to mobile/android/base/crashreporter/res/layout/crash_reporter.xml
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -352,658 +352,39 @@ gbjar.generated_sources += [
     'org/mozilla/gecko/widget/GeckoImageButton.java',
     'org/mozilla/gecko/widget/GeckoImageView.java',
     'org/mozilla/gecko/widget/GeckoLinearLayout.java',
     'org/mozilla/gecko/widget/GeckoRelativeLayout.java',
     'org/mozilla/gecko/widget/GeckoTextSwitcher.java',
     'org/mozilla/gecko/widget/GeckoTextView.java',
 ]
 if CONFIG['MOZ_CRASHREPORTER']:
-    gbjar.sources += [ 'CrashReporter.java ']
+    gbjar.sources += [ 'CrashReporter.java' ]
+    ANDROID_RES_DIRS += [ SRCDIR + '/crashreporter/res' ]
+
 gbjar.sources += sync_java_files
 gbjar.generated_sources += sync_generated_java_files
 gbjar.extra_jars = [
     'gecko-mozglue.jar',
     'gecko-util.jar',
     'sync-thirdparty.jar',
     'websockets.jar',
 ]
 gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough']
 
-ANDROID_GENERATED_RESFILES += [
-    'res/drawable-hdpi/icon.png',
-    'res/drawable-mdpi/icon.png',
-    'res/drawable-xhdpi/icon.png',
-    'res/drawable-xxhdpi/icon.png',
-    'res/values/strings.xml',
+ANDROID_RES_DIRS += [
+    SRCDIR + '/resources',
+    TOPSRCDIR + '/' + CONFIG['MOZ_BRANDING_DIRECTORY'] + '/res',
+    OBJDIR + '/res',
 ]
 
-ANDROID_RESFILES += [
-    'resources/anim/grow_fade_in.xml',
-    'resources/anim/grow_fade_in_center.xml',
-    'resources/anim/popup_hide.xml',
-    'resources/anim/popup_show.xml',
-    'resources/anim/progress_spinner.xml',
-    'resources/anim/shrink_fade_out.xml',
-    'resources/color/primary_text.xml',
-    'resources/color/primary_text_inverse.xml',
-    'resources/color/secondary_text.xml',
-    'resources/color/secondary_text_inverse.xml',
-    'resources/color/select_item_multichoice.xml',
-    'resources/color/tertiary_text.xml',
-    'resources/color/tertiary_text_inverse.xml',
-    'resources/color/top_sites_grid_item_title.xml',
-    'resources/color/url_bar_title.xml',
-    'resources/color/url_bar_title_hint.xml',
-    'resources/drawable-hdpi-v11/alert_addon.png',
-    'resources/drawable-hdpi-v11/alert_app.png',
-    'resources/drawable-hdpi-v11/alert_camera.png',
-    'resources/drawable-hdpi-v11/alert_download.png',
-    'resources/drawable-hdpi-v11/alert_mic.png',
-    'resources/drawable-hdpi-v11/alert_mic_camera.png',
-    'resources/drawable-hdpi-v11/firefox_settings_alert.png',
-    'resources/drawable-hdpi-v11/ic_menu_addons.png',
-    'resources/drawable-hdpi-v11/ic_menu_apps.png',
-    'resources/drawable-hdpi-v11/ic_menu_back.png',
-    'resources/drawable-hdpi-v11/ic_menu_bookmark_add.png',
-    'resources/drawable-hdpi-v11/ic_menu_bookmark_remove.png',
-    'resources/drawable-hdpi-v11/ic_menu_desktop_mode_off.png',
-    'resources/drawable-hdpi-v11/ic_menu_desktop_mode_on.png',
-    'resources/drawable-hdpi-v11/ic_menu_downloads.png',
-    'resources/drawable-hdpi-v11/ic_menu_find_in_page.png',
-    'resources/drawable-hdpi-v11/ic_menu_forward.png',
-    'resources/drawable-hdpi-v11/ic_menu_new_private_tab.png',
-    'resources/drawable-hdpi-v11/ic_menu_new_tab.png',
-    'resources/drawable-hdpi-v11/ic_menu_quit.png',
-    'resources/drawable-hdpi-v11/ic_menu_reload.png',
-    'resources/drawable-hdpi-v11/ic_menu_save_as_pdf.png',
-    'resources/drawable-hdpi-v11/ic_menu_settings.png',
-    'resources/drawable-hdpi-v11/ic_menu_tools.png',
-    'resources/drawable-hdpi-v11/ic_status_logo.png',
-    'resources/drawable-hdpi/ab_done.png',
-    'resources/drawable-hdpi/ab_stacked_transparent_light_holo.9.png',
-    'resources/drawable-hdpi/abouthome_thumbnail.png',
-    'resources/drawable-hdpi/alert_addon.png',
-    'resources/drawable-hdpi/alert_app.png',
-    'resources/drawable-hdpi/alert_camera.png',
-    'resources/drawable-hdpi/alert_download.png',
-    'resources/drawable-hdpi/alert_mic.png',
-    'resources/drawable-hdpi/alert_mic_camera.png',
-    'resources/drawable-hdpi/arrow_popup_bg.9.png',
-    'resources/drawable-hdpi/blank.png',
-    'resources/drawable-hdpi/bookmark_folder_closed.png',
-    'resources/drawable-hdpi/bookmark_folder_opened.png',
-    'resources/drawable-hdpi/close.png',
-    'resources/drawable-hdpi/color_picker_row_bg.9.png',
-    'resources/drawable-hdpi/copy.png',
-    'resources/drawable-hdpi/cut.png',
-    'resources/drawable-hdpi/favicon.png',
-    'resources/drawable-hdpi/find_close.png',
-    'resources/drawable-hdpi/find_next.png',
-    'resources/drawable-hdpi/find_prev.png',
-    'resources/drawable-hdpi/folder.png',
-    'resources/drawable-hdpi/grid_icon_bg_activated.9.png',
-    'resources/drawable-hdpi/grid_icon_bg_focused.9.png',
-    'resources/drawable-hdpi/handle_end.png',
-    'resources/drawable-hdpi/handle_middle.png',
-    'resources/drawable-hdpi/handle_start.png',
-    'resources/drawable-hdpi/history_tabs_indicator_selected.9.png',
-    'resources/drawable-hdpi/home_bg.png',
-    'resources/drawable-hdpi/home_star.png',
-    'resources/drawable-hdpi/home_tab_menu_strip.9.png',
-    'resources/drawable-hdpi/ic_menu_addons_filler.png',
-    'resources/drawable-hdpi/ic_menu_bookmark_add.png',
-    'resources/drawable-hdpi/ic_menu_bookmark_remove.png',
-    'resources/drawable-hdpi/ic_menu_character_encoding.png',
-    'resources/drawable-hdpi/ic_menu_forward.png',
-    'resources/drawable-hdpi/ic_menu_guest.png',
-    'resources/drawable-hdpi/ic_menu_new_private_tab.png',
-    'resources/drawable-hdpi/ic_menu_new_tab.png',
-    'resources/drawable-hdpi/ic_menu_reload.png',
-    'resources/drawable-hdpi/ic_menu_share.png',
-    'resources/drawable-hdpi/ic_status_logo.png',
-    'resources/drawable-hdpi/ic_url_bar_go.png',
-    'resources/drawable-hdpi/ic_url_bar_reader.png',
-    'resources/drawable-hdpi/ic_url_bar_search.png',
-    'resources/drawable-hdpi/ic_url_bar_star.png',
-    'resources/drawable-hdpi/ic_url_bar_tab.png',
-    'resources/drawable-hdpi/icon_bookmarks_empty.png',
-    'resources/drawable-hdpi/icon_last_tabs.png',
-    'resources/drawable-hdpi/icon_last_tabs_empty.png',
-    'resources/drawable-hdpi/icon_most_recent.png',
-    'resources/drawable-hdpi/icon_most_recent_empty.png',
-    'resources/drawable-hdpi/icon_most_visited.png',
-    'resources/drawable-hdpi/icon_openinapp.png',
-    'resources/drawable-hdpi/icon_pageaction.png',
-    'resources/drawable-hdpi/icon_reading_list_empty.png',
-    'resources/drawable-hdpi/larry.png',
-    'resources/drawable-hdpi/lock_identified.png',
-    'resources/drawable-hdpi/lock_verified.png',
-    'resources/drawable-hdpi/menu.png',
-    'resources/drawable-hdpi/menu_item_check.png',
-    'resources/drawable-hdpi/menu_item_more.png',
-    'resources/drawable-hdpi/menu_item_uncheck.png',
-    'resources/drawable-hdpi/menu_light.png',
-    'resources/drawable-hdpi/menu_panel_bg.9.png',
-    'resources/drawable-hdpi/menu_pb.png',
-    'resources/drawable-hdpi/menu_popup_arrow_bottom.png',
-    'resources/drawable-hdpi/menu_popup_arrow_top.png',
-    'resources/drawable-hdpi/menu_popup_bg.9.png',
-    'resources/drawable-hdpi/paste.png',
-    'resources/drawable-hdpi/pause.png',
-    'resources/drawable-hdpi/pin.png',
-    'resources/drawable-hdpi/play.png',
-    'resources/drawable-hdpi/reader.png',
-    'resources/drawable-hdpi/reader_active.png',
-    'resources/drawable-hdpi/reader_cropped.png',
-    'resources/drawable-hdpi/reading_list.png',
-    'resources/drawable-hdpi/select_all.png',
-    'resources/drawable-hdpi/shield.png',
-    'resources/drawable-hdpi/shield_doorhanger.png',
-    'resources/drawable-hdpi/spinner_default.9.png',
-    'resources/drawable-hdpi/spinner_focused.9.png',
-    'resources/drawable-hdpi/spinner_pressed.9.png',
-    'resources/drawable-hdpi/tab_close.png',
-    'resources/drawable-hdpi/tab_indicator_divider.9.png',
-    'resources/drawable-hdpi/tab_indicator_selected.9.png',
-    'resources/drawable-hdpi/tab_indicator_selected_focused.9.png',
-    'resources/drawable-hdpi/tab_new.png',
-    'resources/drawable-hdpi/tab_new_pb.png',
-    'resources/drawable-hdpi/tab_thumbnail_default.png',
-    'resources/drawable-hdpi/tab_thumbnail_shadow.png',
-    'resources/drawable-hdpi/tabs_count.png',
-    'resources/drawable-hdpi/tabs_count_foreground.png',
-    'resources/drawable-hdpi/tabs_normal.png',
-    'resources/drawable-hdpi/tabs_private.png',
-    'resources/drawable-hdpi/tabs_synced.png',
-    'resources/drawable-hdpi/tip_addsearch.png',
-    'resources/drawable-hdpi/top_site_add.png',
-    'resources/drawable-hdpi/url_bar_entry_default.9.png',
-    'resources/drawable-hdpi/url_bar_entry_default_pb.9.png',
-    'resources/drawable-hdpi/url_bar_entry_pressed.9.png',
-    'resources/drawable-hdpi/url_bar_entry_pressed_pb.9.png',
-    'resources/drawable-hdpi/urlbar_stop.png',
-    'resources/drawable-hdpi/validation_arrow.png',
-    'resources/drawable-hdpi/validation_arrow_inverted.png',
-    'resources/drawable-hdpi/validation_bg.9.png',
-    'resources/drawable-hdpi/warning.png',
-    'resources/drawable-hdpi/warning_doorhanger.png',
-    'resources/drawable-large-hdpi-v11/arrow_popup_bg.9.png',
-    'resources/drawable-large-hdpi-v11/ic_menu_forward.png',
-    'resources/drawable-large-hdpi-v11/ic_menu_reload.png',
-    'resources/drawable-large-hdpi-v11/menu.png',
-    'resources/drawable-large-land-v11/home_history_tabs_indicator.xml',
-    'resources/drawable-large-mdpi-v11/arrow_popup_bg.9.png',
-    'resources/drawable-large-mdpi-v11/ic_menu_forward.png',
-    'resources/drawable-large-mdpi-v11/ic_menu_reload.png',
-    'resources/drawable-large-mdpi-v11/menu.png',
-    'resources/drawable-large-xhdpi-v11/arrow_popup_bg.9.png',
-    'resources/drawable-large-xhdpi-v11/ic_menu_forward.png',
-    'resources/drawable-large-xhdpi-v11/ic_menu_reload.png',
-    'resources/drawable-large-xhdpi-v11/menu.png',
-    'resources/drawable-mdpi-v11/alert_addon.png',
-    'resources/drawable-mdpi-v11/alert_app.png',
-    'resources/drawable-mdpi-v11/alert_camera.png',
-    'resources/drawable-mdpi-v11/alert_download.png',
-    'resources/drawable-mdpi-v11/alert_mic.png',
-    'resources/drawable-mdpi-v11/alert_mic_camera.png',
-    'resources/drawable-mdpi-v11/firefox_settings_alert.png',
-    'resources/drawable-mdpi-v11/ic_menu_addons.png',
-    'resources/drawable-mdpi-v11/ic_menu_apps.png',
-    'resources/drawable-mdpi-v11/ic_menu_back.png',
-    'resources/drawable-mdpi-v11/ic_menu_bookmark_add.png',
-    'resources/drawable-mdpi-v11/ic_menu_bookmark_remove.png',
-    'resources/drawable-mdpi-v11/ic_menu_desktop_mode_off.png',
-    'resources/drawable-mdpi-v11/ic_menu_desktop_mode_on.png',
-    'resources/drawable-mdpi-v11/ic_menu_downloads.png',
-    'resources/drawable-mdpi-v11/ic_menu_find_in_page.png',
-    'resources/drawable-mdpi-v11/ic_menu_forward.png',
-    'resources/drawable-mdpi-v11/ic_menu_new_private_tab.png',
-    'resources/drawable-mdpi-v11/ic_menu_new_tab.png',
-    'resources/drawable-mdpi-v11/ic_menu_quit.png',
-    'resources/drawable-mdpi-v11/ic_menu_reload.png',
-    'resources/drawable-mdpi-v11/ic_menu_save_as_pdf.png',
-    'resources/drawable-mdpi-v11/ic_menu_settings.png',
-    'resources/drawable-mdpi-v11/ic_menu_tools.png',
-    'resources/drawable-mdpi-v11/ic_status_logo.png',
-    'resources/drawable-mdpi/ab_done.png',
-    'resources/drawable-mdpi/ab_stacked_transparent_light_holo.9.png',
-    'resources/drawable-mdpi/abouthome_thumbnail.png',
-    'resources/drawable-mdpi/alert_addon.png',
-    'resources/drawable-mdpi/alert_app.png',
-    'resources/drawable-mdpi/alert_camera.png',
-    'resources/drawable-mdpi/alert_download.png',
-    'resources/drawable-mdpi/alert_mic.png',
-    'resources/drawable-mdpi/alert_mic_camera.png',
-    'resources/drawable-mdpi/arrow_popup_bg.9.png',
-    'resources/drawable-mdpi/autocomplete_list_bg.9.png',
-    'resources/drawable-mdpi/blank.png',
-    'resources/drawable-mdpi/bookmark_folder_closed.png',
-    'resources/drawable-mdpi/bookmark_folder_opened.png',
-    'resources/drawable-mdpi/bookmarkdefaults_favicon_addons.png',
-    'resources/drawable-mdpi/bookmarkdefaults_favicon_support.png',
-    'resources/drawable-mdpi/close.png',
-    'resources/drawable-mdpi/color_picker_row_bg.9.png',
-    'resources/drawable-mdpi/copy.png',
-    'resources/drawable-mdpi/cut.png',
-    'resources/drawable-mdpi/desktop_notification.png',
-    'resources/drawable-mdpi/favicon.png',
-    'resources/drawable-mdpi/find_close.png',
-    'resources/drawable-mdpi/find_next.png',
-    'resources/drawable-mdpi/find_prev.png',
-    'resources/drawable-mdpi/folder.png',
-    'resources/drawable-mdpi/grid_icon_bg_activated.9.png',
-    'resources/drawable-mdpi/grid_icon_bg_focused.9.png',
-    'resources/drawable-mdpi/handle_end.png',
-    'resources/drawable-mdpi/handle_middle.png',
-    'resources/drawable-mdpi/handle_start.png',
-    'resources/drawable-mdpi/history_tabs_indicator_selected.9.png',
-    'resources/drawable-mdpi/home_tab_menu_strip.9.png',
-    'resources/drawable-mdpi/ic_menu_addons_filler.png',
-    'resources/drawable-mdpi/ic_menu_bookmark_add.png',
-    'resources/drawable-mdpi/ic_menu_bookmark_remove.png',
-    'resources/drawable-mdpi/ic_menu_character_encoding.png',
-    'resources/drawable-mdpi/ic_menu_forward.png',
-    'resources/drawable-mdpi/ic_menu_guest.png',
-    'resources/drawable-mdpi/ic_menu_new_private_tab.png',
-    'resources/drawable-mdpi/ic_menu_new_tab.png',
-    'resources/drawable-mdpi/ic_menu_reload.png',
-    'resources/drawable-mdpi/ic_menu_share.png',
-    'resources/drawable-mdpi/ic_status_logo.png',
-    'resources/drawable-mdpi/ic_url_bar_go.png',
-    'resources/drawable-mdpi/ic_url_bar_reader.png',
-    'resources/drawable-mdpi/ic_url_bar_search.png',
-    'resources/drawable-mdpi/ic_url_bar_star.png',
-    'resources/drawable-mdpi/ic_url_bar_tab.png',
-    'resources/drawable-mdpi/icon_bookmarks_empty.png',
-    'resources/drawable-mdpi/icon_last_tabs.png',
-    'resources/drawable-mdpi/icon_last_tabs_empty.png',
-    'resources/drawable-mdpi/icon_most_recent.png',
-    'resources/drawable-mdpi/icon_most_recent_empty.png',
-    'resources/drawable-mdpi/icon_most_visited.png',
-    'resources/drawable-mdpi/icon_openinapp.png',
-    'resources/drawable-mdpi/icon_pageaction.png',
-    'resources/drawable-mdpi/icon_reading_list_empty.png',
-    'resources/drawable-mdpi/larry.png',
-    'resources/drawable-mdpi/lock_identified.png',
-    'resources/drawable-mdpi/lock_verified.png',
-    'resources/drawable-mdpi/marketplace.png',
-    'resources/drawable-mdpi/menu.png',
-    'resources/drawable-mdpi/menu_item_check.png',
-    'resources/drawable-mdpi/menu_item_more.png',
-    'resources/drawable-mdpi/menu_item_uncheck.png',
-    'resources/drawable-mdpi/menu_light.png',
-    'resources/drawable-mdpi/menu_panel_bg.9.png',
-    'resources/drawable-mdpi/menu_pb.png',
-    'resources/drawable-mdpi/menu_popup_arrow_bottom.png',
-    'resources/drawable-mdpi/menu_popup_arrow_top.png',
-    'resources/drawable-mdpi/menu_popup_bg.9.png',
-    'resources/drawable-mdpi/paste.png',
-    'resources/drawable-mdpi/pause.png',
-    'resources/drawable-mdpi/pin.png',
-    'resources/drawable-mdpi/play.png',
-    'resources/drawable-mdpi/progress_spinner.png',
-    'resources/drawable-mdpi/reader.png',
-    'resources/drawable-mdpi/reader_active.png',
-    'resources/drawable-mdpi/reader_cropped.png',
-    'resources/drawable-mdpi/reading_list.png',
-    'resources/drawable-mdpi/scrollbar.png',
-    'resources/drawable-mdpi/select_all.png',
-    'resources/drawable-mdpi/shadow.png',
-    'resources/drawable-mdpi/shield.png',
-    'resources/drawable-mdpi/shield_doorhanger.png',
-    'resources/drawable-mdpi/spinner_default.9.png',
-    'resources/drawable-mdpi/spinner_focused.9.png',
-    'resources/drawable-mdpi/spinner_pressed.9.png',
-    'resources/drawable-mdpi/start.png',
-    'resources/drawable-mdpi/tab_close.png',
-    'resources/drawable-mdpi/tab_indicator_divider.9.png',
-    'resources/drawable-mdpi/tab_indicator_selected.9.png',
-    'resources/drawable-mdpi/tab_indicator_selected_focused.9.png',
-    'resources/drawable-mdpi/tab_new.png',
-    'resources/drawable-mdpi/tab_new_pb.png',
-    'resources/drawable-mdpi/tab_thumbnail_default.png',
-    'resources/drawable-mdpi/tab_thumbnail_shadow.png',
-    'resources/drawable-mdpi/tabs_count.png',
-    'resources/drawable-mdpi/tabs_count_foreground.png',
-    'resources/drawable-mdpi/tabs_normal.png',
-    'resources/drawable-mdpi/tabs_private.png',
-    'resources/drawable-mdpi/tabs_synced.png',
-    'resources/drawable-mdpi/tip_addsearch.png',
-    'resources/drawable-mdpi/toast.9.png',
-    'resources/drawable-mdpi/toast_button_focused.9.png',
-    'resources/drawable-mdpi/toast_button_pressed.9.png',
-    'resources/drawable-mdpi/toast_divider.9.png',
-    'resources/drawable-mdpi/top_site_add.png',
-    'resources/drawable-mdpi/url_bar_entry_default.9.png',
-    'resources/drawable-mdpi/url_bar_entry_default_pb.9.png',
-    'resources/drawable-mdpi/url_bar_entry_pressed.9.png',
-    'resources/drawable-mdpi/url_bar_entry_pressed_pb.9.png',
-    'resources/drawable-mdpi/urlbar_stop.png',
-    'resources/drawable-mdpi/validation_arrow.png',
-    'resources/drawable-mdpi/validation_arrow_inverted.png',
-    'resources/drawable-mdpi/validation_bg.9.png',
-    'resources/drawable-mdpi/warning.png',
-    'resources/drawable-mdpi/warning_doorhanger.png',
-    'resources/drawable-xhdpi-v11/alert_addon.png',
-    'resources/drawable-xhdpi-v11/alert_app.png',
-    'resources/drawable-xhdpi-v11/alert_camera.png',
-    'resources/drawable-xhdpi-v11/alert_download.png',
-    'resources/drawable-xhdpi-v11/alert_mic.png',
-    'resources/drawable-xhdpi-v11/alert_mic_camera.png',
-    'resources/drawable-xhdpi-v11/firefox_settings_alert.png',
-    'resources/drawable-xhdpi-v11/ic_menu_addons.png',
-    'resources/drawable-xhdpi-v11/ic_menu_apps.png',
-    'resources/drawable-xhdpi-v11/ic_menu_back.png',
-    'resources/drawable-xhdpi-v11/ic_menu_bookmark_add.png',
-    'resources/drawable-xhdpi-v11/ic_menu_bookmark_remove.png',
-    'resources/drawable-xhdpi-v11/ic_menu_desktop_mode_off.png',
-    'resources/drawable-xhdpi-v11/ic_menu_desktop_mode_on.png',
-    'resources/drawable-xhdpi-v11/ic_menu_downloads.png',
-    'resources/drawable-xhdpi-v11/ic_menu_find_in_page.png',
-    'resources/drawable-xhdpi-v11/ic_menu_forward.png',
-    'resources/drawable-xhdpi-v11/ic_menu_new_private_tab.png',
-    'resources/drawable-xhdpi-v11/ic_menu_new_tab.png',
-    'resources/drawable-xhdpi-v11/ic_menu_quit.png',
-    'resources/drawable-xhdpi-v11/ic_menu_reload.png',
-    'resources/drawable-xhdpi-v11/ic_menu_save_as_pdf.png',
-    'resources/drawable-xhdpi-v11/ic_menu_settings.png',
-    'resources/drawable-xhdpi-v11/ic_menu_tools.png',
-    'resources/drawable-xhdpi-v11/ic_status_logo.png',
-    'resources/drawable-xhdpi/ab_done.png',
-    'resources/drawable-xhdpi/ab_stacked_transparent_light_holo.9.png',
-    'resources/drawable-xhdpi/abouthome_thumbnail.png',
-    'resources/drawable-xhdpi/alert_addon.png',
-    'resources/drawable-xhdpi/alert_app.png',
-    'resources/drawable-xhdpi/alert_camera.png',
-    'resources/drawable-xhdpi/alert_download.png',
-    'resources/drawable-xhdpi/alert_mic.png',
-    'resources/drawable-xhdpi/alert_mic_camera.png',
-    'resources/drawable-xhdpi/arrow_popup_bg.9.png',
-    'resources/drawable-xhdpi/blank.png',
-    'resources/drawable-xhdpi/bookmark_folder_closed.png',
-    'resources/drawable-xhdpi/bookmark_folder_opened.png',
-    'resources/drawable-xhdpi/close.png',
-    'resources/drawable-xhdpi/color_picker_row_bg.9.png',
-    'resources/drawable-xhdpi/copy.png',
-    'resources/drawable-xhdpi/cut.png',
-    'resources/drawable-xhdpi/favicon.png',
-    'resources/drawable-xhdpi/find_close.png',
-    'resources/drawable-xhdpi/find_next.png',
-    'resources/drawable-xhdpi/find_prev.png',
-    'resources/drawable-xhdpi/folder.png',
-    'resources/drawable-xhdpi/grid_icon_bg_activated.9.png',
-    'resources/drawable-xhdpi/grid_icon_bg_focused.9.png',
-    'resources/drawable-xhdpi/handle_end.png',
-    'resources/drawable-xhdpi/handle_middle.png',
-    'resources/drawable-xhdpi/handle_start.png',
-    'resources/drawable-xhdpi/history_tabs_indicator_selected.9.png',
-    'resources/drawable-xhdpi/home_tab_menu_strip.9.png',
-    'resources/drawable-xhdpi/ic_menu_addons_filler.png',
-    'resources/drawable-xhdpi/ic_menu_bookmark_add.png',
-    'resources/drawable-xhdpi/ic_menu_bookmark_remove.png',
-    'resources/drawable-xhdpi/ic_menu_character_encoding.png',
-    'resources/drawable-xhdpi/ic_menu_forward.png',
-    'resources/drawable-xhdpi/ic_menu_guest.png',
-    'resources/drawable-xhdpi/ic_menu_new_private_tab.png',
-    'resources/drawable-xhdpi/ic_menu_new_tab.png',
-    'resources/drawable-xhdpi/ic_menu_reload.png',
-    'resources/drawable-xhdpi/ic_menu_share.png',
-    'resources/drawable-xhdpi/ic_status_logo.png',
-    'resources/drawable-xhdpi/ic_url_bar_go.png',
-    'resources/drawable-xhdpi/ic_url_bar_reader.png',
-    'resources/drawable-xhdpi/ic_url_bar_search.png',
-    'resources/drawable-xhdpi/ic_url_bar_star.png',
-    'resources/drawable-xhdpi/ic_url_bar_tab.png',
-    'resources/drawable-xhdpi/icon_bookmarks_empty.png',
-    'resources/drawable-xhdpi/icon_last_tabs.png',
-    'resources/drawable-xhdpi/icon_last_tabs_empty.png',
-    'resources/drawable-xhdpi/icon_most_recent.png',
-    'resources/drawable-xhdpi/icon_most_recent_empty.png',
-    'resources/drawable-xhdpi/icon_most_visited.png',
-    'resources/drawable-xhdpi/icon_openinapp.png',
-    'resources/drawable-xhdpi/icon_pageaction.png',
-    'resources/drawable-xhdpi/icon_reading_list_empty.png',
-    'resources/drawable-xhdpi/larry.png',
-    'resources/drawable-xhdpi/lock_identified.png',
-    'resources/drawable-xhdpi/lock_verified.png',
-    'resources/drawable-xhdpi/menu.png',
-    'resources/drawable-xhdpi/menu_item_check.png',
-    'resources/drawable-xhdpi/menu_item_more.png',
-    'resources/drawable-xhdpi/menu_item_uncheck.png',
-    'resources/drawable-xhdpi/menu_light.png',
-    'resources/drawable-xhdpi/menu_panel_bg.9.png',
-    'resources/drawable-xhdpi/menu_pb.png',
-    'resources/drawable-xhdpi/menu_popup_arrow_bottom.png',
-    'resources/drawable-xhdpi/menu_popup_arrow_top.png',
-    'resources/drawable-xhdpi/menu_popup_bg.9.png',
-    'resources/drawable-xhdpi/paste.png',
-    'resources/drawable-xhdpi/pause.png',
-    'resources/drawable-xhdpi/pin.png',
-    'resources/drawable-xhdpi/play.png',
-    'resources/drawable-xhdpi/reader.png',
-    'resources/drawable-xhdpi/reader_active.png',
-    'resources/drawable-xhdpi/reader_cropped.png',
-    'resources/drawable-xhdpi/reading_list.png',
-    'resources/drawable-xhdpi/shield.png',
-    'resources/drawable-xhdpi/shield_doorhanger.png',
-    'resources/drawable-xhdpi/spinner_default.9.png',
-    'resources/drawable-xhdpi/spinner_focused.9.png',
-    'resources/drawable-xhdpi/spinner_pressed.9.png',
-    'resources/drawable-xhdpi/tab_close.png',
-    'resources/drawable-xhdpi/tab_indicator_divider.9.png',
-    'resources/drawable-xhdpi/tab_indicator_selected.9.png',
-    'resources/drawable-xhdpi/tab_indicator_selected_focused.9.png',
-    'resources/drawable-xhdpi/tab_new.png',
-    'resources/drawable-xhdpi/tab_new_pb.png',
-    'resources/drawable-xhdpi/tab_thumbnail_default.png',
-    'resources/drawable-xhdpi/tab_thumbnail_shadow.png',
-    'resources/drawable-xhdpi/tabs_count.png',
-    'resources/drawable-xhdpi/tabs_count_foreground.png',
-    'resources/drawable-xhdpi/tabs_normal.png',
-    'resources/drawable-xhdpi/tabs_private.png',
-    'resources/drawable-xhdpi/tabs_synced.png',
-    'resources/drawable-xhdpi/tip_addsearch.png',
-    'resources/drawable-xhdpi/top_site_add.png',
-    'resources/drawable-xhdpi/url_bar_entry_default.9.png',
-    'resources/drawable-xhdpi/url_bar_entry_default_pb.9.png',
-    'resources/drawable-xhdpi/url_bar_entry_pressed.9.png',
-    'resources/drawable-xhdpi/url_bar_entry_pressed_pb.9.png',
-    'resources/drawable-xhdpi/urlbar_stop.png',
-    'resources/drawable-xhdpi/validation_arrow.png',
-    'resources/drawable-xhdpi/validation_arrow_inverted.png',
-    'resources/drawable-xhdpi/validation_bg.9.png',
-    'resources/drawable-xhdpi/warning.png',
-    'resources/drawable-xhdpi/warning_doorhanger.png',
-    'resources/drawable-xlarge-hdpi-v11/ic_menu_bookmark_add.png',
-    'resources/drawable-xlarge-hdpi-v11/ic_menu_bookmark_remove.png',
-    'resources/drawable-xlarge-mdpi-v11/ic_menu_bookmark_add.png',
-    'resources/drawable-xlarge-mdpi-v11/ic_menu_bookmark_remove.png',
-    'resources/drawable-xlarge-v11/home_history_tabs_indicator.xml',
-    'resources/drawable-xlarge-xhdpi-v11/ic_menu_bookmark_add.png',
-    'resources/drawable-xlarge-xhdpi-v11/ic_menu_bookmark_remove.png',
-    'resources/drawable/action_bar_button.xml',
-    'resources/drawable/action_bar_button_inverse.xml',
-    'resources/drawable/bookmark_folder.xml',
-    'resources/drawable/color_picker_checkmark.xml',
-    'resources/drawable/divider_horizontal.xml',
-    'resources/drawable/divider_vertical.xml',
-    'resources/drawable/handle_end_level.xml',
-    'resources/drawable/handle_start_level.xml',
-    'resources/drawable/home_banner.xml',
-    'resources/drawable/home_history_tabs_indicator.xml',
-    'resources/drawable/home_page_title_background.xml',
-    'resources/drawable/ic_menu_back.xml',
-    'resources/drawable/ic_menu_desktop_mode_off.xml',
-    'resources/drawable/ic_menu_desktop_mode_on.xml',
-    'resources/drawable/ic_menu_quit.xml',
-    'resources/drawable/icon_grid_item_bg.xml',
-    'resources/drawable/menu_item_state.xml',
-    'resources/drawable/menu_level.xml',
-    'resources/drawable/remote_tabs_child_divider.xml',
-    'resources/drawable/shaped_button.xml',
-    'resources/drawable/site_security_level.xml',
-    'resources/drawable/spinner.xml',
-    'resources/drawable/suggestion_selector.xml',
-    'resources/drawable/tab_new_level.xml',
-    'resources/drawable/tab_row.xml',
-    'resources/drawable/tab_thumbnail.xml',
-    'resources/drawable/tabs_panel_indicator.xml',
-    'resources/drawable/textbox_bg.xml',
-    'resources/drawable/toast_button.xml',
-    'resources/drawable/top_sites_thumbnail_bg.xml',
-    'resources/drawable/url_bar_bg.xml',
-    'resources/drawable/url_bar_entry.xml',
-    'resources/drawable/url_bar_nav_button.xml',
-    'resources/drawable/url_bar_right_edge.xml',
-    'resources/drawable/webapp_titlebar_bg.xml',
-    'resources/layout-large-land-v11/home_history_list.xml',
-    'resources/layout-large-land-v11/home_history_page.xml',
-    'resources/layout-large-land-v11/home_history_tabs_indicator.xml',
-    'resources/layout-large-land-v11/tabs_panel.xml',
-    'resources/layout-large-land-v11/tabs_panel_footer.xml',
-    'resources/layout-large-land-v11/tabs_panel_header.xml',
-    'resources/layout-large-v11/browser_toolbar.xml',
-    'resources/layout-large-v11/home_pager.xml',
-    'resources/layout-xlarge-v11/font_size_preference.xml',
-    'resources/layout-xlarge-v11/home_history_list.xml',
-    'resources/layout-xlarge-v11/home_history_page.xml',
-    'resources/layout-xlarge-v11/home_history_tabs_indicator.xml',
-    'resources/layout-xlarge-v11/remote_tabs_child.xml',
-    'resources/layout-xlarge-v11/remote_tabs_group.xml',
-    'resources/layout/actionbar.xml',
-    'resources/layout/arrow_popup.xml',
-    'resources/layout/autocomplete_list.xml',
-    'resources/layout/autocomplete_list_item.xml',
-    'resources/layout/basic_color_picker_dialog.xml',
-    'resources/layout/bookmark_edit.xml',
-    'resources/layout/bookmark_folder_row.xml',
-    'resources/layout/bookmark_item_row.xml',
-    'resources/layout/browser_search.xml',
-    'resources/layout/browser_toolbar.xml',
-    'resources/layout/color_picker_row.xml',
-    'resources/layout/datetime_picker.xml',
-    'resources/layout/doorhanger.xml',
-    'resources/layout/doorhanger_button.xml',
-    'resources/layout/find_in_page_content.xml',
-    'resources/layout/font_size_preference.xml',
-    'resources/layout/gecko_app.xml',
-    'resources/layout/home_banner.xml',
-    'resources/layout/home_bookmarks_page.xml',
-    'resources/layout/home_empty_page.xml',
-    'resources/layout/home_empty_reading_page.xml',
-    'resources/layout/home_header_row.xml',
-    'resources/layout/home_history_list.xml',
-    'resources/layout/home_history_page.xml',
-    'resources/layout/home_history_tabs_indicator.xml',
-    'resources/layout/home_item_row.xml',
-    'resources/layout/home_last_tabs_page.xml',
-    'resources/layout/home_most_recent_page.xml',
-    'resources/layout/home_pager.xml',
-    'resources/layout/home_reading_list_page.xml',
-    'resources/layout/home_search_item_row.xml',
-    'resources/layout/home_suggestion_prompt.xml',
-    'resources/layout/home_top_sites_page.xml',
-    'resources/layout/icon_grid.xml',
-    'resources/layout/icon_grid_item.xml',
-    'resources/layout/launch_app_list.xml',
-    'resources/layout/launch_app_listitem.xml',
-    'resources/layout/list_item_header.xml',
-    'resources/layout/menu_action_bar.xml',
-    'resources/layout/menu_item_action_view.xml',
-    'resources/layout/menu_popup.xml',
-    'resources/layout/notification_icon_text.xml',
-    'resources/layout/notification_progress.xml',
-    'resources/layout/notification_progress_text.xml',
-    'resources/layout/pin_site_dialog.xml',
-    'resources/layout/preference_rightalign_icon.xml',
-    'resources/layout/preference_search_engine.xml',
-    'resources/layout/preference_search_tip.xml',
-    'resources/layout/remote_tabs_child.xml',
-    'resources/layout/remote_tabs_group.xml',
-    'resources/layout/search_engine_row.xml',
-    'resources/layout/select_dialog_list.xml',
-    'resources/layout/select_dialog_multichoice.xml',
-    'resources/layout/select_dialog_singlechoice.xml',
-    'resources/layout/shared_ui_components.xml',
-    'resources/layout/simple_dropdown_item_1line.xml',
-    'resources/layout/site_identity.xml',
-    'resources/layout/site_setting_item.xml',
-    'resources/layout/site_setting_title.xml',
-    'resources/layout/suggestion_item.xml',
-    'resources/layout/tab_menu_strip.xml',
-    'resources/layout/tabs_counter.xml',
-    'resources/layout/tabs_item_cell.xml',
-    'resources/layout/tabs_item_row.xml',
-    'resources/layout/tabs_panel.xml',
-    'resources/layout/tabs_panel_header.xml',
-    'resources/layout/tabs_panel_indicator.xml',
-    'resources/layout/text_selection_handles.xml',
-    'resources/layout/toolbar_edit_layout.xml',
-    'resources/layout/top_sites_grid_item_view.xml',
-    'resources/layout/two_line_page_row.xml',
-    'resources/layout/validation_message.xml',
-    'resources/layout/videoplayer.xml',
-    'resources/layout/web_app.xml',
-    'resources/menu-large-v11/browser_app_menu.xml',
-    'resources/menu-v11/browser_app_menu.xml',
-    'resources/menu-xlarge-v11/browser_app_menu.xml',
-    'resources/menu/browser_app_menu.xml',
-    'resources/menu/gecko_app_menu.xml',
-    'resources/menu/home_contextmenu.xml',
-    'resources/menu/titlebar_contextmenu.xml',
-    'resources/menu/top_sites_contextmenu.xml',
-    'resources/values-land/integers.xml',
-    'resources/values-land/layout.xml',
-    'resources/values-land/styles.xml',
-    'resources/values-large-land-v11/dimens.xml',
-    'resources/values-large-land-v11/styles.xml',
-    'resources/values-large-v11/dimens.xml',
-    'resources/values-large-v11/layout.xml',
-    'resources/values-large-v11/styles.xml',
-    'resources/values-large-v11/themes.xml',
-    'resources/values-v11/colors.xml',
-    'resources/values-v11/dimens.xml',
-    'resources/values-v11/styles.xml',
-    'resources/values-v11/themes.xml',
-    'resources/values-v14/styles.xml',
-    'resources/values-v16/styles.xml',
-    'resources/values-xlarge-land-v11/dimens.xml',
-    'resources/values-xlarge-land-v11/styles.xml',
-    'resources/values-xlarge-v11/dimens.xml',
-    'resources/values-xlarge-v11/integers.xml',
-    'resources/values-xlarge-v11/styles.xml',
-    'resources/values/arrays.xml',
-    'resources/values/attrs.xml',
-    'resources/values/colors.xml',
-    'resources/values/dimens.xml',
-    'resources/values/integers.xml',
-    'resources/values/layout.xml',
-    'resources/values/styles.xml',
-    'resources/values/themes.xml',
-    'resources/xml-v11/preference_headers.xml',
-    'resources/xml-v11/preferences.xml',
-    'resources/xml-v11/preferences_customize.xml',
-    'resources/xml-v11/preferences_customize_tablet.xml',
-    'resources/xml/preferences.xml',
-    'resources/xml/preferences_customize.xml',
-    'resources/xml/preferences_devtools.xml',
-    'resources/xml/preferences_display.xml',
-    'resources/xml/preferences_privacy.xml',
-    'resources/xml/preferences_search.xml',
-    'resources/xml/preferences_vendor.xml',
-    'resources/xml/searchable.xml',
+ANDROID_GENERATED_RESFILES += [
+    'res/values/strings.xml',
 ]
 
-if CONFIG['MOZ_CRASHREPORTER']:
-    ANDROID_RESFILES += [
-        'resources/drawable-mdpi/crash_reporter.png',
-        'resources/layout/crash_reporter.xml',
-    ]
-
 for var in ('MOZ_ANDROID_ANR_REPORTER', 'MOZ_LINKER_EXTRACT'):
     if CONFIG[var]:
         DEFINES[var] = 1
 
 for var in ('MOZ_UPDATER', 'MOZ_PKG_SPECIAL'):
     if CONFIG[var]:
         DEFINES[var] = CONFIG[var]
 
rename from mobile/android/branding/aurora/content/fennec_72x72.png
rename to mobile/android/branding/aurora/res/drawable-hdpi/icon.png
rename from mobile/android/branding/aurora/content/fennec_48x48.png
rename to mobile/android/branding/aurora/res/drawable-mdpi/icon.png
rename from mobile/android/branding/aurora/content/fennec_96x96.png
rename to mobile/android/branding/aurora/res/drawable-xhdpi/icon.png
rename from mobile/android/branding/aurora/content/fennec_144x144.png
rename to mobile/android/branding/aurora/res/drawable-xxhdpi/icon.png
rename from mobile/android/branding/beta/content/fennec_72x72.png
rename to mobile/android/branding/beta/res/drawable-hdpi/icon.png
rename from mobile/android/branding/beta/content/fennec_48x48.png
rename to mobile/android/branding/beta/res/drawable-mdpi/icon.png
rename from mobile/android/branding/beta/content/fennec_96x96.png
rename to mobile/android/branding/beta/res/drawable-xhdpi/icon.png
rename from mobile/android/branding/beta/content/fennec_144x144.png
rename to mobile/android/branding/beta/res/drawable-xxhdpi/icon.png
rename from mobile/android/branding/nightly/content/fennec_72x72.png
rename to mobile/android/branding/nightly/res/drawable-hdpi/icon.png
rename from mobile/android/branding/nightly/content/fennec_48x48.png
rename to mobile/android/branding/nightly/res/drawable-mdpi/icon.png
rename from mobile/android/branding/nightly/content/fennec_96x96.png
rename to mobile/android/branding/nightly/res/drawable-xhdpi/icon.png
rename from mobile/android/branding/nightly/content/fennec_144x144.png
rename to mobile/android/branding/nightly/res/drawable-xxhdpi/icon.png
rename from mobile/android/branding/official/content/fennec_72x72.png
rename to mobile/android/branding/official/res/drawable-hdpi/icon.png
rename from mobile/android/branding/official/content/fennec_48x48.png
rename to mobile/android/branding/official/res/drawable-mdpi/icon.png
rename from mobile/android/branding/official/content/fennec_96x96.png
rename to mobile/android/branding/official/res/drawable-xhdpi/icon.png
rename from mobile/android/branding/official/content/fennec_144x144.png
rename to mobile/android/branding/official/res/drawable-xxhdpi/icon.png
rename from mobile/android/branding/unofficial/content/fennec_72x72.png
rename to mobile/android/branding/unofficial/res/drawable-hdpi/icon.png
rename from mobile/android/branding/unofficial/content/fennec_48x48.png
rename to mobile/android/branding/unofficial/res/drawable-mdpi/icon.png
rename from mobile/android/branding/unofficial/content/fennec_96x96.png
rename to mobile/android/branding/unofficial/res/drawable-xhdpi/icon.png
rename from mobile/android/branding/unofficial/content/fennec_144x144.png
rename to mobile/android/branding/unofficial/res/drawable-xxhdpi/icon.png
--- a/mobile/android/tests/background/junit3/android-services.mozbuild
+++ b/mobile/android/tests/background/junit3/android-services.mozbuild
@@ -1,13 +1,6 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-ANDROID_RESFILES += [
-    'res/drawable-hdpi/icon.png',
-    'res/drawable-ldpi/icon.png',
-    'res/drawable-mdpi/icon.png',
-    'res/layout/main.xml',
-    'res/values/strings.xml',
-]
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -201,17 +201,17 @@ class TreeMetadataEmitter(LoggingMixin):
 
         # Proxy some variables as-is until we have richer classes to represent
         # them. We should aim to keep this set small because it violates the
         # desired abstraction of the build definition away from makefiles.
         passthru = VariablePassthru(sandbox)
         varmap = dict(
             # Makefile.in : moz.build
             ANDROID_GENERATED_RESFILES='ANDROID_GENERATED_RESFILES',
-            ANDROID_RESFILES='ANDROID_RESFILES',
+            ANDROID_RES_DIRS='ANDROID_RES_DIRS',
             CPP_UNIT_TESTS='CPP_UNIT_TESTS',
             EXPORT_LIBRARY='EXPORT_LIBRARY',
             EXTRA_COMPONENTS='EXTRA_COMPONENTS',
             EXTRA_JS_MODULES='EXTRA_JS_MODULES',
             EXTRA_PP_COMPONENTS='EXTRA_PP_COMPONENTS',
             EXTRA_PP_JS_MODULES='EXTRA_PP_JS_MODULES',
             FAIL_ON_WARNINGS='FAIL_ON_WARNINGS',
             FILES_PER_UNIFIED_FILE='FILES_PER_UNIFIED_FILE',
--- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
+++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ -63,20 +63,21 @@ VARIABLES = {
         """Android resource files generated as part of the build.
 
         This variable contains a list of files that are expected to be
         generated (often by preprocessing) into a 'res' directory as
         part of the build process, and subsequently merged into an APK
         file.
         """, 'export'),
 
-    'ANDROID_RESFILES': (StrictOrderingOnAppendList, list,
-        """Android resource files.
+    'ANDROID_RES_DIRS': (list, list,
+        """Android resource directories.
 
-        This variable contains a list of files to package into a 'res'
+        This variable contains a list of directories, each relative to
+        the srcdir, containing static files to package into a 'res'
         directory and merge into an APK file.
         """, 'export'),
 
     'SOURCES': (StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool}), list,
         """Source code files.
 
         This variable contains a list of source code files to compile.
         Accepts assembler, C, C++, Objective C/C++.
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -433,21 +433,32 @@ endif
 # layout expected by language repacks. Therefore, we move it to the
 # correct path here, in INNER_MAKE_PACKAGE. See comment about
 # OMNIJAR_NAME in configure.in.
 
 # OMNIJAR_DIR is './' for "omni.ja", 'assets/' for "assets/omni.ja".
 OMNIJAR_DIR := $(dir $(OMNIJAR_NAME))
 OMNIJAR_NAME := $(notdir $(OMNIJAR_NAME))
 
+# We force build an ap_ that does not check dependencies below.
+# Language repacks take advantage of this unchecked dependency ap_ to
+# insert additional resources (translated strings) into the ap_
+# without the build system's participation.  This can do the wrong
+# thing if there are resource changes in between build time and
+# package time.  We try to prevent mismatched resources by erroring
+# out if the compiled resource IDs are not the same as the resource
+# IDs being packaged.
+
 PKG_SUFFIX      = .apk
 INNER_MAKE_PACKAGE	= \
   $(if $(ALREADY_SZIPPED),,$(foreach lib,$(SZIP_LIBRARIES),host/bin/szip $(MOZ_SZIP_FLAGS) $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(lib) && )) \
-  make -C $(GECKO_APP_AP_PATH) gecko.ap_ && \
-  cp $(GECKO_APP_AP_PATH)/gecko.ap_ $(_ABS_DIST) && \
+  make -C $(GECKO_APP_AP_PATH) gecko-nodeps.ap_ && \
+  cp $(GECKO_APP_AP_PATH)/gecko-nodeps.ap_ $(_ABS_DIST)/gecko.ap_ && \
+  ( diff $(GECKO_APP_AP_PATH)/R.txt $(GECKO_APP_AP_PATH)/gecko-nodeps/R.txt >/dev/null || \
+    (echo "*** Error: The R.txt that was built and the R.txt that is being packaged are not the same. Rebuild mobile/android/base and re-package." && exit 1)) && \
   ( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
     mkdir -p lib/$(ABI_DIR) && \
     mv libmozglue.so $(MOZ_CHILD_PROCESS_NAME) lib/$(ABI_DIR) && \
     unzip -o $(_ABS_DIST)/gecko.ap_ && \
     rm $(_ABS_DIST)/gecko.ap_ && \
     $(ZIP) $(if $(MOZ_ENABLE_SZIP),-0 )$(_ABS_DIST)/gecko.ap_ $(ASSET_SO_LIBRARIES) && \
     $(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) $(SZIP_LIBRARIES) && \
     $(if $(filter-out ./,$(OMNIJAR_DIR)), \