diff options
author | Sandeep Siddhartha <sansid@google.com> | 2013-09-06 22:04:44 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-06 22:04:44 +0000 |
commit | 22ae5d6de11b0a6126987293b44cd85048a45015 (patch) | |
tree | 92ca3046b033b223437f197f0579301303d92acc /packages | |
parent | b05b408614767fb60295830d6bf557b33252498e (diff) | |
parent | 4473f020037ed2a01e8288497b9f27cff1b6b8d4 (diff) | |
download | frameworks_base-22ae5d6de11b0a6126987293b44cd85048a45015.zip frameworks_base-22ae5d6de11b0a6126987293b44cd85048a45015.tar.gz frameworks_base-22ae5d6de11b0a6126987293b44cd85048a45015.tar.bz2 |
Merge "Use the permission for hotword recognition" into klp-dev
Diffstat (limited to 'packages')
-rw-r--r-- | packages/Keyguard/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java | 19 |
2 files changed, 8 insertions, 13 deletions
diff --git a/packages/Keyguard/AndroidManifest.xml b/packages/Keyguard/AndroidManifest.xml index 7d77c48..d2c82c8 100644 --- a/packages/Keyguard/AndroidManifest.xml +++ b/packages/Keyguard/AndroidManifest.xml @@ -37,6 +37,8 @@ <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" /> <uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" /> <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" /> + <!-- Permission to perform hotword recognition --> + <uses-permission android:name="android.permission.HOTWORD_RECOGNITION" /> <application android:label="@string/app_name" android:process="com.android.systemui" diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java index 00124b0..78b842c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java @@ -1784,30 +1784,23 @@ public class KeyguardHostView extends KeyguardViewBase { } } - public void onHotwordRecognized(final PendingIntent intent) { + public void onHotwordRecognized(final Intent intent) { if (DEBUG) Log.d(TAG, "onHotwordRecognized"); maybeStopHotwordDetector(); + // See if an activity can handle this intent. + if (getContext().getPackageManager().resolveActivity(intent, 0) == null) + return; if (SecurityMode.None == mCurrentSecuritySelection) { if (intent != null) { - try { - intent.send(); - } catch (PendingIntent.CanceledException e) { - Log.w(TAG, "Failed to launch PendingIntent. Encountered CanceledException"); - } + mActivityLauncher.launchActivity(intent, true, true, null, null); } mCallback.userActivity(0); - mCallback.dismiss(false); } else if (ENABLE_HOTWORD_SECURE && mLockPatternUtils.isSecure()) { setOnDismissAction(new OnDismissAction() { @Override public boolean onDismiss() { if (intent != null) { - try { - intent.send(); - } catch (PendingIntent.CanceledException e) { - Log.w(TAG, "Failed to launch PendingIntent." - + "Encountered CanceledException"); - } + mActivityLauncher.launchActivity(intent, true, true, null, null); } return false; } |