Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 655332c6 authored by Winson Chung's avatar Winson Chung
Browse files

Creating PinnedStackController.



- Creating a PinnedStackController to keep track of the state of the PIP
  to prevent changes in the system (ie. IME showing) and user interaction
  from clobbering each other.
- Refactoring calls in AM into WM/controller

Test: android.server.cts.ActivityManagerPinnedStackTests

Change-Id: Ie59dfd45d5c54764ba69a589b3b8148845e92cc3
Signed-off-by: default avatarWinson Chung <winsonc@google.com>
parent 4b3c3062
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -299,6 +299,8 @@ LOCAL_SRC_FILES += \
	core/java/android/view/IInputFilter.aidl \
	core/java/android/view/IInputFilterHost.aidl \
	core/java/android/view/IOnKeyguardExitResult.aidl \
	core/java/android/view/IPinnedStackController.aidl \
	core/java/android/view/IPinnedStackListener.aidl \
	core/java/android/view/IRotationWatcher.aidl \
	core/java/android/view/IWindow.aidl \
	core/java/android/view/IWindowFocusObserver.aidl \
+0 −46
Original line number Diff line number Diff line
@@ -2940,22 +2940,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            reply.writeNoException();
            return true;
        }
        case GET_DEFAULT_PICTURE_IN_PICTURE_BOUNDS_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            final int displayId = data.readInt();
            Rect r = getDefaultPictureInPictureBounds(displayId);
            reply.writeNoException();
            r.writeToParcel(reply, 0);
            return true;
        }
        case GET_PICTURE_IN_PICTURE_MOVEMENT_BOUNDS_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            final int displayId = data.readInt();
            Rect r = getPictureInPictureMovementBounds(displayId);
            reply.writeNoException();
            r.writeToParcel(reply, 0);
            return true;
        }
        case SET_VR_MODE_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            final IBinder token = data.readStrongBinder();
@@ -7026,36 +7010,6 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    @Override
    public Rect getDefaultPictureInPictureBounds(int displayId) throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(displayId);
        mRemote.transact(GET_DEFAULT_PICTURE_IN_PICTURE_BOUNDS_TRANSACTION, data, reply, 0);
        reply.readException();
        Rect rect = Rect.CREATOR.createFromParcel(reply);
        data.recycle();
        reply.recycle();
        return rect;
    }

    @Override
    public Rect getPictureInPictureMovementBounds(int displayId) throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(displayId);
        mRemote.transact(GET_PICTURE_IN_PICTURE_MOVEMENT_BOUNDS_TRANSACTION, data, reply, 0);
        reply.readException();
        Rect rect = Rect.CREATOR.createFromParcel(reply);
        data.recycle();
        reply.recycle();
        return rect;
    }

    @Override
    public boolean isAppForeground(int uid) throws RemoteException {
        Parcel data = Parcel.obtain();
+2 −14
Original line number Diff line number Diff line
@@ -658,16 +658,6 @@ public interface IActivityManager extends IInterface {

    public void enterPictureInPictureMode(IBinder token) throws RemoteException;

    /**
     * @return the default bounds of the PIP on the default display.
     */
    public Rect getDefaultPictureInPictureBounds(int displayId) throws RemoteException;

    /**
     * @return the movement bounds of the PIP on the default display.
     */
    public Rect getPictureInPictureMovementBounds(int displayId) throws RemoteException;

    public int setVrMode(IBinder token, boolean enabled, ComponentName packageName)
            throws RemoteException;

@@ -1112,8 +1102,6 @@ public interface IActivityManager extends IInterface {

    // Start of O transactions
    int REQUEST_ACTIVITY_RELAUNCH = IBinder.FIRST_CALL_TRANSACTION+400;
    int GET_DEFAULT_PICTURE_IN_PICTURE_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 401;
    int GET_PICTURE_IN_PICTURE_MOVEMENT_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 402;
    int UPDATE_DISPLAY_OVERRIDE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 403;
    int UNREGISTER_TASK_STACK_LISTENER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+404;
    int UPDATE_DISPLAY_OVERRIDE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 401;
    int UNREGISTER_TASK_STACK_LISTENER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+402;
}
+33 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2016, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

import android.graphics.Rect;

/**
 * An interface to the PinnedStackController to update it of state changes, and to query
 * information based on the current state.
 *
 * @hide
 */
interface IPinnedStackController {

    /**
     * Notifies the controller that the user is currently interacting with the PIP.
     */
    oneway void setInInteractiveMode(boolean inInteractiveMode);
}
+39 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2016, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

import android.view.IPinnedStackController;

/**
  * Listener for changes to the pinned stack made by the WindowManager.
  *
  * @hide
  */
oneway interface IPinnedStackListener {

    /**
     * Called when the listener is registered and provides an interface to call back to the pinned
     * stack controller to update the controller of the pinned stack state.
     */
    void onListenerRegistered(IPinnedStackController controller);

    /**
     * Called when window manager decides to adjust the pinned stack bounds, or when the listener
     * is first registered to allow the listener to synchronized its state with the controller.
     */
    void onBoundsChanged(boolean adjustedForIme);
}
Loading