热启动优化-Launcher动画优化

现状:apk热启动比对比机差

经过高速相机拍摄的图片发现apk启动的动画不一致。

有两种优化方向:

1修改动画的显示方式-暂时没有跟进

2.修改动画的速度,但是涉及到所有动画,感觉有风险比较大。

今天咨询了framework的同事,修改了Activity_open的动画

分析如下:

Hot start analysis:

From systrace:

1.dailer warm start:from deliverInputEvent to second doFrame 306ms

2.Launcher from deliverInputEvent to animator finish :507(animator 443ms)

So dailer warm start is about 507ms

Cold start analysis

1.dailer cold start:from deliverInputEvent to second doFrame 815ms

2.Launcher from deliverInputEvent to animator finish :557ms(animator 434ms)

So dailer cold start is about 815ms

apk hot start

306ms

Launcher Animation

507ms

apk cold start

815ms

apk hot start < Launcher Animation < apk cold start

summary

The animation and apk launch are parallel.

apk hot start. The hot start is completed and the animation is not yet completed. After the animation is completed, the hot start stops timing, so the time of the hot start is affected by the animation time.

apk cold start. The animation is complete and the cold start is not yet complete. After the cold start is completed, the cold start stops timing, so the cold start is not affected by the animation.


以上是某项目的分析,可以看到受到Launcher的动画影响,apk的热启动变慢了。

修改文件:Activity_open_enter.xml Activity_open_exit.xml 这两个文件是Launcher的apk启动的动画。修改duration=400.修改为200

从systrace看到动画的时间从430ms变为350ms,不同的apk优化的时间不同。

增加一种修改方法,在Launcher中直接修改动画参数:

packages/apps/Launcher3/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java

private void composeIconLaunchAnimator(…)
anim.play(windowAnimator);

此动画可以客制化时间:

例如:

private static final long APP_LAUNCH_DURATION = 500;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值