Commit Graph

9586 Commits

Author SHA1 Message Date
mauronofrio
babc15ef61 Set toolbox as default for android 9+ TWRPs
I created also a new flag for who wants to use busybox
on android 9+ trees.

To use busybox set the flag like this:

TW_FORCE_USE_BUSYBOX := true

Change-Id: If2231e71c008b36e9ae09857539b82d77e2a9a06
(cherry picked from commit 8ff93eb2234f31298d4f3cfe903887c3f6ecc583)
2020-05-19 14:52:04 +00:00
Chaosmaster
d5364a0b21 Rework progressbar logic, implement scoped/split progressbar
Rework progressbar according to AOSP, this should fix various
issues with progressbar.

From AOSP:

   progress <frac> <secs>
       fill up the next <frac> part of of the progress bar over <secs> seconds. If <secs> is
       zero, use `set_progress` commands to manually control the progress of this segment of the
       bar.

   set_progress <frac>
       <frac> should be between 0.0 and 1.0; sets the progress bar within the segment defined by
       the most recent progress command.

Change-Id: I7f92359046288f3529cb2e98e6d54d410a248f1d
(cherry picked from commit ab16437de14fd9f1203b7e0ce82ea18eb56cae78)
2020-05-19 14:45:22 +00:00
Chaosmaster
7b66bf503f Replace "Reboot System" with "Reboot" for A/B devices
Users may want to reboot to recovery or bootloader after flashing
A/B zips to switch slots and install additional zips.

Change-Id: I128ceff6d0b361921c7ad7623eab93044e942d18
(cherry picked from commit 90df3de75ef05e014ba363d65a59421a04375e5a)
2020-05-19 14:27:39 +00:00
Chaosmaster
a6da6565a0 Add info that flashing AB zip will flash to the inactive slot
Also inform user, that a reboot is required to switch slots

Change-Id: I7d609ee3d231e5d38d9145962e979e012d9a0ac8
(cherry picked from commit 5343a3ca2afcdd895677c5c3ff16a83af372c7b7)
2020-05-19 10:03:54 -04:00
mauronofrio
c79f86ef94 installcommand: port https://gerrit.twrp.me/c/android_bootable_recovery/+/1680
to install/installcommand.cpp

Change-Id: I96384bbc92b202a8a5561229488052d488ca6bc1
2020-05-18 16:49:11 -04:00
bigbiff
8a45a1883c merge conflict: remove merge conflict message
Change-Id: Ife2ff7082494f9cc933a9f22e596ca0716c2ced6
2020-05-18 15:46:39 -04:00
Fabrice Bellet
72bcc2030c twrptar: fix backup freeze with pigz and openaes
The filedescriptors must be opened with the close-on-exec flag, so
child processes don't keep opened parent fd around, that prevents
the processing pipe to be properly closed.

Change-Id: I285d57d04d13452383f1b81910a8eda02f17a156
(cherry picked from commit 7884eac0fcda4a13373766a4df3dd19f53d18f95)
2020-05-18 19:14:59 +00:00
mauronofrio
d8ee9dde72 Make the twrp verify the pre-device among several props
This is really usefull for that devices that have multiple names, for 
example for zenfone 6 that is called WW_I01WD and also ASUS_I01WD, with 
this commit all roms also with a different pre-device will be successfully
flashed. I decided to use ro.product.model and ro.product.name because
these pros are also used in some roms updater-script to check the device
model before start the rom flashing.

Change-Id: I3b4cd3a13e3fff5c5a6c35bf1a0ed146d2b4c3ec
(cherry picked from commit 1913bf32042c380af3c33c5157341db5963ba281)
2020-05-15 23:11:53 +00:00
mauronofrio
fc79aa6375 Encryption: don't try wrapped key if not needed
This commit is used to directly use the wrapped key
decryption when the "wrappedkey" flag is set in the
fstab.

Change-Id: I74310c3bbec378ee684a8f6d0395a9776dd22abf
(cherry picked from commit 1db943295de9728e364bf0e75bfe9f1a98d413a1)
2020-05-13 00:40:25 +00:00
Peter Cai
28ea7b000a partition: set fbe.data.wrappedkey automatically via flag
In change I79c2855d577156670b45c10c7c7b1fcd9fece8d9 we introduced a
property to enable wrappedkey mode. This change supports an extra
`wrappedkey` flag in fstab to automatically set the property to true.

Change-Id: I4f060d4ed6b2a5680649b8746dfa7fd903fe2d35
(cherry picked from commit 40ed06e850de2dc7cc06c2e647688212563f1ec2)
2020-05-13 00:39:19 +00:00
Chaosmaster
6c1477d974 Mount system and vendor for A/B installs for backuptool to work
Also bind mount a copy of /sbin/sh over /system/bin/sh

Change-Id: I58026af425b07b50a4377ab843192578e0d45587
(cherry picked from commit 7bf8df5086c561cbc9da9b32afa678ebe966f5c1)
2020-05-11 18:16:56 +00:00
bigbiff
a34befa5c8 system mount: unmount system after checking for TWRP app
Change-Id: I9ab74c9839b50e399432d19839191b7de2d1bf60
(cherry picked from commit 07f991a3ed1457d4774078219e828e6d63756777)
2020-05-11 15:23:32 +00:00
Captain Throwback
89a03ccd36 vold_decrypt: automatically set Android version & patch level
- Requires TW_INCLUDE_LIBRESETPROP
  (set automatically if TW_OEM_BUILD is not set)
- Set based on installed system (if present)
- Will set values back to TWRP defaults
  after decryption completes
- Only included/run on Oreo+ systems

Change-Id: I41fcc1af8cd4b15329574f7403f7491320199f48
(cherry picked from commit 3284a66e23fbc6e1a82df668b497ef931d9c0081)
2020-05-11 15:22:14 +00:00
bigbiff
437b93a087 Merge remote-tracking branch 'origin/android-9.0' into android-10.0
Change-Id: Ie850f431f0d2c39c86b9c10701676a24770ab447
2020-05-10 20:06:41 -04:00
dianlujitao
b76a73a1a9 Fix backup and restore after autodetection for SAR
This reverts commit 8a411c8d25.

 * Always use "/system" to interact with the frontend and replace it
   with the detected path before taking actions.
 * Don't replace the pretty display name and backup name set during
   processing fstab after wipe. This improves UX and ensures that the
   system backup is always named system.ext4.win despite the actual
   mount point is /system_root so TWRP is able to recover either SAR or
   non-SAR backups.

Change-Id: Ie2594d2678d0c75ce25c0d1087d47b035b3f10e9
2020-05-10 21:35:01 +00:00
Chaosmaster
65633a46d0 Add optional PartitionManager and Mount_Point to
Get_System_Properties for use during SAR-detect

Change-Id: Ie1ffba53459b7bb77ca47d9cb928b2626c704a05
2020-05-10 21:30:50 +00:00
Mohd Faraz
0d9a62e409 Remove Extra spaces occured while using multiline string variable
* On multiline string variable it adds spaces

Change-Id: I0f9140f3840b0238009af2271ac67b25754f76c9
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2020-05-10 21:24:00 +00:00
Chaosmaster
97c4541415 libresetprop: not available for Android < 7
Change-Id: I5cf384b472e43ee8d380ac08aeed1a8567844d7e
2020-05-10 21:21:47 +00:00
Chaosmaster
01a17998da Add flag for overwriting properties with system values
This adds the flag TW_OVERRIDE_SYSTEM_PROPS which can contain
a ";" separated list of properties that should be overriden.

A different source property can be defined by separating
target and source using "="

Example:

TW_OVERRIDE_SYSTEM_PROPS := "ro.build.product;ro.build.fingerprint=ro.system.build.fingerprint"

This will override ro.build.product with the value of ro.build.product from system/build.prop.
And also override ro.build.fingerprint with the value of ro.system.build.fingerprint.

with their corresponding values from the system partition.

Change-Id: Ibcd3e6ed51fa7f7195ad524e606a2b9542687e55
2020-05-10 21:19:32 +00:00
Chaosmaster
461e39fe89 Add TWFunc::Property_Override(name, value) to override properties
using libresetprop

Change-Id: Ic49e187698c714f8a629d20ceddc40e823555477
2020-05-10 17:17:56 -04:00
bigbiff
aaa9e64b81 Merge "Create a flag to include resetprop in the TWRP" into android-9.0 2020-05-10 20:37:09 +00:00
Chaosmaster
f6e42ce390 Implement autodetection for SAR, based on the installed system
This will detect whether SAR is present in the currently installed
OS and set the property ro.twrp.sar accordingly.
After setting the property it will call the bootscript
/sbin/sarsetup.sh (if present) to give device maintainers the
option to do setup operations depending on SAR-status, such
as modifiyng the fstab.

If no system is detected and AB_OTA_UPDATER is defined or built with
Android 10 and upwards, it will fallback to using SAR, otherwise it
will use ro.build.system_root_image as basis for deciding whether SAR
is required or not.

The property ro.twrp.sar will also be used by
TWPartitionManager::Get_Android_Root_Path()

This allows maintaining a single TWRP-build for devices switching
to SAR for Android 10.

The default behavior (when no system is installed)
is determined by the build-flags AB_OTA_UPDATER and
BOARD_BUILD_SYSTEM_ROOT_IMAGE

Change-Id: I2a48c6c81a6ea6fad6e452c06bfbe4d9da0f1e5c
2020-05-10 15:43:56 -04:00
Chaosmaster
da97480567 Create/Remove system_root/system bind mount, when mounting System
This will automatically create and remove a bind mount
/system -> /system_root/system
everytime "System" is mounted via the GUI or ORS.
This should get rid of issues with ZIPs trying to mount
the system-partition to /system on SAR-devices, while keeping
the filesystem-layout in sync with AOSP from a user-perspective.

Change-Id: I7f531d113b07c31b39d8f87edac76a7fc79075e7
2020-05-10 15:43:55 -04:00
Chaosmaster
ff4f958182 Add option to automatically unmount system before installing ZIP
This adds the option to automatically unmount the system partition
before installing a ZIP-file.
This option is enabled by default, This is usefull on SAR-devices
where system is mounted as system_root and ZIPs (i.e. Magisk)
try to unmount system instead of system_root and fail to install.

Change-Id: Id94ae658964679e23aa7fa137e07edf74ee073df
2020-05-10 15:43:55 -04:00
Chaosmaster
3b3b634365 ORS Make mount/unmount system mount system_root on SAR
Change-Id: Ibf8d4d61e6cbb132786f5f9aa23ec91b49bcab89
2020-05-10 15:43:54 -04:00
Chaosmaster
3b6827372e Set system-partition mount point to proper location
This sets the system mount point to either /system_root or /system
depending on whether SAR is detected or not irregardless of what
is specified in fstab.

This removes the need to edit fstab for SAR-builds and simplifies
building unified (SAR/non-SAR) builds.

Change-Id: I154fd76f842702be9e5d09005463c8e5f1d289a4
2020-05-10 15:43:54 -04:00
dianlujitao
58f1a63767 Properly detect system-as-root
ANDROID_ROOT environment variable is also used by other Android
components thus it should ALWAYS be /system in order not to break other
tools. On the other hand, AOSP does have a system property to indicate
system-as-root, just make use of it.

Change-Id: I7fc58a78db7abd05fac9000910169c370f5de62d
2020-05-10 15:43:53 -04:00
mauronofrio
76ef9f3c04 Create a flag to include resetprop in the TWRP
The flag is:
TW_INCLUDE_RESETPROP := true

Change-Id: I4d4d25a6d5bbd2330efd7f184d0f878a8cf0346e
2020-04-30 16:42:03 +08:00
Mohd Faraz
fdd49bbb41 partitionmanager: Unmount all directories mounted to same block
* Like Xiaomi's some older devices uses cust as vendor and also mounts cust & vendor simultanously

 * This patch will unmount all directories mounted to same block

Change-Id: Ic242e267a470b4d82098d847f74b807a461605c4
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
(cherry picked from commit 77a31917f2)
2020-04-26 18:16:59 +00:00
Mohd Faraz
77a31917f2 partitionmanager: Unmount all directories mounted to same block
* Like Xiaomi's some older devices uses cust as vendor and also mounts cust & vendor simultanously

 * This patch will unmount all directories mounted to same block

Change-Id: Ic242e267a470b4d82098d847f74b807a461605c4
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2020-04-26 18:16:04 +00:00
Andreas Schneider
5a850bd493 Fix building libuuid
libuuid uses flock() which requires <sys/file.h>.

Change-Id: I230a5d08ce90088d14db2f89a0843bf43029b3c7
(cherry picked from commit 915bbd225e)
2020-04-26 15:26:25 +00:00
bigbiff
fec60c3e33 Merge "Fix building libuuid" into android-9.0 2020-04-26 15:26:04 +00:00
bigbiff
973167aff3 ramdisk: move uevent link that build creates
Add missing init.rc files for recovery.
Cleanup init symbolic links.
Comment out removing the source file in relink.sh because we need
to retain files in /system in the ramdisk.
Change-Id: Ie959024296738538f3b3161e38027a44525b0696

Change-Id: I5b1a744414b88a9a15c56bd81f37091664d5cdf1
2020-04-09 16:47:23 -04:00
bigbiff
4721a5a1a3 unzip: relink unzip binary from system/bin
Change-Id: I69a8c86c3c817f0a539be53a52f33b8bb6813fdf
2020-04-05 10:32:40 -04:00
bigbiff
36f088ac7c adbd: relink sh properly
Change-Id: Ifb4eba0cded949db66a9d3b77bb185828425d197
2020-04-04 19:58:19 -04:00
bigbiff
63d7add7cf logd: make logd run and relink logcat
Change-Id: I5a2984ea2649bebd923d42e6b984856b36b18fbd
2020-03-31 18:00:59 -04:00
Andreas Schneider
a4e510ee54 init: ueventd already needs /acct
Change-Id: Ifae7078aedc1a520ee003160fb17c8893041cb09
(cherry picked from commit ec350e9d0d)
2020-03-30 17:06:17 -04:00
Andreas Schneider
ec350e9d0d init: ueventd already needs /acct
Change-Id: Ifae7078aedc1a520ee003160fb17c8893041cb09
2020-03-30 21:02:48 +00:00
mauronofrio
cb163e0b14 Relink update_engine_sideload
Change-Id: Ifb95d94a5804f0d490bc8c2c19cab7b03c8f1432
2020-03-30 16:46:35 +02:00
bigbiff
416fe3a18a toybox: deprecate busybox and toolbox utils
Starting with android-10.0 we should only use tools from toybox.
Toyxbox in android-10.0 is specified as a recovery target, so
we just move the symlinks in our relink target.

Change-Id: Ic0116a7d583519b39422ac4d82d30e00918eb29d
2020-03-28 14:13:43 -04:00
bigbiff bigbiff
ac6cc08941 truetype: convert to STL map for handling fonts
In Android 10, libcutils is deprecating the hash functions. This
patchset moves to use the STL map to handle storing related
truetype objects.

This patchset moves the truetype functions to it's own static
class and moves the declarations to a header file. I also removed
statistics functions that were not called from anywhere.

Change-Id: I1679df4c7e844c01e3a2cbdaf5117bb09df2a5f3
2020-03-24 12:01:16 -04:00
bigbiff
6087339d3a prebuilts: don't try to relink again if source is unavailable 2020-03-23 15:41:27 -04:00
theimpulson
d95dcd207c bootable: Move to optional tags everywhere
FAILED:
bootable/recovery/etc/Android.mk: error: init.recovery.ldconfig.rc: LOCAL_MODULE_TAGS := eng is obsolete. See https://android.googlesource.com/platform/build/+/master/Changes.md#LOCAL_MODULE_TAGS
build/make/core/base_rules.mk:171: error: done.
18:29:38 ckati failed with: exit status 1

Change-Id: I056f019aa3249c185b808140bcef45a4777d21b3
Signed-off-by: theimpulson <aayushgupta219@gmail.com>
2020-03-23 15:09:31 -04:00
bigbiff
bf3b1564f9 aosp10: minor cleanup, other commented makefiles need to be worked on 2020-03-23 13:58:30 -04:00
bigbiff
d58ba18272 AOSP10 TWRP Merge: fix conflicts and update libraries needed
This allows flame to boot TWRP. Still will need to work on
super partition for vendor and system access.

The plan will be to cherry-pick any updates to android-9.0
through gerrit.twrp.me to this branch as a WIP.
2020-03-23 11:18:29 -04:00
bigbiff
26d5d5f0b9 Merge tag 'android-10.0.0_r25' into aosp10-4
Android 10.0.0 release 25
2020-03-23 09:56:16 -04:00
Fatih Fırıncı
901141c2eb language: turkish update
Change-Id: I9dab6ea9378f87879384e43dafb2e3ae4f733f68
2020-03-14 17:21:30 -04:00
Martin Dünkelmann
c630b3864f Fix 'system/etc/ld.config.txt' not found error
According to

https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r51/rootdir/Android.mk#260

the ld.config.txt gets generated with the vndk version as a suffix.
This behaviour exists since API level 28 (Android 9.0), if
BOARD_VNDK_VERSION is defined and BOARD_VNDK_RUNTIME_DISABLE is not
true.

The issue seems to be exist since commit
8d70eb617e in twrp.

Change-Id: I19741c29cda65ce051b7c167a946d551ce149f7b
2020-03-14 21:14:54 +00:00
Mohd Faraz
191a6948d9 crypto: fde: decrypt master key first
* Some devices like lavender, etc. getting failed to decrypt

Change-Id: I63ca05c4f87cdd17d48d4541a5a8121c736beb02
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2020-03-09 23:19:54 +00:00
Andreas Schneider
915bbd225e Fix building libuuid
libuuid uses flock() which requires <sys/file.h>.

Change-Id: I230a5d08ce90088d14db2f89a0843bf43029b3c7
2020-03-08 11:44:54 +01:00