diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index ea0f343e80f45..0b8d8563802d9 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -84,8 +84,6 @@ import com.android.systemui.qs.SettingObserver; import com.android.systemui.settings.DisplayTracker; import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.events.PrivacyDotViewController; -import com.android.systemui.tuner.TunerService; -import com.android.systemui.tuner.TunerService.Tunable; import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.concurrency.ThreadFactory; import com.android.systemui.util.settings.SecureSettings; @@ -105,18 +103,15 @@ import javax.inject.Inject; * for antialiasing and emulation purposes. */ @SysUISingleton -public class ScreenDecorations implements CoreStartable, Tunable , Dumpable { +public class ScreenDecorations implements CoreStartable, Dumpable { private static final boolean DEBUG = false; private static final String TAG = "ScreenDecorations"; - public static final String SIZE = "sysui_rounded_size"; - public static final String PADDING = "sysui_rounded_content_padding"; // Provide a way for factory to disable ScreenDecorations to run the Display tests. private static final boolean DEBUG_DISABLE_SCREEN_DECORATIONS = SystemProperties.getBoolean("debug.disable_screen_decorations", false); private static final boolean DEBUG_SCREENSHOT_ROUNDED_CORNERS = SystemProperties.getBoolean("debug.screenshot_rounded_corners", false); - private static final boolean VERBOSE = false; static final boolean DEBUG_COLOR = DEBUG_SCREENSHOT_ROUNDED_CORNERS; private static final int[] DISPLAY_CUTOUT_IDS = { @@ -134,7 +129,6 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable { protected boolean mIsRegistered; private final Context mContext; private final Executor mMainExecutor; - private final TunerService mTunerService; private final SecureSettings mSecureSettings; @VisibleForTesting DisplayTracker.Callback mDisplayListener; @@ -315,7 +309,6 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable { public ScreenDecorations(Context context, @Main Executor mainExecutor, SecureSettings secureSettings, - TunerService tunerService, UserTracker userTracker, DisplayTracker displayTracker, PrivacyDotViewController dotViewController, @@ -327,7 +320,6 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable { mContext = context; mMainExecutor = mainExecutor; mSecureSettings = secureSettings; - mTunerService = tunerService; mUserTracker = userTracker; mDisplayTracker = displayTracker; mDotViewController = dotViewController; @@ -608,12 +600,6 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable { return; } - mMainExecutor.execute(() -> { - Trace.beginSection("ScreenDecorations#addTunable"); - mTunerService.addTunable(this, SIZE); - Trace.endSection(); - }); - // Watch color inversion and invert the overlay as needed. if (mColorInversionSetting == null) { mColorInversionSetting = new SettingObserver(mSecureSettings, mHandler, @@ -632,12 +618,6 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable { mUserTracker.addCallback(mUserChangedCallback, mExecutor); mIsRegistered = true; } else { - mMainExecutor.execute(() -> { - Trace.beginSection("ScreenDecorations#removeTunable"); - mTunerService.removeTunable(this); - Trace.endSection(); - }); - if (mColorInversionSetting != null) { mColorInversionSetting.setListening(false); } @@ -1170,34 +1150,6 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable { Trace.endSection(); } - @Override - public void onTuningChanged(String key, String newValue) { - if (DEBUG_DISABLE_SCREEN_DECORATIONS) { - Log.i(TAG, "ScreenDecorations is disabled"); - return; - } - mExecutor.execute(() -> { - if (mOverlays == null || !SIZE.equals(key)) { - return; - } - Trace.beginSection("ScreenDecorations#onTuningChanged"); - try { - final int sizeFactor = Integer.parseInt(newValue); - mRoundedCornerResDelegate.setTuningSizeFactor(sizeFactor); - } catch (NumberFormatException e) { - mRoundedCornerResDelegate.setTuningSizeFactor(null); - } - 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 - }); - updateHwLayerRoundedCornerExistAndSize(); - Trace.endSection(); - }); - } - private void updateHwLayerRoundedCornerDrawable() { if (mScreenDecorHwcLayer == null) { return; diff --git a/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt b/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt index 8b4aeefb6ed43..5f5ca54bd01f3 100644 --- a/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt +++ b/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt @@ -55,15 +55,6 @@ class RoundedCornerResDelegate( var bottomRoundedSize = Size(0, 0) private set - var tuningSizeFactor: Int? = null - set(value) { - if (field == value) { - return - } - field = value - reloadMeasures() - } - var physicalPixelDisplaySizeRatio: Float = 1f set(value) { if (field == value) { @@ -122,19 +113,6 @@ class RoundedCornerResDelegate( bottomRoundedSize = Size(it.intrinsicWidth, it.intrinsicHeight) } - tuningSizeFactor?.let { - if (it <= 0) { - return - } - val length: Int = (it * density).toInt() - if (topRoundedSize.width > 0) { - topRoundedSize = Size(length, length) - } - if (bottomRoundedSize.width > 0) { - bottomRoundedSize = Size(length, length) - } - } - if (physicalPixelDisplaySizeRatio != 1f) { if (topRoundedSize.width != 0) { topRoundedSize = Size( diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java index 4cf5a4be0b601..a6006a1e6a48b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java @@ -43,7 +43,6 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -96,7 +95,6 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.settings.FakeDisplayTracker; import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.events.PrivacyDotViewController; -import com.android.systemui.tuner.TunerService; import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.concurrency.FakeThreadFactory; import com.android.systemui.util.settings.FakeSettings; @@ -139,8 +137,6 @@ public class ScreenDecorationsTest extends SysuiTestCase { @Mock private Display mDisplay; @Mock - private TunerService mTunerService; - @Mock private UserTracker mUserTracker; @Mock private PrivacyDotViewController mDotViewController; @@ -234,7 +230,7 @@ public class ScreenDecorationsTest extends SysuiTestCase { new ScreenDecorationsLogger(logcatLogBuffer("TestLogBuffer")))); mScreenDecorations = spy(new ScreenDecorations(mContext, mExecutor, mSecureSettings, - mTunerService, mUserTracker, mDisplayTracker, mDotViewController, mThreadFactory, + mUserTracker, mDisplayTracker, mDotViewController, mThreadFactory, mPrivacyDotDecorProviderFactory, mFaceScanningProviderFactory, new ScreenDecorationsLogger(logcatLogBuffer("TestLogBuffer")), mAuthController) { @@ -250,12 +246,6 @@ public class ScreenDecorationsTest extends SysuiTestCase { mExecutor.runAllReady(); } - @Override - public void onTuningChanged(String key, String newValue) { - super.onTuningChanged(key, newValue); - mExecutor.runAllReady(); - } - @Override protected void updateOverlayWindowVisibilityIfViewExists(@Nullable View view) { super.updateOverlayWindowVisibilityIfViewExists(view); @@ -270,7 +260,6 @@ public class ScreenDecorationsTest extends SysuiTestCase { mScreenDecorations.mDisplayInfo = mDisplayInfo; doReturn(1f).when(mScreenDecorations).getPhysicalPixelDisplaySizeRatio(); doNothing().when(mScreenDecorations).updateOverlayProviderViews(any()); - reset(mTunerService); try { mPrivacyDotShowingListener = mScreenDecorations.mPrivacyDotShowingListener.getClass() @@ -464,8 +453,6 @@ public class ScreenDecorationsTest extends SysuiTestCase { mScreenDecorations.start(); // No views added. verifyOverlaysExistAndAdded(false, false, false, false, null); - // No Tuners tuned. - verify(mTunerService, never()).addTunable(any(), any()); // No dot controller init verify(mDotViewController, never()).initialize(any(), any(), any(), any()); } @@ -497,8 +484,6 @@ public class ScreenDecorationsTest extends SysuiTestCase { // Face scanning doesn't exist verifyFaceScanningViewExists(false); - // One tunable. - verify(mTunerService, times(1)).addTunable(any(), any()); // Dot controller init verify(mDotViewController, times(1)).initialize( isA(View.class), isA(View.class), isA(View.class), isA(View.class)); @@ -528,8 +513,6 @@ public class ScreenDecorationsTest extends SysuiTestCase { // Face scanning doesn't exist verifyFaceScanningViewExists(false); - // One tunable. - verify(mTunerService, times(1)).addTunable(any(), any()); // No dot controller init verify(mDotViewController, never()).initialize(any(), any(), any(), any()); } @@ -560,8 +543,6 @@ public class ScreenDecorationsTest extends SysuiTestCase { // Face scanning doesn't exist verifyFaceScanningViewExists(false); - // One tunable. - verify(mTunerService, times(1)).addTunable(any(), any()); // Dot controller init verify(mDotViewController, times(1)).initialize( isA(View.class), isA(View.class), isA(View.class), isA(View.class)); @@ -1076,15 +1057,10 @@ public class ScreenDecorationsTest extends SysuiTestCase { public void testRegistration_From_NoOverlay_To_HasOverlays() { doReturn(false).when(mScreenDecorations).hasOverlays(); mScreenDecorations.start(); - verify(mTunerService, times(0)).addTunable(any(), any()); - verify(mTunerService, times(1)).removeTunable(any()); assertThat(mScreenDecorations.mIsRegistered, is(false)); - reset(mTunerService); doReturn(true).when(mScreenDecorations).hasOverlays(); mScreenDecorations.onConfigurationChanged(new Configuration()); - verify(mTunerService, times(1)).addTunable(any(), any()); - verify(mTunerService, times(0)).removeTunable(any()); assertThat(mScreenDecorations.mIsRegistered, is(true)); } @@ -1093,14 +1069,9 @@ public class ScreenDecorationsTest extends SysuiTestCase { doReturn(true).when(mScreenDecorations).hasOverlays(); mScreenDecorations.start(); - verify(mTunerService, times(1)).addTunable(any(), any()); - verify(mTunerService, times(0)).removeTunable(any()); assertThat(mScreenDecorations.mIsRegistered, is(true)); - reset(mTunerService); mScreenDecorations.onConfigurationChanged(new Configuration()); - verify(mTunerService, times(0)).addTunable(any(), any()); - verify(mTunerService, times(0)).removeTunable(any()); assertThat(mScreenDecorations.mIsRegistered, is(true)); } @@ -1109,15 +1080,10 @@ public class ScreenDecorationsTest extends SysuiTestCase { doReturn(true).when(mScreenDecorations).hasOverlays(); mScreenDecorations.start(); - verify(mTunerService, times(1)).addTunable(any(), any()); - verify(mTunerService, times(0)).removeTunable(any()); assertThat(mScreenDecorations.mIsRegistered, is(true)); - reset(mTunerService); doReturn(false).when(mScreenDecorations).hasOverlays(); mScreenDecorations.onConfigurationChanged(new Configuration()); - verify(mTunerService, times(0)).addTunable(any(), any()); - verify(mTunerService, times(1)).removeTunable(any()); assertThat(mScreenDecorations.mIsRegistered, is(false)); } @@ -1181,7 +1147,7 @@ public class ScreenDecorationsTest extends SysuiTestCase { when(mFaceScanningProviderFactory.getProviders()).thenReturn(mFaceScanningProviders); when(mFaceScanningProviderFactory.getHasProviders()).thenReturn(true); ScreenDecorations screenDecorations = new ScreenDecorations(mContext, mExecutor, - mSecureSettings, mTunerService, mUserTracker, mDisplayTracker, mDotViewController, + mSecureSettings, mUserTracker, mDisplayTracker, mDotViewController, mThreadFactory, mPrivacyDotDecorProviderFactory, mFaceScanningProviderFactory, new ScreenDecorationsLogger(logcatLogBuffer("TestLogBuffer")), mAuthController); screenDecorations.start(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt index 93a1868b72f51..3912bc0e354e3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt @@ -108,27 +108,6 @@ class RoundedCornerResDelegateTest : SysuiTestCase() { assertEquals(Size(8, 8), roundedCornerResDelegate.bottomRoundedSize) } - @Test - fun testUpdateTuningSizeFactor() { - setupResources(radius = 100, - roundedTopDrawable = getTestsDrawable(R.drawable.rounded3px), - roundedBottomDrawable = getTestsDrawable(R.drawable.rounded4px)) - - roundedCornerResDelegate = RoundedCornerResDelegate(mContext.resources, null) - - val factor = 5 - roundedCornerResDelegate.tuningSizeFactor = factor - val length = (factor * mContext.resources.displayMetrics.density).toInt() - - assertEquals(Size(length, length), roundedCornerResDelegate.topRoundedSize) - assertEquals(Size(length, length), roundedCornerResDelegate.bottomRoundedSize) - - roundedCornerResDelegate.tuningSizeFactor = null - - assertEquals(Size(3, 3), roundedCornerResDelegate.topRoundedSize) - assertEquals(Size(4, 4), roundedCornerResDelegate.bottomRoundedSize) - } - @Test fun testPhysicalPixelDisplaySizeChanged() { setupResources(