History log of /frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2360aa33db829121a25be271edbaaaf26e5b093e 27-Apr-2016 Ben Lin <linben@google.com> Merge "Safe check so we don't move cursor beyond possible pos scope." into nyc-dev
f61b0b844069116adde26df6d4655d33831bb395 26-Apr-2016 Tomasz Mikolajewski <mtomasz@google.com> Revert "Precompute cursor indexes in DocumentsUI and improve perf by 2.7%."

This reverts commit 2e4e14789ecf923b16ea4e79b5605952ddc56e5b.

Bug: 28371571
Change-Id: I7aad5eb483c17cccb3485eb22effb677e1ba2160
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
71c7565093fcdc5c58dd16a606f528fff3002177 23-Apr-2016 Ben Lin <linben@google.com> Safe check so we don't move cursor beyond possible pos scope.

Bug: 28278372
Change-Id: I7c66b5229ae3a6a1b99bdf0f02bf1f0b8a1c79b2
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
dcc68fdd0ca1f0d2d2dfb979dd837ac2dd2e16f3 12-Apr-2016 Steve McKay <smckay@google.com> Daeal with null cursors more leniently.

Since modelId may not in fact result in a cursor.
Bug: 28074284

Change-Id: I8632c9c7d5e3da32080c07033089173105c03646
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
007151a90d2a97ad17772a3c9e6be249261a5365 15-Mar-2016 Tomasz Mikolajewski <mtomasz@google.com> Reduce memory allocations and improve sorting in DocumentsUI by 8.42%.

Reland after a revert. No changes.

Bug: 27286016
Change-Id: I0988062106faf4086c44d9b344649ef2cb86d3e7
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
2e4e14789ecf923b16ea4e79b5605952ddc56e5b 15-Mar-2016 Tomasz Mikolajewski <mtomasz@google.com> Precompute cursor indexes in DocumentsUI and improve perf by 2.7%.

Relands after a revert, with a tiny fix.

Bug: 27286016
Change-Id: Ifb6cea46a86e8158b05db5dbf87878892c6cc702
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
f3244e870e341be058292ab778452d155302f0f1 16-Mar-2016 Aga Wronska <agawronska@google.com> Revert "Precompute cursor indexes in DocumentsUI and improve perf by 2.7%."
It ia causing tests failures and exception at the app start.

This reverts commit d35a974b76cb0b3387aff7780d101e3f7de2ebd3.

Change-Id: I2577f723a7e25d4dcc12050791c65a900ac41f7d
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
49ca224623cb49342fec7e61d9f11d05d13d4a2f 15-Mar-2016 Tomasz Mikolajewski <mtomasz@google.com> Reduce memory allocations and improve sorting in DocumentsUI by 8.42%.

Bug: 27286016
Change-Id: Icc84aaaedd396d82f4ca7de63a682deebe1e1b93
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
d35a974b76cb0b3387aff7780d101e3f7de2ebd3 15-Mar-2016 Tomasz Mikolajewski <mtomasz@google.com> Precompute cursor indexes in DocumentsUI and improve perf by 2.7%.

Bug: 27286016
Change-Id: I0ad852faef46ba9eccc90ca32d8c2ea0e2d5cd98
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
77f0595cd150dfb9e1b799cc1b32cb9c32fbc47c 15-Mar-2016 Tomasz Mikolajewski <mtomasz@google.com> Optimize sorting performance by 7.64% in DocumentsUI.

This CL prevents allocating new strings just due to the prefix,
which also simplifies the code.

Bug: 27286016
Change-Id: I3d0ea9e4ede68814c78404bd9ac820b8900851f5
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
c05d98f64e62f57c34e3e00b05261e94b781b1e3 07-Mar-2016 Tomasz Mikolajewski <mtomasz@google.com> Improve sorting performance by 2.5 times.

This CL replaces List<String> with String[], which prevents from
calling get() and set() multiple times within a loop, in favor of
System.arraycopy().

Scanning a directory with 10K files went down from 1200ms to 450ms.

Bug: 27286016
Change-Id: Id533480934f739905a845cb0e13fe862e361b3db
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
ae6d6b494c2f5837889ebe8cbd50d6782697884f 23-Feb-2016 Tomasz Mikolajewski <mtomasz@google.com> Add scaffolds for performance tests of DocumentsUI

Bug: 27370274
Change-Id: I14dea1b85cd84c8bb3c0eee27b2954108bfa4f8b
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
a1f7680f535a30aa816d129c072870031c8a2eb6 25-Feb-2016 Steve McKay <smckay@google.com> Update preconditions to be asserts...

Which are now supported by Jack.
Retain a few preconditions checks that enforce contract.
Disable the one assert we had...because it failed in tests.

Change-Id: I2f6cb01e1af1534be4428ce4a3ee625a163dd163
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
fdfd5b60fc7b62d2a3af97af39abde8c5067eada 19-Feb-2016 Steve McKay <smckay@google.com> Merge "Undo generalization isDownloads > supportsChildren." into nyc-dev
7b300ff36932a4815f1f85b9ea73ec9a373dee10 19-Feb-2016 Ben Kwa <kenobi@google.com> Merge "Implement type-to-focus in the DirectoryFragment." into nyc-dev
008e948c3eac913ae3321bd690e3913e468e7fb1 19-Feb-2016 Steve McKay <smckay@google.com> Undo generalization isDownloads > supportsChildren.

Move root comparison logic into RootInfo.
Move shared string comparison code to Shared.

Change-Id: I3267b496a165ad3cae773783db0e79df2eb118e8
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
a4acc90b0a0bbfa55ed247a3ae04c766c885d220 11-Feb-2016 Ben Kwa <kenobi@google.com> Implement type-to-focus in the DirectoryFragment.

Add a helper to the FocusManager, to handle alphanumeric keystrokes.
- Build a search index mapping document titles to adapter positions, and
keep it up-to-date.
- Intercept alphanumeric keystrokes and build up a search string from
them.
- Use the search string and index to set focus in the directory listing.
- Highlight code is written, but not activated in the UI for now, to
minimize surface area for potential breakages. Revisit enabling
highlights for O.

BUG=24988911

Change-Id: I148ff5583c655338d12bc06d6484a9ed7aa528ad
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
3d988a969f39ca34ef89c449a0675164499c9a3a 15-Feb-2016 Tomasz Mikolajewski <mtomasz@google.com> Provide siblings in a sorted orders in DocumentsUI.

Bug: 27192158
Change-Id: Idefd2ba3027cd4630fcd2aefade9e6b4952e7125
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
3564543e1ece2211a2d5b729fbbf8dd7ac94944c 21-Jan-2016 Steve McKay <smckay@google.com> Move delete support into FileOperationService.

Refactor Jobs to work with files from multiple providers.
Don't shut down threadpool until service#onDestroy is called.

Bug: 26696797, 26462789, 26567205, 25162803, 26714663
Change-Id: Id43e8e3dc2294cd07dcd6a3477b19efb298c260f
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
e2564f9f197f6398cf3f2b1310045b8f685fd85c 09-Jan-2016 Ben Kwa <kenobi@google.com> Increase the stability of sorting in the Model.

This is necessary to prevent UI thrash (items continually shuffling
around) when the underlying Provider doesn't return its contents in a
stable order from one load event to another (DownloadStorageProvider is
an example).

BUG=26417297

Change-Id: Ie99e56b610f5d01d5318be07c0379b506c828735
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
44408260ba99eea55f7c0ec02778bb13d83c3262 06-Jan-2016 Steve McKay <smckay@google.com> Don't proxy calls to DocumentsAdapter in MultiSelManager.

We were bouncing calls out to the adapter pulled from RecyclerView,
but the adapter is easy to write a test double for and
we can readily inject the adapter when needed at runtime.

Eliminates unnecessary indirection.
Also, protect against failure when documents can't be loaded for delete.

Change-Id: Ief6585bf2e3e4fd407d801d485a9d7cd888b8500
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
955e46d004cf484267aef6181722ac19ffaf073d 05-Jan-2016 Steve McKay <smckay@google.com> Fix event relay to correctly dispatch events.

This fixes:
- UI to show selection which was broken in ag/838866
- Delete undo, which throws IOB exception
when undoing a a full delete of all entries.

Change-Id: Idbb43510974e130d283313602a71ac15ad10aadf
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
ef16f5f41106eaa89e5fdf0958e408a6faf7a5f4 23-Dec-2015 Steve McKay <smckay@google.com> Move Adapters to their own classes.

Move section break support into a separate wrapper class.
Fix issue where intermediate directory updates were briefly showing hidden files.
Add a rudimentary test for ModelBackedDocumentsAdapter.

Bug: 26293561, 26383237, 26293561, 26309025
Change-Id: I1fa489b110754d8801091b2009caebe9d2278701
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
c72a2cb899acf5562288675435b08d91ccf8019d 17-Dec-2015 Ben Kwa <kenobi@google.com> Implement bucketed sorting in DocumentsUI.

Change the sort code in the Model to bucket items into two separate
categories (folders and documents) and then sort the two buckets
separately.

Add code to the adapter to insert a visual break in the UI, between
folders and documents.

Change-Id: I759fedcef829aba9ad61554326489a9e62641cc7
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
862b9641e39997f5189dadf0f0c6776f911f344e 07-Dec-2015 Ben Kwa <kenobi@google.com> Re-enable sorting in the DirectoryFragment.

- Move sorting from the back-end (using SortingCursorWrapper) to the the
front-end (in DocumentsAdapter). This makes it such that re-sorting
the directory contents doesn't necessitate a reload.
- Update DirectoryLoaders to just return unsorted results, and rely on
the UI to sort them.
- Remove the (now-unused) SortingCursorWrapper.
- Update Model tests to test sorting.

BUG=26024369

Change-Id: I871cc0e496267d381ae546e0309125d04649415a
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
db65cd5e48e847e99cc64bf79a2fb7fe3bbfd31a 09-Dec-2015 Ben Kwa <kenobi@google.com> Fix file deletion after the move to Model IDs.

- Add methods to the DocumentsAdatper to hide and unhide files. This
removes that burden from the Model.

- Remove clunky markForDeletion/finalizeDeletion and all related code
from the Model. Replace with a straight-up delete method.

- Modify deletion code in the DirectoryFragment. Deletion now looks
like:
- user presses delete
- DocumentsAdapter hides the deleted files
- If the user presses cancel, the DocumentsAdapter unhides the files.
- If the user doesn't cancel, Model.delete is called to delete the
files.

- Fix deletion-related Model tests.

BUG=26024369

Change-Id: I02e2131c1aff1ebcd0bdb93d374675fd157d7f51
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
743c7c2f0f57b4cef7cc11154b2e804a7eb33177 02-Dec-2015 Ben Kwa <kenobi@google.com> Transition selection to use Model IDs.

This CL transitions the MultiSelectManager to (mostly) use Model IDs.

- Add the ability to retrieve all model IDs for the current directory,
from the model.

- Add a map in the DocumentsAdapter that maps from adapter position to
model ID.

- Make the adapter listen for model updates, and update its internal map
of positions to model IDs appropriately.

- Use the aforementioned map when binding ViewHolders.

- Get unit tests to compile; get as many tests passing as possible at
this point. Tests related to deleting things won't work right now.

Still to do:

- Add code to the adapter to sort and group items. After this is done,
SortingCursorWrapper will no longer be needed.

- Add code to the adapter to deal with item addition/removal. After
this is done, the pending-deletion code in the model can be removed.

- Rationalize position-based vs model-based selection. Some code in the
MSM (in particular, code dealing with range selection) is still
position-based. It's becoming clear that it doesn't make sense for
range selection to be ID-based, since "range" is a concept that only
makes sense in the context of items that are positioned in the UI.
Will need to iterate more on the position-based code to make sure it
makes sense.

BUG=26024369

Change-Id: I767cde2d888c101aaf83b59155b14634a236164b
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
003a999db6fef1e0bcec415d02a6b96926942448 01-Dec-2015 Ben Kwa <kenobi@google.com> Switch DirectoryFragment code to use model IDs.

A Model ID is a unique, stable identifier referring to a document.
The basic idea is to move away from doing everything using adapter
positions, and instead use model IDs.

This is the first in a line of CLs toward that goal. It does the
following:

- Introduce the concept of a Model ID, which is unique for each
document.
- Add a method to retrieve items from the Model using ID rather than
adapter position.
- Transition code in the DirectoryFragment to talk to the Model using
Model IDs rather than positions.
- Break the Model class out into a separate file of its own.

BUG=26024369

Change-Id: Ia5171f089d6b8a83855423ec05cf14dbfc7b6ba8
/frameworks/base/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java