Merge "Use explicit intent for installing credentials." into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
26cb01e880
@@ -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) {
|
public void install(Context context, KeyPair pair) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(INSTALL_ACTION);
|
Intent intent = createInstallIntent();
|
||||||
intent.putExtra(PRIVATE_KEY, pair.getPrivate().getEncoded());
|
intent.putExtra(PRIVATE_KEY, pair.getPrivate().getEncoded());
|
||||||
intent.putExtra(PUBLIC_KEY, pair.getPublic().getEncoded());
|
intent.putExtra(PUBLIC_KEY, pair.getPublic().getEncoded());
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
@@ -93,7 +100,7 @@ public class Credentials {
|
|||||||
|
|
||||||
public void install(Context context, String type, byte[] value) {
|
public void install(Context context, String type, byte[] value) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(INSTALL_ACTION);
|
Intent intent = createInstallIntent();
|
||||||
intent.putExtra(type, value);
|
intent.putExtra(type, value);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
@@ -103,7 +110,7 @@ public class Credentials {
|
|||||||
|
|
||||||
public void installFromSdCard(Context context) {
|
public void installFromSdCard(Context context) {
|
||||||
try {
|
try {
|
||||||
context.startActivity(new Intent(INSTALL_ACTION));
|
context.startActivity(createInstallIntent());
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Log.w(LOGTAG, e.toString());
|
Log.w(LOGTAG, e.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user