Commit Graph

7587 Commits

Author SHA1 Message Date
Mauronofrio Matarrese 1ecb6df370 Change slot name position
This is need to avoid overlapping between the third row of buttons and 
the current active slot, actually if you enable edl button, the active 
slot will overlap the button.

Change-Id: I6cfc945c2d0be0530dad7b4ce0f0e2ca29c297c4
2019-04-05 16:19:25 +02:00
Mauronofrio Matarrese 82a2f45eb7 Fix "Install Recovery Ramdisk" of a file which contains a space in the name
Change-Id: Ib2b1deee7427d9ac565676068b11982171f7a98d
2019-04-04 22:40:19 +01:00
Ethan Yonker f0a7e59668 Fix recovery-twrp in some old CM trees
Change-Id: Ie401ab8ec39b721c3747475bcc8269f78963d31c
2019-04-04 10:06:41 -05:00
Ethan Yonker b1a7ae9cd9 Three Dot Three Dot Zero
Change-Id: If58ac0918b78c90071ffe2efa1c8509316a2afb1
2019-04-03 21:34:20 -05:00
Ethan Yonker 193befec8c Extract arch-specific updater binary if present
Check for and extract arch specific updater binary based on
ro.product.cpu.abilist and use ro.product.cpu.abi as a fall back.
If no arch specific updater binary is present then use the regular
update-binary file. Note that a file named update-binary must be
present in the zip still even if it is a 0 byte file.

Change-Id: Iabb2156e68d40c5b99d55ea8e4a9a553eb26600a
2019-04-04 04:28:12 +02:00
Ethan Yonker b150276a43 Prevent having to double-tap some check boxes
Check boxes that do not have a default value set usually required
you to tap them twice to toggle them on the very first time. This
patch checks the return value from GetValue and sets a default of
0 if the variable does not already exist in the Data Manager.

Change-Id: I1ff26e756764ed2a00b10102f13a5bce0119771a
2019-04-04 04:26:53 +02:00
Ethan Yonker 53796e7333 Use magiskboot to repack the boot partition
Set TW_INCLUDE_REPACKTOOLS := true

Must also have:
AB_OTA_UPDATER := true

Use magiskboot and provide GUI options to allow users to repack
their existing boot image to install TWRP (or kernels) so we can
stop having to provide installation zips for AB devices. There is
also an option to try to fix a recovery bootloop if the kernel
has been patched to always boot the ramdisk for root, etc.

You will need to pull the below repo into external/magisk-prebuilt
https://github.com/TeamWin/external_magisk-prebuilt

Change-Id: I74196cc6f095a7576d61886dc96cbc18deba9b04
2019-04-03 16:44:00 -05:00
Dees Troy 9a4d7403d9 Fix build in 5.1 tree
Change-Id: I15f888d58c01de00920dc5c56148d363f4dd79b8
2019-04-03 05:23:34 +02:00
bigbiff bigbiff e4bdb15a5f AB Cache dir: If device doesn't have /data/cache for FBE, we should
try /persist if in the fstab.

Change-Id: I70dd19538b7f9b8cf61c46f6c8167057eec3342b
2019-04-03 02:08:39 +02:00
big biff 794e364e08 Merge "ADB Backup: Ignore creating backup folder for phones not decrypted. This allows you to continue without error. Also we should not set restore path for images in adb backup. Change-Id: Ia75a70377b8e1364fefc82ad41ccf74fa3b7a3c3" into android-9.0 2019-04-03 01:22:19 +02:00
bigbiff bigbiff 4b4148e415 ADB Backup: Stop resetting digest check on restore.
Change-Id: Ieb431705e69dcdfd74efb0a971cd7d2908a42098
2019-04-03 01:06:43 +02:00
Ethan Yonker c53d520d2b Fix zip digest check
Change-Id: I5c05c485574131d3fbc8cb5af5b1281d12b822ce
2019-04-02 15:56:25 -05:00
bigbiff bigbiff cdd97c7fab ADB Backup: Ignore creating backup folder for phones
not decrypted. This allows you to continue without error.
Also we should not set restore path for images in adb
backup.
Change-Id: Ia75a70377b8e1364fefc82ad41ccf74fa3b7a3c3
2019-04-01 22:56:55 -05:00
bigbiff bigbiff 718ab39bc5 Zip install: this will allow TWRP to check md5 and sha256 checksums
for zip installs.

Change-Id: I1fb6af777e08aea29bedaf2e6a9b385ae3b03fac
2019-04-02 05:42:47 +02:00
Makornthawat Emery abc299c09f Correct return case for context check in /cache/recovery
Change-Id: If9eca1b7f6b781542194a6b39c19ee03a521f94b
2019-03-30 01:05:46 +00:00
dianlujitao 95244dd6c0 Transfer /dev/mtp_usb fd ownership when instancing MtpDevHandle
/dev/mtp_usb was opened before instancing MtpDevHandle, the existing fd
should be passed in otherwise MtpDevHandle::start would be blocked as it
attempted to open the device twice.

Change-Id: I6afc5b6926930dad77aceac2f6a00e1c6759a883
2019-03-28 15:04:42 +08:00
andi34 0ef6492518 updater: Allow devices to suppress BLKDISCARD
* On some devices TRIM is disabled for security reasons. Don't fail
  flashing the ROM because discard isn't possible in this case.

Change-Id: I044619c3e0b01a496d967ef136501d0190240ad4
2019-03-23 14:39:53 +02:00
Michael Bestas 9bb7c225a4 Don't copy local mke2fs.conf for O-MR1
* It is now copied from system/extras/ext4_utils

Change-Id: Ibddcad4928c17bc174390d75708a5382a9262441
2019-03-23 14:39:53 +02:00
Michael Bestas de18923571 Remove duplicate ext4 flags from Android.mk
* They are right above

Change-Id: Ifff889e6ff748ed6bfa4a076b1afcc2c6a7eed3b
2019-03-23 14:39:53 +02:00
Michael Bestas 0cc2376153 Set a dummy CM_PLATFORM_SDK_VERSION if it doesn't exist
* Avoids printing 2 build warnings on every single rebuild
  of anything when building TWRP inline

Change-Id: I5dd3623707c03af0dfe7366f1a77e83762e720b2
2019-03-23 14:39:53 +02:00
Michael Bestas 0bb5df9a34 Remove leftover mounts.h~HEAD
* Wrongly added during 8.0 merge

Change-Id: Icc0415f978af352458ce7d605b0c8c4cd84c184e
2019-03-23 14:39:53 +02:00
Simon Shi e682598480 prebuilt: Support ubsan libraries of all architectures
According to the file under './prebuilts/clang/host/linux-x86/clang-4691093/lib64/clang/6.0.2/lib/linux/*.so', these files are supported under different target architectures. This commit would add support to every architecture.

Change-Id: I1f88bc06c3f30e6d2f2083ba9b6350b2376d83f2
2019-03-22 16:33:47 -05:00
Simon Shi 8ae2b0d5dd twinstall: Force variable type
Force the usage of variable type since it is different on the 32-bit
devices. Use this commit to avoid the problem.

bugs:
bootable/recovery/twinstall.cpp:201:67: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'long long' [-Werror,-Wformat]
LOGINFO("has_legacy_properties: mmap (size=%zu) failed: %s!\n", finfo.st_size, strerror(errno));
                                           ~~~                  ^~~~~~~~~~~~~
                                           %lld

Change-Id: Ie0c51a90490e0c069fff33884a9431a97361f5c6
2019-03-22 16:32:39 -05:00
lambdadroid a0a163586c dosfstools: Fix compile error in Pie tree on 32 bit systems
Fixes the following compile error:
bootable/recovery/dosfstools/src/check.c:591:4: error: format specifies type 'unsigned long' but the argument has type 'unsigned long long'
[-Werror,-Wformat]
                 (uint64_t)clusters * fs->cluster_size,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This was fixed upstream in
"Fix format string in check_file() (%lu -> %llu)" (dosfstools/dosfstools@d7665f2)
This commit applies the change on top of TWRP's dosfstools copy.

Change-Id: I23374594662fd95e795f793112e78c54d8d50b30
2019-03-22 22:09:13 +01:00
Ethan Yonker 7e94158684 Support both old and new mkfs.f2fs
Easiest way I could find to determine if we have the old or the
new mkfs.f2fs version is to pipe the usage output to grep and
grep the output for "reserved" and redirect the output to a file.
If the file has any data in it, then we must have the old
mkfs.f2fs that uses -r.

Change-Id: I7f1ed88b577a3f9827a98f0868d8f82e4e4886ac
2019-03-22 08:18:24 -05:00
dianlujitao 4879b37b5d Fix the long broken format function
* For EXT2/3:
   * Align mke2fs options with Android 9.0 fs_mgr_format.cpp.
 * For EXT4:
   * Note that make_ext4fs is still in use on Android 8.1 to workaround
     a FDE encryption bug even though mke2fs has become the default
     choice. The bug is fixed in Android 9.0+.
 * For F2FS:
   * Drop the broken "-r" option, it's never ported to O, explicitly
     pass number of sectors instead.
   * Keep all options aligned with Pie fs_mgr.
   * Check existence before start wiping, as Wipe_EXT4 does.
 * For all:
   * Calculate block size at runtime, and reserve the space specified
     via negative "length" option from fstab. Note that positive length
     will be ignored.
   * If the partition has crypto footer, and "length" is not specified
     in fstab, automatically reverse CRYPT_FOOTER_OFFSET (16384).
   * Remove the default crypto key location: footer, this is a bad
     assumption since most partitions don't use encryption! We need to
     know the real situation to decide whether to reserve crypto footer
     on format.
   * If the current action is "wipe" or "change filesystem", wipe crypto
     footer or block device after mkfs if the partition is
     unencrypted or undecrypted (e.g., wrong password).
   * If the current action is "format data", unconditionally wipe crypto
     footer or block device.

Change-Id: I7304a8ee703131ea4a08ab7c60334af28cac28b3
2019-03-21 16:15:52 -05:00
Ethan Yonker 64e0a6525f Use listbox for device-specific advanced menu items
This patch allows items to have more than one action surrounded
by the <actions> tags like other GUI elements. The patch also
adds new twrp command line options that let you reload the theme
and switch to a specific page from the command line:

adb shell twrp reloadtheme
adb shell twrp changepage=advanced

Change-Id: I838ea380a508be07b9fa617034d1954e116febd6
2019-03-20 15:42:49 -05:00
Dees Troy 908442dfb5 Merge "Update FDE decrypt to pie from CAF" into android-9.0 2019-03-20 21:40:44 +01:00
Ethan Yonker 98661c1a29 Update FDE decrypt to pie from CAF
cryptfs.cpp based on CAF tag LA.UM.7.3.r1-05900-sdm845.0
Used CAF because AOSP no longer contains code for qcom's hardware
crypto.

Change-Id: I921cbe9bed70989f91449e23b5ac3ec1037b7b97
2019-03-20 15:33:48 -05:00
bigbiff bigbiff af32bb9c4f MTP FFS updates:
This update splits old MTP code and new MTP code from Google
into two trees, legacy and ffs. Depending on the SDK level,
the build system will select the correct version. The reason
for separating the versions out are due to older android trees
not supporting the updated MTP code from Google.

Most MTP code is from Google, with additions needed from
implementing the Java functions in C++ for TWRP and FFS.

We assume if you are in android-9.0 or above, your kernel
has support for FFS over MTP. Verify that your init.rc
is mounting the MTP FFS driver to the proper location.

Change-Id: I4b107b239bd9bc5699527f9c8c77d9079f264a7e
2019-03-20 14:28:21 -05:00
mauronofrio e9a49efe75 Adding Edl button in reboot menu
Edl mode is available only on qualcomm devices and it used to fully
restore the bricked devices. I made the button available only if
TW_HAS_EDL_MODE := true like the download button. I set the edl
button to the right of the download button, so devices can support
edl button and download button. I also added the translation for
all languages.

Change-Id: I69d1058b8c050b722395c7b3da6dce1ccfbe7a91
2019-03-20 10:57:07 -05:00
D. Andrei Măceș 08f91e84e0 gpt: Add -Wno-format-security
The existing -Wno-format requires it:

error: -Wformat-security ignored without -Wformat [-Werror=format-security]

Change-Id: I9e4177df3437f582b7c71fdaf364ab3b7ced595e
Signed-off-by: D. Andrei Măceș <andrei@unlegacy-android.org>
2019-03-19 18:05:40 +01:00
Andreas Blaesius 38d2d5268e TWRP: fix compiling on Android 7
fixes
cp: cannot create regular file (...)/recovery/root/file_contexts': No such file or directory

Change-Id: I094a0bd242c6eb01e84570fbe49e853098e33a8b
2019-03-19 17:58:29 +01:00
Ethan Yonker e03158ebdd Fix gr_clip
gr_clip was not calculating the correct values after the rotation
patch. Since gr_clip width and height instead of taking a second
pair of x,y coordinates, we cannot depend as much on the
ROTATION_X_DISP and ROTATION_Y_DISP macros. The simplest solution
was to call scissor with direct values in most cases.

Change-Id: I25f9d575ec6ddc430fca4555f29c8334441fc95d
2019-03-19 11:40:28 -05:00
bigbiff bigbiff 3157f121ad Full screen action: simplify by just hiding navbar
Change-Id: Iab770ee47420deae08cc3c20127f36f53036fbec
2019-03-18 21:54:20 +01:00
lambdadroid eff335d850 prebuilt: Avoid re-linking ARM64 specific library on other architectures
libclang_rt.ubsan_standalone-aarch64-android.so is a library for
arm64 and is therefore not available on other architectures, causing
the build to fail because there is no rule to build it.

Change-Id: Ia4af38f42ba46a233d40e936d43e4c97c449d059
2019-03-18 18:17:16 +01:00
Vladimir Oltean d32b7ebf20 TW_ROTATION: add flag to handle hardware-rotated display panels
* The existence of TW_ROTATION that implements this feature at the
  level of calls to libpixelflinger API closely mirrors the existence of
  ro.sf.hwrotation for surfaceflinger in LineageOS.
* A brute-force approach was previously attempted via the
  BOARD_HAS_FLIPPED_SCREEN makefile flag. That code iterated over the
  active display surface in a double-buffered setup, and performed a
  "smart" memcpy from the UI drawing surface (gr_draw) onto the display
  surface. The problem was that, without heavy loop optimizations, that
  code could have never scaled for 90 and 270 degree rotation.
  I tried and you could literally see the for loop with the naked eye
  while the display surface was updating.
* That code is now gone, but support for BOARD_HAS_FLIPPED_SCREEN := true
  is still there (now means TW_ROTATION := 180).
* This patch relies on the assumption that it is impossibly difficult
  and non-portable to rotate whole framebuffer display surfaces, in a
  way that is not dependent upon the graphics backend (adf, fbdev, drm,
  overlay etc). Therefore, it identifies the rendering primitives that
  the TWRP graphics stack exposes to the GUI application above, and
  implements hwrotation inside each of those calls instead:
    - gr_line(), gr_fill() - 2D geometric shapes (lines, rectangles)
    - gr_blit() - graphical image resources
    - gr_ttf_textExWH() - font rendering
    - gr_fb_width(), gr_fb_height() - framebuffer resolution
* The gist is to keep the backend and framebuffer (dimensions, row size
  etc) unchanged (because making changes there is asking for trouble),
  but present an altogether different reality to the calling API,
  according to the compile-time constant TW_ROTATION.
* All (x, y) API coordinates and shapes are transformed before being
  actually rendered as (x_disp, y_disp) display coordinates.
* With TW_ROTATION := 90 or 270 you can turn a landscape device into
  a portrait one, because the GUI is fooled by the reversed dimensions
  reported by gr_fb_width() and gr_fb_height() and renders the UI as
  for a different device.
* For blit and text rendering operations, figuring out the transformed
  coordinates in display space is not enough, as the surfaces that are
  to be rendered have to be rotated themselves. This is handled by
  allocating an intermediary rotated surface on each rendering
  operation (not ideal), so the code with the intermediary surface
  is compiled out for the TW_ROTATION := 0 case.
* This is still not as bad as rotating the whole framebuffer though, and
  on a msm8976 device the performance hit is not even noticeable (for
  software rendering).
* Currently there is no attempt to make a connection between the
  TW_ROTATION and the { RECOVERY_TOUCHSCREEN_SWAP_XY,
  RECOVERY_TOUCHSCREEN_FLIP_X, RECOVERY_TOUCHSCREEN_FLIP_Y } settings.

Change-Id: Ic8966ad5360c8a499649fdb16e242286640fd992
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
2019-03-18 11:39:38 -05:00
bigbiff bigbiff 19874f1469 AB/Non AB Devices: updates for moving cache
This patchset updates all the places we touch cache on AB devices
and non AB devices so that we can write to the appropriate
location. AB devices removed the cache partition and moved it to
/data/cache.

Change-Id: I485ec205a604f1f07ceb7700ae9c4e720fd55c3e
2019-03-18 04:49:38 +01:00
bigbiff bigbiff 3ed778ad63 Vibration: allow BoardConfig to disable vibration for a device.
Change-Id: Ibd2f67391ce6d7774498839829e0de9391508781
2019-03-17 22:39:00 -05:00
oshmoun 9220dbab44 fix building TWRP for devices without cache
Some devices do not declare BOARD_CACHEIMAGE_PARTITION_SIZE.
This case is detected and required modules are added to LOCAL_REQUIRED_MODULES.
However, := is used instead of +=  and causes the loss of all previously added modules.
The end result is that twrp is not actually getting built since its module was lost.
Fix that by using += when adding modules required for cache-less devices.

Change-Id: Ib0a4db4955040ced77be7ed04d636905beadf093
2019-03-18 04:27:35 +01:00
Dees Troy 5f8394ca88 Merge "slot management: add library for slot management." into android-9.0 2019-03-17 16:09:56 +01:00
big biff 3ae89edb40 Merge "Fix build error on Pie with TW_NO_LEGACY_PROPS := true" into android-9.0 2019-03-15 01:06:47 +01:00
big biff 6b9ee0e0b2 Merge "Revert "Fix ld.config.txt errors on Android 8.1 system root devices"" into android-9.0 2019-03-15 00:40:46 +01:00
big biff 4087034d08 Merge "Add path for time and date fix" into android-9.0 2019-03-09 22:24:26 +01:00
big biff 7812dd49e1 Merge "vold_decrypt: Add android 9.0 support" into android-9.0 2019-03-08 00:52:21 +01:00
Captain Throwback 5ab596451a mksh: add mkshrc when using TW_USE_TOOLBOX
Fixes broken shell prompt in Terminal and adb shell

Before: https://del.dog/7vphlkc
After: https://del.dog/vhkjgo8

Add as prebuilt with suffix "_twrp" to avoid conflict
with original mkshrc and rename via POST_INSTALL_CMD

Prebuilt version adjusts TMPDIR variable from
"/data/local/tmp" to "/tmp" for TWRP

Change-Id: I42a1b2a8c114f66dbe659c07485f1dfae8a5d314
2019-03-07 18:34:15 +01:00
big biff 968009d741 Merge "partition: add squashfs support" into android-9.0 2019-03-07 15:00:38 +01:00
Mauronofrio Matarrese 2dab70d83c Add path for time and date fix
This will add another path where looking for ats_* files

This is needed on some devices like OnePlus 6/6T

Change-Id: I9ac7cdd05ddc80f3e269efda96be2b7712d68af0
2019-03-05 02:23:58 +01:00
big biff f9ec593f1e Merge "minuitwrp: Remove unused variables" into android-9.0 2019-03-03 01:04:23 +01:00
bigbiff bigbiff c630cee1ae slot management: add library for slot management.
Change-Id: I7d0a67bc8e237866485680a5c54443435e7d2737
2019-02-20 18:06:55 -05:00