merge fx-team to mozilla-central
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 11 Oct 2013 11:13:15 +0200
changeset 150428 9f2f57672cc37dd0e6ecff324ac9b0bfb66227b8
parent 150422 6fef99317f215e9b7b4830100f1d5989330a47b2 (current diff)
parent 150427 98b44fcfebb272a8513d5a65598d18c7e3e5d9ee (diff)
child 150438 6b101d4c6d241e3fa39b5ce71f122243fe2c118c
push id25439
push usercbook@mozilla.com
push dateFri, 11 Oct 2013 09:13:41 +0000
treeherdermozilla-central@9f2f57672cc3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone27.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
merge fx-team to mozilla-central
mobile/android/base/resources/xml/preferences.xml.in
mobile/android/base/resources/xml/preferences_customize.xml.in
mobile/android/base/resources/xml/searchable.xml.in
mobile/android/base/resources/xml/sync_authenticator.xml.in
mobile/android/base/resources/xml/sync_options.xml.in
mobile/android/base/resources/xml/sync_syncadapter.xml.in
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -308,22 +308,16 @@ FENNEC_PP_JAVA_FILES := \
   widget/GeckoRelativeLayout.java \
   widget/GeckoTextSwitcher.java \
   widget/GeckoTextView.java \
   SysInfo.java \
   WebApp.java \
   WebApps.java \
   $(NULL)
 
-FENNEC_PP_XML_FILES = \
-  res/xml/preferences.xml \
-  res/xml/preferences_customize.xml \
-  res/xml/searchable.xml \
-  $(NULL)
-
 ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
 MIN_CPU_VERSION=7
 else
 MIN_CPU_VERSION=5
 endif
 
 MOZ_APP_BUILDID=$(shell cat $(DEPTH)/config/buildid)
 
@@ -353,16 +347,18 @@ endif
 DEFINES += \
   -DMANGLED_ANDROID_PACKAGE_NAME=$(subst fennec,f3nn3c,$(ANDROID_PACKAGE_NAME)) \
   -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
   -DANDROID_CPU_ARCH=$(ANDROID_CPU_ARCH) \
   -DANDROID_VERSION_CODE=$(ANDROID_VERSION_CODE) \
   -DCPU_ARCH=$(CPU_ARCH) \
   -DGRE_MILESTONE=$(GRE_MILESTONE) \
   -DMOZILLA_OFFICIAL=$(MOZILLA_OFFICIAL) \
+  -DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)" \
+  -DMOZ_ANDROID_SHARED_ACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE)" \
   -DMOZ_APP_ABI=$(TARGET_XPCOM_ABI) \
   -DMOZ_APP_BASENAME=$(MOZ_APP_BASENAME) \
   -DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID) \
   -DMOZ_APP_DISPLAYNAME="$(MOZ_APP_DISPLAYNAME)" \
   -DMOZ_APP_ID=$(MOZ_APP_ID) \
   -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
   -DMOZ_APP_VENDOR=$(MOZ_APP_VENDOR) \
   -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
@@ -389,66 +385,38 @@ GARBAGE += \
   AndroidManifest.xml  \
   classes.dex  \
   $(MOZGLUE_PP_JAVA_FILES) \
   $(FENNEC_PP_JAVA_FILES) \
   $(SYNC_PP_JAVA_FILES) \
   gecko.ap_  \
   res/values/strings.xml \
   R.java \
-  $(FENNEC_PP_XML_FILES) \
-  $(SYNC_PP_RES_XML) \
   package-name.txt \
   fennec_ids.txt \
   Manifest.java \
   javah.out \
   jni-stubs.inc \
   GeneratedJNIWrappers.cpp \
   GeneratedJNIWrappers.h \
   $(NULL)
 
 GARBAGE_DIRS += classes db jars res sync services
 
-MOZ_ANDROID_SHARED_ID = "$(ANDROID_PACKAGE_NAME).sharedID"
-MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "$(ANDROID_PACKAGE_NAME)_sync"
-
 # 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
-
-# we released these builds to the public with shared IDs and need to keep them
-ifeq (org.mozilla.firefox,$(ANDROID_PACKAGE_NAME))
-MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
-MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
-else ifeq (org.mozilla.firefox_beta,$(ANDROID_PACKAGE_NAME))
-MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
-MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
-else ifeq (org.mozilla.fennec_aurora,$(ANDROID_PACKAGE_NAME))
-MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
-MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
-else ifeq (org.mozilla.fennec,$(ANDROID_PACKAGE_NAME))
-MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
-MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
-endif
-
 else
 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
 endif
 
-ifdef MOZ_ANDROID_SHARED_ID
-DEFINES += -DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)"
-endif
-ifdef MOZ_ANDROID_SHARED_ACCOUNT_TYPE
-DEFINES += -DMOZ_ANDROID_SHARED_ACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE)"
-endif
-
 RES_LAYOUT = \
   $(SYNC_RES_LAYOUT) \
   res/layout/arrow_popup.xml \
   res/layout/autocomplete_list.xml \
   res/layout/autocomplete_list_item.xml \
   res/layout/bookmark_edit.xml \
   res/layout/bookmark_folder_row.xml \
   res/layout/bookmark_item_row.xml \
@@ -593,21 +561,24 @@ RES_VALUES_V14 = \
   res/values-v14/styles.xml \
   $(NULL)
 
 RES_VALUES_V16 = \
   res/values-v16/styles.xml \
   $(NULL)
 
 RES_XML = \
+  res/xml/preferences.xml \
+  res/xml/preferences_customize.xml \
   res/xml/preferences_display.xml \
   res/xml/preferences_search.xml \
   res/xml/preferences_privacy.xml \
   res/xml/preferences_vendor.xml \
   res/xml/preferences_devtools.xml \
+  res/xml/searchable.xml \
   $(SYNC_RES_XML) \
   $(NULL)
 
 RES_XML_V11 = \
   res/xml-v11/preferences_customize.xml \
   res/xml-v11/preference_headers.xml \
   res/xml-v11/preferences_customize_tablet.xml \
   res/xml-v11/preferences.xml \
@@ -1328,26 +1299,16 @@ jni-stubs.inc: jars/gecko-browser.jar ja
 	$(PYTHON) $(topsrcdir)/mobile/android/base/jni-generator.py javah.out $@
 
 ANNOTATION_PROCESSOR_JAR_FILES := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar
 
 GeneratedJNIWrappers.cpp: $(ANNOTATION_PROCESSOR_JAR_FILES)
 GeneratedJNIWrappers.cpp: $(ALL_JARS)
 	$(JAVA) -classpath $(JAVA_BOOTCLASSPATH):$(ANNOTATION_PROCESSOR_JAR_FILES) org.mozilla.gecko.annotationProcessors.AnnotationProcessor $(ALL_JARS)
 
-PP_RES_XML= \
-  $(SYNC_PP_RES_XML) \
-  $(FENNEC_PP_XML_FILES) \
-  $(NULL)
-
-# This is kinda awful; if any of the source files change, we remake them all.
-$(PP_RES_XML): $(patsubst res/%,$(srcdir)/resources/%.in,$(PP_RES_XML))
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-             $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $(subst res/,$(srcdir)/resources/,$@).in > $@
-
 # AndroidManifest.xml includes these files, so they need to be marked as dependencies.
 SERVICES_MANIFEST_FRAGMENTS = $(wildcard $(topsrcdir)/mobile/android/services/manifests/*.in)
 
 android-tgts = \
   AndroidManifest.xml \
   $(MOZGLUE_PP_JAVA_FILES) \
   $(FENNEC_PP_JAVA_FILES) \
   $(SYNC_PP_JAVA_FILES) \
@@ -1402,17 +1363,16 @@ all_resources = \
   res/drawable-mdpi/icon.png \
   res/drawable-hdpi/icon.png \
   res/drawable-xhdpi/icon.png \
   res/drawable-xxhdpi/icon.png \
   res/values/strings.xml \
   $(MULTILOCALE_STRINGS_XML_FILES) \
   AndroidManifest.xml \
   $(RESOURCES) \
-  $(PP_RES_XML) \
   $(NULL)
 
 R.java: $(all_resources)
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko --non-constant-id
 
 gecko.ap_: $(all_resources)
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar  -S res -F $@
 
--- a/mobile/android/base/android-services-files.mk
+++ b/mobile/android/base/android-services-files.mk
@@ -338,22 +338,19 @@ SYNC_RES_VALUES_V11 := \
   res/values-v11/sync_styles.xml \
   $(NULL)
 
 SYNC_RES_VALUES_LARGE_V11 := \
   res/values-large-v11/sync_styles.xml \
   $(NULL)
 
 SYNC_RES_XML := \
-  $(NULL)
-
-SYNC_PP_RES_XML := \
+  res/xml/sync_authenticator.xml \
   res/xml/sync_syncadapter.xml \
   res/xml/sync_options.xml \
-  res/xml/sync_authenticator.xml \
   $(NULL)
 
 SYNC_THIRDPARTY_JAVA_FILES := \
   httpclientandroidlib/androidextra/HttpClientAndroidLog.java \
   httpclientandroidlib/annotation/GuardedBy.java \
   httpclientandroidlib/annotation/Immutable.java \
   httpclientandroidlib/annotation/NotThreadSafe.java \
   httpclientandroidlib/annotation/ThreadSafe.java \
--- a/mobile/android/base/home/BrowserSearch.java
+++ b/mobile/android/base/home/BrowserSearch.java
@@ -211,18 +211,20 @@ public class BrowserSearch extends HomeF
     }
 
     @Override
     public void onDestroyView() {
         super.onDestroyView();
 
         unregisterEventListener("SearchEngines:Data");
 
+        mList.setAdapter(null);
+        mList = null;
+
         mView = null;
-        mList = null;
         mSuggestionsOptInPrompt = null;
         mSuggestClient = null;
     }
 
     @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
         mList.setTag(HomePager.LIST_TAG_BROWSER_SEARCH);
--- a/mobile/android/base/locales/Makefile.in
+++ b/mobile/android/base/locales/Makefile.in
@@ -54,20 +54,24 @@ strings-xml-preqs =\
   $(strings-xml-in) \
   $(BRANDPATH) \
   $(STRINGSPATH) \
   $(SYNCSTRINGSPATH) \
   $(BOOKMARKSPATH) \
   $(if $(IS_LANGUAGE_REPACK),FORCE) \
   $(NULL)
 
+$(if $(MOZ_ANDROID_SHARED_ACCOUNT_TYPE),,$(error Missing MOZ_ANDROID_SHARED_ACCOUNT_TYPE))
+
 $(dir-strings-xml)/strings.xml: $(strings-xml-preqs)
 	$(NSINSTALL) -D $(dir-strings-xml)
 	$(TOUCH) $(call mkdir_deps,$(dir-strings-xml))
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
       $(DEFINES) \
+	  -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
+	  -DBOOKMARKSPATH="$(BOOKMARKSPATH)" \
 	  -DBRANDPATH="$(BRANDPATH)" \
+	  -DMOZ_ANDROID_SHARED_ACCOUNT_TYPE=$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE) \
+	  -DMOZ_APP_DISPLAYNAME="@MOZ_APP_DISPLAYNAME@" \
 	  -DSTRINGSPATH="$(STRINGSPATH)" \
 	  -DSYNCSTRINGSPATH="$(SYNCSTRINGSPATH)" \
-	  -DBOOKMARKSPATH="$(BOOKMARKSPATH)" \
-	  -DMOZ_APP_DISPLAYNAME="@MOZ_APP_DISPLAYNAME@" \
       $< \
 	  > $@
rename from mobile/android/base/resources/xml/preferences.xml.in
rename to mobile/android/base/resources/xml/preferences.xml
--- a/mobile/android/base/resources/xml/preferences.xml.in
+++ b/mobile/android/base/resources/xml/preferences.xml
@@ -1,9 +1,8 @@
-#filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 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/. -->
 
 <!-- Preferences screen for pre-v11 Android devices that do not support
      PreferenceFragment or ActionBar. Preference changes here should be mirrored
      to xml-v11/preferences.xml. -->
@@ -13,56 +12,56 @@
                   android:enabled="false">
 
     <org.mozilla.gecko.SyncPreference android:key="android.not_a_preference.sync"
                                       android:title="@string/pref_sync"
                                       android:persistent="false" />
 
     <PreferenceScreen android:title="@string/pref_category_customize" >
         <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
+                android:targetPackage="@string/android_package_name"
                 android:targetClass="org.mozilla.gecko.GeckoPreferences" >
             <extra
                 android:name="resource"
                 android:value="preferences_customize" />
         </intent>
     </PreferenceScreen>
 
     <PreferenceScreen android:title="@string/pref_category_display" >
         <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
+                android:targetPackage="@string/android_package_name"
                 android:targetClass="org.mozilla.gecko.GeckoPreferences" >
             <extra
                 android:name="resource"
                 android:value="preferences_display" />
         </intent>
     </PreferenceScreen>
 
     <PreferenceScreen android:title="@string/pref_category_privacy_short" >
         <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
+                android:targetPackage="@string/android_package_name"
                 android:targetClass="org.mozilla.gecko.GeckoPreferences" >
             <extra
                 android:name="resource"
                 android:value="preferences_privacy" />
         </intent>
     </PreferenceScreen>
 
     <PreferenceScreen android:title="@string/pref_category_vendor">
         <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
+                android:targetPackage="@string/android_package_name"
                 android:targetClass="org.mozilla.gecko.GeckoPreferences" >
             <extra
                 android:name="resource"
                 android:value="preferences_vendor" />
         </intent>
     </PreferenceScreen>
     <PreferenceScreen android:title="@string/pref_category_devtools">
         <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
+                android:targetPackage="@string/android_package_name"
                 android:targetClass="org.mozilla.gecko.GeckoPreferences" >
             <extra
                 android:name="resource"
                 android:value="preferences_devtools" />
         </intent>
     </PreferenceScreen>
 
 </PreferenceScreen>
rename from mobile/android/base/resources/xml/preferences_customize.xml.in
rename to mobile/android/base/resources/xml/preferences_customize.xml
--- a/mobile/android/base/resources/xml/preferences_customize.xml.in
+++ b/mobile/android/base/resources/xml/preferences_customize.xml
@@ -1,20 +1,19 @@
-#filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 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/. -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:enabled="false">
     <PreferenceScreen android:title="@string/pref_category_search" >
         <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
+                android:targetPackage="@string/android_package_name"
                 android:targetClass="org.mozilla.gecko.GeckoPreferences" >
             <extra
                 android:name="resource"
                 android:value="preferences_search" />
         </intent>
     </PreferenceScreen>
 
     <org.mozilla.gecko.AndroidImportPreference
rename from mobile/android/base/resources/xml/searchable.xml.in
rename to mobile/android/base/resources/xml/searchable.xml
--- a/mobile/android/base/resources/xml/searchable.xml.in
+++ b/mobile/android/base/resources/xml/searchable.xml
@@ -1,8 +1,7 @@
-#filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <searchable xmlns:android="http://schemas.android.com/apk/res/android"
             android:label="@string/moz_app_displayname"
-            android:searchSuggestAuthority="@ANDROID_PACKAGE_NAME@.db.browser"
+            android:searchSuggestAuthority="@string/content_authority_db_browser"
             android:searchSuggestIntentAction="android.intent.action.SEARCH"
             android:searchSettingsDescription="@string/searchable_description"
             android:includeInGlobalSearch="true"/>
rename from mobile/android/base/resources/xml/sync_authenticator.xml.in
rename to mobile/android/base/resources/xml/sync_authenticator.xml
--- a/mobile/android/base/resources/xml/sync_authenticator.xml.in
+++ b/mobile/android/base/resources/xml/sync_authenticator.xml
@@ -1,12 +1,11 @@
-#filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 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/. -->
 
 <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
-    android:accountType="@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@"
+    android:accountType="@string/moz_android_shared_account_type"
     android:icon="@drawable/icon"
     android:smallIcon="@drawable/icon"
     android:label="@string/sync_account_label"
     android:accountPreferences="@xml/sync_options" />
rename from mobile/android/base/resources/xml/sync_options.xml.in
rename to mobile/android/base/resources/xml/sync_options.xml
--- a/mobile/android/base/resources/xml/sync_options.xml.in
+++ b/mobile/android/base/resources/xml/sync_options.xml
@@ -1,32 +1,31 @@
-#filter substitution
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 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/. -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
   <PreferenceCategory
     android:title="@string/sync_settings_options" />
   <PreferenceScreen
     android:key="sync_options"
     android:title="@string/sync_title_pair"
     android:summary="@string/sync_settings_summary_pair">
     <intent
       android:action="android.intent.action.MAIN"
-      android:targetPackage="@ANDROID_PACKAGE_NAME@"
+      android:targetPackage="@string/android_package_name"
       android:targetClass="org.mozilla.gecko.sync.setup.activities.SetupSyncActivity">
       <extra
         android:name="isSetup"
         android:value="false" />
     </intent>
   </PreferenceScreen>
   <PreferenceScreen
     android:key="sync_configure_engines"
     android:title="@string/sync_configure_engines_title">
     <intent
       android:action="android.intent.action.MAIN"
-      android:targetPackage="@ANDROID_PACKAGE_NAME@"
+      android:targetPackage="@string/android_package_name"
       android:targetClass="org.mozilla.gecko.sync.config.activities.SelectEnginesActivity">
     </intent>
   </PreferenceScreen>
 </PreferenceScreen>
rename from mobile/android/base/resources/xml/sync_syncadapter.xml.in
rename to mobile/android/base/resources/xml/sync_syncadapter.xml
--- a/mobile/android/base/resources/xml/sync_syncadapter.xml.in
+++ b/mobile/android/base/resources/xml/sync_syncadapter.xml
@@ -1,12 +1,11 @@
-#filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 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/. -->
 
 <sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
-    android:contentAuthority="@ANDROID_PACKAGE_NAME@.db.browser"
-    android:accountType="@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@"
+    android:contentAuthority="@string/content_authority_db_browser"
+    android:accountType="@string/moz_android_shared_account_type"
     android:supportsUploading="true"
     android:userVisible="true"
 />
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -14,16 +14,19 @@
 <!ENTITY formatS1 "&#037;1&#036;s">
 <!ENTITY formatS2 "&#037;2&#036;s">
 <!ENTITY formatD "&#037;d">
 ]>
 
 #includesubst @BOOKMARKSPATH@
 <resources>
   <string name="moz_app_displayname">@MOZ_APP_DISPLAYNAME@</string>
+  <string name="android_package_name">@ANDROID_PACKAGE_NAME@</string>
+  <string name="content_authority_db_browser">@ANDROID_PACKAGE_NAME@.db.browser</string>
+  <string name="moz_android_shared_account_type">@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@</string>
 #include ../services/strings.xml.in
   <string name="no_space_to_start_error">&no_space_to_start_error;</string>
   <string name="error_loading_file">&error_loading_file;</string>
 
   <string name="bookmarks_title">&bookmarks_title;</string>
   <string name="history_title">&history_title;</string>
   <string name="reading_list_title">&reading_list_title;</string>
 
new file mode 100644
--- /dev/null
+++ b/mobile/android/defs.mk
@@ -0,0 +1,18 @@
+MOZ_ANDROID_SHARED_ID = "$(ANDROID_PACKAGE_NAME).sharedID"
+MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "$(ANDROID_PACKAGE_NAME)_sync"
+
+# We released these builds to the public with shared IDs and need to
+# keep them consistent.
+ifeq (org.mozilla.firefox,$(ANDROID_PACKAGE_NAME))
+MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
+MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
+else ifeq (org.mozilla.firefox_beta,$(ANDROID_PACKAGE_NAME))
+MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
+MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
+else ifeq (org.mozilla.fennec_aurora,$(ANDROID_PACKAGE_NAME))
+MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
+MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
+else ifeq (org.mozilla.fennec,$(ANDROID_PACKAGE_NAME))
+MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
+MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
+endif
--- a/mobile/android/tests/background/junit3/src/common/TestUtils.java
+++ b/mobile/android/tests/background/junit3/src/common/TestUtils.java
@@ -1,13 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 package org.mozilla.gecko.background.common;
 
+import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
 import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
@@ -72,9 +74,86 @@ public class TestUtils extends AndroidSy
 
   public void testGetStagesToSyncFromBundle() {
     final String[] all = new String[] { "other1", "other2", "skip1", "skip2", "sync1", "sync2" };
     assertStagesFromBundle(all, null, null, all);
     assertStagesFromBundle(all, new String[] { "sync1" }, null, new String[] { "sync1" });
     assertStagesFromBundle(all, null, new String[] { "skip1", "skip2" }, new String[] { "other1", "other2", "sync1", "sync2" });
     assertStagesFromBundle(all, new String[] { "sync1", "sync2" }, new String[] { "skip1", "skip2" }, new String[] { "sync1", "sync2" });
   }
+
+  public static void deleteDirectoryRecursively(final File dir) throws IOException {
+    if (!dir.isDirectory()) {
+      throw new IllegalStateException("Given directory, " + dir + ", is not a directory!");
+    }
+
+    for (File f : dir.listFiles()) {
+      if (f.isDirectory()) {
+        deleteDirectoryRecursively(f);
+      } else if (!f.delete()) {
+        // Since this method is for testing, we assume we should be able to do this.
+        throw new IOException("Could not delete file, " + f.getAbsolutePath() + ". Permissions?");
+      }
+    }
+
+    if (!dir.delete()) {
+      throw new IOException("Could not delete dir, " + dir.getAbsolutePath() + ".");
+    }
+  }
+
+  public void testDeleteDirectory() throws Exception {
+    final String TEST_DIR = getApplicationContext().getCacheDir().getAbsolutePath() +
+        "-testDeleteDirectory-" + System.currentTimeMillis();
+
+    // Non-existent directory.
+    final File nonexistent = new File("nonexistentDirectory"); // Hopefully. ;)
+    assertFalse(nonexistent.exists());
+    try {
+      deleteDirectoryRecursively(nonexistent);
+      fail("deleteDirectoryRecursively on a nonexistent directory should throw Exception");
+    } catch (IllegalStateException e) { }
+
+    // Empty dir.
+    File dir = mkdir(TEST_DIR);
+    deleteDirectoryRecursively(dir);
+    assertFalse(dir.exists());
+
+    // Filled dir.
+    dir = mkdir(TEST_DIR);
+    populateDir(dir);
+    deleteDirectoryRecursively(dir);
+    assertFalse(dir.exists());
+
+    // Filled dir with empty dir.
+    dir = mkdir(TEST_DIR);
+    populateDir(dir);
+    File subDir = new File(TEST_DIR + File.separator + "subDir");
+    assertTrue(subDir.mkdir());
+    deleteDirectoryRecursively(dir);
+    assertFalse(subDir.exists()); // For short-circuiting errors.
+    assertFalse(dir.exists());
+
+    // Filled dir with filled dir.
+    dir = mkdir(TEST_DIR);
+    populateDir(dir);
+    subDir = new File(TEST_DIR + File.separator + "subDir");
+    assertTrue(subDir.mkdir());
+    populateDir(subDir);
+    deleteDirectoryRecursively(dir);
+    assertFalse(subDir.exists()); // For short-circuiting errors.
+    assertFalse(dir.exists());
+  }
+
+  private File mkdir(final String name) {
+    final File dir = new File(name);
+    assertTrue(dir.mkdir());
+    return dir;
+  }
+
+  private void populateDir(final File dir) throws IOException {
+    assertTrue(dir.isDirectory());
+    final String dirPath = dir.getAbsolutePath();
+    for (int i = 0; i < 3; i++) {
+      final File f = new File(dirPath + File.separator + i);
+      assertTrue(f.createNewFile()); // Throws IOException if file could not be created.
+    }
+  }
 }
--- a/mobile/android/tests/background/junit3/src/helpers/FakeProfileTestCase.java
+++ b/mobile/android/tests/background/junit3/src/helpers/FakeProfileTestCase.java
@@ -4,16 +4,18 @@
 package org.mozilla.gecko.background.helpers;
 
 import java.io.File;
 
 import android.app.Activity;
 import android.content.Context;
 import android.test.ActivityInstrumentationTestCase2;
 
+import org.mozilla.gecko.background.common.TestUtils;
+
 public abstract class FakeProfileTestCase extends ActivityInstrumentationTestCase2<Activity> {
 
   protected Context context;
   protected File fakeProfileDirectory;
 
   public FakeProfileTestCase() {
     super(Activity.class);
   }
@@ -21,23 +23,22 @@ public abstract class FakeProfileTestCas
   protected abstract String getCacheSuffix();
 
   @Override
   protected void setUp() throws Exception {
     super.setUp();
     context = getInstrumentation().getTargetContext();
     File cache = context.getCacheDir();
     fakeProfileDirectory = new File(cache.getAbsolutePath() + getCacheSuffix());
+    if (fakeProfileDirectory.exists()) {
+      TestUtils.deleteDirectoryRecursively(fakeProfileDirectory);
+    }
     if (!fakeProfileDirectory.mkdir()) {
       throw new IllegalStateException("Could not create temporary directory.");
     }
   }
 
   @Override
   protected void tearDown() throws Exception {
-    // We don't check return values.
-    for (File child : fakeProfileDirectory.listFiles()) {
-      child.delete();
-    }
-    fakeProfileDirectory.delete();
+    TestUtils.deleteDirectoryRecursively(fakeProfileDirectory);
     super.tearDown();
   }
 }