Loading core/java/android/app/servertransaction/TransactionExecutorHelper.java +9 −3 Original line number Diff line number Diff line Loading @@ -75,10 +75,16 @@ public class TransactionExecutorHelper { mLifecycleSequence.clear(); if (finish >= start) { if (start == ON_START && finish == ON_STOP) { // A case when we from start to stop state soon, we don't need to go // through the resumed, paused state. mLifecycleSequence.add(ON_STOP); } else { // just go there for (int i = start + 1; i <= finish; i++) { mLifecycleSequence.add(i); } } } else { // finish < start, can't just cycle down if (start == ON_PAUSE && finish == ON_RESUME) { // Special case when we can just directly go to resumed state. Loading core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java +4 −2 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ public class TransactionExecutorTests { assertArrayEquals(new int[] {}, path(ON_START)); assertArrayEquals(new int[] {ON_RESUME}, path(ON_RESUME)); assertArrayEquals(new int[] {ON_RESUME, ON_PAUSE}, path(ON_PAUSE)); assertArrayEquals(new int[] {ON_RESUME, ON_PAUSE, ON_STOP}, path(ON_STOP)); assertArrayEquals(new int[] {ON_STOP}, path(ON_STOP)); assertArrayEquals(new int[] {ON_RESUME, ON_PAUSE, ON_STOP, ON_DESTROY}, path(ON_DESTROY)); } Loading Loading @@ -362,7 +362,9 @@ public class TransactionExecutorTests { public void testClosestStateResolutionFromOnStart() { mClientRecord.setState(ON_START); assertEquals(ON_RESUME, mExecutorHelper.getClosestOfStates(mClientRecord, shuffledArray( new int[] {ON_CREATE, ON_RESUME, ON_PAUSE, ON_STOP, ON_DESTROY}))); new int[] {ON_CREATE, ON_RESUME, ON_PAUSE, ON_DESTROY}))); assertEquals(ON_STOP, mExecutorHelper.getClosestOfStates(mClientRecord, shuffledArray( new int[] {ON_STOP}))); assertEquals(ON_CREATE, mExecutorHelper.getClosestOfStates(mClientRecord, shuffledArray( new int[] {ON_CREATE}))); } Loading Loading
core/java/android/app/servertransaction/TransactionExecutorHelper.java +9 −3 Original line number Diff line number Diff line Loading @@ -75,10 +75,16 @@ public class TransactionExecutorHelper { mLifecycleSequence.clear(); if (finish >= start) { if (start == ON_START && finish == ON_STOP) { // A case when we from start to stop state soon, we don't need to go // through the resumed, paused state. mLifecycleSequence.add(ON_STOP); } else { // just go there for (int i = start + 1; i <= finish; i++) { mLifecycleSequence.add(i); } } } else { // finish < start, can't just cycle down if (start == ON_PAUSE && finish == ON_RESUME) { // Special case when we can just directly go to resumed state. Loading
core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java +4 −2 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ public class TransactionExecutorTests { assertArrayEquals(new int[] {}, path(ON_START)); assertArrayEquals(new int[] {ON_RESUME}, path(ON_RESUME)); assertArrayEquals(new int[] {ON_RESUME, ON_PAUSE}, path(ON_PAUSE)); assertArrayEquals(new int[] {ON_RESUME, ON_PAUSE, ON_STOP}, path(ON_STOP)); assertArrayEquals(new int[] {ON_STOP}, path(ON_STOP)); assertArrayEquals(new int[] {ON_RESUME, ON_PAUSE, ON_STOP, ON_DESTROY}, path(ON_DESTROY)); } Loading Loading @@ -362,7 +362,9 @@ public class TransactionExecutorTests { public void testClosestStateResolutionFromOnStart() { mClientRecord.setState(ON_START); assertEquals(ON_RESUME, mExecutorHelper.getClosestOfStates(mClientRecord, shuffledArray( new int[] {ON_CREATE, ON_RESUME, ON_PAUSE, ON_STOP, ON_DESTROY}))); new int[] {ON_CREATE, ON_RESUME, ON_PAUSE, ON_DESTROY}))); assertEquals(ON_STOP, mExecutorHelper.getClosestOfStates(mClientRecord, shuffledArray( new int[] {ON_STOP}))); assertEquals(ON_CREATE, mExecutorHelper.getClosestOfStates(mClientRecord, shuffledArray( new int[] {ON_CREATE}))); } Loading