Merge "Fix a couple quickscrub issues" into ub-launcher3-master
diff --git a/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java b/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java
index e39430d..bf55bd6 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/EdgeSwipeController.java
@@ -24,6 +24,7 @@
 import static com.android.quickstep.TouchInteractionService.EDGE_NAV_BAR;
 
 import android.graphics.Rect;
+import android.metrics.LogMaker;
 import android.view.MotionEvent;
 
 import com.android.launcher3.DeviceProfile;
@@ -34,6 +35,40 @@
 import com.android.launcher3.util.VerticalSwipeController;
 import com.android.quickstep.RecentsView;
 
+class EventLogTags {
+    private EventLogTags() {
+    }  // don't instantiate
+
+    /** 524292 sysui_multi_action (content|4) */
+    public static final int SYSUI_MULTI_ACTION = 524292;
+
+    public static void writeSysuiMultiAction(Object[] content) {
+        android.util.EventLog.writeEvent(SYSUI_MULTI_ACTION, content);
+    }
+}
+
+class MetricsLogger {
+    private static MetricsLogger sMetricsLogger;
+
+    private static MetricsLogger getLogger() {
+        if (sMetricsLogger == null) {
+            sMetricsLogger = new MetricsLogger();
+        }
+        return sMetricsLogger;
+    }
+
+    protected void saveLog(Object[] rep) {
+        EventLogTags.writeSysuiMultiAction(rep);
+    }
+
+    public void write(LogMaker content) {
+        if (content.getType() == 0/*MetricsEvent.TYPE_UNKNOWN*/) {
+            content.setType(4/*MetricsEvent.TYPE_ACTION*/);
+        }
+        saveLog(content.serialize());
+    }
+}
+
 /**
  * Extension of {@link VerticalSwipeController} to go from NORMAL to OVERVIEW.
  */
@@ -42,6 +77,8 @@
 
     private static final Rect sTempRect = new Rect();
 
+    private final MetricsLogger mMetricsLogger = new MetricsLogger();
+
     public EdgeSwipeController(Launcher l) {
         super(l, NORMAL, OVERVIEW, l.getDeviceProfile().isVerticalBarLayout()
                 ? HORIZONTAL : VERTICAL);
@@ -70,6 +107,17 @@
 
     @Override
     protected void onTransitionComplete(boolean wasFling, boolean stateChanged) {
+        if (stateChanged && mToState instanceof OverviewState) {
+            // Mimic ActivityMetricsLogger.logAppTransitionMultiEvents() logging for
+            // "Recents" activity for app transition tests.
+            final LogMaker builder = new LogMaker(761/*APP_TRANSITION*/);
+            builder.setPackageName("com.android.systemui");
+            builder.addTaggedData(871/*FIELD_CLASS_NAME*/,
+                    "com.android.systemui.recents.RecentsActivity");
+            builder.addTaggedData(319/*APP_TRANSITION_DELAY_MS*/,
+                    0/* zero time */);
+            mMetricsLogger.write(builder);
+        }
         // TODO: Log something
     }
 
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index f50204f..a4c8d96 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -281,9 +281,9 @@
         mWasLauncherAlreadyVisible = alreadyOnHome;
         mLauncher = launcher;
 
-        // For the duration of the gesture, set the screen orientation to BEHIND to ensure that we
-        // do not rotate mid-quickscrub
-        mLauncher.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND);
+        // For the duration of the gesture, lock the screen orientation to ensure that we do not
+        // rotate mid-quickscrub
+        mLauncher.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
 
         LauncherState startState = mLauncher.getStateManager().getState();
         if (startState.disableRestore) {
diff --git a/src/com/android/launcher3/util/VerticalSwipeController.java b/src/com/android/launcher3/util/VerticalSwipeController.java
index 735fb2f..a647378 100644
--- a/src/com/android/launcher3/util/VerticalSwipeController.java
+++ b/src/com/android/launcher3/util/VerticalSwipeController.java
@@ -62,7 +62,7 @@
     private boolean mNoIntercept;
 
     private AnimatorPlaybackController mCurrentAnimation;
-    private LauncherState mToState;
+    protected LauncherState mToState;
 
     private float mStartProgress;
     // Ratio of transition process [0, 1] to drag displacement (px)