Merge "Revert "Revert "Remove back button when on home screen""" into ub-launcher3-master
diff --git a/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java b/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java
index a2c54f1..b3354a4 100644
--- a/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java
+++ b/quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java
@@ -38,8 +38,10 @@
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
+import android.metrics.LogMaker;
import android.os.Bundle;
import android.os.Looper;
+import android.os.SystemClock;
import android.util.Log;
import android.view.Display;
import android.view.MotionEvent;
@@ -64,6 +66,40 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+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());
+ }
+}
+
/**
* Touch consumer for handling events originating from an activity other than Launcher
*/
@@ -91,6 +127,8 @@
private VelocityTracker mVelocityTracker;
+ private final MetricsLogger mMetricsLogger = new MetricsLogger();
+
public OtherActivityTouchConsumer(Context base, RunningTaskInfo runningTaskInfo,
RecentsModel recentsModel, Intent homeIntent, ISystemUiProxy systemUiProxy,
MainThreadExecutor mainThreadExecutor) {
@@ -125,7 +163,7 @@
// Start the window animation on down to give more time for launcher to draw if the
// user didn't start the gesture over the back button
if (!isUsingScreenShot()) {
- startTouchTrackingForWindowAnimation();
+ startTouchTrackingForWindowAnimation(ev.getEventTime());
}
Display display = getSystemService(WindowManager.class).getDefaultDisplay();
@@ -264,7 +302,7 @@
}
}
- private void startTouchTrackingForWindowAnimation() {
+ private void startTouchTrackingForWindowAnimation(long touchTimeMs) {
// Create the shared handler
final WindowTransformSwipeHandler handler =
new WindowTransformSwipeHandler(mRunningTask, this);
@@ -302,6 +340,16 @@
} else {
controller.finish(false /* toHome */);
}
+
+ // 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*/,
+ SystemClock.uptimeMillis() - touchTimeMs);
+ mMetricsLogger.write(builder);
}
public void onAnimationCanceled() {
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 75fd78e..0e7bc42 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -156,7 +156,8 @@
mEventQueue = new MotionEventQueue(Choreographer.getInstance(), mNoOpTouchConsumer);
sConnected = true;
- new ModelPreload().start(this);
+ // Temporarily disable model preload
+ // new ModelPreload().start(this);
initBackgroundChoreographer();
}
@@ -251,7 +252,7 @@
@Override
public void accept(MotionEvent ev) {
- if (!mTarget.getWindowId().isFocused()) {
+ if (!mTarget.hasWindowFocus()) {
return;
}
int action = ev.getActionMasked();
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index d09daed..bbd90cb 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -33,6 +33,7 @@
import android.annotation.TargetApi;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
+import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.graphics.Matrix;
import android.graphics.Point;
@@ -280,6 +281,10 @@
mWasLauncherAlreadyVisible = alreadyOnHome;
mLauncher = launcher;
+ // 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) {
startState = mLauncher.getStateManager().getRestState();
@@ -616,6 +621,9 @@
mLauncherTransitionController = null;
mLauncherLayoutListener.setHandler(null);
mLauncherLayoutListener.close(false);
+
+ // Restore the requested orientation to the user preference after the gesture has ended
+ mLauncher.updateRequestedOrientation();
}
public void layoutListenerClosed() {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 2e04837..b4093b7 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -371,11 +371,7 @@
// For handling default keys
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
- // On large interfaces, or on devices that a user has specifically enabled screen rotation,
- // we want the screen to auto-rotate based on the current orientation
- setRequestedOrientation(mRotationEnabled
- ? SCREEN_ORIENTATION_UNSPECIFIED : SCREEN_ORIENTATION_NOSENSOR);
-
+ updateRequestedOrientation();
setContentView(mLauncherView);
getRootView().dispatchInsets();
@@ -398,6 +394,13 @@
TraceHelper.endSection("Launcher-onCreate");
}
+ public void updateRequestedOrientation() {
+ // On large interfaces, or on devices that a user has specifically enabled screen rotation,
+ // we want the screen to auto-rotate based on the current orientation
+ setRequestedOrientation(mRotationEnabled
+ ? SCREEN_ORIENTATION_UNSPECIFIED : SCREEN_ORIENTATION_NOSENSOR);
+ }
+
@Override
public void onConfigurationChanged(Configuration newConfig) {
int diff = newConfig.diff(mOldConfig);
@@ -1854,6 +1857,18 @@
if (intent == null) {
throw new IllegalArgumentException("Input must have a valid intent");
}
+ if (item instanceof ShortcutInfo) {
+ ShortcutInfo si = (ShortcutInfo) item;
+ if (si.hasStatusFlag(ShortcutInfo.FLAG_SUPPORTS_WEB_UI)
+ && intent.getAction() == Intent.ACTION_VIEW) {
+ // make a copy of the intent that has the package set to null
+ // we do this because the platform sometimes disables instant
+ // apps temporarily (triggered by the user) and fallbacks to the
+ // web ui. This only works though if the package isn't set
+ intent = new Intent(intent);
+ intent.setPackage(null);
+ }
+ }
startActivitySafely(v, intent, item);
}