summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Vinit Nayak <peanutbutter@google.com> 2024-07-31 13:10:28 -0700
committer Vinit Nayak <peanutbutter@google.com> 2024-07-31 20:26:02 +0000
commit0cc61bd3cc5d6fcb231341f12f11a16c02d45927 (patch)
treeb8356d18bf8a26410298b3c149222c1dff211ca8 /libs
parentbd5e0d9105f2995b7809dc2f3838885b2d1a5ee3 (diff)
Cleanup unused code in DividerSnapAlgorithm
Bug: 266482558 Test: None Flag: EXEMPT cleanup Change-Id: Ia83b4932f3e237d221898a7511d30f62d6df9964
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java102
1 files changed, 4 insertions, 98 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java
index bc6ed1f63c8a..2e1789a51dff 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java
@@ -16,7 +16,6 @@
package com.android.wm.shell.common.split;
-import static android.view.WindowManager.DOCKED_INVALID;
import static android.view.WindowManager.DOCKED_LEFT;
import static android.view.WindowManager.DOCKED_RIGHT;
@@ -29,13 +28,8 @@ import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_NON
import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_START_AND_DISMISS;
import static com.android.wm.shell.common.split.SplitScreenConstants.SnapPosition;
-import android.content.Context;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;
-import android.hardware.display.DisplayManager;
-import android.view.Display;
-import android.view.DisplayInfo;
import androidx.annotation.Nullable;
@@ -86,7 +80,7 @@ public class DividerSnapAlgorithm {
private final float mFixedRatio;
/** Allows split ratios to calculated dynamically instead of using {@link #mFixedRatio}. */
private final boolean mAllowFlexibleSplitRatios;
- private boolean mIsHorizontalDivision;
+ private final boolean mIsHorizontalDivision;
/** The first target which is still splitting the screen */
private final SnapTarget mFirstSplitTarget;
@@ -98,27 +92,6 @@ public class DividerSnapAlgorithm {
private final SnapTarget mDismissEndTarget;
private final SnapTarget mMiddleTarget;
- public static DividerSnapAlgorithm create(Context ctx, Rect insets) {
- DisplayInfo displayInfo = new DisplayInfo();
- ctx.getSystemService(DisplayManager.class).getDisplay(
- Display.DEFAULT_DISPLAY).getDisplayInfo(displayInfo);
- int dividerWindowWidth = ctx.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.docked_stack_divider_thickness);
- int dividerInsets = ctx.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.docked_stack_divider_insets);
- return new DividerSnapAlgorithm(ctx.getResources(),
- displayInfo.logicalWidth, displayInfo.logicalHeight,
- dividerWindowWidth - 2 * dividerInsets,
- ctx.getApplicationContext().getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_PORTRAIT,
- insets);
- }
-
- public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
- boolean isHorizontalDivision, Rect insets) {
- this(res, displayWidth, displayHeight, dividerSize, isHorizontalDivision, insets,
- DOCKED_INVALID, false /* minimized */, true /* resizable */);
- }
public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
boolean isHorizontalDivision, Rect insets, int dockSide) {
@@ -160,29 +133,11 @@ public class DividerSnapAlgorithm {
}
/**
- * @return whether it's feasible to enable split screen in the current configuration, i.e. when
- * snapping in the middle both tasks are larger than the minimal task size.
- */
- public boolean isSplitScreenFeasible() {
- int statusBarSize = mInsets.top;
- int navBarSize = mIsHorizontalDivision ? mInsets.bottom : mInsets.right;
- int size = mIsHorizontalDivision
- ? mDisplayHeight
- : mDisplayWidth;
- int availableSpace = size - navBarSize - statusBarSize - mDividerSize;
- return availableSpace / 2 >= mMinimalSizeResizableTask;
- }
-
- public SnapTarget calculateSnapTarget(int position, float velocity) {
- return calculateSnapTarget(position, velocity, true /* hardDismiss */);
- }
-
- /**
* @param position the top/left position of the divider
* @param velocity current dragging velocity
- * @param hardDismiss if set, make it a bit harder to get reach the dismiss targets
+ * @param hardToDismiss if set, make it a bit harder to get reach the dismiss targets
*/
- public SnapTarget calculateSnapTarget(int position, float velocity, boolean hardDismiss) {
+ public SnapTarget calculateSnapTarget(int position, float velocity, boolean hardToDismiss) {
if (position < mFirstSplitTarget.position && velocity < -mMinDismissVelocityPxPerSecond) {
return mDismissStartTarget;
}
@@ -190,7 +145,7 @@ public class DividerSnapAlgorithm {
return mDismissEndTarget;
}
if (Math.abs(velocity) < mMinFlingVelocityPxPerSecond) {
- return snap(position, hardDismiss);
+ return snap(position, hardToDismiss);
}
if (velocity < 0) {
return mFirstSplitTarget;
@@ -236,19 +191,6 @@ public class DividerSnapAlgorithm {
return 0f;
}
- public SnapTarget getClosestDismissTarget(int position) {
- if (position < mFirstSplitTarget.position) {
- return mDismissStartTarget;
- } else if (position > mLastSplitTarget.position) {
- return mDismissEndTarget;
- } else if (position - mDismissStartTarget.position
- < mDismissEndTarget.position - position) {
- return mDismissStartTarget;
- } else {
- return mDismissEndTarget;
- }
- }
-
public SnapTarget getFirstSplitTarget() {
return mFirstSplitTarget;
}
@@ -411,22 +353,6 @@ public class DividerSnapAlgorithm {
return mMiddleTarget;
}
- public SnapTarget getNextTarget(SnapTarget snapTarget) {
- int index = mTargets.indexOf(snapTarget);
- if (index != -1 && index < mTargets.size() - 1) {
- return mTargets.get(index + 1);
- }
- return snapTarget;
- }
-
- public SnapTarget getPreviousTarget(SnapTarget snapTarget) {
- int index = mTargets.indexOf(snapTarget);
- if (index != -1 && index > 0) {
- return mTargets.get(index - 1);
- }
- return snapTarget;
- }
-
/**
* @return whether or not there are more than 1 split targets that do not include the two
* dismiss targets, used in deciding to display the middle target for accessibility
@@ -451,26 +377,6 @@ public class DividerSnapAlgorithm {
}
/**
- * Cycles through all non-dismiss targets with a stepping of {@param increment}. It moves left
- * if {@param increment} is negative and moves right otherwise.
- */
- public SnapTarget cycleNonDismissTarget(SnapTarget snapTarget, int increment) {
- int index = mTargets.indexOf(snapTarget);
- if (index != -1) {
- SnapTarget newTarget = mTargets.get((index + mTargets.size() + increment)
- % mTargets.size());
- if (newTarget == mDismissStartTarget) {
- return mLastSplitTarget;
- } else if (newTarget == mDismissEndTarget) {
- return mFirstSplitTarget;
- } else {
- return newTarget;
- }
- }
- return snapTarget;
- }
-
- /**
* Represents a snap target for the divider.
*/
public static class SnapTarget {