Merge "Crashing can not override Keyguard transit" into pi-dev
This commit is contained in:
@@ -278,7 +278,8 @@ public interface WindowManager extends ViewManager {
|
||||
TRANSIT_KEYGUARD_OCCLUDE,
|
||||
TRANSIT_KEYGUARD_UNOCCLUDE,
|
||||
TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
|
||||
TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE
|
||||
TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
|
||||
TRANSIT_CRASHING_ACTIVITY_CLOSE
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@interface TransitionType {}
|
||||
|
||||
@@ -3560,8 +3560,8 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
|
||||
int taskNdx = mTaskHistory.indexOf(finishedTask);
|
||||
final TaskRecord task = finishedTask;
|
||||
int activityNdx = task.mActivities.indexOf(r);
|
||||
mWindowManager.prepareAppTransition(TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* TODO */,
|
||||
0, true /* forceOverride */);
|
||||
mWindowManager.prepareAppTransition(TRANSIT_CRASHING_ACTIVITY_CLOSE,
|
||||
false /* alwaysKeepCurrent */);
|
||||
finishActivityLocked(r, Activity.RESULT_CANCELED, null, reason, false);
|
||||
finishedTask = task;
|
||||
// Also terminate any activities below it that aren't yet
|
||||
@@ -5012,7 +5012,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
|
||||
// Force the destroy to skip right to removal.
|
||||
r.app = null;
|
||||
mWindowManager.prepareAppTransition(TRANSIT_CRASHING_ACTIVITY_CLOSE,
|
||||
false /* TODO */, 0, true /* forceOverride */);
|
||||
false /* alwaysKeepCurrent */);
|
||||
finishCurrentActivityLocked(r, FINISH_IMMEDIATELY, false,
|
||||
"handleAppCrashedLocked");
|
||||
}
|
||||
|
||||
@@ -2003,8 +2003,11 @@ public class AppTransition implements Dump {
|
||||
case TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE: {
|
||||
return "TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE";
|
||||
}
|
||||
case TRANSIT_CRASHING_ACTIVITY_CLOSE: {
|
||||
return "TRANSIT_CRASHING_ACTIVITY_CLOSE";
|
||||
}
|
||||
default: {
|
||||
return "<UNKNOWN>";
|
||||
return "<UNKNOWN: " + transition + ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2133,15 +2136,17 @@ public class AppTransition implements Dump {
|
||||
+ " " + this
|
||||
+ " alwaysKeepCurrent=" + alwaysKeepCurrent
|
||||
+ " Callers=" + Debug.getCallers(3));
|
||||
final boolean allowSetCrashing = !isKeyguardTransit(mNextAppTransition)
|
||||
&& transit == TRANSIT_CRASHING_ACTIVITY_CLOSE;
|
||||
if (forceOverride || isKeyguardTransit(transit) || !isTransitionSet()
|
||||
|| mNextAppTransition == TRANSIT_NONE) {
|
||||
|| mNextAppTransition == TRANSIT_NONE || allowSetCrashing) {
|
||||
setAppTransition(transit, flags);
|
||||
}
|
||||
// We never want to change from a Keyguard transit to a non-Keyguard transit, as our logic
|
||||
// relies on the fact that we always execute a Keyguard transition after preparing one. We
|
||||
// also don't want to change away from a crashing transition.
|
||||
else if (!alwaysKeepCurrent && !isKeyguardTransit(transit)
|
||||
&& transit != TRANSIT_CRASHING_ACTIVITY_CLOSE) {
|
||||
else if (!alwaysKeepCurrent && !isKeyguardTransit(mNextAppTransition)
|
||||
&& mNextAppTransition != TRANSIT_CRASHING_ACTIVITY_CLOSE) {
|
||||
if (transit == TRANSIT_TASK_OPEN && isTransitionEqual(TRANSIT_TASK_CLOSE)) {
|
||||
// Opening a new task always supersedes a close for the anim.
|
||||
setAppTransition(transit, flags);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
|
||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -35,7 +36,7 @@ import org.junit.runner.RunWith;
|
||||
/**
|
||||
* Test class for {@link AppTransition}.
|
||||
*
|
||||
* runtest frameworks-services -c com.android.server.wm.AppTransitionTests
|
||||
* atest AppTransitionTests
|
||||
*/
|
||||
@SmallTest
|
||||
@Presubmit
|
||||
@@ -59,6 +60,13 @@ public class AppTransitionTests {
|
||||
assertEquals(TRANSIT_KEYGUARD_GOING_AWAY, mWm.mAppTransition.getAppTransition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKeyguardKeep() throws Exception {
|
||||
mWm.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */);
|
||||
mWm.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */);
|
||||
assertEquals(TRANSIT_KEYGUARD_GOING_AWAY, mWm.mAppTransition.getAppTransition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForceOverride() throws Exception {
|
||||
mWm.prepareAppTransition(TRANSIT_KEYGUARD_UNOCCLUDE, false /* alwaysKeepCurrent */);
|
||||
@@ -66,4 +74,18 @@ public class AppTransitionTests {
|
||||
0 /* flags */, true /* forceOverride */);
|
||||
assertEquals(TRANSIT_ACTIVITY_OPEN, mWm.mAppTransition.getAppTransition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCrashing() throws Exception {
|
||||
mWm.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */);
|
||||
mWm.prepareAppTransition(TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */);
|
||||
assertEquals(TRANSIT_CRASHING_ACTIVITY_CLOSE, mWm.mAppTransition.getAppTransition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKeepKeyguard_withCrashing() throws Exception {
|
||||
mWm.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */);
|
||||
mWm.prepareAppTransition(TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */);
|
||||
assertEquals(TRANSIT_KEYGUARD_GOING_AWAY, mWm.mAppTransition.getAppTransition());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user