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

Commit e349d66a authored by Ikram Gabiyev's avatar Ikram Gabiyev Committed by Android (Google) Code Review
Browse files

Merge "Moving shared classes to common.pip package 5/N" into main

parents 8792597c c7ab83f4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.content.res.Resources
import android.graphics.PointF
import android.util.Size
import com.android.wm.shell.R
import com.android.wm.shell.pip.PipDisplayLayoutState

class LegacySizeSpecSource(
        private val context: Context,
+2 −5
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.wm.shell.pip.phone;
package com.android.wm.shell.common.pip;

import android.content.Context;
import android.content.res.Resources;
@@ -24,9 +24,6 @@ import android.util.ArraySet;
import android.view.Gravity;

import com.android.wm.shell.R;
import com.android.wm.shell.pip.PipBoundsAlgorithm;
import com.android.wm.shell.pip.PipBoundsState;
import com.android.wm.shell.pip.PipKeepClearAlgorithmInterface;

import java.util.Set;

+0 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.content.res.Resources
import android.os.SystemProperties
import android.util.Size
import com.android.wm.shell.R
import com.android.wm.shell.pip.PipDisplayLayoutState
import java.io.PrintWriter

class PhoneSizeSpecSource(
+5 −6
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.wm.shell.pip;
package com.android.wm.shell.common.pip;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -28,8 +28,6 @@ import android.util.Size;
import android.view.Gravity;

import com.android.wm.shell.R;
import com.android.wm.shell.common.pip.PipUtils;
import com.android.wm.shell.common.pip.SizeSpecSource;

import java.io.PrintWriter;

@@ -202,7 +200,8 @@ public class PipBoundsAlgorithm {
     *
     * @return {@code false} if the given source is too small to use for the entering animation.
     */
    static boolean isSourceRectHintValidForEnterPip(Rect sourceRectHint, Rect destinationBounds) {
    public static boolean isSourceRectHintValidForEnterPip(Rect sourceRectHint,
            Rect destinationBounds) {
        return sourceRectHint != null
                && sourceRectHint.width() > destinationBounds.width()
                && sourceRectHint.height() > destinationBounds.height();
@@ -224,7 +223,7 @@ public class PipBoundsAlgorithm {
    }

    /**
     * @return whether the given {@param aspectRatio} is valid.
     * @return whether the given aspectRatio is valid.
     */
    public boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
        return Float.compare(mMinAspectRatio, aspectRatio) <= 0
+20 −7
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.wm.shell.pip;
package com.android.wm.shell.common.pip;

import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -36,7 +36,6 @@ import com.android.internal.protolog.common.ProtoLog;
import com.android.internal.util.function.TriConsumer;
import com.android.wm.shell.R;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.pip.SizeSpecSource;
import com.android.wm.shell.protolog.ShellProtoLogGroup;

import java.io.PrintWriter;
@@ -314,8 +313,11 @@ public class PipBoundsState {
        return mPipDisplayLayoutState.getDisplayLayout();
    }

    /**
     * Clears the PiP re-entry state.
     */
    @VisibleForTesting
    void clearReentryState() {
    public void clearReentryState() {
        mPipReentryState = null;
    }

@@ -400,11 +402,18 @@ public class PipBoundsState {
        mNamedUnrestrictedKeepClearAreas.remove(name);
    }


    /**
     * @return restricted keep clear areas.
     */
    @NonNull
    public Set<Rect> getRestrictedKeepClearAreas() {
        return mRestrictedKeepClearAreas;
    }

    /**
     * @return unrestricted keep clear areas.
     */
    @NonNull
    public Set<Rect> getUnrestrictedKeepClearAreas() {
        if (mNamedUnrestrictedKeepClearAreas.isEmpty()) return mUnrestrictedKeepClearAreas;
@@ -561,7 +570,11 @@ public class PipBoundsState {
        }
    }

    static final class PipReentryState {
    /**
     * Represents the state of pip to potentially restore upon reentry.
     */
    @VisibleForTesting
    public static final class PipReentryState {
        private static final String TAG = PipReentryState.class.getSimpleName();

        private final @Nullable Size mSize;
@@ -573,11 +586,11 @@ public class PipBoundsState {
        }

        @Nullable
        Size getSize() {
        public Size getSize() {
            return mSize;
        }

        float getSnapFraction() {
        public float getSnapFraction() {
            return mSnapFraction;
        }

Loading