This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.
Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.
Test: make relevant packages
Bug: 73535841
Change-Id: I4233b9091d9066c4fa69f3d24aaf367ea500f760
Statically including legacy-android-test leads to duplicate classes
which causes build time problems (with Proguard) and runtime problems on
older SDK versions. This change:
* Stops statically including legacy-android-test.
* Adds compile time dependencies on andoid.test.base, android.test.mock
and android.test.runner where necessary.
* Adds <uses-library android:name="android.test.runner"/> to any
affected package to ensure that the classes that were included by
legacy-android-test are still available at runtime. That also adds a
dependency on android.test.base and android.test.mock.
The following change descriptions were generated automatically and so
may be a little repetitive. They are provided to give the reviewer
enough information to check the comments match what has actually been
changed and check the reasoning behind the changes.
* apct-tests/perftests/core/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in CorePerfTests results
in duplicate classes which leads to build time and compile time
issues.
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
CorePerfTests's source depends on its classes and because of these
changes they are no longer present on the compilation path.
* core/tests/ConnectivityManagerTest/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
ConnectivityManagerTest's source depends on its classes and because
of these changes they are no longer present on the compilation
path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in ConnectivityManagerTest
results in duplicate classes which leads to build time and compile
time issues.
* core/tests/bandwidthtests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
BandwidthTests's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in BandwidthTests results
in duplicate classes which leads to build time and compile time
issues.
* core/tests/bluetoothtests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
BluetoothTests's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in BluetoothTests results
in duplicate classes which leads to build time and compile time
issues.
* core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in DownloadManagerTestApp
results in duplicate classes which leads to build time and compile
time issues.
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
DownloadManagerTestApp's source depends on its classes and because
of these changes they are no longer present on the compilation
path.
* core/tests/hosttests/test-apps/ExternalSharedPerms/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
ExternalSharedPermsTestApp results in duplicate classes which leads
to build time and compile time issues.
* core/tests/hosttests/test-apps/ExternalSharedPermsBT/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
ExternalSharedPermsBTTestApp results in duplicate classes which
leads to build time and compile time issues.
* core/tests/hosttests/test-apps/ExternalSharedPermsDiffKey/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
ExternalSharedPermsDiffKeyTestApp results in duplicate classes
which leads to build time and compile time issues.
* core/tests/hosttests/test-apps/ExternalSharedPermsFL/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
ExternalSharedPermsFLTestApp results in duplicate classes which
leads to build time and compile time issues.
* core/tests/notificationtests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
NotificationStressTests's source depends on its classes and because
of these changes they are no longer present on the compilation
path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in NotificationStressTests
results in duplicate classes which leads to build time and compile
time issues.
* keystore/tests/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in KeystoreTests results
in duplicate classes which leads to build time and compile time
issues.
* media/mca/tests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
CameraEffectsTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in CameraEffectsTests
results in duplicate classes which leads to build time and compile
time issues.
* media/tests/MediaFrameworkTest/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
mediaframeworktest's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in mediaframeworktest
results in duplicate classes which leads to build time and compile
time issues.
* nfc-extras/tests/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in NfcExtrasTests results
in duplicate classes which leads to build time and compile time
issues.
* packages/CarrierDefaultApp/tests/unit/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
CarrierDefaultAppUnitTests's source depends on its classes and
because of these changes they are no longer present on the
compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
CarrierDefaultAppUnitTests results in duplicate classes which leads
to build time and compile time issues.
* packages/ExtServices/tests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
ExtServicesUnitTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in ExtServicesUnitTests
results in duplicate classes which leads to build time and compile
time issues.
* packages/MtpDocumentsProvider/tests/Android.mk
Added 'android.test.base' and 'android.test.mock' to
LOCAL_JAVA_LIBRARIES because MtpDocumentsProviderTests's source
depends on their classes and because of these changes they are no
longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
MtpDocumentsProviderTests results in duplicate classes which leads
to build time and compile time issues.
* packages/SettingsLib/tests/integ/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
SettingsLibTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in SettingsLibTests
results in duplicate classes which leads to build time and compile
time issues.
* packages/SettingsProvider/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in SettingsProvider
results in duplicate classes which leads to build time and compile
time issues.
* packages/SettingsProvider/AndroidManifest.xml
Add uses-library for android.test.runner because otherwise this
change would change the set of files available to SettingsProvider
at runtime.
* packages/Shell/tests/Android.mk
Added 'android.test.base' and 'android.test.mock' to
LOCAL_JAVA_LIBRARIES because ShellTests's source depends on their
classes and because of these changes they are no longer present on
the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in ShellTests results in
duplicate classes which leads to build time and compile time
issues.
* packages/SystemUI/shared/tests/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in SystemUISharedLibTests
results in duplicate classes which leads to build time and compile
time issues.
* packages/SystemUI/tests/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in SystemUITests results
in duplicate classes which leads to build time and compile time
issues.
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
SystemUITests's source depends on its classes and because of these
changes they are no longer present on the compilation path.
* packages/WAPPushManager/tests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
WAPPushManagerTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in WAPPushManagerTests
results in duplicate classes which leads to build time and compile
time issues.
* sax/tests/saxtests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworksSaxTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in FrameworksSaxTests
results in duplicate classes which leads to build time and compile
time issues.
* tests/BrowserPowerTest/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
BrowserPowerTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in BrowserPowerTests
results in duplicate classes which leads to build time and compile
time issues.
* tests/CanvasCompare/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
CanvasCompare's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in CanvasCompare results
in duplicate classes which leads to build time and compile time
issues.
* tests/CoreTests/android/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
CoreTests's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in CoreTests results in
duplicate classes which leads to build time and compile time
issues.
* tests/DataIdleTest/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
DataIdleTest's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in DataIdleTest results in
duplicate classes which leads to build time and compile time
issues.
* tests/FrameworkPerf/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworkPerf's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in FrameworkPerf results
in duplicate classes which leads to build time and compile time
issues.
* tests/HierarchyViewerTest/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
HierarchyViewerTest's source depends on its classes and because of
these changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in HierarchyViewerTest
results in duplicate classes which leads to build time and compile
time issues.
* tests/ImfTest/tests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
ImfTestTests's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in ImfTestTests results in
duplicate classes which leads to build time and compile time
issues.
* tests/Internal/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in InternalTests results
in duplicate classes which leads to build time and compile time
issues.
* tests/MemoryUsage/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
MemoryUsage's source depends on its classes and because of these
changes they are no longer present on the compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in MemoryUsage results in
duplicate classes which leads to build time and compile time
issues.
* tests/NetworkSecurityConfigTest/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
NetworkSecurityConfigTests's source depends on its classes and
because of these changes they are no longer present on the
compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
NetworkSecurityConfigTests results in duplicate classes which leads
to build time and compile time issues.
* tests/SoundTriggerTests/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in SoundTriggerTests
results in duplicate classes which leads to build time and compile
time issues.
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
SoundTriggerTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
* tests/SurfaceComposition/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in SurfaceComposition
results in duplicate classes which leads to build time and compile
time issues.
Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because
SurfaceComposition's source depends on its classes and because of
these changes they are no longer present on the compilation path.
* tests/TtsTests/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in TtsTests results in
duplicate classes which leads to build time and compile time
issues.
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
TtsTests's source depends on its classes and because of these
changes they are no longer present on the compilation path.
* tests/WindowAnimationJank/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in WindowAnimationJank
results in duplicate classes which leads to build time and compile
time issues.
* tests/permission/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworkPermissionTests's source depends on its classes and
because of these changes they are no longer present on the
compilation path.
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in
FrameworkPermissionTests results in duplicate classes which leads
to build time and compile time issues.
* tests/testables/tests/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because statically including the classes in TestablesTests results
in duplicate classes which leads to build time and compile time
issues.
Added 'android.test.base' and 'android.test.mock' to
LOCAL_JAVA_LIBRARIES because TestablesTests's source depends on
their classes and because of these changes they are no longer
present on the compilation path.
Bug: 30188076
Test: make checkbuild
Change-Id: Iacfc939c97415314366ed61c5f3b7aa1a40f0ec9
Remove convenience method from DocumentsProvider, clients to use MetadataReader directly.
Concentrate mimetype checking in MetadataReader.isSupportedType.
Update FileSystemProvider to use MetadataReader directly.
Test: Updated mtp tests. Other functioanlity manually verified.
Change-Id: Ie1e3d3092b53107f6c980c18b1451290dd2a9653
Previous patch ag/2250238 broke MtpDocumentsProviderTests since
ServiceIntentSender's constructor refers the context argument which is
null in the tests.
The CL adds a test version of the constructor which does not use the
context argument in it.
Bug: 38363487
Test: MtpDocumentsProviderTests
Change-Id: I68a1d8cb6997499e5069c33f70fd0f675aaad77c
Previously MtpDocumentsProvider#queryDocument returned
FLAG_DIR_SUPPORTS_CREATE for device having multiple storages.
This was wrong because if the device has multiple storages,
MtpDocumentsProvider places the storages under the device document, thus
users cannot create a document just under the device document.
Bug: 35700994
Test: MtpDocumentsProviderTests
Change-Id: Id73a34a2eaf4e10e23be3c2da7488036cea10000
NotificationManager.startServiceInForeground() was moved to
Context#startForegroundService. MtpDocumentsProvider should use new one.
Bug: 36794559
Test: MtpDocumentsProviderTests
Change-Id: I84723ee8c3f0f8bfe4d5ea8ad035c01c42ce8bab
ag/2008770 fixed the flag value for root document.
We also need to update expected value for MtpDocumentsProviderTest.
Bug: 35855598
Test: adb shell am instrument -w \
com.android.mtp.tests/com.android.mtp.TestResultInstrumentation
Change-Id: I3ca7f08dc8f14b84c350dbc3ddd5a0ba5ff7d04f
TouchLatency is needed by test TouchLatencyJankTestWear
UiBench is needed by test UiBenchJankTests
Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#
Bug: 35882476
Test: local test
make -j32 TouchLatency TouchLatencyJankTestWear && \
tradefed.sh run template/local --template:map test=TouchLatencyJankTestWear \
--test-tag testname --log-level-display VERBOSE
make -j32 UiBenchJankTests UiBench && \
tradefed.sh run template/local --template:map test=UiBenchJankTests \
--test-tag testname --log-level-display VERBOSE
Change-Id: I63f23e3a21ad1343607953958fb7bb0a5fb8c343
This CL adds the APCT tests within this project to
a similar suite as CTS known as device-tests.
The current method of running APCT tests in the infrastructure
is unaffected.
Bug: 35882476
Test: `make dist device-tests -j` and local builds of
continuous_instrumentation_tests & continuous_native_tests
Change-Id: Ifa382fe691842c1cd76897775b9e2a1653449eb5
Prevously MtpDocumentsService was started as background service, then it
turns into a foreground service by calling Service#startForeground.
The workflow did not work until this, because now background activity
cannot launch a background service.
The CL starts using NotificationManager#startForegroundService to launch
MtpDocumentsService so that the service can be started as foreground
service directly.
Bug: 34468813
Test: MtpDocumentsProviderTests
Test: manual testing with connecting MTP device to Android
Change-Id: Ic35d3e92f234881846e5d82ed04d6681a83035f7
AppFuse is now a public API. The CL removes the private version from
MtpDocuemntsProvider package and switches to the public version.
Bug: 32891253
Test: MtpDocumentsProviderTest
Change-Id: Ibdf67309bc0678e2f70ac2dddb920125d9e0760e
In preparation for removing junit classes from the Android API
the legacy-test target will be removed from the
TARGET_DEFAULT_JAVA_LIBRARIES. This change adds explicit
dependencies on junit and/or legacy-android-test to ensure that
modules will compile properly once it is removed.
Bug: 30188076
Test: make checkbuild
Change-Id: I13e88297731253420e4e5f5291d503f13a39a156
Update DocumentsProvider to override
ContentProvider#query(Uri, String[], Bundle, CancellationSignal);
Added an otherwise unneeded import to pass doc check
on DocumentsProvider.
Bug: 30927484
Change-Id: I295c21f53901d567455286f22439f21d22a8a25a
Test: Build and run. Test from DocsUi.
The structure of files in MtpDocumentsProvider looks like
/device/storage/files. But MtpDocumentsProvider shows files
just under the device if the device has only single storage.
It causes a problem that MtpDocumentsProvider tries to create a file
under the device. Previously it tries to create a file with storageId =
0, which means MTP device choose a storage to store the file.
Because it only happens when the device has a single storage, the file
is properly written to the device. But the database in
MtpDocumentsProvider goes into the illegal state where the file is
placed just under the device.
Bug: 32561572
Test: adb shell am instrument -w -e class com.android.mtp.MtpDocumentsProviderTest com.android.mtp.tests/com.android.mtp.TestResultInstrumentation
Change-Id: I47a373ceee8a64ba9995934317693e79d2497ee0
The flag indicate whether the root needs network access or not. MTP
should be LOCAL_ONLY root.
Bug: 30867267
Change-Id: Ia272d4a389cc1ca628d7b963caa37f3dbb6747e3
ag/1241051 explicitly specified the primary mime type for MTP format
code. And it changes mime type for MtpConstants.FORMAT_MPEG from
video/mp4 to video/mpeg.
FIX=30266226
Change-Id: I362bd7d651140b9928aa76e0d54e4769296d9498
For testing, we use blockDocument and unblockDocument test mehtods to
control flow of DocumentLoader's background thread.
Previously testCancelTask may exit before the background thread goes
back from blocking, which causes InterruptedException.
Fixes: 28125289
Change-Id: Id03826733c5b6f1da66b9280838eb1d2897ed5fc
When deleting files, MtpDocumentsProvider clears LoadingTask in
DocumentsLoader to update directory contents list. Previously it can
clear ongoing task, and it skips calling Mapper#stopAddingDocuments.
Since Mapper#startAddingDocuments and Mapper#stopAddingDocuments must be
called 1 to 1, it causes precondition check failure at the next call of
Mapper#startAddingDocuments.
Change-Id: I23e2b117da826297e45404be4db4cc29f96e5510
Fix: 28076320
Previously MtpDocumentsProvider used pipes to transfer bytes from an
application to the provider when writing a document. The problem was
application could not ensure that the last chunk of bytes was
successfully written to MTP device, since pipes had been already closed
when the provider transferred bytes to MTP device. Though the provider
encountered an error, the provider could not report the error to an
application.
The CL switches the method to transfer bytes from pipes to AppFuse. Now
application can flush() bytes on the file descriptor, and flush will not
complete until the provider completes writing bytes to MTP device.
Fixed: 23093747
Change-Id: I4e28f8cbf19d6c97e591943349a7535241d768f7
MtpObjectInfo contains object size as 32-bit integer and the provider
needs to invoke MtpDevice#getObjectSizeLong hidden API to get 64-bit
object size.
The CL switches to use MtpDevice#getObjectSizeLong hidden API if
MtpObjectInfo#getCompressedSize() returns 0xffffffffL, which means the
object size is more than 4GB.
BUG=27805369
Change-Id: I87ea02c09aa784246cf016def309d1f39ed20e90
The CL adds a handler for FUSE_WRITE command which invokes a Java
handler.
BUG=23093747
Change-Id: I1903fca6b5663e6241ad540a89fe812310ba6810
(cherry picked from commit 35693da25af11583053d4af6a70d4acbf446978d)
Previously DocumentLoader#LoaderTask had a counter to count loaded
documents and completes adding documents to the database. However it
does not count documents where a MTP device returns an error for
getObjectInfo. The CL fixes the problem to ensure we complete documents
loading.
BUG=27729653
Change-Id: I696eac790a6535f1bd7a1855dc2d6f932e32eae5
If we have an existing file in the destination directory, which has the
same name with the source file, adding suffix number is
DocumentsProvider's responsibility.
Because MTP does not provide a way to check existance of files with
given name, the logic is implemented as try-and error strategy. The CL
lets If we MtpDocumentsProvider assume we have a file that shares the
same name with the source file if it failed to invoke
MtpDevice#sendObjectInfo. In this case MtpDocumentsProvider retry to
invoke sendObjectInfo with new name with suffix number.
BUG=26991190
Change-Id: I223ac5031f079bc91eb27709b0356f621a1ed55b
Previously if DocumentsProvider found timeout when terminatnig
RootScanner's background thread, it just output it in error log. Thus
the timeout is not regarded as an error in MtpDocumentsProviderTest, and
it makes flaky PipeManagerTest which runs just after
MtpDocumentsProviderTest.
The CL
* lets MtpDocumentsProvider throw TimeoutException for timeout.
* removes redundant resumeRootScanner calls to avoid timeout of
RootScanner#pause.
Also the CL did cleanup the logic that pauses RootScanner when we don't
find any devices. Previously the logic was in
MtpDocumentsProvider#closeInternal but it is not efficient because we
invokes RootScanner#resume just after
MtpDocumentsProvider#closeInternal. Now the CL moves the logic to
RootScanner so that it can pause itself automatically.
BUG=27638500
Change-Id: Ic11bca67c099cbb0f46679db2f035988045d67d6
File extensions contain more information to determine mime type than MTP
format codes. The CL lets MtpDocumentsProvider return mime type from
file extensions if it's not inconsitent with format code.
BUG=27004954
Change-Id: I08a4a91235b1d3f48e77b70b28c8c5aedf8d601d
When rebooting a device, applicaitons lose temporary URI permissions so
we don't need to keep document ID that are not granted persistent URI
permissions.
1. Check Settings.Global.BOOT_COUNT to find out if it's first time to
launch MtpDocumentsProvider since booting.
2. If so, invokes clean up method of MtpDatabase.
BUG=26212981
Change-Id: Ic9a8ca7e7a9cac1ed91fdfb01e9dce14ce819243
MTP devices can return supported operation list. The CL sets root flag
by referring it.
BUG=26147375
Change-Id: I02397821e208cf5a8fcf7457aa279d2818ce24c7
Once MTP device is disconnected from Android, the files on MTP device
are marked as 'DISCONNECTED' in metadata database. These metadata will
be back when MtpDocumentsProvider finds the reconnected MTP device and
fetches the files again.
Previously the 'DISCONNECTED' files are not automatically
refetched. User needs to see files in Documents UI again to reuse
document ID of 'DISCONNECTED' files. The CL changes DocumentLoader so
that it automatically refetches disconnected documents.
BUG=26212981
Change-Id: I5cb2cc9c11af72632e481c59a505794f43ed62ea
The MTP spec does not offer a way to update bytes of exisitng files, so
our provider implementation creates a new file with new bytes and
removes old one.
Previously the new file uses new document ID and the exising document ID
is expired. Also the provider does not update the metadata
database. Thus users see the old flie in DocumentsUI but actually the
files is not accessible.
The CL updates the database with exisitng document ID, so that we can
access the new file with exisiting document ID.
BUG=26549400
Change-Id: I629b707a2e662b34625e8b28857ef818d8933996
The CL introduces MAPPING_KEY column to the database and lets Mapper use
the column to map IDs of devices.
It also removes the concept of mapping mode from Mapper for
simplyfing. Now Mapper just tries to multiple mapping keys (MTP
identifier, display name, and mapping key) to find candidate of ID
mapping.
BUG=26212981
Change-Id: I19f6c7dac146047e9978de4eb33d5076406037ad
(cherry picked from commit 637a2010f4a0c0484b13c4cb87aa2858bdf079b2)
If the remote MTP device is a smartphone, it does not provide files
until a user unlocks the device. The CL adds specific error message for
the situation.
BUG=26318917
Change-Id: Ic4c34609c55ec9c99b7b8a9143d6dae3835784e3
When MTP device is busy (e.g. used by other application),
MtpDocumentsProvider cannot open the device. The CL introduces specific
error message for the case.
BUG=26694828
Change-Id: Iffee2e1c554e4089601186469ff0eac2fd04decd