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

Commit 7ae1ed6d authored by Shawn Lee's avatar Shawn Lee Committed by Android (Google) Code Review
Browse files

Merge "Use opening window with largest screen area during ActivityTransition" into main

parents df602f4f 7a13c84d
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -344,6 +344,16 @@ flag {
   bug: "298186160"
   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 {
flag {
   name: "centralized_status_bar_height_fix"
   name: "centralized_status_bar_height_fix"
   namespace: "systemui"
   namespace: "systemui"
+1 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@ android_library {
        "androidx.core_core-animation-nodeps",
        "androidx.core_core-animation-nodeps",
        "androidx.core_core-ktx",
        "androidx.core_core-ktx",
        "androidx.annotation_annotation",
        "androidx.annotation_annotation",
        "com_android_systemui_flags_lib",
        "SystemUIShaderLib",
        "SystemUIShaderLib",
        "WindowManager-Shell-shared",
        "WindowManager-Shell-shared",
        "animationlib",
        "animationlib",
+26 −5
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@ import androidx.annotation.UiThread
import com.android.app.animation.Interpolators
import com.android.app.animation.Interpolators
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.systemui.Flags.activityTransitionUseLargestWindow
import kotlin.math.roundToInt
import kotlin.math.roundToInt


private const val TAG = "ActivityTransitionAnimator"
private const val TAG = "ActivityTransitionAnimator"
@@ -648,6 +649,21 @@ class ActivityTransitionAnimator(
            var candidate: RemoteAnimationTarget? = null
            var candidate: RemoteAnimationTarget? = null
            for (it in apps) {
            for (it in apps) {
                if (it.mode == RemoteAnimationTarget.MODE_OPENING) {
                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) {
                        if (!it.hasAnimatingParent) {
                            return it
                            return it
                        }
                        }
@@ -656,6 +672,7 @@ class ActivityTransitionAnimator(
                        }
                        }
                    }
                    }
                }
                }
            }
            return candidate
            return candidate
        }
        }


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

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