Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e64bba9 authored by Winson Chung's avatar Winson Chung
Browse files

Add some logging for transposed mode in landscape

Bug: 185820525
Test: Presubmit
Change-Id: Id4cf605fd5c3277273025ac1a73f25add0608412
parent 426bcc77
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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
+10 −0
Original line number Diff line number Diff line
@@ -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;
        }

+9 −0
Original line number Diff line number Diff line
@@ -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;
    }
+3 −1
Original line number Diff line number Diff line
@@ -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();
+1 −0
Original line number Diff line number Diff line
@@ -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";
Loading