Merge "Fix cutout not updating when switching cutout emulation" into tm-qpr-dev
This commit is contained in:
@@ -169,7 +169,7 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView {
|
||||
return
|
||||
}
|
||||
cutoutPath.reset()
|
||||
display.getDisplayInfo(displayInfo)
|
||||
context.display?.getDisplayInfo(displayInfo)
|
||||
displayInfo.displayCutout?.cutoutPath?.let { path -> cutoutPath.set(path) }
|
||||
invalidate()
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
|
||||
private Display.Mode mDisplayMode;
|
||||
@VisibleForTesting
|
||||
protected DisplayInfo mDisplayInfo = new DisplayInfo();
|
||||
private DisplayCutout mDisplayCutout;
|
||||
|
||||
@VisibleForTesting
|
||||
protected void showCameraProtection(@NonNull Path protectionPath, @NonNull Rect bounds) {
|
||||
@@ -384,6 +385,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
|
||||
mRotation = mDisplayInfo.rotation;
|
||||
mDisplayMode = mDisplayInfo.getMode();
|
||||
mDisplayUniqueId = mDisplayInfo.uniqueId;
|
||||
mDisplayCutout = mDisplayInfo.displayCutout;
|
||||
mRoundedCornerResDelegate = new RoundedCornerResDelegate(mContext.getResources(),
|
||||
mDisplayUniqueId);
|
||||
mRoundedCornerResDelegate.setPhysicalPixelDisplaySizeRatio(
|
||||
@@ -1022,7 +1024,8 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
|
||||
mRoundedCornerResDelegate.dump(pw, args);
|
||||
}
|
||||
|
||||
private void updateConfiguration() {
|
||||
@VisibleForTesting
|
||||
void updateConfiguration() {
|
||||
Preconditions.checkState(mHandler.getLooper().getThread() == Thread.currentThread(),
|
||||
"must call on " + mHandler.getLooper().getThread()
|
||||
+ ", but was " + Thread.currentThread());
|
||||
@@ -1033,11 +1036,14 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
|
||||
mDotViewController.setNewRotation(newRotation);
|
||||
}
|
||||
final Display.Mode newMod = mDisplayInfo.getMode();
|
||||
final DisplayCutout newCutout = mDisplayInfo.displayCutout;
|
||||
|
||||
if (!mPendingConfigChange
|
||||
&& (newRotation != mRotation || displayModeChanged(mDisplayMode, newMod))) {
|
||||
&& (newRotation != mRotation || displayModeChanged(mDisplayMode, newMod)
|
||||
|| !Objects.equals(newCutout, mDisplayCutout))) {
|
||||
mRotation = newRotation;
|
||||
mDisplayMode = newMod;
|
||||
mDisplayCutout = newCutout;
|
||||
mRoundedCornerResDelegate.setPhysicalPixelDisplaySizeRatio(
|
||||
getPhysicalPixelDisplaySizeRatio());
|
||||
if (mScreenDecorHwcLayer != null) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.systemui
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Insets
|
||||
import android.graphics.Path
|
||||
@@ -48,6 +49,7 @@ class DisplayCutoutBaseViewTest : SysuiTestCase() {
|
||||
@Mock private lateinit var mockCanvas: Canvas
|
||||
@Mock private lateinit var mockRootView: View
|
||||
@Mock private lateinit var mockDisplay: Display
|
||||
@Mock private lateinit var mockContext: Context
|
||||
|
||||
private lateinit var cutoutBaseView: DisplayCutoutBaseView
|
||||
private val cutout: DisplayCutout = DisplayCutout.Builder()
|
||||
@@ -168,7 +170,9 @@ class DisplayCutoutBaseViewTest : SysuiTestCase() {
|
||||
R.bool.config_fillMainBuiltInDisplayCutout, fillCutout)
|
||||
|
||||
cutoutBaseView = spy(DisplayCutoutBaseView(mContext))
|
||||
whenever(cutoutBaseView.display).thenReturn(mockDisplay)
|
||||
|
||||
whenever(cutoutBaseView.context).thenReturn(mockContext)
|
||||
whenever(mockContext.display).thenReturn(mockDisplay)
|
||||
whenever(mockDisplay.uniqueId).thenReturn("mockDisplayUniqueId")
|
||||
whenever(cutoutBaseView.rootView).thenReturn(mockRootView)
|
||||
whenever(cutoutBaseView.getPhysicalPixelDisplaySizeRatio()).thenReturn(1f)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.systemui
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Insets
|
||||
import android.graphics.PixelFormat
|
||||
import android.graphics.Rect
|
||||
@@ -44,6 +45,7 @@ class ScreenDecorHwcLayerTest : SysuiTestCase() {
|
||||
|
||||
@Mock private lateinit var mockDisplay: Display
|
||||
@Mock private lateinit var mockRootView: View
|
||||
@Mock private lateinit var mockContext: Context
|
||||
|
||||
private val displayWidth = 100
|
||||
private val displayHeight = 200
|
||||
@@ -75,7 +77,8 @@ class ScreenDecorHwcLayerTest : SysuiTestCase() {
|
||||
decorHwcLayer = Mockito.spy(ScreenDecorHwcLayer(mContext, decorationSupport))
|
||||
whenever(decorHwcLayer.width).thenReturn(displayWidth)
|
||||
whenever(decorHwcLayer.height).thenReturn(displayHeight)
|
||||
whenever(decorHwcLayer.display).thenReturn(mockDisplay)
|
||||
whenever(decorHwcLayer.context).thenReturn(mockContext)
|
||||
whenever(mockContext.display).thenReturn(mockDisplay)
|
||||
whenever(decorHwcLayer.rootView).thenReturn(mockRootView)
|
||||
whenever(mockRootView.left).thenReturn(0)
|
||||
whenever(mockRootView.top).thenReturn(0)
|
||||
|
||||
Reference in New Issue
Block a user