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

Commit 7189e147 authored by Nikolas Havrikov's avatar Nikolas Havrikov Committed by Android (Google) Code Review
Browse files

Merge "Use ParceledListSlice in a generic manner"

parents 43a667fa 24b3591d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import android.app.RemoteAction;
import android.content.ComponentName;
import android.content.pm.ParceledListSlice;
import android.graphics.Rect;
@@ -51,9 +52,9 @@ oneway interface IPinnedStackListener {

    /**
     * Called when the set of actions for the current PiP activity changes, or when the listener
     * is first registered to allow the listener to synchronized its state with the controller.
     * is first registered to allow the listener to synchronize its state with the controller.
     */
    void onActionsChanged(in ParceledListSlice actions);
    void onActionsChanged(in ParceledListSlice<RemoteAction> actions);

    /**
     * Called by the window manager to notify the listener that Activity (was or is in pinned mode)
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.shared.system;

import android.app.RemoteAction;
import android.content.ComponentName;
import android.content.pm.ParceledListSlice;
import android.view.DisplayInfo;
@@ -66,7 +67,7 @@ public class PinnedStackListenerForwarder extends IPinnedStackListener.Stub {
    }

    @Override
    public void onActionsChanged(ParceledListSlice actions) {
    public void onActionsChanged(ParceledListSlice<RemoteAction> actions) {
        for (PinnedStackListener listener : mListeners) {
            listener.onActionsChanged(actions);
        }
@@ -111,7 +112,7 @@ public class PinnedStackListenerForwarder extends IPinnedStackListener.Stub {

        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {}

        public void onActionsChanged(ParceledListSlice actions) {}
        public void onActionsChanged(ParceledListSlice<RemoteAction> actions) {}

        public void onActivityHidden(ComponentName componentName) {}

+2 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityTaskManager;
import android.app.IActivityManager;
import android.app.RemoteAction;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ParceledListSlice;
@@ -209,7 +210,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
        }

        @Override
        public void onActionsChanged(ParceledListSlice actions) {
        public void onActionsChanged(ParceledListSlice<RemoteAction> actions) {
            mHandler.post(() -> mMenuController.setAppActions(actions));
        }

+4 −3
Original line number Diff line number Diff line
@@ -162,9 +162,10 @@ public class PipMenuActivity extends Activity {
                    break;
                case MESSAGE_UPDATE_ACTIONS: {
                    final Bundle data = (Bundle) msg.obj;
                    final ParceledListSlice actions = data.getParcelable(EXTRA_ACTIONS);
                    final ParceledListSlice<RemoteAction> actions = data.getParcelable(
                            EXTRA_ACTIONS);
                    setActions(data.getParcelable(EXTRA_STACK_BOUNDS), actions != null
                            ? actions.getList() : Collections.EMPTY_LIST);
                            ? actions.getList() : Collections.emptyList());
                    break;
                }
                case MESSAGE_UPDATE_DISMISS_FRACTION: {
@@ -496,7 +497,7 @@ public class PipMenuActivity extends Activity {
        }
        notifyActivityCallback(mMessenger);

        ParceledListSlice actions = intent.getParcelableExtra(EXTRA_ACTIONS);
        ParceledListSlice<RemoteAction> actions = intent.getParcelableExtra(EXTRA_ACTIONS);
        if (actions != null) {
            mActions.clear();
            mActions.addAll(actions.getList());
+5 −5
Original line number Diff line number Diff line
@@ -115,8 +115,8 @@ public class PipMenuActivityController {
    private InputConsumerController mInputConsumerController;

    private ArrayList<Listener> mListeners = new ArrayList<>();
    private ParceledListSlice mAppActions;
    private ParceledListSlice mMediaActions;
    private ParceledListSlice<RemoteAction> mAppActions;
    private ParceledListSlice<RemoteAction> mMediaActions;
    private int mMenuState;

    // The dismiss fraction update is sent frequently, so use a temporary bundle for the message
@@ -429,7 +429,7 @@ public class PipMenuActivityController {
    /**
     * Sets the menu actions to the actions provided by the current PiP activity.
     */
    public void setAppActions(ParceledListSlice appActions) {
    public void setAppActions(ParceledListSlice<RemoteAction> appActions) {
        mAppActions = appActions;
        updateMenuActions();
    }
@@ -437,7 +437,7 @@ public class PipMenuActivityController {
    /**
     * @return the best set of actions to show in the PiP menu.
     */
    private ParceledListSlice resolveMenuActions() {
    private ParceledListSlice<RemoteAction> resolveMenuActions() {
        if (isValidActions(mAppActions)) {
            return mAppActions;
        }
@@ -515,7 +515,7 @@ public class PipMenuActivityController {
    /**
     * Returns whether the set of actions are valid.
     */
    private boolean isValidActions(ParceledListSlice actions) {
    private static boolean isValidActions(ParceledListSlice<?> actions) {
        return actions != null && actions.getList().size() > 0;
    }

Loading