Add some logging for transposed mode in landscape

Bug: 185820525
Test: Presubmit
Change-Id: Id4cf605fd5c3277273025ac1a73f25add0608412
This commit is contained in:
Winson Chung 2021-04-20 13:26:26 -07:00
parent 426bcc7715
commit 8e64bba9cf
6 changed files with 32 additions and 1 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -566,7 +566,9 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
}
private void onIdpChanged(InvariantDeviceProfile idp) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "onIdpChanged", new Throwable());
}
initDeviceProfile(idp);
dispatchDeviceProfileChanged();
reapplyUi();

View File

@ -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";

View File

@ -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");
}
};
}