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
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
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
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
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
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
Documents searches now happen root-wide, instead of only under a
subdirectory. Updates abstract class and flags to match. Add flag
for a root to indicate it's empty, and hide empty roots in UI unless
creating.
Define "Documents" public directory and storage backend to contain
files.
Bug: 10712057, 10710865, 10710758
Change-Id: I8716367568969f9cb1d83927b2bf5a7013809350
Support decoding thumbnails delivered over pipes by wrapping in a
buffered stream. Also switch to using unstable provider references
to avoid crashing DocumentsUI.
Bug: 10516148, 10510851
Change-Id: I85f6eeaca70c97742bf79656d1d0c6da381fdd47
Hide non-finished downloads from normal picker UI, but keep them
around in management mode. Uses a Uri query parameter and a hidden
API on DocumentsProvider.
Scale thumbnails to fit viewport, always show MIME icon while waiting
on thumbnails, and crossfade between them. Cancel thumbnail tasks
when views are recycled.
Filter directories out of search results for now. Also leave sort
ordering from backend intact, since it's custom ranking. Fix
SearchView interaction to dismiss properly and restore across
orientation and drawer state changes.
Hide most actions when drawer is open. Invalidate RootInfo cache
when locale changes. Apply sort ordering when showing recent create
directories. Hide recent summary string when icon is enough for user
to disambiguate.
Bug: 10667184, 10665663
Change-Id: I331d3272a08c497f88dc659d9e112231cb35aa69
Change MatrixCursor offer() to add() based on review feedback. Remove
some now-unused XML metadata. Hide document creation, since it's not
supported in initial version.
Bug: 10577809, 10461706, 10678563
Change-Id: I7b3f4c6899c28f633471ef816bee22bf032aa0d2
Fix drawable state to correctly show dimmed disabled state. Update
disabled state for all children to grey out text.
Block multi-selection of documents not matching MIME filter. Load
thumbnails in parallel. Show thumbnails in list mode based on MIME
type to match spec.
Give each footer a unique view type to avoid recycler crashes.
Show breadcrumb icons in recent create paths. Fix timestamp bug when
querying/updating recent paths.
Make ContentProviderClient.closeQuietly() really be quiet.
Bug: 10668364, 10510022, 10668701, 10534224, 10667726
Change-Id: I3c705412fb211519f15ad41a273a7533b878e9e5
Latest asset update, including provider icons which are treated as
special cases for now instead of checking into separate apps. Add
tests for MIME type matching of roots. Remove unused XML.
Bug: 10510022
Change-Id: Id567a9e06ba241f60ac011823e550253c6c797fb
A provider can include extras in their Cursors to indicate that
loading is ongoing, or include an error or informational message,
which are now shown in footer views.
Fix registration to always get change notifications.
Test provider that verifies common provider behavior of holding
a reference to "cloud" resources that are released by GC when the
remote Cursor is closed. Also used to validate Recents behavior
for slow providers.
Bug: 10599268
Change-Id: I331c31058dbb80261e7d279b851197c65ac87e32
When incoming request is for local-only content, or for ACTION_CREATE,
only include roots advertise those features.
Filters roots based on the allowed MIME types and the supported types
advertised by each root. This supports displaying Images and Audio
roots only when requesting those content types. Applies the same
filter when deciding which roots to query for recents.
Fixes advanced filtering instead of limiting to just devices. Update
sorting so that Recent always appears first. Add testing support for
LOCAL_ONLY.
Bug: 10597317, 10526535
Change-Id: Ic5ccf475c4fe93fd52b29388d369d7f6915c0c42
Combines related columns and constants onto the same class so they
are easier to discover. Move back to surfacing roots with columns
so they are consistent with documents.
Advanced roots are represented with a flag instead of distinct
types. Flags to indicate supporting of well-known media types,
instead of arbitrary an MIME filter. Reintroduce well-formed rootId
to support recents.
Always use the expanded version of "documents" in constants, methods,
and argument names.
Refactor DocumentProvider method names to clearly distinguish if
a single item or multiple could be returned, and of which type. Add
documentation to clearly define which methods have already been
overridden.
Bug: 10567506, 10567557
Change-Id: I981f26ab82f2b520a19aa1ce66f659de50d7fac0
Using a contract class requires that a provider implement it exactly
with little help. This change introduces a DocumentsProvider abstract
class that provides a client-side implementation of the contract that
greatly reduces developer burden, and improves correctness.
This also moves to first-class DocumentRoot objects, and moves calls
with complex side effects to be ContentProvider.call() invocations,
offering more granular permission control over Uri operations that
shouldn't be available through Uri grants.
This new design also relaxes the requirement that root information be
burned into every Uri. Migrate ExternalDocumentsProvider and
DocumentsUI to adopt new API.
Bug: 10497206
Change-Id: I6f2b3f519bfd62a9d693223ea5628a971ce2e743
Adds new ExifInterface method to extract the thumbnail range from
a larger image file, and use that to return an AssetFileDescriptor.
When decoding an AssetFileDescriptor thumbnail with offsets, read out
the raw data entirely, since Skia uses lseek() aggressively.
Bug: 10412208
Change-Id: I7906cdf82c0c3794cec7043c801a86f66efeb143
Implement EXTRA_HAS_MORE and EXTRA_REQUEST_MORE contract with
document providers. Providers can include EXTRA_HAS_MORE when
additional data is available with additional cost, such as a network
request.
Listen to content changes based on returned cursor instead of
original Uri. Include a test backend to exercise. UX still under
development.
Bug: 10350207
Change-Id: Iaa8954df55a1a1c0aa96eb8a4fd288e12c2fbb01
When requesting thumbnails, check if their dimensions are larger
than requested, and downscale to avoid memory pressure. Load them
async and with LruCache.
Extend MatrixCursor so that RowBuilder can offer() columns without
requiring they know the projection map. This makes it easier to
respond to query() calls, where the remote side controls the
projection map. Use it to handle custom projections in external
storage backend.
Update date/time formatting to match spec.
Bug: 10333418, 10331689
Change-Id: I7e947a8e8068af8a39b55e6766b3241de4f3fc16
Create documents manage mode to support Downloads and transient
storage devices. Locks user into requested backend root, and forces
file sizes on and sorting by last modified.
Separate API constants for Documents versus Roots, and give concrete
MIME types for roots.
Treat null sizes as unknown. Documents are always enabled in list
so that divider is drawn. Mark external storage file as writable.
Bug: 10329983, 10332993, 10332952
Change-Id: I05f4fdf5b04041a38e1ba7fb30202a3b0c615bf6
Move to manual tracking of directory navigation stack so we have Uri
data to persist, instead of opaque fragment backstack. Remember
directory stacks across launches on a per-app basis.
Start recording recently opened and created files. Uniform Uri
parameter extraction utility methods in contract.
Change-Id: I79ed30ee10272bf7c53d339e797639c993f649bb
The same document may be present with different sematics under
multiple storage roots, so always reference using both ROOT_ID and
DOC_ID. This enables backends to revoke permissions for an entire
root, such as when an account is removed.
Start building provider to remember recently accessed documents.
Change-Id: I75befa2e61393dec12fcc7fd27f631fcddae46fa
Introduce XML metadata for storage backends, used to indicate if
custom roots should be queried, and provide any custom MIME type
icons inside that backend.
Parse metadata and resolve custom icons in UI.
Change-Id: Iec026c0b10845edff7a345d9389691ddf2c87a0e
Allow storage backends to publish multiple roots into the UI, which
are defined by a directory GUID, type, and label details. Update
external provider to surface a primary external storage root, and
switch to burning file path into the returned GUIDs so they remain
durable.
Added insert, update, and delete support to external provider. Adds
file extensions to display names when needed to match MIME type.
Add flags for searching and deletion, and extras for Cursor
pagination. Add directory creation dialog to UI. Opening a document
always gives write access.
Change-Id: I9bea1aa0dcde909a5ab86aefeece7451ab920cf1
"signatureOrSystem" permissions are no longer available to all apps
residing en the /system partition. Instead, there is a new /system/priv-app
directory, and only apps whose APKs are in that directory are allowed
to use signatureOrSystem permissions without sharing the platform cert.
This will reduce the surface area for possible exploits of system-
bundled applications to try to gain access to permission-guarded
operations.
The ApplicationInfo.FLAG_SYSTEM flag continues to mean what it is
says in the documentation: it indicates that the application apk was
bundled on the /system partition. A new hidden flag FLAG_PRIVILEGED
has been introduced that reflects the actual right to access these
permissions.
At some point the "system" permission category will be
renamed to "privileged".
Bug 8765951
Change-Id: I6f0fd9cdb9170e076dfc66d83ecea76f8dd7335d
Continuing to flesh out storage backends by adding an external
storage document backend. Still rough, but it can traverse files
and directories.
Early pass at OPEN/CREATE_DOC picker UI, which offers to traverse
any known storage backends. Supports opening subdirectories and
returning a picked file.
Change-Id: Idc3554036b3816a93d9b465ee8a620746859d2ae