Working around incorrect wallpaper offsets being calculated in RTL.

- When launcher starts up, onCreate() triggers the launcher model loader
  to start, which calls bindScreens() to add the workspace pages.  
  However, layout does not happen until the device is unlocked, which 
  means that even though the default screen index and children are there
  the page scrolls are calculated incorrectly, and even in RTL, the 
  page scroll for the 0th screen is zero (it should be at the right
  most edge of the workspace).  This CL works around this by deferring 
  until the first layout after bindScreens() to unlock the wallpaper
  offset from its default bounds.  The workaround is only applied when 
  the launcher activity is first created.

Bug: 28795125
Change-Id: I33da0d7f934f5337d26e69f068f579a32897a837
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3f12abf..aa6f62e 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1372,6 +1372,9 @@
         mWorkspace.setHapticFeedbackEnabled(false);
         mWorkspace.setOnLongClickListener(this);
         mWorkspace.setup(mDragController);
+        // Until the workspace is bound, ensure that we keep the wallpaper offset locked to the
+        // default state, otherwise we will update to the wrong offsets in RTL
+        mWorkspace.lockWallpaperToDefaultPage();
         mWorkspace.bindAndInitFirstWorkspaceScreen(null /* recycled qsb */);
         mDragController.addDragListener(mWorkspace);
 
@@ -3667,6 +3670,11 @@
             mWorkspace.createCustomContentContainer();
             populateCustomContentContainer();
         }
+
+        // After we have added all the screens, if the wallpaper was locked to the default state,
+        // then notify to indicate that it can be released and a proper wallpaper offset can be
+        // computed before the next layout
+        mWorkspace.unlockWallpaperFromDefaultPageOnNextLayout();
     }
 
     private void bindAddScreens(ArrayList<Long> orderedScreenIds) {