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

Commit bb2e391c authored by David Lin's avatar David Lin Committed by Android (Google) Code Review
Browse files

Merge "Use opening window with largest screen area during ActivityTransition" into 24D1-dev

parents 47ad7f75 5ee002d9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -342,6 +342,16 @@ flag {
   bug: "298186160"
}

flag {
   name: "activity_transition_use_largest_window"
   namespace: "systemui"
   description: "Target largest opening window during activity transitions."
   bug: "323294573"
   metadata {
       purpose: PURPOSE_BUGFIX
  }
}

flag {
   name: "centralized_status_bar_height_fix"
   namespace: "systemui"
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ android_library {
        "androidx.core_core-animation-nodeps",
        "androidx.core_core-ktx",
        "androidx.annotation_annotation",
        "com_android_systemui_flags_lib",
        "SystemUIShaderLib",
        "WindowManager-Shell-shared",
        "animationlib",
+26 −5
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import androidx.annotation.UiThread
import com.android.app.animation.Interpolators
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.systemui.Flags.activityTransitionUseLargestWindow
import kotlin.math.roundToInt

private const val TAG = "ActivityTransitionAnimator"
@@ -648,6 +649,21 @@ class ActivityTransitionAnimator(
            var candidate: RemoteAnimationTarget? = null
            for (it in apps) {
                if (it.mode == RemoteAnimationTarget.MODE_OPENING) {
                    if (activityTransitionUseLargestWindow()) {
                        if (
                            candidate == null ||
                                !it.hasAnimatingParent && candidate.hasAnimatingParent
                        ) {
                            candidate = it
                            continue
                        }
                        if (
                            !it.hasAnimatingParent &&
                                it.screenSpaceBounds.hasGreaterAreaThan(candidate.screenSpaceBounds)
                        ) {
                            candidate = it
                        }
                    } else {
                        if (!it.hasAnimatingParent) {
                            return it
                        }
@@ -656,6 +672,7 @@ class ActivityTransitionAnimator(
                        }
                    }
                }
            }
            return candidate
        }

@@ -960,5 +977,9 @@ class ActivityTransitionAnimator(
                e.printStackTrace()
            }
        }

        private fun Rect.hasGreaterAreaThan(other: Rect): Boolean {
            return (this.width() * this.height()) > (other.width() * other.height())
        }
    }
}