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

Commit 1453ebee authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Add device config for experiment of ignoring activity orientation" into main

parents dc30d71a 64821125
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8152,6 +8152,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     */
    @Override
    protected int getOverrideOrientation() {
        if (mWmService.mConstants.mIgnoreActivityOrientationRequest) {
            return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        }
        return mAppCompatController.getOrientationPolicy()
                .overrideOrientationIfNeeded(super.getOverrideOrientation());
    }
+19 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@ import java.util.concurrent.Executor;
 */
final class WindowManagerConstants {

    /** The orientation of activity will be always "unspecified". */
    private static final String KEY_IGNORE_ACTIVITY_ORIENTATION_REQUEST =
            "ignore_activity_orientation_request";

    /**
     * The minimum duration between gesture exclusion logging for a given window in
     * milliseconds.
@@ -58,6 +62,9 @@ final class WindowManagerConstants {
    /** @see AndroidDeviceConfig#KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE */
    boolean mSystemGestureExcludedByPreQStickyImmersive;

    /** @see #KEY_IGNORE_ACTIVITY_ORIENTATION_REQUEST */
    boolean mIgnoreActivityOrientationRequest;

    private final WindowManagerGlobalLock mGlobalLock;
    private final Runnable mUpdateSystemGestureExclusionCallback;
    private final DeviceConfigInterface mDeviceConfig;
@@ -89,6 +96,7 @@ final class WindowManagerConstants {
        updateSystemGestureExclusionLogDebounceMillis();
        updateSystemGestureExclusionLimitDp();
        updateSystemGestureExcludedByPreQStickyImmersive();
        updateIgnoreActivityOrientationRequest();
    }

    private void onAndroidPropertiesChanged(DeviceConfig.Properties properties) {
@@ -127,6 +135,9 @@ final class WindowManagerConstants {
                    case KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS:
                        updateSystemGestureExclusionLogDebounceMillis();
                        break;
                    case KEY_IGNORE_ACTIVITY_ORIENTATION_REQUEST:
                        updateIgnoreActivityOrientationRequest();
                        break;
                    default:
                        break;
                }
@@ -152,6 +163,12 @@ final class WindowManagerConstants {
                KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE, false);
    }

    private void updateIgnoreActivityOrientationRequest() {
        mIgnoreActivityOrientationRequest = mDeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_WINDOW_MANAGER,
                KEY_IGNORE_ACTIVITY_ORIENTATION_REQUEST, false);
    }

    void dump(PrintWriter pw) {
        pw.println("WINDOW MANAGER CONSTANTS (dumpsys window constants):");

@@ -161,6 +178,8 @@ final class WindowManagerConstants {
        pw.print("="); pw.println(mSystemGestureExclusionLimitDp);
        pw.print("  "); pw.print(KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE);
        pw.print("="); pw.println(mSystemGestureExcludedByPreQStickyImmersive);
        pw.print("  "); pw.print(KEY_IGNORE_ACTIVITY_ORIENTATION_REQUEST);
        pw.print("="); pw.println(mIgnoreActivityOrientationRequest);
        pw.println();
    }
}