Merge "Restrict the overridden min size for PiP" into rvc-dev
This commit is contained in:
@@ -632,6 +632,13 @@
|
|||||||
<!-- The default minimal size of a PiP task, in both dimensions. -->
|
<!-- The default minimal size of a PiP task, in both dimensions. -->
|
||||||
<dimen name="default_minimal_size_pip_resizable_task">108dp</dimen>
|
<dimen name="default_minimal_size_pip_resizable_task">108dp</dimen>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The overridable minimal size of a PiP task, in both dimensions.
|
||||||
|
Different from default_minimal_size_pip_resizable_task, this is to limit the dimension
|
||||||
|
when the pinned stack size is overridden by app via minWidth/minHeight.
|
||||||
|
-->
|
||||||
|
<dimen name="overridable_minimal_size_pip_resizable_task">48dp</dimen>
|
||||||
|
|
||||||
<!-- Height of a task when in minimized mode from the top when launcher is resizable. -->
|
<!-- Height of a task when in minimized mode from the top when launcher is resizable. -->
|
||||||
<dimen name="task_height_of_minimized_mode">80dp</dimen>
|
<dimen name="task_height_of_minimized_mode">80dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -1927,6 +1927,7 @@
|
|||||||
<java-symbol type="fraction" name="config_dimBehindFadeDuration" />
|
<java-symbol type="fraction" name="config_dimBehindFadeDuration" />
|
||||||
<java-symbol type="dimen" name="default_minimal_size_resizable_task" />
|
<java-symbol type="dimen" name="default_minimal_size_resizable_task" />
|
||||||
<java-symbol type="dimen" name="default_minimal_size_pip_resizable_task" />
|
<java-symbol type="dimen" name="default_minimal_size_pip_resizable_task" />
|
||||||
|
<java-symbol type="dimen" name="overridable_minimal_size_pip_resizable_task" />
|
||||||
<java-symbol type="dimen" name="task_height_of_minimized_mode" />
|
<java-symbol type="dimen" name="task_height_of_minimized_mode" />
|
||||||
<java-symbol type="fraction" name="config_screenAutoBrightnessDozeScaleFactor" />
|
<java-symbol type="fraction" name="config_screenAutoBrightnessDozeScaleFactor" />
|
||||||
<java-symbol type="bool" name="config_allowPriorityVibrationsInLowPowerMode" />
|
<java-symbol type="bool" name="config_allowPriorityVibrationsInLowPowerMode" />
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import android.os.Handler;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.util.EventLog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Size;
|
import android.util.Size;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
@@ -193,6 +194,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory
|
private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory
|
||||||
mSurfaceControlTransactionFactory;
|
mSurfaceControlTransactionFactory;
|
||||||
private PictureInPictureParams mPictureInPictureParams;
|
private PictureInPictureParams mPictureInPictureParams;
|
||||||
|
private int mOverridableMinSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set to {@code true}, the entering animation will be skipped and we will wait for
|
* If set to {@code true}, the entering animation will be skipped and we will wait for
|
||||||
@@ -211,6 +213,8 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
mPipBoundsHandler = boundsHandler;
|
mPipBoundsHandler = boundsHandler;
|
||||||
mEnterExitAnimationDuration = context.getResources()
|
mEnterExitAnimationDuration = context.getResources()
|
||||||
.getInteger(R.integer.config_pipResizeAnimationDuration);
|
.getInteger(R.integer.config_pipResizeAnimationDuration);
|
||||||
|
mOverridableMinSize = context.getResources().getDimensionPixelSize(
|
||||||
|
com.android.internal.R.dimen.overridable_minimal_size_pip_resizable_task);
|
||||||
mSurfaceTransactionHelper = surfaceTransactionHelper;
|
mSurfaceTransactionHelper = surfaceTransactionHelper;
|
||||||
mPipAnimationController = pipAnimationController;
|
mPipAnimationController = pipAnimationController;
|
||||||
mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
|
mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
|
||||||
@@ -887,7 +891,14 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
// -1 will be populated if an activity specifies defaultWidth/defaultHeight in <layout>
|
// -1 will be populated if an activity specifies defaultWidth/defaultHeight in <layout>
|
||||||
// without minWidth/minHeight
|
// without minWidth/minHeight
|
||||||
if (windowLayout.minWidth > 0 && windowLayout.minHeight > 0) {
|
if (windowLayout.minWidth > 0 && windowLayout.minHeight > 0) {
|
||||||
return new Size(windowLayout.minWidth, windowLayout.minHeight);
|
// If either dimension is smaller than the allowed minimum, adjust them
|
||||||
|
// according to mOverridableMinSize and log to SafeNet
|
||||||
|
if (windowLayout.minWidth < mOverridableMinSize
|
||||||
|
|| windowLayout.minHeight < mOverridableMinSize) {
|
||||||
|
EventLog.writeEvent(0x534e4554, "174302616", -1, "");
|
||||||
|
}
|
||||||
|
return new Size(Math.max(windowLayout.minWidth, mOverridableMinSize),
|
||||||
|
Math.max(windowLayout.minHeight, mOverridableMinSize));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user