summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityManagerNative.java29
-rw-r--r--core/java/android/app/ActivityThread.java5
-rw-r--r--core/java/android/app/IActivityManager.java5
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java10
4 files changed, 17 insertions, 32 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index e8d08b8..8c57169 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -17,7 +17,6 @@
package android.app;
import android.app.ActivityManager.StackInfo;
-import android.app.ProfilerInfo;
import android.content.ComponentName;
import android.content.IIntentReceiver;
import android.content.IIntentSender;
@@ -2209,17 +2208,12 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
return true;
}
- case GET_ACTIVITY_CONTAINER_TRANSACTION: {
+ case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
IBinder activityToken = data.readStrongBinder();
- IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
+ int displayId = getActivityDisplayId(activityToken);
reply.writeNoException();
- if (activityContainer != null) {
- reply.writeInt(1);
- reply.writeStrongBinder(activityContainer.asBinder());
- } else {
- reply.writeInt(0);
- }
+ reply.writeInt(displayId);
return true;
}
@@ -5238,26 +5232,21 @@ class ActivityManagerProxy implements IActivityManager
reply.recycle();
}
- public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
- throws RemoteException {
+ @Override
+ public int getActivityDisplayId(IBinder activityToken) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(activityToken);
- mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
+ mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
reply.readException();
- final int result = reply.readInt();
- final IActivityContainer res;
- if (result == 1) {
- res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
- } else {
- res = null;
- }
+ final int displayId = reply.readInt();
data.recycle();
reply.recycle();
- return res;
+ return displayId;
}
+ @Override
public IBinder getHomeActivityToken() throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index f2be45c..8353d54 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -2339,10 +2339,7 @@ public final class ActivityThread {
final DisplayManagerGlobal dm = DisplayManagerGlobal.getInstance();
try {
- IActivityContainer container =
- ActivityManagerNative.getDefault().getEnclosingActivityContainer(r.token);
- final int displayId =
- container == null ? Display.DEFAULT_DISPLAY : container.getDisplayId();
+ final int displayId = ActivityManagerNative.getDefault().getActivityDisplayId(r.token);
if (displayId > Display.DEFAULT_DISPLAY) {
Display display = dm.getRealDisplay(displayId, r.token);
baseContext = appContext.createDisplayContext(display);
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index e505d69..dd3a38b 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -438,8 +438,7 @@ public interface IActivityManager extends IInterface {
public void deleteActivityContainer(IActivityContainer container) throws RemoteException;
- public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
- throws RemoteException;
+ public int getActivityDisplayId(IBinder activityToken) throws RemoteException;
public IBinder getHomeActivityToken() throws RemoteException;
@@ -754,7 +753,7 @@ public interface IActivityManager extends IInterface {
int GET_PERSISTED_URI_PERMISSIONS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+181;
int APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+182;
int GET_HOME_ACTIVITY_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+183;
- int GET_ACTIVITY_CONTAINER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+184;
+ int GET_ACTIVITY_DISPLAY_ID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+184;
int DELETE_ACTIVITY_CONTAINER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+185;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index e8f3757..2ab447a 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -57,6 +57,7 @@ import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.SparseIntArray;
+import android.view.Display;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IAppOpsService;
@@ -8663,14 +8664,13 @@ public final class ActivityManagerService extends ActivityManagerNative
}
@Override
- public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
- throws RemoteException {
+ public int getActivityDisplayId(IBinder activityToken) throws RemoteException {
synchronized (this) {
ActivityStack stack = ActivityRecord.getStackLocked(activityToken);
- if (stack != null) {
- return stack.mActivityContainer;
+ if (stack != null && stack.mActivityContainer.isAttachedLocked()) {
+ return stack.mActivityContainer.getDisplayId();
}
- return null;
+ return Display.DEFAULT_DISPLAY;
}
}