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