Commit Graph

10985 Commits

Author SHA1 Message Date
sekaiacg
cf77cb357c keymaster restore: Do not enter the keymaster_restore page repeatedly
Change-Id: I0c7ca541d52d923067537adb561ca5a61bde7f08
2022-01-10 20:34:02 +00:00
Captain Throwback
086358633e System_Property_Get: Set default path for build.prop
Change-Id: I5f4fa7150c025033eca29bf4fe3fe3f908f18e5e
2022-01-05 18:58:19 -05:00
theincognito-inc
546ebc391d Change TWRP nano TERM env variable from pcansi to bg1.25
pcansi TERM has always had some display and/or scrolling (up, down, left or right) issues in nano on TWRP's embedded Terminal.
Most frequently seen is misaligned/displaced text on long lines and files, either initially or once scrolled through.
bg1.25 seems to be the most compatible TERM for all devices currently.

Change-Id: If00a8352ca3576085f69c12dffb5b21637c7b21c
2022-01-04 20:32:23 +00:00
Captain Throwback
a185252c8e System_Property_Get: Allow specifying multiple prop file paths
Some OEMs include prop files in custom locations. Add these to
a list and parse when setting properties.

Use the flag TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS followed
by a semi-colon-separated list of paths (relative to /system)
where the additional prop files can be found.

The standard build.prop file does not need to be specified and
will always be parsed.

Example:
TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS := etc/buildinfo/oem_build.prop;etc/prop.default

Change-Id: Ie0e25c7d2575d928310ff1b4fc1aef44a83784ca
2022-01-02 16:02:04 -05:00
bigbiff
922b121f31 libresetprop: use the latest header
Change-Id: I24656393cc84b1a978338fa587c535797d81c2a9
2022-01-01 18:36:43 +00:00
bigbiff
a84acc7fa5 fscrypt v1: support legacy ioctl
Crosshatch uses a legacy ioctl for setting and getting fscrypt
policies. If the device is legacy, we will use the legacy ioctl.

Change-Id: I5c2e068f166b89fe9f7839a6d6a9533e49fc5b07
2021-12-31 15:44:50 +00:00
Captain Throwback
740d852518 vold_decrypt: only include patch_level functions with libresetprop
The functions use the Property_Override function from libresetprop,
so don't include if libresetprop isn't included in build

Change-Id: I5eb210f17fea908ec35cb223e4a55066419f55dc
2021-12-29 16:00:54 +00:00
nebrassy
7007c999f9 correct condition for change TWRP folder
Change-Id: I3549d3be3bf2d4557055b9ca48a84f88db44eca7
2021-12-26 20:53:06 +00:00
Adithya R
a42c10d156 sepolicy: twrp: Mark ueventd as permissive
* required to load fw from non-hlos

Change-Id: I4ee82c7cd405d91d3a4e70c75591631c236bd94d
2021-12-26 17:04:00 +00:00
dianlujitao
b20dfaa26d partitionmanager: Use boot HIDL to switch active slots
Change-Id: I7009380d7736f71e63d5558b6a447961cc1075c7
2021-12-26 17:02:41 +00:00
Captain Throwback
4076a67cd3 postrecoveryboot: rename script to reflect recovery mode
Change-Id: Ifb9d64a2bec118592523682749093bf894ec2cbe
2021-12-21 22:07:29 +00:00
Magendanz
37920d9d6e Replacing format string with one appropriate for 32-bit or 64-bit size.
Change-Id: I280f38ce000a5231795953b251ba2123545903ae
2021-12-12 15:01:25 -08:00
sekaiacg
a202b5aa32 recovery: Fix the crash caused by StartIteration
In the new version of libziparchive, the default values ​​of the optional_prefix and optional_suffix parameters of the StartIteration function are changed to empty strings, and nullptr is no longer detected.

Change-Id: I66ee58a9515586700b10a3d5aa5b780a6207b33c
2021-12-12 17:34:03 +00:00
luoqiangwei1
cd1f4cac6f Fix the fuse error that cannot handle the OTA package larger than 4 GiB
1. That read data will be blocked when adb sideload OTA package
2. An error(Out of bound read) occurs when installing OTA package by fuse

Test: as follows
    - adb sideload OTA package
    - install OTA package by install_with_fuse parameter

Change-Id: Ie53510d157f6ea4c92606b289fcb745d441918c8
Signed-off-by: luoqiangwei1 <luoqiangwei1@xiaomi.com>
Signed-off-by: GarfieldHan <2652609017@qq.com>
2021-12-10 23:27:53 +00:00
GarfieldHan
b3f6a26422 twrpinstall: Switch to ZipEntry64
The libziparchive TWRP using was outdated, not supported a zip
size more than 4 GiB. With the development of technologies,
Obviously it was not enough for ROM packages, like Xiaomi's
MIUI for Vitrual A/B devices (for example Redmi K40 [alioth])
is more than 4 GiB and TWRP couldn't handle it properly.
Since we have updated libziparchive to latest version, we could
switch ZipEntry to ZipEntry64 so that TWRP can support a ROM
package if its size more than 4 GiB.

Co-authored-by: sekaiacg <sekaiacg@gmail.com>
Signed-off-by: GarfieldHan <2652609017@qq.com>
Change-Id: Iee811554bb08e02bf2bd8e9057511f36caefdc9d
2021-12-10 23:19:17 +00:00
bigbiff
36cb2ad28e /sdcard: do not bind mount twice
Change-Id: I1757eb8732a01a728392c3499ac3300c81522806
2021-12-09 19:26:06 -05:00
Gao Xiang
70b83292d6 libblkid: add erofs filesystem support
Enhanced Read-Only File System (EROFS) has been included in Linux
kernel, many Linux distributions, buildroot and Android AOSP for
a while. Plus, nowadays, it's known that EROFS has been commercially
used by several Android vendors for their system partitions.

This patch adds support for detecting EROFS filesystem to libblkid.

Since util-linux/util-linux@cd129b7 introduced blkid_probe_set_block_size
function to report filesystem block size, TWRP is using blkid 2.25.0, which
means blkid_probe_set_block_size wasn't supported and required, so remove
the blkszbits judgement and blkid_probe_set_block_size for fixing building.

Test: Add erofs mount point to twrp.flags, build and boot
OP4A7A:/ # logcat | grep erofs
I (6)[571:recovery]erofs: (device dm-0): mounted with opts: , root inode @ nid 58.
I (6)[571:recovery]erofs: (device dm-9): mounted with opts: , root inode @ nid 43.
I (6)[571:recovery]erofs: (device dm-1): mounted with opts: , root inode @ nid 52.
I (6)[571:recovery]erofs: (device dm-10): mounted with opts: , root inode @ nid 45.
I (6)[571:recovery]erofs: (device dm-8): mounted with opts: , root inode @ nid 42.
I (0)[571:recovery]erofs: (device dm-12): mounted with opts: , root inode @ nid 38.
I (3)[571:recovery]erofs: (device dm-0): mounted with opts: , root inode @ nid 58.
I (3)[571:recovery]erofs: (device dm-1): mounted with opts: , root inode @ nid 52.
I (3)[571:recovery]erofs: (device dm-0): mounted with opts: , root inode @ nid 58.
I (3)[571:recovery]erofs: (device dm-0): mounted with opts: , root inode @ nid 58.
I (3)[571:recovery]erofs: (device dm-9): mounted with opts: , root inode @ nid 43.
I (2)[571:recovery]erofs: (device dm-1): mounted with opts: , root inode @ nid 52.
I (2)[571:recovery]erofs: (device dm-10): mounted with opts: , root inode @ nid 45.
I (2)[571:recovery]erofs: (device dm-8): mounted with opts: , root inode @ nid 42.
I (2)[571:recovery]erofs: (device dm-12): mounted with opts: , root inode @ nid 38.
I (6)[571:recovery]erofs: (device dm-0): mounted with opts: , root inode @ nid 58.
I (6)[571:recovery]erofs: (device dm-0): mounted with opts: , root inode @ nid 58.

OP4A7A:/ # cat /tmp/recovery.log | grep erofs
   Current_File_System: erofs
   Fstab_File_System: erofs
   Current_File_System: erofs
   Fstab_File_System: erofs
   Fstab_File_System: erofs
   Current_File_System: erofs
   Fstab_File_System: erofs
   Current_File_System: erofs
   Fstab_File_System: erofs
   Current_File_System: erofs
   Fstab_File_System: erofs
   Current_File_System: erofs
   Fstab_File_System: erofs

Now TWRP can recognize the EROFS filesystem perfectly after setting fs in twrp.flags

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
[@pomelohan: Adapt for TWRP's libblkid version and add erofs.c to build]
Co-authored-by: GarfieldHan <2652609017@qq.com>
Signed-off-by: GarfieldHan <2652609017@qq.com>
Change-Id: I00263757b5b6ed881165e65795ef849d86763165
2021-12-09 00:18:38 +00:00
sekaiacg
cdc0319717 twrpinstall: Remove unnecessary CloseArchive() calls
The destructor MemoryPackage::~MemoryPackage() will automatically call CloseArchive(), so there is no need to repeat the operation to prevent Recovery from crashing.

Change-Id: Ife5d5818bc603f8709e998b856a1e97bc365fc87
2021-12-04 20:05:53 +08:00
kirillsvk
82fba90680 Russian language: fix spaces
Change-Id: I2e8a52421c4120cbdbc08de78a402c81fc3d73fd
(cherry picked from commit 8d6dbd86c9bc0396b6300dd19d1a7f4d96761bfb)
2021-12-03 23:05:04 +00: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
nebrassy
0fc1ee2c1a twrpRepacker: override slot back after flashing
and move updating partition details to the function

Change-Id: I6f27ab1191246b6a23e625b0e3459db9024691c7
2021-11-21 03:33:59 +01:00
bigbiff
ac43dd1179 unmapping super devices: do not remove ramdisk mountpoints
Change-Id: Iabd543e914887af78813805141604ae0ca1c812d
2021-11-21 01:43:09 +00:00
Captain Throwback
a866b44f45 lpdump: only build for dynamic partition devices
Change-Id: Ia4a90681a6342cb5e4269ca3475376507b5d5260
2021-11-19 23:46:27 +00:00
Captain Throwback
4f19caa016 lptools: add to build
Use TW_EXCLUDE_LPTOOLS to exclude from build

Will only be included on devices with dynamic partitions

Change-Id: I77092344a1e31e749161cb31e6e020f6e9fc3800
2021-11-19 23:46:05 +00: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
nebrassy
9a68408725 repacker: update partition details after switching slot
Change-Id: I9f6f396530ad40f70c02c917b01e9b8158add773
2021-11-18 18:40:57 +01:00
LinkBoi00
7ebe82a950 gui: theme: Switch to larger buttons in the reboot menu
Since the TWRP app button is gone from the reboot menu,
it would make sense to switch back to the larger buttons
for the slots and move down the active slot information
to fit the screen better

Change-Id: Iabf891da8799b063bb4902d583b67f0594b4fc19
2021-11-16 23:38:32 +00:00
bigbiff
5bcc1408c6 Merge "gui: theme: Remove the TWRP app button from the reboot menu" into android-11 2021-11-16 23:27:43 +00:00
LinkBoi00
f5547386da action: Only unmount /vendor if it actually exists
* Since commit 168bc4caaedfdf655a71ba24a1c5a7f2b905a122 the vendor partition gets unmounted prior to switching the slots. However, devices without a vendor partition (e.g. tissot's stock partition table) will have errors since the partition doesn't actually exist
* Therefore, it should be only mounted if that partition exists in the partition table

Change-Id: Id16ab55e25d05964ca0de1bf218914d66c2b0205
2021-11-16 16:37:42 +00:00
LinkBoi00
79f434efc4 gui: theme: Remove the TWRP app button from the reboot menu
* The TWRP app button results in a big delay to open the reboot page

Change-Id: I7390d5bff2142214dfb3e2aad821859ac03e8c2f
2021-11-16 10:39:11 +02:00
bigbiff
989dee2ac8 twrp release: 3.6.0 for a11
Change-Id: I416e8b29d3230d9a16014b4fa5b4b48bbad7e1b8
2021-11-13 17:33:19 -05:00
Ctapchuk
803f860a60 Update Russian language, sync with en.xml
Change-Id: Iefa42509dfecdb282563c305086c18342520f939
2021-11-13 13:07:45 +07:00
Ctapchuk
452489e66e Add support for installation realme/OPPO OTA
Support for '--special_update_package' command from boot message

For example realmeUI 2.0 using this command for boot message to install OTA packages
--special_update_package=/data/ota_package/OTA/.otaPackage/system_vendor_19720.1.3.202108120000042554318_patch

Change-Id: I7d1a49a3e05a439d4c96717c1700dd063f4e55c4
2021-11-12 21:34:05 +07:00
zhenyolka
9085047555 Handle XML files format properly
In A12 format of XML files changed to Android Binary XML
TWRP uses RapidXML to parse XMLs, but it don't support ABX format
So before parse check format of XML format and if it is in ABX, just ignore it for now

Change-Id: Ie40f5b3534db50143999984be22ade1d1af162e7
2021-11-11 19:51:34 +00:00
zhenyolka
e46d69670f Add support of A12 keymaster_key_blob files structure
In A12 keymaster_key_blob format changed
Compared to A11 it contains another new 8 bytes at beginning "pKMblob\0" (in hex 0x704B4D626C6F6200)
We can just ignore them

Change-Id: I8a1701a248be536fdd000b9011122ef954c8e4d1
2021-11-11 19:49:16 +00:00
bigbiff
8f5fad3741 keymaster restore: warn when pin, password or pattern is enabled
Starting in Android 10, zygote relies on stored inodes in order
to find packages in the user's CE directories. Since TWRP cannot
force inode creation on restore, we warn the user to remove their
pin before restoring their backup. Otherwise zygote may not load
properly in Android. This will force the system to update the
inode cache.

The user can then re-add their security settings to android.

Change-Id: I8f07962d07304dee54c08318efc500dca424b6c0
2021-11-10 23:21:46 +00:00
bigbiff
dd16123707 rotation: fix switch statement for rotation
Change-Id: I29e594791b3a149f08df95fe37309a1ed82784ad
2021-11-10 23:20:24 +00:00
nebrassy
5ca08db4e6 sepolicy: make postinstall permissive
Change-Id: I005669b31598a8917a1e70dc3284bdb857763955
2021-11-10 13:34:18 +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
Ctapchuk
aefc2ab3db module load: don't processed /vendor in fastbootd if not required
Change-Id: Ia81af8187c135df93b7aa0ad83de2a79b63a384b
2021-11-09 00:23:40 +00:00
Aseem Athale
dd81b9a8d7 theme: Capitalize EDL
TWRP used 'Edl', but everywhere else, it is 'EDL'.

Change-Id: I4f63185ffb96797da0d695b34857ee242cfa33e8
2021-11-08 13:21:50 +05:30
Captain Throwback
fec0c3bf53 keyboard: add num template for PIN input
Credit for the xml updates:
fordownloads (vnukov.d03@gmail.com)
MrYacha (yacha@orangefox.tech)

Change-Id: Ie776b7de206dbeda122184052d474ebf5fbd7d68
2021-11-05 17:03:16 -04:00
Captain Throwback
f386d472d8 crypto: differentiate type for PIN
Change-Id: Ic3c384fcc5dc3c71b868a1b45040e74d729c63f0
2021-11-05 17:02:48 -04:00
bigbiff
aa8d517d9b Revert "checkpoint: check checkpoint instead of assuming"
This reverts commit c0228607f3.

Reason for revert: It seems necessary to force checkpoint.

Change-Id: I6889027538c0656b3689e008b03c1812317b22e6
2021-11-05 18:58:37 +00:00
bigbiff
c0228607f3 checkpoint: check checkpoint instead of assuming
Change-Id: I51ea28759b85db5192117420685774147550947b
2021-11-01 22:22:21 +00:00
Captain Throwback
3d0a644462 sepolicy: update for exfat-fuse
Change-Id: I5226d22c8b23faffeb70f56483c45d1a4ec72039
2021-10-27 12:40:17 -04:00
bigbiff
b5a20a8d00 apex: cleanup apex directory bind mount names
Change-Id: Ia120ed12f3ae551044907dfd1fd05444be78d18c
2021-10-23 14:27:55 -04:00
bigbiff
b9655640f7 postinstall: allow twrp to run postinstall scripts
Change-Id: I9b2ff1b94611bf08e53a5cc452872eb3942dd160
2021-10-23 13:33:51 -04:00
bigbiff
83298f5375 custom theme: fix libziparchive loading of custom themes
Change-Id: Ia23a9dcd24fcbb61cb5e1df366a4325d20d777b2
2021-10-22 21:19:28 +00:00
bigbiff
850fa28798 kernel loader: don't try to reload modules already loaded by init
Change-Id: I58fb2ee369bdb9f5c5f9e6c8ea3f15781ae60ece
2021-10-20 01:26:14 +00:00