am 2fd3cb95
: Merge "Fix ActivityContainer callback parcelling." into klp-modular-dev
* commit '2fd3cb9544df1e09caa725a8d542cf2fe1df0c75': Fix ActivityContainer callback parcelling.
This commit is contained in:
@ -1998,7 +1998,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
|||||||
data.enforceInterface(IActivityManager.descriptor);
|
data.enforceInterface(IActivityManager.descriptor);
|
||||||
IBinder parentActivityToken = data.readStrongBinder();
|
IBinder parentActivityToken = data.readStrongBinder();
|
||||||
IActivityContainerCallback callback =
|
IActivityContainerCallback callback =
|
||||||
(IActivityContainerCallback) data.readStrongBinder();
|
IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
|
||||||
IActivityContainer activityContainer =
|
IActivityContainer activityContainer =
|
||||||
createActivityContainer(parentActivityToken, callback);
|
createActivityContainer(parentActivityToken, callback);
|
||||||
reply.writeNoException();
|
reply.writeNoException();
|
||||||
@ -4627,7 +4627,7 @@ class ActivityManagerProxy implements IActivityManager
|
|||||||
Parcel reply = Parcel.obtain();
|
Parcel reply = Parcel.obtain();
|
||||||
data.writeInterfaceToken(IActivityManager.descriptor);
|
data.writeInterfaceToken(IActivityManager.descriptor);
|
||||||
data.writeStrongBinder(parentActivityToken);
|
data.writeStrongBinder(parentActivityToken);
|
||||||
data.writeStrongBinder((IBinder)callback);
|
data.writeStrongBinder(callback == null ? null : callback.asBinder());
|
||||||
mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
|
mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
|
||||||
reply.readException();
|
reply.readException();
|
||||||
final int result = reply.readInt();
|
final int result = reply.readInt();
|
||||||
|
@ -92,8 +92,8 @@ public class ActivityView extends ViewGroup {
|
|||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
try {
|
try {
|
||||||
final IBinder token = mActivity.getActivityToken();
|
final IBinder token = mActivity.getActivityToken();
|
||||||
mActivityContainer =
|
mActivityContainer = ActivityManagerNative.getDefault().createActivityContainer(token,
|
||||||
ActivityManagerNative.getDefault().createActivityContainer(token, null);
|
new ActivityContainerCallback());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw new IllegalStateException("ActivityView: Unable to create ActivityContainer. "
|
throw new IllegalStateException("ActivityView: Unable to create ActivityContainer. "
|
||||||
+ e);
|
+ e);
|
||||||
@ -282,4 +282,14 @@ public class ActivityView extends ViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ActivityContainerCallback extends IActivityContainerCallback.Stub {
|
||||||
|
@Override
|
||||||
|
public void setVisible(IBinder container, boolean visible) {
|
||||||
|
if (DEBUG) Log.v(TAG, "setVisible(): container=" + container + " visible=" + visible);
|
||||||
|
if (visible) {
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,5 @@ import android.os.IBinder;
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
interface IActivityContainerCallback {
|
interface IActivityContainerCallback {
|
||||||
oneway void onLastActivityRemoved(IBinder container);
|
oneway void setVisible(IBinder container, boolean visible);
|
||||||
}
|
}
|
||||||
|
@ -1025,6 +1025,16 @@ final class ActivityStack {
|
|||||||
return mStackSupervisor.isFrontStack(this);
|
return mStackSupervisor.isFrontStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setVisibile(ActivityRecord r, boolean visible) {
|
||||||
|
r.visible = visible;
|
||||||
|
mWindowManager.setAppVisibility(r.appToken, visible);
|
||||||
|
final ArrayList<ActivityStack> containers = r.mChildContainers;
|
||||||
|
for (int containerNdx = containers.size() - 1; containerNdx >= 0; --containerNdx) {
|
||||||
|
ActivityContainer container = containers.get(containerNdx).mActivityContainer;
|
||||||
|
container.setVisible(visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version of ensureActivitiesVisible that can easily be called anywhere.
|
* Version of ensureActivitiesVisible that can easily be called anywhere.
|
||||||
*/
|
*/
|
||||||
@ -1103,8 +1113,7 @@ final class ActivityStack {
|
|||||||
if (!r.visible) {
|
if (!r.visible) {
|
||||||
if (DEBUG_VISBILITY) Slog.v(
|
if (DEBUG_VISBILITY) Slog.v(
|
||||||
TAG, "Starting and making visible: " + r);
|
TAG, "Starting and making visible: " + r);
|
||||||
r.visible = true;
|
setVisibile(r, true);
|
||||||
mWindowManager.setAppVisibility(r.appToken, true);
|
|
||||||
}
|
}
|
||||||
if (r != starting) {
|
if (r != starting) {
|
||||||
mStackSupervisor.startSpecificActivityLocked(r, false, false);
|
mStackSupervisor.startSpecificActivityLocked(r, false, false);
|
||||||
@ -1130,7 +1139,7 @@ final class ActivityStack {
|
|||||||
if (mTranslucentActivityWaiting != null) {
|
if (mTranslucentActivityWaiting != null) {
|
||||||
mUndrawnActivitiesBelowTopTranslucent.add(r);
|
mUndrawnActivitiesBelowTopTranslucent.add(r);
|
||||||
}
|
}
|
||||||
mWindowManager.setAppVisibility(r.appToken, true);
|
setVisibile(r, true);
|
||||||
r.sleeping = false;
|
r.sleeping = false;
|
||||||
r.app.pendingUiClean = true;
|
r.app.pendingUiClean = true;
|
||||||
r.app.thread.scheduleWindowVisibility(r.appToken, true);
|
r.app.thread.scheduleWindowVisibility(r.appToken, true);
|
||||||
@ -1166,9 +1175,8 @@ final class ActivityStack {
|
|||||||
// sure they no longer are keeping the screen frozen.
|
// sure they no longer are keeping the screen frozen.
|
||||||
if (r.visible) {
|
if (r.visible) {
|
||||||
if (DEBUG_VISBILITY) Slog.v(TAG, "Making invisible: " + r);
|
if (DEBUG_VISBILITY) Slog.v(TAG, "Making invisible: " + r);
|
||||||
r.visible = false;
|
|
||||||
try {
|
try {
|
||||||
mWindowManager.setAppVisibility(r.appToken, false);
|
setVisibile(r, false);
|
||||||
switch (r.state) {
|
switch (r.state) {
|
||||||
case STOPPING:
|
case STOPPING:
|
||||||
case STOPPED:
|
case STOPPED:
|
||||||
|
@ -126,6 +126,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
static final int HANDLE_DISPLAY_ADDED = FIRST_SUPERVISOR_STACK_MSG + 5;
|
static final int HANDLE_DISPLAY_ADDED = FIRST_SUPERVISOR_STACK_MSG + 5;
|
||||||
static final int HANDLE_DISPLAY_CHANGED = FIRST_SUPERVISOR_STACK_MSG + 6;
|
static final int HANDLE_DISPLAY_CHANGED = FIRST_SUPERVISOR_STACK_MSG + 6;
|
||||||
static final int HANDLE_DISPLAY_REMOVED = FIRST_SUPERVISOR_STACK_MSG + 7;
|
static final int HANDLE_DISPLAY_REMOVED = FIRST_SUPERVISOR_STACK_MSG + 7;
|
||||||
|
static final int CONTAINER_CALLBACK_VISIBILITY = FIRST_SUPERVISOR_STACK_MSG + 8;
|
||||||
|
|
||||||
private final static String VIRTUAL_DISPLAY_BASE_NAME = "ActivityViewVirtualDisplay";
|
private final static String VIRTUAL_DISPLAY_BASE_NAME = "ActivityViewVirtualDisplay";
|
||||||
|
|
||||||
@ -2952,6 +2953,14 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
case HANDLE_DISPLAY_REMOVED: {
|
case HANDLE_DISPLAY_REMOVED: {
|
||||||
handleDisplayRemovedLocked(msg.arg1);
|
handleDisplayRemovedLocked(msg.arg1);
|
||||||
} break;
|
} break;
|
||||||
|
case CONTAINER_CALLBACK_VISIBILITY: {
|
||||||
|
final ActivityContainer container = (ActivityContainer) msg.obj;
|
||||||
|
try {
|
||||||
|
// We only send this message if mCallback is non-null.
|
||||||
|
container.mCallback.setVisible(container.asBinder(), msg.arg1 == 1);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2963,6 +2972,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
final ActivityRecord mParentActivity;
|
final ActivityRecord mParentActivity;
|
||||||
final String mIdString;
|
final String mIdString;
|
||||||
|
|
||||||
|
boolean mVisible = true;
|
||||||
|
|
||||||
/** Display this ActivityStack is currently on. Null if not attached to a Display. */
|
/** Display this ActivityStack is currently on. Null if not attached to a Display. */
|
||||||
ActivityDisplay mActivityDisplay;
|
ActivityDisplay mActivityDisplay;
|
||||||
|
|
||||||
@ -3110,6 +3121,16 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setVisible(boolean visible) {
|
||||||
|
if (mVisible != visible) {
|
||||||
|
mVisible = visible;
|
||||||
|
if (mCallback != null) {
|
||||||
|
mHandler.obtainMessage(CONTAINER_CALLBACK_VISIBILITY, visible ? 1 : 0,
|
||||||
|
0 /* unused */, this).sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return mIdString + (mActivityDisplay == null ? "N" : "A");
|
return mIdString + (mActivityDisplay == null ? "N" : "A");
|
||||||
|
Reference in New Issue
Block a user