Bug 1380639 - Fixes to fold into underlying patch. draft
authorNick Alexander <nalexander@mozilla.com>
Fri, 14 Jul 2017 14:49:07 -0700
changeset 609144 140a1b3ed9988e5e101b1db56bb4cc2c77836362
parent 609143 a45d65fe52a505fc483159da76f5a9eaa17d5163
child 637518 c99a14b121e9e33360c761fd32f19023cc744528
push id68521
push usernalexander@mozilla.com
push dateFri, 14 Jul 2017 21:53:05 +0000
bugs1380639
milestone56.0a1
Bug 1380639 - Fixes to fold into underlying patch. I had done a bunch of the work on android.m4 before I realized I should start from your work. I folded my approach into yours. There's only one substantive change in the first patch from yours -- Gradle support. The other changes are just to generalize the existing function rather than duplicating it. It's not clear to me whether the Proguard changes are required. I don't see any Proguard directives in the constraint-layout AAR, but Google is moving past Proguard pretty quickly, so it's possible that constraint-layout is not designed for a Proguard-ed environment. I think it more likely that the constraint-layout AAR does not do any reflection. MozReview-Commit-ID: C0sRCoLnrKU
mobile/android/app/src/main/res/layout/home_combined_history_panel.xml
mobile/android/base/Makefile.in
mobile/android/base/moz.build
mobile/android/config/proguard/proguard.cfg
--- a/mobile/android/app/src/main/res/layout/home_combined_history_panel.xml
+++ b/mobile/android/app/src/main/res/layout/home_combined_history_panel.xml
@@ -1,52 +1,90 @@
 <?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/. -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:orientation="vertical">
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                                             xmlns:app="http://schemas.android.com/apk/res-auto"
+                                             xmlns:tools="http://schemas.android.com/tools"
+                                             android:layout_width="match_parent"
+                                             android:layout_height="match_parent"
+                                             android:orientation="vertical">
 
     <android.support.v4.widget.SwipeRefreshLayout
-            android:id="@+id/refresh_layout"
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:layout_weight="1.2">
+        android:id="@+id/refresh_layout"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        tools:layout_constraintTop_creator="1"
+        tools:layout_constraintRight_creator="1"
+        tools:layout_constraintBottom_creator="1"
+        android:layout_marginStart="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_marginEnd="8dp"
+        app:layout_constraintRight_toRightOf="parent"
+        tools:layout_constraintLeft_creator="1"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
 
         <org.mozilla.gecko.home.CombinedHistoryRecyclerView
-                android:id="@+id/combined_recycler_view"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:scrollbars="vertical"/>
+            android:id="@+id/combined_recycler_view"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:scrollbars="vertical"/>
 
     </android.support.v4.widget.SwipeRefreshLayout>
 
-    <include android:id="@+id/home_history_empty_view"
-              layout="@layout/home_empty_panel"
-              android:layout_width="match_parent"
-              android:layout_height="0dp"
-              android:layout_weight="3"
-              android:visibility="gone"/>
+    <include
+        android:id="@+id/home_history_empty_view"
+        layout="@layout/home_empty_panel"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="gone"
+        app:layout_constraintRight_toLeftOf="@+id/refresh_layout"
+        tools:layout_constraintTop_creator="1"
+        tools:layout_constraintRight_creator="1"
+        tools:layout_constraintBottom_creator="1"
+        app:layout_constraintBottom_toTopOf="parent"
+        tools:layout_constraintLeft_creator="1"
+        app:layout_constraintLeft_toLeftOf="@+id/refresh_layout"
+        app:layout_constraintTop_toTopOf="parent"/>
 
-    <include android:id="@+id/home_clients_empty_view"
-              layout="@layout/history_sync_setup"
-              android:layout_width="match_parent"
-              android:layout_height="0dp"
-              android:layout_weight="3"
-              android:visibility="gone"/>
+    <include
+        android:id="@+id/home_clients_empty_view"
+        layout="@layout/history_sync_setup"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="gone"
+        tools:layout_constraintTop_creator="1"
+        tools:layout_constraintBottom_creator="1"
+        app:layout_constraintBottom_toTopOf="parent"
+        tools:layout_constraintLeft_creator="1"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent"/>
 
-    <include android:id="@+id/home_recent_tabs_empty_view"
-              layout="@layout/home_empty_panel"
-              android:layout_width="match_parent"
-              android:layout_height="0dp"
-              android:layout_weight="3"
-              android:visibility="gone"/>
+    <include
+        android:id="@+id/home_recent_tabs_empty_view"
+        layout="@layout/home_empty_panel"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="gone"
+        tools:layout_constraintTop_creator="1"
+        tools:layout_constraintRight_creator="1"
+        app:layout_constraintRight_toRightOf="@+id/home_clients_empty_view"
+        app:layout_constraintTop_toBottomOf="@+id/home_clients_empty_view"
+        tools:layout_constraintLeft_creator="1"
+        app:layout_constraintLeft_toRightOf="@+id/home_clients_empty_view"/>
 
-    <Button android:id="@+id/history_panel_footer_button"
-            style="@style/Widget.Home.ActionButton"
-            android:layout_width="match_parent"
-            android:layout_height="48dp"
-            android:visibility="gone" />
+    <Button
+        android:id="@+id/history_panel_footer_button"
+        style="@style/Widget.Home.ActionButton"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="gone"
+        tools:layout_constraintTop_creator="1"
+        tools:layout_constraintRight_creator="1"
+        app:layout_constraintRight_toRightOf="@+id/home_recent_tabs_empty_view"
+        app:layout_constraintTop_toBottomOf="@+id/home_recent_tabs_empty_view"
+        tools:layout_constraintLeft_creator="1"
+        app:layout_constraintLeft_toRightOf="@+id/home_recent_tabs_empty_view"/>
 
-</LinearLayout>
+</android.support.constraint.ConstraintLayout>
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -33,28 +33,28 @@ GARBAGE_DIRS += classes db jars res sync
 JAVA_BOOTCLASSPATH := \
     $(ANDROID_SDK)/android.jar \
     $(NULL)
 
 JAVA_BOOTCLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_BOOTCLASSPATH)))
 
 JAVA_CLASSPATH += \
     $(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB) \
-    $(ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB) \
     $(ANDROID_SUPPORT_V4_AAR_LIB) \
     $(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
     $(ANDROID_APPCOMPAT_V7_AAR_LIB) \
     $(ANDROID_SUPPORT_VECTOR_DRAWABLE_AAR_LIB) \
     $(ANDROID_ANIMATED_VECTOR_DRAWABLE_AAR_LIB) \
     $(ANDROID_CARDVIEW_V7_AAR_LIB) \
     $(ANDROID_DESIGN_AAR_LIB) \
     $(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
     $(ANDROID_CUSTOMTABS_AAR_LIB) \
     $(ANDROID_PALETTE_V7_AAR_LIB) \
     $(ANDROID_CONSTRAINT_LAYOUT_AAR_LIB) \
+    $(ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB) \
     $(NULL)
 
 # If native devices are enabled, add Google Play Services and some of the v7
 # compat libraries.
 ifdef MOZ_NATIVE_DEVICES
     JAVA_CLASSPATH += \
         $(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
         $(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
@@ -101,16 +101,17 @@ java_bundled_libs := \
     $(ANDROID_SUPPORT_VECTOR_DRAWABLE_AAR_LIB) \
     $(ANDROID_ANIMATED_VECTOR_DRAWABLE_AAR_LIB) \
     $(ANDROID_CARDVIEW_V7_AAR_LIB) \
     $(ANDROID_DESIGN_AAR_LIB) \
     $(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
     $(ANDROID_CUSTOMTABS_AAR_LIB) \
     $(ANDROID_PALETTE_V7_AAR_LIB) \
     $(ANDROID_CONSTRAINT_LAYOUT_AAR_LIB) \
+    $(ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB) \
     $(NULL)
 
 ifdef MOZ_NATIVE_DEVICES
     java_bundled_libs += \
         $(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
         $(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
         $(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \
         $(ANDROID_MEDIAROUTER_V7_AAR_LIB) \
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -163,17 +163,16 @@ constants_jar.sources += ['java/org/mozi
 constants_jar.generated_sources = [
     '../geckoview/generated/preprocessed/org/mozilla/geckoview/BuildConfig.java',
     'generated/preprocessed/org/mozilla/gecko/AdjustConstants.java',
     'generated/preprocessed/org/mozilla/gecko/AppConstants.java',
     'generated/preprocessed/org/mozilla/gecko/MmaConstants.java',
 ]
 constants_jar.extra_jars = [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-    CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
     CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
 ]
 
 if CONFIG['MOZ_INSTALL_TRACKING']:
     constants_jar.sources += ['java/org/mozilla/gecko/' + x for x in [
         'adjust/AdjustHelper.java',
@@ -238,17 +237,17 @@ if CONFIG['ANDROID_CUSTOMTABS_AAR']:
 # (no resources) resjar.generated_sources += ['generated/android/support/customtabs/R.java']
 if CONFIG['ANDROID_PALETTE_V7_AAR']:
     ANDROID_EXTRA_PACKAGES += ['android.support.v7.palette']
     ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PALETTE_V7_AAR_RES']]
 # (no resources) resjar.generated_sources += ['generated/android/support/v7/palette/R.java']
 if CONFIG['ANDROID_CONSTRAINT_LAYOUT_AAR']:
     ANDROID_EXTRA_PACKAGES += ['android.support.constraint']
     ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_CONSTRAINT_LAYOUT_AAR_RES']]
-# (no resources) resjar.generated_sources += ['generated/android/support/customtabs/R.java']
+    resjar.generated_sources += ['generated/android/support/constraint/R.java']
 
 resjar.javac_flags += ['-Xlint:all']
 
 mgjar = add_java_jar('gecko-mozglue')
 mgjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in [
     'mozglue/ByteBufferInputStream.java',
     'mozglue/DirectBufferAllocator.java',
     'mozglue/GeckoLoader.java',
@@ -256,17 +255,16 @@ mgjar.sources += [geckoview_source_dir +
     'mozglue/NativeReference.java',
     'mozglue/NativeZip.java',
     'mozglue/SafeIntent.java',
     'mozglue/SharedMemory.java',
 ]]
 mgjar.generated_sources = [] # Keep it this way.
 mgjar.extra_jars += [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-    CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
     'constants.jar',
 ]
 mgjar.javac_flags += ['-Xlint:all']
 
 gujar = add_java_jar('gecko-util')
 gujar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in [
     'util/ActivityResultHandler.java',
     'util/ActivityResultHandlerMap.java',
@@ -303,31 +301,29 @@ gujar.sources += [geckoview_source_dir +
     'util/UUIDUtil.java',
     'util/WeakReferenceHandler.java',
     'util/WindowUtils.java',
 ]]
 gujar.extra_jars = [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
-    CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
     'constants.jar',
     'gecko-mozglue.jar',
 ]
 gujar.javac_flags += ['-Xlint:all,-deprecation']
 
 stjar = add_java_jar('sync-thirdparty')
 stjar.sources += [ thirdparty_source_dir + f for f in sync_thirdparty_java_files ]
 stjar.javac_flags = ['-Xlint:none']
 
 services_jar = add_java_jar('services')
 services_jar.sources += sync_java_files
 services_jar.extra_jars = [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-    CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
     CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
     'constants.jar',
     'gecko-R.jar',
     'gecko-mozglue.jar',
     'gecko-thirdparty.jar',
     'gecko-util.jar',
@@ -479,17 +475,16 @@ if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
         'media/GeckoHlsRendererBase.java',
         'media/GeckoHlsVideoRenderer.java',
         'media/Utils.java',
     ]]
 
 
 gvjar.extra_jars += [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-    CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
     'constants.jar',
     'gecko-mozglue.jar',
     'gecko-util.jar',
 ]
 
 gvjar.javac_flags += [
@@ -1030,17 +1025,16 @@ else:
         'skin/SkinConfig.java',
         'toolbar/TabCounter.java',
     ]]
 
 android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
 gbjar.generated_sources = [] # Keep it this way.
 gbjar.extra_jars += [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-    CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
     'constants.jar',
 ]
 if CONFIG['MOZ_CRASHREPORTER']:
     gbjar.sources += [ 'java/org/mozilla/gecko/CrashReporter.java' ]
     ANDROID_RES_DIRS += [ 'crashreporter/res' ]
 
@@ -1173,16 +1167,17 @@ gbjar.extra_jars += [CONFIG['ANDROID_APP
 gbjar.extra_jars += [CONFIG['ANDROID_SUPPORT_VECTOR_DRAWABLE_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_ANIMATED_VECTOR_DRAWABLE_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_CARDVIEW_V7_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_DESIGN_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_CUSTOMTABS_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_PALETTE_V7_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_CONSTRAINT_LAYOUT_AAR_LIB']]
+gbjar.extra_jars += [CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB']]
 
 gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough', '-J-Xmx512m', '-J-Xms128m']
 
 # gecko-thirdparty is a good place to put small independent libraries
 gtjar = add_java_jar('gecko-thirdparty')
 gtjar.sources += [ thirdparty_source_dir + f for f in [
     'com/booking/rtlviewpager/PagerAdapterWrapper.java',
     'com/booking/rtlviewpager/RtlViewPager.java',
@@ -1220,17 +1215,16 @@ gtjar.sources += [ thirdparty_source_dir
     'com/squareup/picasso/Target.java',
     'com/squareup/picasso/TargetAction.java',
     'com/squareup/picasso/Transformation.java',
     'com/squareup/picasso/UrlConnectionDownloader.java',
     'com/squareup/picasso/Utils.java'
 ] ]
 gtjar.extra_jars = [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-    CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
 ]
 
 if not CONFIG['MOZILLA_OFFICIAL']:
     gtjar.sources += [ thirdparty_source_dir + f for f in [
         'org/lucasr/dspec/DesignSpec.java',
         'org/lucasr/dspec/RawResource.java'
@@ -1381,17 +1375,16 @@ if CONFIG['MOZ_ANDROID_MMA']:
     ] ]
     lpjar.extra_jars += [
         CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_ADS_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_GCM_AAR_LIB'],
         CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-        CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
         CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
         CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
         'sync-thirdparty.jar',
     ]
 
 # Putting branding earlier allows branders to override default resources.
 ANDROID_RES_DIRS += [
     '/' + CONFIG['MOZ_BRANDING_DIRECTORY'] + '/res',
@@ -1438,17 +1431,16 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']
     search_source_dir = SRCDIR + '/../search'
     include('../search/search_activity_sources.mozbuild')
 
     search_activity = add_java_jar('search-activity')
     search_activity.sources += [search_source_dir + '/' + f for f in search_activity_sources]
     search_activity.javac_flags += ['-Xlint:all']
     search_activity.extra_jars = [
         CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
-        CONFIG['ANDROID_CONSTRAINT_LAYOUT_SOLVER_JAR_LIB'],
         CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
         CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
         'constants.jar',
         'gecko-R.jar',
         'gecko-browser.jar',
         'gecko-mozglue.jar',
         'gecko-thirdparty.jar',
         'gecko-util.jar',
--- a/mobile/android/config/proguard/proguard.cfg
+++ b/mobile/android/config/proguard/proguard.cfg
@@ -171,8 +171,15 @@
 
 -include "appcompat-v7-keeps.cfg"
 
 -include "proguard-android.cfg"
 
 -include "proguard-leanplum.cfg"
 
 -include "../../geckoview/proguard-rules.txt"
+
+# Keep - Library. Keep all public and protected classes, fields, and methods.
+-keep public class android.support.constraint.*
+{
+    public protected <fields>;
+    public protected <methods>;
+}