Commit Graph

271 Commits

Author SHA1 Message Date
Zim
17be6f999b Fix multi-user and multi-storage with FUSE
Up until now, the FUSE mount logic has made two assumptions:
1. The primary external volume is an emulated volume on /data/media
2. Only the primary user is running, as user zero

With this change, we are able to handle the following cases:
1. Mount new external storage volumes as as portable storage
(PublicVolume) managed by FUSE. The PublicVolume originally mounted on
/mnt/media_rw/<uuid> is availabe on /storage/<uuid> as a FUSE mount

2. Mount new external storage volumes as adoptable storage
(PrivateVolume) with a stacked EmulatedVolume managed by FUSE. The
EmulatedVolume orignally mounted on /mnt/expand/<uuid>/media will be
available on /storage/emulated if set as the primary storage

3. Run the MediaProvider as a secondary user handling requests on
/mnt/user/<userid>/<volid>

Test: atest AdoptableHostTest
Bug: 135341433
Bug: 140120303

Change-Id: I5fb48616b4143277ea14c6846037e2fd176e16db
2019-11-12 16:40:39 +00:00
Bill Yi
57e4d5b80a Import translations. DO NOT MERGE
Change-Id: I7a8a9b598689bb9ad2e18d27de05e8334ee7b41e
Auto-generated-cl: translation import
2019-11-06 14:29:56 -08:00
Philip P. Moltmann
128b70364e Note with featureId from ContentProvider
This takes the Context#getFeatureId from the calling context and pipes
it all way through to the noteOp calls done by the content provider.

Bug: 136595429
Test: atest CtsAppOpsTestCases (new test added to capture this case)
            TelecomUnitTests:CallLogManagerTest
	    ContentProviderClientTest
	    TelecomUnitTests:MissedCallNotifierImplTest
	    TelecomUnitTests:BasicCallTests
	    MediaInserterTest
	    PreferencesHelperTest
	    RankingHelperTest
	    PinnedSliceStateTest
	    FrameworksCoreTests:ContentResolverTest
Change-Id: I53b1035626229c920b353509a5bece157b52fb51
2019-10-29 15:41:28 -07:00
Ivan Chiang
730b3a3a45 Allow providers block folders in ACTION_OPEN_DOCUMENT_TREE
DocumentsContract
- Add new flag FLAG_DIR_BLOCKS_TREE in Document

ExternalStorageProvider
- Add flag into DocumentInfo for blocking folder

Change-Id: Ib557fe99d330788a3bd968bffd43b6658761514f
Bug: 32370759
Test: atest DocumentsTest
2019-10-02 06:01:36 +00:00
Bill Yi
7ceb4c6aba Import translations. DO NOT MERGE
Change-Id: Iab86bc7039dc430d19c6c8003ab1fd30a76e380c
Auto-generated-cl: translation import
2019-07-11 09:56:52 -07:00
Jeff Sharkey
601c3c63d0 Fix getMediaUri() bug on secondary devices.
We need to return visible paths for MediaProvider to work with,
instead of internal paths.

Bug: 133730441
Test: atest android.providerui.cts.MediaStoreUiTest
Change-Id: If06dc635b22032761626cf54b37b7bc15ace7b2e
2019-05-29 12:55:07 -06:00
Bill Yi
b871bd62a3 Import translations. DO NOT MERGE
Change-Id: I5d9ed79b13c8a2af09d6909473ae42a95d8452ad
Auto-generated-cl: translation import
2019-02-02 08:21:02 -08:00
Ivan Chiang
c26d3c28c2 Add new column into Root to get the supported query args
DocumentsContract:
- Add @Public column Root#COLUMN_QUERY_ARGS
- Update java doc

DocumentsProvider:
- Update java doc

FileSystemProvider & ExternalStorageProvider
- Add supported query args into Roots

Bug: 121234248
Test: manual
Change-Id: Ia944200ee1a44d75c9ad683564218e3d0dcef885
2019-01-21 15:44:53 +08:00
TreeHugger Robot
6634ae2cf3 Merge "Migrate frameworks/base/packages/ExternalStorageProvider/tests to androidx.test" 2018-12-20 23:53:33 +00:00
KOUSHIK PANUGANTI
2d6c5fc3bf Migrate frameworks/base/packages/ExternalStorageProvider/tests to androidx.test
See go/jetpack-test-android-migration

Test: make checkbuild
Change-Id: I20090d9bd41f91d239181e42754452d46ec2f3ff
2018-12-18 12:37:14 -08:00
Amin Shaikh
305e87e6d9 Add StorageVolume#createOpenDocumentTreeIntent
Change-Id: I6894bad24fa7757dee1028a31ba0b07701baa7b3
Fixes: 119519300
Test: manually using ApiDemos Content > Storage > Documents
2018-12-18 11:44:13 -05:00
Jeff Sharkey
efd355c1c3 Merge "Hide eject icon of removable media when it's emulated volume" am: 7f656092df am: 0fe81d7320
am: 29ce4d5fda

Change-Id: I815654df758200596b949943738608cd42ecdc40
2018-12-05 08:48:12 -08:00
Jeff Sharkey
29ce4d5fda Merge "Hide eject icon of removable media when it's emulated volume" am: 7f656092df
am: 0fe81d7320

Change-Id: Ia2b865c56a92265151444b4b7310b61c51a9a952
2018-12-05 08:38:43 -08:00
Takamasa Kuramitsu
f5f03fc083 Hide eject icon of removable media when it's emulated volume
Hide eject icon of removable media on the root list of Files app when
primary shared storage is in adopted media due to the following reasons.

- Primary shared storage should not be easily ejected because that
causes the situation that there's no primary shared storage

- To align with the Storage settings (Settings > Storage), eject icon
is disabled in this menu when the removable media is adopted

- Eject action from Files app can only unmount primary shared storage

Bug: 117252468
Test: manual
Change-Id: Idd76229fb10db621a817afd60295787c761345b1
2018-11-29 03:08:07 +00:00
Ivan Chiang
a972d0449a Extend DocumentsContract search to accept mime types
1. Add the key of query arguments and match method
   in DocumentsContract.
2. Implement new querySearchDocuments method in
   DocumentsProvider, ExternalStoragProvider and
   FileSystemProvider.

Bug: 111786939
Test: Manual Test
Change-Id: I04e9f2be971f10ac1e9584a3486c948aaddea0a4
2018-11-14 15:06:35 +08:00
Risan
f8771d362c Merge "Introducing StubVolume in StorageManager" am: b499af866c am: eb871cc916
am: ee32e0d473

Change-Id: I4098132df9833b7cbac0db9bdadac297d324a822
2018-11-13 12:12:23 -08:00
Risan
ee32e0d473 Merge "Introducing StubVolume in StorageManager" am: b499af866c
am: eb871cc916

Change-Id: I69240d32659b511aec0e1e029fb6c6f1ab455c9c
2018-11-13 11:57:12 -08:00
Risan
05c41e6a0a Introducing StubVolume in StorageManager
Bug: 110380403
Test: Tested in ARC++ (with Settings and vold changes in separate CLS)
- able to see the external storage under StorageSettings. Also tested
the sm command to print stubvolumes.

Change-Id: I7517260a40399bd9800424bb394512601f6af617
2018-11-08 21:48:35 +00:00
Jeff Sharkey
643e99ef06 Reroute Uri conversions though MediaProvider.
Upcoming changes will prevent apps from reading "_data" columns
directly, which is required to convert between DocumentsProvider and
MediaProvider Uris.  To solve this, delegate the call() through
MediaProvider, where it can perform the "_data" lookup on behalf
of the caller.

Also add new getMediaUri() call to offer symmetry.

Bug: 111960973, 117627072, 110961701
Test: atest android.provider.cts.MediaStoreUiTest
Change-Id: I53c640704d86047d7a4bf1702aca027873395abf
2018-10-24 19:34:09 -06:00
felkachang
593d07b991 To add the Android.bp of ExternalStorageProvider
ExternalStorageProvider doesn't have any tests yet.
1. Convert Android.mk to Android.bp
2. Add init testcase
3. formatted by bpfmt -s -w Android.bp

Fixes: 117812397
Test: atest ExternalStorageProviderTests

Change-Id: I74235832f453110742de0b15cb14fac7514ecf0e
2018-10-24 06:11:06 +00:00
Andreas Gampe
b58893078b Frameworks: Annotate trivial @GuardedBy in packages
Add @GuardedBy for simple functions that require locks and have a name in
one of the frameworks naming styles for locks ("^.*(Locked|LPw|LPr|L[a-zA-Z]|UL|AL|NL)$").

Derived by errorprone.

Bug: 73000847
Test: m
Change-Id: Id14322b0a6206152cd2933c968e0a6f470fcee09
2018-09-05 17:05:26 -07:00
Bill Yi
ffa6905ddf Import translations. DO NOT MERGE
Change-Id: I629ba4be0e89af2cc8c760cfe8d5a3e3ac5443f8
Auto-generated-cl: translation import
2018-08-04 00:29:32 -07:00
Bill Yi
6d98c3e49c Import translations. DO NOT MERGE
Change-Id: I5fdad685a6bfd04b78a1ad1fb9586efc2924bb8a
Auto-generated-cl: translation import
2018-06-01 07:24:11 -07:00
Jeff Sharkey
cbfdfa90ad Merge "Return to modifying raw /mnt/media_rw paths." into pi-dev am: f7d3e028ae
am: 1394fd25ca

Change-Id: If6904b6dc431dab74e326b75f37b58ee3c99feef
2018-05-02 18:10:07 -07:00
Jeff Sharkey
1394fd25ca Merge "Return to modifying raw /mnt/media_rw paths." into pi-dev
am: f7d3e028ae

Change-Id: I61692ebdc49233923863ce773bb42a07498551b0
2018-05-02 14:29:10 -07:00
Jeff Sharkey
b00d5ea59a Return to modifying raw /mnt/media_rw paths.
We thought we could push everyone through sdcardfs, but secondary
devices mounted in a stable location don't give full write access to
apps holding WRITE_EXTERNAL_STORAGE, so system internals still need
to reach behind sdcardfs.

To keep sdcardfs in the loop about changes that we make behind its
back, we issue access(2) calls which should be enough for it to
invalidate any cached details.

Bug: 74132243
Test: manual
Change-Id: I727cd179a5a825b16ec4df6e2f41a079758d41c5
2018-05-01 10:03:18 -06:00
Bill Yi
d7c370022f Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 64712476
Change-Id: Ib6847dd09539560b2c186a527a44294c86f211b2
2018-03-31 08:23:18 -07:00
Bill Yi
e89b7d01a9 Import translations. DO NOT MERGE
Change-Id: I78df3676b8f5fb027826ca835c9964446c3a1b70
Auto-generated-cl: translation import
2018-03-16 21:39:38 -07:00
Anton Hansson
ab6ec61251 frameworks/base: Set LOCAL_SDK_VERSION where possible.
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
2018-02-28 15:13:23 +00:00
Bill Yi
13ad8519fb Import translations. DO NOT MERGE
Change-Id: I30b4cf6c9fc5ca3f785ddb332a37311604947f8a
Auto-generated-cl: translation import
2018-02-26 14:29:07 -08:00
Bill Yi
696be5e21f Import translations. DO NOT MERGE
Change-Id: I9f7b9fb49d574b567ae8afae7ff089513ead3672
Auto-generated-cl: translation import
2018-02-22 02:27:16 -08:00
Jeff Sharkey
b78b754dc0 Enforce file transfer restrictions for shell.
If we have a policy that says DISALLOW_USB_FILE_TRANSFER, then block
file transfers for that user through common ContentProviders.

Test: builds, boots
Bug: 64672411
Change-Id: I502b10c2c229727bc6b421f9db6d2d9e2e03845c
2018-01-04 15:07:41 -07:00
Bill Yi
bd3fc330af Import translations. DO NOT MERGE
Change-Id: I37739ceeebaf645509f3a5b13d9d16af0f4cffbf
Auto-generated-cl: translation import
Exempt-From-Owner-Approval: translation import
2017-09-05 23:14:11 -07:00
Bill Yi
2aed9f432a Import translations. DO NOT MERGE
Change-Id: Ib23ebf427c10ff98a43a1565c95f8055f38fd7da
Auto-generated-cl: translation import
Exempt-From-Owner-Approval: translation import
2017-08-11 21:08:39 -07:00
Jeff Sharkey
b9b9bddabe Merge "Use "real" free space; refresh on large changes." into oc-dev am: 6428beec23
am: 1d7d72de3f

Change-Id: I337c92b3d030905ff8bea6e894558cda8e87e34e
2017-05-10 04:13:03 +00:00
Jeff Sharkey
1d7d72de3f Merge "Use "real" free space; refresh on large changes." into oc-dev
am: 6428beec23

Change-Id: Ic464de2c77983dfbb9cdcc7cc6a27062d866797a
2017-05-10 03:56:33 +00:00
Jeff Sharkey
06823d4c2e Use "real" free space; refresh on large changes.
For volumes where the OS manages cached data, use the "free space" as
reported by StorageStatsManager, which is the same value shown in
the Settings app and other UI elements.

Also, when the storage space changes significantly, invalidate anyone
who was holding a cached "free space" value.

Test: builds, boots
Bug: 38146029
Change-Id: I4b3a484a8bf32cd137a83f1ea441beca6dc6719a
2017-05-09 16:55:31 -06:00
Bill Yi
7b329f6c9d Import translations. DO NOT MERGE
Change-Id: I20af9c4b4177a5a36496e76c70870b4792944f2c
Auto-generated-cl: translation import
2017-04-11 11:28:05 -07:00
Bill Yi
8e7ad54464 Import translations. DO NOT MERGE
Change-Id: I71ee4b0792217988e13df03f2ced891e83cf038e
Auto-generated-cl: translation import
2017-04-07 17:48:48 -07:00
Bill Yi
808bdf5bce Import translations. DO NOT MERGE
Change-Id: I0276e7c9fb791dcdaf604ed87abe58677abcc3af
Auto-generated-cl: translation import
2017-04-07 17:45:13 -07:00
Jeff Sharkey
c0a60682e2 Merge "We really want f_frsize and f_bavail." into oc-dev am: fd463121c6
am: f9f7d71cc5

Change-Id: Ifa28cb4515d6e9e74380fe70d73aec292d126ac9
2017-04-03 17:43:10 +00:00
Jeff Sharkey
f9f7d71cc5 Merge "We really want f_frsize and f_bavail." into oc-dev
am: fd463121c6

Change-Id: I55aebb3b452f4d41af7e5f54d0dff27e9bc6cca6
2017-04-03 17:27:48 +00:00
Jeff Sharkey
dafb17e7eb We really want f_frsize and f_bavail.
It's confusing, but f_bsize is not the value you're looking for; the
real block size is f_frsize.  Fix all those bugs.

Also, the vast majority of clients are interested in the usable
disk space, not including reserved space.

Test: builds, boots
Bug: 36840579
Change-Id: Ib1470389afd49c14cab62282ec1e978ebb2c4791
2017-04-02 23:33:38 -06:00
Bill Yi
8e79b3a9a0 Import translations. DO NOT MERGE
Change-Id: I789e7f6f9910fb2bfceec085555a42335853f1dd
Auto-generated-cl: translation import
2017-03-31 00:39:13 -07:00
Bill Yi
cebf64124c Import translations. DO NOT MERGE
Change-Id: I53e36942b22959b652d97804e339d85683c0a31b
Auto-generated-cl: translation import
2017-03-31 00:36:03 -07:00
TreeHugger Robot
0e74c95c0c Merge "Unhide FLAG_SUPPORT_EJECT and related methods." 2017-03-24 01:23:53 +00:00
Garfield Tan
8787703ae0 Unhide FLAG_SUPPORT_EJECT and related methods.
Test: Builds and CTS tests pass. Some manual tests as well.
Bug: 36483910
Change-Id: Idd9b1c9d9573222ee12127044ff11b9ab2487f0a
2017-03-23 16:41:24 -07:00
Bill Yi
97da16f1a7 Import translations. DO NOT MERGE
Change-Id: I78f94f36822ec6c8e01bd1ee3e49d75aa9fe65ac
Auto-generated-cl: translation import
2017-03-23 00:41:07 -07:00
Ben Lin
0df63e9080 Add android:label to ExternalStorageProvider.
Test: Builds.
Bug: 30138665
Change-Id: I6ac028f97c1451f9d78f7f5a0960f1a3f8bde5b7
2017-03-20 10:20:41 -07:00
Garfield Tan
b690b4de06 Address comments from API council.
Test: Code builds and tests pass. Also some manual tests around ESP.
Bug: 35813037
Bug: 35812990
Change-Id: Ia9d3a3964e9a83d0c1c08e5db4c2e231504aa99a
2017-03-02 12:48:13 -08:00