From 8e64bba9cf5079dadc677d876958afc2f4aea706 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 20 Apr 2021 13:26:26 -0700 Subject: [PATCH] Add some logging for transposed mode in landscape Bug: 185820525 Test: Presubmit Change-Id: Id4cf605fd5c3277273025ac1a73f25add0608412 --- .../src/com/android/quickstep/TaplTestsQuickstep.java | 4 ++++ src/com/android/launcher3/DeviceProfile.java | 10 ++++++++++ src/com/android/launcher3/InvariantDeviceProfile.java | 9 +++++++++ src/com/android/launcher3/Launcher.java | 4 +++- src/com/android/launcher3/testing/TestProtocol.java | 1 + .../android/launcher3/ui/PortraitLandscapeRunner.java | 5 +++++ 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 0fe5432ceb..a700e16d64 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import android.content.Intent; +import android.util.Log; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -36,6 +37,7 @@ import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel; import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.OverviewActions; import com.android.launcher3.tapl.OverviewTask; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.ui.TaplTestsLauncher3; import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch; import com.android.quickstep.views.RecentsView; @@ -187,10 +189,12 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @NavigationModeSwitch @PortraitLandscape public void testSwitchToOverview() throws Exception { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "testSwitchToOverview"); assertNotNull("Workspace.switchToOverview() returned null", mLauncher.pressHome().switchToOverview()); assertTrue("Launcher internal state didn't switch to Overview", isInState(() -> LauncherState.OVERVIEW)); + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "testSwitchToOverview finished"); } @Test diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 985a445f81..dae4f3b8dd 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -25,6 +25,7 @@ import android.content.res.Resources; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; +import android.util.Log; import android.view.Surface; import android.view.WindowInsets; import android.view.WindowManager; @@ -35,6 +36,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.IconShape; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.icons.IconNormalizer; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.DisplayController.Info; import com.android.launcher3.util.WindowBounds; @@ -973,6 +975,10 @@ public class DeviceProfile { mInfo = info; mTransposeLayoutWithOrientation = context.getResources() .getBoolean(R.bool.hotseat_transpose_layout_with_orientation); + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, + "transposeLayout=" + mTransposeLayoutWithOrientation); + } } public Builder setSizeRange(Point minSize, Point maxSize) { @@ -985,6 +991,10 @@ public class DeviceProfile { mWidth = width; mHeight = height; mIsLandscape = mWidth > mHeight; + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, + "isLandscape=" + mIsLandscape + " w=" + mWidth + " h=" + mHeight); + } return this; } diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index f19877793b..a863e6b55c 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -48,6 +48,7 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.graphics.IconShape; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.ConfigMonitor; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.DisplayController.Info; @@ -338,6 +339,10 @@ public class InvariantDeviceProfile { DeviceProfile.Builder builder = new DeviceProfile.Builder(context, this, displayInfo) .setSizeRange(new Point(displayInfo.smallestSize), new Point(displayInfo.largestSize)); + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, + "largeSide=" + largeSide + " smallSide=" + smallSide); + } landscapeProfile = builder.setSize(largeSide, smallSide).build(); portraitProfile = builder.setSize(smallSide, largeSide).build(); @@ -571,6 +576,10 @@ public class InvariantDeviceProfile { } public DeviceProfile getDeviceProfile(Context context) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "getDeviceProfile: orientation=" + + context.getResources().getConfiguration().orientation, new Throwable()); + } return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? landscapeProfile : portraitProfile; } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 3236f5d542..30dd5481d2 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -566,7 +566,9 @@ public class Launcher extends StatefulActivity implements Launche } private void onIdpChanged(InvariantDeviceProfile idp) { - + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "onIdpChanged", new Throwable()); + } initDeviceProfile(idp); dispatchDeviceProfileChanged(); reapplyUi(); diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 18f1df18cb..3296ea51f6 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -109,6 +109,7 @@ public final class TestProtocol { public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation"; public static final String PERMANENT_DIAG_TAG = "TaplTarget"; + public static final String LAUNCHER_NOT_TRANSPOSED = "b/185820525"; public static final String NO_SWIPE_TO_HOME = "b/158017601"; public static final String WORK_PROFILE_REMOVED = "b/159671700"; public static final String TIS_NO_EVENTS = "b/180915942"; diff --git a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java b/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java index 266f0aeb1d..6c68daa8c1 100644 --- a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java +++ b/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java @@ -4,6 +4,7 @@ import android.util.Log; import android.view.Surface; import com.android.launcher3.tapl.TestHelpers; +import com.android.launcher3.testing.TestProtocol; import org.junit.rules.TestRule; import org.junit.runner.Description; @@ -54,19 +55,23 @@ class PortraitLandscapeRunner implements TestRule { } private void evaluateInPortrait() throws Throwable { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInPortrait"); mTest.mDevice.setOrientationNatural(); mTest.mLauncher.setExpectedRotation(Surface.ROTATION_0); AbstractLauncherUiTest.checkDetectedLeaks(mTest.mLauncher); base.evaluate(); mTest.getDevice().pressHome(); + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInPortrait finished"); } private void evaluateInLandscape() throws Throwable { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInLandscape"); mTest.mDevice.setOrientationLeft(); mTest.mLauncher.setExpectedRotation(Surface.ROTATION_90); AbstractLauncherUiTest.checkDetectedLeaks(mTest.mLauncher); base.evaluate(); mTest.getDevice().pressHome(); + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInLandscape finished"); } }; }