Merge "Remove PIP tuner items" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
86339dc8ee
@@ -1892,21 +1892,6 @@
|
|||||||
<!-- PiP BTW notification description. [CHAR LIMIT=NONE] -->
|
<!-- PiP BTW notification description. [CHAR LIMIT=NONE] -->
|
||||||
<string name="pip_notification_message">If you don’t want <xliff:g id="name" example="Google Maps">%s</xliff:g> to use this feature, tap to open settings and turn it off.</string>
|
<string name="pip_notification_message">If you don’t want <xliff:g id="name" example="Google Maps">%s</xliff:g> to use this feature, tap to open settings and turn it off.</string>
|
||||||
|
|
||||||
<!-- PiP section of the tuner. [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="picture_in_picture" translatable="false">Picture-in-Picture</string>
|
|
||||||
|
|
||||||
<!-- PiP minimize title. [CHAR LIMIT=NONE]-->
|
|
||||||
<string name="pip_minimize_title" translatable="false">Minimize</string>
|
|
||||||
|
|
||||||
<!-- PiP minimize description. [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="pip_minimize_description" translatable="false">Drag or fling the PIP to the edges of the screen to minimize it.</string>
|
|
||||||
|
|
||||||
<!-- PiP fling to dismiss title. [CHAR LIMIT=NONE]-->
|
|
||||||
<string name="pip_fling_dismiss_title" translatable="false">Fling to dismiss</string>
|
|
||||||
|
|
||||||
<!-- PiP fling to dismiss description. [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="pip_fling_dismiss_description" translatable="false">Fling from anywhere on the screen to the bottom of the screen to dismiss the PIP.</string>
|
|
||||||
|
|
||||||
<!-- Button to play the current media on picture-in-picture (PIP) [CHAR LIMIT=30] -->
|
<!-- Button to play the current media on picture-in-picture (PIP) [CHAR LIMIT=30] -->
|
||||||
<string name="pip_play">Play</string>
|
<string name="pip_play">Play</string>
|
||||||
|
|
||||||
|
|||||||
@@ -121,24 +121,6 @@
|
|||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
<PreferenceScreen
|
|
||||||
android:key="picture_in_picture"
|
|
||||||
android:title="@string/picture_in_picture">
|
|
||||||
|
|
||||||
<com.android.systemui.tuner.TunerSwitch
|
|
||||||
android:key="pip_minimize"
|
|
||||||
android:title="@string/pip_minimize_title"
|
|
||||||
android:summary="@string/pip_minimize_description"
|
|
||||||
sysui:defValue="false" />
|
|
||||||
|
|
||||||
<com.android.systemui.tuner.TunerSwitch
|
|
||||||
android:key="pip_fling_dismiss"
|
|
||||||
android:title="@string/pip_fling_dismiss_title"
|
|
||||||
android:summary="@string/pip_fling_dismiss_description"
|
|
||||||
sysui:defValue="false" />
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="doze"
|
android:key="doze"
|
||||||
android:title="@string/tuner_doze">
|
android:title="@string/tuner_doze">
|
||||||
|
|||||||
@@ -54,11 +54,13 @@ import java.io.PrintWriter;
|
|||||||
* Manages all the touch handling for PIP on the Phone, including moving, dismissing and expanding
|
* Manages all the touch handling for PIP on the Phone, including moving, dismissing and expanding
|
||||||
* the PIP.
|
* the PIP.
|
||||||
*/
|
*/
|
||||||
public class PipTouchHandler implements TunerService.Tunable {
|
public class PipTouchHandler {
|
||||||
private static final String TAG = "PipTouchHandler";
|
private static final String TAG = "PipTouchHandler";
|
||||||
|
|
||||||
private static final String TUNER_KEY_MINIMIZE = "pip_minimize";
|
// Allow the PIP to be dragged to the edge of the screen to be minimized.
|
||||||
private static final String TUNER_KEY_FLING_DISMISS = "pip_fling_dismiss";
|
private static final boolean ENABLE_MINIMIZE = false;
|
||||||
|
// Allow the PIP to be flung from anywhere on the screen to the bottom to be dismissed.
|
||||||
|
private static final boolean ENABLE_FLING_DISMISS = false;
|
||||||
|
|
||||||
// These values are used for metrics and should never change
|
// These values are used for metrics and should never change
|
||||||
private static final int METRIC_VALUE_DISMISSED_BY_TAP = 0;
|
private static final int METRIC_VALUE_DISMISSED_BY_TAP = 0;
|
||||||
@@ -113,11 +115,6 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Allow the PIP to be dragged to the edge of the screen to be minimized.
|
|
||||||
private boolean mEnableMinimize = false;
|
|
||||||
// Allow the PIP to be flung from anywhere on the screen to the bottom to be dismissed.
|
|
||||||
private boolean mEnableFlingToDismiss = false;
|
|
||||||
|
|
||||||
// Behaviour states
|
// Behaviour states
|
||||||
private int mMenuState;
|
private int mMenuState;
|
||||||
private boolean mIsMinimized;
|
private boolean mIsMinimized;
|
||||||
@@ -196,10 +193,6 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
mExpandedShortestEdgeSize = context.getResources().getDimensionPixelSize(
|
mExpandedShortestEdgeSize = context.getResources().getDimensionPixelSize(
|
||||||
R.dimen.pip_expanded_shortest_edge_size);
|
R.dimen.pip_expanded_shortest_edge_size);
|
||||||
|
|
||||||
// Register any tuner settings changes
|
|
||||||
Dependency.get(TunerService.class).addTunable(this, TUNER_KEY_MINIMIZE);
|
|
||||||
Dependency.get(TunerService.class).addTunable(this, TUNER_KEY_FLING_DISMISS);
|
|
||||||
|
|
||||||
// Register the listener for input consumer touch events
|
// Register the listener for input consumer touch events
|
||||||
inputConsumerController.setTouchListener(this::handleTouchEvent);
|
inputConsumerController.setTouchListener(this::handleTouchEvent);
|
||||||
inputConsumerController.setRegistrationListener(this::onRegistrationChanged);
|
inputConsumerController.setRegistrationListener(this::onRegistrationChanged);
|
||||||
@@ -240,18 +233,6 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTuningChanged(String key, String newValue) {
|
|
||||||
switch (key) {
|
|
||||||
case TUNER_KEY_MINIMIZE:
|
|
||||||
mEnableMinimize = newValue == null ? false : Integer.parseInt(newValue) != 0;
|
|
||||||
break;
|
|
||||||
case TUNER_KEY_FLING_DISMISS:
|
|
||||||
mEnableFlingToDismiss = newValue == null ? false : Integer.parseInt(newValue) != 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onConfigurationChanged() {
|
public void onConfigurationChanged() {
|
||||||
mMotionHelper.onConfigurationChanged();
|
mMotionHelper.onConfigurationChanged();
|
||||||
mMotionHelper.synchronizePinnedStackBounds();
|
mMotionHelper.synchronizePinnedStackBounds();
|
||||||
@@ -451,7 +432,7 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
* Sets the minimized state.
|
* Sets the minimized state.
|
||||||
*/
|
*/
|
||||||
void setMinimizedStateInternal(boolean isMinimized) {
|
void setMinimizedStateInternal(boolean isMinimized) {
|
||||||
if (!mEnableMinimize) {
|
if (!ENABLE_MINIMIZE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setMinimizedState(isMinimized, false /* fromController */);
|
setMinimizedState(isMinimized, false /* fromController */);
|
||||||
@@ -461,7 +442,7 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
* Sets the minimized state.
|
* Sets the minimized state.
|
||||||
*/
|
*/
|
||||||
void setMinimizedState(boolean isMinimized, boolean fromController) {
|
void setMinimizedState(boolean isMinimized, boolean fromController) {
|
||||||
if (!mEnableMinimize) {
|
if (!ENABLE_MINIMIZE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mIsMinimized != isMinimized) {
|
if (mIsMinimized != isMinimized) {
|
||||||
@@ -597,7 +578,7 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
final PointF lastDelta = touchState.getLastTouchDelta();
|
final PointF lastDelta = touchState.getLastTouchDelta();
|
||||||
float left = mTmpBounds.left + lastDelta.x;
|
float left = mTmpBounds.left + lastDelta.x;
|
||||||
float top = mTmpBounds.top + lastDelta.y;
|
float top = mTmpBounds.top + lastDelta.y;
|
||||||
if (!touchState.allowDraggingOffscreen() || !mEnableMinimize) {
|
if (!touchState.allowDraggingOffscreen() || !ENABLE_MINIMIZE) {
|
||||||
left = Math.max(mMovementBounds.left, Math.min(mMovementBounds.right, left));
|
left = Math.max(mMovementBounds.left, Math.min(mMovementBounds.right, left));
|
||||||
}
|
}
|
||||||
if (ENABLE_DISMISS_DRAG_TO_EDGE) {
|
if (ENABLE_DISMISS_DRAG_TO_EDGE) {
|
||||||
@@ -645,7 +626,7 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
final boolean isHorizontal = Math.abs(vel.x) > Math.abs(vel.y);
|
final boolean isHorizontal = Math.abs(vel.x) > Math.abs(vel.y);
|
||||||
final float velocity = PointF.length(vel.x, vel.y);
|
final float velocity = PointF.length(vel.x, vel.y);
|
||||||
final boolean isFling = velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond();
|
final boolean isFling = velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond();
|
||||||
final boolean isUpWithinDimiss = mEnableFlingToDismiss
|
final boolean isUpWithinDimiss = ENABLE_FLING_DISMISS
|
||||||
&& touchState.getLastTouchPosition().y >= mMovementBounds.bottom
|
&& touchState.getLastTouchPosition().y >= mMovementBounds.bottom
|
||||||
&& mMotionHelper.isGestureToDismissArea(mMotionHelper.getBounds(), vel.x,
|
&& mMotionHelper.isGestureToDismissArea(mMotionHelper.getBounds(), vel.x,
|
||||||
vel.y, isFling);
|
vel.y, isFling);
|
||||||
@@ -666,7 +647,7 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
if (touchState.isDragging()) {
|
if (touchState.isDragging()) {
|
||||||
final boolean isFlingToEdge = isFling && isHorizontal && mMovementWithinMinimize
|
final boolean isFlingToEdge = isFling && isHorizontal && mMovementWithinMinimize
|
||||||
&& (mStartedOnLeft ? vel.x < 0 : vel.x > 0);
|
&& (mStartedOnLeft ? vel.x < 0 : vel.x > 0);
|
||||||
if (mEnableMinimize &&
|
if (ENABLE_MINIMIZE &&
|
||||||
!mIsMinimized && (mMotionHelper.shouldMinimizePip() || isFlingToEdge)) {
|
!mIsMinimized && (mMotionHelper.shouldMinimizePip() || isFlingToEdge)) {
|
||||||
// Pip should be minimized
|
// Pip should be minimized
|
||||||
setMinimizedStateInternal(true);
|
setMinimizedStateInternal(true);
|
||||||
@@ -758,7 +739,7 @@ public class PipTouchHandler implements TunerService.Tunable {
|
|||||||
pw.println(innerPrefix + "mImeHeight=" + mImeHeight);
|
pw.println(innerPrefix + "mImeHeight=" + mImeHeight);
|
||||||
pw.println(innerPrefix + "mSavedSnapFraction=" + mSavedSnapFraction);
|
pw.println(innerPrefix + "mSavedSnapFraction=" + mSavedSnapFraction);
|
||||||
pw.println(innerPrefix + "mEnableDragToEdgeDismiss=" + ENABLE_DISMISS_DRAG_TO_EDGE);
|
pw.println(innerPrefix + "mEnableDragToEdgeDismiss=" + ENABLE_DISMISS_DRAG_TO_EDGE);
|
||||||
pw.println(innerPrefix + "mEnableMinimize=" + mEnableMinimize);
|
pw.println(innerPrefix + "mEnableMinimize=" + ENABLE_MINIMIZE);
|
||||||
mSnapAlgorithm.dump(pw, innerPrefix);
|
mSnapAlgorithm.dump(pw, innerPrefix);
|
||||||
mTouchState.dump(pw, innerPrefix);
|
mTouchState.dump(pw, innerPrefix);
|
||||||
mMotionHelper.dump(pw, innerPrefix);
|
mMotionHelper.dump(pw, innerPrefix);
|
||||||
|
|||||||
Reference in New Issue
Block a user