Loading packages/SystemUI/src/com/android/systemui/DisplayCutoutBaseView.kt +32 −21 Original line number Diff line number Diff line Loading @@ -47,7 +47,8 @@ import com.android.systemui.animation.Interpolators open class DisplayCutoutBaseView : View, RegionInterceptableView { private var shouldDrawCutout: Boolean = DisplayCutout.getFillBuiltInDisplayCutout( context.resources, context.display?.uniqueId) context.resources, context.display?.uniqueId ) private var displayUniqueId: String? = null private var displayMode: Display.Mode? = null protected val location = IntArray(2) Loading @@ -74,8 +75,8 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) override fun onAttachedToWindow() { super.onAttachedToWindow() Loading @@ -85,7 +86,7 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { onUpdate() } fun onDisplayChanged(displayId: Int) { fun onDisplayChanged(newDisplayUniqueId: String?) { val oldMode: Display.Mode? = displayMode val display: Display? = context.display displayMode = display?.mode Loading @@ -93,7 +94,8 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { if (displayUniqueId != display?.uniqueId) { displayUniqueId = display?.uniqueId shouldDrawCutout = DisplayCutout.getFillBuiltInDisplayCutout( context.resources, displayUniqueId) context.resources, displayUniqueId ) } // Skip if display mode or cutout hasn't changed. Loading @@ -101,7 +103,7 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { display?.cutout == displayInfo.displayCutout) { return } if (displayId == display?.displayId) { if (newDisplayUniqueId == display?.uniqueId) { updateCutout() updateProtectionBoundingPath() onUpdate() Loading Loading @@ -147,8 +149,9 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { cutoutBounds.translate(-location[0], -location[1]) // Intersect with window's frame cutoutBounds.op(rootView.left, rootView.top, rootView.right, rootView.bottom, Region.Op.INTERSECT) cutoutBounds.op( rootView.left, rootView.top, rootView.right, rootView.bottom, Region.Op.INTERSECT ) return cutoutBounds } Loading @@ -171,9 +174,12 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { protected open fun drawCutoutProtection(canvas: Canvas) { if (cameraProtectionProgress > HIDDEN_CAMERA_PROTECTION_SCALE && !protectionRect.isEmpty) { canvas.scale(cameraProtectionProgress, cameraProtectionProgress, protectionRect.centerX(), protectionRect.centerY()) !protectionRect.isEmpty ) { canvas.scale( cameraProtectionProgress, cameraProtectionProgress, protectionRect.centerX(), protectionRect.centerY() ) canvas.drawPath(protectionPath, paint) } } Loading Loading @@ -205,14 +211,17 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { requestLayout() } cameraProtectionAnimator?.cancel() cameraProtectionAnimator = ValueAnimator.ofFloat(cameraProtectionProgress, if (showProtection) 1.0f else HIDDEN_CAMERA_PROTECTION_SCALE).setDuration(750) cameraProtectionAnimator = ValueAnimator.ofFloat( cameraProtectionProgress, if (showProtection) 1.0f else HIDDEN_CAMERA_PROTECTION_SCALE ).setDuration(750) cameraProtectionAnimator?.interpolator = Interpolators.DECELERATE_QUINT cameraProtectionAnimator?.addUpdateListener(ValueAnimator.AnimatorUpdateListener { animation: ValueAnimator -> cameraProtectionAnimator?.addUpdateListener( ValueAnimator.AnimatorUpdateListener { animation: ValueAnimator -> cameraProtectionProgress = animation.animatedValue as Float invalidate() }) } ) cameraProtectionAnimator?.addListener(object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { cameraProtectionAnimator = null Loading Loading @@ -245,8 +254,10 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { // Apply rotation. val lw: Int = displayInfo.logicalWidth val lh: Int = displayInfo.logicalHeight val flipped = (displayInfo.rotation == Surface.ROTATION_90 || displayInfo.rotation == Surface.ROTATION_270) val flipped = ( displayInfo.rotation == Surface.ROTATION_90 || displayInfo.rotation == Surface.ROTATION_270 ) val dw = if (flipped) lh else lw val dh = if (flipped) lw else lh transformPhysicalToLogicalCoordinates(displayInfo.rotation, dw, dh, m) Loading packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +27 −49 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; Loading Loading @@ -92,10 +91,8 @@ import com.android.systemui.util.settings.SecureSettings; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.concurrent.Executor; import javax.inject.Inject; Loading Loading @@ -448,6 +445,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab } } boolean needToUpdateProviderViews = false; final String newUniqueId = mDisplayInfo.uniqueId; if (!Objects.equals(newUniqueId, mDisplayUniqueId)) { mDisplayUniqueId = newUniqueId; Loading @@ -470,8 +468,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab updateHwLayerRoundedCornerDrawable(); updateHwLayerRoundedCornerExistAndSize(); } updateOverlayProviderViews(); needToUpdateProviderViews = true; } final float newRatio = getPhysicalPixelDisplaySizeRatio(); Loading @@ -480,7 +477,13 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab if (mScreenDecorHwcLayer != null) { updateHwLayerRoundedCornerExistAndSize(); } updateOverlayProviderViews(); needToUpdateProviderViews = true; } if (needToUpdateProviderViews) { updateOverlayProviderViews(null); } else { updateOverlayProviderViews(new Integer[] { mFaceScanningViewId }); } if (mCutoutViews != null) { Loading @@ -490,18 +493,12 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab if (cutoutView == null) { continue; } cutoutView.onDisplayChanged(displayId); } cutoutView.onDisplayChanged(newUniqueId); } DisplayCutoutView overlay = (DisplayCutoutView) getOverlayView(mFaceScanningViewId); if (overlay != null) { // handle display resolution changes overlay.onDisplayChanged(displayId); } if (mScreenDecorHwcLayer != null) { mScreenDecorHwcLayer.onDisplayChanged(displayId); mScreenDecorHwcLayer.onDisplayChanged(newUniqueId); } } }; Loading Loading @@ -804,7 +801,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab return; } removeOverlayView(provider.getViewId()); overlay.addDecorProvider(provider, mRotation); overlay.addDecorProvider(provider, mRotation, mTintColor); }); } // Use visibility of privacy dot views & face scanning view to determine the overlay's Loading Loading @@ -954,24 +951,6 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab return; } // When the hwc supports screen decorations, the layer will use the A8 color mode which // won't be affected by the color inversion. If the composition goes the client composition // route, the color inversion will be handled by the RenderEngine. final Set<Integer> viewsMayNeedColorUpdate = new HashSet<>(); if (mHwcScreenDecorationSupport == null) { ColorStateList tintList = ColorStateList.valueOf(mTintColor); mRoundedCornerResDelegate.setColorTintList(tintList); viewsMayNeedColorUpdate.add(R.id.rounded_corner_top_left); viewsMayNeedColorUpdate.add(R.id.rounded_corner_top_right); viewsMayNeedColorUpdate.add(R.id.rounded_corner_bottom_left); viewsMayNeedColorUpdate.add(R.id.rounded_corner_bottom_right); viewsMayNeedColorUpdate.add(R.id.display_cutout); } if (getOverlayView(mFaceScanningViewId) != null) { viewsMayNeedColorUpdate.add(mFaceScanningViewId); } final Integer[] views = new Integer[viewsMayNeedColorUpdate.size()]; viewsMayNeedColorUpdate.toArray(views); for (int i = 0; i < BOUNDS_POSITION_LENGTH; i++) { if (mOverlays[i] == null) { continue; Loading @@ -981,14 +960,19 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab View child; for (int j = 0; j < size; j++) { child = overlayView.getChildAt(j); if (viewsMayNeedColorUpdate.contains(child.getId()) && child instanceof DisplayCutoutView) { if (child instanceof DisplayCutoutView && child.getId() == R.id.display_cutout) { ((DisplayCutoutView) child).setColor(mTintColor); } } mOverlays[i].onReloadResAndMeasure(views, mProviderRefreshToken, mRotation, mDisplayUniqueId); } updateOverlayProviderViews(new Integer[] { mFaceScanningViewId, R.id.rounded_corner_top_left, R.id.rounded_corner_top_right, R.id.rounded_corner_bottom_left, R.id.rounded_corner_bottom_right }); } @VisibleForTesting Loading Loading @@ -1119,7 +1103,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab } // update all provider views inside overlay updateOverlayProviderViews(); updateOverlayProviderViews(null); } FaceScanningOverlay faceScanningOverlay = Loading Loading @@ -1191,7 +1175,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab context.getResources(), context.getDisplay().getUniqueId()); } private void updateOverlayProviderViews() { private void updateOverlayProviderViews(@Nullable Integer[] filterIds) { if (mOverlays == null) { return; } Loading @@ -1200,7 +1184,8 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab if (overlay == null) { continue; } overlay.onReloadResAndMeasure(null, mProviderRefreshToken, mRotation, mDisplayUniqueId); overlay.onReloadResAndMeasure(filterIds, mProviderRefreshToken, mRotation, mTintColor, mDisplayUniqueId); } } Loading Loading @@ -1239,19 +1224,12 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab } catch (NumberFormatException e) { mRoundedCornerResDelegate.setTuningSizeFactor(null); } Integer[] filterIds = { updateOverlayProviderViews(new Integer[] { R.id.rounded_corner_top_left, R.id.rounded_corner_top_right, R.id.rounded_corner_bottom_left, R.id.rounded_corner_bottom_right }; for (final OverlayWindow overlay: mOverlays) { if (overlay == null) { continue; } overlay.onReloadResAndMeasure(filterIds, mProviderRefreshToken, mRotation, mDisplayUniqueId); } }); updateHwLayerRoundedCornerExistAndSize(); }); } Loading packages/SystemUI/src/com/android/systemui/decor/DecorProvider.kt +5 −3 Original line number Diff line number Diff line Loading @@ -46,14 +46,16 @@ abstract class DecorProvider { view: View, reloadToken: Int, @Surface.Rotation rotation: Int, displayUniqueId: String? = null tintColor: Int, displayUniqueId: String? ) /** Inflate view into parent as current rotation */ abstract fun inflateView( context: Context, parent: ViewGroup, @Surface.Rotation rotation: Int @Surface.Rotation rotation: Int, tintColor: Int ): View } Loading packages/SystemUI/src/com/android/systemui/decor/FaceScanningProviderFactory.kt +9 −2 Original line number Diff line number Diff line Loading @@ -115,19 +115,25 @@ class FaceScanningOverlayProviderImpl( override fun onReloadResAndMeasure( view: View, reloadToken: Int, rotation: Int, @Surface.Rotation rotation: Int, tintColor: Int, displayUniqueId: String? ) { (view.layoutParams as FrameLayout.LayoutParams).let { updateLayoutParams(it, rotation) view.layoutParams = it (view as? FaceScanningOverlay)?.let { overlay -> overlay.setColor(tintColor) overlay.onDisplayChanged(displayUniqueId) } } } override fun inflateView( context: Context, parent: ViewGroup, @Surface.Rotation rotation: Int @Surface.Rotation rotation: Int, tintColor: Int ): View { val view = FaceScanningOverlay( context, Loading @@ -137,6 +143,7 @@ class FaceScanningOverlayProviderImpl( mainExecutor ) view.id = viewId view.setColor(tintColor) FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT).let { updateLayoutParams(it, rotation) Loading packages/SystemUI/src/com/android/systemui/decor/OverlayWindow.kt +18 −12 Original line number Diff line number Diff line Loading @@ -34,9 +34,10 @@ class OverlayWindow(private val context: Context) { fun addDecorProvider( decorProvider: DecorProvider, @Surface.Rotation rotation: Int @Surface.Rotation rotation: Int, tintColor: Int ) { val view = decorProvider.inflateView(context, rootView, rotation) val view = decorProvider.inflateView(context, rootView, rotation, tintColor) viewProviderMap[decorProvider.viewId] = Pair(view, decorProvider) } Loading Loading @@ -82,6 +83,7 @@ class OverlayWindow(private val context: Context) { filterIds: Array<Int>? = null, reloadToken: Int, @Surface.Rotation rotation: Int, tintColor: Int, displayUniqueId: String? = null ) { filterIds?.forEach { id -> Loading @@ -89,16 +91,20 @@ class OverlayWindow(private val context: Context) { it.second.onReloadResAndMeasure( view = it.first, reloadToken = reloadToken, displayUniqueId = displayUniqueId, rotation = rotation) rotation = rotation, tintColor = tintColor, displayUniqueId = displayUniqueId ) } } ?: run { viewProviderMap.values.forEach { it.second.onReloadResAndMeasure( view = it.first, reloadToken = reloadToken, displayUniqueId = displayUniqueId, rotation = rotation) rotation = rotation, tintColor = tintColor, displayUniqueId = displayUniqueId ) } } } Loading Loading
packages/SystemUI/src/com/android/systemui/DisplayCutoutBaseView.kt +32 −21 Original line number Diff line number Diff line Loading @@ -47,7 +47,8 @@ import com.android.systemui.animation.Interpolators open class DisplayCutoutBaseView : View, RegionInterceptableView { private var shouldDrawCutout: Boolean = DisplayCutout.getFillBuiltInDisplayCutout( context.resources, context.display?.uniqueId) context.resources, context.display?.uniqueId ) private var displayUniqueId: String? = null private var displayMode: Display.Mode? = null protected val location = IntArray(2) Loading @@ -74,8 +75,8 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) override fun onAttachedToWindow() { super.onAttachedToWindow() Loading @@ -85,7 +86,7 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { onUpdate() } fun onDisplayChanged(displayId: Int) { fun onDisplayChanged(newDisplayUniqueId: String?) { val oldMode: Display.Mode? = displayMode val display: Display? = context.display displayMode = display?.mode Loading @@ -93,7 +94,8 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { if (displayUniqueId != display?.uniqueId) { displayUniqueId = display?.uniqueId shouldDrawCutout = DisplayCutout.getFillBuiltInDisplayCutout( context.resources, displayUniqueId) context.resources, displayUniqueId ) } // Skip if display mode or cutout hasn't changed. Loading @@ -101,7 +103,7 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { display?.cutout == displayInfo.displayCutout) { return } if (displayId == display?.displayId) { if (newDisplayUniqueId == display?.uniqueId) { updateCutout() updateProtectionBoundingPath() onUpdate() Loading Loading @@ -147,8 +149,9 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { cutoutBounds.translate(-location[0], -location[1]) // Intersect with window's frame cutoutBounds.op(rootView.left, rootView.top, rootView.right, rootView.bottom, Region.Op.INTERSECT) cutoutBounds.op( rootView.left, rootView.top, rootView.right, rootView.bottom, Region.Op.INTERSECT ) return cutoutBounds } Loading @@ -171,9 +174,12 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { protected open fun drawCutoutProtection(canvas: Canvas) { if (cameraProtectionProgress > HIDDEN_CAMERA_PROTECTION_SCALE && !protectionRect.isEmpty) { canvas.scale(cameraProtectionProgress, cameraProtectionProgress, protectionRect.centerX(), protectionRect.centerY()) !protectionRect.isEmpty ) { canvas.scale( cameraProtectionProgress, cameraProtectionProgress, protectionRect.centerX(), protectionRect.centerY() ) canvas.drawPath(protectionPath, paint) } } Loading Loading @@ -205,14 +211,17 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { requestLayout() } cameraProtectionAnimator?.cancel() cameraProtectionAnimator = ValueAnimator.ofFloat(cameraProtectionProgress, if (showProtection) 1.0f else HIDDEN_CAMERA_PROTECTION_SCALE).setDuration(750) cameraProtectionAnimator = ValueAnimator.ofFloat( cameraProtectionProgress, if (showProtection) 1.0f else HIDDEN_CAMERA_PROTECTION_SCALE ).setDuration(750) cameraProtectionAnimator?.interpolator = Interpolators.DECELERATE_QUINT cameraProtectionAnimator?.addUpdateListener(ValueAnimator.AnimatorUpdateListener { animation: ValueAnimator -> cameraProtectionAnimator?.addUpdateListener( ValueAnimator.AnimatorUpdateListener { animation: ValueAnimator -> cameraProtectionProgress = animation.animatedValue as Float invalidate() }) } ) cameraProtectionAnimator?.addListener(object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { cameraProtectionAnimator = null Loading Loading @@ -245,8 +254,10 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { // Apply rotation. val lw: Int = displayInfo.logicalWidth val lh: Int = displayInfo.logicalHeight val flipped = (displayInfo.rotation == Surface.ROTATION_90 || displayInfo.rotation == Surface.ROTATION_270) val flipped = ( displayInfo.rotation == Surface.ROTATION_90 || displayInfo.rotation == Surface.ROTATION_270 ) val dw = if (flipped) lh else lw val dh = if (flipped) lw else lh transformPhysicalToLogicalCoordinates(displayInfo.rotation, dw, dh, m) Loading
packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +27 −49 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; Loading Loading @@ -92,10 +91,8 @@ import com.android.systemui.util.settings.SecureSettings; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.concurrent.Executor; import javax.inject.Inject; Loading Loading @@ -448,6 +445,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab } } boolean needToUpdateProviderViews = false; final String newUniqueId = mDisplayInfo.uniqueId; if (!Objects.equals(newUniqueId, mDisplayUniqueId)) { mDisplayUniqueId = newUniqueId; Loading @@ -470,8 +468,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab updateHwLayerRoundedCornerDrawable(); updateHwLayerRoundedCornerExistAndSize(); } updateOverlayProviderViews(); needToUpdateProviderViews = true; } final float newRatio = getPhysicalPixelDisplaySizeRatio(); Loading @@ -480,7 +477,13 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab if (mScreenDecorHwcLayer != null) { updateHwLayerRoundedCornerExistAndSize(); } updateOverlayProviderViews(); needToUpdateProviderViews = true; } if (needToUpdateProviderViews) { updateOverlayProviderViews(null); } else { updateOverlayProviderViews(new Integer[] { mFaceScanningViewId }); } if (mCutoutViews != null) { Loading @@ -490,18 +493,12 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab if (cutoutView == null) { continue; } cutoutView.onDisplayChanged(displayId); } cutoutView.onDisplayChanged(newUniqueId); } DisplayCutoutView overlay = (DisplayCutoutView) getOverlayView(mFaceScanningViewId); if (overlay != null) { // handle display resolution changes overlay.onDisplayChanged(displayId); } if (mScreenDecorHwcLayer != null) { mScreenDecorHwcLayer.onDisplayChanged(displayId); mScreenDecorHwcLayer.onDisplayChanged(newUniqueId); } } }; Loading Loading @@ -804,7 +801,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab return; } removeOverlayView(provider.getViewId()); overlay.addDecorProvider(provider, mRotation); overlay.addDecorProvider(provider, mRotation, mTintColor); }); } // Use visibility of privacy dot views & face scanning view to determine the overlay's Loading Loading @@ -954,24 +951,6 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab return; } // When the hwc supports screen decorations, the layer will use the A8 color mode which // won't be affected by the color inversion. If the composition goes the client composition // route, the color inversion will be handled by the RenderEngine. final Set<Integer> viewsMayNeedColorUpdate = new HashSet<>(); if (mHwcScreenDecorationSupport == null) { ColorStateList tintList = ColorStateList.valueOf(mTintColor); mRoundedCornerResDelegate.setColorTintList(tintList); viewsMayNeedColorUpdate.add(R.id.rounded_corner_top_left); viewsMayNeedColorUpdate.add(R.id.rounded_corner_top_right); viewsMayNeedColorUpdate.add(R.id.rounded_corner_bottom_left); viewsMayNeedColorUpdate.add(R.id.rounded_corner_bottom_right); viewsMayNeedColorUpdate.add(R.id.display_cutout); } if (getOverlayView(mFaceScanningViewId) != null) { viewsMayNeedColorUpdate.add(mFaceScanningViewId); } final Integer[] views = new Integer[viewsMayNeedColorUpdate.size()]; viewsMayNeedColorUpdate.toArray(views); for (int i = 0; i < BOUNDS_POSITION_LENGTH; i++) { if (mOverlays[i] == null) { continue; Loading @@ -981,14 +960,19 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab View child; for (int j = 0; j < size; j++) { child = overlayView.getChildAt(j); if (viewsMayNeedColorUpdate.contains(child.getId()) && child instanceof DisplayCutoutView) { if (child instanceof DisplayCutoutView && child.getId() == R.id.display_cutout) { ((DisplayCutoutView) child).setColor(mTintColor); } } mOverlays[i].onReloadResAndMeasure(views, mProviderRefreshToken, mRotation, mDisplayUniqueId); } updateOverlayProviderViews(new Integer[] { mFaceScanningViewId, R.id.rounded_corner_top_left, R.id.rounded_corner_top_right, R.id.rounded_corner_bottom_left, R.id.rounded_corner_bottom_right }); } @VisibleForTesting Loading Loading @@ -1119,7 +1103,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab } // update all provider views inside overlay updateOverlayProviderViews(); updateOverlayProviderViews(null); } FaceScanningOverlay faceScanningOverlay = Loading Loading @@ -1191,7 +1175,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab context.getResources(), context.getDisplay().getUniqueId()); } private void updateOverlayProviderViews() { private void updateOverlayProviderViews(@Nullable Integer[] filterIds) { if (mOverlays == null) { return; } Loading @@ -1200,7 +1184,8 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab if (overlay == null) { continue; } overlay.onReloadResAndMeasure(null, mProviderRefreshToken, mRotation, mDisplayUniqueId); overlay.onReloadResAndMeasure(filterIds, mProviderRefreshToken, mRotation, mTintColor, mDisplayUniqueId); } } Loading Loading @@ -1239,19 +1224,12 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab } catch (NumberFormatException e) { mRoundedCornerResDelegate.setTuningSizeFactor(null); } Integer[] filterIds = { updateOverlayProviderViews(new Integer[] { R.id.rounded_corner_top_left, R.id.rounded_corner_top_right, R.id.rounded_corner_bottom_left, R.id.rounded_corner_bottom_right }; for (final OverlayWindow overlay: mOverlays) { if (overlay == null) { continue; } overlay.onReloadResAndMeasure(filterIds, mProviderRefreshToken, mRotation, mDisplayUniqueId); } }); updateHwLayerRoundedCornerExistAndSize(); }); } Loading
packages/SystemUI/src/com/android/systemui/decor/DecorProvider.kt +5 −3 Original line number Diff line number Diff line Loading @@ -46,14 +46,16 @@ abstract class DecorProvider { view: View, reloadToken: Int, @Surface.Rotation rotation: Int, displayUniqueId: String? = null tintColor: Int, displayUniqueId: String? ) /** Inflate view into parent as current rotation */ abstract fun inflateView( context: Context, parent: ViewGroup, @Surface.Rotation rotation: Int @Surface.Rotation rotation: Int, tintColor: Int ): View } Loading
packages/SystemUI/src/com/android/systemui/decor/FaceScanningProviderFactory.kt +9 −2 Original line number Diff line number Diff line Loading @@ -115,19 +115,25 @@ class FaceScanningOverlayProviderImpl( override fun onReloadResAndMeasure( view: View, reloadToken: Int, rotation: Int, @Surface.Rotation rotation: Int, tintColor: Int, displayUniqueId: String? ) { (view.layoutParams as FrameLayout.LayoutParams).let { updateLayoutParams(it, rotation) view.layoutParams = it (view as? FaceScanningOverlay)?.let { overlay -> overlay.setColor(tintColor) overlay.onDisplayChanged(displayUniqueId) } } } override fun inflateView( context: Context, parent: ViewGroup, @Surface.Rotation rotation: Int @Surface.Rotation rotation: Int, tintColor: Int ): View { val view = FaceScanningOverlay( context, Loading @@ -137,6 +143,7 @@ class FaceScanningOverlayProviderImpl( mainExecutor ) view.id = viewId view.setColor(tintColor) FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT).let { updateLayoutParams(it, rotation) Loading
packages/SystemUI/src/com/android/systemui/decor/OverlayWindow.kt +18 −12 Original line number Diff line number Diff line Loading @@ -34,9 +34,10 @@ class OverlayWindow(private val context: Context) { fun addDecorProvider( decorProvider: DecorProvider, @Surface.Rotation rotation: Int @Surface.Rotation rotation: Int, tintColor: Int ) { val view = decorProvider.inflateView(context, rootView, rotation) val view = decorProvider.inflateView(context, rootView, rotation, tintColor) viewProviderMap[decorProvider.viewId] = Pair(view, decorProvider) } Loading Loading @@ -82,6 +83,7 @@ class OverlayWindow(private val context: Context) { filterIds: Array<Int>? = null, reloadToken: Int, @Surface.Rotation rotation: Int, tintColor: Int, displayUniqueId: String? = null ) { filterIds?.forEach { id -> Loading @@ -89,16 +91,20 @@ class OverlayWindow(private val context: Context) { it.second.onReloadResAndMeasure( view = it.first, reloadToken = reloadToken, displayUniqueId = displayUniqueId, rotation = rotation) rotation = rotation, tintColor = tintColor, displayUniqueId = displayUniqueId ) } } ?: run { viewProviderMap.values.forEach { it.second.onReloadResAndMeasure( view = it.first, reloadToken = reloadToken, displayUniqueId = displayUniqueId, rotation = rotation) rotation = rotation, tintColor = tintColor, displayUniqueId = displayUniqueId ) } } } Loading