summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-07-28 17:49:55 -0700
committerDianne Hackborn <hackbod@google.com>2009-07-28 17:55:13 -0700
commita6ddc8af22af6bce879c5bf906aad16c0b3d6b01 (patch)
tree8a8d91e64c127d07657cb3d32c2ab130673120e6 /core
parentac38dfc5435b57281c97165e4de5b5a12af98a20 (diff)
downloadframeworks_base-a6ddc8af22af6bce879c5bf906aad16c0b3d6b01.zip
frameworks_base-a6ddc8af22af6bce879c5bf906aad16c0b3d6b01.tar.gz
frameworks_base-a6ddc8af22af6bce879c5bf906aad16c0b3d6b01.tar.bz2
Fix issue #1999179: search -> click result -> press home = search dialog is shown then hidden
Re-arrange various things to ensure that the search dialog is told about system windows being closed before it is told about the navigation back to home.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/ActivityManagerNative.java21
-rw-r--r--core/java/android/app/IActivityManager.java5
-rw-r--r--core/java/android/app/IActivityWatcher.aidl1
-rw-r--r--core/java/android/server/search/SearchDialogWrapper.java40
-rw-r--r--core/java/android/server/search/SearchManagerService.java5
5 files changed, 63 insertions, 9 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 3aeac53..447512a 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1085,6 +1085,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
reply.writeInt(result);
return true;
}
+
case KILL_APPLICATION_WITH_UID_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
String pkg = data.readString();
@@ -1093,6 +1094,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
reply.writeNoException();
return true;
}
+
+ case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ String reason = data.readString();
+ closeSystemDialogs(reason);
+ reply.writeNoException();
+ return true;
+ }
}
return super.onTransact(code, data, reply, flags);
@@ -2376,6 +2385,7 @@ class ActivityManagerProxy implements IActivityManager
data.recycle();
return result;
}
+
public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
@@ -2387,6 +2397,17 @@ class ActivityManagerProxy implements IActivityManager
data.recycle();
reply.recycle();
}
+
+ public void closeSystemDialogs(String reason) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ data.writeString(reason);
+ mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
private IBinder mRemote;
}
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index b1b5282..f6ef549 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -268,7 +268,9 @@ public interface IActivityManager extends IInterface {
throws RemoteException;
public void killApplicationWithUid(String pkg, int uid) throws RemoteException;
-
+
+ public void closeSystemDialogs(String reason) throws RemoteException;
+
/*
* Private non-Binder interfaces
*/
@@ -424,4 +426,5 @@ public interface IActivityManager extends IInterface {
int UNREGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+93;
int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94;
int KILL_APPLICATION_WITH_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95;
+ int CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96;
}
diff --git a/core/java/android/app/IActivityWatcher.aidl b/core/java/android/app/IActivityWatcher.aidl
index 5d36e3f..6737545 100644
--- a/core/java/android/app/IActivityWatcher.aidl
+++ b/core/java/android/app/IActivityWatcher.aidl
@@ -23,4 +23,5 @@ package android.app;
*/
oneway interface IActivityWatcher {
void activityResuming(int activityId);
+ void closingSystemDialogs(String reason);
}
diff --git a/core/java/android/server/search/SearchDialogWrapper.java b/core/java/android/server/search/SearchDialogWrapper.java
index b8a9875..49718cb 100644
--- a/core/java/android/server/search/SearchDialogWrapper.java
+++ b/core/java/android/server/search/SearchDialogWrapper.java
@@ -63,6 +63,8 @@ implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
private static final int MSG_STOP_SEARCH = 2;
// arg1 is activity id
private static final int MSG_ACTIVITY_RESUMING = 3;
+ // obj is the reason
+ private static final int MSG_CLOSING_SYSTEM_DIALOGS = 4;
private static final String KEY_INITIAL_QUERY = "q";
private static final String KEY_LAUNCH_ACTIVITY = "a";
@@ -127,8 +129,7 @@ implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
private void registerBroadcastReceiver() {
if (!mReceiverRegistered) {
IntentFilter filter = new IntentFilter(
- Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
+ Intent.ACTION_CONFIGURATION_CHANGED);
mContext.registerReceiver(mBroadcastReceiver, filter, null,
mSearchUiThread);
mReceiverRegistered = true;
@@ -149,12 +150,7 @@ implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
- if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
- if (!"search".equals(intent.getStringExtra("reason"))) {
- if (DBG) debug(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- performStopSearch();
- }
- } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
+ if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
if (DBG) debug(Intent.ACTION_CONFIGURATION_CHANGED);
performOnConfigurationChanged();
}
@@ -219,6 +215,18 @@ implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
mSearchUiThread.sendMessage(msg);
}
+ /**
+ * Handles closing of system windows/dialogs
+ * Can be called from any thread.
+ */
+ public void closingSystemDialogs(String reason) {
+ if (DBG) debug("closingSystemDialogs(reason=" + reason + ")");
+ Message msg = Message.obtain();
+ msg.what = MSG_CLOSING_SYSTEM_DIALOGS;
+ msg.obj = reason;
+ mSearchUiThread.sendMessage(msg);
+ }
+
//
// Implementation methods that run on the search UI thread
//
@@ -244,6 +252,9 @@ implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
case MSG_ACTIVITY_RESUMING:
performActivityResuming(msg.arg1);
break;
+ case MSG_CLOSING_SYSTEM_DIALOGS:
+ performClosingSystemDialogs((String)msg.obj);
+ break;
}
}
@@ -330,6 +341,19 @@ implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
}
/**
+ * Updates due to system dialogs being closed
+ * This must be called on the search UI thread.
+ */
+ void performClosingSystemDialogs(String reason) {
+ if (DBG) debug("performClosingSystemDialogs(): mStartedIdent="
+ + mStartedIdent + ", reason: " + reason);
+ if (!"search".equals(reason)) {
+ if (DBG) debug(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
+ performStopSearch();
+ }
+ }
+
+ /**
* Must be called from the search UI thread.
*/
void performOnConfigurationChanged() {
diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java
index fdeb8f9..afed4a4 100644
--- a/core/java/android/server/search/SearchManagerService.java
+++ b/core/java/android/server/search/SearchManagerService.java
@@ -138,6 +138,11 @@ public class SearchManagerService extends ISearchManager.Stub {
if (mSearchDialog == null) return;
mSearchDialog.activityResuming(activityId);
}
+ public void closingSystemDialogs(String reason) {
+ if (DBG) Log.i("foo", "********************** closing dialogs: " + reason);
+ if (mSearchDialog == null) return;
+ mSearchDialog.closingSystemDialogs(reason);
+ }
};
/**