updateConfiguration()的relaunch App流程

在这里插入代码片
切换系统语言更新Configuration
frameworks/base/core/java/com/android/internal/app/LocalePicker.java
public static void updateLocales(LocaleList locales) {try {IActivityManager am = ActivityManager.getService();Configuration config = am.getConfiguration();config.setLocales(locales);config.userSetLocale = true;am.updatePersistentConfiguration(config);BackupManager.dataChanged("com.android.providers.settings");} catch (RemoteException var3) {}}
->
IActivityTaskManager.aidl
389      /**
390       * Updates global configuration and applies changes to the entire system.
391       * @param values Update values for global configuration. If null is passed it will request the
392       *               Window Manager to compute new config for the default display.
393       * @throws RemoteException
394       * @return Returns true if the configuration was updated.
395       */
396      boolean updateConfiguration(in Configuration values);
->
ActivityTaskManagerService.java
4833      @Override
4834      public boolean updateConfiguration(Configuration values) {4835          mAmInternal.enforceCallingPermission(CHANGE_CONFIGURATION, "updateConfiguration()");
4836
4837          synchronized (mGlobalLock) {4838              if (mWindowManager == null) {4839                  Slog.w(TAG, "Skip updateConfiguration because mWindowManager isn't set");
4840                  return false;
4841              }
4842
4843              if (values == null) {4844                  // sentinel: fetch the current configuration from the window manager
4845                  values = mWindowManager.computeNewConfiguration(DEFAULT_DISPLAY);
4846              }
4847
4848              mH.sendMessage(PooledLambda.obtainMessage(
4849                      ActivityManagerInternal::updateOomLevelsForDisplay, mAmInternal,
4850                      DEFAULT_DISPLAY));
4851
4852              final long origId = Binder.clearCallingIdentity();
4853              try {4854                  if (values != null) {4855                      Settings.System.clearConfiguration(values);
4856                  }
4857                  updateConfigurationLocked(values, null, false, false /* persistent */,
4858                          UserHandle.USER_NULL, false /* deferResume */,
4859                          mTmpUpdateConfigurationResult);
4860                  return mTmpUpdateConfigurationResult.changes != 0;
4861              } finally {4862                  Binder.restoreCallingIdentity(origId);
4863              }
4864          }
4865      }->
5630      /**
5631       * Do either or both things: (1) change the current configuration, and (2)
5632       * make sure the given activity is running with the (now) current
5633       * configuration.  Returns true if the activity has been left running, or
5634       * false if <var>starting</var> is being destroyed to match the new
5635       * configuration.
5636       *
5637       * @param userId is only used when persistent parameter is set to true to persist configuration
5638       *               for that particular user
5639       */
5640      boolean updateConfigurationLocked(Configuration values, ActivityRecord starting,
5641              boolean initLocale, boolean persistent, int userId, boolean deferResume,
5642              ActivityTaskManagerService.UpdateConfigurationResult result) {5643          int changes = 0;
5644          boolean kept = true;
5645
5646          deferWindowLayout();
5647          try {5648              if (values != null) {// 分析1
5649                  changes = updateGlobalConfigurationLocked(values, initLocale, persistent, userId,
5650                          deferResume);
5651              }
5652              // 分析2
5653              kept = ensureConfigAndVisibilityAfterUpdate(starting, changes);
5654          } finally {5655              continueWindowLayout();
5656          }
5657
5658          if (result != null) {5659              result.changes = changes;
5660              result.activityRelaunched = !kept;
5661          }
5662          return kept;
5663      }
->
// 分析2
6327      /** Applies latest configuration and/or visibility updates if needed. */
6328      boolean ensureConfigAndVisibilityAfterUpdate(ActivityRecord starting, int changes) {6329          boolean kept = true;
6330          final ActivityStack mainStack = mRootWindowContainer.getTopDisplayFocusedStack();
6331          // mainStack is null during startup.
6332          if (mainStack != null) {6333              if (changes != 0 && starting == null) {6334                  // If the configuration changed, and the caller is not already
6335                  // in the process of starting an activity, then find the top
6336                  // activity to check if its configuration needs to change.
6337                  starting = mainStack.topRunningActivity();
6338              }
6339
6340              if (starting != null) {6341                  kept = starting.ensureActivityConfiguration(changes,
6342                          false /* preserveWindow */);
6343                  // And we need to make sure at this point that all other activities
6344                  // are made visible with the correct configuration.
6345                  mRootWindowContainer.ensureActivitiesVisible(starting, changes,
6346                          !PRESERVE_WINDOWS);
6347              }
6348          }
6349
6350          return kept;
6351      }
->
ActivityRecord.java
ensureActivityConfiguration() {if (shouldRelaunchLocked() {relaunchActivityLocked(preserveWindow);}
}主要在:shouldRelaunchLocked做一些判断

Android R: updateConfiguration()的relaunch App流程相关推荐

  1. Android R WiFi热点流程浅析

    Android R WiFi热点流程浅析 Android上的WiFi SoftAp功能是用户常用的功能之一,它能让我们分享手机的网络给其他设备使用. 那Android系统是如何实现SoftAp的呢,这 ...

  2. android R Variable Refresh Rate 可变帧率 VRR

    android R 可变帧率VRR 前言 API简述 Graphics相关代码分析 1.用户设置刷新率流程 2.SurfaceFlinger设置刷新率 使用API以及验证 前言 本文代码基于Andro ...

  3. 【Android 高性能音频】Oboe 开发流程 ( Oboe 完整代码示例 )

    文章目录 一.GitHub 地址 二.Oboe C++ 代码 三.日志封装 四.Activity 代码 五.AndroidManifest.xml 配置文件 六.CMakeLists.txt 构建脚本 ...

  4. android系统加载主题的流程,详解Android布局加载流程源码

    一.首先看布局层次 看这么几张图 我们会发现DecorView里面包裹的内容可能会随着不同的情况而变化,但是在Decor之前的层次关系都是固定的.即Activity包裹PhoneWindow,Phon ...

  5. android搜索框布局文件,android搜索框列表布局,流程及主要步骤思维导图

    android搜索框列表布局,流程及主要步骤思维导图 android搜索框列表布局,流程及主要步骤思维导图 activity_coin_search.xml ---------- android:id ...

  6. Android R 通知新特性—人与对话(气泡窗)

    文章目录 对话 Conversation Space Bubbles 通知中心的Bubble 如何弹出Bubble(app端相关) 系统是如何弹出Bubble的(源码相关) Android R 通知新 ...

  7. (六十五)Android O StartService的 anr timeout 流程分析

    前言:之前在(六十四)Android O Service启动流程梳理--startService 梳理了startService的一般流程,anr的没有涉及,本篇就以anr的为关注点梳理下流程. 参考 ...

  8. Android 6.0 Phone 多方通话流程

    写在前面的话 本文主要分析Voice Call多方通话的流程,分析GSM和CDMA在多方通话不同的地方,研究的代码是Android 6.0的,目前只关注framework层. 1. 多方通话的概念 下 ...

  9. Android 5.1 Lollipop Phone工作流程浅析(十三)__InCallActivity启动Performance浅析

    前置文章: < Android 4.4 Kitkat Phone工作流程浅析(一)__概要和学习计划> <Android 4.4 Kitkat Phone工作流程浅析(二)__UI结 ...

最新文章

  1. 是时候取消Scrum的产品负责人角色了吗?
  2. python使用手册-python 教程与手册(60IN1合集)
  3. 话说:学好C语言,走遍天下都不怕
  4. linux文件-access函数
  5. Eclipse GBK批量转UTF-8插件
  6. MongoDB高可用集群搭建
  7. 为什么kill进程后socket一直处于FIN_WAIT_1状态
  8. linux判断改行符_Linux判断符如何使用?
  9. php添加用户信息进入数据库,dedecms用户将信息插入数据库
  10. 12 File and Device I/O using System Calls
  11. python 爬虫 表格_爬虫数据表格
  12. linux img提取文件系统,Linux下 mount IMG文件提示“您必须制定文件系统类型”解决方法...
  13. Animation Framework
  14. 从头来之【iOS及历史版本特性介绍】
  15. 前端基础学习之CSS选择器
  16. python产生随机数的函数_Python 随机数函数
  17. SQL Server 卸载重装
  18. 2023年华南理工大学运筹学与控制论上岸前辈备考经验
  19. 华为版计算机软件,Huawei华为手机PC客户端软件
  20. 容斥原理(转载http://www.cppblog.com/vici/archive/2011/09/05/155103.html)

热门文章

  1. IMX556PLR-C TOF
  2. java equals方法详解
  3. Android debuggerd 源码分析
  4. 暑期学习 DCGAN 笔记
  5. python爬音乐-用python爬取网易云音乐歌曲的歌词
  6. javascript 深拷贝的方法
  7. Java安卓适配全面屏_GitHub - chnagzhaolin/NotchScreenTool: Android刘海屏、水滴屏等全面屏适配工具...
  8. vscode python 第三方库自动补全 第三方库的智能提示
  9. 查看进程启动时间 linux,Linux详细查看进程启动时间
  10. 网上的流量卡可以永久使用吗?看看你申请的套餐详情就知道了!