Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5e630a0 authored by Hung-ying Tyan's avatar Hung-ying Tyan
Browse files

Use explicit intent for installing credentials.

http://b/issue?id=3020049

Change-Id: I429c5b2c9f3b876e6197894a9437952d71d5c472
parent 70f1a3b8
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -80,9 +80,16 @@ public class Credentials {
        }
    }

    private Intent createInstallIntent() {
        Intent intent = new Intent(INSTALL_ACTION);
        intent.setClassName("com.android.certinstaller",
                "com.android.certinstaller.CertInstallerMain");
        return intent;
    }

    public void install(Context context, KeyPair pair) {
        try {
            Intent intent = new Intent(INSTALL_ACTION);
            Intent intent = createInstallIntent();
            intent.putExtra(PRIVATE_KEY, pair.getPrivate().getEncoded());
            intent.putExtra(PUBLIC_KEY, pair.getPublic().getEncoded());
            context.startActivity(intent);
@@ -93,7 +100,7 @@ public class Credentials {

    public void install(Context context, String type, byte[] value) {
        try {
            Intent intent = new Intent(INSTALL_ACTION);
            Intent intent = createInstallIntent();
            intent.putExtra(type, value);
            context.startActivity(intent);
        } catch (ActivityNotFoundException e) {
@@ -103,7 +110,7 @@ public class Credentials {

    public void installFromSdCard(Context context) {
        try {
            context.startActivity(new Intent(INSTALL_ACTION));
            context.startActivity(createInstallIntent());
        } catch (ActivityNotFoundException e) {
            Log.w(LOGTAG, e.toString());
        }