Loading quickstep/libs/sysui_shared.jar +490 B (115 KiB) File changed.No diff preview for this file type. View original file View changed file quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java +9 −4 Original line number Diff line number Diff line Loading @@ -23,8 +23,10 @@ import static android.view.MotionEvent.ACTION_UP; import static android.view.MotionEvent.INVALID_POINTER_ID; import static com.android.quickstep.RemoteRunnable.executeSafely; import static com.android.quickstep.TouchInteractionService.DEBUG_SHOW_OVERVIEW_BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_BACK; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_NONE; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_OVERVIEW; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityOptions; Loading Loading @@ -61,6 +63,7 @@ import com.android.systemui.shared.system.RecentsAnimationListener; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.WindowManagerWrapper; import java.util.Arrays; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; Loading @@ -71,6 +74,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private static final String TAG = "ActivityTouchConsumer"; private static final long LAUNCHER_DRAW_TIMEOUT_MS = 150; private static final int[] DEFERRED_HIT_TARGETS = DEBUG_SHOW_OVERVIEW_BUTTON ? new int[] {HIT_TARGET_BACK, HIT_TARGET_OVERVIEW} : new int[] {HIT_TARGET_BACK}; private final RunningTaskInfo mRunningTask; private final RecentsModel mRecentsModel; Loading @@ -79,6 +84,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private final MainThreadExecutor mMainThreadExecutor; private final Choreographer mBackgroundThreadChoreographer; private final boolean mIsDeferredDownTarget; private final PointF mDownPos = new PointF(); private final PointF mLastPos = new PointF(); private int mActivePointerId = INVALID_POINTER_ID; Loading @@ -88,7 +94,6 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private BaseSwipeInteractionHandler mInteractionHandler; private int mDisplayRotation; private Rect mStableInsets = new Rect(); private @HitTarget int mDownHitTarget = HIT_TARGET_NONE; private VelocityTracker mVelocityTracker; private MotionEventQueue mEventQueue; Loading @@ -105,7 +110,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC mISystemUiProxy = systemUiProxy; mMainThreadExecutor = mainThreadExecutor; mBackgroundThreadChoreographer = backgroundThreadChoreographer; mDownHitTarget = downHitTarget; mIsDeferredDownTarget = Arrays.binarySearch(DEFERRED_HIT_TARGETS, downHitTarget) >= 0; } @Override Loading @@ -124,7 +129,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC // 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() && mDownHitTarget != HIT_TARGET_BACK) { if (!isUsingScreenShot() && !mIsDeferredDownTarget) { startTouchTrackingForWindowAnimation(ev.getEventTime()); } Loading Loading @@ -166,7 +171,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC if (isUsingScreenShot()) { startTouchTrackingForScreenshotAnimation(); } else if (mDownHitTarget == HIT_TARGET_BACK) { } else if (mIsDeferredDownTarget) { // If we deferred starting the window animation on touch down, then // start tracking now startTouchTrackingForWindowAnimation(ev.getEventTime()); Loading quickstep/src/com/android/quickstep/OverviewCommandHelper.java 0 → 100644 +111 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import static com.android.launcher3.LauncherState.OVERVIEW; import android.annotation.TargetApi; import android.app.ActivityManager.RecentTaskInfo; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Build; import android.os.SystemClock; import android.os.UserHandle; import android.view.ViewConfiguration; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.states.InternalStateHandler; import com.android.systemui.shared.system.ActivityManagerWrapper; /** * Helper class to handle various atomic commands for switching between Overview. */ @TargetApi(Build.VERSION_CODES.P) public class OverviewCommandHelper extends InternalStateHandler { private final Context mContext; private final ActivityManagerWrapper mAM; public final Intent homeIntent; public final ComponentName launcher; private long mLastToggleTime; public OverviewCommandHelper(Context context) { mContext = context; mAM = ActivityManagerWrapper.getInstance(); homeIntent = new Intent(Intent.ACTION_MAIN) .addCategory(Intent.CATEGORY_HOME) .setPackage(context.getPackageName()) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ResolveInfo info = context.getPackageManager().resolveActivity(homeIntent, 0); launcher = new ComponentName(context.getPackageName(), info.activityInfo.name); // Clear the packageName as system can fail to dedupe it b/64108432 homeIntent.setComponent(launcher).setPackage(null); } public void onOverviewToggle() { long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime; mLastToggleTime = SystemClock.elapsedRealtime(); if (isOverviewAlmostVisible()) { boolean isQuickTap = elapsedTime < ViewConfiguration.getDoubleTapTimeout(); startNonLauncherTask(isQuickTap ? 2 : 1); } else { Intent intent = addToIntent(new Intent(homeIntent)); mContext.startActivity(intent); initWhenReady(); } } private void startNonLauncherTask(int backStackCount) { for (RecentTaskInfo rti : mAM.getRecentTasks(backStackCount, UserHandle.myUserId())) { backStackCount--; if (backStackCount == 0) { mAM.startActivityFromRecents(rti.id, null); } } } private boolean isOverviewAlmostVisible() { if (clearReference()) { return true; } if (!mAM.getRunningTask().topActivity.equals(launcher)) { return false; } Launcher launcher = getLauncher(); return launcher != null && launcher.isStarted() && launcher.isInState(OVERVIEW); } private Launcher getLauncher() { return (Launcher) LauncherAppState.getInstance(mContext).getModel().getCallback(); } @Override protected boolean init(Launcher launcher, boolean alreadyOnHome) { AbstractFloatingView.closeAllOpenViews(launcher, alreadyOnHome); launcher.getStateManager().goToState(OVERVIEW, alreadyOnHome); clearReference(); return false; } } quickstep/src/com/android/quickstep/OverviewInteractionState.java +3 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ package com.android.quickstep; import static com.android.quickstep.TouchInteractionService.DEBUG_SHOW_OVERVIEW_BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON; import android.content.Context; import android.os.Handler; Loading Loading @@ -60,7 +62,7 @@ public class OverviewInteractionState { } }; private static int sFlags; private static int sFlags = DEBUG_SHOW_OVERVIEW_BUTTON ? FLAG_SHOW_OVERVIEW_BUTTON : 0; public static void setBackButtonVisible(Context context, boolean visible) { updateFlagOnUi(context, FLAG_HIDE_BACK_BUTTON, !visible); Loading quickstep/src/com/android/quickstep/RecentsModel.java +0 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.support.annotation.WorkerThread; import android.util.LruCache; import android.util.SparseArray; import com.android.launcher3.Launcher; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.util.Preconditions; Loading Loading
quickstep/libs/sysui_shared.jar +490 B (115 KiB) File changed.No diff preview for this file type. View original file View changed file
quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java +9 −4 Original line number Diff line number Diff line Loading @@ -23,8 +23,10 @@ import static android.view.MotionEvent.ACTION_UP; import static android.view.MotionEvent.INVALID_POINTER_ID; import static com.android.quickstep.RemoteRunnable.executeSafely; import static com.android.quickstep.TouchInteractionService.DEBUG_SHOW_OVERVIEW_BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_BACK; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_NONE; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_OVERVIEW; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityOptions; Loading Loading @@ -61,6 +63,7 @@ import com.android.systemui.shared.system.RecentsAnimationListener; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.WindowManagerWrapper; import java.util.Arrays; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; Loading @@ -71,6 +74,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private static final String TAG = "ActivityTouchConsumer"; private static final long LAUNCHER_DRAW_TIMEOUT_MS = 150; private static final int[] DEFERRED_HIT_TARGETS = DEBUG_SHOW_OVERVIEW_BUTTON ? new int[] {HIT_TARGET_BACK, HIT_TARGET_OVERVIEW} : new int[] {HIT_TARGET_BACK}; private final RunningTaskInfo mRunningTask; private final RecentsModel mRecentsModel; Loading @@ -79,6 +84,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private final MainThreadExecutor mMainThreadExecutor; private final Choreographer mBackgroundThreadChoreographer; private final boolean mIsDeferredDownTarget; private final PointF mDownPos = new PointF(); private final PointF mLastPos = new PointF(); private int mActivePointerId = INVALID_POINTER_ID; Loading @@ -88,7 +94,6 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private BaseSwipeInteractionHandler mInteractionHandler; private int mDisplayRotation; private Rect mStableInsets = new Rect(); private @HitTarget int mDownHitTarget = HIT_TARGET_NONE; private VelocityTracker mVelocityTracker; private MotionEventQueue mEventQueue; Loading @@ -105,7 +110,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC mISystemUiProxy = systemUiProxy; mMainThreadExecutor = mainThreadExecutor; mBackgroundThreadChoreographer = backgroundThreadChoreographer; mDownHitTarget = downHitTarget; mIsDeferredDownTarget = Arrays.binarySearch(DEFERRED_HIT_TARGETS, downHitTarget) >= 0; } @Override Loading @@ -124,7 +129,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC // 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() && mDownHitTarget != HIT_TARGET_BACK) { if (!isUsingScreenShot() && !mIsDeferredDownTarget) { startTouchTrackingForWindowAnimation(ev.getEventTime()); } Loading Loading @@ -166,7 +171,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC if (isUsingScreenShot()) { startTouchTrackingForScreenshotAnimation(); } else if (mDownHitTarget == HIT_TARGET_BACK) { } else if (mIsDeferredDownTarget) { // If we deferred starting the window animation on touch down, then // start tracking now startTouchTrackingForWindowAnimation(ev.getEventTime()); Loading
quickstep/src/com/android/quickstep/OverviewCommandHelper.java 0 → 100644 +111 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import static com.android.launcher3.LauncherState.OVERVIEW; import android.annotation.TargetApi; import android.app.ActivityManager.RecentTaskInfo; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Build; import android.os.SystemClock; import android.os.UserHandle; import android.view.ViewConfiguration; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.states.InternalStateHandler; import com.android.systemui.shared.system.ActivityManagerWrapper; /** * Helper class to handle various atomic commands for switching between Overview. */ @TargetApi(Build.VERSION_CODES.P) public class OverviewCommandHelper extends InternalStateHandler { private final Context mContext; private final ActivityManagerWrapper mAM; public final Intent homeIntent; public final ComponentName launcher; private long mLastToggleTime; public OverviewCommandHelper(Context context) { mContext = context; mAM = ActivityManagerWrapper.getInstance(); homeIntent = new Intent(Intent.ACTION_MAIN) .addCategory(Intent.CATEGORY_HOME) .setPackage(context.getPackageName()) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ResolveInfo info = context.getPackageManager().resolveActivity(homeIntent, 0); launcher = new ComponentName(context.getPackageName(), info.activityInfo.name); // Clear the packageName as system can fail to dedupe it b/64108432 homeIntent.setComponent(launcher).setPackage(null); } public void onOverviewToggle() { long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime; mLastToggleTime = SystemClock.elapsedRealtime(); if (isOverviewAlmostVisible()) { boolean isQuickTap = elapsedTime < ViewConfiguration.getDoubleTapTimeout(); startNonLauncherTask(isQuickTap ? 2 : 1); } else { Intent intent = addToIntent(new Intent(homeIntent)); mContext.startActivity(intent); initWhenReady(); } } private void startNonLauncherTask(int backStackCount) { for (RecentTaskInfo rti : mAM.getRecentTasks(backStackCount, UserHandle.myUserId())) { backStackCount--; if (backStackCount == 0) { mAM.startActivityFromRecents(rti.id, null); } } } private boolean isOverviewAlmostVisible() { if (clearReference()) { return true; } if (!mAM.getRunningTask().topActivity.equals(launcher)) { return false; } Launcher launcher = getLauncher(); return launcher != null && launcher.isStarted() && launcher.isInState(OVERVIEW); } private Launcher getLauncher() { return (Launcher) LauncherAppState.getInstance(mContext).getModel().getCallback(); } @Override protected boolean init(Launcher launcher, boolean alreadyOnHome) { AbstractFloatingView.closeAllOpenViews(launcher, alreadyOnHome); launcher.getStateManager().goToState(OVERVIEW, alreadyOnHome); clearReference(); return false; } }
quickstep/src/com/android/quickstep/OverviewInteractionState.java +3 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ package com.android.quickstep; import static com.android.quickstep.TouchInteractionService.DEBUG_SHOW_OVERVIEW_BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON; import android.content.Context; import android.os.Handler; Loading Loading @@ -60,7 +62,7 @@ public class OverviewInteractionState { } }; private static int sFlags; private static int sFlags = DEBUG_SHOW_OVERVIEW_BUTTON ? FLAG_SHOW_OVERVIEW_BUTTON : 0; public static void setBackButtonVisible(Context context, boolean visible) { updateFlagOnUi(context, FLAG_HIDE_BACK_BUTTON, !visible); Loading
quickstep/src/com/android/quickstep/RecentsModel.java +0 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.support.annotation.WorkerThread; import android.util.LruCache; import android.util.SparseArray; import com.android.launcher3.Launcher; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.util.Preconditions; Loading