summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorKarl Rosaen <krosaen@google.com>2009-07-21 16:21:32 -0700
committerKarl Rosaen <krosaen@google.com>2009-07-21 16:21:32 -0700
commitec0a12cf199659a749ff1fe7b788626eddc095eb (patch)
tree931ae83f678cd1e05dcfe4fe369d3d3b72fe0ad4 /core
parent841ed8596a745d90822467bc2c0e13880bb59cc9 (diff)
downloadframeworks_base-ec0a12cf199659a749ff1fe7b788626eddc095eb.zip
frameworks_base-ec0a12cf199659a749ff1fe7b788626eddc095eb.tar.gz
frameworks_base-ec0a12cf199659a749ff1fe7b788626eddc095eb.tar.bz2
Don't start search from a dialog if there is no activity associated with
the search manager at that point. Still works: - hitting search when a managed dialog of an app is showing will dismiss the dialog and start in-app search (if it supports it), falling back on global search - hitting search when a dialog of an app (not managed by the activity) will dismiss the dialog and start global search - hitting search when a system dialog is showing will just dismiss the dialog.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/Dialog.java5
-rw-r--r--core/java/android/app/SearchManager.java4
2 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 444f222..9432755 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -788,6 +788,11 @@ public class Dialog implements DialogInterface, Window.Callback,
final SearchManager searchManager = (SearchManager) mContext
.getSystemService(Context.SEARCH_SERVICE);
+ // can't start search without an associated activity (e.g a system dialog)
+ if (!searchManager.hasIdent()) {
+ return false;
+ }
+
// associate search with owner activity if possible (otherwise it will default to
// global search).
final ComponentName appName = mOwnerActivity == null ? null
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index c98d966..0631ad5 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -1536,6 +1536,10 @@ public class SearchManager
mService = ISearchManager.Stub.asInterface(
ServiceManager.getService(Context.SEARCH_SERVICE));
}
+
+ /*package*/ boolean hasIdent() {
+ return mIdent != 0;
+ }
/*package*/ void setIdent(int ident) {
if (mIdent != 0) {