摘要:
加密进度显示简化过程是这样的:0x001 – shutdown framework; 0x02 – 开始执行加密(vold单独运行), 进度更新到system property中; 0x03 – start mini framework;0x04 — Core App 被解析;0x05 – 声明响应HOME的CryptyKeep启动。0x06 – CryptyKeep每1s检查一次system property。
问题背景:OEM厂家,点“加密手机”,不显示加密的进度条
下面是问题分析过程:
0x01: 加密操作的开始位置:
public class CryptKeeperConfirm extends Fragment
mFinalClickListener.onClick
{...
Intent intent = new Intent(getActivity(), Blank.class);
intent.putExtras(getArguments());
startActivity(intent);
...
}
//执行跳转到内部的 Activity: CryptKeeperConfirm.Blank
onCreate()
{...
IBinder service = ServiceManager.getService("mount");
IMountService mountService = IMountService.Stub.asInterface(service);
mountService.encryptStorage(args.getInt("type", -1), args.getString("password"));
}
0x02: 再看还有个CryptKeeper Activity,是个什么鬼?
整个setting找不到这个Activity的启动代码。但是细看会发现,这个界面就是进度条界面。
具有开机启动的声明:
与进度有关系的有两个属性:vold.decrypt , vold_encrypt_progress 。
检索这两个属性,注意力转移到 cryptfs.c
0x03:cryptfs.c 文件中的关键点分析
property_set("vold.encrypt_progress", "0");
property_set("vold.encrypt_progress", buf);
property_set("vold.encrypt_progress", "100");
设置进度
property_set("vold.decrypt", "trigger_shutdown_framework");
property_set("vold.decrypt", "trigger_restart_framework");
property_set("vold.decrypt", "trigger_restart_min_framework")
上面这几个可以亲自试一下,trigger_shutdown_framework, framework会挂掉,还有adb 端口
property_set(ANDROID_RB_PROPERTY, "reboot")
上面的属性设置,直接重启Android。
没有碰到过类似的命令? 请参考:http://www.bkjia.com/Androidjc/924621.html
在android/system/core/rootdir/下执行如下指令可以得到
grep -h “^on” –include=”*.rc” -r .
init.rc 中有如下 触发器 :
on property:vold.decrypt=trigger_shutdown_framework
class_reset late_start
class_reset main
on property:sys.powerctl=*
powerctl ${sys.powerctl}
待续:
0x0A: mountService.encryptStorage 分析
(待补充)