update:2021.03.19

fix:重新提交
add:
This commit is contained in:
FHT
2021-03-19 18:14:04 +08:00
parent 23e93b0e31
commit d4399ffa61
1189 changed files with 0 additions and 149104 deletions

View File

@@ -1,94 +0,0 @@
package com.android.uiuios;
import static com.android.uiuios.Utilities.postAsyncCallback;
import static com.android.uiuios.anim.Interpolators.AGGRESSIVE_EASE;
import static com.android.uiuios.anim.Interpolators.LINEAR;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.quickstep.views.IconRecentsView.CONTENT_ALPHA;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Handler;
import android.view.View;
import com.android.quickstep.views.IconRecentsView;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
/**
* A {@link QuickstepAppTransitionManagerImpl} with recents-specific app transitions based off
* {@link com.android.quickstep.views.IconRecentsView}.
*/
public final class GoLauncherAppTransitionManagerImpl extends QuickstepAppTransitionManagerImpl {
public GoLauncherAppTransitionManagerImpl(Context context) {
super(context);
}
@Override
protected boolean isLaunchingFromRecents(View v, RemoteAnimationTargetCompat[] targets) {
return mLauncher.getStateManager().getState().overviewUi;
}
@Override
RemoteAnimationRunnerCompat getWallpaperOpenRunner(boolean fromUnlock) {
return new GoWallpaperOpenLauncherAnimationRunner(mHandler,
false /* startAtFrontOfQueue */, fromUnlock);
}
@Override
protected void composeRecentsLaunchAnimator(AnimatorSet anim, View v,
RemoteAnimationTargetCompat[] targets, boolean launcherClosing) {
// Stubbed. Recents launch animation will come from the recents view itself and will not
// use remote animations.
}
@Override
protected Runnable composeViewContentAnimator(AnimatorSet anim, float[] alphas, float[] trans) {
IconRecentsView overview = mLauncher.getOverviewPanel();
ObjectAnimator alpha = ObjectAnimator.ofFloat(overview,
CONTENT_ALPHA, alphas);
alpha.setDuration(CONTENT_ALPHA_DURATION);
alpha.setInterpolator(LINEAR);
anim.play(alpha);
ObjectAnimator transY = ObjectAnimator.ofFloat(overview, View.TRANSLATION_Y, trans);
transY.setInterpolator(AGGRESSIVE_EASE);
transY.setDuration(CONTENT_TRANSLATION_DURATION);
anim.play(transY);
return mLauncher.getStateManager()::reapplyState;
}
/**
* Remote animation runner for animation from app to Launcher. For Go, when going to recents,
* we need to ensure that the recents view is ready for remote animation before starting.
*/
private final class GoWallpaperOpenLauncherAnimationRunner extends
WallpaperOpenLauncherAnimationRunner {
public GoWallpaperOpenLauncherAnimationRunner(Handler handler, boolean startAtFrontOfQueue,
boolean fromUnlock) {
super(handler, startAtFrontOfQueue, fromUnlock);
}
@Override
public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
AnimationResult result) {
boolean isGoingToRecents =
taskIsATargetWithMode(targetCompats, mLauncher.getTaskId(), MODE_OPENING)
&& (mLauncher.getStateManager().getState() == LauncherState.OVERVIEW);
if (isGoingToRecents) {
IconRecentsView recentsView = mLauncher.getOverviewPanel();
if (!recentsView.isReadyForRemoteAnim()) {
recentsView.setOnReadyForRemoteAnimCallback(() ->
postAsyncCallback(mHandler, () -> onCreateAnimation(targetCompats, result))
);
return;
}
}
super.onCreateAnimation(targetCompats, result);
}
}
}

View File

@@ -1,38 +0,0 @@
/*
* Copyright (C) 2019 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.uiuios;
import static com.android.uiuios.LauncherState.NORMAL;
import com.android.quickstep.RecentsToActivityHelper;
/**
* {@link RecentsToActivityHelper} for when the recents implementation is contained in
* {@link Launcher}.
*/
public final class LauncherRecentsToActivityHelper implements RecentsToActivityHelper {
private final Launcher mLauncher;
public LauncherRecentsToActivityHelper(Launcher launcher) {
mLauncher = launcher;
}
@Override
public void leaveRecents() {
mLauncher.getStateManager().goToState(NORMAL);
}
}

View File

@@ -1,94 +0,0 @@
/*
* Copyright (C) 2019 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.uiuios.uioverrides;
import com.android.uiuios.DeviceProfile;
import com.android.uiuios.Launcher;
import com.android.uiuios.LauncherStateManager.StateHandler;
import com.android.uiuios.Utilities;
import com.android.uiuios.config.FeatureFlags;
import com.android.uiuios.graphics.RotationMode;
import com.android.uiuios.uioverrides.touchcontrollers.LandscapeEdgeSwipeController;
import com.android.uiuios.uioverrides.touchcontrollers.LandscapeStatesTouchController;
import com.android.uiuios.uioverrides.touchcontrollers.PortraitStatesTouchController;
import com.android.uiuios.uioverrides.touchcontrollers.StatusBarTouchController;
import com.android.uiuios.util.TouchController;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.views.IconRecentsView;
import java.util.ArrayList;
/**
* Provides recents-related {@link UiFactory} logic and classes.
*/
public abstract class RecentsUiFactory {
public static final boolean GO_LOW_RAM_RECENTS_ENABLED = true;
public static TouchController[] createTouchControllers(Launcher launcher) {
ArrayList<TouchController> list = new ArrayList<>();
list.add(launcher.getDragController());
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
list.add(new LandscapeStatesTouchController(launcher));
list.add(new LandscapeEdgeSwipeController(launcher));
} else {
boolean allowDragToOverview = SysUINavigationMode.INSTANCE.get(launcher)
.getMode().hasGestures;
list.add(new PortraitStatesTouchController(launcher, allowDragToOverview));
}
if (FeatureFlags.PULL_DOWN_STATUS_BAR && Utilities.IS_DEBUG_DEVICE
&& !launcher.getDeviceProfile().isMultiWindowMode
&& !launcher.getDeviceProfile().isVerticalBarLayout()) {
list.add(new StatusBarTouchController(launcher));
}
return list.toArray(new TouchController[list.size()]);
}
/**
* Creates and returns the controller responsible for recents view state transitions.
*
* @param launcher the launcher activity
* @return state handler for recents
*/
public static StateHandler createRecentsViewStateController(Launcher launcher) {
return new RecentsViewStateController(launcher);
}
/**
* Clean-up logic that occurs when recents is no longer in use/visible.
*
* @param launcher the launcher activity
*/
public static void resetOverview(Launcher launcher) {
IconRecentsView recentsView = launcher.getOverviewPanel();
recentsView.setTransitionedFromApp(false);
}
/**
* Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
*
* @param launcher the launcher activity
*/
public static void onLauncherStateOrResumeChanged(Launcher launcher) {}
public static RotationMode getRotationMode(DeviceProfile dp) {
return RotationMode.NORMAL;
}
public static void clearSwipeSharedState(boolean finishAnimation) {}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2019 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.uiuios.uioverrides;
import static com.android.quickstep.views.IconRecentsView.CONTENT_ALPHA;
import android.util.FloatProperty;
import com.android.uiuios.Launcher;
import com.android.uiuios.LauncherRecentsToActivityHelper;
import com.android.quickstep.views.IconRecentsView;
import androidx.annotation.NonNull;
/**
* State handler for Go's {@link IconRecentsView}.
*/
public final class RecentsViewStateController extends
BaseRecentsViewStateController<IconRecentsView> {
public RecentsViewStateController(@NonNull Launcher launcher) {
super(launcher);
launcher.<IconRecentsView>getOverviewPanel().setRecentsToActivityHelper(
new LauncherRecentsToActivityHelper(launcher));
}
@Override
FloatProperty<IconRecentsView> getContentAlphaProperty() {
return CONTENT_ALPHA;
}
}

View File

@@ -1,158 +0,0 @@
/*
* Copyright (C) 2019 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.uiuios.uioverrides.states;
import static android.view.View.VISIBLE;
import static com.android.uiuios.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.uiuios.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.uiuios.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
import static com.android.uiuios.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
import static com.android.uiuios.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X;
import static com.android.uiuios.anim.AnimatorSetBuilder.ANIM_WORKSPACE_FADE;
import static com.android.uiuios.anim.AnimatorSetBuilder.ANIM_WORKSPACE_SCALE;
import static com.android.uiuios.anim.AnimatorSetBuilder.ANIM_WORKSPACE_TRANSLATE;
import static com.android.uiuios.anim.Interpolators.ACCEL;
import static com.android.uiuios.anim.Interpolators.DEACCEL_2;
import static com.android.uiuios.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.uiuios.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.uiuios.states.RotationHelper.REQUEST_ROTATE;
import android.view.View;
import com.android.uiuios.DeviceProfile;
import com.android.uiuios.Launcher;
import com.android.uiuios.LauncherState;
import com.android.uiuios.R;
import com.android.uiuios.anim.AnimatorSetBuilder;
import com.android.uiuios.userevent.nano.LauncherLogProto;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.views.IconRecentsView;
/**
* Definition for overview state
*/
public class OverviewState extends LauncherState {
// Scale recents takes before animating in
private static final float RECENTS_PREPARE_SCALE = 1.33f;
private static final int STATE_FLAGS = FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED
| FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;
public OverviewState(int id) {
this(id, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
}
protected OverviewState(int id, int transitionDuration, int stateFlags) {
super(id, LauncherLogProto.ContainerType.TASKSWITCHER, transitionDuration, stateFlags);
}
@Override
public ScaleAndTranslation getOverviewScaleAndTranslation(Launcher launcher) {
return new ScaleAndTranslation(1f, 0f, 0f);
}
@Override
public void onStateEnabled(Launcher launcher) {
IconRecentsView recentsView = launcher.getOverviewPanel();
recentsView.onBeginTransitionToOverview();
recentsView.setShowStatusBarForegroundScrim(true);
// Request orientation be set to unspecified, letting the system decide the best
// orientation.
launcher.getRotationHelper().setCurrentStateRequest(REQUEST_ROTATE);
}
@Override
public void onStateDisabled(Launcher launcher) {
IconRecentsView recentsView = launcher.getOverviewPanel();
recentsView.setShowStatusBarForegroundScrim(false);
}
@Override
public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
return new PageAlphaProvider(DEACCEL_2) {
@Override
public float getPageAlpha(int pageIndex) {
return 0;
}
};
}
@Override
public int getVisibleElements(Launcher launcher) {
return NONE;
}
@Override
public float getWorkspaceScrimAlpha(Launcher launcher) {
return 0.5f;
}
@Override
public String getDescription(Launcher launcher) {
return launcher.getString(R.string.accessibility_desc_recent_apps);
}
@Override
public void onBackPressed(Launcher launcher) {
// TODO: Add logic to go back to task if coming from a currently running task.
super.onBackPressed(launcher);
}
public static float getDefaultSwipeHeight(Launcher launcher) {
return getDefaultSwipeHeight(launcher.getDeviceProfile());
}
public static float getDefaultSwipeHeight(DeviceProfile dp) {
return dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx;
}
@Override
public void prepareForAtomicAnimation(Launcher launcher, LauncherState fromState,
AnimatorSetBuilder builder) {
if (fromState == NORMAL && this == OVERVIEW) {
if (SysUINavigationMode.getMode(launcher) == SysUINavigationMode.Mode.NO_BUTTON) {
builder.setInterpolator(ANIM_WORKSPACE_SCALE, ACCEL);
builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
} else {
builder.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2);
}
builder.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2);
builder.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7);
builder.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
View overview = launcher.getOverviewPanel();
if (overview.getVisibility() != VISIBLE) {
SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE);
}
}
}
public static OverviewState newBackgroundState(int id) {
return new OverviewState(id);
}
public static OverviewState newPeekState(int id) {
return new OverviewState(id);
}
public static OverviewState newSwitchState(int id) {
return new OverviewState(id);
}
}

View File

@@ -1,70 +0,0 @@
/*
* Copyright (C) 2019 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.uiuios.uioverrides.touchcontrollers;
import static com.android.uiuios.LauncherState.ALL_APPS;
import static com.android.uiuios.LauncherState.NORMAL;
import android.view.MotionEvent;
import com.android.uiuios.AbstractFloatingView;
import com.android.uiuios.Launcher;
import com.android.uiuios.LauncherState;
import com.android.uiuios.userevent.nano.LauncherLogProto;
/**
* Touch controller for landscape mode.
*/
public final class LandscapeStatesTouchController extends PortraitStatesTouchController {
public LandscapeStatesTouchController(Launcher l) {
super(l, true /* allowDragToOverview */);
}
@Override
protected boolean canInterceptTouch(MotionEvent ev) {
if (mCurrentAnimation != null) {
// If we are already animating from a previous state, we can intercept.
return true;
}
if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
return false;
}
if (mLauncher.isInState(ALL_APPS)) {
// In all-apps only listen if the container cannot scroll itself
return mLauncher.getAppsView().shouldContainerScroll(ev);
} else if (mLauncher.isInState(NORMAL)) {
return true;
} else {
return false;
}
}
@Override
protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
if (fromState == ALL_APPS && !isDragTowardPositive) {
return NORMAL;
} else if (isDragTowardPositive) {
return ALL_APPS;
}
return fromState;
}
@Override
protected int getLogContainerTypeForNormalState() {
return LauncherLogProto.ContainerType.WORKSPACE;
}
}

View File

@@ -1,65 +0,0 @@
/*
* Copyright (C) 2019 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.uiuios.uioverrides.touchcontrollers;
import android.view.MotionEvent;
import com.android.uiuios.Launcher;
import com.android.uiuios.util.PendingAnimation;
/**
* Helper class for {@link PortraitStatesTouchController} that determines swipeable regions and
* animations on the overview state that depend on the recents implementation.
*/
public final class PortraitOverviewStateTouchHelper {
public PortraitOverviewStateTouchHelper(Launcher launcher) {}
/**
* Whether or not {@link PortraitStatesTouchController} should intercept the touch when on the
* overview state.
*
* @param ev the motion event
* @return true if we should intercept the motion event
*/
boolean canInterceptTouch(MotionEvent ev) {
// Go does not support swiping to all-apps from recents.
return false;
}
/**
* Whether or not swiping down to leave overview state should return to the currently running
* task app.
*
* @return true if going back should take the user to the currently running task
*/
boolean shouldSwipeDownReturnToApp() {
// Go does not support swiping tasks down to launch tasks from recents.
return false;
}
/**
* Create the animation for going from overview to the task app via swiping.
*
* @param duration how long the animation should be
* @return the animation
*/
PendingAnimation createSwipeDownToTaskAppAnimation(long duration) {
// Go does not support swiping tasks down to launch tasks from recents.
return null;
}
}