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

Commit af8222e7 authored by Vali Calinescu's avatar Vali Calinescu Committed by Automerger Merge Worker
Browse files

Merge "Refresh activity after stronger letterboxing for camera compat" into udc-dev am: 64696fa4

parents 531c586a 64696fa4
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -3865,6 +3865,12 @@
      "group": "WM_DEBUG_ADD_REMOVE",
      "group": "WM_DEBUG_ADD_REMOVE",
      "at": "com\/android\/server\/wm\/WindowState.java"
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    },
    "1511273241": {
      "message": "Refreshing activity for camera compatibility treatment, activityRecord=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/DisplayRotationCompatPolicy.java"
    },
    "1518495446": {
    "1518495446": {
      "message": "removeWindowToken: Attempted to remove non-existing token: %s",
      "message": "removeWindowToken: Attempted to remove non-existing token: %s",
      "level": "WARN",
      "level": "WARN",
@@ -4297,12 +4303,6 @@
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    },
    "1967643923": {
      "message": "Refershing activity for camera compatibility treatment, activityRecord=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/DisplayRotationCompatPolicy.java"
    },
    "1967975839": {
    "1967975839": {
      "message": "Changing app %s visible=%b performLayout=%b",
      "message": "Changing app %s visible=%b performLayout=%b",
      "level": "VERBOSE",
      "level": "VERBOSE",
+7 −4
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ final class DisplayRotationCompatPolicy {
        try {
        try {
            activity.mLetterboxUiController.setIsRefreshAfterRotationRequested(true);
            activity.mLetterboxUiController.setIsRefreshAfterRotationRequested(true);
            ProtoLog.v(WM_DEBUG_STATES,
            ProtoLog.v(WM_DEBUG_STATES,
                    "Refershing activity for camera compatibility treatment, "
                    "Refreshing activity for camera compatibility treatment, "
                            + "activityRecord=%s", activity);
                            + "activityRecord=%s", activity);
            final ClientTransaction transaction = ClientTransaction.obtain(
            final ClientTransaction transaction = ClientTransaction.obtain(
                    activity.app.getThread(), activity.token);
                    activity.app.getThread(), activity.token);
@@ -311,11 +311,14 @@ final class DisplayRotationCompatPolicy {
        }
        }
    }
    }


    // Refreshing only when configuration changes after rotation.
    // Refreshing only when configuration changes after rotation or camera split screen aspect ratio
    // treatment is enabled
    private boolean shouldRefreshActivity(ActivityRecord activity, Configuration newConfig,
    private boolean shouldRefreshActivity(ActivityRecord activity, Configuration newConfig,
            Configuration lastReportedConfig) {
            Configuration lastReportedConfig) {
        return newConfig.windowConfiguration.getDisplayRotation()
        final boolean displayRotationChanged = (newConfig.windowConfiguration.getDisplayRotation()
                        != lastReportedConfig.windowConfiguration.getDisplayRotation()
                != lastReportedConfig.windowConfiguration.getDisplayRotation());
        return (displayRotationChanged
                || activity.mLetterboxUiController.isCameraCompatSplitScreenAspectRatioAllowed())
                && isTreatmentEnabledForActivity(activity)
                && isTreatmentEnabledForActivity(activity)
                && activity.mLetterboxUiController.shouldRefreshActivityForCameraCompat();
                && activity.mLetterboxUiController.shouldRefreshActivityForCameraCompat();
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -214,7 +214,7 @@ final class LetterboxConfiguration {
    // otherwise the apps get blacked out when they are resumed and do not have focus yet.
    // otherwise the apps get blacked out when they are resumed and do not have focus yet.
    private boolean mIsCompatFakeFocusEnabled;
    private boolean mIsCompatFakeFocusEnabled;


    // Whether should use split screen aspect ratio for the activity when camera compat treatment
    // Whether we should use split screen aspect ratio for the activity when camera compat treatment
    // is enabled and activity is connected to the camera in fullscreen.
    // is enabled and activity is connected to the camera in fullscreen.
    private final boolean mIsCameraCompatSplitScreenAspectRatioEnabled;
    private final boolean mIsCameraCompatSplitScreenAspectRatioEnabled;


@@ -1118,7 +1118,7 @@ final class LetterboxConfiguration {
    }
    }


    /**
    /**
     * Whether should use split screen aspect ratio for the activity when camera compat treatment
     * Whether we should use split screen aspect ratio for the activity when camera compat treatment
     * is enabled and activity is connected to the camera in fullscreen.
     * is enabled and activity is connected to the camera in fullscreen.
     */
     */
    boolean isCameraCompatSplitScreenAspectRatioEnabled() {
    boolean isCameraCompatSplitScreenAspectRatioEnabled() {
+1 −1
Original line number Original line Diff line number Diff line
@@ -958,7 +958,7 @@ final class LetterboxUiController {
     * Whether we use split screen aspect ratio for the activity when camera compat treatment
     * Whether we use split screen aspect ratio for the activity when camera compat treatment
     * is active because the corresponding config is enabled and activity supports resizing.
     * is active because the corresponding config is enabled and activity supports resizing.
     */
     */
    private boolean isCameraCompatSplitScreenAspectRatioAllowed() {
    boolean isCameraCompatSplitScreenAspectRatioAllowed() {
        return mLetterboxConfiguration.isCameraCompatSplitScreenAspectRatioEnabled()
        return mLetterboxConfiguration.isCameraCompatSplitScreenAspectRatioEnabled()
                && !mActivityRecord.shouldCreateCompatDisplayInsets();
                && !mActivityRecord.shouldCreateCompatDisplayInsets();
    }
    }
+15 −0
Original line number Original line Diff line number Diff line
@@ -479,6 +479,8 @@ public final class DisplayRotationCompatPolicyTests extends WindowTestsBase {
    public void testOnActivityConfigurationChanging_displayRotationNotChanging_noRefresh()
    public void testOnActivityConfigurationChanging_displayRotationNotChanging_noRefresh()
            throws Exception {
            throws Exception {
        configureActivity(SCREEN_ORIENTATION_PORTRAIT);
        configureActivity(SCREEN_ORIENTATION_PORTRAIT);
        doReturn(false).when(mActivity.mLetterboxUiController)
                .isCameraCompatSplitScreenAspectRatioAllowed();


        mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
        mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
        callOnActivityConfigurationChanging(mActivity, /* isDisplayRotationChanging */ false);
        callOnActivityConfigurationChanging(mActivity, /* isDisplayRotationChanging */ false);
@@ -486,6 +488,19 @@ public final class DisplayRotationCompatPolicyTests extends WindowTestsBase {
        assertActivityRefreshRequested(/* refreshRequested */ false);
        assertActivityRefreshRequested(/* refreshRequested */ false);
    }
    }


    @Test
    public void testOnActivityConfigurationChanging_splitScreenAspectRatioAllowed_refresh()
            throws Exception {
        configureActivity(SCREEN_ORIENTATION_PORTRAIT);
        doReturn(true).when(mActivity.mLetterboxUiController)
                .isCameraCompatSplitScreenAspectRatioAllowed();

        mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
        callOnActivityConfigurationChanging(mActivity, /* isDisplayRotationChanging */ false);

        assertActivityRefreshRequested(/* refreshRequested */ true);
    }

    @Test
    @Test
    public void testOnActivityConfigurationChanging_cycleThroughStopDisabled() throws Exception {
    public void testOnActivityConfigurationChanging_cycleThroughStopDisabled() throws Exception {
        when(mLetterboxConfiguration.isCameraCompatRefreshCycleThroughStopEnabled())
        when(mLetterboxConfiguration.isCameraCompatRefreshCycleThroughStopEnabled())