Merge "Consider "similar" change modes the same for promotion purposes" into tm-qpr-dev
This commit is contained in:
@@ -1331,7 +1331,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
|
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
|
||||||
" sibling is a participant with mode %s",
|
" sibling is a participant with mode %s",
|
||||||
TransitionInfo.modeToString(siblingMode));
|
TransitionInfo.modeToString(siblingMode));
|
||||||
if (mode != siblingMode) {
|
if (reduceMode(mode) != reduceMode(siblingMode)) {
|
||||||
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
|
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
|
||||||
" SKIP: common mode mismatch. was %s",
|
" SKIP: common mode mismatch. was %s",
|
||||||
TransitionInfo.modeToString(mode));
|
TransitionInfo.modeToString(mode));
|
||||||
@@ -1341,6 +1341,16 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** "reduces" a mode into a smaller set of modes that uniquely represents visibility change. */
|
||||||
|
@TransitionInfo.TransitionMode
|
||||||
|
private static int reduceMode(@TransitionInfo.TransitionMode int mode) {
|
||||||
|
switch (mode) {
|
||||||
|
case TRANSIT_TO_BACK: return TRANSIT_CLOSE;
|
||||||
|
case TRANSIT_TO_FRONT: return TRANSIT_OPEN;
|
||||||
|
default: return mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Go through topTargets and try to promote (see {@link #canPromote}) one of them.
|
* Go through topTargets and try to promote (see {@link #canPromote}) one of them.
|
||||||
*
|
*
|
||||||
@@ -1842,7 +1852,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
@TransitionInfo.TransitionMode
|
@TransitionInfo.TransitionMode
|
||||||
int getTransitMode(@NonNull WindowContainer wc) {
|
int getTransitMode(@NonNull WindowContainer wc) {
|
||||||
if ((mFlags & ChangeInfo.FLAG_ABOVE_TRANSIENT_LAUNCH) != 0) {
|
if ((mFlags & ChangeInfo.FLAG_ABOVE_TRANSIENT_LAUNCH) != 0) {
|
||||||
return TRANSIT_CLOSE;
|
return mExistenceChanged ? TRANSIT_CLOSE : TRANSIT_TO_BACK;
|
||||||
}
|
}
|
||||||
final boolean nowVisible = wc.isVisibleRequested();
|
final boolean nowVisible = wc.isVisibleRequested();
|
||||||
if (nowVisible == mVisible) {
|
if (nowVisible == mVisible) {
|
||||||
|
|||||||
@@ -392,6 +392,70 @@ public class TransitionTests extends WindowTestsBase {
|
|||||||
tasks[showWallpaperTask].mRemoteToken.toWindowContainerToken()).getFlags());
|
tasks[showWallpaperTask].mRemoteToken.toWindowContainerToken()).getFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateInfo_PromoteSimilarClose() {
|
||||||
|
final Transition transition = createTestTransition(TRANSIT_CLOSE);
|
||||||
|
ArrayMap<WindowContainer, Transition.ChangeInfo> changes = transition.mChanges;
|
||||||
|
ArraySet<WindowContainer> participants = transition.mParticipants;
|
||||||
|
|
||||||
|
final Task topTask = createTask(mDisplayContent);
|
||||||
|
final Task belowTask = createTask(mDisplayContent);
|
||||||
|
final ActivityRecord showing = createActivityRecord(belowTask);
|
||||||
|
final ActivityRecord hiding = createActivityRecord(topTask);
|
||||||
|
final ActivityRecord closing = createActivityRecord(topTask);
|
||||||
|
// Start states.
|
||||||
|
changes.put(topTask, new Transition.ChangeInfo(true /* vis */, false /* exChg */));
|
||||||
|
changes.put(belowTask, new Transition.ChangeInfo(false /* vis */, false /* exChg */));
|
||||||
|
changes.put(showing, new Transition.ChangeInfo(false /* vis */, false /* exChg */));
|
||||||
|
changes.put(hiding, new Transition.ChangeInfo(true /* vis */, false /* exChg */));
|
||||||
|
changes.put(closing, new Transition.ChangeInfo(true /* vis */, true /* exChg */));
|
||||||
|
fillChangeMap(changes, topTask);
|
||||||
|
// End states.
|
||||||
|
showing.mVisibleRequested = true;
|
||||||
|
closing.mVisibleRequested = false;
|
||||||
|
hiding.mVisibleRequested = false;
|
||||||
|
|
||||||
|
participants.add(belowTask);
|
||||||
|
participants.add(hiding);
|
||||||
|
participants.add(closing);
|
||||||
|
ArrayList<WindowContainer> targets = Transition.calculateTargets(participants, changes);
|
||||||
|
assertEquals(2, targets.size());
|
||||||
|
assertTrue(targets.contains(belowTask));
|
||||||
|
assertTrue(targets.contains(topTask));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateInfo_PromoteSimilarOpen() {
|
||||||
|
final Transition transition = createTestTransition(TRANSIT_OPEN);
|
||||||
|
ArrayMap<WindowContainer, Transition.ChangeInfo> changes = transition.mChanges;
|
||||||
|
ArraySet<WindowContainer> participants = transition.mParticipants;
|
||||||
|
|
||||||
|
final Task topTask = createTask(mDisplayContent);
|
||||||
|
final Task belowTask = createTask(mDisplayContent);
|
||||||
|
final ActivityRecord showing = createActivityRecord(topTask);
|
||||||
|
final ActivityRecord opening = createActivityRecord(topTask);
|
||||||
|
final ActivityRecord closing = createActivityRecord(belowTask);
|
||||||
|
// Start states.
|
||||||
|
changes.put(topTask, new Transition.ChangeInfo(false /* vis */, false /* exChg */));
|
||||||
|
changes.put(belowTask, new Transition.ChangeInfo(true /* vis */, false /* exChg */));
|
||||||
|
changes.put(showing, new Transition.ChangeInfo(false /* vis */, false /* exChg */));
|
||||||
|
changes.put(opening, new Transition.ChangeInfo(false /* vis */, true /* exChg */));
|
||||||
|
changes.put(closing, new Transition.ChangeInfo(true /* vis */, false /* exChg */));
|
||||||
|
fillChangeMap(changes, topTask);
|
||||||
|
// End states.
|
||||||
|
showing.mVisibleRequested = true;
|
||||||
|
opening.mVisibleRequested = true;
|
||||||
|
closing.mVisibleRequested = false;
|
||||||
|
|
||||||
|
participants.add(belowTask);
|
||||||
|
participants.add(showing);
|
||||||
|
participants.add(opening);
|
||||||
|
ArrayList<WindowContainer> targets = Transition.calculateTargets(participants, changes);
|
||||||
|
assertEquals(2, targets.size());
|
||||||
|
assertTrue(targets.contains(belowTask));
|
||||||
|
assertTrue(targets.contains(topTask));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTargets_noIntermediatesToWallpaper() {
|
public void testTargets_noIntermediatesToWallpaper() {
|
||||||
final Transition transition = createTestTransition(TRANSIT_OPEN);
|
final Transition transition = createTestTransition(TRANSIT_OPEN);
|
||||||
|
|||||||
Reference in New Issue
Block a user