diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-05-19 18:37:45 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-05-19 18:46:53 -0700 |
commit | 95fc68f24a2a93e5664e2234abcfe479d385cc05 (patch) | |
tree | 6f8f8071cf8a69d82fd16c1d5455ea81d31e1275 /core/java/android | |
parent | ee748d37b01b3affb72b701d95ba20c189887b5f (diff) | |
download | frameworks_base-95fc68f24a2a93e5664e2234abcfe479d385cc05.zip frameworks_base-95fc68f24a2a93e5664e2234abcfe479d385cc05.tar.gz frameworks_base-95fc68f24a2a93e5664e2234abcfe479d385cc05.tar.bz2 |
Fix issue where apps could prevent the user from going home.
Now we have a 5-second time after home is pressed, during which
only the home app (and the status bar) can switch to another app.
After that time, any start activity requests that occurred will
be executed, to allow things like alarms to be displayed. Also
if during that time the user launches another app, the pending
starts will be executed without resuming their activities and
the one they started placed at the top and executed.
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 34 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 26 |
2 files changed, 60 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 541f413..16f0a30 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -998,6 +998,20 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case STOP_APP_SWITCHES_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + stopAppSwitches(); + reply.writeNoException(); + return true; + } + + case RESUME_APP_SWITCHES_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + resumeAppSwitches(); + reply.writeNoException(); + return true; + } + case PEEK_SERVICE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); Intent service = Intent.CREATOR.createFromParcel(data); @@ -2182,5 +2196,25 @@ class ActivityManagerProxy implements IActivityManager return res; } + public void stopAppSwitches() throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0); + reply.readException(); + reply.recycle(); + data.recycle(); + } + + public void resumeAppSwitches() throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0); + reply.readException(); + reply.recycle(); + data.recycle(); + } + private IBinder mRemote; } diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 56b29c1..d15a154 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -44,9 +44,30 @@ import java.util.List; * {@hide} */ public interface IActivityManager extends IInterface { + /** + * Returned by startActivity() if the start request was canceled because + * app switches are temporarily canceled to ensure the user's last request + * (such as pressing home) is performed. + */ + public static final int START_SWITCHES_CANCELED = 4; + /** + * Returned by startActivity() if an activity wasn't really started, but + * the given Intent was given to the existing top activity. + */ public static final int START_DELIVERED_TO_TOP = 3; + /** + * Returned by startActivity() if an activity wasn't really started, but + * a task was simply brought to the foreground. + */ public static final int START_TASK_TO_FRONT = 2; + /** + * Returned by startActivity() if the caller asked that the Intent not + * be executed if it is the recipient, and that is indeed the case. + */ public static final int START_RETURN_INTENT_TO_CALLER = 1; + /** + * Activity was started successfully as normal. + */ public static final int START_SUCCESS = 0; public static final int START_INTENT_NOT_RESOLVED = -1; public static final int START_CLASS_NOT_FOUND = -2; @@ -225,6 +246,9 @@ public interface IActivityManager extends IInterface { public boolean shutdown(int timeout) throws RemoteException; + public void stopAppSwitches() throws RemoteException; + public void resumeAppSwitches() throws RemoteException; + /* * Private non-Binder interfaces */ @@ -371,4 +395,6 @@ public interface IActivityManager extends IInterface { int PEEK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+84; int PROFILE_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+85; int SHUTDOWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+86; + int STOP_APP_SWITCHES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+87; + int RESUME_APP_SWITCHES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+88; } |