Semi-workaround for #2027266: app drawer showing up on the side of the screen
(when booted while docked)
This isn't really a fix, but we now have the activity report the configuration
it actually launched in, so the activity manager will later adjust it if
needed. Should help us recover from hitting the race in this particular case.
Change-Id: I3bb83a48c2d692b4cb1822d8ae7d924cfa9187b2
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 2d7658a..3b8aee9 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -315,8 +315,12 @@
case ACTIVITY_IDLE_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
IBinder token = data.readStrongBinder();
+ Configuration config = null;
+ if (data.readInt() != 0) {
+ config = Configuration.CREATOR.createFromParcel(data);
+ }
if (token != null) {
- activityIdle(token);
+ activityIdle(token, config);
}
reply.writeNoException();
return true;
@@ -1397,12 +1401,18 @@
data.recycle();
reply.recycle();
}
- public void activityIdle(IBinder token) throws RemoteException
+ public void activityIdle(IBinder token, Configuration config) throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(token);
+ if (config != null) {
+ data.writeInt(1);
+ config.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
reply.readException();
data.recycle();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index fc00a4c..b4ac159 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1116,6 +1116,7 @@
boolean stopped;
boolean hideForNow;
Configuration newConfig;
+ Configuration createdConfig;
ActivityRecord nextIdle;
ActivityInfo activityInfo;
@@ -1944,7 +1945,8 @@
(a.activity != null ? a.activity.mFinished : false));
if (a.activity != null && !a.activity.mFinished) {
try {
- am.activityIdle(a.token);
+ am.activityIdle(a.token, a.createdConfig);
+ a.createdConfig = null;
} catch (RemoteException ex) {
}
}
@@ -2464,6 +2466,7 @@
Activity a = performLaunchActivity(r, customIntent);
if (a != null) {
+ r.createdConfig = new Configuration(a.getResources().getConfiguration());
handleResumeActivity(r.token, false, r.isForward);
if (!r.activity.mFinished && r.startsNotResumed) {
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 7ad7561..9f505ac 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -109,7 +109,7 @@
public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException;
public void attachApplication(IApplicationThread app) throws RemoteException;
/* oneway */
- public void activityIdle(IBinder token) throws RemoteException;
+ public void activityIdle(IBinder token, Configuration config) throws RemoteException;
public void activityPaused(IBinder token, Bundle state) throws RemoteException;
/* oneway */
public void activityStopped(IBinder token,