Commit Graph

292 Commits

Author SHA1 Message Date
Konsta 0fccc9644d Merge remote-tracking branch 'TeamWin/android-11' into android-11
Change-Id: Ia871166a4ba2c4bd1c33031b74453566cc54ad40

Conflicts:
	Android.mk
	partition.cpp
2022-11-01 11:16:03 +02:00
me-cafebabe 5a0a3aeed5 partition: Mount partition as RO when updating size
So that read-only partitions can also get mounted.
For example, Super volumes are RO when setting up.

Change-Id: I736a738963ba208cfdeaadc05c47d45b1bb7bf3e
(cherry picked from commit b52a4815d5c3a5be1fe56968f4480c788d2eaab2)
2022-09-10 19:15:46 +00:00
Darth9 8c5088d5fc backup: support exclusion of user-defined directories from backups
Example: TW_BACKUP_EXCLUSIONS := /data/fonts,/data/blah,/data/geewhiz

Change-Id: I99e690eb0879281b1149e60ff430b6b3e7dd93c2
(cherry picked from commit cc683e7a3deefb96ece49b07bf88648087a7ccaf)
2022-08-23 18:22:49 +00:00
me-cafebabe 1e9626e798 partition: Don't force system partitions to read-only
Let's follow fstab flags.

Change-Id: I9c8d8c9a998df242256e820065716558dc56b908
(cherry picked from commit c49e34af4721f637edb850acbe1e94fc1ac9edd5)
2022-08-03 23:10:38 +00:00
me-cafebabe a021ac28c7 partition: Set default values for system_ext partition
Change-Id: Iae69e2887926fc808f6e4b1110a7f562b99119f2
(cherry picked from commit 701e9abe26353f143287897942e367f8245c6f54)
2022-08-02 23:25:00 +00:00
sekaiacg f4af5f1a3f backup_exclusions: exclude /data/extm folder from backup
exclude this dir to prevent "error 255" on MIUI

Change-Id: I7e31006617775d575cc1f37a0234369a345c372d
(cherry picked from commit 05ca8766bff3e0cb22e1d69be56fa8d9f1d9ef19)
2022-07-19 15:00:37 +00:00
Captain Throwback d5e2c5247e sload_f2fs: update code for correct binary name
Change-Id: I7c14ec0b76d82d2b0951fd57fbc7184acc09d25a
(cherry picked from commit 8833868a48b054c708650c136c9b27b48c901ce0)
2022-05-21 16:39:16 +00:00
Konsta d81f25b39d don't mount boot readonly
Change-Id: I7be2ea767d5536adbe6c456089655a767cef547f
2022-04-29 08:09:26 +03:00
Konsta 3dfefcf5e8 Merge remote-tracking branch 'TeamWin/android-11' into android-11
Change-Id: Icdfe57679807de4dc8b8e3480946669d1e153b75
2022-03-16 17:50:56 +02:00
bigbiff 2c53845cbe sdcard: remove mount check
Change-Id: I278d7f71e79a82a34f95dba197555d08960f2723
2022-02-20 17:42:27 +00:00
Konsta 9f3de1e955 Merge remote-tracking branch 'TeamWin/android-11' into android-11
Change-Id: I421c59cdcc81ccf591fd52966d1f10cf5d876a0f

Conflicts:
	Android.mk
2022-02-19 12:01:46 +02:00
Konsta 843ff8ec96 Revert "Revert "/sdcard: do not bind mount twice""
This reverts commit bfdf3719cc.
2022-02-19 12:01:31 +02:00
Konsta a500eaef7f Revert "sdcard: only bind mount sdcard after successful preparation of data"
This reverts commit 60bb9f6369.
2022-02-19 12:01:05 +02:00
bigbiff bee26852ce datamedia: setup datamedia with key_directory set
Change-Id: I92cc83caf7e4ff3b43a69d214d176acb230abdef
2022-02-09 20:49:54 -05:00
Captain Throwback e848afcea6 fstab: add quota to handled flags
Change-Id: Iffce38ff43b1337803a5fcf067483f61533ee423
2022-02-08 23:05:46 +00:00
Captain Throwback 32bcdcd32e fstab: add support for metadata_encryption flag
Change-Id: Ic1f12f280e9e99cfe3587e35b88a1f2e9d97a1b2
2022-02-08 12:45:01 -05:00
bigbiff cda1588bc5 sdcard: only bind mount sdcard after successful preparation of data
Change-Id: I589f48a019f90a60ad48f93c5f5555aae4b8a5c9
2022-02-08 00:52:07 +00:00
nijel8 80c92d9be2 nandroid: exclude apexdata com.android.art folder from backup
- throws tar 255 error on AOSP Android 12

Change-Id: I2bad9c83c294d7b533c637b678764fdf25bc2cf0
2022-01-15 20:38:34 +00:00
bigbiff 60bb9f6369 sdcard: only bind mount sdcard after successful preparation of data
Change-Id: I589f48a019f90a60ad48f93c5f5555aae4b8a5c9
2022-01-13 13:16:07 +02:00
Konsta bfdf3719cc Revert "/sdcard: do not bind mount twice"
This reverts commit 36cb2ad28e.
2022-01-13 13:11:51 +02:00
Konsta 438a85efcf Merge remote-tracking branch 'TeamWin/android-11' into android-11
Change-Id: Id1d534cce0969c98e2b8b6484278342201dd562d
2022-01-12 16:55:24 +02:00
Captain Throwback e331b8a1b7 tw_crypto_pwtype: move default setting to data.cpp
Change-Id: Id3dda3bc2c32ad286b1ec67595f482f84b5077d7
2022-01-10 21:21:16 +00:00
bigbiff 36cb2ad28e /sdcard: do not bind mount twice
Change-Id: I1757eb8732a01a728392c3499ac3300c81522806
2021-12-09 19:26:06 -05:00
Konsta 894efea684 never keep system and vendor partitions readonly
Change-Id: I72b1740d406b16d066cfb86426529c8f9a4a9912
2021-11-23 14:32:23 +02:00
GarfieldHan d0b854b31d Add EROFS to file system check list
This commit will add EROFS Filesystem mount support

Since Huawei announced the new file system EROFS and successfully
merged into mainline. More and more OEMs switch the ext4 filesystem
to EROFS filesystem for system/vendor/odm/product partitions like
Oplus (OPPO / Realme / OnePlus).

Test: Import the latest fstab from system, build and boot. EROFS-based
partions like system and vendor partitions were sucessfully mounted.

Notes: Although I tried to change 'ext4' to 'erofs' for correct partition
in twrp.flags, but it was still recognized as 'ext4'. So you can just copy
the line related erofs partitions from recovery.fstab and TWRP will failed
to recognize the line in twrp.flags, and then skip this line, so the issue
was solved.

Signed-off-by: GarfieldHan <2652609017@qq.com>
Change-Id: I49a04e4465f1d92eb589ad6d86b6db9b58d720eb
2021-11-21 23:54:28 +08:00
nkk71 3c1e35f51c Adopted Storage: Add support for mixed mode sdcards
* Adds support for mixed adopted storage + removable
  storage partitioned sdcards.

* Also symlinks Adopted Storage datamedia folder to an
  available /sdcardN (N being 2 through 9) folder.

* Requires a suitable entry in fstab, for example:

    # Removable Storage
    /sd_ext ext4 /dev/block/mmcblk1p2 /dev/block/mmcblk1
        flags=storage;wipeingui;removable;encryptable=footer
    /external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
        flags=storage;wipeingui;removable;encryptable=footer

  /sd_ext will be the mountpoint for adopted storage, and /sdcardN
  will become symlinked to /sd_ext/data/media[/0]

* Fix adopted storage nickname being ""

* Output adopted partition info after successful decrypt

* Mimic single lun code for multi lun devices:
  "Mount CurrentStoragePath if it's not /data"

Change-Id: I3874c09f1a1c3a81f04277e17f17cc03ecb4184a
2021-11-18 19:47:13 +00:00
micky387 2ec1df43d3 recovery: Don't exclude the whole data system dir for the factory reset
Factory reset not clean correctly the settings of system.

Change-Id: I3ff616093e4f2f480f11f97ccfb4072756400777
2021-11-09 00:24:06 +00:00
Captain Throwback 37c3aef4e8 crypto: only set crypto state and type if not already set
Move setting crypto state and type to functions and call those
functions rather than arbitrarily setting those props in every
case. This cleans up all the log spam from trying to set
read-only props, since they will now only get set if
they aren't already.

Change-Id: I392bee060d71c6ee50d0d92bf1b118d9049be41a
2021-10-06 22:27:49 +00:00
Captain Throwback 8a8e56cd60 crypto: only show FBE error if device is encrypted
Change-Id: I60da4ff71a15e5bc4e13135abf268bff1c88b8d1
2021-10-06 22:02:32 +00:00
Captain Throwback 63573b550f mtp: don't create storage device after format data
Since we don't re-create data/media on FBE devices,
don't create an MTP storage device for it.

This fixes the bug when, after formatting data on
and FBE device, an empty Internal Storage appears
on the PC.

This also prevents an empty storage device from
being created if recovery is rebooted after formatting
data before booting to Android. A warning will appear
in the console that MTP is disabled in that case.

Currently the path is hardcoded to data/media; this
should probably be adjusted for cases where adoptable
storage is being used.

Change-Id: Iaafc5e3cde54c3ef6ffaf33f76d14c626b6e590d
2021-10-05 22:53:07 +00:00
bigbiff d21252f1b5 merges: allow user to perform snapshot merges in advanced menu
Change-Id: I894a0ef5a0ec8e208053358f09a6b8a6d4ee408a
2021-10-05 22:32:19 +00:00
bigbiff 437d86f6a0 wrappedkey: don't use twrp for processing anymore
Now in android-11 we can now process legacy and newer wrappedkey
support in our libfscrypt library. TWRP doesn't need to set a
property to check for wrapped key. libfscrypt will just process
wrappedkey fs_mgr flag for legacy wrapped key or wrappedkey_v0
for the newer wrapped key supported in android-11.

Change-Id: Ia94c7ebe34a05c9b25bbb7a5b2e899902c93d203
2021-09-28 00:53:32 +00:00
systemad db475c9015 f2fs format: Remade f2fs command
Main reason for this change was to add proper support for casefolding and project id quota
so I adapted how the command was built, similar how the AOSP recovery crafts it.

Your device tree also need to include this
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)

references:
https://android.googlesource.com/platform/bootable/recovery/+/refs/tags/android-11.0.0_r29/recovery_utils/roots.cpp#246
https://source.android.com/devices/storage/sdcardfs-deprecate

Change-Id: Id45b8ed33fe4f2317f0559ef77423f70d892b91c
2021-09-27 20:20:07 +00:00
bigbiff aed1bdfe59 get_args: process /data/cache/command
Change-Id: I744cdc5a72f53fd1224de242e30ff261e6104900
2021-09-25 20:52:58 +00:00
bigbiff 998f839e82 super processing: use logical flag to denote super status
To support all partitions that are on the super partition
we now parse for the logical flag in fstab to denote super
status.

- Remove guards for the first character being '/'.
- Skip commented lines in fstab
- Build Backup_Display_Name from partitions in super.
The first four lines that are in fstab will be
displayed.
Change-Id: I3f8980187bd4a136257dd6eeaeddd7ea71706cd3

Change-Id: I1ee7c02f91aafb646beaf401a43bcb22fa8c8c7a
2021-08-28 17:48:23 +00:00
bigbiff cfa875c4d4 vab support: merges and unmapping super devices
- check for merges before formatting data
- add advanced option for unmapping super devices

Change-Id: I38d4d3bbdfa071969016c3e000c86a4d03c71e45
2021-08-09 23:04:33 +00:00
bigbiff a15d02f885 vab: exclude gsi
Change-Id: I00d4b4f19aafcaf87ad951ba4f1cb7e3fe84ced8
2021-07-26 19:20:57 -04:00
bigbiff 2d54867daa fbe formatting: add warning for fbe devices and remove unused string
Change-Id: Id7af18a4c39932d8685e3265bfa158494ffd10f0
2021-07-17 00:14:21 +00:00
bigbiff be4f46cbc3 sdcard: bind mount in post decrypt
also uncomment wiping code that should not be commented

Change-Id: I445f688628dcedb67544c22c7b0775ee62e0b267
2021-05-18 20:35:51 -04:00
bigbiff a957f078be FsCrypt update: support fscrypt policies v1 and v2
This patchset introduces support decryption for Android 11.

In this update we deprecate ext4crypt. To specify the
policy version to use, use TW_USE_FSCRYPT_POLICY := 1 or
TW_USE_FSCRYPT_POLICY := 2. By default policy version will
be set to 2 if this variable is omitted.

Change-Id: I62a29c1bef36c259ec4b11259f71be613d20a112
2021-05-18 20:35:51 -04:00
bigbiff 4a60bee82e android root: restore context for android system root
In this patchset we will store and reset the android system
root context after a wipe and restore to prevent issues
with no context labels in the file_contexts being applied.
This will prevent no boot issues in android with selinux
denials on the system root partition.

Change-Id: I87fd3a6060fbaa3e7bdfd7a4b1d09feeb4fa3f27
(cherry picked from commit 35d2bfda3c89ebd212a9bd2328bffd7464f95d47)
2021-02-15 12:29:48 -05:00
Peter Cai d68e6413e5 partition: add support dm_use_original_path
* On some mediatek devices we must use symlinked path instead of the
      real block device.  Needed for decryption on some MTK HW FDE devices.

Change-Id: Ib48d745fd442c590aea2baf6d2dbe20aaaef9eec
2021-02-15 12:29:27 -05:00
Peter Cai 439d60cb9d partitionmanager: support delayed adopted storage mount
* On some devices, the external mmc driver will only load the card after
  a certain delay. The original code will break and fail to mount any
  adopted storage in this case.

* Add a special fstab flag to allow the partitionmanager to retry after
  a delay.

Change-Id: I219978850ff3ba7ad9dc7ca96fc30634c9574164
2021-02-15 12:29:19 -05:00
Captain Throwback acc7f0f873 wrappedkey: only run check on FBE devices
Change-Id: I3713fc4619279d8ee2de924df2bc4fbde944d834
2021-02-15 12:27:03 -05:00
Captain Throwback b5af4f80d0 fbe: move key directory logging within key directory check
Change-Id: I9d1a50ab0fb8b9bbb2e0686c6ffe28b4b22634b4
2021-02-15 12:26:54 -05:00
Captain Throwback dbc37b7a4c wrappedkey: set prop for metadata partition if flag is present
Change-Id: I0da59e81993a119d198dbfc350b7fca0e1cb3c5c
2021-02-15 12:26:46 -05:00
nebrassy 57f210d409 also set crypto state for non-metadata FBE
Change-Id: I586878cc6134d798b1d087415cb694d6738f279a
2021-02-15 12:25:47 -05:00
nebrassy f74255ea1e set crypto state/type when detected
Change-Id: I4506d3ef11052dbebf974b5c387a3c7d5055f2ea
2020-11-11 01:59:11 +00:00
Noah Jacobson 81d638d235 Add support for multi-user decryption
* Add CLI support using the command "twrp decrypt <PASSWORD> [USER ID]"
* Add GUI support using the menu Advanced --> Decrypt User

multiuser: Parse users only when Decrypt_DE runs successfully

multiuser: Warn when not all users are decrypted

Change-Id: Ia5e943b13c2d5ec5c34ae97661133c19ff471e6d
2020-10-23 00:52:04 +00:00
Captain Throwback 47bf7204f8 partition: support tntfs module
Change-Id: I0532b10f6748d00c80454a051ef63cc74a77780c
2020-10-22 22:26:02 +00:00