Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/upstream' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Feb 9, 2024
2 parents 28eaa08 + 0fcab6a commit 0d9d300
Show file tree
Hide file tree
Showing 10 changed files with 472 additions and 389 deletions.
14 changes: 2 additions & 12 deletions lawnchair/src/app/lawnchair/search/LawnchairAppSearchAlgorithm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class LawnchairAppSearchAlgorithm(context: Context) : LawnchairSearchAlgorithm(c
return apps.asSequence()
.filter { StringMatcherUtility.matches(queryTextLower, it.title.toString(), matcher) }
.filterHiddenApps(queryTextLower)
.sortedWith(queryComparator(queryTextLower))
.take(maxResultsCount)
.toList()
}
Expand All @@ -183,18 +182,16 @@ class LawnchairAppSearchAlgorithm(context: Context) : LawnchairSearchAlgorithm(c
val filteredApps = apps.asSequence()
.filterHiddenApps(queryTextLower)
.toList()
val matches = FuzzySearch.extractTop(
val matches = FuzzySearch.extractSorted(
queryTextLower,
filteredApps,
{ it.sectionName + it.title },
WeightedRatio(),
65,
)

return matches
return matches.take(maxResultsCount)
.map { it.referent }
.sortedWith(queryComparator(queryTextLower))
.take(maxResultsCount)
}

private fun Sequence<AppInfo>.filterHiddenApps(query: String): Sequence<AppInfo> {
Expand All @@ -209,11 +206,4 @@ class LawnchairAppSearchAlgorithm(context: Context) : LawnchairSearchAlgorithm(c
filter { it.toComponentKey().toString() !in hiddenApps }
}
}

private fun queryComparator(query: String): Comparator<AppInfo> {
return compareBy(
{ it.title.toString().startsWith(query, true).not() },
{ it.title.toString() },
)
}
}
20 changes: 10 additions & 10 deletions quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ public ActivityOptionsWrapper getActivityLaunchOptions(View v) {
boolean fromRecents = isLaunchingFromRecents(v, null /* targets */);
RunnableList onEndCallback = new RunnableList();

// Handle the case where an already visible task is launched which results in no
// transition
TaskRestartedDuringLaunchListener restartedListener = new TaskRestartedDuringLaunchListener();
// Handle the case where an already visible task is launched which results in no transition
TaskRestartedDuringLaunchListener restartedListener =
new TaskRestartedDuringLaunchListener();
restartedListener.register(onEndCallback::executeAllAndDestroy);
onEndCallback.add(restartedListener::unregister);

Expand Down Expand Up @@ -1250,7 +1250,8 @@ private boolean shouldPlayFallbackClosingAnimation(RemoteAnimationTarget[] targe
for (RemoteAnimationTarget target : targets) {
if (target.mode == MODE_CLOSING) {
numTargets++;
if (numTargets > 1 || target.windowConfiguration.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW) {
if (numTargets > 1 || target.windowConfiguration.getWindowingMode()
== WINDOWING_MODE_MULTI_WINDOW) {
return true;
}
}
Expand Down Expand Up @@ -1635,11 +1636,11 @@ public Pair<RectFSpringAnim, AnimatorSet> createWallpaperOpenAnimations(
final boolean launcherIsForceInvisibleOrOpening = mLauncher.isForceInvisible()
|| launcherIsATargetWithMode(appTargets, MODE_OPENING);

View launcherView = findLauncherView(appTargets);
boolean playFallBackAnimation = (launcherView == null
&& launcherIsForceInvisibleOrOpening)
|| mLauncher.getWorkspace().isOverlayShown()
|| shouldPlayFallbackClosingAnimation(appTargets);
View launcherView = findLauncherView(appTargets);
boolean playFallBackAnimation = (launcherView == null
&& launcherIsForceInvisibleOrOpening)
|| mLauncher.getWorkspace().isOverlayShown()
|| shouldPlayFallbackClosingAnimation(appTargets);

boolean playWorkspaceReveal = true;
boolean skipAllAppsScale = false;
Expand Down Expand Up @@ -2094,7 +2095,6 @@ private static class LaunchDepthController extends DepthController {
setCrossWindowBlursEnabled(
CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
}

// Make sure that the starting value matches the current depth set by the main
// controller.
stateDepth.setValue(launcher.getDepthController().stateDepth.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,7 @@ private void onComputeInsetsForSeparateWindow(ViewTreeObserver.InternalInsetsInf
}

/**
* Called whenever a new ui controller is set, and should update anything that
* depends on the
* Called whenever a new ui controller is set, and should update anything that depends on the
* ui controller.
*/
public void onUiControllerChanged() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,22 @@ public void onStateTransitionStart(LauncherState toState) {
}
}

@Override
public void onStateTransitionComplete(LauncherState finalState) {
mLauncherState = finalState;
updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false);
// TODO(b/279514548) Cleans up bad state that can occur when user interacts with
// taskbar on top of transparent activity.
if (finalState == LauncherState.NORMAL && mLauncher.hasBeenResumed()) {
updateStateForFlag(FLAG_RESUMED, true);
}
applyState();
boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT;
com.android.launcher3.taskbar.Utilities.setOverviewDragState(
mControllers, finalState.disallowTaskbarGlobalDrag(),
disallowLongClick, finalState.allowTaskbarInitialSplitSelection());
}
};
@Override
public void onStateTransitionComplete(LauncherState finalState) {
mLauncherState = finalState;
updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false);
// TODO(b/279514548) Cleans up bad state that can occur when user interacts with
// taskbar on top of transparent activity.
if (finalState == LauncherState.NORMAL && mLauncher.isResumed()) {
updateStateForFlag(FLAG_RESUMED, true);
}
applyState();
boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT;
com.android.launcher3.taskbar.Utilities.setOverviewDragState(
mControllers, finalState.disallowTaskbarGlobalDrag(),
disallowLongClick, finalState.allowTaskbarInitialSplitSelection());
}
};

/**
* Initializes the controller instance, and applies the initial state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,13 @@ public void onConfigurationChanged(Configuration newConfig) {

@Override
public RunnableList startActivitySafely(View v, Intent intent, ItemInfo item) {
// Only pause is taskbar controller is not present until the transition (if it
// exists) ends
// Only pause is taskbar controller is not present until the transition (if it exists) ends
mHotseatPredictionController.setPauseUIUpdate(getTaskbarUIController() == null);
RunnableList result = super.startActivitySafely(v, intent, item);
if (result == null) {
mHotseatPredictionController.setPauseUIUpdate(false);
if (getTaskbarUIController() == null) {
mHotseatPredictionController.setPauseUIUpdate(false);
}
} else {
result.add(() -> mHotseatPredictionController.setPauseUIUpdate(false));
}
Expand Down Expand Up @@ -450,7 +451,10 @@ public void bindWorkspaceComponentsRemoved(Predicate<ItemInfo> matcher) {
public void onDestroy() {
mAppTransitionManager.onActivityDestroyed();
if (mUnfoldTransitionProgressProvider != null) {
SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null);
if (FeatureFlags.RECEIVE_UNFOLD_EVENTS_FROM_SYSUI.get()) {
SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null);
}

mUnfoldTransitionProgressProvider.destroy();
}
mTISBindHelper.onDestroy();
Expand Down Expand Up @@ -1326,4 +1330,4 @@ public View onCreateView(View parent, String name, Context context, AttributeSet
}
return super.onCreateView(parent, name, context, attrs);
}
}
}
6 changes: 2 additions & 4 deletions quickstep/src/com/android/quickstep/TaskAnimationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,9 @@ public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets) {
// The only time we get onTasksAppeared() in button navigation with a
// 3p launcher is if the user goes to overview first, and in this case we
// can immediately finish the transition
RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel();
RecentsView recentsView =
activityInterface.getCreatedActivity().getOverviewPanel();
if (recentsView != null) {
Log.d(TestProtocol.INCORRECT_HOME_STATE,
"finish recents animation on "
+ compat.taskInfo.description);
recentsView.finishRecentsAnimation(true, null);
}
return;
Expand Down
6 changes: 4 additions & 2 deletions quickstep/src/com/android/quickstep/TaskViewUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,13 @@ public void onAnimationEnd(Animator animation) {
}
}
if (taskId == initialTaskId) {
splitRoot1 = change.getParent() == null ? change : transitionInfo.getChange(change.getParent());
splitRoot1 = change.getParent() == null ? change :
transitionInfo.getChange(change.getParent());
openingTargets.add(splitRoot1.getLeash());
}
if (taskId == secondTaskId) {
splitRoot2 = change.getParent() == null ? change : transitionInfo.getChange(change.getParent());
splitRoot2 = change.getParent() == null ? change :
transitionInfo.getChange(change.getParent());
openingTargets.add(splitRoot2.getLeash());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import android.util.FloatProperty;
import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
Expand Down Expand Up @@ -302,9 +301,8 @@ protected void onFinishInflate() {
0,
0 // Bottom left
};
final TypedValue value = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, value, true);
mBottomSheetBackgroundColor = value.data;
mBottomSheetBackgroundColor =
Themes.getAttrColor(getContext(), R.attr.materialColorSurfaceDim);
updateBackgroundVisibility(mActivityContext.getDeviceProfile());
mSearchUiManager.initializeSearch(this);
}
Expand Down
Loading

0 comments on commit 0d9d300

Please sign in to comment.