summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Soulos <psoulos@google.com>2015-10-21 21:38:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-21 21:38:08 +0000
commitb0876d3cb4e90c21acc23941a80648d45451e7fd (patch)
tree39d623da36b8c50e0bf9ffaf1d0581e6dc8aa0e8
parent958f46fd5944f3588ab1b77baae2452270f3a045 (diff)
parent33c079a90b605b550b04915be70217f7a3fe61b6 (diff)
downloadandroid_packages_apps_CertInstaller-b0876d3cb4e90c21acc23941a80648d45451e7fd.tar.gz
android_packages_apps_CertInstaller-b0876d3cb4e90c21acc23941a80648d45451e7fd.tar.bz2
android_packages_apps_CertInstaller-b0876d3cb4e90c21acc23941a80648d45451e7fd.zip
Merge "Nemo CTS: Call the right class for SSL" into cw-e-dev
-rw-r--r--src/com/android/certinstaller/CertInstaller.java4
-rw-r--r--src/com/android/certinstaller/CredentialHelper.java14
2 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/certinstaller/CertInstaller.java b/src/com/android/certinstaller/CertInstaller.java
index 907646e..0a6049e 100644
--- a/src/com/android/certinstaller/CertInstaller.java
+++ b/src/com/android/certinstaller/CertInstaller.java
@@ -21,6 +21,7 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
@@ -394,6 +395,7 @@ public class CertInstaller extends Activity {
}
nameInput.setText(getDefaultName());
nameInput.selectAll();
+ final Context appContext = getApplicationContext();
Dialog d = new AlertDialog.Builder(this)
.setView(view)
.setTitle(R.string.name_credential_dialog_title)
@@ -411,7 +413,7 @@ public class CertInstaller extends Activity {
// install everything to system keystore
try {
startActivityForResult(
- mCredentials.createSystemInstallIntent(),
+ mCredentials.createSystemInstallIntent(appContext),
REQUEST_SYSTEM_INSTALL_CODE);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "systemInstall(): " + e);
diff --git a/src/com/android/certinstaller/CredentialHelper.java b/src/com/android/certinstaller/CredentialHelper.java
index c131268..a3e2e27 100644
--- a/src/com/android/certinstaller/CredentialHelper.java
+++ b/src/com/android/certinstaller/CredentialHelper.java
@@ -18,6 +18,7 @@ package com.android.certinstaller;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.RemoteException;
import android.security.Credentials;
@@ -256,11 +257,16 @@ class CredentialHelper {
return mUid != -1;
}
- Intent createSystemInstallIntent() {
+ Intent createSystemInstallIntent(final Context context) {
Intent intent = new Intent("com.android.credentials.INSTALL");
// To prevent the private key from being sniffed, we explicitly spell
// out the intent receiver class.
- intent.setClassName("com.android.settings", "com.android.settings.CredentialStorage");
+ if (!isWear(context)) {
+ intent.setClassName("com.android.settings", "com.android.settings.CredentialStorage");
+ } else {
+ intent.setClassName("com.google.android.apps.wearable.settings",
+ "com.google.android.clockwork.settings.CredentialStorage");
+ }
intent.putExtra(Credentials.EXTRA_INSTALL_AS_UID, mUid);
try {
if (mUserKey != null) {
@@ -365,4 +371,8 @@ class CredentialHelper {
return true;
}
+
+ private static boolean isWear(final Context context) {
+ return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
+ }
}