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

相关文章

Security OAuth2 单点登录流程

单点登录(英语:Single sign-on,缩写为 SSO),又译为单一签入,一种对于许多相互关连,但是又是各自独立的软件系统,提供访问控制的属性。当拥有这项属性时,当用户登录时,就可以获取所有系统的访问权限,不用对每个单一系统都逐一登录。这项功能通常是以轻型目录访问协议(LDAP)来实现,在服务器上会将用户信息存储到LDAP数据库中。相同的,单一注销(single sign-off)就是指

Spring Security基于数据库验证流程详解

Spring Security 校验流程图 相关解释说明(认真看哦) AbstractAuthenticationProcessingFilter 抽象类 /*** 调用 #requiresAuthentication(HttpServletRequest, HttpServletResponse) 决定是否需要进行验证操作。* 如果需要验证,则会调用 #attemptAuthentica

mybatis的整体架构

mybatis的整体架构分为三层: 1.基础支持层 该层包括:数据源模块、事务管理模块、缓存模块、Binding模块、反射模块、类型转换模块、日志模块、资源加载模块、解析器模块 2.核心处理层 该层包括:配置解析、参数映射、SQL解析、SQL执行、结果集映射、插件 3.接口层 该层包括:SqlSession 基础支持层 该层保护mybatis的基础模块,它们为核心处理层提供了良好的支撑。

性能测试介绍

性能测试是一种测试方法,旨在评估系统、应用程序或组件在现实场景中的性能表现和可靠性。它通常用于衡量系统在不同负载条件下的响应时间、吞吐量、资源利用率、稳定性和可扩展性等关键指标。 为什么要进行性能测试 通过性能测试,可以确定系统是否能够满足预期的性能要求,找出性能瓶颈和潜在的问题,并进行优化和调整。 发现性能瓶颈:性能测试可以帮助发现系统的性能瓶颈,即系统在高负载或高并发情况下可能出现的问题

水位雨量在线监测系统概述及应用介绍

在当今社会,随着科技的飞速发展,各种智能监测系统已成为保障公共安全、促进资源管理和环境保护的重要工具。其中,水位雨量在线监测系统作为自然灾害预警、水资源管理及水利工程运行的关键技术,其重要性不言而喻。 一、水位雨量在线监测系统的基本原理 水位雨量在线监测系统主要由数据采集单元、数据传输网络、数据处理中心及用户终端四大部分构成,形成了一个完整的闭环系统。 数据采集单元:这是系统的“眼睛”,

Hadoop数据压缩使用介绍

一、压缩原则 (1)运算密集型的Job,少用压缩 (2)IO密集型的Job,多用压缩 二、压缩算法比较 三、压缩位置选择 四、压缩参数配置 1)为了支持多种压缩/解压缩算法,Hadoop引入了编码/解码器 2)要在Hadoop中启用压缩,可以配置如下参数

MySQL数据库宕机,启动不起来,教你一招搞定!

作者介绍:老苏,10余年DBA工作运维经验,擅长Oracle、MySQL、PG、Mongodb数据库运维(如安装迁移,性能优化、故障应急处理等)公众号:老苏畅谈运维欢迎关注本人公众号,更多精彩与您分享。 MySQL数据库宕机,数据页损坏问题,启动不起来,该如何排查和解决,本文将为你说明具体的排查过程。 查看MySQL error日志 查看 MySQL error日志,排查哪个表(表空间

springboot3打包成war包,用tomcat8启动

1、在pom中,将打包类型改为war <packaging>war</packaging> 2、pom中排除SpringBoot内置的Tomcat容器并添加Tomcat依赖,用于编译和测试,         *依赖时一定设置 scope 为 provided (相当于 tomcat 依赖只在本地运行和测试的时候有效,         打包的时候会排除这个依赖)<scope>provided

Android实现任意版本设置默认的锁屏壁纸和桌面壁纸(两张壁纸可不一致)

客户有些需求需要设置默认壁纸和锁屏壁纸  在默认情况下 这两个壁纸是相同的  如果需要默认的锁屏壁纸和桌面壁纸不一样 需要额外修改 Android13实现 替换默认桌面壁纸: 将图片文件替换frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.*  (注意不能是bmp格式) 替换默认锁屏壁纸: 将图片资源放入vendo

内核启动时减少log的方式

内核引导选项 内核引导选项大体上可以分为两类:一类与设备无关、另一类与设备有关。与设备有关的引导选项多如牛毛,需要你自己阅读内核中的相应驱动程序源码以获取其能够接受的引导选项。比如,如果你想知道可以向 AHA1542 SCSI 驱动程序传递哪些引导选项,那么就查看 drivers/scsi/aha1542.c 文件,一般在前面 100 行注释里就可以找到所接受的引导选项说明。大多数选项是通过"_