summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Spurlock <jspurlock@google.com> 2012-11-12 08:00:19 -0800
committer Android Git Automerger <android-git-automerger@android.com> 2012-11-12 08:00:19 -0800
commitb80bc6737f27d6e9ab72a46cea266fd8a29a57e6 (patch)
treeb8e92632406ec0aa3d36136be16c2b4050c1cecc
parent5a7b18d919c8b3bd784ef729bbe5e53c53f084d4 (diff)
parent4299f63e54dceeaaa44a057ba03f0881834491ec (diff)
am 4299f63e: am b340fe4f: am f6f47e95: Merge "Disable navbar searchlight if search assist not available." into jb-mr1.1-dev
* commit '4299f63e54dceeaaa44a057ba03f0881834491ec': Disable navbar searchlight if search assist not available.
-rw-r--r--core/java/android/app/SearchManager.java3
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java12
2 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index 43a163dcf067..6382ceefdd68 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -858,6 +858,9 @@ public class SearchManager
*/
public Intent getAssistIntent(Context context, int userHandle) {
try {
+ if (mService == null) {
+ return null;
+ }
ComponentName comp = mService.getAssistIntent(userHandle);
if (comp == null) {
return null;
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index df4c661ab2d3..c227619fc94b 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -22,6 +22,7 @@ import android.app.Activity;
import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.PendingIntent;
+import android.app.SearchManager;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -166,6 +167,9 @@ public class KeyguardViewMediator {
/** UserManager for querying number of users */
private UserManager mUserManager;
+ /** SearchManager for determining whether or not search assistant is available */
+ private SearchManager mSearchManager;
+
/**
* Used to keep the device awake while to ensure the keyguard finishes opening before
* we sleep.
@@ -527,6 +531,7 @@ public class KeyguardViewMediator {
* Let us know that the system is ready after startup.
*/
public void onSystemReady() {
+ mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
synchronized (this) {
if (DEBUG) Log.d(TAG, "onSystemReady");
mSystemReady = true;
@@ -1313,6 +1318,9 @@ public class KeyguardViewMediator {
// showing secure lockscreen; disable ticker.
flags |= StatusBarManager.DISABLE_NOTIFICATION_TICKER;
}
+ if (!isAssistantAvailable()) {
+ flags |= StatusBarManager.DISABLE_SEARCH;
+ }
}
if (DEBUG) {
@@ -1410,4 +1418,8 @@ public class KeyguardViewMediator {
mKeyguardViewManager.showAssistant();
}
+ private boolean isAssistantAvailable() {
+ return mSearchManager != null
+ && mSearchManager.getAssistIntent(mContext, UserHandle.USER_CURRENT) != null;
+ }
}