Loading src/com/android/documentsui/selection/ContentLock.java +9 −2 Original line number Diff line number Diff line Loading @@ -73,17 +73,24 @@ public final class ContentLock { } } /** * Returns true if locked. */ synchronized boolean isLocked() { return mLocks > 0; } /** * Allows other selection code to perform a precondition check asserting the state is locked. */ final void checkLocked() { checkState(mLocks > 0); checkState(isLocked()); } /** * Allows other selection code to perform a precondition check asserting the state is unlocked. */ final void checkUnlocked() { checkState(mLocks == 0); checkState(!isLocked()); } } src/com/android/documentsui/selection/GestureSelectionHelper.java +7 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,13 @@ public final class GestureSelectionHelper extends ScrollHost implements OnItemTo */ public void start() { checkState(!mStarted); checkState(mLastStartedItemPos > -1); // See: b/70518185. It appears start() is being called via onLongPress // even though we never received an intial handleInterceptedDownEvent // where we would usually initialize mLastStartedItemPos. if (mLastStartedItemPos < 0){ Log.w(TAG, "Illegal state. Can't start without valid mLastStartedItemPos."); return; } // Partner code in MotionInputHandler ensures items // are selected and range established prior to Loading tests/unit/com/android/documentsui/selection/GestureSelectionHelperTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -80,11 +80,10 @@ public class GestureSelectionHelperTest { @Test public void testNoStartOnIllegalPosition() { mView.mNextPosition = -1; mHelper.onInterceptTouchEvent(null, DOWN); try { mHelper.start(); fail("Should have thrown."); } catch (Exception expected) {} assertFalse(mLock.isLocked()); } @Test Loading Loading
src/com/android/documentsui/selection/ContentLock.java +9 −2 Original line number Diff line number Diff line Loading @@ -73,17 +73,24 @@ public final class ContentLock { } } /** * Returns true if locked. */ synchronized boolean isLocked() { return mLocks > 0; } /** * Allows other selection code to perform a precondition check asserting the state is locked. */ final void checkLocked() { checkState(mLocks > 0); checkState(isLocked()); } /** * Allows other selection code to perform a precondition check asserting the state is unlocked. */ final void checkUnlocked() { checkState(mLocks == 0); checkState(!isLocked()); } }
src/com/android/documentsui/selection/GestureSelectionHelper.java +7 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,13 @@ public final class GestureSelectionHelper extends ScrollHost implements OnItemTo */ public void start() { checkState(!mStarted); checkState(mLastStartedItemPos > -1); // See: b/70518185. It appears start() is being called via onLongPress // even though we never received an intial handleInterceptedDownEvent // where we would usually initialize mLastStartedItemPos. if (mLastStartedItemPos < 0){ Log.w(TAG, "Illegal state. Can't start without valid mLastStartedItemPos."); return; } // Partner code in MotionInputHandler ensures items // are selected and range established prior to Loading
tests/unit/com/android/documentsui/selection/GestureSelectionHelperTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -80,11 +80,10 @@ public class GestureSelectionHelperTest { @Test public void testNoStartOnIllegalPosition() { mView.mNextPosition = -1; mHelper.onInterceptTouchEvent(null, DOWN); try { mHelper.start(); fail("Should have thrown."); } catch (Exception expected) {} assertFalse(mLock.isLocked()); } @Test Loading