问题描述:恢复出厂设置开机后有个白色界面闪现,并且没有显示锁屏界面
抓取恢复出厂设置开机log和正常开机的log对比
Line 20371: 08-12 01:29:10.946 1240 1240 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.settings/.CryptKeeper} from uid 0
Line 20747: 08-12 01:29:11.818 1240 2993 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.settings/.FallbackHome} from uid 0
Line 24471: 08-12 01:29:20.311 1240 2940 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.provision/.DefaultActivity} from uid 0
Line 25053: 08-12 01:29:21.736 1240 1348 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.launcher3/.Launcher} from uid 0
...
Line 20541: 08-12 01:29:11.357 2862 2862 D KeyguardUpdateMonitor: mDeviceProvisioned is:false
Line 20543: 08-12 01:29:11.372 2862 2862 D KeyguardUpdateMonitor: initMembers() - NumOfPhone=2
Line 20563: 08-12 01:29:11.433 2862 2862 V KeyguardUpdateMonitor: startListeningForFingerprint()
Line 20565: 08-12 01:29:11.453 2862 2862 D KeyguardUpdateMonitor: isDeviceProvisioned get DEVICE_PROVISIONED from db again !!
...
Line 22197: 08-12 01:29:14.756 2862 2862 D KeyguardViewMediator: adjustStatusBarLocked: mShowing=false mOccluded=false isSecure=false force=false --> flags=0x0
Line 22254: 08-12 01:29:15.060 2862 3099 D KeyguardViewMediator: onStartedWakingUp, seq = 1
Line 22255: 08-12 01:29:15.061 2862 3099 D KeyguardViewMediator: notifyStartedWakingUp
Line 22256: 08-12 01:29:15.061 2862 3099 D KeyguardViewMediator: notifyScreenOn
Line 22257: 08-12 01:29:15.065 2862 3099 D KeyguardViewMediator: notifyScreenTurnedOn
Line 22258: 08-12 01:29:15.068 2862 3241 D KeyguardViewMediator: onBootCompleted() is called
...
Line 22567: 08-12 01:29:16.515 2862 2862 D KeyguardViewMediator: onSystemReady
Line 22568: 08-12 01:29:16.516 2862 2862 D KeyguardViewMediator: lockedOrMissing is false, requireSim=false, antiTheftLocked=false
Line 22569: 08-12 01:29:16.516 2862 2862 D KeyguardUpdateMonitor: isDeviceProvisioned get DEVICE_PROVISIONED from db again !!
Line 22570: 08-12 01:29:16.517 2862 2862 D KeyguardViewMediator: doKeyguard: not showing because device isn't provisioned and the sim is not locked or missing
- 正常开机的log
Line 7555: 08-12 02:35:42.800 1043 1043 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.settings/.FallbackHome} from uid 0
Line 11588: 08-12 02:35:52.266 1043 1057 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.launcher3/.Launcher} from uid 0
...
Line 7974: 08-12 02:35:44.063 1273 1273 D KeyguardUpdateMonitor: mDeviceProvisioned is:true
Line 7975: 08-12 02:35:44.068 1273 1273 D KeyguardUpdateMonitor: initMembers() - NumOfPhone=2
Line 7991: 08-12 02:35:44.103 1273 1273 V KeyguardUpdateMonitor: startListeningForFingerprint()
...
Line 9906: 08-12 02:35:47.652 1273 1273 D KeyguardViewMediator: adjustStatusBarLocked: mShowing=true mOccluded=false isSecure=false force=false --> flags=0x1200000
Line 10011: 08-12 02:35:47.970 1273 1328 D KeyguardViewMediator: onStartedWakingUp, seq = 1
Line 10012: 08-12 02:35:47.970 1273 1328 D KeyguardViewMediator: notifyStartedWakingUp
Line 10013: 08-12 02:35:47.971 1273 1328 D KeyguardViewMediator: notifyScreenOn
Line 10014: 08-12 02:35:47.972 1273 1328 D KeyguardViewMediator: notifyScreenTurnedOn
Line 10015: 08-12 02:35:47.972 1273 1328 D KeyguardViewMediator: onBootCompleted() is called
...
Line 10548: 08-12 02:35:49.575 1273 1273 D KeyguardViewMediator: onSystemReady
Line 10549: 08-12 02:35:49.576 1273 1273 D KeyguardViewMediator: lockedOrMissing is false, requireSim=false, antiTheftLocked=false
Line 10550: 08-12 02:35:49.583 1273 1273 D KeyguardViewMediator: doKeyguard: showing the lock screen
Line 10551: 08-12 02:35:49.583 1273 1273 D KeyguardViewMediator: showLocked
可以看出,mDeviceProvisioned 的值不同,因此KeyguardViewMediator.java中的处理也不同。
- 源码位置:SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
private void doKeyguardLocked(Bundle options) {
...
if (!lockedOrMissing && shouldWaitForProvisioning() && !antiTheftLocked) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned"
+ " and the sim is not locked or missing");
return;
}
...
}
...
private boolean shouldWaitForProvisioning() {
return !mUpdateMonitor.isDeviceProvisioned() && !isSecure();
}
- 源码位置:SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
public boolean isDeviceProvisioned() {
if (mDeviceProvisioned == false) {
Log.d(TAG, "isDeviceProvisioned get DEVICE_PROVISIONED from db again !!");
return (0 != Settings.Global.getInt(
mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0));
} else {
return mDeviceProvisioned;
}
}
...
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
...
private boolean isDeviceProvisionedInSettingsDb() {
return Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0) != 0;
}
DefaultActivity.java中
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
只设置这两个属性后就finish了,没有最其他操作,闪现白色界面就是启动这个了
最后处理,去掉DefaultActivity.java所在应用,将这两个设置添加到FallbackHome.java中。