use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project android_frameworks_base by AOSPA.
the class RecentsImpl method toggleRecents.
public void toggleRecents(int growTarget) {
// Skip this toggle if we are already waiting to trigger recents via alt-tab
if (mFastAltTabTrigger.isDozing()) {
return;
}
mDraggingInRecents = false;
mLaunchedWhileDocking = false;
mTriggeredFromAltTab = false;
try {
SystemServicesProxy ssp = Recents.getSystemServices();
MutableBoolean isHomeStackVisible = new MutableBoolean(true);
long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
if (!launchState.launchedWithAltTab) {
// Has the user tapped quickly?
boolean isQuickTap = ViewConfiguration.getDoubleTapMinTime() < elapsedTime && elapsedTime < ViewConfiguration.getDoubleTapTimeout();
if (Recents.getConfiguration().isGridEnabled) {
if (isQuickTap) {
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
} else {
EventBus.getDefault().post(new LaunchMostRecentTaskRequestEvent());
}
} else {
if (!debugFlags.isPagingEnabled() || isQuickTap) {
// Launch the next focused task
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
} else {
// Notify recents to move onto the next task
EventBus.getDefault().post(new IterateRecentsEvent());
}
}
} else {
// account
if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
return;
}
EventBus.getDefault().post(new ToggleRecentsEvent());
mLastToggleTime = SystemClock.elapsedRealtime();
}
return;
} else {
// account
if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
return;
}
// Otherwise, start the recents activity
ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
startRecentsActivity(runningTask, isHomeStackVisible.value, true, /* animate */
growTarget);
// Only close the other system windows if we are actually showing recents
ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
mLastToggleTime = SystemClock.elapsedRealtime();
}
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Failed to launch RecentsActivity", e);
}
}
use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project android_frameworks_base by AOSPA.
the class TaskStackView method onMeasure.
/**
* This is called with the full window width and height to allow stack view children to
* perform the full screen transition down.
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mInMeasureLayout = true;
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
// Update the stable stack bounds, but only update the current stack bounds if the stable
// bounds have changed. This is because we may get spurious measures while dragging where
// our current stack bounds reflect the target drop region.
mLayoutAlgorithm.getTaskStackBounds(mDisplayRect, new Rect(0, 0, width, height), mLayoutAlgorithm.mSystemInsets.top, mLayoutAlgorithm.mSystemInsets.left, mLayoutAlgorithm.mSystemInsets.right, mTmpRect);
if (!mTmpRect.equals(mStableStackBounds)) {
mStableStackBounds.set(mTmpRect);
mStackBounds.set(mTmpRect);
mStableWindowRect.set(0, 0, width, height);
mWindowRect.set(0, 0, width, height);
}
// Compute the rects in the stack algorithm
mStableLayoutAlgorithm.initialize(mDisplayRect, mStableWindowRect, mStableStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
mLayoutAlgorithm.initialize(mDisplayRect, mWindowRect, mStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
updateLayoutAlgorithm(false);
// If this is the first layout, then scroll to the front of the stack, then update the
// TaskViews with the stack so that we can lay them out
boolean resetToInitialState = (width != mLastWidth || height != mLastHeight) && mResetToInitialStateWhenResized;
if (mAwaitingFirstLayout || mInitialState != INITIAL_STATE_UPDATE_NONE || resetToInitialState) {
if (mInitialState != INITIAL_STATE_UPDATE_LAYOUT_ONLY || resetToInitialState) {
updateToInitialState();
mResetToInitialStateWhenResized = false;
}
if (!mAwaitingFirstLayout) {
mInitialState = INITIAL_STATE_UPDATE_NONE;
}
}
// initial state has been updated
if (mLaunchNextAfterFirstMeasure) {
mLaunchNextAfterFirstMeasure = false;
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
}
// Rebind all the views, including the ignore ones
bindVisibleTaskViews(mStackScroller.getStackScroll(), false);
// Measure each of the TaskViews
mTmpTaskViews.clear();
mTmpTaskViews.addAll(getTaskViews());
mTmpTaskViews.addAll(mViewPool.getViews());
int taskViewCount = mTmpTaskViews.size();
for (int i = 0; i < taskViewCount; i++) {
measureTaskView(mTmpTaskViews.get(i));
}
if (mTaskViewFocusFrame != null) {
mTaskViewFocusFrame.measure();
}
setMeasuredDimension(width, height);
mLastWidth = width;
mLastHeight = height;
mInMeasureLayout = false;
}
use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project android_frameworks_base by ResurrectionRemix.
the class TaskStackView method onMeasure.
/**
* This is called with the full window width and height to allow stack view children to
* perform the full screen transition down.
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mInMeasureLayout = true;
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
// Update the stable stack bounds, but only update the current stack bounds if the stable
// bounds have changed. This is because we may get spurious measures while dragging where
// our current stack bounds reflect the target drop region.
mLayoutAlgorithm.getTaskStackBounds(mDisplayRect, new Rect(0, 0, width, height), mLayoutAlgorithm.mSystemInsets.top, mLayoutAlgorithm.mSystemInsets.left, mLayoutAlgorithm.mSystemInsets.right, mTmpRect);
if (!mTmpRect.equals(mStableStackBounds)) {
mStableStackBounds.set(mTmpRect);
mStackBounds.set(mTmpRect);
mStableWindowRect.set(0, 0, width, height);
mWindowRect.set(0, 0, width, height);
}
// Compute the rects in the stack algorithm
mStableLayoutAlgorithm.initialize(mDisplayRect, mStableWindowRect, mStableStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
mLayoutAlgorithm.initialize(mDisplayRect, mWindowRect, mStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
updateLayoutAlgorithm(false);
// If this is the first layout, then scroll to the front of the stack, then update the
// TaskViews with the stack so that we can lay them out
boolean resetToInitialState = (width != mLastWidth || height != mLastHeight) && mResetToInitialStateWhenResized;
if (mAwaitingFirstLayout || mInitialState != INITIAL_STATE_UPDATE_NONE || resetToInitialState) {
if (mInitialState != INITIAL_STATE_UPDATE_LAYOUT_ONLY || resetToInitialState) {
updateToInitialState();
mResetToInitialStateWhenResized = false;
}
if (!mAwaitingFirstLayout) {
mInitialState = INITIAL_STATE_UPDATE_NONE;
}
}
// initial state has been updated
if (mLaunchNextAfterFirstMeasure) {
mLaunchNextAfterFirstMeasure = false;
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
}
// Rebind all the views, including the ignore ones
bindVisibleTaskViews(mStackScroller.getStackScroll(), false);
// Measure each of the TaskViews
mTmpTaskViews.clear();
mTmpTaskViews.addAll(getTaskViews());
mTmpTaskViews.addAll(mViewPool.getViews());
int taskViewCount = mTmpTaskViews.size();
for (int i = 0; i < taskViewCount; i++) {
measureTaskView(mTmpTaskViews.get(i));
}
if (mTaskViewFocusFrame != null) {
mTaskViewFocusFrame.measure();
}
setMeasuredDimension(width, height);
mLastWidth = width;
mLastHeight = height;
mInMeasureLayout = false;
}
use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project android_frameworks_base by ResurrectionRemix.
the class RecentsImpl method toggleRecents.
public void toggleRecents(int growTarget) {
// Skip this toggle if we are already waiting to trigger recents via alt-tab
if (mFastAltTabTrigger.isDozing()) {
return;
}
mDraggingInRecents = false;
mLaunchedWhileDocking = false;
mTriggeredFromAltTab = false;
try {
SystemServicesProxy ssp = Recents.getSystemServices();
MutableBoolean isHomeStackVisible = new MutableBoolean(true);
long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
if (!launchState.launchedWithAltTab) {
// Has the user tapped quickly?
boolean isQuickTap = ViewConfiguration.getDoubleTapMinTime() < elapsedTime && elapsedTime < ViewConfiguration.getDoubleTapTimeout();
if (Recents.getConfiguration().isGridEnabled()) {
if (isQuickTap) {
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
} else {
EventBus.getDefault().post(new LaunchMostRecentTaskRequestEvent());
}
} else {
if (!debugFlags.isPagingEnabled() || isQuickTap) {
// Launch the next focused task
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
} else {
// Notify recents to move onto the next task
EventBus.getDefault().post(new IterateRecentsEvent());
}
}
} else {
// account
if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
return;
}
EventBus.getDefault().post(new ToggleRecentsEvent());
mLastToggleTime = SystemClock.elapsedRealtime();
}
return;
} else {
// account
if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
return;
}
// Otherwise, start the recents activity
ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
startRecentsActivity(runningTask, isHomeStackVisible.value, true, /* animate */
growTarget);
// Only close the other system windows if we are actually showing recents
ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
mLastToggleTime = SystemClock.elapsedRealtime();
}
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Failed to launch RecentsActivity", e);
}
}
use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project android_frameworks_base by DirtyUnicorns.
the class TaskStackView method onMeasure.
/**
* This is called with the full window width and height to allow stack view children to
* perform the full screen transition down.
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mInMeasureLayout = true;
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
// Update the stable stack bounds, but only update the current stack bounds if the stable
// bounds have changed. This is because we may get spurious measures while dragging where
// our current stack bounds reflect the target drop region.
mLayoutAlgorithm.getTaskStackBounds(mDisplayRect, new Rect(0, 0, width, height), mLayoutAlgorithm.mSystemInsets.top, mLayoutAlgorithm.mSystemInsets.left, mLayoutAlgorithm.mSystemInsets.right, mTmpRect);
if (!mTmpRect.equals(mStableStackBounds)) {
mStableStackBounds.set(mTmpRect);
mStackBounds.set(mTmpRect);
mStableWindowRect.set(0, 0, width, height);
mWindowRect.set(0, 0, width, height);
}
// Compute the rects in the stack algorithm
mStableLayoutAlgorithm.initialize(mDisplayRect, mStableWindowRect, mStableStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
mLayoutAlgorithm.initialize(mDisplayRect, mWindowRect, mStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
updateLayoutAlgorithm(false);
// If this is the first layout, then scroll to the front of the stack, then update the
// TaskViews with the stack so that we can lay them out
boolean resetToInitialState = (width != mLastWidth || height != mLastHeight) && mResetToInitialStateWhenResized;
if (mAwaitingFirstLayout || mInitialState != INITIAL_STATE_UPDATE_NONE || resetToInitialState) {
if (mInitialState != INITIAL_STATE_UPDATE_LAYOUT_ONLY || resetToInitialState) {
updateToInitialState();
mResetToInitialStateWhenResized = false;
}
if (!mAwaitingFirstLayout) {
mInitialState = INITIAL_STATE_UPDATE_NONE;
}
}
// initial state has been updated
if (mLaunchNextAfterFirstMeasure) {
mLaunchNextAfterFirstMeasure = false;
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
}
// Rebind all the views, including the ignore ones
bindVisibleTaskViews(mStackScroller.getStackScroll(), false);
// Measure each of the TaskViews
mTmpTaskViews.clear();
mTmpTaskViews.addAll(getTaskViews());
mTmpTaskViews.addAll(mViewPool.getViews());
int taskViewCount = mTmpTaskViews.size();
for (int i = 0; i < taskViewCount; i++) {
measureTaskView(mTmpTaskViews.get(i));
}
if (mTaskViewFocusFrame != null) {
mTaskViewFocusFrame.measure();
}
setMeasuredDimension(width, height);
mLastWidth = width;
mLastHeight = height;
mInMeasureLayout = false;
}
Aggregations