Android U 多任务启动分屏——整体流程介绍

2024-08-29 16:44

本文主要是介绍Android U 多任务启动分屏——整体流程介绍,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

原生的分屏功能是在多任务中,点击应用图标选择分屏,在选择多任务中的其他应用进行分屏
在这里插入图片描述

整体流程

层级结构

#1 DefaultTaskDisplayArea type=undefined mode=fullscreen override-mode=fullscreen requested-bounds=[0,0][0,0] bounds=[0,0][1440,2960]#1 Task=3 type=standard mode=fullscreen override-mode=fullscreen requested-bounds=[0,0][0,0] bounds=[0,0][1440,2960]#1 Task=4 type=standard mode=multi-window override-mode=multi-window requested-bounds=[0,1498][1440,2960] bounds=[0,1498][1440,2960]#0 Task=55 type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,1498][1440,2960]#0 ActivityRecord{c8a85d8 u0 com.android.dialer/.main.impl.MainActivity t55} type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,1498][1440,2960]#0 17b29c2 com.android.dialer/com.android.dialer.main.impl.MainActivity type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,1498][1440,2960]#0 Task=5 type=standard mode=multi-window override-mode=multi-window requested-bounds=[0,0][1440,1463] bounds=[0,0][1440,1463]#0 Task=61 type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1440,1463]#0 ActivityRecord{a029103 u0 com.android.messaging/.ui.conversationlist.ConversationListActivity t61} type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1440,1463]#0 d3dd038 com.android.messaging/com.android.messaging.ui.conversationlist.ConversationListActivity type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1440,1463]

对应如下树状图
在这里插入图片描述

各模块责任与堆栈

Launcher

1.确定分屏上部分,做好相关显示动画,等待选择下分屏

Launcher: 	at com.android.quickstep.views.RecentsView.createInitialSplitSelectAnimation(RecentsView.java:3196)
Launcher: 	at com.android.quickstep.views.RecentsView.createTaskDismissAnimation(RecentsView.java:3493)
Launcher: 	at com.android.quickstep.views.RecentsView.createSplitSelectInitAnimation(RecentsView.java:4636)
Launcher: 	at com.android.launcher3.uioverrides.RecentsViewStateController.handleSplitSelectionState(RecentsViewStateController.java:139)
Launcher: 	at com.android.launcher3.uioverrides.RecentsViewStateController.setStateWithAnimationInternal(RecentsViewStateController.java:109)
Launcher: 	at com.android.launcher3.uioverrides.BaseRecentsViewStateController.setStateWithAnimation(BaseRecentsViewStateController.java:91)
Launcher: 	at com.android.launcher3.uioverrides.BaseRecentsViewStateController.setStateWithAnimation(BaseRecentsViewStateController.java:61)
Launcher: 	at com.android.launcher3.statemanager.StateManager.createAnimationToNewWorkspaceInternal(StateManager.java:350)
Launcher: 	at com.android.launcher3.statemanager.StateManager.goToStateAnimated(StateManager.java:285)
Launcher: 	at com.android.launcher3.statemanager.StateManager.goToState(StateManager.java:273)
Launcher: 	at com.android.launcher3.statemanager.StateManager.goToState(StateManager.java:152)
Launcher: 	at com.android.launcher3.statemanager.StateManager.goToState(StateManager.java:145)
Launcher: 	at com.android.quickstep.views.LauncherRecentsView.initiateSplitSelect(LauncherRecentsView.java:210)
Launcher: 	at com.android.quickstep.views.TaskView.initiateSplitSelect(TaskView.java:1767)
Launcher: 	at com.android.quickstep.TaskShortcutFactory$SplitSelectSystemShortcut.onClick(TaskShortcutFactory.java:124)
Launcher: 	at com.android.quickstep.views.TaskMenuView$$ExternalSyntheticLambda3.onClick(Unknown Source:2)
Launcher: 	at android.view.View.performClick(View.java:7659)
Launcher: 	at android.view.View.performClickInternal(View.java:7636)
Launcher: 	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
Launcher: 	at android.view.View$PerformClick.run(View.java:30156)
Launcher: 	at android.os.Handler.handleCallback(Handler.java:958)
Launcher: 	at android.os.Handler.dispatchMessage(Handler.java:99)
Launcher: 	at android.os.Looper.loopOnce(Looper.java:205)
Launcher: 	at android.os.Looper.loop(Looper.java:294)
Launcher: 	at android.app.ActivityThread.main(ActivityThread.java:8177)
Launcher: 	at java.lang.reflect.Method.invoke(Native Method)
Launcher: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
Launcher: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

2.确定选择下分屏,播放相关动画,调用SytemUI接口进入到真正分屏

Launcher: 	at com.android.quickstep.views.RecentsView.confirmSplitSelect(RecentsView.java:4716)
Launcher: 	at com.android.quickstep.views.TaskView.confirmSecondSplitSelectApp(TaskView.java:762)
Launcher: 	at com.android.quickstep.views.TaskView.onClick(TaskView.java:746)
Launcher: 	at com.android.quickstep.views.TaskView.$r8$lambda$2dErZAYzRAWboZR0vn31kIz_HGY(Unknown Source:0)
Launcher: 	at com.android.quickstep.views.TaskView$$ExternalSyntheticLambda2.onClick(Unknown Source:2)
Launcher: 	at android.view.View.performClick(View.java:7659)
Launcher: 	at android.view.View.performClickInternal(View.java:7636)
Launcher: 	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
Launcher: 	at android.view.View$PerformClick.run(View.java:30156)
Launcher: 	at android.os.Handler.handleCallback(Handler.java:958)
Launcher: 	at android.os.Handler.dispatchMessage(Handler.java:99)
Launcher: 	at android.os.Looper.loopOnce(Looper.java:205)
Launcher: 	at android.os.Looper.loop(Looper.java:294)
Launcher: 	at android.app.ActivityThread.main(ActivityThread.java:8177)
Launcher: 	at java.lang.reflect.Method.invoke(Native Method)
Launcher: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
Launcher: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
pendingAnimation.addEndListener(aBoolean -> {mSplitSelectStateController.launchSplitTasks(aBoolean1 -> RecentsView.this.resetFromSplitSelectionState());InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER);});
Launcher: 	at com.android.quickstep.util.SplitSelectStateController.launchTasksRefactored(SplitSelectStateController.java:412)
Launcher: 	at com.android.quickstep.util.SplitSelectStateController.launchTasks(SplitSelectStateController.java:329)
Launcher: 	at com.android.quickstep.util.SplitSelectStateController.launchSplitTasks(SplitSelectStateController.java:258)
Launcher: 	at com.android.quickstep.views.RecentsView.lambda$confirmSplitSelect$34(RecentsView.java:4718)
Launcher: 	at com.android.quickstep.views.RecentsView.$r8$lambda$uSHMT-0i9azkpL6YW9McOOFyjVQ(Unknown Source:0)
Launcher: 	at com.android.quickstep.views.RecentsView$$ExternalSyntheticLambda26.accept(Unknown Source:4)
Launcher: 	at com.android.launcher3.anim.AnimatorListeners$EndStateCallbackWrapper.onAnimationEnd(AnimatorListeners.java:80)
Launcher: 	at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:711)
Launcher: 	at android.animation.Animator$AnimatorCaller$$ExternalSyntheticLambda1.call(Unknown Source:4)
Launcher: 	at android.animation.Animator.callOnList(Animator.java:669)
Launcher: 	at android.animation.Animator.notifyListeners(Animator.java:608)
Launcher: 	at android.animation.Animator.notifyEndListeners(Animator.java:633)
Launcher: 	at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1306)
Launcher: 	at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1566)
Launcher: 	at android.animation.ValueAnimator.pulseAnimationFrame(ValueAnimator.java:1582)
Launcher: 	at android.animation.AnimatorSet.pulseFrame(AnimatorSet.java:1314)
Launcher: 	at android.animation.AnimatorSet.handleAnimationEvents(AnimatorSet.java:1297)
Launcher: 	at android.animation.AnimatorSet.doAnimationFrame(AnimatorSet.java:1197)
Launcher: 	at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:328)
Launcher: 	at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
Launcher: 	at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
Launcher: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1337)
Launcher: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
Launcher: 	at android.view.Choreographer.doCallbacks(Choreographer.java:952)
Launcher: 	at android.view.Choreographer.doFrame(Choreographer.java:878)
Launcher: 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
Launcher: 	at android.os.Handler.handleCallback(Handler.java:958)
Launcher: 	at android.os.Handler.dispatchMessage(Handler.java:99)
Launcher: 	at android.os.Looper.loopOnce(Looper.java:205)
Launcher: 	at android.os.Looper.loop(Looper.java:294)
Launcher: 	at android.app.ActivityThread.main(ActivityThread.java:8177)
Launcher: 	at java.lang.reflect.Method.invoke(Native Method)
Launcher: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
Launcher: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

SystemUiProxy调用ISplitScreen.aidl进行跨进程通信到SystemUI进程
在这里插入图片描述

SytemUI

SplitScreenController实现了ISplitScreen.aidl
在这里插入图片描述

SplitScreen: 	at android.window.WindowOrganizer.startNewTransition(WindowOrganizer.java:94)
SplitScreen: 	at com.android.wm.shell.transition.Transitions.startTransition(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:1121)
SplitScreen: 	at com.android.wm.shell.splitscreen.SplitScreenTransitions.startEnterTransition(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:345)
SplitScreen: 	at com.android.wm.shell.splitscreen.StageCoordinator.startWithTask(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:701)
SplitScreen: 	at com.android.wm.shell.splitscreen.StageCoordinator.startTasks(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:623)
SplitScreen: 	at com.android.wm.shell.splitscreen.SplitScreenController$ISplitScreenImpl.lambda$startTasks$11(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:1157)
SplitScreen: 	at com.android.wm.shell.splitscreen.SplitScreenController$ISplitScreenImpl.$r8$lambda$UuHBVv3bzz4CDOdyAqlv4kaRHgY(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:0)
SplitScreen: 	at com.android.wm.shell.splitscreen.SplitScreenController$ISplitScreenImpl$$ExternalSyntheticLambda14.accept(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:0)
SplitScreen: 	at com.android.wm.shell.common.ExecutorUtils.lambda$executeRemoteCallWithTaskPermission$1(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:60)
SplitScreen: 	at com.android.wm.shell.common.ExecutorUtils.$r8$lambda$s8eUOdyrqpqzzyFwAMGxO-MaCg4(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:0)
SplitScreen: 	at com.android.wm.shell.common.ExecutorUtils$$ExternalSyntheticLambda1.run(go/retraceme d8ee0e3eecdad3cdc77c111ff5591ebe26372c47d62ba59187c5ecf96366b561:0)
SplitScreen: 	at android.os.Handler.handleCallback(Handler.java:958)
SplitScreen: 	at android.os.Handler.dispatchMessage(Handler.java:99)
SplitScreen: 	at android.os.Looper.loopOnce(Looper.java:205)
SplitScreen: 	at android.os.Looper.loop(Looper.java:294)
SplitScreen: 	at android.os.HandlerThread.run(HandlerThread.java:67)

1.对上分屏的Task进行启动

2.设置好对应的bound到configration中

3.对分屏的RootTask进行排位到最顶部

4.对下分屏的Task进行启动

对Task的操作均会保存到WindowContainerTransaction对象中,最后通过WindowOrganizer调用IWindowOrganizerController.aidl进行跨进程通信到SystemServer进程进程Task操作
在这里插入图片描述

注:SplitLayout初始化分屏的分割线的布局的流程,从代码上看,如果shell动画开关是打开的,那么该流程在1和2之间执行;反之,则会在4之后,即窗口relayout流程中通过shell动画流程调用。

SystemServer

在这里插入图片描述

WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.applyTransaction(WindowOrganizerController.java:597)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.applyTransaction(WindowOrganizerController.java:484)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.applyTransaction(WindowOrganizerController.java:502)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.lambda$startTransition$3(WindowOrganizerController.java:314)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.$r8$lambda$v_6sOG-rerjgO2wQxXrUcgpnWaU(WindowOrganizerController.java:0)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController$$ExternalSyntheticLambda3.onCollectStarted(R8$$SyntheticClass:0)
WindowOrganizerController: 	at com.android.server.wm.TransitionController.startCollectOrQueue(TransitionController.java:1306)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.startTransition(WindowOrganizerController.java:310)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.startNewTransition(WindowOrganizerController.java:271)
WindowOrganizerController: 	at android.window.IWindowOrganizerController$Stub.onTransact(IWindowOrganizerController.java:245)
WindowOrganizerController: 	at com.android.server.wm.WindowOrganizerController.onTransact(WindowOrganizerController.java:188)
WindowOrganizerController: 	at android.os.Binder.execTransactInternal(Binder.java:1344)
WindowOrganizerController: 	at android.os.Binder.execTransact(Binder.java:1275)

WindowOrganizerController实现了IWindowOrganizerController.aidl
其接收SystemUI中的命令来对Task进行不同的操作
applyTransaction中对Task区域大小bounds变化以及RootTask的reorder和startTask等操作进行了处理

交互简图

在这里插入图片描述

这篇关于Android U 多任务启动分屏——整体流程介绍的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1118409

相关文章

Python进阶之Excel基本操作介绍

《Python进阶之Excel基本操作介绍》在现实中,很多工作都需要与数据打交道,Excel作为常用的数据处理工具,一直备受人们的青睐,本文主要为大家介绍了一些Python中Excel的基本操作,希望... 目录概述写入使用 xlwt使用 XlsxWriter读取修改概述在现实中,很多工作都需要与数据打交

使用MongoDB进行数据存储的操作流程

《使用MongoDB进行数据存储的操作流程》在现代应用开发中,数据存储是一个至关重要的部分,随着数据量的增大和复杂性的增加,传统的关系型数据库有时难以应对高并发和大数据量的处理需求,MongoDB作为... 目录什么是MongoDB?MongoDB的优势使用MongoDB进行数据存储1. 安装MongoDB

java脚本使用不同版本jdk的说明介绍

《java脚本使用不同版本jdk的说明介绍》本文介绍了在Java中执行JavaScript脚本的几种方式,包括使用ScriptEngine、Nashorn和GraalVM,ScriptEngine适用... 目录Java脚本使用不同版本jdk的说明1.使用ScriptEngine执行javascript2.

SpringBoot项目启动后自动加载系统配置的多种实现方式

《SpringBoot项目启动后自动加载系统配置的多种实现方式》:本文主要介绍SpringBoot项目启动后自动加载系统配置的多种实现方式,并通过代码示例讲解的非常详细,对大家的学习或工作有一定的... 目录1. 使用 CommandLineRunner实现方式:2. 使用 ApplicationRunne

Python实现NLP的完整流程介绍

《Python实现NLP的完整流程介绍》这篇文章主要为大家详细介绍了Python实现NLP的完整流程,文中的示例代码讲解详细,具有一定的借鉴价值,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1. 编程安装和导入必要的库2. 文本数据准备3. 文本预处理3.1 小写化3.2 分词(Tokenizatio

Android数据库Room的实际使用过程总结

《Android数据库Room的实际使用过程总结》这篇文章主要给大家介绍了关于Android数据库Room的实际使用过程,详细介绍了如何创建实体类、数据访问对象(DAO)和数据库抽象类,需要的朋友可以... 目录前言一、Room的基本使用1.项目配置2.创建实体类(Entity)3.创建数据访问对象(DAO

SpringBoot使用minio进行文件管理的流程步骤

《SpringBoot使用minio进行文件管理的流程步骤》MinIO是一个高性能的对象存储系统,兼容AmazonS3API,该软件设计用于处理非结构化数据,如图片、视频、日志文件以及备份数据等,本文... 目录一、拉取minio镜像二、创建配置文件和上传文件的目录三、启动容器四、浏览器登录 minio五、

bat脚本启动git bash窗口,并执行命令方式

《bat脚本启动gitbash窗口,并执行命令方式》本文介绍了如何在Windows服务器上使用cmd启动jar包时出现乱码的问题,并提供了解决方法——使用GitBash窗口启动并设置编码,通过编写s... 目录一、简介二、使用说明2.1 start.BAT脚本2.2 参数说明2.3 效果总结一、简介某些情

Android WebView的加载超时处理方案

《AndroidWebView的加载超时处理方案》在Android开发中,WebView是一个常用的组件,用于在应用中嵌入网页,然而,当网络状况不佳或页面加载过慢时,用户可能会遇到加载超时的问题,本... 目录引言一、WebView加载超时的原因二、加载超时处理方案1. 使用Handler和Timer进行超

Nginx、Tomcat等项目部署问题以及解决流程

《Nginx、Tomcat等项目部署问题以及解决流程》本文总结了项目部署中常见的four类问题及其解决方法:Nginx未按预期显示结果、端口未开启、日志分析的重要性以及开发环境与生产环境运行结果不一致... 目录前言1. Nginx部署后未按预期显示结果1.1 查看Nginx的启动情况1.2 解决启动失败的