Giter Site home page Giter Site logo

kdrag0n / tipatch Goto Github PK

View Code? Open in Web Editor NEW
70.0 6.0 9.0 2.6 MB

A patcher for TWRP to backup internal storage/emulated SD card contents (photos, downloads, videos, etc).

License: MIT License

CMake 2.11% Kotlin 46.21% C++ 34.39% Java 17.29%
twrp twrp-recovery android-app patcher

tipatch's Introduction

Tipatch

API GitHub release Release downloads License

Tipatch patches TWRP to backup contents of internal storage (the emulated SD card at /sdcard) as part of Data, thus preventing data loss. Internal storage typically includes items such as photos, videos, downloads, game data, and other assorted files. Website

Get it on Google Play or XDA Labs

Why?

TWRP Data backups do not include Internal Storage, which is the emulated SD card that stores your photos, videos, downloads, and more. This means that in the event you transfer phones or completely wipe data, all of that is gone! Eventual data loss is inevitable here.

I decided to make this tool after encountering data loss multiple times because of the issue. To make it accessible to all users, I made it an app instead of only a command-line computer program.

Effects

  • Data (incl. storage) instead of Data (excl. storage) on Backup screen
  • Backups of Data include... instead of Backups of Data do not include... when stating backup
  • Bigger calculated Data size on Backup screen
  • Internal storage being restored when restoring the backup

Side effect: wiping Data WILL also wipe internal storage!

If you use a theme, or a language other than English, the text will not change. Revert to the default theme and/or temporarily change the language back to English to confirm this. Don't worry, this is only a cosmetic effect.

Restoring backups taken with a patched TWRP (i.e. those that include internal storage) does not require a patched recovery.

Will it work for device name?

The app supports patching the currently installed recovery in-place on rooted devices. It has been confirmed to work on Exynos, Snapdragon, Kirin, and MediaTek devices.

If you are not rooted or your device is not supported by in-place patching, don't worry. It also supports patching an image and saving the result as an image.

Help, something broke!

If you used in-place patching and your recovery doesn't boot anymore, tap Restore backup in the action menu.

If you don't want internal storage to be backed up anymore, tap Undo patch in the action menu instead of Patch.

For other issues or feedback, you can post on the XDA thread, find me on Telegram or e-mail me.

How does it really work?

It simply changes TWRP to ignore /data/.twrp instead of /data/media, where internal storage resides.

The core logic is written in C++, loaded as a native library by the app. The app handles I/O, while the C++ code does the heavy lifting and actual patching, in-memory. I chose to do this in C++ instead of Kotlin because of memory usage and speed concerns.

Since users are likely to get impatient waiting for the ramdisk compression to finish, I implemented parallel gzip that uses up to 4 cores at once to finish the compression faster. It's limited at 4 to prevent overloading the device and saturating memory bandwidth, thus making the process slower. LZMA compression is done in Java and is not optimized because of the minority of devices with LZMA compressed ramdisks.

Unfortunately, I was not able to have the C++ piece directly read from a file descriptor obtained from Kotlin because in file patching mode, it is possible to refer to files that may be stored anywhere - Google Drive, other apps, etc. This was a major loss in terms of memory consumption during patching.

tipatch's People

Contributors

kdrag0n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tipatch's Issues

TWRP is not recognized on some devices

My phone is the Samsung Galaxy S6 on Sprint's network (hardware version G920P.02) Tipatch doesn't work with root (when working with the recovery's partition) or without root (when working with an image of the recovery.)

Video:
tipatch_breakage
Logcat:

I/Tipatch (24956): Reading & unpacking image READ slot=null
I/Tipatch (24956): Decompressing ramdisk with Gzip DECOMPRESS slot=null
I/Tipatch (24956): Patching ramdisk PATCH slot=null

Image:
https://dl.twrp.me/zerofltespr/twrp-3.2.3-0-zerofltespr.img.html

Sorry for the inconvenience but could there be an update?

I have a OnePlus 9R with TWRP 3.5.2 (Super_partition, a/b slots etc) after flash and when trying to enter recovery with the patch, it does not enter and goes back to the bootloader, I also tried to root the app itself but it didn't work either.

I don't want to sound petulant but if an incentive (donation) is needed I can do it, I know that not only would I benefit from an update but everyone!

Thank you for your attention, good developments!

Xiaomi Poco X3 Pro - Patched recovery does not boot

I patched TWRP 3.6.2 for Xiaomi Poco X3 Pro (vayu) using TiPatch. Both in-place patch and patch using the img file lead to a recovery that doesn't boot but falls back to bootloader/fastboot.
Image is here (file is too big to attach at this post).

Tracker-free version?

That sounds like a great app, congrats! I just hesitate installing it as it comes with several trackers (Crashlytics, Firebase Analytics, Firebase itself). Is it possible to provide a tracker-free version for us "tin foils"? I'd provide that via my repo (which, as requested by a user, currently holds the version you provide in the releases section, thank you for that; my updater script fetches new versions automatically, usually within 24h). I'm thinking along the lines of a tipatch-app-noanalytics-<version>.apk ๐Ÿ˜‰

patched TWRP showing incorrect "Wipe" and imprecise "Advanced Wipe" description

I mentioned this already on xda but I figured it would be best to open an issue for this.

The "Wipe" description of the patched TWRP is incorrect as it definitely wipes internal storage. This is mentioned in your OP at xda.

"Note that wiping Data WILL also wipe internal storage, contrary to normal behavior. [...] A side effect is that wiping "Data" will also wipe internal storage".

I suggest just dropping the "not" from the current string resulting in "Wipes Data, Cache, and Dalvik (including internal storage)".

As for the "Advanced Wipe" description I would suggest "Data (incl. storage)" like seen here.

This would result in a consistent and accurate user interface and less frustrated users. TWRP had/has a problem you fixed but many users did not exactly complain about missing functionality but about misleading UI resulting in wrong expectations as can be seen here.

No indication of progress, ie buiding digests, %, etc.

Samsung SM-N910V
Marshmallow
twrp-3.3.1-0-trlte

First attempt to backup Data w/ patched twrp.
Last message was "Backups of Data include files in internal storage such as pictures and downloads"
Blue progress bar border is animated, but there is no progress bar or numerical progress for 15 minutes
How do I know if this is crashed? I don't want to pull the battery unnecessarily risking corrupting my Micro SD card

Empty readme

I found your app in F-Droid but after I try to read more about it on the linked homepage (which give a 404) i try to read the GitHub readme which is empty.
So where can we read more about?

Push Tipatch-lite to F-Droid

As you already wrote a tracker-free and permission-lite ;) version #1, I think it's time to push that version to F-Droid. This way privacy minded users have always up to date versions as well and don't have to rely on private repositories (note that this is not the lite version at the time of writing!).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.