122 Commits

Author SHA1 Message Date
Jeff Sharkey
5d321d472d Guard against missing document columns.
When filtering and sorting, guard against missing columns to avoid
crashing entire app.

Bug: 11377065
Change-Id: I04f035c918d743bcc84592f05e3ef9ad0ebfadce
2013-10-29 11:48:30 -07:00
Jeff Sharkey
db5ef12500 Use inotify to update DocumentsUI.
While user is actively looking at a directory, subscribe to inotify
events and notify of content changes to trigger requeries.  Reference
count the observers, since multiple cursors are regularly open during
requeries.

Fix leaking cursors on activity rotation; crazy loader ID generation
is no longer needed.

Bug: 10999396
Change-Id: Iddeb08a056fee80c93df8499874705bcd213a1e2
2013-10-25 17:51:04 -07:00
Jeff Sharkey
96c620595b Extra to always show advanced devices.
Also always lower-case extension to extract MIME type correctly,
we may want to fix in MimeUtils at some point.

Bug: 11354402
Change-Id: I77d0c06a663cd0c4320c41553ff1980b6f9a7778
2013-10-25 16:30:54 -07:00
Jeff Sharkey
758f97e46d Remove persisted stacks when app removed/cleared.
When an app's data is cleared, or it's uninstalled, remove any
persisted stacks.

Bug: 11355566
Change-Id: I4e5cf0ec710591ad62f1ad52c2e358616631af41
2013-10-24 11:22:20 -07:00
Jeff Sharkey
c24bbd4ce5 Long-press on GET_CONTENT app shows its details.
Matches ResolverActivity behavior.

Bug: 11319259
Change-Id: Id7f2a73b225e4cfd9bdef3b1c7cecb77d9bd2b90
2013-10-23 16:05:56 -07:00
Jeff Sharkey
04d45a0bdd Show spinner while waiting for mutations.
When mutation operations are waiting for a storage backend, show a
spinner in place of the save button.

Bug: 11333249
Change-Id: I2b620b4532ad977a2b60d4bdc5caa55f89021456
2013-10-23 15:48:05 -07:00
Jeff Sharkey
46de7b5024 Update roots when data cleared, refresh UI.
Data cleared usually means accounts went away, so kick off roots
refresh.  Also update any visible UI after a refresh finishes.

Bug: 10899793
Change-Id: Id68c80b5e635e358cfd75f4961ce13cd1c7c5f82
2013-10-23 09:59:06 -07:00
Jeff Sharkey
b3d42635aa Treat document thumbnails as preemptable.
When a more important request comes along, preempt all outstanding
thumbnail requests.

Bug: 11317901
Change-Id: I164fc8d804bb9c471e6da3f8127228043b3ca482
2013-10-23 09:23:13 -07:00
Craig Mautner
d2d76ac6b9 Use dialog animations for dialog style.
Using activity animations on non-fullscreen activities that sit over
a wallpaper activity cause the exiting activity to show up underneath
the next activity. If the next activity happens to be a wallpaper
activity then this will be janky as the exiting activity will go from
on top of the incoming activity to on top of the wallpaper as it
animates away.

Fixes bug 11200253.

Change-Id: I7e81c50cfe7ae106da2d62f5866f43fc046181c5
2013-10-14 15:52:58 -07:00
Baligh Uddin
5ab664c159 Import translations. DO NOT MERGE
Change-Id: I4bdcff01e1271ee4a7695a9bb646cd84530f654e
Auto-generated-cl: translation import
2013-10-10 19:16:51 -07:00
Jeff Sharkey
15be83612c Support overriding calling package in Documents.
Calling package is only used to pick the stack to restore, not for
security purposes.  This lets other system tools (like Printing)
indicate the real caller.

Bug: 11149540
Change-Id: I155e32577eaeda7dfcb80a7d84ac3b54f281590a
2013-10-09 13:52:26 -07:00
Jeff Sharkey
d2e1e810a7 Drop <meta-data> support for DocumentsProviders.
Prebuilts have finished migrating to new <intent-filter> based
approach.  Also update isDocumentUri() to match new definition.

Bug: 11109484
Change-Id: Ib95e2c3f5a9ff70b8d5e411f68ad49d1990dae8c
2013-10-09 13:31:13 -07:00
Jeff Sharkey
78b1370308 Grab Activity reference before leaving fragment.
When creating a new directory, we spawn an AsyncTask and finish the
fragment.  This change keeps an Activity reference to report the
result back to.

Bug: 11137561
Change-Id: Icfccc5e50e8f53a50dced589e1564d64457e0ed0
2013-10-08 17:11:49 -07:00
Jeff Sharkey
bcc77b502b Merge "Add <intent-filter> support to <provider>." into klp-dev 2013-10-07 21:41:45 +00:00
Jeff Sharkey
567fdd9fba Merge "When launched into empty recents, show drawer." into klp-dev 2013-10-07 21:36:25 +00:00
Jeff Sharkey
85f5f81320 Add <intent-filter> support to <provider>.
For the new documents work, we're only interested in the subset of
ContentProviders that actually implement DocumentsContract.  Instead
of returning all providers, add <intent-filter> support to make it
easier to limit the set of returned ProviderInfo.

Define a well-known action for DocumentsProviders, and start using it
when querying for roots.  Continue supporting the old <meta-data>
approach until all apps have been updated.

Bug: 8599233
Change-Id: I05f049bba21311f5421738002f99ee214447c909
2013-10-07 14:19:13 -07:00
Jeff Sharkey
a82c2e24bc When launched into empty recents, show drawer.
Pull out drawer to give users more context about meaningful places
to navigate to.  Also fix bug where restored roots weren't being
highlighted.

Bug: 10852518
Change-Id: Id294f6923477ca4dc505c4b0a21a5bdf8b722cf4
2013-10-07 14:08:20 -07:00
Jeff Sharkey
a27366efc4 Merge "Ellipsize titles in middle, otherwise end." into klp-dev 2013-10-07 20:17:54 +00:00
Jeff Sharkey
2c4b99fbe6 Ellipsize titles in middle, otherwise end.
Long document titles can include distinguishing details at the end
of the title, so ellipsize in the middle.  All other details ellipsize
at the end.

Bug: 11081420
Change-Id: I2c266ebc594d2ad383033b435acb8adb5fb823bc
2013-10-07 11:39:07 -07:00
Baligh Uddin
0ea4be04a0 Import translations. DO NOT MERGE
Change-Id: I4365c56d96fc1e1aa97e05d154ce23441c5b1431
Auto-generated-cl: translation import
2013-10-07 10:43:11 -07:00
Baligh Uddin
15800b793b Merge "Import translations. DO NOT MERGE" into klp-dev 2013-10-04 22:53:07 +00:00
Jeff Sharkey
ca25db0cb3 Custom pressed states, fixed column sizes.
Use custom pressed state assets.  Use fixed column sizes to prevent
truncating of long dates on small screens.

Also tear down any active CAB when switching fragments.

Bug: 11032418, 11028212
Change-Id: I2bf3dc3f693319b4b55cc901ed460f60faceba35
2013-10-04 14:48:08 -07:00
Baligh Uddin
dfe1303d93 Import translations. DO NOT MERGE
Change-Id: Id6fb45a4be5a4e32cd673127862ff413526dcc7b
Auto-generated-cl: translation import
2013-10-04 12:23:39 -07:00
Baligh Uddin
8e68d5fceb Merge "Import translations. DO NOT MERGE" into klp-dev 2013-10-03 03:41:47 +00:00
Baligh Uddin
e2aea6f859 Import translations. DO NOT MERGE
Change-Id: I6630568359b173cd95d9b76743f682c6e92c7371
Auto-generated-cl: translation import
2013-10-02 12:03:19 -07:00
Jeff Sharkey
d01571e6d4 Isolate calls to each remote DocumentsProvider.
All background work is going through AsyncTasks, which uses a shared
thread pool.  Even with the new ContentProviderClient logic to detect
ANRs, the UI can still appear to be unresponsive for 20 seconds, even
if the user attempted to switch to a different backend.  In the worst
case, a backlog of thumbnail requests would end up wedging Loaders
for a long time, since they all share the same THREAD_POOL_EXECUTOR.

This change isolates calls to each provider onto their own thread,
which they're free to wedge and recover from over time.

It also means we no longer need a dedicated thread pool for recents
loading, and can use a simpler Semaphore instead.

Disables thumbnails in recents on svelte devices.

Bug: 10993301, 11014856
Change-Id: I7f8a5bbb5f64437e006cb2c48b7e854136d5c38c
2013-10-02 08:54:02 -07:00
Jeff Sharkey
ee3e1603fd Fix animations, padding in RTL mode.
Show directory animations coming in from left-side when in RTL
language.  Also fix NinePatchDrawable to correctly mirror its padding
when auto-mirrored, and fix InsetDrawable to propagate the layout
direction to the wrapped Drawable.

Bug: 10987190, 11030793
Change-Id: I1213802a07d0c4ced93438df1e6ddf5aed3df677
2013-10-01 16:03:00 -07:00
Jeff Sharkey
7aa7601c09 Detect wedged ContentProviders, treat as ANR.
All ContentProvider calls are currently blocking, making it hard for
an app to recover when a remote provider is wedged.  This change adds
hidden support to ContentProviderClient to timeout remote calls,
treating them as ANRs.  This behavior is disabled by default.

Update DocumentsUI to use a 20 second timeout whenever interacting
with a storage provider.

Bug: 10993301, 10819461, 10852518
Change-Id: I10fa3c425c6a7225fff9cb7a0a07659028230cd3
2013-10-01 09:50:41 -07:00
Baligh Uddin
bb1abd1ce5 Import translations. DO NOT MERGE
Change-Id: Ibf90ac2ca945f9a5e803f3bbfbb5caa69b08a4ce
Auto-generated-cl: translation import
2013-09-30 10:20:46 -07:00
Jeff Sharkey
cc637d9ae5 Merge "New roots UX, async, performance, docs." into klp-dev 2013-09-28 00:27:29 +00:00
Jeff Sharkey
6efba22ce5 New roots UX, async, performance, docs.
Yet another iteration from UX on how roots should be ordered.  Since
we no longer categorize by type, remove from public API.  Updated
asset drop with new dividers.

Update public API docs to be explicit about required columns.  Hide
flags and columns that aren't required for third-party apps.

Move remainder of potentially blocking work to AsyncTasks, including
creating directories, picked root resolution, and creation of new
documents once picked.

Improve performance of layouts by removing baseline alignment and
reduce hierarchy depth.  Set alpha on ImageViews directly to avoid
offscreen rendering hit.

Limit returned recents to 45 days.  Show load in recents when still
waiting for backends.  Show empty message when no recents stacks to
create from.  Use unique key when saving recent stacks.

Bug: 10941423, 10819454, 10964412, 10960718
Change-Id: I08cf589dcda7e203acf67928f4d30322ae36ee94
2013-09-27 17:13:13 -07:00
Jeff Sharkey
10d655927c Merge "Make directories always enabled, for realz." into klp-dev 2013-09-27 02:55:05 +00:00
Jeff Sharkey
3d52dc9c3a Make directories always enabled, for realz.
Bug: 10946731
Change-Id: I3eb132c53e47f31d1d1723ed2262823b54b1fce0
2013-09-26 19:42:52 -07:00
Jeff Sharkey
8c6c04197e Merge "Tighten flags enforcement, API to test Uris." into klp-dev 2013-09-26 20:33:29 +00:00
Jeff Sharkey
ee2f7df9ee Tighten flags enforcement, API to test Uris.
Check and throw if callers request invalid grant flags.  Add API to
test if a Uri is backend by a DocumentsProvider.

Bug: 10919391, 10935608
Change-Id: Ifa6afefb95983558c8c64dc15ddf650e9fe07080
2013-09-26 13:14:45 -07:00
Jeff Sharkey
bb77d99c25 Merge "Directories are always enabled; update assets." into klp-dev 2013-09-26 17:58:41 +00:00
Jeff Sharkey
2a030b05a9 Directories are always enabled; update assets.
Fix bug where item enabled state depended on FLAG_SUPPORTS_WRITE;
directories are now always enabled.  Also unifies enabled testing.

Bug: 10903210, 10946731
Change-Id: I241533d273dfe4a2146bb322a8bd93066bf4ef55
2013-09-26 10:54:19 -07:00
Baligh Uddin
1ffe09e2f1 Merge "Import translations. DO NOT MERGE" into klp-dev 2013-09-26 02:53:59 +00:00
Baligh Uddin
976df296f4 Import translations. DO NOT MERGE
Change-Id: I8d908dee86b15624d846ab335337b88b371ed5d5
Auto-generated-cl: translation import
2013-09-25 17:19:25 -07:00
Jeff Sharkey
e66c1778f8 Require that persistable Uri permissions be taken.
Change our Intent flag to indicate that a Uri permission grant is
persistable, but don't actually persist it until explicitly taken by
the receiving app.  This prevents apps from spamming each other if
persisted permissions aren't really required.

Remember the last time a persisted grant was taken by an app, and
use this to prune away the oldest grants when the number of grants
grows too large.  Allow apps to query persisted grants they are
holding, and allow them to release previously persisted grants. Add
public UriPermission class to return grant details and timestamp.

Track various permission strengths separately, and combine together
after each mutation pass.  Persistable grants are currently treated
like global grants, but they could be moved to have owners in the
future.  Require that grant holders trying to extend a persistable
permission actually hold a persistable permission themselves.

Bug: 10835779
Change-Id: I95b2f797c04ce7fd2612f9a644685dbd44e03759
2013-09-25 15:16:41 -07:00
Jeff Sharkey
6a20e57411 Handle null stacks gracefully.
Bug: 10928395
Change-Id: Ie7c3f7e0eb068ece0cf678a5d6346f18a413856b
2013-09-25 14:39:14 -07:00
Baligh Uddin
86d7136377 Import translations. DO NOT MERGE
Change-Id: Ifaa3920e5a0d002b7bdb9eb668acf5cbc36729fc
Auto-generated-cl: translation import
2013-09-25 09:07:42 -07:00
Michael Wright
870cb43585 Merge "Mirror DocumentsUI assets for RTL layouts" into klp-dev 2013-09-24 22:39:07 +00:00
Jeff Sharkey
deffadeb74 Freshen restored stacks, more UX bug fixes.
When restoring a persisted stack, such as last location or a location
where save occurred, freshen the DocumentStack to get the latest
details from backend, and ensure the path is still valid.

Filter Recent directories in create mode based on roots allowed by
incoming request.

Remember when user last picked an external app, and open drawer next
time user launches for GET_CONTENT.

Fix state list drawable ordering, and avoid clobbering Drawable
callback when wrapping in InsetDrawable; tricksy hobbitses!

Make grid items smaller to always fit two columns on phones.  Draw
grid items all the way to screen edge; don't clip to padding.  Better
error message when folder creation failed.  Show Recents in grid mode
when picking any visual content, not just images.

Bug: 10846100, 10903211, 10898993, 10892808, 10892058, 10892009, 10885012
Change-Id: Ia0f88d911abc6ea03645d6fd3e04271c21d5936a
2013-09-24 12:57:47 -07:00
Michael Wright
56d2030a35 Mirror DocumentsUI assets for RTL layouts
Bug: 10641916
Change-Id: I037adeb5ec7df6e3812be8653929a55ed8b87323
2013-09-24 12:50:00 -07:00
Jeff Sharkey
b180a65d41 Allow saving to Downloads.
Uses new column to mark writability.  Also filter file selection in
create mode to only allow writable files.

Bug: 10667164, 10893268
Change-Id: I90f74efbb7ac634fbdb3cc02a904a96a434d3605
2013-09-23 14:23:45 -07:00
Jeff Sharkey
1feeddf518 Latest UX asset drop, grid padding.
Bring in latest asset drop.  Apply grid padding programmatically
instead of waiting for asset.  Remove alpha from directory animation.

Update save footer background to match spec.

Bug: 10700025
Change-Id: I8eef08f36d04767b78e91b23f72bdbebfbb02f58
2013-09-21 15:26:37 -07:00
Jeff Sharkey
5545f56f75 Create unique files, root ordering, UI bugs.
When a file already exists on disk, try adding a counter suffix to
make a unique name.  Move services near top of roots list, just below
recents.  Remove "Documents" root.

Increase number of recents allowed from single provider, and add more
logging to diagnose wedged loaders.

When launching GET_CONTENT apps, wait for successful result before
relaying result; canceled requests now return to DocumentsUI.

Add CloseGuard to ContentProviderClients, since leaked instances can
keep the remote process alive.

Fix UI bug around trailing breadcrumbs.  Fix bug that dropped Recents
from roots list.  Add up action to Settings activity.  Give our
activity a default icon while waiting for async roots to load.

Bug: 10818683, 10819461, 10819461, 10819196, 10860199
Change-Id: I7b9e26b1cf8353dd3175458b23da2b4bda6c5831
2013-09-21 14:07:16 -07:00
Jeff Sharkey
a9ce049db8 Load RootInfo in background, invalidation.
Move all RootInfo queries to background threads to avoid janking
the UI.  Update passes happen on spawed task, which swaps out updated
cache results when finished.  Support partial updates when only a
single package/authority has changed.  Watch for change notifications
for roots, since flags can change over time.

Ignore stopped packages when in background, but query them for roots
when launching any picker UI.

Optimize management launches by treating as one-shot requests that
don't need to wait for all RootInfo.

Bug: 10600454, 10745490
Change-Id: Ibc7b15688ef6b41bd7e9dd0d7564b501e60e49a9
2013-09-19 19:53:32 -07:00
Jeff Sharkey
f8abf2e387 Also catch one more tablet layout NPE.
Bug: 10837208
Change-Id: I178110431221773658403319b2be7aff22adadc8
2013-09-19 11:25:56 -07:00