Loading core/java/android/app/ActivityManagerNative.java +21 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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); Loading Loading @@ -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(); Loading @@ -2388,5 +2398,16 @@ class ActivityManagerProxy implements IActivityManager 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; } core/java/android/app/IActivityManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -269,6 +269,8 @@ public interface IActivityManager extends IInterface { public void killApplicationWithUid(String pkg, int uid) throws RemoteException; public void closeSystemDialogs(String reason) throws RemoteException; /* * Private non-Binder interfaces */ Loading Loading @@ -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; } core/java/android/app/IActivityWatcher.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -23,4 +23,5 @@ package android.app; */ oneway interface IActivityWatcher { void activityResuming(int activityId); void closingSystemDialogs(String reason); } core/java/android/server/search/SearchDialogWrapper.java +32 −8 Original line number Diff line number Diff line Loading @@ -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"; Loading Loading @@ -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; Loading @@ -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(); } Loading Loading @@ -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 // Loading @@ -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; } } Loading Loading @@ -329,6 +340,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. */ Loading core/java/android/server/search/SearchManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -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); } }; /** Loading Loading
core/java/android/app/ActivityManagerNative.java +21 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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); Loading Loading @@ -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(); Loading @@ -2388,5 +2398,16 @@ class ActivityManagerProxy implements IActivityManager 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; }
core/java/android/app/IActivityManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -269,6 +269,8 @@ public interface IActivityManager extends IInterface { public void killApplicationWithUid(String pkg, int uid) throws RemoteException; public void closeSystemDialogs(String reason) throws RemoteException; /* * Private non-Binder interfaces */ Loading Loading @@ -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; }
core/java/android/app/IActivityWatcher.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -23,4 +23,5 @@ package android.app; */ oneway interface IActivityWatcher { void activityResuming(int activityId); void closingSystemDialogs(String reason); }
core/java/android/server/search/SearchDialogWrapper.java +32 −8 Original line number Diff line number Diff line Loading @@ -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"; Loading Loading @@ -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; Loading @@ -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(); } Loading Loading @@ -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 // Loading @@ -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; } } Loading Loading @@ -329,6 +340,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. */ Loading
core/java/android/server/search/SearchManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -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); } }; /** Loading