diff options
author | Paul Soulos <psoulos@google.com> | 2015-10-21 21:42:11 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-10-21 21:42:11 +0000 |
commit | cab79670a3342ce04a5bd6d76c35c2746e405c3f (patch) | |
tree | 94e40dbdb2e76c6abfe9c9ff2b2ed9c6ef1e0460 | |
parent | 7721edd438afd40cbf764f8ec826375832199009 (diff) | |
parent | b0876d3cb4e90c21acc23941a80648d45451e7fd (diff) | |
download | android_packages_apps_CertInstaller-cab79670a3342ce04a5bd6d76c35c2746e405c3f.tar.gz android_packages_apps_CertInstaller-cab79670a3342ce04a5bd6d76c35c2746e405c3f.tar.bz2 android_packages_apps_CertInstaller-cab79670a3342ce04a5bd6d76c35c2746e405c3f.zip |
Merge "Nemo CTS: Call the right class for SSL" into cw-e-dev
am: b0876d3cb4
* commit 'b0876d3cb4e90c21acc23941a80648d45451e7fd':
Nemo CTS: Call the right class for SSL
-rw-r--r-- | src/com/android/certinstaller/CertInstaller.java | 4 | ||||
-rw-r--r-- | src/com/android/certinstaller/CredentialHelper.java | 14 |
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); + } } |