twrpapp: restore system mount to previous state

The current function to check for the existence of the TWRP app
in system unconditionally unmounts system once the check is
complete. Since the TWRP app check now occurs more frequently since
change 70e0a397e00c605cf7b01a5f5ce027dea84f1a14, system is now
getting unmounted every time the Advanced menu is entered, which
is undesirable if it was mounted in order to perform tasks from that
menu.

This patch first checks the state of the system mount point, and
once the check is complete, either unmounts system or leaves it
mounted, based on the initial state.

Change-Id: I7ad1f3e4e6cf3579134f1a9c5468ad90a142feae
1 file changed
tree: 783578583a879b4bda633b707b73035785abba75
  1. .github/
  2. adbbu/
  3. applypatch/
  4. attr/
  5. bmlutils/
  6. boot_control/
  7. bootloader_message/
  8. bootloader_message_twrp/
  9. crypto/
  10. dosfstools/
  11. edify/
  12. etc/
  13. exfat/
  14. fb2png/
  15. flashutils/
  16. fonts/
  17. fuse/
  18. gpt/
  19. gui/
  20. htcdumlock/
  21. injecttwrp/
  22. libblkid/
  23. libcrecovery/
  24. libmincrypt/
  25. libpixelflinger/
  26. libtar/
  27. minadbd/
  28. minadbd21/
  29. minui/
  30. minui21/
  31. minuitwrp/
  32. minzip/
  33. mmcutils/
  34. mtdutils/
  35. mtp/
  36. openaes/
  37. orscmd/
  38. otafault/
  39. otautil/
  40. ozip_decrypt/
  41. pigz/
  42. prebuilt/
  43. private/
  44. res/
  45. res-hdpi/
  46. res-mdpi/
  47. res-xhdpi/
  48. res-xxhdpi/
  49. res-xxxhdpi/
  50. scripts/
  51. sepolicy/
  52. simg2img/
  53. tests/
  54. toolbox/
  55. tools/
  56. toybox/
  57. twrpDigest/
  58. twrpTarMain/
  59. uncrypt/
  60. update_verifier/
  61. updater/
  62. verifier24/
  63. .clang-format
  64. .gitignore
  65. adb_install.cpp
  66. adb_install.h
  67. Android.bp
  68. Android.mk
  69. asn1_decoder.cpp
  70. asn1_decoder.h
  71. BasePartition.cpp
  72. bootloader.h
  73. CleanSpec.mk
  74. common.h
  75. data.cpp
  76. data.hpp
  77. default_device.cpp
  78. device.cpp
  79. device.h
  80. exclude.cpp
  81. exclude.hpp
  82. find_file.cpp
  83. find_file.hpp
  84. fixContexts.cpp
  85. fixContexts.hpp
  86. fuse.h
  87. fuse_sdcard_provider.cpp
  88. fuse_sdcard_provider.h
  89. fuse_sideload.cpp
  90. fuse_sideload.h
  91. fuse_sideload22.cpp
  92. fuse_sideload22.h
  93. infomanager.cpp
  94. infomanager.hpp
  95. install.cpp
  96. install.h
  97. installcommand.cpp
  98. installcommand.h
  99. interlace-frames.py
  100. legacy_properties.h
  101. legacy_property_service.cpp
  102. legacy_property_service.h
  103. mounts.c
  104. mounts.cpp
  105. mounts.h
  106. NOTICE
  107. openrecoveryscript.cpp
  108. openrecoveryscript.hpp
  109. OWNERS
  110. partition.cpp
  111. partitionmanager.cpp
  112. partitions.hpp
  113. PREUPLOAD.cfg
  114. progresstracking.cpp
  115. progresstracking.hpp
  116. README.md
  117. recovery-persist.cpp
  118. recovery-persist.rc
  119. recovery-refresh.cpp
  120. recovery-refresh.rc
  121. recovery.cpp
  122. recovery_ui.h
  123. roots.cpp
  124. roots.h
  125. rotate_logs.cpp
  126. rotate_logs.h
  127. screen_ui.cpp
  128. screen_ui.h
  129. set_metadata.cpp
  130. set_metadata.h
  131. stub_ui.h
  132. tarWrite.c
  133. tarWrite.h
  134. tw_atomic.cpp
  135. tw_atomic.hpp
  136. twcommon.h
  137. twinstall.cpp
  138. twinstall.h
  139. twinstallorig.cpp
  140. twinstallorig.h
  141. twrp-functions.cpp
  142. twrp-functions.hpp
  143. twrp.cpp
  144. twrpAdbBuFifo.cpp
  145. twrpAdbBuFifo.hpp
  146. twrpDigestDriver.cpp
  147. twrpDigestDriver.hpp
  148. twrpTar.cpp
  149. twrpTar.h
  150. twrpTar.hpp
  151. ui.cpp
  152. ui.h
  153. variables.h
  154. verifier.cpp
  155. verifier.h
  156. vr_device.cpp
  157. vr_ui.cpp
  158. vr_ui.h
  159. wear_device.cpp
  160. wear_ui.cpp
  161. wear_ui.h
  162. zipwrap.cpp
  163. zipwrap.hpp
README.md

Team Win Recovery Project (TWRP)

You can find a compiling guide here.