android:persistent (非系统app失效)
生活随笔
收集整理的這篇文章主要介紹了
android:persistent (非系统app失效)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
非系統app設置persistent無效
安裝時 if ((flags&PARSE_IS_SYSTEM) != 0) {if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestApplication_persistent,false)) {ai.flags |= ApplicationInfo.FLAG_PERSISTENT;}}
系統啟動時會拉起persistent的(系統)app
try {List apps = AppGlobals.getPackageManager().getPersistentApplications(STOCK_PM_FLAGS);if (apps != null) {int N = apps.size();int i;for (i=0; i<N; i++) {ApplicationInfo info= (ApplicationInfo)apps.get(i);if (info != null &&!info.packageName.equals("android")) {addAppLocked(info, false, null /* ABI override */);}}} } catch (RemoteException ex) {// pm is in same process, this will never happen. }final ProcessRecord addAppLocked(ApplicationInfo info, boolean isolated,String abiOverride) {if (app.thread == null && mPersistentStartingProcesses.indexOf(app) < 0) {mPersistentStartingProcesses.add(app);startProcessLocked(app, "added application", app.processName, abiOverride,null /* entryPoint */, null /* entryPointArgs */);}return app;}
app進程死掉之后重啟persistent app
private final boolean cleanUpApplicationRecordLocked(ProcessRecord app,boolean restarting, boolean allowRestart, int index) {if (!app.persistent || app.isolated) {} 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 (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);startProcessLocked(app, "restart", app.processName);return true;} else if (app.pid > 0 && app.pid != MY_PID) {}return false; }
非系統app標志位失效
if ((flags&PARSE_IS_SYSTEM) != 0) {if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestApplication_persistent,false)) {ai.flags |= ApplicationInfo.FLAG_PERSISTENT;} }總結
以上是生活随笔為你收集整理的android:persistent (非系统app失效)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android进程优先级的计算
- 下一篇: 默认(1sp = 1dp) , sp:带