Bug 709391 - Part 1: implement in-Fennec Android Sync shipping solution. r=blassey, a=akeybl
authorRichard Newman <rnewman@mozilla.com>
Wed, 21 Dec 2011 08:44:06 -0800
changeset 84213 2bf61c2d0e29d42b08d7c26202a3d8d157e156e1
parent 84212 76509146a8e5e5f5dabf590c7a3cfe51a24754cc
child 84214 7b15cf9b89facef74fc74717a9ea638bb3e6c6d3
push id775
push userrnewman@mozilla.com
push dateThu, 26 Jan 2012 04:30:14 +0000
treeherdermozilla-aurora@b310cea4258c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, akeybl
bugs709391
milestone11.0a2
Bug 709391 - Part 1: implement in-Fennec Android Sync shipping solution. r=blassey, a=akeybl
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/Makefile.in
mobile/android/base/strings.xml.in
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -7,16 +7,18 @@
       android:versionName="@MOZ_APP_VERSION@"
 #ifdef MOZ_ANDROID_SHARED_ID
       android:sharedUserId="@MOZ_ANDROID_SHARED_ID@"
 #endif
       >
     <uses-sdk android:minSdkVersion="5"
               android:targetSdkVersion="11"/>
 
+#include ../sync/manifests/SyncAndroidManifest_permissions.xml.in
+
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
     <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
 
     <uses-permission android:name="android.permission.WAKE_LOCK"/>
@@ -100,16 +102,18 @@
                   android:process="@ANDROID_PACKAGE_NAME@Restarter"
                   android:theme="@style/Gecko"
                   android:excludeFromRecents="true">
           <intent-filter>
             <action android:name="org.mozilla.gecko.restart"/>
           </intent-filter>
         </activity>
 
+#include ../sync/manifests/SyncAndroidManifest_activities.xml.in
+
 #if MOZ_CRASHREPORTER
   <activity android:name="CrashReporter"
             android:label="@string/crash_reporter_title"
             android:icon="@drawable/crash_reporter"
             android:theme="@style/Gecko"
             android:excludeFromRecents="true">
           <intent-filter>
             <action android:name="org.mozilla.gecko.reportCrash" />
@@ -140,14 +144,15 @@
                   android:theme="@style/Gecko.TitleBar"
                   android:label="@string/settings_title"
                   android:excludeFromRecents="true"/>
 
         <provider android:name="@ANDROID_PACKAGE_NAME@.db.BrowserProvider"
                   android:authorities="@ANDROID_PACKAGE_NAME@.db.browser"
                   android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
 
+#include ../sync/manifests/SyncAndroidManifest_services.xml.in
     </application>
 
     <permission android:name="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"
                 android:protectionLevel="signature"/>
 
 </manifest> 
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -42,17 +42,25 @@ VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/ipc/app/defs.mk
 
 DIRS = locales
 
 DIST_FILES = package-name.txt
 
+SYNC_JAVA_FILES=$(shell cat $(topsrcdir)/mobile/android/sync/java-sources.mn | tr '\n' ' ';)
+SYNC_PP_JAVA_FILES=$(shell cat $(topsrcdir)/mobile/android/sync/preprocess-sources.mn | tr '\n' ' ';)
+SYNC_RES_DRAWABLE=$(shell cat $(topsrcdir)/mobile/android/sync/android-drawable-resources.mn | tr '\n' ' ';)
+SYNC_RES_LAYOUT=$(shell cat $(topsrcdir)/mobile/android/sync/android-layout-resources.mn | tr '\n' ' ';)
+SYNC_RES_VALUES=$(shell cat $(topsrcdir)/mobile/android/sync/android-values-resources.mn | tr '\n' ' ';)
+SYNC_RES_XML=$(shell cat $(topsrcdir)/mobile/android/sync/android-xml-resources.mn | tr '\n' ' ';)
+
 JAVAFILES = \
+  $(SYNC_JAVA_FILES) \
   AboutHomeContent.java \
   AlertNotification.java \
   AutoCompletePopup.java \
   AwesomeBar.java \
   AwesomeBarTabs.java \
   BrowserToolbar.java \
   ConfirmPreference.java \
   db/AndroidBrowserDB.java \
@@ -112,16 +120,17 @@ JAVAFILES = \
   gfx/ViewportMetrics.java \
   gfx/WidgetTileLayer.java \
   ui/Axis.java \
   ui/PanZoomController.java \
   ui/SubdocumentScrollHelper.java \
   $(NULL)
 
 PROCESSEDJAVAFILES = \
+  $(SYNC_PP_JAVA_FILES) \
   App.java \
   LauncherShortcuts.java \
   NotificationHandler.java \
   Restarter.java \
   db/BrowserContract.java \
   db/BrowserProvider.java \
   $(NULL)
 
@@ -180,16 +189,17 @@ endif
 
 else
 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
 DEFINES += -DMOZ_ANDROID_SHARED_ID="$(ANDROID_PACKAGE_NAME).sharedID"
 endif
 
 RES_LAYOUT = \
+  $(SYNC_RES_LAYOUT) \
   res/layout/autocomplete_list_item.xml \
   res/layout/awesomebar.xml \
   res/layout/awesomebar_header_row.xml \
   res/layout/awesomebar_row.xml \
   res/layout/awesomebar_search.xml \
   res/layout/awesomebar_tab_indicator.xml \
   res/layout/awesomebar_tabs.xml \
   res/layout/browser_toolbar.xml \
@@ -214,29 +224,33 @@ RES_LAYOUT = \
   $(NULL)
 
 RES_LAYOUT_V11 = \
   res/layout-v11/awesomebar.xml \
   res/layout-v11/gecko_app.xml \
   $(NULL)
 
 RES_VALUES = \
+  $(SYNC_RES_VALUES) \
   res/values/defaults.xml \
   res/values/arrays.xml \
   res/values/colors.xml \
   res/values/styles.xml \
   res/values/themes.xml \
   $(NULL)
 
 RES_VALUES_V11 = \
   res/values-v11/styles.xml \
   res/values-v11/themes.xml \
   $(NULL)
 
-RES_XML = res/xml/preferences.xml
+RES_XML = \
+  res/xml/preferences.xml \
+  $(SYNC_RES_XML) \
+  $(NULL)
 
 RES_ANIM = \
   res/anim/grow_fade_in.xml \
   res/anim/shrink_fade_out.xml \
   $(NULL)
 
 RES_DRAWABLE_NODPI = \
   res/drawable-nodpi/abouthome_bg.png \
@@ -445,17 +459,19 @@ RES_MENU = \
 JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
 
 ifdef MOZ_CRASHREPORTER
 PROCESSEDJAVAFILES += CrashReporter.java
 MOZ_ANDROID_DRAWABLES += mobile/android/base/resources/drawable/crash_reporter.png
 RES_LAYOUT += res/layout/crash_reporter.xml
 endif
 
-MOZ_ANDROID_DRAWABLES += mobile/android/base/resources/drawable/abouthome_bg_repeat.xml         \
+MOZ_ANDROID_DRAWABLES += \
+                         $(SYNC_RES_DRAWABLE)                                                   \
+                         mobile/android/base/resources/drawable/abouthome_bg_repeat.xml         \
                          mobile/android/base/resources/drawable/abouthome_topsites_bg_repeat.xml \
                          mobile/android/base/resources/drawable/address_bar_bg.xml              \
                          mobile/android/base/resources/drawable/address_bar_bg_shadow.xml       \
                          mobile/android/base/resources/drawable/address_bar_url_default.xml     \
                          mobile/android/base/resources/drawable/address_bar_url_pressed.xml     \
                          mobile/android/base/resources/drawable/autocomplete_list_bg.9.png      \
                          mobile/android/base/resources/drawable/awesomebar_tab_indicator.xml    \
                          mobile/android/base/resources/drawable/awesomebar_tab_press.xml        \
@@ -502,23 +518,26 @@ MOZ_ANDROID_DRAWABLES += $(shell if test
 
 include $(topsrcdir)/config/rules.mk
 
 # Override the Java settings with some specific android settings
 include $(topsrcdir)/config/android-common.mk
 
 # Note that we're going to set up a dependency directly between embed_android.dex and the java files
 # Instead of on the .class files, since more than one .class file might be produced per .java file
+# Sync dependencies are provided in a single jar. Sync classes themselves are delivered as source,
+# because Android resource classes must be compiled together in order to avoid overlapping resource
+# indices.
 classes.dex: $(JAVAFILES) $(PROCESSEDJAVAFILES) R.java
 	$(NSINSTALL) -D classes
 	$(JAVAC) $(JAVAC_FLAGS) -Xlint:unchecked -Xlint:deprecation -d classes  $(addprefix $(srcdir)/,$(JAVAFILES)) $(PROCESSEDJAVAFILES) R.java
 	$(DX) --dex --output=$@ classes
 
 AndroidManifest.xml $(PROCESSEDJAVAFILES) package-name.txt: % : %.in Makefile.in
-	mkdir -p db
+	mkdir -p db sync/repositories/android
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
              $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
 
 res/drawable/icon.png: $(MOZ_APP_ICON)
 	$(NSINSTALL) -D res/drawable
 	cp $(ICON_PATH) $@
 
 res/drawable-hdpi/icon.png: $(MOZ_APP_ICON)
@@ -535,16 +554,17 @@ RES_DRAWABLE = $(addprefix res/drawable/
 	$(NSINSTALL) -D res/layout
 	$(NSINSTALL) $^  res/layout
 
 $(RES_LAYOUT_V11): $(subst res/,$(srcdir)/resources/,$(RES_LAYOUT_V11))
 	$(NSINSTALL) -D res/layout-v11
 	$(NSINSTALL) $(srcdir)/resources/layout-v11/* res/layout-v11/
 
 $(RES_VALUES): \
+		$(subst res/,$(srcdir)/resources/,$(SYNC_RES_VALUES)) \
 		$(srcdir)/resources/values/colors.xml \
 		$(srcdir)/resources/values/styles.xml \
 		$(srcdir)/resources/values/themes.xml \
 		$(srcdir)/resources/values/arrays.xml \
 		$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/res/values/defaults.xml
 	$(NSINSTALL) -D res/values
 	$(NSINSTALL) $^  res/values
 
@@ -607,17 +627,17 @@ RES_DRAWABLE = $(addprefix res/drawable/
 $(RES_COLOR): $(subst res/,$(srcdir)/resources/,$(RES_COLOR))
 	$(NSINSTALL) -D res/color
 	$(NSINSTALL) $^  res/color
 
 $(RES_MENU): $(subst res/,$(srcdir)/resources/,$(RES_MENU))
 	$(NSINSTALL) -D res/menu
 	$(NSINSTALL) $^  res/menu
 
-R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_LAYOUT_V11) $(RES_DRAWABLE) $(RES_VALUES) $(RES_VALUES_V11) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_MDPI_V8) $(RES_DRAWABLE_HDPI_V8) $(RES_DRAWABLE_MDPI_V9) $(RES_DRAWABLE_HDPI_V9) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_COLOR) $(RES_MENU) res/drawable/icon.png res/drawable-hdpi/icon.png res/values/strings.xml AndroidManifest.xml
+R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_LAYOUT_V11) $(RES_DRAWABLE) $(RES_VALUES) $(RES_VALUES_V11) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_MDPI_V8) $(RES_DRAWABLE_HDPI_V8) $(RES_DRAWABLE_MDPI_V9) $(RES_DRAWABLE_HDPI_V9) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_COLOR) $(RES_MENU) res/drawable/sync_icon.png res/drawable/icon.png res/drawable-hdpi/icon.png res/values/strings.xml AndroidManifest.xml
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko
 
-gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_LAYOUT) $(RES_LAYOUT_V11) $(RES_DRAWABLE) $(RES_VALUES) $(RES_VALUES_V11) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_MDPI_V8) $(RES_DRAWABLE_HDPI_V8) $(RES_DRAWABLE_MDPI_V9) $(RES_DRAWABLE_HDPI_V9) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_COLOR) $(RES_MENU) res/values/strings.xml FORCE
+gecko.ap_: AndroidManifest.xml res/drawable/sync_icon.png res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_LAYOUT) $(RES_LAYOUT_V11) $(RES_DRAWABLE) $(RES_VALUES) $(RES_VALUES_V11) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_MDPI_V8) $(RES_DRAWABLE_HDPI_V8) $(RES_DRAWABLE_MDPI_V9) $(RES_DRAWABLE_HDPI_V9) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_COLOR) $(RES_MENU) res/values/strings.xml FORCE
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar  -S res -F $@
 
 libs:: classes.dex package-name.txt
 	$(INSTALL) classes.dex $(FINAL_TARGET)
 	$(INSTALL) package-name.txt $(FINAL_TARGET)
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -1,15 +1,16 @@
 #filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE resources [
 #includesubst @BRANDPATH@
 #includesubst @STRINGSPATH@
 ]>
 <resources>
+#include ../sync/strings.xml.in
   <string name="splash_firstrun">&splash_firstrun;</string>
   <string name="no_space_to_start_error">&no_space_to_start_error;</string>
   <string name="error_loading_file">&error_loading_file;</string>
 
   <string name="awesomebar_all_pages_title">&awesomebar_all_pages_title;</string>
   <string name="awesomebar_bookmarks_title">&awesomebar_bookmarks_title;</string>
   <string name="awesomebar_history_title">&awesomebar_history_title;</string>
   <string name="awesomebar_search_engine">&awesomebar_search_engine;</string>