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

Commit 7d8f809a authored by Graciela Putri's avatar Graciela Putri Committed by Automerger Merge Worker
Browse files

Merge "Add isAutomaticReachabilityInBookModeEnabled config" into tm-qpr-dev...

Merge "Add isAutomaticReachabilityInBookModeEnabled config" into tm-qpr-dev am: fe1eb226 am: 71adb622

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21957703



Change-Id: Ie0a9acf58b9566f083b18afe185aa049767ed3e8
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents afe25cc2 71adb622
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5498,6 +5498,10 @@
    <!-- Whether vertical reachability repositioning is allowed for letterboxed fullscreen apps. -->
    <bool name="config_letterboxIsVerticalReachabilityEnabled">false</bool>

    <!-- Whether book mode automatic horizontal reachability positioning is allowed for letterboxed
        fullscreen apps -->
    <bool name="config_letterboxIsAutomaticReachabilityInBookModeEnabled">false</bool>

    <!-- Default horizontal position of the letterboxed app window when reachability is
        enabled and an app is fullscreen in landscape device orientation. When reachability is
        enabled, the position can change between left, center and right. This config defines the
+1 −0
Original line number Diff line number Diff line
@@ -4487,6 +4487,7 @@
  <java-symbol type="dimen" name="config_letterboxTabletopModePositionMultiplier" />
  <java-symbol type="bool" name="config_letterboxIsHorizontalReachabilityEnabled" />
  <java-symbol type="bool" name="config_letterboxIsVerticalReachabilityEnabled" />
  <java-symbol type="bool" name="config_letterboxIsAutomaticReachabilityInBookModeEnabled" />
  <java-symbol type="integer" name="config_letterboxDefaultPositionForHorizontalReachability" />
  <java-symbol type="integer" name="config_letterboxDefaultPositionForVerticalReachability" />
  <java-symbol type="integer" name="config_letterboxDefaultPositionForBookModeReachability" />
+1 −1
Original line number Diff line number Diff line
@@ -8649,7 +8649,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        resolvedBounds.set(containingBounds);

        final float letterboxAspectRatioOverride =
                mLetterboxUiController.getFixedOrientationLetterboxAspectRatio();
                mLetterboxUiController.getFixedOrientationLetterboxAspectRatio(newParentConfig);
        final float desiredAspectRatio =
                letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO
                        ? letterboxAspectRatioOverride : computeAspectRatio(parentBounds);
+32 −0
Original line number Diff line number Diff line
@@ -184,6 +184,10 @@ final class LetterboxConfiguration {
    // portrait device orientation.
    private boolean mIsVerticalReachabilityEnabled;

    // Whether book mode automatic horizontal reachability positioning is allowed for letterboxed
    // fullscreen apps in landscape device orientation.
    private boolean mIsAutomaticReachabilityInBookModeEnabled;

    // Whether education is allowed for letterboxed fullscreen apps.
    private boolean mIsEducationEnabled;

@@ -277,6 +281,8 @@ final class LetterboxConfiguration {
                R.bool.config_letterboxIsHorizontalReachabilityEnabled);
        mIsVerticalReachabilityEnabled = mContext.getResources().getBoolean(
                R.bool.config_letterboxIsVerticalReachabilityEnabled);
        mIsAutomaticReachabilityInBookModeEnabled = mContext.getResources().getBoolean(
                R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled);
        mDefaultPositionForHorizontalReachability =
                readLetterboxHorizontalReachabilityPositionFromConfig(mContext, false);
        mDefaultPositionForVerticalReachability =
@@ -681,6 +687,14 @@ final class LetterboxConfiguration {
        return mIsVerticalReachabilityEnabled;
    }

    /*
     * Whether automatic horizontal reachability repositioning in book mode is allowed for
     * letterboxed fullscreen apps in landscape device orientation.
     */
    boolean getIsAutomaticReachabilityInBookModeEnabled() {
        return mIsAutomaticReachabilityInBookModeEnabled;
    }

    /**
     * Overrides whether horizontal reachability repositioning is allowed for letterboxed fullscreen
     * apps in landscape device orientation.
@@ -697,6 +711,14 @@ final class LetterboxConfiguration {
        mIsVerticalReachabilityEnabled = enabled;
    }

    /**
     * Overrides whether automatic horizontal reachability repositioning in book mode is allowed for
     * letterboxed fullscreen apps in landscape device orientation.
     */
    void setIsAutomaticReachabilityInBookModeEnabled(boolean enabled) {
        mIsAutomaticReachabilityInBookModeEnabled = enabled;
    }

    /**
     * Resets whether horizontal reachability repositioning is allowed for letterboxed fullscreen
     * apps in landscape device orientation to
@@ -717,6 +739,16 @@ final class LetterboxConfiguration {
                R.bool.config_letterboxIsVerticalReachabilityEnabled);
    }

    /**
     * Resets whether automatic horizontal reachability repositioning in book mode is
     * allowed for letterboxed fullscreen apps in landscape device orientation to
     * {@link R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled}.
     */
    void resetEnabledAutomaticReachabilityInBookMode() {
        mIsAutomaticReachabilityInBookModeEnabled = mContext.getResources().getBoolean(
                R.bool.config_letterboxIsAutomaticReachabilityInBookModeEnabled);
    }

    /*
     * Gets default horizontal position of the letterboxed app window when horizontal reachability
     * is enabled.
+18 −10
Original line number Diff line number Diff line
@@ -793,13 +793,18 @@ final class LetterboxUiController {
    float getHorizontalPositionMultiplier(Configuration parentConfiguration) {
        // Don't check resolved configuration because it may not be updated yet during
        // configuration change.
        boolean bookMode = isDisplayFullScreenAndInPosture(
                DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */);
        boolean bookModeEnabled = isFullScreenAndBookModeEnabled();
        return isHorizontalReachabilityEnabled(parentConfiguration)
                // Using the last global dynamic position to avoid "jumps" when moving
                // between apps or activities.
                ? mLetterboxConfiguration.getHorizontalMultiplierForReachability(bookMode)
                : mLetterboxConfiguration.getLetterboxHorizontalPositionMultiplier(bookMode);
                ? mLetterboxConfiguration.getHorizontalMultiplierForReachability(bookModeEnabled)
                : mLetterboxConfiguration.getLetterboxHorizontalPositionMultiplier(bookModeEnabled);
    }

    private boolean isFullScreenAndBookModeEnabled() {
        return isDisplayFullScreenAndInPosture(
                DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */)
                && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled();
    }

    float getVerticalPositionMultiplier(Configuration parentConfiguration) {
@@ -814,8 +819,10 @@ final class LetterboxUiController {
                : mLetterboxConfiguration.getLetterboxVerticalPositionMultiplier(tabletopMode);
    }

    float getFixedOrientationLetterboxAspectRatio() {
    float getFixedOrientationLetterboxAspectRatio(@NonNull Configuration parentConfiguration) {
        // Don't resize to split screen size when half folded if letterbox position is centered
        return isDisplayFullScreenAndSeparatingHinge()
                    && getHorizontalPositionMultiplier(parentConfiguration) != 0.5f
                        ? getSplitScreenAspectRatio()
                        : mActivityRecord.shouldCreateCompatDisplayInsets()
                            ? getDefaultMinAspectRatioForUnresizableApps()
@@ -881,7 +888,8 @@ final class LetterboxUiController {
            return;
        }

        boolean isInFullScreenBookMode = isDisplayFullScreenAndSeparatingHinge();
        boolean isInFullScreenBookMode = isDisplayFullScreenAndSeparatingHinge()
                && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled();
        int letterboxPositionForHorizontalReachability = mLetterboxConfiguration
                .getLetterboxPositionForHorizontalReachability(isInFullScreenBookMode);
        if (mLetterbox.getInnerFrame().left > x) {
Loading