Commit graph

6170 commits

Author SHA1 Message Date
Eric Biggers
298770c2cf Merge "Revert "Introduce ro.crypto.uses_fs_ioc_add_encryption_key property"" into main am: 50e681b4ba am: 59e7388536 am: 579643b765
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705760

Change-Id: Ie58b63a6a68bbea912f61bc0e5d670ab4b0d54af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-15 02:09:29 +00:00
Eric Biggers
579643b765 Merge "Revert "Introduce ro.crypto.uses_fs_ioc_add_encryption_key property"" into main am: 50e681b4ba am: 59e7388536
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705760

Change-Id: I922242eeb193b924e8f242f954d1935f9cafd749
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-15 01:25:18 +00:00
Eric Biggers
59e7388536 Merge "Revert "Introduce ro.crypto.uses_fs_ioc_add_encryption_key property"" into main am: 50e681b4ba
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705760

Change-Id: I2ed5f6e758fc48bc842c05652c8c002edaae991a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-15 00:44:25 +00:00
Paul Lawrence
d73dfd4ab0 Add vdc volume getStorageSize
StorageStatsManager.getTotalBytes currently takes the size of /data and
rounds up to known probable sizes to guess the size of internal storage.
This is not always correct.

Instead, find the device /data is on and get the size of that device.
This should give a more accurate answer.

Bug: 295358118
Test: vdc volume getStorageSize returns storage size
Change-Id: I907892041b1ce2cd72092a9877ac34c12bf3f254
2023-08-14 23:51:39 +00:00
Eric Biggers
50e681b4ba Merge "Revert "Introduce ro.crypto.uses_fs_ioc_add_encryption_key property"" into main 2023-08-14 20:54:30 +00:00
Jooyung Han
4c6bacf224 Merge changes from topic "revert-2685449-apexdata-dirs-NPLMAAVHNV" into main am: 866faf55e3 am: 6d57d3a9fa am: 0e013cf720 am: 120a8bcbc6
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705735

Change-Id: I05c1bf89b360b7beff0221ba3e8190a41603eaa3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-12 01:45:55 +00:00
Tomasz Wasilczyk
389c690708 Merge "Use String8/16 c_str" into main am: 920fe9b065 am: affd3c30cc am: dc0c9884bc am: b18a6b8e88
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705933

Change-Id: I66211fd8146d81ec595ea02629cc1d8ec4bbfffa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-12 01:45:08 +00:00
Jooyung Han
120a8bcbc6 Merge changes from topic "revert-2685449-apexdata-dirs-NPLMAAVHNV" into main am: 866faf55e3 am: 6d57d3a9fa am: 0e013cf720
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705735

Change-Id: I2bfd1cdfa4b3ca9aef2a507c05899fce0ef7b5ed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-12 01:00:02 +00:00
Tomasz Wasilczyk
b18a6b8e88 Merge "Use String8/16 c_str" into main am: 920fe9b065 am: affd3c30cc am: dc0c9884bc
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705933

Change-Id: Ie59d8aab3092a3d2e938354a66cf92378c3505b9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-12 00:59:46 +00:00
Jooyung Han
0e013cf720 Merge changes from topic "revert-2685449-apexdata-dirs-NPLMAAVHNV" into main am: 866faf55e3 am: 6d57d3a9fa
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705735

Change-Id: Ia4b693cff865fc380f157ec6ec4cea7d672bcad7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-12 00:15:58 +00:00
Tomasz Wasilczyk
dc0c9884bc Merge "Use String8/16 c_str" into main am: 920fe9b065 am: affd3c30cc
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705933

Change-Id: I6af82f1be61dc38aceaa8b3f738bd3784cc39ca3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-12 00:15:29 +00:00
Jooyung Han
6d57d3a9fa Merge changes from topic "revert-2685449-apexdata-dirs-NPLMAAVHNV" into main am: 866faf55e3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705735

Change-Id: I074c6b9bc82169bc4ce611bd4bf2aacd63816f56
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-11 23:34:11 +00:00
Tomasz Wasilczyk
affd3c30cc Merge "Use String8/16 c_str" into main am: 920fe9b065
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2705933

Change-Id: I44bd263aab55b4a1c9b73215a1719e02dbc6cdfe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-11 23:33:01 +00:00
Jooyung Han
866faf55e3 Merge changes from topic "revert-2685449-apexdata-dirs-NPLMAAVHNV" into main
* changes:
  Use /data/misc/apexdata for the list of APEXes
  Revert "Use apexservice to get the list of apexes"
2023-08-11 23:23:18 +00:00
Tomasz Wasilczyk
920fe9b065 Merge "Use String8/16 c_str" into main 2023-08-11 22:56:12 +00:00
Eric Biggers
2114e26501 Revert "Introduce ro.crypto.uses_fs_ioc_add_encryption_key property"
This reverts commit 78f806198f.

There is no code that reads this system property, logcat already shows
whether the FS keyring is being used, and all devices launching with
Android 11 and later are guaranteed to use the FS keyring anyway.

Bug: 154327249
Change-Id: Id906efedd89d5bcac5370fb141cdbf7848932d95
2023-08-11 20:27:44 +00:00
Tomasz Wasilczyk
fa1b3971fd Use String8/16 c_str
Bug: 295394788
Test: make checkbuild
Change-Id: I6029b226006c4e82849411adfe539d5c43763e18
2023-08-11 16:12:17 +00:00
Jooyung Han
64d727c503 Use /data/misc/apexdata for the list of APEXes
vold_prepare_subdirs should create apexdata directories for each APEX.
Previously, it gets the list by scanning /apex directory. However,
vold/vold_prepare_subdirs run in the bootstrap mount namespace, they can
see only bootstrap apexes in /apex. The reason why it worked was that
unintended side effects of how we managed /apex directory for both mount
namespace.

Instead, since apexdata directories are already populated by init in
/data/misc/apexdata, we can use that directory for the same purpose.

Bug: 295345486
Test: CtsPackageSettingHostTestCases
Change-Id: I453cd59f54ccbb140f73b5e8576b36fa49f9bc59
2023-08-12 01:05:53 +09:00
Jooyung Han
6d07925510 Revert "Use apexservice to get the list of apexes"
Revert submission 2685449-apexdata-dirs

Reason for revert: b/295345486 performance regression.

Reverted changes: /q/submissionid:2685449-apexdata-dirs

Bug: b/295345486
Test: n/a
Change-Id: I710a416398148b544635e32e6b8066fb0560171f
2023-08-12 00:45:30 +09:00
Jooyung Han
e309b641af Merge "Use apexservice to get the list of apexes" into main am: d54caf0598 am: f10ff3ad79 am: 7dcb194604 am: 2d4b7ed3fb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2685449

Change-Id: I35f4e7e0a69d8ca76f5d935db499a7514273cc02
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-09 09:24:03 +00:00
Jooyung Han
2d4b7ed3fb Merge "Use apexservice to get the list of apexes" into main am: d54caf0598 am: f10ff3ad79 am: 7dcb194604
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2685449

Change-Id: I0c94b76c1a6dfc035ba6ec806df9bba8d881cd5e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-09 08:40:23 +00:00
Jooyung Han
7dcb194604 Merge "Use apexservice to get the list of apexes" into main am: d54caf0598 am: f10ff3ad79
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2685449

Change-Id: I2e36ea173f0703c08c63da05ace2d6b17b7c42aa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-09 07:56:49 +00:00
Jooyung Han
f10ff3ad79 Merge "Use apexservice to get the list of apexes" into main am: d54caf0598
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2685449

Change-Id: I53d9757abead3b69e832bc906b7bf747399f8180
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-09 07:15:45 +00:00
Jooyung Han
d54caf0598 Merge "Use apexservice to get the list of apexes" into main 2023-08-09 06:37:02 +00:00
David Anderson
82c24af55b Merge "vold: fix idlemaint abort may hold the wakelock" into main am: 1d0290c4fb am: ba9097a253 am: fb17820f1e am: 8e4fa8dd82
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2672655

Change-Id: Ic0da7f4d7813be897f71ddaa50376afb8f7e9a36
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-04 01:19:51 +00:00
David Anderson
8e4fa8dd82 Merge "vold: fix idlemaint abort may hold the wakelock" into main am: 1d0290c4fb am: ba9097a253 am: fb17820f1e
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2672655

Change-Id: I0c2eb456aa45bfe42e025b2e230aafe931082de4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-04 00:34:27 +00:00
David Anderson
fb17820f1e Merge "vold: fix idlemaint abort may hold the wakelock" into main am: 1d0290c4fb am: ba9097a253
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2672655

Change-Id: I17dac7e7d8e1ac4177a466b8d65d718145236286
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-03 23:50:35 +00:00
David Anderson
ba9097a253 Merge "vold: fix idlemaint abort may hold the wakelock" into main am: 1d0290c4fb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2672655

Change-Id: I94c330852d10c8c9eda83023d50f8ad0252ade28
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-03 23:07:34 +00:00
David Anderson
1d0290c4fb Merge "vold: fix idlemaint abort may hold the wakelock" into main 2023-08-03 22:28:28 +00:00
Jooyung Han
443a73b100 Use apexservice to get the list of apexes
In this change, the logic to get the list of apexes is replaced with
the query to apexservice, which is the source of truth. This dedups
the manual scanning of /apex for the apex list, which should be
internal to apexd. (Note how vold_prepare_subdirs filtered out
directories with "@" character).

This also makes vold_prepare_subdirs immune to the upcoming changes:
/apex directory containing only bootstrap APEXes in the bootstrap NS.

Until now, getting the list of apexes by scanning /apex was okay
because of the accidental fact that /apex directory has directories
for all the apexes, not only bootstrap apexes.

Bug: 293949266
Bug: 293546778
Test: CtsPackageSettingHostTestCases
Change-Id: I3fe373ca6f4c2281439bb2449845a1a14357131e
2023-08-01 10:51:49 +00:00
Ryan Prichard
f0241c612e Merge "Add a ZeroingAllocator::rebind<Other> for Other==char" into main am: c2b3fefa01 am: 727ef62350 am: e97cfd2d73 am: c836f0d085
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2673490

Change-Id: Ib98596d610db014567a25a36a78949f3b40ca24d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-26 03:13:18 +00:00
Ryan Prichard
c836f0d085 Merge "Add a ZeroingAllocator::rebind<Other> for Other==char" into main am: c2b3fefa01 am: 727ef62350 am: e97cfd2d73
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2673490

Change-Id: I99ab7a7df2ca277ef9687ff27e21ba5a269e12c7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-26 02:32:37 +00:00
Ryan Prichard
e97cfd2d73 Merge "Add a ZeroingAllocator::rebind<Other> for Other==char" into main am: c2b3fefa01 am: 727ef62350
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2673490

Change-Id: I9ad5271a7a6e7f1514794b7096816867eb29b477
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-26 01:22:42 +00:00
Ryan Prichard
727ef62350 Merge "Add a ZeroingAllocator::rebind<Other> for Other==char" into main am: c2b3fefa01
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2673490

Change-Id: Ib95f19d558139205647dfa086b92c966bcdbc7ba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-26 00:10:17 +00:00
Ryan Prichard
c2b3fefa01 Merge "Add a ZeroingAllocator::rebind<Other> for Other==char" into main 2023-07-25 23:32:50 +00:00
Ryan Prichard
4c513f2c7e Add a ZeroingAllocator::rebind<Other> for Other==char
Newer versions of libc++ check that an allocator can be rebound to the
same element type. We need to add a rebind member to ZeroingAllocator
to fix this compiler error:

prebuilts/clang/host/linux-x86/clang-r498229/include/c++/v1/vector:376:19: error: static assertion failed due to requirement 'is_same<android::vold::ZeroingAllocator, std::allocator<char>>::value': [allocator.requirements] states that rebinding an allocator to the same type should result in the original allocator
    static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It likely doesn't matter in practice because this allocator is only
used with std::vector, which probably doesn't use allocator rebinding,
because it won't allocate an internal node type (e.g. unlike std::map,
std::list, etc).

Alternatively, ZeroingAllocator could be changed to a
ZeroingAllocator<T> that can zero arbitrary types, but it doesn't seem
necessary currently, and types other than char wouldn't be used.

Bug: b/175635923
Test: treehugger
Change-Id: I42e9d8f02a18637fc67e94cc1358d2ed733a7268
2023-07-24 21:36:32 -07:00
Li Chong
5b224dc337 vold: fix idlemaint abort may hold the wakelock
when the idlemaint run is working, if two or more idlemaint abort concurrency are working.
all idlemaint abort will hold the wakelock, until idlemaint run finished,
but it just nofity one idlemaint abort thread to stop and release the wakelock.
Remaining idlemaint abort threads will hold the wakelock until next idlemaint run to notify them.

Bug: 292383791
Test: see the issue Description

Change-Id: I5312be2e0e92c41483cab26e627a4ae562e5aed8
2023-07-24 15:23:30 +08:00
Martijn Coenen
cf6ed75946 Merge "SM: Change volume mountUserId for new user" into main am: c7bed872c0 am: 7f304c1cf3 am: d746d9cbce am: 57f69e62fe
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2657116

Change-Id: I916ae078f2745d666b7f6e03506c0621e2290271
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 10:48:34 +00:00
Martijn Coenen
57f69e62fe Merge "SM: Change volume mountUserId for new user" into main am: c7bed872c0 am: 7f304c1cf3 am: d746d9cbce
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2657116

Change-Id: I9a339e37c1214f6cf9c0df59b4b5c2fa0d6daf83
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 10:05:55 +00:00
Martijn Coenen
d746d9cbce Merge "SM: Change volume mountUserId for new user" into main am: c7bed872c0 am: 7f304c1cf3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2657116

Change-Id: Id7f10b7d2291d79ee7358a0ffccb1aa309c225d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 09:18:28 +00:00
Martijn Coenen
7f304c1cf3 Merge "SM: Change volume mountUserId for new user" into main am: c7bed872c0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2657116

Change-Id: Ice2d9032bb1c9186b1b39d0a0a5f9ed1115537f3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 08:34:45 +00:00
Martijn Coenen
c7bed872c0 Merge "SM: Change volume mountUserId for new user" into main 2023-07-17 08:05:33 +00:00
Arnab Sen
f96d81f5cd SM: Change volume mountUserId for new user
When a volume is ejected from a user but not removed from the device
and mounted again by calling StorageManager#mount, the volume is
mounted for the user from which it was last ejected. This causes the
path of the mounted volume to be inaccessible to the current user.

Whenever StorageManager#mount is called, check if the
VolumeInfo#mountUserId is same as the current userId maintained by
StorageManagerService, if it is not, change the mountUserId for the
Volume to the current userId known to StorageManagerService if it
is not the primary volume and the volume is visible.
This change also fixes a bug where the volumes are unmounted for the
wrong user which causes StorageSessionController go out of sync
which would cause errors during mounting the volumes again as it
maintains sessions per user. The bug also caused volume event
broadcasts to be sent to wrong user handles. To solve the issue
add an extra paramter in IVoldListener#onVolumeStateChanged for userId
which will update the copy which is used for informing
StorageSessionController and also for sending broadcasts.

Test: Perform the following steps:
1. Format SD Card as portable storage in system user.
2. Eject the SD Card from Storage Settings.
3. Switch to a non-system user
4. Mount the SD Card again.
5. Check that the Storage Summary is shown correctly instead
   of 0B out of 0B.
Also, checked from the logs the volume state broadcasts are sent to
the correct user handles.

Change-Id: I60b8954cdaee4a54ea6a6299fe5ddda2006faf1c
2023-07-14 09:55:37 +00:00
Wen-Chih Lo
5b9fd68dfa Handle errors corrected exit status returned by fsck
Properly handle the exit status 1, which shows filesystem errors
corrected, returned by fsck.

Test: manually hot-plugs SD card and check logcat logs
Change-Id: Iacaa8b1d1a7b59931014c1ab6a4708ffc3cd0c06
2023-07-07 11:32:01 +08:00
Treehugger Robot
31f87b72f1 Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d am: 66ac89b173 am: 8da4142839 am: a4b20ffedb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: Ied130273ddd2204d5718a5165a8e4b2f8bca17c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-24 01:17:39 +00:00
Treehugger Robot
a4b20ffedb Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d am: 66ac89b173 am: 8da4142839
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: I992421fa9fa3b99b3dd653248d6ea75b9f150443
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-24 00:05:50 +00:00
Treehugger Robot
8da4142839 Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d am: 66ac89b173
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: Iad699d0f41e221d53545d7a203bda87d54295635
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 23:17:16 +00:00
Treehugger Robot
66ac89b173 Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: I35fa71d4edee636cf0320e900a043fd5f2331b0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 22:30:03 +00:00
Treehugger Robot
79fecb2f8d Merge "Remove dead code from fs_mgr" am: 50d89e6351
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: Ia0904ec0d1b26cbaf65c8b43c29eecdbbcd07915
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 21:45:27 +00:00
Treehugger Robot
50d89e6351 Merge "Remove dead code from fs_mgr" 2023-06-23 20:07:09 +00:00