Loading services/core/java/com/android/server/wm/ActivityRecord.java +32 −0 Original line number Original line Diff line number Diff line Loading @@ -504,6 +504,9 @@ final class ActivityRecord extends WindowToken { WindowProcessController app; // if non-null, hosting application WindowProcessController app; // if non-null, hosting application private State mState; // current state we are in private State mState; // current state we are in private Bundle mIcicle; // last saved activity state private Bundle mIcicle; // last saved activity state private boolean mHandoffEnabled = false; // if Handoff is enabled for this activity private boolean mAllowFullTaskRecreation = false; // if the entire task stack can be recreated // during handoff of this activity. private PersistableBundle mPersistentState; // last persistently saved activity state private PersistableBundle mPersistentState; // last persistently saved activity state private boolean mHaveState = true; // Indicates whether the last saved state of activity is private boolean mHaveState = true; // Indicates whether the last saved state of activity is // preserved. This starts out 'true', since the initial state // preserved. This starts out 'true', since the initial state Loading Loading @@ -1280,6 +1283,35 @@ final class ActivityRecord extends WindowToken { return true; return true; } } /** Update if handoff is enabled for this activity. */ void setHandoffEnabled(boolean handoffEnabled, boolean allowFullTaskRecreation) { mHandoffEnabled = handoffEnabled; mAllowFullTaskRecreation = allowFullTaskRecreation; } /** * Get if Handoff is enabled for this Activity. * @see #setHandoffEnabled() to change if Handoff is enabled. * @return if Handoff is enabled. */ boolean isHandoffEnabled() { return mHandoffEnabled; } /** * Get if the entire task will be recreated when handing off this activity. * @see #setHandoffEnabled() to change this parameter. If Handoff is disabled for this * activity, this will return false. * @return if the entire task will be recreated when handing off this activity. */ boolean allowFullTaskRecreation() { if (!isHandoffEnabled()) { return false; } return mAllowFullTaskRecreation; } /** Update the saved state of an activity. */ /** Update the saved state of an activity. */ void setSavedState(@Nullable Bundle savedState) { void setSavedState(@Nullable Bundle savedState) { mIcicle = savedState; mIcicle = savedState; Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -913,6 +913,16 @@ public class ActivityRecordTests extends WindowTestsBase { assertEquals(STARTED, activity.getState()); assertEquals(STARTED, activity.getState()); } } @Test public void testSetHandoffEnabled() { final ActivityRecord activity = createActivityWithTask(); assertFalse(activity.isHandoffEnabled()); assertFalse(activity.allowFullTaskRecreation()); activity.setHandoffEnabled(true, true); assertTrue(activity.isHandoffEnabled()); assertTrue(activity.allowFullTaskRecreation()); } @Test @Test public void testTakeSceneTransitionInfo() { public void testTakeSceneTransitionInfo() { final ActivityRecord activity = createActivityWithTask(); final ActivityRecord activity = createActivityWithTask(); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +32 −0 Original line number Original line Diff line number Diff line Loading @@ -504,6 +504,9 @@ final class ActivityRecord extends WindowToken { WindowProcessController app; // if non-null, hosting application WindowProcessController app; // if non-null, hosting application private State mState; // current state we are in private State mState; // current state we are in private Bundle mIcicle; // last saved activity state private Bundle mIcicle; // last saved activity state private boolean mHandoffEnabled = false; // if Handoff is enabled for this activity private boolean mAllowFullTaskRecreation = false; // if the entire task stack can be recreated // during handoff of this activity. private PersistableBundle mPersistentState; // last persistently saved activity state private PersistableBundle mPersistentState; // last persistently saved activity state private boolean mHaveState = true; // Indicates whether the last saved state of activity is private boolean mHaveState = true; // Indicates whether the last saved state of activity is // preserved. This starts out 'true', since the initial state // preserved. This starts out 'true', since the initial state Loading Loading @@ -1280,6 +1283,35 @@ final class ActivityRecord extends WindowToken { return true; return true; } } /** Update if handoff is enabled for this activity. */ void setHandoffEnabled(boolean handoffEnabled, boolean allowFullTaskRecreation) { mHandoffEnabled = handoffEnabled; mAllowFullTaskRecreation = allowFullTaskRecreation; } /** * Get if Handoff is enabled for this Activity. * @see #setHandoffEnabled() to change if Handoff is enabled. * @return if Handoff is enabled. */ boolean isHandoffEnabled() { return mHandoffEnabled; } /** * Get if the entire task will be recreated when handing off this activity. * @see #setHandoffEnabled() to change this parameter. If Handoff is disabled for this * activity, this will return false. * @return if the entire task will be recreated when handing off this activity. */ boolean allowFullTaskRecreation() { if (!isHandoffEnabled()) { return false; } return mAllowFullTaskRecreation; } /** Update the saved state of an activity. */ /** Update the saved state of an activity. */ void setSavedState(@Nullable Bundle savedState) { void setSavedState(@Nullable Bundle savedState) { mIcicle = savedState; mIcicle = savedState; Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -913,6 +913,16 @@ public class ActivityRecordTests extends WindowTestsBase { assertEquals(STARTED, activity.getState()); assertEquals(STARTED, activity.getState()); } } @Test public void testSetHandoffEnabled() { final ActivityRecord activity = createActivityWithTask(); assertFalse(activity.isHandoffEnabled()); assertFalse(activity.allowFullTaskRecreation()); activity.setHandoffEnabled(true, true); assertTrue(activity.isHandoffEnabled()); assertTrue(activity.allowFullTaskRecreation()); } @Test @Test public void testTakeSceneTransitionInfo() { public void testTakeSceneTransitionInfo() { final ActivityRecord activity = createActivityWithTask(); final ActivityRecord activity = createActivityWithTask(); Loading