Reimplement QuickSwitch compat libs (#4084)

* Reimplement makeDefaultActivityOptions

* No need to post again

* Cleanups

* Tweak LawnchairQuickstepCompat

* Let compatLibVR depend on compatLibVQ

* Let compatLibVS depend on compatLibVR

* Cleanup compatLibVT

* Let compatLibVU depend on compatLibVT

* Add ActivityManagerCompatVS.getRunningTasks back

* Fix ActivityManagerCompatVS

* Don't return null running tasks

* Annotate getTaskSnapshot

* Fix style

* Retrun list from getRunningTasks

* Tweaks

* Cleanups

* null check

* Add ActivityManagerCompatVS.invalidateHomeTaskSnapshot back

* Move ThumbnailData

* Fixed err

* Cleanup

* Add RequiresApi

* Make RemoteTransitionCompat as an interface

* Annotate ActivityOptionsCompat

* More interfaces

* Replace aidl files with generated sources

* Reformat

* Revert "Replace aidl files with generated sources"

This reverts commit ee450e696d93bce5361224710d225b13c5a3127a.

Revert "Reformat"

This reverts commit 38c8f21ed3cd016e5bf58973483555bd44b3ef18.

* Use launcherNullable

* Fixes more crashes

---------

Co-authored-by: MrSluffy <werdna.jac@gmail.com>
This commit is contained in:
Zongle Wang
2024-03-10 11:24:14 +08:00
committed by GitHub
parent 0ca884dc25
commit bfb4ddfa48
34 changed files with 377 additions and 476 deletions
@@ -1049,14 +1049,11 @@ public class QuickstepLauncher extends Launcher {
@Override
public ActivityOptionsWrapper makeDefaultActivityOptions(int splashScreenStyle) {
RunnableList callbacks = new RunnableList();
ActivityOptions options = LawnchairQuickstepCompat.ATLEAST_R ? ActivityOptions.makeCustomAnimation(
this, 0, 0, Color.TRANSPARENT,
Executors.MAIN_EXECUTOR.getHandler(), null,
elapsedRealTime -> callbacks.executeAllAndDestroy()) : ActivityOptions.makeBasic();
if (LawnchairQuickstepCompat.ATLEAST_T) {
options.setSplashScreenStyle(splashScreenStyle);
}
Utilities.allowBGLaunch(options);
ActivityOptions options = ActivityOptions.makeCustomAnimation(
this, 0, 0, Color.TRANSPARENT,
Executors.MAIN_EXECUTOR.getHandler(), null,
elapsedRealTime -> callbacks.executeAllAndDestroy());
options.setSplashScreenStyle(splashScreenStyle);
return new ActivityOptionsWrapper(options, callbacks);
}
@@ -252,7 +252,7 @@ public class TopTaskTracker extends ISplitScreenListener.Stub implements TaskSta
return null;
}
List<RunningTaskInfo> visibleNonExcludedTasks = mAllCachedTasks.stream()
.filter(t -> t.isVisible
.filter(t -> (t.isVisible && LawnchairQuickstepCompat.ATLEAST_S)
&& (t.baseIntent.getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) == 0)
.collect(Collectors.toList());
return visibleNonExcludedTasks.isEmpty() ? null
@@ -973,16 +973,10 @@ public class TaskView extends FrameLayout implements Reusable {
*/
private ActivityOptions makeCustomAnimation(Context context, int enterResId,
int exitResId, final Runnable callback, final Handler callbackHandler) {
if (!LawnchairQuickstepCompat.ATLEAST_T) {
return LawnchairQuickstepCompat.getActivityOptionsCompat().makeCustomAnimation(context, enterResId, exitResId, callback, callbackHandler);
if (Utilities.ATLEAST_Q) {
return LawnchairQuickstepCompat.getActivityOptionsCompat().makeCustomAnimation(context, enterResId, exitResId, callbackHandler, callback, null);
}
return ActivityOptions.makeCustomTaskAnimation(context, enterResId, exitResId,
callbackHandler,
elapsedRealTime -> {
if (callback != null) {
callbackHandler.post(callback);
}
}, null /* finishedListener */);
return ActivityOptions.makeBasic();
}
/**