Merge "Only associate the same windowing mode to a transition info" into sc-dev am: 216d32af4d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14948152 Change-Id: I91df03e864dcb30dd528ea287f9b29cbd4ec5cf2
This commit is contained in:
@@ -312,6 +312,12 @@ class ActivityMetricsLogger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns {@code true} if the incoming activity can belong to this transition. */
|
||||||
|
boolean canCoalesce(ActivityRecord r) {
|
||||||
|
return mLastLaunchedActivity.mDisplayContent == r.mDisplayContent
|
||||||
|
&& mLastLaunchedActivity.getWindowingMode() == r.getWindowingMode();
|
||||||
|
}
|
||||||
|
|
||||||
/** @return {@code true} if the activity matches a launched activity in this transition. */
|
/** @return {@code true} if the activity matches a launched activity in this transition. */
|
||||||
boolean contains(ActivityRecord r) {
|
boolean contains(ActivityRecord r) {
|
||||||
return r != null && (r == mLastLaunchedActivity || mPendingDrawActivities.contains(r));
|
return r != null && (r == mLastLaunchedActivity || mPendingDrawActivities.contains(r));
|
||||||
@@ -604,8 +610,7 @@ class ActivityMetricsLogger {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final DisplayContent targetDisplay = launchedActivity.mDisplayContent;
|
if (info != null && info.canCoalesce(launchedActivity)) {
|
||||||
if (info != null && info.mLastLaunchedActivity.mDisplayContent == targetDisplay) {
|
|
||||||
// If we are already in an existing transition on the same display, only update the
|
// If we are already in an existing transition on the same display, only update the
|
||||||
// activity name, but not the other attributes.
|
// activity name, but not the other attributes.
|
||||||
|
|
||||||
@@ -633,7 +638,7 @@ class ActivityMetricsLogger {
|
|||||||
// As abort for no process switch.
|
// As abort for no process switch.
|
||||||
launchObserverNotifyIntentFailed();
|
launchObserverNotifyIntentFailed();
|
||||||
}
|
}
|
||||||
if (targetDisplay.isSleeping()) {
|
if (launchedActivity.mDisplayContent.isSleeping()) {
|
||||||
// It is unknown whether the activity can be drawn or not, e.g. ut depends on the
|
// It is unknown whether the activity can be drawn or not, e.g. ut depends on the
|
||||||
// keyguard states and the attributes or flags set by the activity. If the activity
|
// keyguard states and the attributes or flags set by the activity. If the activity
|
||||||
// keeps invisible in the grace period, the tracker will be cancelled so it won't get
|
// keeps invisible in the grace period, the tracker will be cancelled so it won't get
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import static org.mockito.Mockito.timeout;
|
|||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.ActivityOptions.SourceInfo;
|
import android.app.ActivityOptions.SourceInfo;
|
||||||
import android.app.WaitResult;
|
import android.app.WaitResult;
|
||||||
|
import android.app.WindowConfiguration;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@@ -476,6 +477,18 @@ public class ActivityMetricsLaunchObserverTests extends WindowTestsBase {
|
|||||||
transitToDrawnAndVerifyOnLaunchFinished(activityOnNewDisplay);
|
transitToDrawnAndVerifyOnLaunchFinished(activityOnNewDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConsecutiveLaunchWithDifferentWindowingMode() {
|
||||||
|
mTopActivity.setWindowingMode(WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW);
|
||||||
|
onActivityLaunched(mTrampolineActivity);
|
||||||
|
mActivityMetricsLogger.notifyActivityLaunching(mTopActivity.intent,
|
||||||
|
mTrampolineActivity /* caller */, mTrampolineActivity.getUid());
|
||||||
|
notifyActivityLaunched(START_SUCCESS, mTopActivity);
|
||||||
|
// Different windowing modes should be independent launch events.
|
||||||
|
transitToDrawnAndVerifyOnLaunchFinished(mTrampolineActivity);
|
||||||
|
transitToDrawnAndVerifyOnLaunchFinished(mTopActivity);
|
||||||
|
}
|
||||||
|
|
||||||
private void transitToDrawnAndVerifyOnLaunchFinished(ActivityRecord activity) {
|
private void transitToDrawnAndVerifyOnLaunchFinished(ActivityRecord activity) {
|
||||||
notifyTransitionStarting(activity);
|
notifyTransitionStarting(activity);
|
||||||
notifyWindowsDrawn(activity);
|
notifyWindowsDrawn(activity);
|
||||||
|
|||||||
Reference in New Issue
Block a user