Remove if(DEBUG) around ProtoLogs for TV PiP code
When the logs were switched to ProtoLogs the if(DEBUG) statements to prevent spamming the logs were kept, however they are not needed since the ProtoLogs can be turned on and off on demand (off by default) Bug: 218457585 Test: manual - enable logs (adb shell wm logging enable-text WM_SHELL_PICTURE_IN_PICTURE) and all logs should be present Change-Id: Ib29838f3f1d359bd1fd74b4e83a23eafa3a2f207
This commit is contained in:
@@ -48,11 +48,10 @@ import java.util.Set;
|
||||
* Contains pip bounds calculations that are specific to TV.
|
||||
*/
|
||||
public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
|
||||
private static final String TAG = TvPipBoundsAlgorithm.class.getSimpleName();
|
||||
private static final boolean DEBUG = TvPipController.DEBUG;
|
||||
|
||||
private final @NonNull TvPipBoundsState mTvPipBoundsState;
|
||||
@NonNull
|
||||
private final TvPipBoundsState mTvPipBoundsState;
|
||||
|
||||
private int mFixedExpandedHeightInPx;
|
||||
private int mFixedExpandedWidthInPx;
|
||||
@@ -89,10 +88,9 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
/** Returns the destination bounds to place the PIP window on entry. */
|
||||
@Override
|
||||
public Rect getEntryDestinationBounds() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: getEntryDestinationBounds()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: getEntryDestinationBounds()", TAG);
|
||||
|
||||
updateExpandedPipSize();
|
||||
final boolean isPipExpanded = mTvPipBoundsState.isTvExpandedPipSupported()
|
||||
&& mTvPipBoundsState.getDesiredTvExpandedAspectRatio() != 0
|
||||
@@ -107,10 +105,8 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
/** Returns the current bounds adjusted to the new aspect ratio, if valid. */
|
||||
@Override
|
||||
public Rect getAdjustedDestinationBounds(Rect currentBounds, float newAspectRatio) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: getAdjustedDestinationBounds: %f", TAG, newAspectRatio);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: getAdjustedDestinationBounds: %f", TAG, newAspectRatio);
|
||||
return adjustBoundsForTemporaryDecor(getTvPipPlacement().getBounds());
|
||||
}
|
||||
|
||||
@@ -154,24 +150,22 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
restrictedKeepClearAreas,
|
||||
unrestrictedKeepClearAreas);
|
||||
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: screenSize: %s", TAG, screenSize);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: stashOffset: %d", TAG, mTvPipBoundsState.getStashOffset());
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: insetBounds: %s", TAG, insetBounds.toShortString());
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: pipSize: %s", TAG, pipSize);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: gravity: %s", TAG, Gravity.toString(mTvPipBoundsState.getTvPipGravity()));
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: restrictedKeepClearAreas: %s", TAG, restrictedKeepClearAreas);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: unrestrictedKeepClearAreas: %s", TAG, unrestrictedKeepClearAreas);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: placement: %s", TAG, placement);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: screenSize: %s", TAG, screenSize);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: stashOffset: %d", TAG, mTvPipBoundsState.getStashOffset());
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: insetBounds: %s", TAG, insetBounds.toShortString());
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: pipSize: %s", TAG, pipSize);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: gravity: %s", TAG, Gravity.toString(mTvPipBoundsState.getTvPipGravity()));
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: restrictedKeepClearAreas: %s", TAG, restrictedKeepClearAreas);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: unrestrictedKeepClearAreas: %s", TAG, unrestrictedKeepClearAreas);
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: placement: %s", TAG, placement);
|
||||
|
||||
return placement;
|
||||
}
|
||||
@@ -180,13 +174,11 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
* @return previous gravity if it is to be saved, or {@link Gravity#NO_GRAVITY} if not.
|
||||
*/
|
||||
int updateGravityOnExpandToggled(int previousGravity, boolean expanding) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateGravityOnExpandToggled(), expanding: %b"
|
||||
+ ", mOrientation: %d, previous gravity: %s",
|
||||
TAG, expanding, mTvPipBoundsState.getTvFixedPipOrientation(),
|
||||
Gravity.toString(previousGravity));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateGravityOnExpandToggled(), expanding: %b"
|
||||
+ ", mOrientation: %d, previous gravity: %s",
|
||||
TAG, expanding, mTvPipBoundsState.getTvFixedPipOrientation(),
|
||||
Gravity.toString(previousGravity));
|
||||
|
||||
if (!mTvPipBoundsState.isTvExpandedPipSupported()) {
|
||||
return Gravity.NO_GRAVITY;
|
||||
@@ -237,10 +229,8 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
}
|
||||
}
|
||||
mTvPipBoundsState.setTvPipGravity(updatedGravity);
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: new gravity: %s", TAG, Gravity.toString(updatedGravity));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: new gravity: %s", TAG, Gravity.toString(updatedGravity));
|
||||
|
||||
return gravityToSave;
|
||||
}
|
||||
@@ -249,10 +239,8 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
* @return true if gravity changed
|
||||
*/
|
||||
boolean updateGravity(int keycode) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateGravity, keycode: %d", TAG, keycode);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateGravity, keycode: %d", TAG, keycode);
|
||||
|
||||
// Check if position change is valid
|
||||
if (mTvPipBoundsState.isTvPipExpanded()) {
|
||||
@@ -309,10 +297,8 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
|
||||
if (updatedGravity != currentGravity) {
|
||||
mTvPipBoundsState.setTvPipGravity(updatedGravity);
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: new gravity: %s", TAG, Gravity.toString(updatedGravity));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: new gravity: %s", TAG, Gravity.toString(updatedGravity));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -343,8 +329,8 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
final Size expandedSize;
|
||||
if (expandedRatio == 0) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateExpandedPipSize(): Expanded mode aspect ratio"
|
||||
+ " of 0 not supported", TAG);
|
||||
"%s: updateExpandedPipSize(): Expanded mode aspect ratio"
|
||||
+ " of 0 not supported", TAG);
|
||||
return;
|
||||
} else if (expandedRatio < 1) {
|
||||
// vertical
|
||||
@@ -356,16 +342,12 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
float aspectRatioHeight = mFixedExpandedWidthInPx / expandedRatio;
|
||||
|
||||
if (maxHeight > aspectRatioHeight) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Accommodate aspect ratio", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Accommodate aspect ratio", TAG);
|
||||
expandedSize = new Size(mFixedExpandedWidthInPx, (int) aspectRatioHeight);
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Aspect ratio is too extreme, use max size", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Aspect ratio is too extreme, use max size", TAG);
|
||||
expandedSize = new Size(mFixedExpandedWidthInPx, maxHeight);
|
||||
}
|
||||
}
|
||||
@@ -378,26 +360,20 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
|
||||
- pipDecorations.left - pipDecorations.right;
|
||||
float aspectRatioWidth = mFixedExpandedHeightInPx * expandedRatio;
|
||||
if (maxWidth > aspectRatioWidth) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Accommodate aspect ratio", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Accommodate aspect ratio", TAG);
|
||||
expandedSize = new Size((int) aspectRatioWidth, mFixedExpandedHeightInPx);
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Aspect ratio is too extreme, use max size", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Aspect ratio is too extreme, use max size", TAG);
|
||||
expandedSize = new Size(maxWidth, mFixedExpandedHeightInPx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mTvPipBoundsState.setTvExpandedSize(expandedSize);
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateExpandedPipSize(): expanded size, width: %d, height: %d",
|
||||
TAG, expandedSize.getWidth(), expandedSize.getHeight());
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateExpandedPipSize(): expanded size, width: %d, height: %d",
|
||||
TAG, expandedSize.getWidth(), expandedSize.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import java.util.function.Supplier;
|
||||
* Manages debouncing of PiP movements and scheduling of unstashing.
|
||||
*/
|
||||
public class TvPipBoundsController {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "TvPipBoundsController";
|
||||
|
||||
/**
|
||||
@@ -133,11 +132,9 @@ public class TvPipBoundsController {
|
||||
|
||||
private void schedulePinnedStackPlacement(@NonNull final Placement placement,
|
||||
int animationDuration) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: schedulePinnedStackPlacement() - pip bounds: %s",
|
||||
TAG, placement.getBounds().toShortString());
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: schedulePinnedStackPlacement() - pip bounds: %s",
|
||||
TAG, placement.getBounds().toShortString());
|
||||
|
||||
if (mPendingPlacement != null && Objects.equals(mPendingPlacement.getBounds(),
|
||||
placement.getBounds())) {
|
||||
@@ -171,10 +168,8 @@ public class TvPipBoundsController {
|
||||
}
|
||||
|
||||
private void applyPendingPlacement() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: applyPendingPlacement()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: applyPendingPlacement()", TAG);
|
||||
if (mPendingPlacement != null) {
|
||||
applyPlacement(mPendingPlacement, mPendingStash, mPendingPlacementAnimationDuration);
|
||||
mPendingStash = false;
|
||||
@@ -226,10 +221,8 @@ public class TvPipBoundsController {
|
||||
}
|
||||
|
||||
mPipTargetBounds = bounds;
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: movePipTo() - new pip bounds: %s", TAG, bounds.toShortString());
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: movePipTo() - new pip bounds: %s", TAG, bounds.toShortString());
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onPipTargetBoundsChange(bounds, animationDuration);
|
||||
|
||||
@@ -70,7 +70,6 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
TvPipNotificationController.Delegate, DisplayController.OnDisplaysChangedListener,
|
||||
ConfigurationChangeListener, UserChangeListener {
|
||||
private static final String TAG = "TvPipController";
|
||||
static final boolean DEBUG = false;
|
||||
|
||||
private static final int NONEXISTENT_TASK_ID = -1;
|
||||
|
||||
@@ -80,7 +79,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
STATE_PIP,
|
||||
STATE_PIP_MENU,
|
||||
})
|
||||
public @interface State {}
|
||||
public @interface State {
|
||||
}
|
||||
|
||||
/**
|
||||
* State when there is no applications in Pip.
|
||||
@@ -117,7 +117,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
private final ShellExecutor mMainExecutor;
|
||||
private final TvPipImpl mImpl = new TvPipImpl();
|
||||
|
||||
private @State int mState = STATE_NO_PIP;
|
||||
@State
|
||||
private int mState = STATE_NO_PIP;
|
||||
private int mPreviousGravity = TvPipBoundsState.DEFAULT_TV_GRAVITY;
|
||||
private int mPinnedTaskId = NONEXISTENT_TASK_ID;
|
||||
|
||||
@@ -236,16 +237,12 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onConfigurationChanged(), state=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onConfigurationChanged(), state=%s", TAG, stateToName(mState));
|
||||
|
||||
if (isPipShown()) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: > closing Pip.", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: > closing Pip.", TAG);
|
||||
closePip();
|
||||
}
|
||||
|
||||
@@ -268,16 +265,12 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
*/
|
||||
@Override
|
||||
public void showPictureInPictureMenu() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showPictureInPictureMenu(), state=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showPictureInPictureMenu(), state=%s", TAG, stateToName(mState));
|
||||
|
||||
if (mState == STATE_NO_PIP) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: > cannot open Menu from the current state.", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: > cannot open Menu from the current state.", TAG);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -288,10 +281,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
|
||||
@Override
|
||||
public void onMenuClosed() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: closeMenu(), state before=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: closeMenu(), state before=%s", TAG, stateToName(mState));
|
||||
setState(STATE_PIP);
|
||||
updatePinnedStackBounds();
|
||||
}
|
||||
@@ -306,10 +297,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
*/
|
||||
@Override
|
||||
public void movePipToFullscreen() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: movePipToFullscreen(), state=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: movePipToFullscreen(), state=%s", TAG, stateToName(mState));
|
||||
|
||||
mPipTaskOrganizer.exitPip(mResizeAnimationDuration, false /* requestEnterSplit */);
|
||||
onPipDisappeared();
|
||||
@@ -317,10 +306,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
|
||||
@Override
|
||||
public void togglePipExpansion() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: togglePipExpansion()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: togglePipExpansion()", TAG);
|
||||
boolean expanding = !mTvPipBoundsState.isTvPipExpanded();
|
||||
int saveGravity = mTvPipBoundsAlgorithm
|
||||
.updateGravityOnExpandToggled(mPreviousGravity, expanding);
|
||||
@@ -347,10 +334,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
mPreviousGravity = Gravity.NO_GRAVITY;
|
||||
updatePinnedStackBounds();
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Position hasn't changed", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: Position hasn't changed", TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,11 +388,9 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
*/
|
||||
@Override
|
||||
public void closePip() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: closePip(), state=%s, loseAction=%s", TAG, stateToName(mState),
|
||||
mCloseAction);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: closePip(), state=%s, loseAction=%s", TAG, stateToName(mState),
|
||||
mCloseAction);
|
||||
|
||||
if (mCloseAction != null) {
|
||||
try {
|
||||
@@ -443,10 +426,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
|
||||
private void checkIfPinnedTaskAppeared() {
|
||||
final TaskInfo pinnedTask = getPinnedTaskInfo();
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: checkIfPinnedTaskAppeared(), task=%s", TAG, pinnedTask);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: checkIfPinnedTaskAppeared(), task=%s", TAG, pinnedTask);
|
||||
if (pinnedTask == null || pinnedTask.topActivity == null) return;
|
||||
mPinnedTaskId = pinnedTask.taskId;
|
||||
|
||||
@@ -455,10 +436,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
}
|
||||
|
||||
private void checkIfPinnedTaskIsGone() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onTaskStackChanged()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onTaskStackChanged()", TAG);
|
||||
|
||||
if (isPipShown() && getPinnedTaskInfo() == null) {
|
||||
ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
@@ -468,10 +447,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
}
|
||||
|
||||
private void onPipDisappeared() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipDisappeared() state=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipDisappeared() state=%s", TAG, stateToName(mState));
|
||||
|
||||
mPipNotificationController.dismiss();
|
||||
mTvPipMenuController.closeMenu();
|
||||
@@ -483,19 +460,15 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
|
||||
@Override
|
||||
public void onPipTransitionStarted(int direction, Rect pipBounds) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipTransition_Started(), state=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipTransition_Started(), state=%s", TAG, stateToName(mState));
|
||||
mTvPipMenuController.notifyPipAnimating(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPipTransitionCanceled(int direction) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipTransition_Canceled(), state=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipTransition_Canceled(), state=%s", TAG, stateToName(mState));
|
||||
mTvPipMenuController.notifyPipAnimating(false);
|
||||
}
|
||||
|
||||
@@ -504,19 +477,15 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
if (PipAnimationController.isInPipDirection(direction) && mState == STATE_NO_PIP) {
|
||||
setState(STATE_PIP);
|
||||
}
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipTransition_Finished(), state=%s", TAG, stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipTransition_Finished(), state=%s", TAG, stateToName(mState));
|
||||
mTvPipMenuController.notifyPipAnimating(false);
|
||||
}
|
||||
|
||||
private void setState(@State int state) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setState(), state=%s, prev=%s",
|
||||
TAG, stateToName(state), stateToName(mState));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setState(), state=%s, prev=%s",
|
||||
TAG, stateToName(state), stateToName(mState));
|
||||
mState = state;
|
||||
}
|
||||
|
||||
@@ -550,11 +519,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
|
||||
boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
|
||||
if (task.getWindowingMode() == WINDOWING_MODE_PINNED) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPinnedActivityRestartAttempt()", TAG);
|
||||
}
|
||||
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPinnedActivityRestartAttempt()", TAG);
|
||||
// If the "Pip-ed" Activity is launched again by Launcher or intent, make it
|
||||
// fullscreen.
|
||||
movePipToFullscreen();
|
||||
@@ -569,7 +535,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
public void onActionsChanged(List<RemoteAction> actions,
|
||||
RemoteAction closeAction) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onActionsChanged()", TAG);
|
||||
"%s: onActionsChanged()", TAG);
|
||||
|
||||
mTvPipMenuController.setAppActions(actions, closeAction);
|
||||
mCloseAction = closeAction;
|
||||
@@ -578,7 +544,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
@Override
|
||||
public void onAspectRatioChanged(float ratio) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onAspectRatioChanged: %f", TAG, ratio);
|
||||
"%s: onAspectRatioChanged: %f", TAG, ratio);
|
||||
|
||||
mTvPipBoundsState.setAspectRatio(ratio);
|
||||
if (!mTvPipBoundsState.isTvPipExpanded()) {
|
||||
@@ -589,7 +555,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
@Override
|
||||
public void onExpandedAspectRatioChanged(float ratio) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onExpandedAspectRatioChanged: %f", TAG, ratio);
|
||||
"%s: onExpandedAspectRatioChanged: %f", TAG, ratio);
|
||||
|
||||
mTvPipBoundsState.setDesiredTvExpandedAspectRatio(ratio, false);
|
||||
mTvPipMenuController.updateExpansionState();
|
||||
@@ -635,11 +601,9 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
wmShell.addPinnedStackListener(new PinnedStackListenerForwarder.PinnedTaskListener() {
|
||||
@Override
|
||||
public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onImeVisibilityChanged(), visible=%b, height=%d",
|
||||
TAG, imeVisible, imeHeight);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onImeVisibilityChanged(), visible=%b, height=%d",
|
||||
TAG, imeVisible, imeHeight);
|
||||
|
||||
if (imeVisible == mTvPipBoundsState.isImeShowing()
|
||||
&& (!imeVisible || imeHeight == mTvPipBoundsState.getImeHeight())) {
|
||||
@@ -661,17 +625,13 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
}
|
||||
|
||||
private static TaskInfo getPinnedTaskInfo() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: getPinnedTaskInfo()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: getPinnedTaskInfo()", TAG);
|
||||
try {
|
||||
final TaskInfo taskInfo = ActivityTaskManager.getService().getRootTaskInfo(
|
||||
WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: taskInfo=%s", TAG, taskInfo);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: taskInfo=%s", TAG, taskInfo);
|
||||
return taskInfo;
|
||||
} catch (RemoteException e) {
|
||||
ProtoLog.e(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
@@ -681,10 +641,8 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
|
||||
}
|
||||
|
||||
private static void removeTask(int taskId) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: removeTask(), taskId=%d", TAG, taskId);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: removeTask(), taskId=%d", TAG, taskId);
|
||||
try {
|
||||
ActivityTaskManager.getService().removeTask(taskId);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -54,7 +54,6 @@ import java.util.Objects;
|
||||
*/
|
||||
public class TvPipMenuController implements PipMenuController, TvPipMenuView.Listener {
|
||||
private static final String TAG = "TvPipMenuController";
|
||||
private static final boolean DEBUG = TvPipController.DEBUG;
|
||||
private static final String BACKGROUND_WINDOW_TITLE = "PipBackgroundView";
|
||||
|
||||
private final Context mContext;
|
||||
@@ -119,10 +118,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
}
|
||||
|
||||
void setDelegate(Delegate delegate) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setDelegate(), delegate=%s", TAG, delegate);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setDelegate(), delegate=%s", TAG, delegate);
|
||||
if (mDelegate != null) {
|
||||
throw new IllegalStateException(
|
||||
"The delegate has already been set and should not change.");
|
||||
@@ -145,10 +142,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
}
|
||||
|
||||
private void attachPipMenu() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: attachPipMenu()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: attachPipMenu()", TAG);
|
||||
|
||||
if (mPipMenuView != null) {
|
||||
detachPipMenu();
|
||||
@@ -158,7 +153,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
attachPipMenuView();
|
||||
|
||||
mTvPipBoundsState.setPipMenuPermanentDecorInsets(Insets.of(-mPipMenuBorderWidth,
|
||||
-mPipMenuBorderWidth, -mPipMenuBorderWidth, -mPipMenuBorderWidth));
|
||||
-mPipMenuBorderWidth, -mPipMenuBorderWidth, -mPipMenuBorderWidth));
|
||||
mTvPipBoundsState.setPipMenuTemporaryDecorInsets(Insets.of(0, 0, 0, -mPipEduTextHeight));
|
||||
mMainHandler.postDelayed(mCloseEduTextRunnable, mPipEduTextShowDurationMs);
|
||||
}
|
||||
@@ -180,15 +175,15 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
|
||||
private void setUpViewSurfaceZOrder(View v, int zOrderRelativeToPip) {
|
||||
v.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
v.getViewRootImpl().addSurfaceChangedCallback(
|
||||
new PipMenuSurfaceChangedCallback(v, zOrderRelativeToPip));
|
||||
}
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
v.getViewRootImpl().addSurfaceChangedCallback(
|
||||
new PipMenuSurfaceChangedCallback(v, zOrderRelativeToPip));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
}
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -205,10 +200,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
}
|
||||
|
||||
void showMovementMenuOnly() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showMovementMenuOnly()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showMovementMenuOnly()", TAG);
|
||||
setInMoveMode(true);
|
||||
mCloseAfterExitMoveMenu = true;
|
||||
showMenuInternal();
|
||||
@@ -216,9 +209,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
|
||||
@Override
|
||||
public void showMenu() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: showMenu()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: showMenu()", TAG);
|
||||
setInMoveMode(false);
|
||||
mCloseAfterExitMoveMenu = false;
|
||||
showMenuInternal();
|
||||
@@ -274,15 +265,12 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
}
|
||||
|
||||
void closeMenu() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: closeMenu()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: closeMenu()", TAG);
|
||||
|
||||
if (mPipMenuView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPipMenuView.hideAllUserControls();
|
||||
grantPipMenuFocus(false);
|
||||
mDelegate.onMenuClosed();
|
||||
@@ -296,7 +284,6 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
if (mInMoveMode == moveMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
mInMoveMode = moveMode;
|
||||
if (mDelegate != null) {
|
||||
mDelegate.onInMoveModeChanged();
|
||||
@@ -305,22 +292,19 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
|
||||
@Override
|
||||
public void onEnterMoveMode() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onEnterMoveMode - %b, close when exiting move menu: %b", TAG, mInMoveMode,
|
||||
mCloseAfterExitMoveMenu);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onEnterMoveMode - %b, close when exiting move menu: %b", TAG, mInMoveMode,
|
||||
mCloseAfterExitMoveMenu);
|
||||
setInMoveMode(true);
|
||||
mPipMenuView.showMoveMenu(mDelegate.getPipGravity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onExitMoveMode() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onExitMoveMode - %b, close when exiting move menu: %b", TAG, mInMoveMode,
|
||||
mCloseAfterExitMoveMenu);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onExitMoveMode - %b, close when exiting move menu: %b", TAG, mInMoveMode,
|
||||
mCloseAfterExitMoveMenu);
|
||||
|
||||
if (mCloseAfterExitMoveMenu) {
|
||||
setInMoveMode(false);
|
||||
mCloseAfterExitMoveMenu = false;
|
||||
@@ -337,10 +321,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
|
||||
@Override
|
||||
public boolean onPipMovement(int keycode) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipMovement - %b", TAG, mInMoveMode);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onPipMovement - %b", TAG, mInMoveMode);
|
||||
if (mInMoveMode) {
|
||||
mDelegate.movePip(keycode);
|
||||
}
|
||||
@@ -357,18 +339,14 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
|
||||
@Override
|
||||
public void setAppActions(List<RemoteAction> actions, RemoteAction closeAction) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setAppActions()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setAppActions()", TAG);
|
||||
updateAdditionalActionsList(mAppActions, actions, closeAction);
|
||||
}
|
||||
|
||||
private void onMediaActionsChanged(List<RemoteAction> actions) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onMediaActionsChanged()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: onMediaActionsChanged()", TAG);
|
||||
|
||||
// Hide disabled actions.
|
||||
List<RemoteAction> enabledActions = new ArrayList<>();
|
||||
@@ -420,10 +398,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
public void resizePipMenu(@Nullable SurfaceControl pipLeash,
|
||||
@Nullable SurfaceControl.Transaction t,
|
||||
Rect destinationBounds) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: resizePipMenu: %s", TAG, destinationBounds.toShortString());
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: resizePipMenu: %s", TAG, destinationBounds.toShortString());
|
||||
if (destinationBounds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -437,14 +413,14 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
final SurfaceControl frontSurface = getSurfaceControl(mPipMenuView);
|
||||
final SyncRtSurfaceTransactionApplier.SurfaceParams frontParams =
|
||||
new SyncRtSurfaceTransactionApplier.SurfaceParams.Builder(frontSurface)
|
||||
.withWindowCrop(menuBounds)
|
||||
.build();
|
||||
.withWindowCrop(menuBounds)
|
||||
.build();
|
||||
|
||||
final SurfaceControl backSurface = getSurfaceControl(mPipBackgroundView);
|
||||
final SyncRtSurfaceTransactionApplier.SurfaceParams backParams =
|
||||
new SyncRtSurfaceTransactionApplier.SurfaceParams.Builder(backSurface)
|
||||
.withWindowCrop(menuBounds)
|
||||
.build();
|
||||
.withWindowCrop(menuBounds)
|
||||
.build();
|
||||
|
||||
// TODO(b/226580399): switch to using SurfaceSyncer (see b/200284684) to synchronize the
|
||||
// animations of the pip surface with the content of the front and back menu surfaces
|
||||
@@ -467,13 +443,11 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
@Override
|
||||
public void movePipMenu(SurfaceControl pipLeash, SurfaceControl.Transaction transaction,
|
||||
Rect pipDestBounds) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: movePipMenu: %s", TAG, pipDestBounds.toShortString());
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: movePipMenu: %s", TAG, pipDestBounds.toShortString());
|
||||
|
||||
if (pipDestBounds.isEmpty()) {
|
||||
if (transaction == null && DEBUG) {
|
||||
if (transaction == null) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: no transaction given", TAG);
|
||||
}
|
||||
@@ -489,16 +463,12 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
// resizing and the PiP menu is also resized. We then want to do a scale from the current
|
||||
// new menu bounds.
|
||||
if (pipLeash != null && transaction != null) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: tmpSourceBounds based on mPipMenuView.getBoundsOnScreen()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: tmpSourceBounds based on mPipMenuView.getBoundsOnScreen()", TAG);
|
||||
mPipMenuView.getBoundsOnScreen(tmpSourceBounds);
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: tmpSourceBounds based on menu width and height", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: tmpSourceBounds based on menu width and height", TAG);
|
||||
tmpSourceBounds.set(0, 0, menuDestBounds.width(), menuDestBounds.height());
|
||||
}
|
||||
|
||||
@@ -524,8 +494,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
if (pipLeash != null && transaction != null) {
|
||||
final SyncRtSurfaceTransactionApplier.SurfaceParams pipParams =
|
||||
new SyncRtSurfaceTransactionApplier.SurfaceParams.Builder(pipLeash)
|
||||
.withMergeTransaction(transaction)
|
||||
.build();
|
||||
.withMergeTransaction(transaction)
|
||||
.build();
|
||||
mApplier.scheduleApply(frontParams, pipParams);
|
||||
} else {
|
||||
mApplier.scheduleApply(frontParams);
|
||||
@@ -567,10 +537,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
@Override
|
||||
public void updateMenuBounds(Rect destinationBounds) {
|
||||
final Rect menuBounds = calculateMenuSurfaceBounds(destinationBounds);
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateMenuBounds: %s", TAG, menuBounds.toShortString());
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: updateMenuBounds: %s", TAG, menuBounds.toShortString());
|
||||
mSystemWindows.updateViewLayout(mPipBackgroundView,
|
||||
getPipMenuLayoutParams(mContext, BACKGROUND_WINDOW_TITLE, menuBounds.width(),
|
||||
menuBounds.height()));
|
||||
@@ -629,10 +597,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
|
||||
}
|
||||
|
||||
private void grantPipMenuFocus(boolean grantFocus) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: grantWindowFocus(%b)", TAG, grantFocus);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: grantWindowFocus(%b)", TAG, grantFocus);
|
||||
|
||||
try {
|
||||
WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(null /* window */,
|
||||
|
||||
@@ -71,7 +71,6 @@ import java.util.List;
|
||||
*/
|
||||
public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
private static final String TAG = "TvPipMenuView";
|
||||
private static final boolean DEBUG = TvPipController.DEBUG;
|
||||
|
||||
private static final int FIRST_CUSTOM_ACTION_POSITION = 3;
|
||||
|
||||
@@ -448,10 +447,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
}
|
||||
|
||||
void setIsExpanded(boolean expanded) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setIsExpanded, expanded: %b", TAG, expanded);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setIsExpanded, expanded: %b", TAG, expanded);
|
||||
mExpandButton.setImageResource(
|
||||
expanded ? R.drawable.pip_ic_collapse : R.drawable.pip_ic_expand);
|
||||
mExpandButton.setTextAndDescription(
|
||||
@@ -462,9 +459,7 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
* @param gravity for the arrow hints
|
||||
*/
|
||||
void showMoveMenu(int gravity) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: showMoveMenu()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: showMoveMenu()", TAG);
|
||||
mButtonMenuIsVisible = false;
|
||||
mMoveMenuIsVisible = true;
|
||||
showButtonsMenu(false);
|
||||
@@ -476,11 +471,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
}
|
||||
|
||||
void showButtonsMenu() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showButtonsMenu()", TAG);
|
||||
}
|
||||
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showButtonsMenu()", TAG);
|
||||
mButtonMenuIsVisible = true;
|
||||
mMoveMenuIsVisible = false;
|
||||
showButtonsMenu(true);
|
||||
@@ -553,10 +545,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
*/
|
||||
void setAdditionalActions(List<RemoteAction> actions, RemoteAction closeAction,
|
||||
Handler mainHandler) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setAdditionalActions()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: setAdditionalActions()", TAG);
|
||||
|
||||
// Replace system close action with custom close action if available
|
||||
if (closeAction != null) {
|
||||
@@ -707,10 +697,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
* Shows user hints for moving the PiP, e.g. arrows.
|
||||
*/
|
||||
public void showMovementHints(int gravity) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showMovementHints(), position: %s", TAG, Gravity.toString(gravity));
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showMovementHints(), position: %s", TAG, Gravity.toString(gravity));
|
||||
|
||||
animateAlphaTo(checkGravity(gravity, Gravity.BOTTOM) ? 1f : 0f, mArrowUp);
|
||||
animateAlphaTo(checkGravity(gravity, Gravity.TOP) ? 1f : 0f, mArrowDown);
|
||||
@@ -752,10 +740,9 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
* Hides user hints for moving the PiP, e.g. arrows.
|
||||
*/
|
||||
public void hideMovementHints() {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: hideMovementHints()", TAG);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: hideMovementHints()", TAG);
|
||||
|
||||
animateAlphaTo(0, mArrowUp);
|
||||
animateAlphaTo(0, mArrowRight);
|
||||
animateAlphaTo(0, mArrowDown);
|
||||
@@ -767,10 +754,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
* Show or hide the pip buttons menu.
|
||||
*/
|
||||
public void showButtonsMenu(boolean show) {
|
||||
if (DEBUG) {
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showUserActions: %b", TAG, show);
|
||||
}
|
||||
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
|
||||
"%s: showUserActions: %b", TAG, show);
|
||||
if (show) {
|
||||
mActionButtonsContainer.setVisibility(VISIBLE);
|
||||
refocusPreviousButton();
|
||||
|
||||
Reference in New Issue
Block a user