Merge "Use ParceledListSlice in a generic manner"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7189e147e5
@@ -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)
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ public class PipControlsViewController {
|
||||
/**
|
||||
* Updates the set of activity-defined actions.
|
||||
*/
|
||||
public void setActions(List<RemoteAction> actions) {
|
||||
public void setActions(List<? extends RemoteAction> actions) {
|
||||
mCustomActions.clear();
|
||||
mCustomActions.addAll(actions);
|
||||
updateUserActions();
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.app.ActivityManager.StackInfo;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.app.IActivityTaskManager;
|
||||
import android.app.RemoteAction;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -135,7 +136,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
||||
private MediaController mPipMediaController;
|
||||
private String[] mLastPackagesResourceGranted;
|
||||
private PipNotification mPipNotification;
|
||||
private ParceledListSlice mCustomActions;
|
||||
private ParceledListSlice<RemoteAction> mCustomActions;
|
||||
private int mResizeAnimationDuration;
|
||||
|
||||
// Used to calculate the movement bounds
|
||||
@@ -220,7 +221,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionsChanged(ParceledListSlice actions) {
|
||||
public void onActionsChanged(ParceledListSlice<RemoteAction> actions) {
|
||||
mCustomActions = actions;
|
||||
mHandler.post(() -> {
|
||||
for (int i = mListeners.size() - 1; i >= 0; --i) {
|
||||
@@ -764,7 +765,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
||||
/** Invoked when the PIP menu gets shown. */
|
||||
void onShowPipMenu();
|
||||
/** Invoked when the PIP menu actions change. */
|
||||
void onPipMenuActionsChanged(ParceledListSlice actions);
|
||||
void onPipMenuActionsChanged(ParceledListSlice<RemoteAction> actions);
|
||||
/** Invoked when the PIPed activity is about to return back to the fullscreen. */
|
||||
void onMoveToFullscreen();
|
||||
/** Invoked when we are above to start resizing the Pip. */
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.systemui.pip.tv;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorInflater;
|
||||
import android.app.Activity;
|
||||
import android.app.RemoteAction;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ParceledListSlice;
|
||||
import android.os.Bundle;
|
||||
@@ -149,12 +150,12 @@ public class PipMenuActivity extends Activity implements PipManager.Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPipMenuActionsChanged(ParceledListSlice actions) {
|
||||
public void onPipMenuActionsChanged(ParceledListSlice<RemoteAction> actions) {
|
||||
if (DEBUG) Log.d(TAG, "onPipMenuActionsChanged()");
|
||||
|
||||
boolean hasCustomActions = actions != null && !actions.getList().isEmpty();
|
||||
mPipControlsViewController.setActions(
|
||||
hasCustomActions ? actions.getList() : Collections.EMPTY_LIST);
|
||||
hasCustomActions ? actions.getList() : Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.systemui.pip.tv;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.RemoteAction;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -89,7 +90,7 @@ public class PipNotification {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPipMenuActionsChanged(ParceledListSlice actions) {
|
||||
public void onPipMenuActionsChanged(ParceledListSlice<RemoteAction> actions) {
|
||||
// no-op.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user