您的当前位置:首页正文

Android系统Setting CA证书安装流程

来源:华佗小知识

安装路径

Setting - Security -install from stroage

1.打开setting源码,找到install from storage对应的代码

credentials_install.png

当点击“从存储设备安装证书”时,会通过intent进入CertInstallerMain中,这个类在系统app,CerInstaller中。

2.在CertInstallerMain的onCreate()方法,对相应action进行处理

CertInstallerMain的onCreate()方法.png

Credentials在framework层,对应的action如下:

public static final String INSTALL_ACTION = "android.credentials.INSTALL";

public static final String INSTALL_AS_USER_ACTION = "android.credentials.INSTALL_AS_USER";
判断bundle是否为空.png

如果bundle为空,这段代码将打开一个类似文件浏览器界面,在系统下为DocumentUI,可以点击安装外部存储中的证书。


Paste_Image.png

下面这段代码,最终会跳到CertInstaller中。


Paste_Image.png 进入CertInstaller.png

进入CertInstaller会首先提示设置锁屏密码或者pin

Paste_Image.png Paste_Image.png

最终安装证书的方法

Paste_Image.png