android:persistent="true"作用
针对系统级别的应用,在启动home之前启动,即随着系统开机启动

public void systemReady(final Runnable goingCallback, TimingsTraceLog traceLog) {...synchronized (this) {// Only start up encryption-aware persistent apps; once user is// unlocked we'll come back around and start unaware appsstartPersistentApps(PackageManager.MATCH_DIRECT_BOOT_AWARE);// Start up initial activity.mBooting = true;// Enable home activity for system user, so that the system can always boot. We don't// do this when the system user is not setup since the setup wizard should be the one// to handle home activity in this case.if (UserManager.isSplitSystemUser() &&Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.USER_SETUP_COMPLETE, 0) != 0) {ComponentName cName = new ComponentName(mContext, SystemUserHomeActivity.class);try {AppGlobals.getPackageManager().setComponentEnabledSetting(cName,PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0,UserHandle.USER_SYSTEM);} catch (RemoteException e) {throw e.rethrowAsRuntimeException();}}startHomeActivityLocked(currentUserId, "systemReady");try {if (AppGlobals.getPackageManager().hasSystemUidErrors()) {Slog.e(TAG, "UIDs on the system are inconsistent, you need to wipe your"+ " data partition or your device will be unstable.");mUiHandler.obtainMessage(SHOW_UID_ERROR_UI_MSG).sendToTarget();}} catch (RemoteException e) {}

当此应用异常被杀死后,系统会restart此应用,即应用的包活性。

 private final boolean attachApplicationLocked(IApplicationThread thread,int pid, int callingUid, long startSeq) {...final String processName = app.processName;try {AppDeathRecipient adr = new AppDeathRecipient(app, pid, thread);thread.asBinder().linkToDeath(adr, 0);app.deathRecipient = adr;} catch (RemoteException e) {app.resetPackageList(mProcessStats);startProcessLocked(app, "link fail", processName);return false;}...}            private final class AppDeathRecipient implements IBinder.DeathRecipient {final ProcessRecord mApp;final int mPid;final IApplicationThread mAppThread;AppDeathRecipient(ProcessRecord app, int pid,IApplicationThread thread) {if (DEBUG_ALL) Slog.v(TAG, "New death recipient " + this+ " for thread " + thread.asBinder());mApp = app;mPid = pid;mAppThread = thread;}@Overridepublic void binderDied() {if (DEBUG_ALL) Slog.v(TAG, "Death received in " + this+ " for thread " + mAppThread.asBinder());synchronized(ActivityManagerService.this) {appDiedLocked(mApp, mPid, mAppThread, true);}}}   @GuardedBy("this")private final boolean cleanUpApplicationRecordLocked(ProcessRecord app,boolean restarting, boolean allowRestart, int index, boolean replacingPid) {    ...} else if (!app.removed) {// This app is persistent, so we need to keep its record around.// If it is not already on the pending app list, add it there// and start a new process for it.if (mPersistentStartingProcesses.indexOf(app) < 0) {mPersistentStartingProcesses.add(app);restart = true;}}if ((DEBUG_PROCESSES || DEBUG_CLEANUP) && mProcessesOnHold.contains(app)) Slog.v(TAG_CLEANUP, "Clean-up removing on hold: " + app);mProcessesOnHold.remove(app);if (app == mHomeProcess) {mHomeProcess = null;}if (app == mPreviousProcess) {mPreviousProcess = null;}if (restart && !app.isolated) {// We have components that still need to be running in the// process, so re-launch it.if (index < 0) {ProcessList.remove(app.pid);}addProcessNameLocked(app);app.pendingStart = false;startProcessLocked(app, "restart", app.processName);return true;

android:persistent=true作用相关推荐

  1. android默认exported_Android android:exported = true 用法详解

    Android android:exported = true 用法详解 Android相关属性的介绍:android:exported = true 在Activity中该属性用来标示:当前Acti ...

  2. android:persistent属性

    为什么写这篇文章呢?前段时间在研究telephony时,一直没有在framework下发现对telephony的初始化(PhoneFactory.java中的makeDefaultPhones函数)的 ...

  3. Android相关属性的介绍:android:exported = true

    在Activity中该属性用来标示:当前Activity是否可以被另一个Application的组件启动:true允许被启动:false不允许被启动. android:exported 是Androi ...

  4. 腾讯、网易云、字节跳动面试点总结—AMS在Android起到什么作用?

    本专栏专注分享大型Bat面试知识,后续会持续更新,喜欢的话麻烦点击一个关注 面试官: AMS在Android起到什么作用,简单的分析下Android的源码 心理分析:这道题在发生在大多数场景下.面对这 ...

  5. android字节流压缩,Android代码压缩工具R8详解 android.enableR8=true

    前言 最近 Android Studio 稳定版迎来了3.3版本更新,带来的新特性之一是新一代的代码压缩工具 R8,本文将详细介绍这一新工具 R8.阅读本文内容前需了解: 关于 R8 作为 Andro ...

  6. android:fitsSystemWindows=“true”

    what's system window System windows are the parts of the screen where the system is drawing either n ...

  7. Android输入法遮挡了输入框,使用android:fitsSystemWindows=“true“后界面顶部出现白条解决方案

    Android输入法遮挡了输入框,使用android:fitsSystemWindows="true"后界面顶部出现白条解决方案 参考文章: (1)Android输入法遮挡了输入框 ...

  8. android进程调试(ro.debuggable=1或android:debuggable=true)----JDWP线程

    ro.debuggable=1或android:debuggable="true" VM process JDWP thread -– adbd(JDWP service) --- ...

  9. keyProperty=“id“ 和useGeneratedKeys=“true“作用

    keyProperty="id" 和useGeneratedKeys="true"作用 使用 mysql 自增长序列,新插入一条数据时,怎么得到主键? 加入以下 ...

  10. (转)Android属性设置android:noHistory=true

    设置 android:noHistory="true"后,该Activity在statck中不留历史痕迹.默认的值是false. 举例说明,假设有三个Activity分别是:A,B ...

最新文章

  1. SAP PM 初级系列23 - IW22 事务代码里创建维修工单
  2. 修改及查看mysql数据库的字符集
  3. 采购组织0001不对工厂1000负责
  4. java大型wms架构设计_Java生鲜电商平台-库存管理设计与架构
  5. kotlin使用spring data redis(二)
  6. IBASE text component
  7. word椭圆形标注怎么设置_轻松应对毕业季,搞定论文图表,word中处理原来没你想象的那么难...
  8. 《程序员》杂志2011年第5期.pdf 下载链接 首发。
  9. POJ 3225 - 区间
  10. Skype For Business Server 2015 离线消息
  11. 【QA】基于动态协同网络(DCN)的问答模型
  12. 推荐一款弹出窗口插件 lhgdialog 4.2.0 正式版
  13. CentOS 8 基础命令
  14. C语言练习——数据加密
  15. 中国医疗器械行业需求态势及未来前景趋势预测报告(2022-2027年)
  16. 成绩在C语言中怎么表示,c语言指数函数-分数在C语言中怎么表示分数和指数形式在C语 – 手机爱问...
  17. 鸿蒙一青城的对联,8副写景色的对联,风景美如画,令人陶醉!
  18. 教你如何利用灰度图透明效果制作隐藏图片.Part2
  19. 设置Win7虚拟机的内存
  20. 【CUDA基础练习】向量内积计算的若干种方法

热门文章

  1. 【网格压缩测评】MeshQuan、MeshOpt、Draco
  2. Centos7使用编译源码方式安装mysql
  3. 电脑文件被杀毒软件误删了怎么恢复?
  4. fork的仓库如何和父父仓库同步 parent仓库
  5. linux命令离线手册下载,linux 命令速查手册全集下载
  6. 一文带你搞懂Python中的文件操作
  7. 温哥华岛大学计算机科学,温哥华有哪些知名大学排名(温哥华地区大学排名一览)...
  8. linux带方括号进程,Linux特殊符号大全(转摘)
  9. Spring的装配方式
  10. c语言中fabs是什么意思,c语言fabs是什么意思