├── .github └── workflows │ ├── build.yml │ └── reuse.yml ├── .gitignore ├── .reuse └── dep5 ├── LICENSES ├── Apache-2.0.txt ├── CC-BY-SA-4.0.txt ├── CC0-1.0.txt └── LicenseRef-Google-Droidguasso.txt ├── app ├── build.gradle ├── libs │ ├── droidguasso.jar │ └── droidguasso.jar.license └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── org │ │ └── microg │ │ └── gms │ │ └── droidguard │ │ ├── DroidGuardDatabase.java │ │ ├── DroidGuardHelper.java │ │ ├── DroidGuassoHelper.java │ │ └── RemoteDroidGuardService.java │ └── res │ ├── mipmap-hdpi │ └── ic_core_service_app.png │ ├── mipmap-mdpi │ └── ic_core_service_app.png │ ├── mipmap-xhdpi │ └── ic_core_service_app.png │ ├── mipmap-xxhdpi │ └── ic_core_service_app.png │ ├── mipmap-xxxhdpi │ └── ic_core_service_app.png │ └── values │ └── strings.xml ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ ├── gradle-wrapper.jar.license │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── proto ├── build.gradle └── src │ └── main │ └── proto │ └── droidguard.proto ├── remote-droid-guard ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── aidl │ └── org │ │ └── microg │ │ └── gms │ │ └── droidguard │ │ ├── IRemoteDroidGuard.aidl │ │ ├── IRemoteDroidGuardCallback.aidl │ │ └── RemoteDroidGuardRequest.aidl │ └── java │ └── org │ └── microg │ └── gms │ └── droidguard │ ├── Constants.java │ ├── RemoteDroidGuardConnector.java │ └── RemoteDroidGuardRequest.java ├── scripts ├── decrypt.java └── update-droidguasso.sh └── settings.gradle /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2020 microG Team 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | name: Build 5 | on: [pull_request, push] 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | with: 12 | fetch-depth: 0 13 | - run: ./gradlew --no-daemon build 14 | env: 15 | TERM: dumb 16 | JAVA_OPTS: -Xmx2048m 17 | -------------------------------------------------------------------------------- /.github/workflows/reuse.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2020 microG Team 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | name: REUSE Compliance Check 5 | on: [pull_request, push] 6 | jobs: 7 | test: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - uses: fsfe/reuse-action@v1 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2013, microG Project Team 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | *.iml 5 | gen/ 6 | bin/ 7 | build/ 8 | .gradle/ 9 | user.gradle 10 | local.properties 11 | .directory 12 | .idea/ 13 | /scripts/decrypt.class 14 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | 3 | Files: app/src/main/protos-java/* 4 | Copyright: 2016, microG Project Team. Automatically generated from .proto file 5 | License: Apache-2.0 6 | 7 | Files: app/src/main/res/mipmap-*/*.png 8 | Copyright: 2016, microG Project Team 9 | License: CC-BY-SA-4.0 10 | -------------------------------------------------------------------------------- /LICENSES/Apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, 6 | AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | 11 | 12 | "License" shall mean the terms and conditions for use, reproduction, and distribution 13 | as defined by Sections 1 through 9 of this document. 14 | 15 | 16 | 17 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 18 | owner that is granting the License. 19 | 20 | 21 | 22 | "Legal Entity" shall mean the union of the acting entity and all other entities 23 | that control, are controlled by, or are under common control with that entity. 24 | For the purposes of this definition, "control" means (i) the power, direct 25 | or indirect, to cause the direction or management of such entity, whether 26 | by contract or otherwise, or (ii) ownership of fifty percent (50%) or more 27 | of the outstanding shares, or (iii) beneficial ownership of such entity. 28 | 29 | 30 | 31 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions 32 | granted by this License. 33 | 34 | 35 | 36 | "Source" form shall mean the preferred form for making modifications, including 37 | but not limited to software source code, documentation source, and configuration 38 | files. 39 | 40 | 41 | 42 | "Object" form shall mean any form resulting from mechanical transformation 43 | or translation of a Source form, including but not limited to compiled object 44 | code, generated documentation, and conversions to other media types. 45 | 46 | 47 | 48 | "Work" shall mean the work of authorship, whether in Source or Object form, 49 | made available under the License, as indicated by a copyright notice that 50 | is included in or attached to the work (an example is provided in the Appendix 51 | below). 52 | 53 | 54 | 55 | "Derivative Works" shall mean any work, whether in Source or Object form, 56 | that is based on (or derived from) the Work and for which the editorial revisions, 57 | annotations, elaborations, or other modifications represent, as a whole, an 58 | original work of authorship. For the purposes of this License, Derivative 59 | Works shall not include works that remain separable from, or merely link (or 60 | bind by name) to the interfaces of, the Work and Derivative Works thereof. 61 | 62 | 63 | 64 | "Contribution" shall mean any work of authorship, including the original version 65 | of the Work and any modifications or additions to that Work or Derivative 66 | Works thereof, that is intentionally submitted to Licensor for inclusion in 67 | the Work by the copyright owner or by an individual or Legal Entity authorized 68 | to submit on behalf of the copyright owner. For the purposes of this definition, 69 | "submitted" means any form of electronic, verbal, or written communication 70 | sent to the Licensor or its representatives, including but not limited to 71 | communication on electronic mailing lists, source code control systems, and 72 | issue tracking systems that are managed by, or on behalf of, the Licensor 73 | for the purpose of discussing and improving the Work, but excluding communication 74 | that is conspicuously marked or otherwise designated in writing by the copyright 75 | owner as "Not a Contribution." 76 | 77 | 78 | 79 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 80 | of whom a Contribution has been received by Licensor and subsequently incorporated 81 | within the Work. 82 | 83 | 2. Grant of Copyright License. Subject to the terms and conditions of this 84 | License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, 85 | no-charge, royalty-free, irrevocable copyright license to reproduce, prepare 86 | Derivative Works of, publicly display, publicly perform, sublicense, and distribute 87 | the Work and such Derivative Works in Source or Object form. 88 | 89 | 3. Grant of Patent License. Subject to the terms and conditions of this License, 90 | each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, 91 | no-charge, royalty-free, irrevocable (except as stated in this section) patent 92 | license to make, have made, use, offer to sell, sell, import, and otherwise 93 | transfer the Work, where such license applies only to those patent claims 94 | licensable by such Contributor that are necessarily infringed by their Contribution(s) 95 | alone or by combination of their Contribution(s) with the Work to which such 96 | Contribution(s) was submitted. If You institute patent litigation against 97 | any entity (including a cross-claim or counterclaim in a lawsuit) alleging 98 | that the Work or a Contribution incorporated within the Work constitutes direct 99 | or contributory patent infringement, then any patent licenses granted to You 100 | under this License for that Work shall terminate as of the date such litigation 101 | is filed. 102 | 103 | 4. Redistribution. You may reproduce and distribute copies of the Work or 104 | Derivative Works thereof in any medium, with or without modifications, and 105 | in Source or Object form, provided that You meet the following conditions: 106 | 107 | (a) You must give any other recipients of the Work or Derivative Works a copy 108 | of this License; and 109 | 110 | (b) You must cause any modified files to carry prominent notices stating that 111 | You changed the files; and 112 | 113 | (c) You must retain, in the Source form of any Derivative Works that You distribute, 114 | all copyright, patent, trademark, and attribution notices from the Source 115 | form of the Work, excluding those notices that do not pertain to any part 116 | of the Derivative Works; and 117 | 118 | (d) If the Work includes a "NOTICE" text file as part of its distribution, 119 | then any Derivative Works that You distribute must include a readable copy 120 | of the attribution notices contained within such NOTICE file, excluding those 121 | notices that do not pertain to any part of the Derivative Works, in at least 122 | one of the following places: within a NOTICE text file distributed as part 123 | of the Derivative Works; within the Source form or documentation, if provided 124 | along with the Derivative Works; or, within a display generated by the Derivative 125 | Works, if and wherever such third-party notices normally appear. The contents 126 | of the NOTICE file are for informational purposes only and do not modify the 127 | License. You may add Your own attribution notices within Derivative Works 128 | that You distribute, alongside or as an addendum to the NOTICE text from the 129 | Work, provided that such additional attribution notices cannot be construed 130 | as modifying the License. 131 | 132 | You may add Your own copyright statement to Your modifications and may provide 133 | additional or different license terms and conditions for use, reproduction, 134 | or distribution of Your modifications, or for any such Derivative Works as 135 | a whole, provided Your use, reproduction, and distribution of the Work otherwise 136 | complies with the conditions stated in this License. 137 | 138 | 5. Submission of Contributions. Unless You explicitly state otherwise, any 139 | Contribution intentionally submitted for inclusion in the Work by You to the 140 | Licensor shall be under the terms and conditions of this License, without 141 | any additional terms or conditions. Notwithstanding the above, nothing herein 142 | shall supersede or modify the terms of any separate license agreement you 143 | may have executed with Licensor regarding such Contributions. 144 | 145 | 6. Trademarks. This License does not grant permission to use the trade names, 146 | trademarks, service marks, or product names of the Licensor, except as required 147 | for reasonable and customary use in describing the origin of the Work and 148 | reproducing the content of the NOTICE file. 149 | 150 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to 151 | in writing, Licensor provides the Work (and each Contributor provides its 152 | Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 153 | KIND, either express or implied, including, without limitation, any warranties 154 | or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR 155 | A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness 156 | of using or redistributing the Work and assume any risks associated with Your 157 | exercise of permissions under this License. 158 | 159 | 8. Limitation of Liability. In no event and under no legal theory, whether 160 | in tort (including negligence), contract, or otherwise, unless required by 161 | applicable law (such as deliberate and grossly negligent acts) or agreed to 162 | in writing, shall any Contributor be liable to You for damages, including 163 | any direct, indirect, special, incidental, or consequential damages of any 164 | character arising as a result of this License or out of the use or inability 165 | to use the Work (including but not limited to damages for loss of goodwill, 166 | work stoppage, computer failure or malfunction, or any and all other commercial 167 | damages or losses), even if such Contributor has been advised of the possibility 168 | of such damages. 169 | 170 | 9. Accepting Warranty or Additional Liability. While redistributing the Work 171 | or Derivative Works thereof, You may choose to offer, and charge a fee for, 172 | acceptance of support, warranty, indemnity, or other liability obligations 173 | and/or rights consistent with this License. However, in accepting such obligations, 174 | You may act only on Your own behalf and on Your sole responsibility, not on 175 | behalf of any other Contributor, and only if You agree to indemnify, defend, 176 | and hold each Contributor harmless for any liability incurred by, or claims 177 | asserted against, such Contributor by reason of your accepting any such warranty 178 | or additional liability. END OF TERMS AND CONDITIONS 179 | 180 | APPENDIX: How to apply the Apache License to your work. 181 | 182 | To apply the Apache License to your work, attach the following boilerplate 183 | notice, with the fields enclosed by brackets "[]" replaced with your own identifying 184 | information. (Don't include the brackets!) The text should be enclosed in 185 | the appropriate comment syntax for the file format. We also recommend that 186 | a file or class name and description of purpose be included on the same "printed 187 | page" as the copyright notice for easier identification within third-party 188 | archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | 194 | you may not use this file except in compliance with the License. 195 | 196 | You may obtain a copy of the License at 197 | 198 | http://www.apache.org/licenses/LICENSE-2.0 199 | 200 | Unless required by applicable law or agreed to in writing, software 201 | 202 | distributed under the License is distributed on an "AS IS" BASIS, 203 | 204 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 205 | 206 | See the License for the specific language governing permissions and 207 | 208 | limitations under the License. 209 | -------------------------------------------------------------------------------- /LICENSES/CC-BY-SA-4.0.txt: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution-ShareAlike 4.0 International Creative Commons 2 | Corporation ("Creative Commons") is not a law firm and does not provide legal 3 | services or legal advice. Distribution of Creative Commons public licenses 4 | does not create a lawyer-client or other relationship. Creative Commons makes 5 | its licenses and related information available on an "as-is" basis. Creative 6 | Commons gives no warranties regarding its licenses, any material licensed 7 | under their terms and conditions, or any related information. Creative Commons 8 | disclaims all liability for damages resulting from their use to the fullest 9 | extent possible. 10 | 11 | Using Creative Commons Public Licenses 12 | 13 | Creative Commons public licenses provide a standard set of terms and conditions 14 | that creators and other rights holders may use to share original works of 15 | authorship and other material subject to copyright and certain other rights 16 | specified in the public license below. The following considerations are for 17 | informational purposes only, are not exhaustive, and do not form part of our 18 | licenses. 19 | 20 | Considerations for licensors: Our public licenses are intended for use by 21 | those authorized to give the public permission to use material in ways otherwise 22 | restricted by copyright and certain other rights. Our licenses are irrevocable. 23 | Licensors should read and understand the terms and conditions of the license 24 | they choose before applying it. Licensors should also secure all rights necessary 25 | before applying our licenses so that the public can reuse the material as 26 | expected. Licensors should clearly mark any material not subject to the license. 27 | This includes other CC-licensed material, or material used under an exception 28 | or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors 29 | 30 | Considerations for the public: By using one of our public licenses, a licensor 31 | grants the public permission to use the licensed material under specified 32 | terms and conditions. If the licensor's permission is not necessary for any 33 | reason–for example, because of any applicable exception or limitation to copyright–then 34 | that use is not regulated by the license. Our licenses grant only permissions 35 | under copyright and certain other rights that a licensor has authority to 36 | grant. Use of the licensed material may still be restricted for other reasons, 37 | including because others have copyright or other rights in the material. A 38 | licensor may make special requests, such as asking that all changes be marked 39 | or described. 40 | 41 | Although not required by our licenses, you are encouraged to respect those 42 | requests where reasonable. More considerations for the public : wiki.creativecommons.org/Considerations_for_licensees 43 | 44 | Creative Commons Attribution-ShareAlike 4.0 International Public License 45 | 46 | By exercising the Licensed Rights (defined below), You accept and agree to 47 | be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 48 | 4.0 International Public License ("Public License"). To the extent this Public 49 | License may be interpreted as a contract, You are granted the Licensed Rights 50 | in consideration of Your acceptance of these terms and conditions, and the 51 | Licensor grants You such rights in consideration of benefits the Licensor 52 | receives from making the Licensed Material available under these terms and 53 | conditions. 54 | 55 | Section 1 – Definitions. 56 | 57 | a. Adapted Material means material subject to Copyright and Similar Rights 58 | that is derived from or based upon the Licensed Material and in which the 59 | Licensed Material is translated, altered, arranged, transformed, or otherwise 60 | modified in a manner requiring permission under the Copyright and Similar 61 | Rights held by the Licensor. For purposes of this Public License, where the 62 | Licensed Material is a musical work, performance, or sound recording, Adapted 63 | Material is always produced where the Licensed Material is synched in timed 64 | relation with a moving image. 65 | 66 | b. Adapter's License means the license You apply to Your Copyright and Similar 67 | Rights in Your contributions to Adapted Material in accordance with the terms 68 | and conditions of this Public License. 69 | 70 | c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, 71 | approved by Creative Commons as essentially the equivalent of this Public 72 | License. 73 | 74 | d. Copyright and Similar Rights means copyright and/or similar rights closely 75 | related to copyright including, without limitation, performance, broadcast, 76 | sound recording, and Sui Generis Database Rights, without regard to how the 77 | rights are labeled or categorized. For purposes of this Public License, the 78 | rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 79 | 80 | e. Effective Technological Measures means those measures that, in the absence 81 | of proper authority, may not be circumvented under laws fulfilling obligations 82 | under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, 83 | and/or similar international agreements. 84 | 85 | f. Exceptions and Limitations means fair use, fair dealing, and/or any other 86 | exception or limitation to Copyright and Similar Rights that applies to Your 87 | use of the Licensed Material. 88 | 89 | g. License Elements means the license attributes listed in the name of a Creative 90 | Commons Public License. The License Elements of this Public License are Attribution 91 | and ShareAlike. 92 | 93 | h. Licensed Material means the artistic or literary work, database, or other 94 | material to which the Licensor applied this Public License. 95 | 96 | i. Licensed Rights means the rights granted to You subject to the terms and 97 | conditions of this Public License, which are limited to all Copyright and 98 | Similar Rights that apply to Your use of the Licensed Material and that the 99 | Licensor has authority to license. 100 | 101 | j. Licensor means the individual(s) or entity(ies) granting rights under this 102 | Public License. 103 | 104 | k. Share means to provide material to the public by any means or process that 105 | requires permission under the Licensed Rights, such as reproduction, public 106 | display, public performance, distribution, dissemination, communication, or 107 | importation, and to make material available to the public including in ways 108 | that members of the public may access the material from a place and at a time 109 | individually chosen by them. 110 | 111 | l. Sui Generis Database Rights means rights other than copyright resulting 112 | from Directive 96/9/EC of the European Parliament and of the Council of 11 113 | March 1996 on the legal protection of databases, as amended and/or succeeded, 114 | as well as other essentially equivalent rights anywhere in the world. 115 | 116 | m. You means the individual or entity exercising the Licensed Rights under 117 | this Public License. Your has a corresponding meaning. 118 | 119 | Section 2 – Scope. 120 | 121 | a. License grant. 122 | 123 | 1. Subject to the terms and conditions of this Public License, the Licensor 124 | hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, 125 | irrevocable license to exercise the Licensed Rights in the Licensed Material 126 | to: 127 | 128 | A. reproduce and Share the Licensed Material, in whole or in part; and 129 | 130 | B. produce, reproduce, and Share Adapted Material. 131 | 132 | 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions 133 | and Limitations apply to Your use, this Public License does not apply, and 134 | You do not need to comply with its terms and conditions. 135 | 136 | 3. Term. The term of this Public License is specified in Section 6(a). 137 | 138 | 4. Media and formats; technical modifications allowed. The Licensor authorizes 139 | You to exercise the Licensed Rights in all media and formats whether now known 140 | or hereafter created, and to make technical modifications necessary to do 141 | so. The Licensor waives and/or agrees not to assert any right or authority 142 | to forbid You from making technical modifications necessary to exercise the 143 | Licensed Rights, including technical modifications necessary to circumvent 144 | Effective Technological Measures. For purposes of this Public License, simply 145 | making modifications authorized by this Section 2(a)(4) never produces Adapted 146 | Material. 147 | 148 | 5. Downstream recipients. 149 | 150 | A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed 151 | Material automatically receives an offer from the Licensor to exercise the 152 | Licensed Rights under the terms and conditions of this Public License. 153 | 154 | B. Additional offer from the Licensor – Adapted Material. Every recipient 155 | of Adapted Material from You automatically receives an offer from the Licensor 156 | to exercise the Licensed Rights in the Adapted Material under the conditions 157 | of the Adapter's License You apply. 158 | 159 | C. No downstream restrictions. You may not offer or impose any additional 160 | or different terms or conditions on, or apply any Effective Technological 161 | Measures to, the Licensed Material if doing so restricts exercise of the Licensed 162 | Rights by any recipient of the Licensed Material. 163 | 164 | 6. No endorsement. Nothing in this Public License constitutes or may be construed 165 | as permission to assert or imply that You are, or that Your use of the Licensed 166 | Material is, connected with, or sponsored, endorsed, or granted official status 167 | by, the Licensor or others designated to receive attribution as provided in 168 | Section 3(a)(1)(A)(i). 169 | 170 | b. Other rights. 171 | 172 | 1. Moral rights, such as the right of integrity, are not licensed under this 173 | Public License, nor are publicity, privacy, and/or other similar personality 174 | rights; however, to the extent possible, the Licensor waives and/or agrees 175 | not to assert any such rights held by the Licensor to the limited extent necessary 176 | to allow You to exercise the Licensed Rights, but not otherwise. 177 | 178 | 2. Patent and trademark rights are not licensed under this Public License. 179 | 180 | 3. To the extent possible, the Licensor waives any right to collect royalties 181 | from You for the exercise of the Licensed Rights, whether directly or through 182 | a collecting society under any voluntary or waivable statutory or compulsory 183 | licensing scheme. In all other cases the Licensor expressly reserves any right 184 | to collect such royalties. 185 | 186 | Section 3 – License Conditions. 187 | 188 | Your exercise of the Licensed Rights is expressly made subject to the following 189 | conditions. 190 | 191 | a. Attribution. 192 | 193 | 1. If You Share the Licensed Material (including in modified form), You must: 194 | 195 | A. retain the following if it is supplied by the Licensor with the Licensed 196 | Material: 197 | 198 | i. identification of the creator(s) of the Licensed Material and any others 199 | designated to receive attribution, in any reasonable manner requested by the 200 | Licensor (including by pseudonym if designated); 201 | 202 | ii. a copyright notice; 203 | 204 | iii. a notice that refers to this Public License; 205 | 206 | iv. a notice that refers to the disclaimer of warranties; 207 | 208 | v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 209 | 210 | B. indicate if You modified the Licensed Material and retain an indication 211 | of any previous modifications; and 212 | 213 | C. indicate the Licensed Material is licensed under this Public License, and 214 | include the text of, or the URI or hyperlink to, this Public License. 215 | 216 | 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner 217 | based on the medium, means, and context in which You Share the Licensed Material. 218 | For example, it may be reasonable to satisfy the conditions by providing a 219 | URI or hyperlink to a resource that includes the required information. 220 | 221 | 3. If requested by the Licensor, You must remove any of the information required 222 | by Section 3(a)(1)(A) to the extent reasonably practicable. 223 | 224 | b. ShareAlike.In addition to the conditions in Section 3(a), if You Share 225 | Adapted Material You produce, the following conditions also apply. 226 | 227 | 1. The Adapter's License You apply must be a Creative Commons license with 228 | the same License Elements, this version or later, or a BY-SA Compatible License. 229 | 230 | 2. You must include the text of, or the URI or hyperlink to, the Adapter's 231 | License You apply. You may satisfy this condition in any reasonable manner 232 | based on the medium, means, and context in which You Share Adapted Material. 233 | 234 | 3. You may not offer or impose any additional or different terms or conditions 235 | on, or apply any Effective Technological Measures to, Adapted Material that 236 | restrict exercise of the rights granted under the Adapter's License You apply. 237 | 238 | Section 4 – Sui Generis Database Rights. 239 | 240 | Where the Licensed Rights include Sui Generis Database Rights that apply to 241 | Your use of the Licensed Material: 242 | 243 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, 244 | reuse, reproduce, and Share all or a substantial portion of the contents of 245 | the database; 246 | 247 | b. if You include all or a substantial portion of the database contents in 248 | a database in which You have Sui Generis Database Rights, then the database 249 | in which You have Sui Generis Database Rights (but not its individual contents) 250 | is Adapted Material, including for purposes of Section 3(b); and 251 | 252 | c. You must comply with the conditions in Section 3(a) if You Share all or 253 | a substantial portion of the contents of the database. 254 | 255 | For the avoidance of doubt, this Section 4 supplements and does not replace 256 | Your obligations under this Public License where the Licensed Rights include 257 | other Copyright and Similar Rights. 258 | 259 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 260 | 261 | a. Unless otherwise separately undertaken by the Licensor, to the extent possible, 262 | the Licensor offers the Licensed Material as-is and as-available, and makes 263 | no representations or warranties of any kind concerning the Licensed Material, 264 | whether express, implied, statutory, or other. This includes, without limitation, 265 | warranties of title, merchantability, fitness for a particular purpose, non-infringement, 266 | absence of latent or other defects, accuracy, or the presence or absence of 267 | errors, whether or not known or discoverable. Where disclaimers of warranties 268 | are not allowed in full or in part, this disclaimer may not apply to You. 269 | 270 | b. To the extent possible, in no event will the Licensor be liable to You 271 | on any legal theory (including, without limitation, negligence) or otherwise 272 | for any direct, special, indirect, incidental, consequential, punitive, exemplary, 273 | or other losses, costs, expenses, or damages arising out of this Public License 274 | or use of the Licensed Material, even if the Licensor has been advised of 275 | the possibility of such losses, costs, expenses, or damages. Where a limitation 276 | of liability is not allowed in full or in part, this limitation may not apply 277 | to You. 278 | 279 | c. The disclaimer of warranties and limitation of liability provided above 280 | shall be interpreted in a manner that, to the extent possible, most closely 281 | approximates an absolute disclaimer and waiver of all liability. 282 | 283 | Section 6 – Term and Termination. 284 | 285 | a. This Public License applies for the term of the Copyright and Similar Rights 286 | licensed here. However, if You fail to comply with this Public License, then 287 | Your rights under this Public License terminate automatically. 288 | 289 | b. Where Your right to use the Licensed Material has terminated under Section 290 | 6(a), it reinstates: 291 | 292 | 1. automatically as of the date the violation is cured, provided it is cured 293 | within 30 days of Your discovery of the violation; or 294 | 295 | 2. upon express reinstatement by the Licensor. 296 | 297 | c. For the avoidance of doubt, this Section 6(b) does not affect any right 298 | the Licensor may have to seek remedies for Your violations of this Public 299 | License. 300 | 301 | d. For the avoidance of doubt, the Licensor may also offer the Licensed Material 302 | under separate terms or conditions or stop distributing the Licensed Material 303 | at any time; however, doing so will not terminate this Public License. 304 | 305 | e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 306 | 307 | Section 7 – Other Terms and Conditions. 308 | 309 | a. The Licensor shall not be bound by any additional or different terms or 310 | conditions communicated by You unless expressly agreed. 311 | 312 | b. Any arrangements, understandings, or agreements regarding the Licensed 313 | Material not stated herein are separate from and independent of the terms 314 | and conditions of this Public License. 315 | 316 | Section 8 – Interpretation. 317 | 318 | a. For the avoidance of doubt, this Public License does not, and shall not 319 | be interpreted to, reduce, limit, restrict, or impose conditions on any use 320 | of the Licensed Material that could lawfully be made without permission under 321 | this Public License. 322 | 323 | b. To the extent possible, if any provision of this Public License is deemed 324 | unenforceable, it shall be automatically reformed to the minimum extent necessary 325 | to make it enforceable. If the provision cannot be reformed, it shall be severed 326 | from this Public License without affecting the enforceability of the remaining 327 | terms and conditions. 328 | 329 | c. No term or condition of this Public License will be waived and no failure 330 | to comply consented to unless expressly agreed to by the Licensor. 331 | 332 | d. Nothing in this Public License constitutes or may be interpreted as a limitation 333 | upon, or waiver of, any privileges and immunities that apply to the Licensor 334 | or You, including from the legal processes of any jurisdiction or authority. 335 | 336 | Creative Commons is not a party to its public licenses. Notwithstanding, Creative 337 | Commons may elect to apply one of its public licenses to material it publishes 338 | and in those instances will be considered the "Licensor." The text of the 339 | Creative Commons public licenses is dedicated to the public domain under the 340 | CC0 Public Domain Dedication. Except for the limited purpose of indicating 341 | that material is shared under a Creative Commons public license or as otherwise 342 | permitted by the Creative Commons policies published at creativecommons.org/policies, 343 | Creative Commons does not authorize the use of the trademark "Creative Commons" 344 | or any other trademark or logo of Creative Commons without its prior written 345 | consent including, without limitation, in connection with any unauthorized 346 | modifications to any of its public licenses or any other arrangements, understandings, 347 | or agreements concerning use of licensed material. For the avoidance of doubt, 348 | this paragraph does not form part of the public licenses. 349 | 350 | Creative Commons may be contacted at creativecommons.org. 351 | -------------------------------------------------------------------------------- /LICENSES/CC0-1.0.txt: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES 4 | NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE 5 | AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION 6 | ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE 7 | OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS 8 | LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION 9 | OR WORKS PROVIDED HEREUNDER. 10 | 11 | Statement of Purpose 12 | 13 | The laws of most jurisdictions throughout the world automatically confer exclusive 14 | Copyright and Related Rights (defined below) upon the creator and subsequent 15 | owner(s) (each and all, an "owner") of an original work of authorship and/or 16 | a database (each, a "Work"). 17 | 18 | Certain owners wish to permanently relinquish those rights to a Work for the 19 | purpose of contributing to a commons of creative, cultural and scientific 20 | works ("Commons") that the public can reliably and without fear of later claims 21 | of infringement build upon, modify, incorporate in other works, reuse and 22 | redistribute as freely as possible in any form whatsoever and for any purposes, 23 | including without limitation commercial purposes. These owners may contribute 24 | to the Commons to promote the ideal of a free culture and the further production 25 | of creative, cultural and scientific works, or to gain reputation or greater 26 | distribution for their Work in part through the use and efforts of others. 27 | 28 | For these and/or other purposes and motivations, and without any expectation 29 | of additional consideration or compensation, the person associating CC0 with 30 | a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright 31 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work 32 | and publicly distribute the Work under its terms, with knowledge of his or 33 | her Copyright and Related Rights in the Work and the meaning and intended 34 | legal effect of CC0 on those rights. 35 | 36 | 1. Copyright and Related Rights. A Work made available under CC0 may be protected 37 | by copyright and related or neighboring rights ("Copyright and Related Rights"). 38 | Copyright and Related Rights include, but are not limited to, the following: 39 | 40 | i. the right to reproduce, adapt, distribute, perform, display, communicate, 41 | and translate a Work; 42 | 43 | ii. moral rights retained by the original author(s) and/or performer(s); 44 | 45 | iii. publicity and privacy rights pertaining to a person's image or likeness 46 | depicted in a Work; 47 | 48 | iv. rights protecting against unfair competition in regards to a Work, subject 49 | to the limitations in paragraph 4(a), below; 50 | 51 | v. rights protecting the extraction, dissemination, use and reuse of data 52 | in a Work; 53 | 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal protection 56 | of databases, and under any national implementation thereof, including any 57 | amended or successor version of such directive); and 58 | 59 | vii. other similar, equivalent or corresponding rights throughout the world 60 | based on applicable law or treaty, and any national implementations thereof. 61 | 62 | 2. Waiver. To the greatest extent permitted by, but not in contravention of, 63 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and 64 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright 65 | and Related Rights and associated claims and causes of action, whether now 66 | known or unknown (including existing as well as future claims and causes of 67 | action), in the Work (i) in all territories worldwide, (ii) for the maximum 68 | duration provided by applicable law or treaty (including future time extensions), 69 | (iii) in any current or future medium and for any number of copies, and (iv) 70 | for any purpose whatsoever, including without limitation commercial, advertising 71 | or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the 72 | benefit of each member of the public at large and to the detriment of Affirmer's 73 | heirs and successors, fully intending that such Waiver shall not be subject 74 | to revocation, rescission, cancellation, termination, or any other legal or 75 | equitable action to disrupt the quiet enjoyment of the Work by the public 76 | as contemplated by Affirmer's express Statement of Purpose. 77 | 78 | 3. Public License Fallback. Should any part of the Waiver for any reason be 79 | judged legally invalid or ineffective under applicable law, then the Waiver 80 | shall be preserved to the maximum extent permitted taking into account Affirmer's 81 | express Statement of Purpose. In addition, to the extent the Waiver is so 82 | judged Affirmer hereby grants to each affected person a royalty-free, non 83 | transferable, non sublicensable, non exclusive, irrevocable and unconditional 84 | license to exercise Affirmer's Copyright and Related Rights in the Work (i) 85 | in all territories worldwide, (ii) for the maximum duration provided by applicable 86 | law or treaty (including future time extensions), (iii) in any current or 87 | future medium and for any number of copies, and (iv) for any purpose whatsoever, 88 | including without limitation commercial, advertising or promotional purposes 89 | (the "License"). The License shall be deemed effective as of the date CC0 90 | was applied by Affirmer to the Work. Should any part of the License for any 91 | reason be judged legally invalid or ineffective under applicable law, such 92 | partial invalidity or ineffectiveness shall not invalidate the remainder of 93 | the License, and in such case Affirmer hereby affirms that he or she will 94 | not (i) exercise any of his or her remaining Copyright and Related Rights 95 | in the Work or (ii) assert any associated claims and causes of action with 96 | respect to the Work, in either case contrary to Affirmer's express Statement 97 | of Purpose. 98 | 99 | 4. Limitations and Disclaimers. 100 | 101 | a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, 102 | licensed or otherwise affected by this document. 103 | 104 | b. Affirmer offers the Work as-is and makes no representations or warranties 105 | of any kind concerning the Work, express, implied, statutory or otherwise, 106 | including without limitation warranties of title, merchantability, fitness 107 | for a particular purpose, non infringement, or the absence of latent or other 108 | defects, accuracy, or the present or absence of errors, whether or not discoverable, 109 | all to the greatest extent permissible under applicable law. 110 | 111 | c. Affirmer disclaims responsibility for clearing rights of other persons 112 | that may apply to the Work or any use thereof, including without limitation 113 | any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims 114 | responsibility for obtaining any necessary consents, permissions or other 115 | rights required for any use of the Work. 116 | 117 | d. Affirmer understands and acknowledges that Creative Commons is not a party 118 | to this document and has no duty or obligation with respect to this CC0 or 119 | use of the Work. 120 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-Google-Droidguasso.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Google. All rights reserved. 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | apply plugin: 'com.android.application' 7 | 8 | repositories { 9 | flatDir { 10 | dirs 'libs' 11 | } 12 | } 13 | 14 | dependencies { 15 | implementation "com.squareup.wire:wire-runtime:$wireVersion" 16 | implementation ':droidguasso:@jar' 17 | implementation project(':proto') 18 | implementation project(':remote-droid-guard') 19 | } 20 | 21 | android { 22 | compileSdkVersion androidCompileSdk 23 | buildToolsVersion "$androidBuildVersionTools" 24 | 25 | defaultConfig { 26 | versionName version 27 | versionCode appVersionCode 28 | minSdkVersion androidMinSdk 29 | targetSdkVersion androidTargetSdk 30 | } 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | lintOptions { 38 | disable "InvalidPackage" 39 | } 40 | 41 | dexOptions { 42 | additionalParameters "--core-library" 43 | } 44 | } 45 | 46 | if (file('user.gradle').exists()) { 47 | apply from: 'user.gradle' 48 | } 49 | -------------------------------------------------------------------------------- /app/libs/droidguasso.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/RemoteDroidGuard/6e966812659a430f5bb02df56eb399c48901f7d2/app/libs/droidguasso.jar -------------------------------------------------------------------------------- /app/libs/droidguasso.jar.license: -------------------------------------------------------------------------------- 1 | Copyright the original author or authors, all rights reserved. 2 | SPDX-License-Identifier: LicenseRef-Google-Droidguasso 3 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/org/microg/gms/droidguard/DroidGuardDatabase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2020, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | import android.content.Context; 9 | import android.database.sqlite.SQLiteDatabase; 10 | import android.database.sqlite.SQLiteOpenHelper; 11 | 12 | public class DroidGuardDatabase extends SQLiteOpenHelper { 13 | private static final String DB_NAME = "dg.db"; 14 | 15 | public DroidGuardDatabase(Context context) { 16 | super(context, DB_NAME, null, 2); 17 | } 18 | 19 | @Override 20 | public void onCreate(SQLiteDatabase db) { 21 | // Note: "NON NULL" is actually not a valid sqlite constraint, but this is what we see in the original database *shrug* 22 | db.execSQL("CREATE TABLE main (a TEXT NOT NULL, b LONG NOT NULL, c LONG NOT NULL, d TEXT NON NULL, e TEXT NON NULL,f BLOB NOT NULL,g BLOB NOT NULL);"); 23 | } 24 | 25 | @Override 26 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 27 | db.execSQL("DROP TABLE IF EXISTS main;"); 28 | onCreate(db); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/org/microg/gms/droidguard/DroidGuardHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | import android.content.Context; 9 | import android.os.Build; 10 | import android.os.Bundle; 11 | import android.text.TextUtils; 12 | import android.util.Base64; 13 | import android.util.Log; 14 | 15 | import java.io.ByteArrayInputStream; 16 | import java.io.ByteArrayOutputStream; 17 | import java.io.File; 18 | import java.io.FileOutputStream; 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | import java.io.OutputStream; 22 | import java.lang.reflect.Field; 23 | import java.net.HttpURLConnection; 24 | import java.net.URL; 25 | import java.nio.ByteBuffer; 26 | import java.nio.CharBuffer; 27 | import java.nio.charset.Charset; 28 | import java.nio.charset.CharsetDecoder; 29 | import java.util.ArrayList; 30 | import java.util.Arrays; 31 | import java.util.Enumeration; 32 | import java.util.HashMap; 33 | import java.util.List; 34 | import java.util.Map; 35 | import java.util.zip.GZIPInputStream; 36 | import java.util.zip.ZipEntry; 37 | import java.util.zip.ZipFile; 38 | 39 | import dalvik.system.DexClassLoader; 40 | import okio.ByteString; 41 | 42 | public class DroidGuardHelper { 43 | private static final String TAG = "GmsDroidGuardHelper"; 44 | private static final String DG_CLASS_NAME = "com.google.ccc.abuse.droidguard.DroidGuard"; 45 | private static final String DG_URL = "https://www.googleapis.com/androidantiabuse/v1/x/create?alt=PROTO&key=AIzaSyBofcZsgLSS7BOnBjZPEkk4rYwzOIz-lTI"; 46 | private static Map> loadedClass = new HashMap<>(); 47 | 48 | public static byte[] guard(Context context, RemoteDroidGuardRequest request) throws Exception { 49 | int versionCode = context.getPackageManager().getPackageInfo(Constants.GMS_PACKAGE_NAME, 0).versionCode; 50 | 51 | // Ensure database exists 52 | new DroidGuardDatabase(context).getReadableDatabase().close(); 53 | 54 | SignedDGResponse signedResponse = request(new DGRequest.Builder() 55 | .usage(new DGUsage(request.reason, request.packageName, ByteString.EMPTY)) 56 | .info(getSystemInfo(null)) 57 | .isGoogleCn(false) 58 | .enableInlineVm(true) 59 | .currentVersion(3) 60 | .versionNamePrefix(gmsVersionNamePrefix(versionCode, Build.CPU_ABI)) 61 | .cached(getCached(context)) 62 | .arch(getArch()) 63 | .build(), 64 | versionCode); 65 | DGResponse response = DGResponse.ADAPTER.decode(signedResponse.data.toByteArray()); 66 | String checksum = response.vmChecksum.hex(); 67 | File dgCacheDir = context.getDir("dg_cache", 0); 68 | File dgDir = new File(dgCacheDir, checksum); 69 | dgDir.mkdirs(); 70 | File dgFile = new File(dgDir, "the.apk"); 71 | downloadAndPrepareDg(response, dgCacheDir, dgDir, dgFile); 72 | 73 | Class clazz; 74 | if (!loadedClass.containsKey(checksum)) { 75 | ClassLoader loader = new DexClassLoader(new File(dgDir, "the.apk").getAbsolutePath(), 76 | new File(dgDir, "opt").getAbsolutePath(), new File(dgDir, "lib").getAbsolutePath(), context.getClassLoader()); 77 | clazz = loader.loadClass(DG_CLASS_NAME); 78 | loadedClass.put(checksum, clazz); 79 | } else { 80 | clazz = loadedClass.get(checksum); 81 | } 82 | 83 | return invoke(context, clazz, request.packageName, request.reason, response.byteCode.toByteArray(), request.androidIdLong, request.extras); 84 | } 85 | 86 | public static int gmsVersionCode(int versionCode, String arch) { 87 | versionCode -= versionCode % 1000; 88 | switch (arch) { 89 | case "arm64-v8a": 90 | return versionCode + 23; 91 | case "x86": 92 | return versionCode + 26; 93 | case "x86_64": 94 | return versionCode + 27; 95 | default: 96 | return versionCode + 19; 97 | } 98 | } 99 | 100 | public static String gmsVersionNamePrefix(int versionCode, String arch) { 101 | int minor, patch; 102 | versionCode /= 1000; 103 | patch = versionCode % 100; 104 | versionCode /= 100; 105 | minor = versionCode % 100; 106 | versionCode /= 100; 107 | String versionPrefix = versionCode + "." + minor + "." + patch; 108 | switch (arch) { 109 | case "arm64-v8a": 110 | return versionPrefix + " (040400-{{cl}})"; 111 | case "x86": 112 | case "x86_64": 113 | return versionPrefix + " (040700-{{cl}})"; 114 | default: 115 | return versionPrefix + " (040300-{{cl}})"; 116 | } 117 | } 118 | 119 | public static byte[] invoke(Context context, Class clazz, String packageName, String type, byte[] byteCode, String androidIdLong, Bundle extras) throws InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, NoSuchMethodException { 120 | Object instance = clazz 121 | .getDeclaredConstructor(Context.class, String.class, byte[].class, Object.class) 122 | .newInstance(context, type, byteCode, new Callback(packageName, androidIdLong)); 123 | final Map map = new HashMap<>(); 124 | if (extras != null) { 125 | for (String key : extras.keySet()) { 126 | String val = extras.getString(key); 127 | if (val != null) map.put(key, val); 128 | } 129 | } 130 | return (byte[]) clazz.getMethod("run", Map.class).invoke(instance, map); 131 | } 132 | 133 | private static List getSystemInfo(Object build) { 134 | Class clazz = build == null ? Build.class : build.getClass(); 135 | return Arrays.asList( 136 | createSystemInfoPair("BOARD", clazz, build), 137 | createSystemInfoPair("BOOTLOADER", clazz, build), 138 | createSystemInfoPair("BRAND", clazz, build), 139 | createSystemInfoPair("CPU_ABI", clazz, build), 140 | createSystemInfoPair("CPU_ABI2", clazz, build), 141 | createSystemInfoPair("SUPPORTED_ABIS", clazz, build), 142 | createSystemInfoPair("DEVICE", clazz, build), 143 | createSystemInfoPair("DISPLAY", clazz, build), 144 | createSystemInfoPair("FINGERPRINT", clazz, build), 145 | createSystemInfoPair("HARDWARE", clazz, build), 146 | createSystemInfoPair("HOST", clazz, build), 147 | createSystemInfoPair("ID", clazz, build), 148 | createSystemInfoPair("MANUFACTURER", clazz, build), 149 | createSystemInfoPair("MODEL", clazz, build), 150 | createSystemInfoPair("PRODUCT", clazz, build), 151 | createSystemInfoPair("RADIO", clazz, build), 152 | createSystemInfoPair("SERIAL", clazz, build), 153 | createSystemInfoPair("TAGS", clazz, build), 154 | createSystemInfoPair("TIME", clazz, build), 155 | createSystemInfoPair("TYPE", clazz, build), 156 | createSystemInfoPair("USER", clazz, build), 157 | createSystemInfoPair("VERSION.CODENAME", clazz, build), 158 | createSystemInfoPair("VERSION.INCREMENTAL", clazz, build), 159 | createSystemInfoPair("VERSION.RELEASE", clazz, build), 160 | createSystemInfoPair("VERSION.SDK", clazz, build), 161 | createSystemInfoPair("VERSION.SDK_INT", clazz, build)); 162 | } 163 | 164 | private static KeyValuePair createSystemInfoPair(final String key, final Class clazz, final Object obj) { 165 | try { 166 | String[] tr = key.split("\\."); 167 | Class nuClass = clazz; 168 | Object nuObj = obj; 169 | for (int i = 0; i < tr.length - 1; i++) { 170 | try { 171 | Field field = nuClass.getField(tr[i]); 172 | nuObj = field.get(nuObj); 173 | nuClass = field.getType(); 174 | } catch (NoSuchFieldException ne) { 175 | if (obj == null && nuObj == null) { 176 | for (Class aClass : nuClass.getDeclaredClasses()) { 177 | String name = aClass.getCanonicalName().replace('$', '.'); 178 | String guessedName = nuClass.getCanonicalName().replace('$', '.') + "." + tr[i]; 179 | if (name.equals(guessedName)) { 180 | nuClass = aClass; 181 | break; 182 | } 183 | } 184 | } 185 | } 186 | } 187 | String nuKey = tr[tr.length - 1]; 188 | Object val = nuClass.getField(nuKey).get(nuObj); 189 | if (val instanceof String[]) 190 | return new KeyValuePair(nuKey, TextUtils.join(",", (String[]) val), ByteString.EMPTY); 191 | else 192 | return new KeyValuePair(nuKey, String.valueOf(val), ByteString.EMPTY); 193 | } catch (Exception e) { 194 | if (obj != null) { 195 | // fallback to real system info 196 | return createSystemInfoPair(key, Build.class, null); 197 | } 198 | Log.w(TAG, e); 199 | return new KeyValuePair(key, "unknown", ByteString.EMPTY); 200 | } 201 | } 202 | 203 | private static List getCached(Context context) { 204 | List res = new ArrayList<>(); 205 | File dgDir = context.getDir("dg_cache", 0); 206 | for (String cache : dgDir.list()) { 207 | if (new File(dgDir, cache).isDirectory()) { 208 | res.add(ByteString.decodeHex(cache)); 209 | } 210 | } 211 | return res; 212 | } 213 | 214 | private static void downloadAndPrepareDg(DGResponse response, File dgCacheDir, File dgDir, File dgFile) throws IOException { 215 | File dgCacheFile = new File(dgCacheDir, response.vmChecksum.hex() + ".apk"); 216 | if (!dgFile.exists()) { 217 | if (response.content == null) { 218 | Log.d(TAG, "Downloading DG implementation from " + response.vmUrl + " to " + dgCacheFile); 219 | InputStream is = new URL(response.vmUrl).openStream(); 220 | streamToFile(is, dgCacheFile); 221 | } else { 222 | Log.d(TAG, "Using provided response data for " + dgCacheFile); 223 | FileOutputStream fos = new FileOutputStream(dgCacheFile); 224 | fos.write(response.content.toByteArray()); 225 | fos.close(); 226 | } 227 | new File(dgDir, "opt").mkdirs(); 228 | File libDir = new File(dgDir, "lib"); 229 | libDir.mkdirs(); 230 | ZipFile zipFile = new ZipFile(dgCacheFile); 231 | Enumeration entries = zipFile.entries(); 232 | while (entries.hasMoreElements()) { 233 | ZipEntry entry = entries.nextElement(); 234 | if (!entry.isDirectory()) { 235 | String name = entry.getName(); 236 | String targetName; 237 | if (name.startsWith("lib/" + Build.CPU_ABI + "/")) { 238 | targetName = name.substring(Build.CPU_ABI.length() + 5); 239 | } else if (name.startsWith("lib/" + Build.CPU_ABI2 + "/")) { 240 | targetName = name.substring(Build.CPU_ABI2.length() + 5); 241 | } else { 242 | continue; 243 | } 244 | streamToFile(zipFile.getInputStream(entry), new File(libDir, targetName)); 245 | } 246 | } 247 | dgCacheFile.renameTo(dgFile); 248 | } else { 249 | Log.d(TAG, "Using cached file from " + dgFile); 250 | } 251 | } 252 | 253 | private static void streamToFile(InputStream is, File targetFile) throws IOException { 254 | FileOutputStream fos = new FileOutputStream(targetFile); 255 | byte[] bytes = new byte[1024]; 256 | while (true) { 257 | int n = is.read(bytes); 258 | if (n < 0) { 259 | break; 260 | } 261 | fos.write(bytes, 0, n); 262 | } 263 | is.close(); 264 | fos.close(); 265 | } 266 | 267 | private static String getArch() { 268 | try { 269 | return System.getProperty("os.arch"); 270 | } catch (Exception ex) { 271 | return ""; 272 | } 273 | } 274 | 275 | private static SignedDGResponse request(DGRequest request, int versionCode) throws IOException { 276 | HttpURLConnection connection = (HttpURLConnection) new URL(DG_URL).openConnection(); 277 | connection.setRequestMethod("POST"); 278 | connection.setDoInput(true); 279 | connection.setDoOutput(true); 280 | connection.setRequestProperty("Content-Type", "application/x-protobuf"); 281 | connection.setRequestProperty("Accept-Encoding", "gzip"); 282 | connection.setRequestProperty("User-Agent", "DroidGuard/" + gmsVersionCode(versionCode, Build.CPU_ABI)); 283 | 284 | Log.d(TAG, "-- Request --\n" + request); 285 | OutputStream os = connection.getOutputStream(); 286 | os.write(request.encode()); 287 | os.close(); 288 | 289 | if (connection.getResponseCode() != 200) { 290 | byte[] bytes = null; 291 | String ex; 292 | try { 293 | bytes = readStreamToEnd(connection.getErrorStream()); 294 | ex = new String(readStreamToEnd(new GZIPInputStream(new ByteArrayInputStream(bytes)))); 295 | } catch (Exception e) { 296 | if (bytes != null) { 297 | throw new IOException(getBytesAsString(bytes), e); 298 | } 299 | throw new IOException(connection.getResponseMessage(), e); 300 | } 301 | throw new IOException(ex); 302 | } 303 | 304 | InputStream is = connection.getInputStream(); 305 | SignedDGResponse response = SignedDGResponse.ADAPTER.decode(new GZIPInputStream(is)); 306 | is.close(); 307 | return response; 308 | } 309 | 310 | private static byte[] readStreamToEnd(final InputStream is) throws IOException { 311 | final ByteArrayOutputStream bos = new ByteArrayOutputStream(); 312 | if (is != null) { 313 | final byte[] buff = new byte[1024]; 314 | int read; 315 | do { 316 | bos.write(buff, 0, (read = is.read(buff)) < 0 ? 0 : read); 317 | } while (read >= 0); 318 | is.close(); 319 | } 320 | return bos.toByteArray(); 321 | } 322 | 323 | private static String getBytesAsString(byte[] bytes) { 324 | if (bytes == null) return "null"; 325 | try { 326 | CharsetDecoder d = Charset.forName("US-ASCII").newDecoder(); 327 | CharBuffer r = d.decode(ByteBuffer.wrap(bytes)); 328 | return r.toString(); 329 | } catch (Exception e) { 330 | return Base64.encodeToString(bytes, Base64.NO_WRAP); 331 | } 332 | } 333 | 334 | public static final class Callback { 335 | 336 | private String packageName; 337 | private String androidIdLong; 338 | 339 | public Callback(String packageName, String androidIdLong) { 340 | this.packageName = packageName; 341 | this.androidIdLong = androidIdLong; 342 | } 343 | 344 | public final String a(final byte[] array) { 345 | String guasso = new String(DroidGuassoHelper.guasso(array)); 346 | Log.d(TAG, "a: " + Base64.encodeToString(array, Base64.NO_WRAP) + " -> " + guasso); 347 | return guasso; 348 | } 349 | 350 | public final String b() { 351 | Log.d(TAG, "b -> " + androidIdLong); 352 | return androidIdLong; 353 | } 354 | 355 | public final String c() { 356 | Log.d(TAG, "c -> " + packageName); 357 | return packageName; 358 | } 359 | 360 | public final void d(final Object o, final byte[] array) { 361 | Log.d(TAG, "d: " + o + ", " + Base64.encodeToString(array, Base64.NO_WRAP)); 362 | } 363 | } 364 | } 365 | -------------------------------------------------------------------------------- /app/src/main/java/org/microg/gms/droidguard/DroidGuassoHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | import com.google.ccc.abuse.droidguard.droidguasso.Droidguasso; 9 | 10 | import java.io.File; 11 | import java.io.FileInputStream; 12 | import java.io.FilenameFilter; 13 | import java.nio.ByteBuffer; 14 | import java.nio.ByteOrder; 15 | import java.security.MessageDigest; 16 | import java.security.NoSuchAlgorithmException; 17 | import java.util.ArrayList; 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | import okio.ByteString; 22 | 23 | /** 24 | * DroidGuasso helper class. It hashes some files up to a size of 1024 bytes and feeds them with a digest into DroidGuasso 25 | */ 26 | public class DroidGuassoHelper { 27 | private static final String TAG = "GmsDroidGuassoHelper"; 28 | 29 | private char[] HEX_CHARS = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; 30 | 31 | /** 32 | * Makes a call to DroidGuasso. 33 | * 34 | * @param digest A digest array to feed into DroidGuasso 35 | * @return DroidGuasso output data to further process 36 | */ 37 | public static byte[] guasso(byte[] digest) { 38 | List substrs = new ArrayList<>(); 39 | addFilesInPath("/vendor/lib/egl", substrs); //Hashing all EGL libs in /vendor 40 | addFilesInPath("/system/lib/egl", substrs); //Hashing all EGL libs in /system 41 | Collections.sort(substrs); 42 | substrs.add(initialBytesDigest(new File("/system/lib/egl/egl.cfg"))); //Hashing the EGL config 43 | String eglInfo = hexDigest(substrs.toString().getBytes()); //SHA-1 hashing the toString() of an object? 44 | 45 | 46 | float[] floats = new float[]{0.35502917f, 0.47196686f, 0.24689609f, 0.66850024f, 0.7746259f, 0.5967446f, 0.06270856f, 0.19201201f, 0.35090452f, 0.5573558f, 0.470259f, 0.9866341f}; 47 | if (digest != null && digest.length >= 48) { 48 | ByteBuffer order = ByteBuffer.wrap(digest).order(ByteOrder.LITTLE_ENDIAN); 49 | for (int i = 0; i < 12; i++) { 50 | floats[i] = ((float) Math.abs(order.getInt())) / 2.14748365E9f; 51 | } 52 | } 53 | 54 | Droidguasso dg = new Droidguasso(); 55 | dg.render(floats); 56 | 57 | return ("5=" + eglInfo + "\n7=" + dg.getGpu() + "\n8=" + dg.getHash1() + "\n9=" + dg.getHash2() + "\n").getBytes(); 58 | } 59 | 60 | /** 61 | * SHA-1 hashes file contents. Max size is 1024 bytes. 62 | * 63 | * @param file A file object which contents to hash 64 | * @return Returns the hash 65 | */ 66 | private static String initialBytesDigest(File file) { 67 | try { 68 | FileInputStream is = new FileInputStream(file); 69 | byte[] bytes = new byte[(int) Math.min(1024, file.length())]; 70 | is.read(bytes); 71 | is.close(); 72 | return hexDigest(bytes); 73 | } catch (Exception e) { 74 | return ""; 75 | } 76 | } 77 | 78 | /** 79 | * SHA-1 hashes an byte array 80 | * 81 | * @param bytes Bytes to hash 82 | * @return Returns the hash 83 | */ 84 | private static String hexDigest(byte[] bytes) { 85 | try { 86 | return ByteString.of(MessageDigest.getInstance("SHA-1").digest(bytes)).hex(); 87 | } catch (NoSuchAlgorithmException e) { 88 | return ""; 89 | } 90 | } 91 | 92 | /** 93 | * Finds ".so" files in a directory and adds their SHA-1 hashed content to a given {@link List} object. 94 | * Representation in the list as follows: 95 | * {@literal //} 96 | * 97 | * @param path the parent directory to search for ".so" files 98 | * @param list the list to add the 99 | */ 100 | private static void addFilesInPath(String path, List list) { 101 | final File parent = new File(path); 102 | if (parent.isDirectory()) { 103 | final File[] listFiles = parent.listFiles((dir, filename) -> filename.endsWith(".so")); 104 | for (File file : listFiles) { 105 | list.add(file.getName() + "/" + file.length() + "/" + initialBytesDigest(file)); 106 | } 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /app/src/main/java/org/microg/gms/droidguard/RemoteDroidGuardService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | import android.app.Service; 9 | import android.content.Intent; 10 | import android.os.IBinder; 11 | import android.os.RemoteException; 12 | import android.util.Log; 13 | 14 | public class RemoteDroidGuardService extends Service { 15 | private static final String TAG = "GmsDroidGuardRemote"; 16 | 17 | @Override 18 | public IBinder onBind(Intent intent) { 19 | return new IRemoteDroidGuard.Stub() { 20 | 21 | @Override 22 | public void guard(final IRemoteDroidGuardCallback callback, final RemoteDroidGuardRequest request) throws RemoteException { 23 | 24 | new Thread(new Runnable() { 25 | @Override 26 | public void run() { 27 | try { 28 | callback.onResult(DroidGuardHelper.guard(RemoteDroidGuardService.this, request)); 29 | } catch (Exception e) { 30 | Log.w(TAG, e); 31 | try { 32 | callback.onError(e.getMessage()); 33 | } catch (RemoteException e1) { 34 | stopSelf(); 35 | } 36 | } 37 | } 38 | }).start(); 39 | } 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_core_service_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/RemoteDroidGuard/6e966812659a430f5bb02df56eb399c48901f7d2/app/src/main/res/mipmap-hdpi/ic_core_service_app.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_core_service_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/RemoteDroidGuard/6e966812659a430f5bb02df56eb399c48901f7d2/app/src/main/res/mipmap-mdpi/ic_core_service_app.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_core_service_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/RemoteDroidGuard/6e966812659a430f5bb02df56eb399c48901f7d2/app/src/main/res/mipmap-xhdpi/ic_core_service_app.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_core_service_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/RemoteDroidGuard/6e966812659a430f5bb02df56eb399c48901f7d2/app/src/main/res/mipmap-xxhdpi/ic_core_service_app.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_core_service_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/RemoteDroidGuard/6e966812659a430f5bb02df56eb399c48901f7d2/app/src/main/res/mipmap-xxxhdpi/ic_core_service_app.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | microG DroidGuard Helper 9 | 10 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | buildscript { 7 | ext.safeParcelVersion = '1.7.0' 8 | 9 | ext.kotlinVersion = '1.4.10' 10 | 11 | ext.wireVersion = '3.2.2' 12 | 13 | ext.androidBuildGradleVersion = '3.6.3' 14 | 15 | ext.androidBuildVersionTools = '29.0.3' 16 | 17 | ext.androidMinSdk = 9 18 | ext.androidTargetSdk = 29 19 | ext.androidCompileSdk = 30 20 | 21 | repositories { 22 | jcenter() 23 | google() 24 | } 25 | 26 | dependencies { 27 | classpath "com.android.tools.build:gradle:$androidBuildGradleVersion" 28 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" 29 | classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion" 30 | } 31 | } 32 | 33 | String gitDescribeVersion() { 34 | def stdout = new ByteArrayOutputStream() 35 | if (rootProject.file("gradlew").exists()) 36 | exec { commandLine 'git', 'describe', '--tags', '--always', '--dirty'; standardOutput = stdout } 37 | else // automatic build system, don't tag dirty 38 | exec { commandLine 'git', 'describe', '--tags', '--always'; standardOutput = stdout } 39 | return stdout.toString().trim().substring(1) 40 | } 41 | 42 | int gitCountCommits() { 43 | def stdout = new ByteArrayOutputStream() 44 | exec { 45 | commandLine 'git', 'rev-list', '--count', "HEAD" 46 | standardOutput = stdout 47 | } 48 | return Integer.parseInt(stdout.toString().trim()) 49 | } 50 | 51 | allprojects { 52 | apply plugin: 'idea' 53 | 54 | version = gitDescribeVersion() 55 | ext.appVersionCode = gitCountCommits() 56 | } 57 | 58 | subprojects { 59 | repositories { 60 | jcenter() 61 | google() 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/RemoteDroidGuard/6e966812659a430f5bb02df56eb399c48901f7d2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar.license: -------------------------------------------------------------------------------- 1 | Copyright 2015 the original author or authors. 2 | SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2016, microG Project Team 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | distributionBase=GRADLE_USER_HOME 5 | distributionPath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | # Copyright 2015 the original author or authors. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | ############################################################################## 21 | ## 22 | ## Gradle start up script for UN*X 23 | ## 24 | ############################################################################## 25 | 26 | # Attempt to set APP_HOME 27 | # Resolve links: $0 may be a link 28 | PRG="$0" 29 | # Need this for relative symlinks. 30 | while [ -h "$PRG" ] ; do 31 | ls=`ls -ld "$PRG"` 32 | link=`expr "$ls" : '.*-> \(.*\)$'` 33 | if expr "$link" : '/.*' > /dev/null; then 34 | PRG="$link" 35 | else 36 | PRG=`dirname "$PRG"`"/$link" 37 | fi 38 | done 39 | SAVED="`pwd`" 40 | cd "`dirname \"$PRG\"`/" >/dev/null 41 | APP_HOME="`pwd -P`" 42 | cd "$SAVED" >/dev/null 43 | 44 | APP_NAME="Gradle" 45 | APP_BASE_NAME=`basename "$0"` 46 | 47 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 48 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 49 | 50 | # Use the maximum available, or set MAX_FD != -1 to use that value. 51 | MAX_FD="maximum" 52 | 53 | warn () { 54 | echo "$*" 55 | } 56 | 57 | die () { 58 | echo 59 | echo "$*" 60 | echo 61 | exit 1 62 | } 63 | 64 | # OS specific support (must be 'true' or 'false'). 65 | cygwin=false 66 | msys=false 67 | darwin=false 68 | nonstop=false 69 | case "`uname`" in 70 | CYGWIN* ) 71 | cygwin=true 72 | ;; 73 | Darwin* ) 74 | darwin=true 75 | ;; 76 | MINGW* ) 77 | msys=true 78 | ;; 79 | NONSTOP* ) 80 | nonstop=true 81 | ;; 82 | esac 83 | 84 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 85 | 86 | 87 | # Determine the Java command to use to start the JVM. 88 | if [ -n "$JAVA_HOME" ] ; then 89 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 90 | # IBM's JDK on AIX uses strange locations for the executables 91 | JAVACMD="$JAVA_HOME/jre/sh/java" 92 | else 93 | JAVACMD="$JAVA_HOME/bin/java" 94 | fi 95 | if [ ! -x "$JAVACMD" ] ; then 96 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 97 | 98 | Please set the JAVA_HOME variable in your environment to match the 99 | location of your Java installation." 100 | fi 101 | else 102 | JAVACMD="java" 103 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 104 | 105 | Please set the JAVA_HOME variable in your environment to match the 106 | location of your Java installation." 107 | fi 108 | 109 | # Increase the maximum file descriptors if we can. 110 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 111 | MAX_FD_LIMIT=`ulimit -H -n` 112 | if [ $? -eq 0 ] ; then 113 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 114 | MAX_FD="$MAX_FD_LIMIT" 115 | fi 116 | ulimit -n $MAX_FD 117 | if [ $? -ne 0 ] ; then 118 | warn "Could not set maximum file descriptor limit: $MAX_FD" 119 | fi 120 | else 121 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 122 | fi 123 | fi 124 | 125 | # For Darwin, add options to specify how the application appears in the dock 126 | if $darwin; then 127 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 128 | fi 129 | 130 | # For Cygwin or MSYS, switch paths to Windows format before running java 131 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 132 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 133 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 134 | 135 | JAVACMD=`cygpath --unix "$JAVACMD"` 136 | 137 | # We build the pattern for arguments to be converted via cygpath 138 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 139 | SEP="" 140 | for dir in $ROOTDIRSRAW ; do 141 | ROOTDIRS="$ROOTDIRS$SEP$dir" 142 | SEP="|" 143 | done 144 | OURCYGPATTERN="(^($ROOTDIRS))" 145 | # Add a user-defined pattern to the cygpath arguments 146 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 147 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 148 | fi 149 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 150 | i=0 151 | for arg in "$@" ; do 152 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 153 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 154 | 155 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 156 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 157 | else 158 | eval `echo args$i`="\"$arg\"" 159 | fi 160 | i=`expr $i + 1` 161 | done 162 | case $i in 163 | 0) set -- ;; 164 | 1) set -- "$args0" ;; 165 | 2) set -- "$args0" "$args1" ;; 166 | 3) set -- "$args0" "$args1" "$args2" ;; 167 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 168 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 169 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 170 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 171 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 172 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 173 | esac 174 | fi 175 | 176 | # Escape application args 177 | save () { 178 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 179 | echo " " 180 | } 181 | APP_ARGS=`save "$@"` 182 | 183 | # Collect all arguments for the java command, following the shell quoting and substitution rules 184 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 185 | 186 | exec "$JAVACMD" "$@" 187 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem SPDX-License-Identifier: Apache-2.0 2 | @rem 3 | @rem Copyright 2015 the original author or authors. 4 | @rem 5 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 6 | @rem you may not use this file except in compliance with the License. 7 | @rem You may obtain a copy of the License at 8 | @rem 9 | @rem https://www.apache.org/licenses/LICENSE-2.0 10 | @rem 11 | @rem Unless required by applicable law or agreed to in writing, software 12 | @rem distributed under the License is distributed on an "AS IS" BASIS, 13 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | @rem See the License for the specific language governing permissions and 15 | @rem limitations under the License. 16 | @rem 17 | 18 | @if "%DEBUG%" == "" @echo off 19 | @rem ########################################################################## 20 | @rem 21 | @rem Gradle startup script for Windows 22 | @rem 23 | @rem ########################################################################## 24 | 25 | @rem Set local scope for the variables with windows NT shell 26 | if "%OS%"=="Windows_NT" setlocal 27 | 28 | set DIRNAME=%~dp0 29 | if "%DIRNAME%" == "" set DIRNAME=. 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if "%ERRORLEVEL%" == "0" goto init 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto init 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :init 69 | @rem Get command-line arguments, handling Windows variants 70 | 71 | if not "%OS%" == "Windows_NT" goto win9xME_args 72 | 73 | :win9xME_args 74 | @rem Slurp the command line arguments. 75 | set CMD_LINE_ARGS= 76 | set _SKIP=2 77 | 78 | :win9xME_args_slurp 79 | if "x%~1" == "x" goto execute 80 | 81 | set CMD_LINE_ARGS=%* 82 | 83 | :execute 84 | @rem Setup the command line 85 | 86 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 87 | 88 | 89 | @rem Execute Gradle 90 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 91 | 92 | :end 93 | @rem End local scope for the variables with windows NT shell 94 | if "%ERRORLEVEL%"=="0" goto mainEnd 95 | 96 | :fail 97 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 98 | rem the _cmd.exe /c_ return code! 99 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 100 | exit /b 1 101 | 102 | :mainEnd 103 | if "%OS%"=="Windows_NT" endlocal 104 | 105 | :omega 106 | -------------------------------------------------------------------------------- /proto/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2020, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | apply plugin: 'com.squareup.wire' 7 | apply plugin: 'kotlin' 8 | 9 | dependencies { 10 | implementation "com.squareup.wire:wire-runtime:$wireVersion" 11 | } 12 | 13 | wire { 14 | kotlin { 15 | javaInterop = true 16 | } 17 | } 18 | 19 | sourceSets { 20 | main.java.srcDirs += "$buildDir/generated/source/wire" 21 | } 22 | 23 | compileKotlin { 24 | kotlinOptions.jvmTarget = 1.8 25 | } 26 | 27 | compileTestKotlin { 28 | kotlinOptions.jvmTarget = 1.8 29 | } 30 | -------------------------------------------------------------------------------- /proto/src/main/proto/droidguard.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | option java_package = "org.microg.gms.droidguard"; 7 | 8 | message DGUsage { 9 | optional string type = 1; 10 | optional string packageName = 2; 11 | } 12 | 13 | message KeyValuePair { 14 | optional string key = 1; 15 | optional string val = 2; 16 | } 17 | 18 | message DGRequest { 19 | optional DGUsage usage = 1; 20 | repeated KeyValuePair info = 2; 21 | optional string versionNamePrefix = 3; 22 | optional bool hasAccount = 6; 23 | optional bool isGoogleCn = 7; 24 | optional bool enableInlineVm = 8; 25 | repeated bytes cached = 9; 26 | optional int32 currentVersion = 13; 27 | optional string arch = 14; 28 | } 29 | 30 | message SignedDGResponse { 31 | optional bytes data = 1; 32 | optional bytes sig = 2; 33 | } 34 | 35 | message DGResponse { 36 | optional bytes byteCode = 1; 37 | optional string vmUrl = 2; 38 | optional bytes vmChecksum = 3; 39 | optional int32 expiryTimeSecs = 4; 40 | optional bytes content = 5; 41 | } 42 | -------------------------------------------------------------------------------- /remote-droid-guard/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | apply plugin: 'com.android.library' 7 | apply plugin: 'maven-publish' 8 | apply plugin: 'signing' 9 | 10 | dependencies { 11 | implementation "org.microg:safe-parcel:$safeParcelVersion" 12 | } 13 | 14 | group = 'org.microg.gms' 15 | 16 | android { 17 | compileSdkVersion androidCompileSdk 18 | buildToolsVersion "$androidBuildVersionTools" 19 | 20 | defaultConfig { 21 | versionName version 22 | minSdkVersion androidMinSdk 23 | } 24 | 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | afterEvaluate { 32 | publishing { 33 | publications { 34 | release(MavenPublication) { 35 | pom { 36 | name = 'Remote DroidGuard Client' 37 | description = 'Remote DroidGuard client library' 38 | url = 'https://github.com/microg/RemoteDroidGuard' 39 | licenses { 40 | license { 41 | name = 'The Apache Software License, Version 2.0' 42 | url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 43 | } 44 | } 45 | developers { 46 | developer { 47 | id = 'microg' 48 | name = 'microG Team' 49 | } 50 | developer { 51 | id = 'mar-v-in' 52 | name = 'Marvin W.' 53 | } 54 | } 55 | scm { 56 | url = 'https://github.com/microg/RemoteDroidGuard' 57 | connection = 'scm:git:https://github.com/microg/RemoteDroidGuard.git' 58 | developerConnection = 'scm:git:ssh://github.com/microg/RemoteDroidGuard.git' 59 | } 60 | } 61 | 62 | from components.release 63 | } 64 | } 65 | if (project.hasProperty('sonatype.username')) { 66 | repositories { 67 | maven { 68 | name = 'sonatype' 69 | url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' 70 | credentials { 71 | username project.getProperty('sonatype.username') 72 | password project.getProperty('sonatype.password') 73 | } 74 | } 75 | } 76 | } 77 | } 78 | if (project.hasProperty('signing.keyId')) { 79 | signing { 80 | sign publishing.publications 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /remote-droid-guard/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /remote-droid-guard/src/main/aidl/org/microg/gms/droidguard/IRemoteDroidGuard.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | import org.microg.gms.droidguard.IRemoteDroidGuardCallback; 9 | import org.microg.gms.droidguard.RemoteDroidGuardRequest; 10 | 11 | interface IRemoteDroidGuard { 12 | void guard(IRemoteDroidGuardCallback callbach, in RemoteDroidGuardRequest request) = 0; 13 | } 14 | -------------------------------------------------------------------------------- /remote-droid-guard/src/main/aidl/org/microg/gms/droidguard/IRemoteDroidGuardCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | interface IRemoteDroidGuardCallback { 9 | void onResult(in byte[] result) = 0; 10 | void onError(String msg) = 1; 11 | } 12 | -------------------------------------------------------------------------------- /remote-droid-guard/src/main/aidl/org/microg/gms/droidguard/RemoteDroidGuardRequest.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | parcelable RemoteDroidGuardRequest; 9 | -------------------------------------------------------------------------------- /remote-droid-guard/src/main/java/org/microg/gms/droidguard/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | public class Constants { 9 | public static final String GMS_PACKAGE_NAME = "com.google.android.gms"; 10 | } 11 | -------------------------------------------------------------------------------- /remote-droid-guard/src/main/java/org/microg/gms/droidguard/RemoteDroidGuardConnector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | import android.content.ComponentName; 9 | import android.content.Context; 10 | import android.content.Intent; 11 | import android.content.ServiceConnection; 12 | import android.os.Bundle; 13 | import android.os.IBinder; 14 | import android.os.RemoteException; 15 | import android.util.Log; 16 | 17 | import java.util.concurrent.CountDownLatch; 18 | import java.util.concurrent.TimeUnit; 19 | 20 | public class RemoteDroidGuardConnector { 21 | private static final String TAG = "GmsDroidGuardConn"; 22 | 23 | private Context context; 24 | 25 | public RemoteDroidGuardConnector(Context context) { 26 | this.context = context; 27 | } 28 | 29 | public Result guard(final String type, final String androidIdLong) { 30 | return guard(type, androidIdLong, new Bundle()); 31 | } 32 | 33 | public synchronized Result guard(final String type, final String androidIdLong, final Bundle extras) { 34 | final Result res = new Result(); 35 | res.statusCode = 14; 36 | connectForTask(new Task() { 37 | @Override 38 | public void run(IRemoteDroidGuard remote, final ServiceConnection connection, final CountDownLatch countDownLatch) { 39 | try { 40 | RemoteDroidGuardRequest request = new RemoteDroidGuardRequest(); 41 | request.packageName = context.getPackageName(); 42 | request.reason = type; 43 | request.androidIdLong = androidIdLong; 44 | request.extras = extras; 45 | remote.guard(new IRemoteDroidGuardCallback.Stub() { 46 | @Override 47 | public void onResult(byte[] result) throws RemoteException { 48 | res.result = result; 49 | res.statusCode = 0; 50 | countDownLatch.countDown(); 51 | context.unbindService(connection); 52 | } 53 | 54 | @Override 55 | public void onError(String err) throws RemoteException { 56 | res.statusCode = 8; 57 | res.errorMsg = err; 58 | countDownLatch.countDown(); 59 | context.unbindService(connection); 60 | } 61 | }, request); 62 | } catch (RemoteException e) { 63 | Log.w(TAG, e); 64 | res.statusCode = 8; 65 | countDownLatch.countDown(); 66 | } 67 | } 68 | }); 69 | return res; 70 | } 71 | 72 | @Deprecated 73 | public Result guard(String type, String androidIdLong, Bundle extras, String id1, String id2) { 74 | return guard(type, androidIdLong, extras); 75 | } 76 | 77 | private boolean connectForTask(Task todo) { 78 | CountDownLatch countDownLatch = new CountDownLatch(1); 79 | 80 | Intent intent = new Intent("org.microg.gms.droidguard.REMOTE"); 81 | intent.setPackage("org.microg.gms.droidguard"); 82 | 83 | Connection c = new Connection(countDownLatch, todo); 84 | 85 | try { 86 | if (!context.bindService(intent, c, Context.BIND_AUTO_CREATE)) { 87 | return false; 88 | } 89 | } catch (SecurityException e) { 90 | return false; 91 | } 92 | 93 | try { 94 | countDownLatch.await(30, TimeUnit.SECONDS); 95 | } catch (InterruptedException e) { 96 | 97 | } 98 | 99 | // When calling DroidguardHelper.guard(), process com.google.android.gms.unstable dies often 100 | // thanks to com.google.ccc.abuse.droidguard.DroidGuard 101 | // However, because of the above bindService, the process persists for a while in zombie state, 102 | // and only next SafetyNetClientService calls that touch RemoteDroidGuardService make the process 103 | // really go away (onDestroy gets called on RemoteDroidGuardService), with logcat getting the 104 | // "Service org.microg.gms.snet.SafetyNetClientService has leaked ServiceConnection 105 | // org.microg.gms.droidguard.RemoteDroidGuardConnector$Connection" message 106 | // By unbinding here, the process is terminated immediately, and no more leaks are happening 107 | try { 108 | context.unbindService(c); 109 | } catch (Exception ignored) { 110 | } 111 | 112 | return true; 113 | } 114 | 115 | private interface Task { 116 | void run(IRemoteDroidGuard remote, ServiceConnection connection, CountDownLatch countDownLatch); 117 | } 118 | 119 | private class Connection implements ServiceConnection { 120 | 121 | private CountDownLatch countDownLatch; 122 | private Task todo; 123 | 124 | public Connection(CountDownLatch countDownLatch, Task todo) { 125 | this.countDownLatch = countDownLatch; 126 | this.todo = todo; 127 | } 128 | 129 | @Override 130 | public void onServiceConnected(ComponentName name, IBinder service) { 131 | try { 132 | if (todo != null) { 133 | todo.run(IRemoteDroidGuard.Stub.asInterface(service), this, countDownLatch); 134 | } 135 | todo = null; 136 | } catch (Exception e) { 137 | context.unbindService(this); 138 | } 139 | } 140 | 141 | @Override 142 | public void onServiceDisconnected(ComponentName name) { 143 | countDownLatch.countDown(); 144 | } 145 | } 146 | 147 | public class Result { 148 | private byte[] result; 149 | private int statusCode; 150 | private String errorMsg; 151 | 152 | public byte[] getResult() { 153 | return result; 154 | } 155 | 156 | public int getStatusCode() { 157 | return statusCode; 158 | } 159 | 160 | public String getErrorMsg() { 161 | return errorMsg; 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /remote-droid-guard/src/main/java/org/microg/gms/droidguard/RemoteDroidGuardRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.microg.gms.droidguard; 7 | 8 | import android.os.Bundle; 9 | 10 | import org.microg.safeparcel.AutoSafeParcelable; 11 | import org.microg.safeparcel.SafeParceled; 12 | 13 | public class RemoteDroidGuardRequest extends AutoSafeParcelable { 14 | 15 | // should match caller 16 | @SafeParceled(1) 17 | public String packageName; 18 | 19 | // Where to put this DroidGuard response, known values: "attest", "fast" 20 | @SafeParceled(2) 21 | public String reason; 22 | 23 | // From GSettings store 24 | @SafeParceled(3) 25 | public String androidIdLong; 26 | 27 | // additional fields, known key: "contentBinding" 28 | @SafeParceled(100) 29 | public Bundle extras; 30 | 31 | public RemoteDroidGuardRequest() { 32 | 33 | } 34 | 35 | public static final Creator CREATOR = new AutoCreator<>(RemoteDroidGuardRequest.class); 36 | } 37 | -------------------------------------------------------------------------------- /scripts/decrypt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | import java.io.InputStream; 7 | import java.io.ByteArrayOutputStream; 8 | import java.io.FileInputStream; 9 | import java.io.FileOutputStream; 10 | import java.security.spec.AlgorithmParameterSpec; 11 | import java.security.Key; 12 | import javax.crypto.spec.IvParameterSpec; 13 | import javax.crypto.spec.SecretKeySpec; 14 | import javax.crypto.Cipher; 15 | import java.io.File; 16 | import java.io.IOException; 17 | 18 | public class decrypt { 19 | public static void main(String[] args) throws Exception { 20 | IvParameterSpec iv = new IvParameterSpec(new byte[] { 1, 33, 13, 28, 87, 122, 25, 5, 4, 30, 22, 101, 5, 50, 12, 0 }); 21 | byte[] key = new byte[16]; 22 | byte[] bytes = "96a176a2e35d8ae4".getBytes(); 23 | for (int n = 0; n < 16 && n < bytes.length; ++n) { 24 | key[n] = bytes[n]; 25 | } 26 | SecretKeySpec k = new SecretKeySpec(key, "AES"); 27 | Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding"); 28 | c.init(2, k, iv); 29 | byte[] res = c.doFinal(readStreamToEnd(new FileInputStream(new File(args[0])))); 30 | FileOutputStream fos = new FileOutputStream(new File(args[1])); 31 | fos.write(res); 32 | fos.close(); 33 | } 34 | 35 | public static byte[] readStreamToEnd(final InputStream is) throws IOException { 36 | final ByteArrayOutputStream bos = new ByteArrayOutputStream(); 37 | if (is != null) { 38 | final byte[] buff = new byte[1024]; 39 | int read; 40 | do { 41 | bos.write(buff, 0, (read = is.read(buff)) < 0 ? 0 : read); 42 | } while (read >= 0); 43 | is.close(); 44 | } 45 | return bos.toByteArray(); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /scripts/update-droidguasso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-FileCopyrightText: 2016, microG Project Team 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | SCRIPT=`readlink -f "$0"` 6 | SCRIPTPATH=`dirname "$SCRIPT"` 7 | DG=`readlink -f "$1"` 8 | 9 | D2J_NAMES="d2j-dex2jar.sh d2j-dex2jar dex2jar.sh dex2jar" 10 | for i in $D2J_NAMES; do 11 | d2j=`which d2j-dex2jar.sh` 12 | if [ "$d2j" = "" ]; then break; fi 13 | done 14 | if [ "$d2j" = "" ]; then 15 | echo "dex2jar not found, please make sure dex2jar is in \$PATH with one of these names: $D2J_NAMES" 16 | exit 1 17 | fi 18 | echo "Found dex2jar: $d2j" 19 | 20 | javac=`which javac` 21 | if [ "$javac" = "" ]; then 22 | echo "javac not found, please make sure javac is in \$PATH" 23 | exit 1 24 | fi 25 | echo "Found javac: $javac" 26 | 27 | java=`which java` 28 | if [ "$java" = "" ]; then 29 | echo "java not found, please make sure java is in \$PATH" 30 | exit 1 31 | fi 32 | echo "Found java: $java" 33 | 34 | faketime=`which faketime` 35 | if [ "$faketime" = "" ]; then 36 | echo "faketime not found, please make sure faketime is in \$PATH" 37 | exit 1 38 | fi 39 | echo "Found faketime: $faketime" 40 | 41 | TMPDIR=`mktemp -d` 42 | cd $SCRIPTPATH 43 | echo "Compiling decryptor" 44 | $javac decrypt.java 45 | echo "Decrypting $DG to $TMPDIR/droidguasso.apk" 46 | $java decrypt "$DG" "$TMPDIR/droidguasso.apk" 47 | $faketime -f '1970-01-01 01:00:00' $d2j -f -o "../app/libs/droidguasso.jar" "$TMPDIR/droidguasso.apk" 48 | rm -rf "$TMPDIR" 49 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, microG Project Team 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | include ':app' 7 | include ':proto' 8 | include ':remote-droid-guard' 9 | --------------------------------------------------------------------------------