├── .github └── workflows │ └── ci.yml ├── .gitignore ├── LICENSE ├── README.md ├── detacher ├── Cargo.toml └── src │ ├── main.rs │ └── sql │ ├── auto_update.sql │ ├── frosting.sql │ ├── install_queue.sql │ ├── install_source.sql │ ├── library.sql │ └── localappstate.sql ├── mindetach ├── META-INF │ └── com │ │ └── google │ │ └── android │ │ ├── update-binary │ │ └── updater-script ├── customize.sh ├── detach.txt ├── module.prop ├── service.sh └── system │ └── bin │ ├── mindetach-arm │ └── mindetach-arm64 └── update.json /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | on: push 2 | 3 | jobs: 4 | run: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout 8 | uses: actions/checkout@v3 9 | 10 | - name: Build 11 | id: build 12 | run: | 13 | cd mindetach 14 | VER=$(grep version= module.prop | cut -d= -f2) 15 | echo "VER=$VER" >> $GITHUB_OUTPUT 16 | zip -r "../mindetach-${VER}.zip" . 17 | 18 | - name: Upload module to release 19 | uses: svenstaro/upload-release-action@v2 20 | with: 21 | file: mindetach-${{ steps.build.outputs.VER }}.zip 22 | release_name: mindetach-${{ steps.build.outputs.VER }} 23 | tag: ${{ steps.build.outputs.VER }} 24 | overwrite: true 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.db 2 | *.py 3 | *.zip 4 | t.sh 5 | b.sh 6 | Cargo.lock 7 | detacher/target 8 | detacher/rust-toolchain -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2022 [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### ⚠️ You can instead use the more reliable [zygisk-detach](https://github.com/j-hc/zygisk-detach) module 2 | 3 | # mindetach magisk module 4 | 5 | Magisk module to detach apps from Play Store 6 | 7 | I use a more efficient method than other modules (basically registering a trigger in the DB) to persist the detachment which **does not run on the background** or have the overhead of any type of scheduling. 8 | 9 | ## Usage 10 | * Apps to detach are got either from `/sdcard/detach.txt` or `detach.txt` file inside the module. 11 | 12 | `/sdcard/detach.txt` takes precedence. 13 | 14 | `detach.txt` format: 15 | ``` 16 | com.google.android.youtube 17 | com.someotherapp 18 | ``` 19 | 20 | * Apps will be detached from Play Store once you flash the module. To re-attach them, remove the module and clean the data of Play Store. 21 | 22 | * To modify detach.txt and run the detachment again, you can re-flash mindetach.zip or execute `su -c mindetach` in terminal. 23 | -------------------------------------------------------------------------------- /detacher/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "detacher" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["j-hc"] 6 | 7 | [dependencies] 8 | libc-print = "0.1" 9 | sqlite = { version="0.31", default-features = false, features = ["linkage"] } 10 | 11 | [profile.release-pr] 12 | inherits = "release" 13 | lto = "fat" 14 | panic = "abort" 15 | codegen-units = 1 16 | strip = true 17 | opt-level = 3 18 | 19 | [profile.release-debug] 20 | inherits = "release-pr" 21 | strip = false 22 | 23 | [profile.dev] 24 | panic = "abort" 25 | 26 | [features] 27 | print_stdout = [] 28 | -------------------------------------------------------------------------------- /detacher/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | #![feature(iter_intersperse)] 3 | 4 | use libc_print::libc_println; 5 | use std::path::Path; 6 | 7 | macro_rules! db_dir { 8 | () => { 9 | "/data/data/com.android.vending/databases/" 10 | }; 11 | } 12 | 13 | macro_rules! query { 14 | ($arg:literal) => { 15 | ( 16 | concat!(db_dir!(), $arg, ".db"), 17 | include_bytes!(concat!("sql/", $arg, ".sql")), 18 | ) 19 | }; 20 | } 21 | 22 | macro_rules! f { 23 | ($($s:expr),*) => { 24 | [ $( AsRef::::as_ref(&$s) ),* ].concat() 25 | }; 26 | } 27 | 28 | static mut QUERY: [(&str, &[u8]); 6] = [ 29 | query!("auto_update"), 30 | query!("frosting"), 31 | query!("install_queue"), 32 | query!("install_source"), 33 | query!("library"), 34 | query!("localappstate"), 35 | ]; 36 | 37 | fn get_apps() -> Option> { 38 | let exe = std::env::current_exe().unwrap(); 39 | let modpath = exe.ancestors().skip(3).next().unwrap(); 40 | let detach_txt = modpath.join("detach.txt"); 41 | 42 | for detach_path in [ 43 | Path::new("/sdcard/detach.txt"), 44 | Path::new("/data/adb/modules/mindetach/detach.txt"), 45 | &detach_txt, 46 | ] 47 | .iter() 48 | .filter(|p| p.exists()) 49 | { 50 | let apps = std::fs::read_to_string(detach_path) 51 | .ok()? 52 | .lines() 53 | .map(|s| s.trim()) 54 | .filter(|l| !l.is_empty() && !l.starts_with('#')) 55 | .map(|s| f!("'", s, "'")) 56 | .collect::>(); 57 | if !apps.is_empty() { 58 | return Some(apps); 59 | } 60 | } 61 | None 62 | } 63 | 64 | #[no_mangle] 65 | pub extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 { 66 | run() 67 | } 68 | 69 | fn alt_name(s: &str) -> String { 70 | let s = s 71 | .as_bytes() 72 | .iter() 73 | .cloned() 74 | .intersperse(b'%') 75 | .collect::>(); 76 | unsafe { String::from_utf8_unchecked(s) } 77 | } 78 | 79 | fn db_open(path: &str) -> sqlite::Result { 80 | let f = sqlite::OpenFlags::new().set_read_write().set_no_mutex(); 81 | let mut conn = sqlite::Connection::open_with_flags(path, f)?; 82 | conn.set_busy_timeout(2000)?; 83 | Ok(conn) 84 | } 85 | 86 | fn apply_verify_apps(apps: &[String]) -> bool { 87 | if let Ok(conn) = db_open(concat!(db_dir!(), "verify_apps.db")) { 88 | for n in apps.iter() { 89 | let sql = f!("DELETE FROM apk_info WHERE data LIKE ", &alt_name(n)); 90 | match conn.execute(&sql) { 91 | Ok(_) => return true, 92 | Err(e) => { 93 | if cfg!(feature = "print_stdout") { 94 | libc_println!("ERROR: {}", e); 95 | } 96 | } 97 | } 98 | } 99 | } 100 | false 101 | } 102 | 103 | fn run() -> i32 { 104 | let Some(apps) = get_apps() else { 105 | libc_println!("- All detach.txt files were empty. Skipping detaching."); 106 | return 0; 107 | }; 108 | let apps_concat = apps.join(","); 109 | libc_println!("- Apps: {}", apps_concat); 110 | 111 | for (i, (p, q)) in unsafe { QUERY.iter_mut() }.enumerate() { 112 | let sql = unsafe { std::str::from_utf8_unchecked(q) }.replace("PKGNAME", &apps_concat); 113 | match db_open(p) { 114 | Ok(conn) => match conn.execute(&sql) { 115 | Ok(_) => libc_println!("- STEP {}: OK", i + 1), 116 | Err(err) => { 117 | libc_println!("- STEP {}: SKIPPED (query: {})", i + 1, err) 118 | } 119 | }, 120 | Err(_) => libc_println!("- STEP {}: SKIPPED", i + 1), 121 | }; 122 | } 123 | 124 | let i = unsafe { QUERY.len() } + 1; 125 | if apply_verify_apps(&apps) { 126 | libc_println!("- STEP {}: OK", i) 127 | } else { 128 | libc_println!("- STEP {}: SKIPPED", i) 129 | } 130 | 131 | 0 132 | } 133 | -------------------------------------------------------------------------------- /detacher/src/sql/auto_update.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM auto_update 2 | WHERE 3 | pk IN (PKGNAME); 4 | 5 | DROP TRIGGER IF EXISTS j_hc_auto_update_blockupdate_AI; 6 | 7 | CREATE TRIGGER j_hc_auto_update_blockupdate_AI AFTER INSERT ON auto_update BEGIN 8 | DELETE FROM auto_update 9 | WHERE 10 | pk IN (PKGNAME); 11 | END; 12 | 13 | DROP TRIGGER IF EXISTS j_hc_auto_update_blockupdate_BI; 14 | 15 | CREATE TRIGGER j_hc_auto_update_blockupdate_BI BEFORE INSERT ON auto_update BEGIN 16 | SELECT 17 | RAISE ( 18 | ROLLBACK, 19 | 'mindetach: auto_update.auto_update insert' 20 | ) 21 | WHERE 22 | NEW.pk IN (PKGNAME); 23 | END; -------------------------------------------------------------------------------- /detacher/src/sql/frosting.sql: -------------------------------------------------------------------------------- 1 | UPDATE frosting 2 | SET 3 | last_updated = 9999999999999 4 | WHERE 5 | pk IN (PKGNAME) -------------------------------------------------------------------------------- /detacher/src/sql/install_queue.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM install_requests 2 | WHERE 3 | pk IN (PKGNAME); 4 | 5 | DROP TRIGGER IF EXISTS j_hc_install_requests_blockupdate_AI; 6 | 7 | CREATE TRIGGER j_hc_install_requests_blockupdate_AI AFTER INSERT ON install_requests BEGIN 8 | DELETE FROM install_requests 9 | WHERE 10 | NEW.pk IN (PKGNAME); 11 | 12 | END; 13 | 14 | DROP TRIGGER IF EXISTS j_hc_install_requests_blockupdate_BI; 15 | 16 | CREATE TRIGGER j_hc_install_requests_blockupdate_BI BEFORE INSERT ON install_requests BEGIN 17 | SELECT 18 | RAISE ( 19 | ROLLBACK, 20 | 'mindetach: install_requests.install_requests insert' 21 | ) 22 | WHERE 23 | NEW.pk IN (PKGNAME); 24 | 25 | END; -------------------------------------------------------------------------------- /detacher/src/sql/install_source.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM install_source 2 | WHERE 3 | pk IN (PKGNAME) -------------------------------------------------------------------------------- /detacher/src/sql/library.sql: -------------------------------------------------------------------------------- 1 | DROP TRIGGER IF EXISTS j_hc_ownership_blockupdate_AU; 2 | 3 | DROP TRIGGER IF EXISTS j_hc_ownership_blockupdate_BU; 4 | 5 | UPDATE ownership 6 | SET 7 | app_certificate_hash = 'j-hc-mindetach', 8 | purchase_time = 0 9 | WHERE 10 | doc_id IN (PKGNAME); 11 | 12 | DROP TRIGGER IF EXISTS j_hc_ownership_blockupdate_AI; 13 | 14 | CREATE TRIGGER j_hc_ownership_blockupdate_AI AFTER INSERT ON ownership BEGIN 15 | UPDATE ownership 16 | SET 17 | app_certificate_hash = 'j-hc-mindetach', 18 | purchase_time = 0 19 | WHERE 20 | doc_id IN (PKGNAME); 21 | 22 | END; 23 | 24 | CREATE TRIGGER j_hc_ownership_blockupdate_AU AFTER 25 | UPDATE ON ownership BEGIN 26 | UPDATE ownership 27 | SET 28 | app_certificate_hash = 'j-hc-mindetach', 29 | purchase_time = 0 30 | WHERE 31 | doc_id IN (PKGNAME) 32 | AND NEW.doc_id IN (PKGNAME); 33 | 34 | END; 35 | 36 | DROP TRIGGER IF EXISTS j_hc_ownership_blockupdate_BD; 37 | 38 | CREATE TRIGGER j_hc_ownership_blockupdate_BD BEFORE DELETE ON ownership BEGIN 39 | SELECT 40 | RAISE (ROLLBACK, 'mindetach: library.ownership delete') 41 | WHERE 42 | OLD.doc_id IN (PKGNAME); 43 | 44 | END; 45 | 46 | DROP TRIGGER IF EXISTS j_hc_ownership_blockupdate_BI; 47 | 48 | CREATE TRIGGER j_hc_ownership_blockupdate_BI BEFORE INSERT ON ownership BEGIN 49 | SELECT 50 | RAISE (ROLLBACK, 'mindetach: library.ownership insert') 51 | WHERE 52 | NEW.doc_id IN (PKGNAME); 53 | 54 | END; 55 | 56 | CREATE TRIGGER j_hc_ownership_blockupdate_BU BEFORE 57 | UPDATE ON ownership BEGIN 58 | SELECT 59 | RAISE (ROLLBACK, 'mindetach: library.ownership update') 60 | WHERE 61 | NEW.doc_id IN (PKGNAME); 62 | 63 | END; -------------------------------------------------------------------------------- /detacher/src/sql/localappstate.sql: -------------------------------------------------------------------------------- 1 | DROP TRIGGER IF EXISTS j_hc_appstate_blockupdate_BU; 2 | DROP TRIGGER IF EXISTS j_hc_appstate_blockupdate_AU; 3 | 4 | UPDATE appstate 5 | SET 6 | auto_update = 2, 7 | delivery_data_timestamp_ms = 9999999999999, 8 | last_update_timestamp_ms = 9999999999999 9 | WHERE 10 | package_name IN (PKGNAME); 11 | 12 | DROP TRIGGER IF EXISTS j_hc_appstate_blockupdate_AI; 13 | 14 | CREATE TRIGGER j_hc_appstate_blockupdate_AI AFTER INSERT ON appstate BEGIN 15 | UPDATE appstate 16 | SET 17 | auto_update = '2', 18 | delivery_data_timestamp_ms = 9999999999999, 19 | last_update_timestamp_ms = 9999999999999 20 | WHERE 21 | package_name IN (PKGNAME) 22 | AND NEW.package_name IN (PKGNAME); 23 | 24 | END; 25 | 26 | 27 | CREATE TRIGGER j_hc_appstate_blockupdate_AU AFTER 28 | UPDATE ON appstate BEGIN 29 | UPDATE appstate 30 | SET 31 | auto_update = '2', 32 | delivery_data_timestamp_ms = 9999999999999, 33 | last_update_timestamp_ms = 9999999999999 34 | WHERE 35 | package_name IN (PKGNAME) 36 | AND NEW.package_name IN (PKGNAME); 37 | 38 | END; 39 | 40 | DROP TRIGGER IF EXISTS j_hc_appstate_blockupdate_BD; 41 | 42 | CREATE TRIGGER j_hc_appstate_blockupdate_BD BEFORE DELETE ON appstate BEGIN 43 | SELECT 44 | RAISE ( 45 | ROLLBACK, 46 | 'mindetach: localappstate.appstate delete' 47 | ) 48 | WHERE 49 | OLD.package_name IN (PKGNAME); 50 | 51 | END; 52 | 53 | DROP TRIGGER IF EXISTS j_hc_appstate_blockupdate_BI; 54 | 55 | CREATE TRIGGER j_hc_appstate_blockupdate_BI BEFORE INSERT ON appstate BEGIN 56 | SELECT 57 | RAISE ( 58 | ROLLBACK, 59 | 'mindetach: localappstate.appstate insert' 60 | ) 61 | WHERE 62 | NEW.package_name IN (PKGNAME); 63 | 64 | END; 65 | 66 | CREATE TRIGGER j_hc_appstate_blockupdate_BU BEFORE 67 | UPDATE ON appstate BEGIN 68 | SELECT 69 | RAISE ( 70 | ROLLBACK, 71 | 'mindetach: localappstate.appstate update' 72 | ) 73 | WHERE 74 | NEW.package_name IN (PKGNAME); 75 | 76 | END; -------------------------------------------------------------------------------- /mindetach/META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # echo before loading util_functions 10 | ui_print() { echo "$1"; } 11 | 12 | require_new_magisk() { 13 | ui_print "*******************************" 14 | ui_print " Please install Magisk v20.4+! " 15 | ui_print "*******************************" 16 | exit 1 17 | } 18 | 19 | ######################### 20 | # Load util_functions.sh 21 | ######################### 22 | 23 | OUTFD=$2 24 | ZIPFILE=$3 25 | 26 | mount /data 2>/dev/null 27 | 28 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 29 | . /data/adb/magisk/util_functions.sh 30 | [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk 31 | 32 | install_module 33 | exit 0 34 | -------------------------------------------------------------------------------- /mindetach/META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /mindetach/customize.sh: -------------------------------------------------------------------------------- 1 | # shellcheck disable=SC2148,SC2086 2 | 3 | if [ ! -d /data/data/com.android.vending/databases ]; then 4 | ui_print "- Do not clean the data of Play Store" 5 | ui_print "- Open Play Store and reflash mindetach again!" 6 | abort "" 7 | fi 8 | 9 | mv -f $MODPATH/system/bin/mindetach-${ARCH} $MODPATH/system/bin/mindetach 10 | rm $MODPATH/system/bin/mindetach-* 11 | 12 | # preserve detach.txt 13 | cp -f $NVBASE/modules/mindetach/detach.txt $MODPATH/detach.txt 14 | 15 | am force-stop com.android.vending 16 | OP=$($MODPATH/system/bin/mindetach) 17 | C=$? 18 | am force-stop com.android.vending 19 | ui_print "$OP" 20 | 21 | if [ $C = 1 ]; then 22 | ui_print "- Immediate detach was not successful" 23 | ui_print "- This may be because you are not using Magisk Manager" 24 | ui_print "- mindetach will only work after a reboot!" 25 | fi 26 | ui_print "" 27 | ui_print " by j-hc (github.com/j-hc)" 28 | -------------------------------------------------------------------------------- /mindetach/detach.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j-hc/mindetach-magisk/7c93a47ea4de36a7b94bf326c16ddc3328fe0b1b/mindetach/detach.txt -------------------------------------------------------------------------------- /mindetach/module.prop: -------------------------------------------------------------------------------- 1 | id=mindetach 2 | name=mindetach 3 | version=v3.4 4 | versionCode=12 5 | author=j-hc 6 | description=Minimal module for detaching apps from Play Store 7 | updateJson=https://raw.githubusercontent.com/j-hc/mindetach-magisk/master/update.json 8 | -------------------------------------------------------------------------------- /mindetach/service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # shellcheck disable=SC2086 3 | MODDIR=${0%/*} 4 | until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done 5 | until [ -d /sdcard/Android ]; do sleep 1; done 6 | sleep 15 7 | 8 | am force-stop com.android.vending 9 | $MODDIR/system/bin/mindetach 10 | am force-stop com.android.vending 11 | -------------------------------------------------------------------------------- /mindetach/system/bin/mindetach-arm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j-hc/mindetach-magisk/7c93a47ea4de36a7b94bf326c16ddc3328fe0b1b/mindetach/system/bin/mindetach-arm -------------------------------------------------------------------------------- /mindetach/system/bin/mindetach-arm64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j-hc/mindetach-magisk/7c93a47ea4de36a7b94bf326c16ddc3328fe0b1b/mindetach/system/bin/mindetach-arm64 -------------------------------------------------------------------------------- /update.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v3.4", 3 | "versionCode": 12, 4 | "zipUrl": "https://github.com/j-hc/mindetach-magisk/releases/latest/download/mindetach-v3.4.zip", 5 | "changelog": "https://raw.githubusercontent.com/j-hc/mindetach-magisk/master/README.md" 6 | } --------------------------------------------------------------------------------