在Android M版本里,如果设定的加密密码,比如pin,password和pattern。那在开机的时候,会要求输入密码才能开机。如下图:
在开机过程中比较重要的一只文件CryptKeeper.java。
Path:/packages/apps/Settings/src/com/android/settings/CryptKeeper.java
接下来讲讲需要加密开机过程中的几个关键flow。
1, 在开机过程中,会先跑到CryptKeeper.java,其中比较重要的就是setupUi()。
1),部分被加密,直接显示factoryreset
457 if (mEncryptionGoneBad|| isDebugView(FORCE_VIEW_ERROR)){
458 setContentView(R.layout.crypt_keeper_progress);
459 showFactoryReset(mCorrupt);
460 return;
461 }
2),获取vold.encrypt_progress的值,如果为空,就会去init进度条,并且会不断更新这个进度条。
463 final String progress = SystemProperties.get("vold.encrypt_progress");
464 if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
465 setContentView(R.layout.crypt_keeper_progress);
3),判断mValidationRequested是否为flase,如果为false,就执行ValidationTask。这个分支是最早执行的,即最先执行ValidationTask。527 } else if (!mValidationRequested) {
528 // We're supposed to be encrypted,but no validation has been done.
529 new ValidationTask().execute((Void[]) null);
530 mValidationRequested = true;
531 }
ValidationTask的主要功能是先获取Encryption state。如果状态为ENCRYPTION_STATE_OK,就将mEncryptionGoneBad设置成true。ValidationTask执行完之后,就会将mValidationComplete设置成true,准备执行输入password的task。286 private class ValidationTaskextends AsyncTask<Void, Void, Boolean> {
290 protected Boolean doInBackground(Void... params){
291 final
FDE之要求密码开机流程
最新推荐文章于 2023-10-21 22:22:52 发布