diff --git a/.github/matchers/gradle-build-kotlin-error-matcher.json b/.github/matchers/gradle-build-kotlin-error-matcher.json deleted file mode 100644 index bd9e8762..00000000 --- a/.github/matchers/gradle-build-kotlin-error-matcher.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "gradle-build-kotlin-error-matcher", - "severity": "error", - "pattern": [ - { - "regexp": "^e:\\sfile:\/\/([^:]+):(\\d+):(\\d+)\\s(.+)$", - "file": 1, - "line": 2, - "column": 3, - "message": 4 - } - ] - } - ] -} diff --git a/.github/matchers/gradle-build-kotlin-error-matcher.json.license b/.github/matchers/gradle-build-kotlin-error-matcher.json.license deleted file mode 100644 index f24ebfe5..00000000 --- a/.github/matchers/gradle-build-kotlin-error-matcher.json.license +++ /dev/null @@ -1,2 +0,0 @@ -SPDX-FileCopyrightText: none -SPDX-License-Identifier: CC0-1.0 diff --git a/.github/matchers/gradle-build-matcher.json b/.github/matchers/gradle-build-matcher.json deleted file mode 100644 index df09e4f4..00000000 --- a/.github/matchers/gradle-build-matcher.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "gradle-build-matcher", - "pattern": [ - { - "regexp": "^\\s*([^:]+):(\\d+):\\s(error|Error):\\s(.+)$", - "file": 1, - "line": 2, - "severity": 3, - "message": 4 - } - ] - } - ] -} diff --git a/.github/matchers/gradle-build-matcher.json.license b/.github/matchers/gradle-build-matcher.json.license deleted file mode 100644 index f24ebfe5..00000000 --- a/.github/matchers/gradle-build-matcher.json.license +++ /dev/null @@ -1,2 +0,0 @@ -SPDX-FileCopyrightText: none -SPDX-License-Identifier: CC0-1.0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 0bd69ddc..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: "Gradle build" -permissions: {} -on: - - push - - pull_request - - workflow_dispatch - -jobs: - build: - name: "Gradle build" - runs-on: ubuntu-latest - - steps: - - name: "Checkout sources" - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: "Setup Java" - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: "17" - - name: "Gradle Wrapper validation" - uses: gradle/wrapper-validation-action@v2 - - name: "Setup Gradle" - uses: gradle/actions/setup-gradle@v3 - - name: "Setup matchers" - run: | - # Setting up matchers... - - matchers_dir='${{ github.workspace }}/.github/matchers' - matcher_list() - { - echo 'gradle-build-matcher.json' - echo 'gradle-build-kotlin-error-matcher.json' - } - - matcher_list | while IFS='' read -r NAME; do - if test -f "${matchers_dir:?}/${NAME:?}"; then - echo "::add-matcher::${matchers_dir:?}/${NAME:?}" - echo "Matcher configured: ${NAME:?}" - fi - done - - name: "Execute Gradle assemble" - run: "./gradlew --no-daemon assemble" - - name: "Execute Gradle check" - run: "./gradlew --no-daemon check" diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml deleted file mode 100644 index 1913b6f2..00000000 --- a/.github/workflows/debug.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Debug APK Builder - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: JDK 8 Setup - uses: actions/setup-java@v1 - with: - java-version: 11.0.8 - - - name: Install NDK - run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669" - - - name: Grant rights - run: chmod +x ./gradlew - - - name: Build project - run: ./gradlew build - - - name: Build APK - run: ./gradlew assembleDebug - - - name: Upload to Artifacts - uses: actions/upload-artifact@v2 - with: - name: 'MicroG' - path: play-services-core/build/outputs/apk/debug/play-services-core-debug.apk \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ec5fff5e..00000000 --- a/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -*.iml -gen/ -bin/ -build/ -.gradle/ -.idea/ -user.gradle -local.properties -.directory -play-services-core/release - -.settings -.classpath -.project \ No newline at end of file diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 2f7c68b6..00000000 --- a/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2015 μg Project Team -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := GmsCore -LOCAL_MODULE_TAGS := optional -LOCAL_PACKAGE_NAME := GmsCore - -gmscore_root := $(LOCAL_PATH) -gmscore_dir := play-services-core -gmscore_out := $(TARGET_COMMON_OUT_ROOT)/obj/APPS/$(LOCAL_MODULE)_intermediates -gmscore_build := $(gmscore_dir)/build -gmscore_apk := $(gmscore_build)/outputs/apk/release/play-services-core-release-unsigned.apk - -$(gmscore_root)/$(gmscore_apk): - rm -Rf $(gmscore_root)/$(gmscore_build) - mkdir -p $(ANDROID_BUILD_TOP)/$(gmscore_out) - ln -s $(ANDROID_BUILD_TOP)/$(gmscore_out) $(ANDROID_BUILD_TOP)/$(gmscore_root)/$(gmscore_build) - echo "sdk.dir=$(ANDROID_HOME)" > $(gmscore_root)/local.properties - cd $(gmscore_root) && git submodule update --recursive --init - cd $(gmscore_root)/$(gmscore_dir) && JAVA_TOOL_OPTIONS="$(JAVA_TOOL_OPTIONS) -Dfile.encoding=UTF8" ../gradlew assembleRelease - -LOCAL_CERTIFICATE := platform -LOCAL_SRC_FILES := $(gmscore_apk) -LOCAL_MODULE_CLASS := APPS -LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) - -include $(BUILD_PREBUILT) \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f433b1a5..00000000 --- a/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt deleted file mode 100644 index 4ed90b95..00000000 --- a/LICENSES/Apache-2.0.txt +++ /dev/null @@ -1,208 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, -AND DISTRIBUTION - - 1. Definitions. - - - -"License" shall mean the terms and conditions for use, reproduction, and distribution -as defined by Sections 1 through 9 of this document. - - - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - - - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct -or indirect, to cause the direction or management of such entity, whether -by contract or otherwise, or (ii) ownership of fifty percent (50%) or more -of the outstanding shares, or (iii) beneficial ownership of such entity. - - - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions -granted by this License. - - - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - - - -"Object" form shall mean any form resulting from mechanical transformation -or translation of a Source form, including but not limited to compiled object -code, generated documentation, and conversions to other media types. - - - -"Work" shall mean the work of authorship, whether in Source or Object form, -made available under the License, as indicated by a copyright notice that -is included in or attached to the work (an example is provided in the Appendix -below). - - - -"Derivative Works" shall mean any work, whether in Source or Object form, -that is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative -Works shall not include works that remain separable from, or merely link (or -bind by name) to the interfaces of, the Work and Derivative Works thereof. - - - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative -Works thereof, that is intentionally submitted to Licensor for inclusion in -the Work by the copyright owner or by an individual or Legal Entity authorized -to submit on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication -sent to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor -for the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - - - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently incorporated -within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this -License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable copyright license to reproduce, prepare -Derivative Works of, publicly display, publicly perform, sublicense, and distribute -the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, -each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) patent -license to make, have made, use, offer to sell, sell, import, and otherwise -transfer the Work, where such license applies only to those patent claims -licensable by such Contributor that are necessarily infringed by their Contribution(s) -alone or by combination of their Contribution(s) with the Work to which such -Contribution(s) was submitted. If You institute patent litigation against -any entity (including a cross-claim or counterclaim in a lawsuit) alleging -that the Work or a Contribution incorporated within the Work constitutes direct -or contributory patent infringement, then any patent licenses granted to You -under this License for that Work shall terminate as of the date such litigation -is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or -Derivative Works thereof in any medium, with or without modifications, and -in Source or Object form, provided that You meet the following conditions: - -(a) You must give any other recipients of the Work or Derivative Works a copy -of this License; and - -(b) You must cause any modified files to carry prominent notices stating that -You changed the files; and - -(c) You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source -form of the Work, excluding those notices that do not pertain to any part -of the Derivative Works; and - -(d) If the Work includes a "NOTICE" text file as part of its distribution, -then any Derivative Works that You distribute must include a readable copy -of the attribution notices contained within such NOTICE file, excluding those -notices that do not pertain to any part of the Derivative Works, in at least -one of the following places: within a NOTICE text file distributed as part -of the Derivative Works; within the Source form or documentation, if provided -along with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents -of the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works -that You distribute, alongside or as an addendum to the NOTICE text from the -Work, provided that such additional attribution notices cannot be construed -as modifying the License. - -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, -or distribution of Your modifications, or for any such Derivative Works as -a whole, provided Your use, reproduction, and distribution of the Work otherwise -complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any -Contribution intentionally submitted for inclusion in the Work by You to the -Licensor shall be under the terms and conditions of this License, without -any additional terms or conditions. Notwithstanding the above, nothing herein -shall supersede or modify the terms of any separate license agreement you -may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, -trademarks, service marks, or product names of the Licensor, except as required -for reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to -in writing, Licensor provides the Work (and each Contributor provides its -Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied, including, without limitation, any warranties -or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR -A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness -of using or redistributing the Work and assume any risks associated with Your -exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether -in tort (including negligence), contract, or otherwise, unless required by -applicable law (such as deliberate and grossly negligent acts) or agreed to -in writing, shall any Contributor be liable to You for damages, including -any direct, indirect, special, incidental, or consequential damages of any -character arising as a result of this License or out of the use or inability -to use the Work (including but not limited to damages for loss of goodwill, -work stoppage, computer failure or malfunction, or any and all other commercial -damages or losses), even if such Contributor has been advised of the possibility -of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work -or Derivative Works thereof, You may choose to offer, and charge a fee for, -acceptance of support, warranty, indemnity, or other liability obligations -and/or rights consistent with this License. However, in accepting such obligations, -You may act only on Your own behalf and on Your sole responsibility, not on -behalf of any other Contributor, and only if You agree to indemnify, defend, -and hold each Contributor harmless for any liability incurred by, or claims -asserted against, such Contributor by reason of your accepting any such warranty -or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own identifying -information. (Don't include the brackets!) The text should be enclosed in -the appropriate comment syntax for the file format. We also recommend that -a file or class name and description of purpose be included on the same "printed -page" as the copyright notice for easier identification within third-party -archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); - -you may not use this file except in compliance with the License. - -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software - -distributed under the License is distributed on an "AS IS" BASIS, - -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -See the License for the specific language governing permissions and - -limitations under the License. diff --git a/LICENSES/CC-BY-4.0.txt b/LICENSES/CC-BY-4.0.txt deleted file mode 100644 index 3f92dfc5..00000000 --- a/LICENSES/CC-BY-4.0.txt +++ /dev/null @@ -1,324 +0,0 @@ -Creative Commons Attribution 4.0 International Creative Commons Corporation -("Creative Commons") is not a law firm and does not provide legal services -or legal advice. Distribution of Creative Commons public licenses does not -create a lawyer-client or other relationship. Creative Commons makes its licenses -and related information available on an "as-is" basis. Creative Commons gives -no warranties regarding its licenses, any material licensed under their terms -and conditions, or any related information. Creative Commons disclaims all -liability for damages resulting from their use to the fullest extent possible. - -Using Creative Commons Public Licenses - -Creative Commons public licenses provide a standard set of terms and conditions -that creators and other rights holders may use to share original works of -authorship and other material subject to copyright and certain other rights -specified in the public license below. The following considerations are for -informational purposes only, are not exhaustive, and do not form part of our -licenses. - -Considerations for licensors: Our public licenses are intended for use by -those authorized to give the public permission to use material in ways otherwise -restricted by copyright and certain other rights. Our licenses are irrevocable. -Licensors should read and understand the terms and conditions of the license -they choose before applying it. Licensors should also secure all rights necessary -before applying our licenses so that the public can reuse the material as -expected. Licensors should clearly mark any material not subject to the license. -This includes other CC-licensed material, or material used under an exception -or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors - -Considerations for the public: By using one of our public licenses, a licensor -grants the public permission to use the licensed material under specified -terms and conditions. If the licensor's permission is not necessary for any -reason–for example, because of any applicable exception or limitation to copyright–then -that use is not regulated by the license. Our licenses grant only permissions -under copyright and certain other rights that a licensor has authority to -grant. Use of the licensed material may still be restricted for other reasons, -including because others have copyright or other rights in the material. A -licensor may make special requests, such as asking that all changes be marked -or described. Although not required by our licenses, you are encouraged to -respect those requests where reasonable. More considerations for the public -: wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution -4.0 International Public License - -By exercising the Licensed Rights (defined below), You accept and agree to -be bound by the terms and conditions of this Creative Commons Attribution -4.0 International Public License ("Public License"). To the extent this Public -License may be interpreted as a contract, You are granted the Licensed Rights -in consideration of Your acceptance of these terms and conditions, and the -Licensor grants You such rights in consideration of benefits the Licensor -receives from making the Licensed Material available under these terms and -conditions. - -Section 1 – Definitions. - -a. Adapted Material means material subject to Copyright and Similar Rights -that is derived from or based upon the Licensed Material and in which the -Licensed Material is translated, altered, arranged, transformed, or otherwise -modified in a manner requiring permission under the Copyright and Similar -Rights held by the Licensor. For purposes of this Public License, where the -Licensed Material is a musical work, performance, or sound recording, Adapted -Material is always produced where the Licensed Material is synched in timed -relation with a moving image. - -b. Adapter's License means the license You apply to Your Copyright and Similar -Rights in Your contributions to Adapted Material in accordance with the terms -and conditions of this Public License. - -c. Copyright and Similar Rights means copyright and/or similar rights closely -related to copyright including, without limitation, performance, broadcast, -sound recording, and Sui Generis Database Rights, without regard to how the -rights are labeled or categorized. For purposes of this Public License, the -rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. - -d. Effective Technological Measures means those measures that, in the absence -of proper authority, may not be circumvented under laws fulfilling obligations -under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, -and/or similar international agreements. - -e. Exceptions and Limitations means fair use, fair dealing, and/or any other -exception or limitation to Copyright and Similar Rights that applies to Your -use of the Licensed Material. - -f. Licensed Material means the artistic or literary work, database, or other -material to which the Licensor applied this Public License. - -g. Licensed Rights means the rights granted to You subject to the terms and -conditions of this Public License, which are limited to all Copyright and -Similar Rights that apply to Your use of the Licensed Material and that the -Licensor has authority to license. - -h. Licensor means the individual(s) or entity(ies) granting rights under this -Public License. - -i. Share means to provide material to the public by any means or process that -requires permission under the Licensed Rights, such as reproduction, public -display, public performance, distribution, dissemination, communication, or -importation, and to make material available to the public including in ways -that members of the public may access the material from a place and at a time -individually chosen by them. - -j. Sui Generis Database Rights means rights other than copyright resulting -from Directive 96/9/EC of the European Parliament and of the Council of 11 -March 1996 on the legal protection of databases, as amended and/or succeeded, -as well as other essentially equivalent rights anywhere in the world. - -k. You means the individual or entity exercising the Licensed Rights under -this Public License. Your has a corresponding meaning. - -Section 2 – Scope. - - a. License grant. - -1. Subject to the terms and conditions of this Public License, the Licensor -hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, -irrevocable license to exercise the Licensed Rights in the Licensed Material -to: - - A. reproduce and Share the Licensed Material, in whole or in part; and - - B. produce, reproduce, and Share Adapted Material. - -2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions -and Limitations apply to Your use, this Public License does not apply, and -You do not need to comply with its terms and conditions. - - 3. Term. The term of this Public License is specified in Section 6(a). - -4. Media and formats; technical modifications allowed. The Licensor authorizes -You to exercise the Licensed Rights in all media and formats whether now known -or hereafter created, and to make technical modifications necessary to do -so. The Licensor waives and/or agrees not to assert any right or authority -to forbid You from making technical modifications necessary to exercise the -Licensed Rights, including technical modifications necessary to circumvent -Effective Technological Measures. For purposes of this Public License, simply -making modifications authorized by this Section 2(a)(4) never produces Adapted -Material. - - 5. Downstream recipients. - -A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed -Material automatically receives an offer from the Licensor to exercise the -Licensed Rights under the terms and conditions of this Public License. - -B. No downstream restrictions. You may not offer or impose any additional -or different terms or conditions on, or apply any Effective Technological -Measures to, the Licensed Material if doing so restricts exercise of the Licensed -Rights by any recipient of the Licensed Material. - -6. No endorsement. Nothing in this Public License constitutes or may be construed -as permission to assert or imply that You are, or that Your use of the Licensed -Material is, connected with, or sponsored, endorsed, or granted official status -by, the Licensor or others designated to receive attribution as provided in -Section 3(a)(1)(A)(i). - - b. Other rights. - -1. Moral rights, such as the right of integrity, are not licensed under this -Public License, nor are publicity, privacy, and/or other similar personality -rights; however, to the extent possible, the Licensor waives and/or agrees -not to assert any such rights held by the Licensor to the limited extent necessary -to allow You to exercise the Licensed Rights, but not otherwise. - -2. Patent and trademark rights are not licensed under this Public License. - -3. To the extent possible, the Licensor waives any right to collect royalties -from You for the exercise of the Licensed Rights, whether directly or through -a collecting society under any voluntary or waivable statutory or compulsory -licensing scheme. In all other cases the Licensor expressly reserves any right -to collect such royalties. - -Section 3 – License Conditions. - -Your exercise of the Licensed Rights is expressly made subject to the following -conditions. - - a. Attribution. - -1. If You Share the Licensed Material (including in modified form), You must: - -A. retain the following if it is supplied by the Licensor with the Licensed -Material: - -i. identification of the creator(s) of the Licensed Material and any others -designated to receive attribution, in any reasonable manner requested by the -Licensor (including by pseudonym if designated); - - ii. a copyright notice; - - iii. a notice that refers to this Public License; - - iv. a notice that refers to the disclaimer of warranties; - -v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; - -B. indicate if You modified the Licensed Material and retain an indication -of any previous modifications; and - -C. indicate the Licensed Material is licensed under this Public License, and -include the text of, or the URI or hyperlink to, this Public License. - -2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner -based on the medium, means, and context in which You Share the Licensed Material. -For example, it may be reasonable to satisfy the conditions by providing a -URI or hyperlink to a resource that includes the required information. - -3. If requested by the Licensor, You must remove any of the information required -by Section 3(a)(1)(A) to the extent reasonably practicable. - -4. If You Share Adapted Material You produce, the Adapter's License You apply -must not prevent recipients of the Adapted Material from complying with this -Public License. - -Section 4 – Sui Generis Database Rights. - -Where the Licensed Rights include Sui Generis Database Rights that apply to -Your use of the Licensed Material: - -a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, -reuse, reproduce, and Share all or a substantial portion of the contents of -the database; - -b. if You include all or a substantial portion of the database contents in -a database in which You have Sui Generis Database Rights, then the database -in which You have Sui Generis Database Rights (but not its individual contents) -is Adapted Material; and - -c. You must comply with the conditions in Section 3(a) if You Share all or -a substantial portion of the contents of the database. - -For the avoidance of doubt, this Section 4 supplements and does not replace -Your obligations under this Public License where the Licensed Rights include -other Copyright and Similar Rights. - -Section 5 – Disclaimer of Warranties and Limitation of Liability. - -a. Unless otherwise separately undertaken by the Licensor, to the extent possible, -the Licensor offers the Licensed Material as-is and as-available, and makes -no representations or warranties of any kind concerning the Licensed Material, -whether express, implied, statutory, or other. This includes, without limitation, -warranties of title, merchantability, fitness for a particular purpose, non-infringement, -absence of latent or other defects, accuracy, or the presence or absence of -errors, whether or not known or discoverable. Where disclaimers of warranties -are not allowed in full or in part, this disclaimer may not apply to You. - -b. To the extent possible, in no event will the Licensor be liable to You -on any legal theory (including, without limitation, negligence) or otherwise -for any direct, special, indirect, incidental, consequential, punitive, exemplary, -or other losses, costs, expenses, or damages arising out of this Public License -or use of the Licensed Material, even if the Licensor has been advised of -the possibility of such losses, costs, expenses, or damages. Where a limitation -of liability is not allowed in full or in part, this limitation may not apply -to You. - -c. The disclaimer of warranties and limitation of liability provided above -shall be interpreted in a manner that, to the extent possible, most closely -approximates an absolute disclaimer and waiver of all liability. - -Section 6 – Term and Termination. - -a. This Public License applies for the term of the Copyright and Similar Rights -licensed here. However, if You fail to comply with this Public License, then -Your rights under this Public License terminate automatically. - -b. Where Your right to use the Licensed Material has terminated under Section -6(a), it reinstates: - -1. automatically as of the date the violation is cured, provided it is cured -within 30 days of Your discovery of the violation; or - - 2. upon express reinstatement by the Licensor. - -c. For the avoidance of doubt, this Section 6(b) does not affect any right -the Licensor may have to seek remedies for Your violations of this Public -License. - -d. For the avoidance of doubt, the Licensor may also offer the Licensed Material -under separate terms or conditions or stop distributing the Licensed Material -at any time; however, doing so will not terminate this Public License. - - e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. - -Section 7 – Other Terms and Conditions. - -a. The Licensor shall not be bound by any additional or different terms or -conditions communicated by You unless expressly agreed. - -b. Any arrangements, understandings, or agreements regarding the Licensed -Material not stated herein are separate from and independent of the terms -and conditions of this Public License. - -Section 8 – Interpretation. - -a. For the avoidance of doubt, this Public License does not, and shall not -be interpreted to, reduce, limit, restrict, or impose conditions on any use -of the Licensed Material that could lawfully be made without permission under -this Public License. - -b. To the extent possible, if any provision of this Public License is deemed -unenforceable, it shall be automatically reformed to the minimum extent necessary -to make it enforceable. If the provision cannot be reformed, it shall be severed -from this Public License without affecting the enforceability of the remaining -terms and conditions. - -c. No term or condition of this Public License will be waived and no failure -to comply consented to unless expressly agreed to by the Licensor. - -d. Nothing in this Public License constitutes or may be interpreted as a limitation -upon, or waiver of, any privileges and immunities that apply to the Licensor -or You, including from the legal processes of any jurisdiction or authority. - -Creative Commons is not a party to its public licenses. Notwithstanding, Creative -Commons may elect to apply one of its public licenses to material it publishes -and in those instances will be considered the "Licensor." The text of the -Creative Commons public licenses is dedicated to the public domain under the -CC0 Public Domain Dedication. Except for the limited purpose of indicating -that material is shared under a Creative Commons public license or as otherwise -permitted by the Creative Commons policies published at creativecommons.org/policies, -Creative Commons does not authorize the use of the trademark "Creative Commons" -or any other trademark or logo of Creative Commons without its prior written -consent including, without limitation, in connection with any unauthorized -modifications to any of its public licenses or any other arrangements, understandings, -or agreements concerning use of licensed material. For the avoidance of doubt, -this paragraph does not form part of the public licenses. - -Creative Commons may be contacted at creativecommons.org. diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt deleted file mode 100644 index 0e259d42..00000000 --- a/LICENSES/CC0-1.0.txt +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 6c86c4ec..00000000 --- a/build.gradle +++ /dev/null @@ -1,136 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2013, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -buildscript { -<<<<<<< HEAD - ext.kotlinVersion = '1.8.20' - ext.coroutineVersion = '1.6.4' - - ext.annotationVersion = '1.6.0' - ext.appcompatVersion = '1.6.1' - ext.coreVersion = '1.9.0' - ext.collectionVersion = '1.3.0-dev01' - ext.fragmentVersion = '1.5.5' - ext.lifecycleVersion = '2.5.1' - ext.materialVersion = '1.8.0' - ext.navigationVersion = '2.5.3' - ext.preferenceVersion = '1.2.0' - ext.webkitVersion = '1.6.0' -======= - ext.cronetVersion = '102.5005.125' - ext.wearableVersion = '0.1.1' - - ext.kotlinVersion = '1.9.22' - ext.coroutineVersion = '1.7.3' - - ext.annotationVersion = '1.7.1' - ext.appcompatVersion = '1.6.1' - ext.biometricVersion = '1.1.0' - ext.coreVersion = '1.12.0' - ext.fragmentVersion = '1.6.2' - ext.lifecycleVersion = '2.7.0' - ext.loaderVersion = '1.1.0' - ext.materialVersion = '1.11.0' - ext.mediarouterVersion = '1.6.0' - ext.multidexVersion = '2.0.1' - ext.navigationVersion = '2.7.7' - ext.preferenceVersion = '1.2.0' - ext.recyclerviewVersion = '1.3.2' - ext.webkitVersion = '1.10.0' ->>>>>>> 48e0b00a (Update build tools and dependencies) - - ext.circleimageviewVersion = '3.1.0' - ext.volleyVersion = '1.2.1' - ext.wireVersion = '4.5.5' - -<<<<<<< HEAD - - ext.androidBuildGradleVersion = '8.0.0' - ext.androidBuildVersionTools = '33.0.2' - - ext.androidMinSdk = 23 - ext.androidTargetSdk = 30 - ext.androidCompileSdk = 33 -======= - ext.androidBuildGradleVersion = '8.2.2' - - ext.androidBuildVersionTools = '34.0.0' - - ext.androidMinSdk = 19 - ext.androidTargetSdk = 29 - ext.androidCompileSdk = 34 ->>>>>>> 48e0b00a (Update build tools and dependencies) - - repositories { - mavenCentral() - google() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion" - } -} - - -<<<<<<< HEAD -def gmsVersion = "24.10.17" -======= -def gmsVersion = "24.09.13" ->>>>>>> ef113281 (Bump GMS version to 24.09.13 (#2191)) -def gmsVersionCode = Integer.parseInt(gmsVersion.replaceAll('\\.', '')) -<<<<<<< HEAD - -def ourVersionBase = "0.3.0" - -def ourVersionCode = gmsVersionCode * 1000 -def ourVersionName = "$ourVersionBase.$gmsVersionCode" -======= -def vendingVersion = "40.2.26" -def vendingVersionCode = Integer.parseInt(vendingVersion.replaceAll('\\.', '')) -def gitVersionBase = execResult('git', 'describe', '--tags', '--abbrev=0', '--match=v[0-9]*').trim().substring(1) -def gitCommitCount = Integer.parseInt(execResult('git', 'rev-list', '--count', "v$gitVersionBase..HEAD").trim()) -def gitCommitId = execResult('git', 'show-ref', '--abbrev=7', '--head', 'HEAD').trim().split(' ')[0] -def gitDirty = false -execResult('git', 'status', '--porcelain').lines().each { stat -> - def status = stat.substring(0,2) - def file = stat.substring(3) - if (status == '??') { - if (subprojects.any { p -> file.startsWith(p.name + '/') }) { - logger.lifecycle('Dirty file: {} (untracked)', file) - gitDirty = true - } else { - logger.info('New file outside module: {} (ignored for dirty check)', file) - } - } else { - logger.lifecycle('Dirty file: {} (changed)', file) - gitDirty = true - } -} -def ourVersionBase = gitVersionBase.substring(0, gitVersionBase.lastIndexOf('.')) -def ourVersionMinor = Integer.parseInt(ourVersionBase.substring(ourVersionBase.lastIndexOf('.') + 1)) -def ourGmsVersionCode = gmsVersionCode * 1000 + ourVersionMinor * 2 + (gitCommitCount > 0 || gitDirty ? 1 : 0) -def ourGmsVersionName = "$ourVersionBase.$gmsVersionCode" + (gitCommitCount > 0 && !gitDirty ? "-$gitCommitCount" : "") + (gitDirty ? "-dirty" : "") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "") -def ourVendingVersionCode = 80000000 + vendingVersionCode * 100 + ourVersionMinor * 2 + (gitCommitCount > 0 || gitDirty ? 1 : 0) -def ourVendingVersionName = "$ourVersionBase.$vendingVersionCode" + (gitCommitCount > 0 && !gitDirty ? "-$gitCommitCount" : "") + (gitDirty ? "-dirty" : "") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "") -logger.lifecycle('Starting build for GMS version {} ({})...', ourGmsVersionName, ourGmsVersionCode) ->>>>>>> 33109df6 (Bump Companion version) - -allprojects { - apply plugin: 'idea' - - group = 'org.microg.gms' - version = ourVersionName - ext.appVersionCode = ourVersionCode - ext.isReleaseVersion = false -} - -subprojects { - repositories { - mavenCentral() - google() - } -} diff --git a/fake-signature/src/huawei/java/com/huawei/signature/diff/AppListDatabaseOpenHelper.java b/fake-signature/src/huawei/java/com/huawei/signature/diff/AppListDatabaseOpenHelper.java deleted file mode 100644 index f7e2d26e..00000000 --- a/fake-signature/src/huawei/java/com/huawei/signature/diff/AppListDatabaseOpenHelper.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.huawei.signature.diff; - -import android.content.ContentValues; -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; -import android.util.Log; -import org.microg.signature.fake.R; - -public class AppListDatabaseOpenHelper extends SQLiteOpenHelper { - private static final String TAG = AppListDatabaseOpenHelper.class.getSimpleName(); - private static final String DATABASE_NAME = "app_list.db"; - public static final String TABLE_APPLIST = "applist"; - public static final String COLUMN_NAME = "name"; - public static final String COLUMN_FAKE = "fake"; - private static final int DATABASE_VERSION = 3; - private static final String DROP_APP_LIST_TABLE = "DROP TABLE IF EXISTS " + TABLE_APPLIST; - private static final String CREATE_APP_LIST_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_APPLIST + "(" + - COLUMN_NAME + " VARCHAR(255) PRIMARY KEY, " + - COLUMN_FAKE + " INTEGER CHECK(" + COLUMN_FAKE + " >= 0 and " + COLUMN_FAKE + " <= 1)" + - ")"; - private final Context context; - - public AppListDatabaseOpenHelper(Context context) { - super(context, DATABASE_NAME, null, DATABASE_VERSION); - this.context = context; - } - - @Override - public void onCreate(SQLiteDatabase db) { - Log.d(TAG, "onCreate"); - db.execSQL(DROP_APP_LIST_TABLE); - db.execSQL(CREATE_APP_LIST_TABLE); - initData(db); - } - - @Override - public void onOpen(SQLiteDatabase db) { - super.onOpen(db); - if (!db.isReadOnly()) { - initData(db); - } - } - - private void initData(SQLiteDatabase db) { - String[] wantFakeApps = context.getResources().getStringArray(R.array.signature_want_fake); - String[] neverFakeApps = context.getResources().getStringArray(R.array.signature_never_fake); - if (wantFakeApps.length == 0 && neverFakeApps.length == 0) { - return; - } - for (String app : wantFakeApps) { - db.insertWithOnConflict(TABLE_APPLIST, null, generateValues(app, true), SQLiteDatabase.CONFLICT_REPLACE); - } - for (String app : neverFakeApps) { - db.insertWithOnConflict(TABLE_APPLIST, null, generateValues(app, false), SQLiteDatabase.CONFLICT_REPLACE); - } - } - - private ContentValues generateValues(String packageName, boolean fake) { - ContentValues contentValues = new ContentValues(); - contentValues.put(COLUMN_NAME, packageName); - contentValues.put(COLUMN_FAKE, fake ? 1 : 0); - return contentValues; - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - onCreate(db); - } -} \ No newline at end of file diff --git a/fake-signature/src/main/res/values/arrays.xml b/fake-signature/src/main/res/values/arrays.xml deleted file mode 100644 index 4f3118db..00000000 --- a/fake-signature/src/main/res/values/arrays.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - com.google.android.gms - com.android.vending - com.spotify.music - com.getir - com.pozitron.iscep - com.widgetable.theme.android - pro.huobi - com.tarparos.phigaea - com.artem.scotepio - com.sabah.deprembs - com.boynergrup.hopi - com.belbim.istanbulkart - com.a101.plus - com.widgetable.theme.android - net.wargaming.wot.blitz - com.litatom.app - com.ataexpress.tiklagelsin - tr.com.petrolofisi - com.mobisoft.beymen - com.unilever.algida - com.mobisoft.morhipo - com.zzkko - com.didilabs.kaavefali - com.airbnb.android - com.mobillium.papara - co.com.fincaraiz.app - com.frisby.frisby - - - com.truecaller - - \ No newline at end of file diff --git a/firebase-auth/core/src/main/kotlin/org/microg/gms/firebase/auth/FirebaseAuthService.kt b/firebase-auth/core/src/main/kotlin/org/microg/gms/firebase/auth/FirebaseAuthService.kt deleted file mode 100644 index ff411333..00000000 --- a/firebase-auth/core/src/main/kotlin/org/microg/gms/firebase/auth/FirebaseAuthService.kt +++ /dev/null @@ -1,649 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.firebase.auth - -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import android.content.IntentFilter -import android.os.Build.VERSION.SDK_INT -import android.os.Handler -import android.os.Parcel -import android.provider.Telephony -import android.telephony.SmsMessage -import android.util.Log -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.lifecycleScope -import com.google.android.gms.common.api.CommonStatusCodes -import com.google.android.gms.common.api.Status -import com.google.android.gms.common.internal.GetServiceRequest -import com.google.android.gms.common.internal.IGmsCallbacks -import com.google.firebase.auth.ActionCodeSettings -import com.google.firebase.auth.EmailAuthCredential -import com.google.firebase.auth.PhoneAuthCredential -import com.google.firebase.auth.UserProfileChangeRequest -import com.google.firebase.auth.api.internal.* -import org.json.JSONArray -import org.json.JSONObject -import org.microg.gms.BaseService -import org.microg.gms.common.GmsService -import org.microg.gms.common.PackageUtils -import org.microg.gms.utils.digest -import org.microg.gms.utils.getCertificates - -private const val TAG = "GmsFirebaseAuth" - -fun JSONObject.getStringOrNull(key: String) = if (has(key)) getString(key) else null -fun JSONObject.getJSONArrayOrNull(key: String) = if (has(key)) getJSONArray(key) else null -fun JSONArray?.orEmpty() = this ?: JSONArray() -fun JSONObject.getJSONArrayLength(key: String) = getJSONArrayOrNull(key).orEmpty().length() - -private val ActionCodeSettings.requestTypeAsString: String - get() = when (requestType) { - 1 -> "PASSWORD_RESET" - 2 -> "OLD_EMAIL_AGREE" - 3 -> "NEW_EMAIL_ACCEPT" - 4 -> "VERIFY_EMAIL" - 5 -> "RECOVER_EMAIL" - 6 -> "EMAIL_SIGNIN" - 7 -> "VERIFY_AND_CHANGE_EMAIL" - 8 -> "REVERT_SECOND_FACTOR_ADDITION" - else -> "OOB_REQ_TYPE_UNSPECIFIED" - } - -private val UserProfileChangeRequest.deleteAttributeList: List - get() { - val list = arrayListOf() - if (shouldRemoveDisplayName) list.add("DISPLAY_NAME") - if (shouldRemovePhotoUri) list.add("PHOTO_URL") - return list - } - -private fun Intent.getSmsMessages(): Array { - return if (SDK_INT >= 19) { - Telephony.Sms.Intents.getMessagesFromIntent(this) - } else { - (getSerializableExtra("pdus") as? Array)?.map { SmsMessage.createFromPdu(it) }.orEmpty().toTypedArray() - } -} - -class FirebaseAuthService : BaseService(TAG, GmsService.FIREBASE_AUTH) { - override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService?) { - PackageUtils.getAndCheckCallingPackage(this, request.packageName) - val apiKey = request.extras?.getString(Constants.EXTRA_API_KEY) - val libraryVersion = request.extras?.getString(Constants.EXTRA_LIBRARY_VERSION) - if (apiKey == null) { - callback.onPostInitComplete(CommonStatusCodes.DEVELOPER_ERROR, null, null) - } else { - callback.onPostInitComplete(0, FirebaseAuthServiceImpl(this, lifecycle, request.packageName, libraryVersion, apiKey).asBinder(), null) - } - } -} - -class FirebaseAuthServiceImpl(private val context: Context, override val lifecycle: Lifecycle, private val packageName: String, private val libraryVersion: String?, private val apiKey: String) : IFirebaseAuthService.Stub(), LifecycleOwner { - private val client by lazy { IdentityToolkitClient(context, apiKey, packageName, context.packageManager.getCertificates(packageName).firstOrNull()?.digest("SHA1")) } - private var authorizedDomain: String? = null - - private suspend fun getAuthorizedDomain(): String { - authorizedDomain?.let { return it } - val authorizedDomain = try { - client.getProjectConfig().getJSONArray("authorizedDomains").getString(0) - } catch (e: Exception) { - Log.w(TAG, e) - "localhost" - } - this.authorizedDomain = authorizedDomain - return authorizedDomain - } - - private suspend fun refreshTokenResponse(cachedState: String): GetTokenResponse { - var tokenResponse = GetTokenResponse.parseJson(cachedState) - if (System.currentTimeMillis() + 300000L < tokenResponse.issuedAt + tokenResponse.expiresIn * 1000) { - return tokenResponse - } - return client.getTokenByRefreshToken(tokenResponse.refreshToken).toGetTokenResponse() - } - - private fun JSONObject.toGetTokenResponse() = GetTokenResponse().apply { - refreshToken = getStringOrNull("refresh_token") - accessToken = getStringOrNull("access_token") - expiresIn = getStringOrNull("expires_in")?.toLong() - tokenType = getStringOrNull("token_type") - } - - private fun JSONObject.toGetAccountInfoUser(): GetAccountInfoUser = GetAccountInfoUser().apply { - localId = getStringOrNull("localId") - email = getStringOrNull("email") - isEmailVerified = optBoolean("emailVerified") - displayName = getStringOrNull("displayName") - photoUrl = getStringOrNull("photoUrl") - for (i in 0 until getJSONArrayLength("providerUserInfo")) { - getJSONArray("providerUserInfo").getJSONObject(i).run { - providerInfoList.providerUserInfos.add(ProviderUserInfo().apply { - federatedId = getStringOrNull("federatedId") - displayName = getStringOrNull("displayName") - photoUrl = getStringOrNull("photoUrl") - providerId = getStringOrNull("providerId") - phoneNumber = getStringOrNull("phoneNumber") - email = getStringOrNull("email") - rawUserInfo = this@run.toString() - }) - } - } - password = getStringOrNull("rawPassword") - phoneNumber = getStringOrNull("phoneNumber") - creationTimestamp = getStringOrNull("createdAt")?.toLong() ?: 0L - lastSignInTimestamp = getStringOrNull("lastLoginAt")?.toLong() ?: 0L - } - - private fun JSONObject.toCreateAuthUriResponse(): CreateAuthUriResponse = CreateAuthUriResponse().apply { - authUri = getStringOrNull("authUri") - isRegistered = optBoolean("registered") - providerId = getStringOrNull("providerId") - isForExistingProvider = optBoolean("forExistingProvider") - for (i in 0 until getJSONArrayLength("allProviders")) { - stringList.values.add(getJSONArray("allProviders").getString(i)) - } - for (i in 0 until getJSONArrayLength("signinMethods")) { - signInMethods.add(getJSONArray("signinMethods").getString(i)) - } - } - - override fun applyActionCode(request: ApplyActionCodeAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: applyActionCode") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun applyActionCodeCompat(code: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: applyActionCodeCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun changeEmail(request: ChangeEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: changeEmail") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun changeEmailCompat(cachedState: String?, email: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: changeEmailCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun changePassword(request: ChangePasswordAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: changePassword") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun changePasswordCompat(cachedState: String?, password: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: changePasswordCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun checkActionCode(request: CheckActionCodeAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: checkActionCode") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun checkActionCodeCompat(code: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: checkActionCodeCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun confirmPasswordReset(request: ConfirmPasswordResetAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: confirmPasswordReset") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun confirmPasswordResetCompat(code: String?, newPassword: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: confirmPasswordResetCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun createUserWithEmailAndPassword(request: CreateUserWithEmailAndPasswordAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "createUserWithEmailAndPassword") - try { - val tokenResult = client.signupNewUser(email = request.email, password = request.password, tenantId = request.tenantId) - val idToken = tokenResult.getString("idToken") - val refreshToken = tokenResult.getString("refreshToken") - val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() - val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = true } - Log.d(TAG, "callback: onGetTokenResponseAndUser") - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun createUserWithEmailAndPasswordCompat(email: String?, password: String?, callbacks: IFirebaseAuthCallbacks) { - createUserWithEmailAndPassword(CreateUserWithEmailAndPasswordAidlRequest().apply { this.email = email; this.password = password }, callbacks) - } - - override fun delete(request: DeleteAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: delete") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun deleteCompat(cachedState: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: deleteCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun finalizeMfaEnrollment(request: FinalizeMfaEnrollmentAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: finalizeMfaEnrollment") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun finalizeMfaSignIn(request: FinalizeMfaSignInAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: finalizeMfaSignIn") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun getAccessToken(request: GetAccessTokenAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "getAccessToken") - try { - callbacks.onGetTokenResponse(client.getTokenByRefreshToken(request.refreshToken).toGetTokenResponse()) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun getAccessTokenCompat(refreshToken: String?, callbacks: IFirebaseAuthCallbacks) { - getAccessToken(GetAccessTokenAidlRequest().apply { this.refreshToken = refreshToken }, callbacks) - } - - override fun getProvidersForEmail(request: GetProvidersForEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "getProvidersForEmail") - try { - callbacks.onCreateAuthUriResponse(client.createAuthUri(identifier = request.email, tenantId = request.tenantId).toCreateAuthUriResponse()) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun getProvidersForEmailCompat(email: String?, callbacks: IFirebaseAuthCallbacks) { - getProvidersForEmail(GetProvidersForEmailAidlRequest().apply { this.email = email }, callbacks) - } - - override fun linkEmailAuthCredential(request: LinkEmailAuthCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "linkEmailAuthCredential") - try { - val getTokenResponse = refreshTokenResponse(request.cachedState) - val accountInfoResult = client.getAccountInfo(idToken = getTokenResponse.accessToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() - val setAccountInfo = client.setAccountInfo(idToken = getTokenResponse.accessToken, localId = accountInfoResult.localId, email = request.email, password = request.password).toGetAccountInfoUser() - accountInfoResult.email = setAccountInfo.email - accountInfoResult.isEmailVerified = setAccountInfo.isEmailVerified - accountInfoResult.providerInfoList = setAccountInfo.providerInfoList - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun linkEmailAuthCredentialCompat(email: String?, password: String?, cachedState: String?, callbacks: IFirebaseAuthCallbacks) { - linkEmailAuthCredential(LinkEmailAuthCredentialAidlRequest().apply { this.email = email; this.password = password; this.cachedState = cachedState }, callbacks) - } - - override fun linkFederatedCredential(request: LinkFederatedCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: linkFederatedCredential") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun linkFederatedCredentialCompat(cachedState: String?, verifyAssertionRequest: VerifyAssertionRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: linkFederatedCredentialCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun linkPhoneAuthCredential(request: LinkPhoneAuthCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: linkPhoneAuthCredential") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun linkPhoneAuthCredentialCompat(cachedState: String?, credential: PhoneAuthCredential?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: linkPhoneAuthCredentialCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun reload(request: ReloadAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - try { - Log.d(TAG, "reload") - val getTokenResponse = refreshTokenResponse(request.cachedState) - val accountInfoResult = client.getAccountInfo(idToken = getTokenResponse.accessToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() - Log.d(TAG, "callback: onGetTokenResponseAndUser") - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun reloadCompat(cachedState: String?, callbacks: IFirebaseAuthCallbacks) { - reload(ReloadAidlRequest().apply { this.cachedState = cachedState }, callbacks) - } - - override fun sendEmailVerification(request: SendEmailVerificationWithSettingsAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - try { - Log.d(TAG, "sendEmailVerification") - client.getOobConfirmationCode( - requestType = "VERIFY_EMAIL", - idToken = request.token, - iOSBundleId = request.settings?.iOSBundle, - iOSAppStoreId = request.settings?.iOSAppStoreId, - continueUrl = request.settings?.url, - androidInstallApp = request.settings?.androidInstallApp, - androidMinimumVersion = request.settings?.androidMinimumVersion, - androidPackageName = request.settings?.androidPackageName, - canHandleCodeInApp = request.settings?.handleCodeInApp - ) - callbacks.onEmailVerificationResponse() - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun sendEmailVerificationCompat(token: String?, actionCodeSettings: ActionCodeSettings?, callbacks: IFirebaseAuthCallbacks) { - sendEmailVerification(SendEmailVerificationWithSettingsAidlRequest().apply { this.token = token; this.settings = actionCodeSettings }, callbacks) - } - - override fun sendVerificationCode(request: SendVerificationCodeAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - try { - Log.d(TAG, "sendVerificationCode") - val reCaptchaToken = when { - request.request.recaptchaToken != null -> request.request.recaptchaToken - ReCaptchaOverlay.isSupported(context) -> ReCaptchaOverlay.awaitToken(context, apiKey, getAuthorizedDomain()) - ReCaptchaActivity.isSupported(context) -> ReCaptchaActivity.awaitToken(context, apiKey, getAuthorizedDomain()) - else -> throw RuntimeException("No recaptcha token available") - } - var sessionInfo: String? = null - var registered = true - val receiver = object : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - var smsCode: String? = null - for (message in intent.getSmsMessages()) { - smsCode = Regex("\\b([0-9]{6})\\b").find(message.messageBody)?.groups?.get(1)?.value - ?: continue - Log.d(TAG, "Received SMS verification code: $smsCode") - break - } - if (smsCode == null) return - registered = false - context.unregisterReceiver(this) - try { - callbacks.onVerificationCompletedResponse(PhoneAuthCredential().apply { - this.phoneNumber = request.request.phoneNumber - this.sessionInfo = sessionInfo - this.smsCode = smsCode - }) - Log.d(TAG, "callback: onVerificationCompletedResponse") - } catch (e: Exception) { - Log.w(TAG, e) - } - } - } - context.registerReceiver(receiver, IntentFilter("android.provider.Telephony.SMS_RECEIVED")) - var timeout = request.request.timeoutInSeconds * 1000L - if (timeout <= 0L) timeout = 120000L - Handler().postDelayed({ - if (registered) { - Log.d(TAG, "Waited ${timeout}ms for verification code SMS, timeout.") - context.unregisterReceiver(receiver) - callbacks.onVerificationAutoTimeOut(sessionInfo) - Log.d(TAG, "callback: onVerificationAutoTimeOut") - } - }, timeout) - sessionInfo = client.sendVerificationCode(phoneNumber = request.request.phoneNumber, reCaptchaToken = reCaptchaToken).getString("sessionInfo") - callbacks.onSendVerificationCodeResponse(sessionInfo) - Log.d(TAG, "callback: onSendVerificationCodeResponse") - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun sendVerificationCodeCompat(request: SendVerificationCodeRequest, callbacks: IFirebaseAuthCallbacks) { - sendVerificationCode(SendVerificationCodeAidlRequest().apply { this.request = request }, callbacks) - } - - override fun sendGetOobConfirmationCodeEmail(request: SendGetOobConfirmationCodeEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - try { - Log.d(TAG, "sendGetOobConfirmationCodeEmail") - client.getOobConfirmationCode( - requestType = request.settings?.requestTypeAsString ?: "OOB_REQ_TYPE_UNSPECIFIED", - email = request.email, - iOSBundleId = request.settings?.iOSBundle, - iOSAppStoreId = request.settings?.iOSAppStoreId, - continueUrl = request.settings?.url, - androidInstallApp = request.settings?.androidInstallApp, - androidMinimumVersion = request.settings?.androidMinimumVersion, - androidPackageName = request.settings?.androidPackageName, - canHandleCodeInApp = request.settings?.handleCodeInApp - ) - Log.d(TAG, "callback: onResetPasswordResponse") - callbacks.onResetPasswordResponse(null) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun sendGetOobConfirmationCodeEmailCompat(email: String?, actionCodeSettings: ActionCodeSettings?, callbacks: IFirebaseAuthCallbacks) { - sendGetOobConfirmationCodeEmail(SendGetOobConfirmationCodeEmailAidlRequest().apply { this.email = email; this.settings = actionCodeSettings }, callbacks) - } - - override fun setFirebaseUiVersion(request: SetFirebaseUiVersionAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: setFirebaseUiVersion") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun setFirebaseUIVersionCompat(firebaseUiVersion: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: setFirebaseUIVersionCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun signInAnonymously(request: SignInAnonymouslyAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "signInAnonymously") - try { - val tokenResult = client.signupNewUser(tenantId = request.tenantId) - val idToken = tokenResult.getString("idToken") - val refreshToken = tokenResult.getString("refreshToken") - val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() - val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = true } - Log.d(TAG, "callback: onGetTokenResponseAndUser") - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun signInAnonymouslyCompat(callbacks: IFirebaseAuthCallbacks) { - signInAnonymously(SignInAnonymouslyAidlRequest(), callbacks) - } - - override fun signInWithCredential(request: SignInWithCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: signInWithCredential") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun signInWithCredentialCompat(verifyAssertionRequest: VerifyAssertionRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: signInWithCredentialCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun signInWithCustomToken(request: SignInWithCustomTokenAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "signInWithCustomToken") - try { - val tokenResult = client.verifyCustomToken(token = request.token) - val idToken = tokenResult.getString("idToken") - val refreshToken = tokenResult.getString("refreshToken") - val isNewUser = tokenResult.optBoolean("isNewUser") - val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() - val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = isNewUser } - Log.d(TAG, "callback: onGetTokenResponseAndUser") - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun signInWithCustomTokenCompat(token: String, callbacks: IFirebaseAuthCallbacks) { - signInWithCustomToken(SignInWithCustomTokenAidlRequest().apply { this.token = token }, callbacks) - } - - override fun signInWithEmailAndPassword(request: SignInWithEmailAndPasswordAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "signInWithEmailAndPassword") - try { - val tokenResult = client.verifyPassword(email = request.email, password = request.password, tenantId = request.tenantId) - val idToken = tokenResult.getString("idToken") - val refreshToken = tokenResult.getString("refreshToken") - val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() - val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() - Log.d(TAG, "callback: onGetTokenResponseAndUser") - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun signInWithEmailAndPasswordCompat(email: String?, password: String?, callbacks: IFirebaseAuthCallbacks) { - signInWithEmailAndPassword(SignInWithEmailAndPasswordAidlRequest().apply { this.email = email; this.password = password }, callbacks) - } - - override fun signInWithEmailLink(request: SignInWithEmailLinkAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: signInWithEmailLink") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun signInWithEmailLinkCompat(credential: EmailAuthCredential?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: signInWithEmailLinkCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun signInWithPhoneNumber(request: SignInWithPhoneNumberAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "signInWithPhoneNumber") - try { - val tokenResult = client.verifyPhoneNumber( - phoneNumber = request.credential.phoneNumber, - temporaryProof = request.credential.temporaryProof, - sessionInfo = request.credential.sessionInfo, - code = request.credential.smsCode - ) - val idToken = tokenResult.getString("idToken") - val refreshToken = tokenResult.getString("refreshToken") - val isNewUser = tokenResult.optBoolean("isNewUser") - val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() - val accountInfoResult = client.getAccountInfo(idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = isNewUser } - Log.d(TAG, "callback: onGetTokenResponseAndUser") - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun signInWithPhoneNumberCompat(credential: PhoneAuthCredential?, callbacks: IFirebaseAuthCallbacks) { - signInWithPhoneNumber(SignInWithPhoneNumberAidlRequest().apply { this.credential = credential }, callbacks) - } - - override fun startMfaEnrollmentWithPhoneNumber(request: StartMfaPhoneNumberEnrollmentAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: startMfaEnrollmentWithPhoneNumber") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun startMfaSignInWithPhoneNumber(request: StartMfaPhoneNumberSignInAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: startMfaSignInWithPhoneNumber") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun unenrollMfa(request: UnenrollMfaAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: unenrollMfa") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun unlinkEmailCredential(request: UnlinkEmailCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: unlinkEmailCredential") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun unlinkEmailCredentialCompat(cachedState: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: unlinkEmailCredentialCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun unlinkFederatedCredential(request: UnlinkFederatedCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: unlinkFederatedCredential") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun unlinkFederatedCredentialCompat(provider: String?, cachedState: String?, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: unlinkFederatedCredentialCompat") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - override fun updateProfile(request: UpdateProfileAidlRequest, callbacks: IFirebaseAuthCallbacks) { - lifecycleScope.launchWhenStarted { - Log.d(TAG, "updateProfile") - try { - val getTokenResponse = refreshTokenResponse(request.cachedState) - val accountInfoResult = client.getAccountInfo(idToken = getTokenResponse.accessToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() - val setAccountInfo = client.setAccountInfo(idToken = getTokenResponse.accessToken, localId = accountInfoResult.localId, displayName = request.request.displayName, photoUrl = request.request.photoUrl, deleteAttribute = request.request.deleteAttributeList).toGetAccountInfoUser() - accountInfoResult.photoUrl = setAccountInfo.photoUrl - accountInfoResult.displayName = setAccountInfo.displayName - callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) - } catch (e: Exception) { - Log.w(TAG, "callback: onFailure", e) - callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) - } - } - } - - override fun updateProfileCompat(cachedState: String?, userProfileChangeRequest: UserProfileChangeRequest, callbacks: IFirebaseAuthCallbacks) { - updateProfile(UpdateProfileAidlRequest().apply { this.cachedState = cachedState; this.request = userProfileChangeRequest}, callbacks) - } - - override fun verifyBeforeUpdateEmail(request: VerifyBeforeUpdateEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { - Log.d(TAG, "Not yet implemented: verifyBeforeUpdateEmail") - callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) - } - - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean { - if (super.onTransact(code, data, reply, flags)) return true - Log.d(TAG, "onTransact: $code, $data, $flags") - return false - } -} diff --git a/firebase-auth/core/src/main/kotlin/org/microg/gms/firebase/auth/IdentityToolkitClient.kt b/firebase-auth/core/src/main/kotlin/org/microg/gms/firebase/auth/IdentityToolkitClient.kt deleted file mode 100644 index ca391a6d..00000000 --- a/firebase-auth/core/src/main/kotlin/org/microg/gms/firebase/auth/IdentityToolkitClient.kt +++ /dev/null @@ -1,148 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.firebase.auth - -import android.content.Context -import android.util.Log -import com.android.volley.NetworkResponse -import com.android.volley.ParseError -import com.android.volley.Request.Method.GET -import com.android.volley.Request.Method.POST -import com.android.volley.Response -import com.android.volley.VolleyError -import com.android.volley.toolbox.HttpHeaderParser -import com.android.volley.toolbox.JsonObjectRequest -import com.android.volley.toolbox.JsonRequest -import com.android.volley.toolbox.Volley -import org.json.JSONArray -import org.json.JSONException -import org.json.JSONObject -import org.microg.gms.utils.singleInstanceOf -import org.microg.gms.utils.toHexString -import java.io.UnsupportedEncodingException -import java.lang.RuntimeException -import java.nio.charset.Charset -import kotlin.coroutines.resume -import kotlin.coroutines.resumeWithException -import kotlin.coroutines.suspendCoroutine - -private const val TAG = "GmsFirebaseAuthClient" - -class IdentityToolkitClient(context: Context, private val apiKey: String, private val packageName: String? = null, private val certSha1Hash: ByteArray? = null) { - private val queue = singleInstanceOf { Volley.newRequestQueue(context.applicationContext) } - - private fun buildRelyingPartyUrl(method: String) = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/$method?key=$apiKey" - private fun buildStsUrl(method: String) = "https://securetoken.googleapis.com/v1/$method?key=$apiKey" - - private fun getRequestHeaders(): Map = hashMapOf().apply { - if (packageName != null) put("X-Android-Package", packageName) - if (certSha1Hash != null) put("X-Android-Cert", certSha1Hash.toHexString().uppercase()) - } - - private suspend fun request(method: String, data: JSONObject): JSONObject = suspendCoroutine { continuation -> - queue.add(object : JsonObjectRequest(POST, buildRelyingPartyUrl(method), data, { - continuation.resume(it) - }, { - Log.d(TAG, "Error: ${it.networkResponse?.data?.decodeToString() ?: it.message}") - continuation.resumeWithException(RuntimeException(it)) - }) { - override fun getHeaders(): Map = getRequestHeaders() - }) - } - - suspend fun createAuthUri(identifier: String? = null, tenantId: String? = null, continueUri: String? = "http://localhost"): JSONObject = - request("createAuthUri", JSONObject() - .put("identifier", identifier) - .put("tenantId", tenantId) - .put("continueUri", continueUri)) - - suspend fun getAccountInfo(idToken: String? = null): JSONObject = - request("getAccountInfo", JSONObject() - .put("idToken", idToken)) - - suspend fun getProjectConfig(): JSONObject = suspendCoroutine { continuation -> - queue.add(JsonObjectRequest(GET, buildRelyingPartyUrl("getProjectConfig"), null, { continuation.resume(it) }, { continuation.resumeWithException(RuntimeException(it)) })) - } - - suspend fun getOobConfirmationCode(requestType: String, email: String? = null, newEmail: String? = null, continueUrl: String? = null, idToken: String? = null, iOSBundleId: String? = null, iOSAppStoreId: String? = null, androidMinimumVersion: String? = null, androidInstallApp: Boolean? = null, androidPackageName: String? = null, canHandleCodeInApp: Boolean? = null): JSONObject = - request("getOobConfirmationCode", JSONObject() - .put("kind", "identitytoolkit#relyingparty") - .put("requestType", requestType) - .put("email", email) - .put("newEmail", newEmail) - .put("continueUrl", continueUrl) - .put("idToken", idToken) - .put("iOSBundleId", iOSBundleId) - .put("iOSAppStoreId", iOSAppStoreId) - .put("androidMinimumVersion", androidMinimumVersion) - .put("androidInstallApp", androidInstallApp) - .put("androidPackageName", androidPackageName) - .put("canHandleCodeInApp", canHandleCodeInApp)) - - - suspend fun sendVerificationCode(phoneNumber: String? = null, reCaptchaToken: String? = null): JSONObject = - request("sendVerificationCode", JSONObject() - .put("phoneNumber", phoneNumber) - .put("recaptchaToken", reCaptchaToken)) - - suspend fun setAccountInfo(idToken: String? = null, localId: String? = null, email: String? = null, password: String? = null, displayName: String? = null, photoUrl: String? = null, deleteAttribute: List = emptyList()): JSONObject = - request("setAccountInfo", JSONObject() - .put("idToken", idToken) - .put("localId", localId) - .put("email", email) - .put("password", password) - .put("displayName", displayName) - .put("photoUrl", photoUrl) - .put("deleteAttribute", JSONArray().apply { deleteAttribute.map { put(it) } })) - - suspend fun signupNewUser(email: String? = null, password: String? = null, tenantId: String? = null): JSONObject = - request("signupNewUser", JSONObject() - .put("email", email) - .put("password", password) - .put("tenantId", tenantId)) - - suspend fun verifyCustomToken(token: String? = null, returnSecureToken: Boolean = true): JSONObject = - request("verifyCustomToken", JSONObject() - .put("token", token) - .put("returnSecureToken", returnSecureToken)) - - suspend fun verifyPassword(email: String? = null, password: String? = null, tenantId: String? = null, returnSecureToken: Boolean = true): JSONObject = - request("verifyPassword", JSONObject() - .put("email", email) - .put("password", password) - .put("tenantId", tenantId) - .put("returnSecureToken", returnSecureToken)) - - suspend fun verifyPhoneNumber(phoneNumber: String? = null, sessionInfo: String? = null, code: String? = null, idToken: String? = null, verificationProof: String? = null, temporaryProof: String? = null): JSONObject = - request("verifyPhoneNumber", JSONObject() - .put("verificationProof", verificationProof) - .put("code", code) - .put("idToken", idToken) - .put("temporaryProof", temporaryProof) - .put("phoneNumber", phoneNumber) - .put("sessionInfo", sessionInfo)) - - suspend fun getTokenByRefreshToken(refreshToken: String): JSONObject = suspendCoroutine { continuation -> - queue.add(object : JsonRequest(POST, buildStsUrl("token"), "grant_type=refresh_token&refresh_token=$refreshToken", { continuation.resume(it) }, { continuation.resumeWithException(RuntimeException(it)) }) { - override fun parseNetworkResponse(response: NetworkResponse): Response { - return try { - val jsonString = String(response.data, Charset.forName(HttpHeaderParser.parseCharset(response.headers, PROTOCOL_CHARSET))) - Response.success(JSONObject(jsonString), null) - } catch (e: UnsupportedEncodingException) { - Response.error(ParseError(e)) - } catch (je: JSONException) { - Response.error(ParseError(je)) - } - } - - override fun getBodyContentType(): String { - return "application/x-www-form-urlencoded" - } - - override fun getHeaders(): Map = getRequestHeaders() - }) - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 86630672..00000000 --- a/gradle.properties +++ /dev/null @@ -1,5 +0,0 @@ -android.useAndroidX=true -org.gradle.jvmargs=-Xmx4096m -XX:+UseParallelGC -android.defaults.buildfeatures.buildconfig=true -android.nonTransitiveRClass=false -android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 62d4c053..00000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index ab7cda7a..00000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,11 +0,0 @@ -#Thu Jun 29 16:45:22 ICT 2023 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -<<<<<<< HEAD -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-rc-3-bin.zip -======= -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip -networkTimeout=10000 ->>>>>>> 48e0b00a (Update build tools and dependencies) -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew deleted file mode 100755 index 64544521..00000000 --- a/gradlew +++ /dev/null @@ -1,243 +0,0 @@ -#!/bin/sh - -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" \ No newline at end of file diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index d0412fa3..00000000 --- a/gradlew.bat +++ /dev/null @@ -1,200 +0,0 @@ -<<<<<<< HEAD -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega -======= -@rem SPDX-License-Identifier: Apache-2.0 -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega ->>>>>>> 48e0b00a (Update build tools and dependencies) diff --git a/play-services-ads-identifier/core/src/main/kotlin/org/microg/gms/ads/identifier/AdvertisingIdService.kt b/play-services-ads-identifier/core/src/main/kotlin/org/microg/gms/ads/identifier/AdvertisingIdService.kt deleted file mode 100644 index 0c4f96d1..00000000 --- a/play-services-ads-identifier/core/src/main/kotlin/org/microg/gms/ads/identifier/AdvertisingIdService.kt +++ /dev/null @@ -1,139 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ -package org.microg.gms.ads.identifier - -import android.app.Service -import android.content.Context -import android.content.Intent -import android.content.pm.PackageManager -import android.os.Binder -import android.os.Bundle -import android.os.IBinder -import android.util.Log -import androidx.core.os.bundleOf -import com.google.android.gms.ads.identifier.internal.IAdvertisingIdService -import org.microg.gms.common.GooglePackagePermission -import org.microg.gms.common.PackageUtils -import java.util.UUID - -const val TAG = "AdvertisingId" -const val EMPTY_AD_ID = "00000000-0000-0000-0000-000000000000" - -class AdvertisingIdService : Service() { - override fun onBind(intent: Intent): IBinder? { - return AdvertisingIdServiceImpl(this).asBinder() - } -} - -class MemoryAdvertisingIdConfiguration(context: Context) : AdvertisingIdConfiguration(context) { - override val adTrackingLimitedPerApp: MutableMap = hashMapOf() - override var adTrackingLimitedGlobally: Boolean = true - override var debugLogging: Boolean = false - override var adId: String = EMPTY_AD_ID - override var debugAdId: String = EMPTY_AD_ID - - init { - resetAdvertisingId() - } -} - -abstract class AdvertisingIdConfiguration(private val context: Context) { - abstract val adTrackingLimitedPerApp: MutableMap - abstract var adTrackingLimitedGlobally: Boolean - abstract var debugLogging: Boolean - abstract var adId: String - abstract var debugAdId: String - - fun isAdTrackingLimitedForApp(uid: Int): Boolean { - if (adTrackingLimitedGlobally) return true - return adTrackingLimitedPerApp[uid] ?: false - } - - fun resetAdvertisingId(): String { - adId = UUID.randomUUID().toString() - debugAdId = UUID.randomUUID().toString().dropLast(12) + "10ca1ad1abe1" - return if (debugLogging) debugAdId else adId - } - - fun getAdvertisingIdForApp(uid: Int): String { - if (isAdTrackingLimitedForApp(uid)) return EMPTY_AD_ID - try { - val packageNames = context.packageManager.getPackagesForUid(uid) ?: return EMPTY_AD_ID - for (packageName in packageNames) { - val applicationInfo = context.packageManager.getApplicationInfo(packageName, 0) - if (applicationInfo.targetSdkVersion > 33) { - if (context.packageManager.checkPermission("com.google.android.gms.permission.AD_ID", packageName) == PackageManager.PERMISSION_DENIED) { - throw SecurityException("Permission not granted") - } - } - } - } catch (e: Exception) { - Log.w(TAG, "Permission check failed", e) - return EMPTY_AD_ID - } - val adId = if (debugLogging) debugAdId else adId - return adId.ifEmpty { resetAdvertisingId() } - } -} - -class AdvertisingIdServiceImpl(private val context: Context) : IAdvertisingIdService.Stub() { - private val configuration = MemoryAdvertisingIdConfiguration(context) - - override fun getAdvertisingId(): String { - return configuration.getAdvertisingIdForApp(Binder.getCallingUid()) - } - - override fun isAdTrackingLimited(ignored: Boolean): Boolean { - return configuration.isAdTrackingLimitedForApp(Binder.getCallingUid()) - } - - override fun resetAdvertisingId(packageName: String): String { - PackageUtils.checkPackageUid(context, packageName, getCallingUid()) - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - return configuration.resetAdvertisingId() - } - - override fun setAdTrackingLimitedGlobally(packageName: String, limited: Boolean) { - PackageUtils.checkPackageUid(context, packageName, getCallingUid()) - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - configuration.adTrackingLimitedGlobally = limited - } - - override fun setDebugLoggingEnabled(packageName: String, enabled: Boolean): String { - PackageUtils.checkPackageUid(context, packageName, getCallingUid()) - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - configuration.debugLogging = enabled - return advertisingId - } - - override fun isDebugLoggingEnabled(): Boolean { - return configuration.debugLogging - } - - override fun isAdTrackingLimitedGlobally(): Boolean { - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - return configuration.adTrackingLimitedGlobally - } - - override fun setAdTrackingLimitedForApp(uid: Int, limited: Boolean) { - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - configuration.adTrackingLimitedPerApp[uid] = limited - } - - override fun resetAdTrackingLimitedForApp(uid: Int) { - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - configuration.adTrackingLimitedPerApp.remove(uid) - } - - override fun getAllAppsLimitedAdTrackingConfiguration(): Bundle { - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - return bundleOf(*configuration.adTrackingLimitedPerApp.map { it.key.toString() to it.value }.toTypedArray()) - } - - override fun getAdvertisingIdForApp(uid: Int): String { - PackageUtils.assertGooglePackagePermission(context, GooglePackagePermission.AD_ID) - return configuration.getAdvertisingIdForApp(uid) - } -} diff --git a/play-services-ads-identifier/core/src/main/res/values-be/strings.xml b/play-services-ads-identifier/core/src/main/res/values-be/strings.xml deleted file mode 100644 index d4a8547b..00000000 --- a/play-services-ads-identifier/core/src/main/res/values-be/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Дазвол рэкламнага ідэнтыфікатара - Дазваляе выдаўцу дадатку прама ці ўскосна атрымліваць доступ да рэкламнага ідэнтыфікатара. - Апавяшчэнне рэкламнага ідэнтыфікатара - Дазваляе з дадаткам атрымліваць апавяшчэнне калі рэкламны ідэнтыфікатар або перавага аб ліміце рэкламнай сачэння карыстальніка абноўленыя. - \ No newline at end of file diff --git a/play-services-ads-identifier/core/src/main/res/values-es/strings.xml b/play-services-ads-identifier/core/src/main/res/values-es/strings.xml deleted file mode 100644 index 90c47f72..00000000 --- a/play-services-ads-identifier/core/src/main/res/values-es/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Permiso de identificación publicitaria - Permite que una aplicación de editor acceda directa o indirectamente a un ID de publicidad válido. - Notificación del ID de publicidad - Permite que una aplicación reciba una notificación cuando se actualiza el ID de publicidad o la preferencia de limitar el seguimiento de anuncios del usuario. - \ No newline at end of file diff --git a/play-services-ads-identifier/core/src/main/res/values-pt-rBR/strings.xml b/play-services-ads-identifier/core/src/main/res/values-pt-rBR/strings.xml deleted file mode 100644 index 389929df..00000000 --- a/play-services-ads-identifier/core/src/main/res/values-pt-rBR/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Permissão do ID publicitário - Permite o app acessar um ID publicitário válido diretamente ou indiretamente. - Notificação de ID publicitário - Permite um app receber uma notificação quando o ID publicitário ou configuração de limitar rastreamento por anúncios do usuário muda. - \ No newline at end of file diff --git a/play-services-ads-identifier/core/src/main/res/values-ru/strings.xml b/play-services-ads-identifier/core/src/main/res/values-ru/strings.xml deleted file mode 100644 index dc46f144..00000000 --- a/play-services-ads-identifier/core/src/main/res/values-ru/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Разрешает приложению получать уведомление когда рекламный идентификатор или предпочтение о лимите рекламной слежки пользователя обновлены. - Разрешение рекламного идентификатора - Разрешает издателю приложения прямо или косвенно получать доступ к рекламному идентификатору. - Уведомление рекламного идентификатора - \ No newline at end of file diff --git a/play-services-ads-identifier/core/src/main/res/values-zh-rCN/strings.xml b/play-services-ads-identifier/core/src/main/res/values-zh-rCN/strings.xml deleted file mode 100644 index fbe69d8a..00000000 --- a/play-services-ads-identifier/core/src/main/res/values-zh-rCN/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - 广告 ID 权限 - 允许发布者应用直接或间接地访问广告 ID。 - 广告 ID 通知 - 允许应用在用户的广告 ID 或限制广告跟踪设置更改时得到通知。 - \ No newline at end of file diff --git a/play-services-api/build.gradle b/play-services-api/build.gradle deleted file mode 100644 index f78981e9..00000000 --- a/play-services-api/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2013-2015 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' - -android { - compileSdk androidCompileSdk - buildToolsVersion '33.0.2' - - defaultConfig { - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = "1.8" - } - namespace 'org.microg.gms.api' - buildFeatures { - aidl true - } -} - -dependencies { - api project(':play-services-basement') - api project(':play-services-iid-api') - api project(':play-services-base-api') -} \ No newline at end of file diff --git a/play-services-api/gradle.properties b/play-services-api/gradle.properties deleted file mode 100644 index cac2a521..00000000 --- a/play-services-api/gradle.properties +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2013-2016 microG Project Team -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -POM_NAME=Play Services Internal API -POM_DESCRIPTION=Interfaces and objects for IPC between Play Services Library and Play Services Core - -POM_PACKAGING=aar - -POM_URL=https://github.com/microg/android_external_GmsApi - -POM_SCM_URL=https://github.com/microg/android_external_GmsApi -POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mar-v-in -POM_DEVELOPER_NAME=Marvin W \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/auth/IAuthManagerService.aidl b/play-services-api/src/main/aidl/com/google/android/auth/IAuthManagerService.aidl deleted file mode 100644 index ae33a334..00000000 --- a/play-services-api/src/main/aidl/com/google/android/auth/IAuthManagerService.aidl +++ /dev/null @@ -1,23 +0,0 @@ -package com.google.android.auth; - -import android.os.Bundle; -import android.accounts.Account; - -import com.google.android.gms.auth.AccountChangeEventsResponse; -import com.google.android.gms.auth.AccountChangeEventsRequest; -import com.google.android.gms.auth.GetHubTokenRequest; -import com.google.android.gms.auth.GetHubTokenInternalResponse; -import com.google.android.gms.auth.HasCababilitiesRequest; - -interface IAuthManagerService { - Bundle getToken(String accountName, String scope, in Bundle extras) = 0; - Bundle clearToken(String token, in Bundle extras) = 1; - AccountChangeEventsResponse getChangeEvents(in AccountChangeEventsRequest request) = 2; - - Bundle getTokenWithAccount(in Account account, String scope, in Bundle extras) = 4; - Bundle getAccounts(in Bundle extras) = 5; - Bundle removeAccount(in Account account) = 6; - Bundle requestGoogleAccountsAccess(String packageName) = 7; - int hasCapabilities(in HasCababilitiesRequest request) = 8; - GetHubTokenInternalResponse getHubToken(in GetHubTokenRequest request, in Bundle extras) = 9; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/AccountChangeEventsRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/AccountChangeEventsRequest.aidl deleted file mode 100644 index 206b1a9d..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/AccountChangeEventsRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth; - -parcelable AccountChangeEventsRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/AccountChangeEventsResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/AccountChangeEventsResponse.aidl deleted file mode 100644 index 832e5859..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/AccountChangeEventsResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth; - -parcelable AccountChangeEventsResponse; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/GetHubTokenInternalResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/GetHubTokenInternalResponse.aidl deleted file mode 100644 index f73f91bb..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/GetHubTokenInternalResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth; - -parcelable GetHubTokenInternalResponse; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/GetHubTokenRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/GetHubTokenRequest.aidl deleted file mode 100644 index 74de2776..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/GetHubTokenRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth; - -parcelable GetHubTokenRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/HasCababilitiesRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/HasCababilitiesRequest.aidl deleted file mode 100644 index c0c080cd..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/HasCababilitiesRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth; - -parcelable HasCababilitiesRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/Credential.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/Credential.aidl deleted file mode 100644 index 82536b93..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/Credential.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth.api.credentials; - -parcelable Credential; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/CredentialRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/CredentialRequest.aidl deleted file mode 100644 index d000f32e..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/CredentialRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth.api.credentials; - -parcelable CredentialRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.aidl deleted file mode 100644 index 7fa0d4ab..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth.api.credentials.internal; - -parcelable DeleteRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.aidl deleted file mode 100644 index 814f68da..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth.api.credentials.internal; - -parcelable GeneratePasswordRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsCallbacks.aidl deleted file mode 100644 index da248c33..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsCallbacks.aidl +++ /dev/null @@ -1,10 +0,0 @@ -package com.google.android.gms.auth.api.credentials.internal; - -import com.google.android.gms.common.api.Status; -import com.google.android.gms.auth.api.credentials.Credential; - -interface ICredentialsCallbacks { - void onStatusAndCredential(in Status status, in Credential credential) = 0; - void onStatus(in Status status) = 1; - void onStatusAndString(in Status status, String string) = 2; -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsService.aidl deleted file mode 100644 index 89c6c7e2..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsService.aidl +++ /dev/null @@ -1,15 +0,0 @@ -package com.google.android.gms.auth.api.credentials.internal; - -import com.google.android.gms.auth.api.credentials.CredentialRequest; -import com.google.android.gms.auth.api.credentials.internal.ICredentialsCallbacks; -import com.google.android.gms.auth.api.credentials.internal.DeleteRequest; -import com.google.android.gms.auth.api.credentials.internal.GeneratePasswordRequest; -import com.google.android.gms.auth.api.credentials.internal.SaveRequest; - -interface ICredentialsService { - void request(ICredentialsCallbacks callbacks, in CredentialRequest request) = 0; - void save(ICredentialsCallbacks callbacks, in SaveRequest request) = 1; - void delete(ICredentialsCallbacks callbacks, in DeleteRequest request) = 2; - void disableAutoSignIn(ICredentialsCallbacks callbacks) = 3; - void generatePassword(ICredentialsCallbacks callbacks, in GeneratePasswordRequest request) = 4; -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/SaveRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/SaveRequest.aidl deleted file mode 100644 index b5bcb593..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/SaveRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth.api.credentials.internal; - -parcelable SaveRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/internal/IAuthCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/internal/IAuthCallbacks.aidl deleted file mode 100644 index ae8e79c5..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/internal/IAuthCallbacks.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package com.google.android.gms.auth.api.internal; - -import com.google.android.gms.auth.api.proxy.ProxyResponse; - -interface IAuthCallbacks { - void onProxyResponse(in ProxyResponse response) = 0; - void onSpatulaHeader(String spatulaHeader) = 1; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/internal/IAuthService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/internal/IAuthService.aidl deleted file mode 100644 index a5f6a537..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/internal/IAuthService.aidl +++ /dev/null @@ -1,11 +0,0 @@ -package com.google.android.gms.auth.api.internal; - -import com.google.android.gms.auth.api.internal.IAuthCallbacks; -//import com.google.android.gms.auth.api.proxy.ProxyGrpcRequest; -import com.google.android.gms.auth.api.proxy.ProxyRequest; - -interface IAuthService { - void performProxyRequest(IAuthCallbacks callbacks, in ProxyRequest request) = 0; -// void performProxyGrpcRequest(IAuthCallback callbacks, in ProxyGrpcRequest request) = 1; - void getSpatulaHeader(IAuthCallbacks callbacks) = 2; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/proxy/ProxyRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/proxy/ProxyRequest.aidl deleted file mode 100644 index fa5885f8..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/proxy/ProxyRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth.api.proxy; - -parcelable ProxyRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/proxy/ProxyResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/proxy/ProxyResponse.aidl deleted file mode 100644 index eae21f3c..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/proxy/ProxyResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.auth.api.proxy; - -parcelable ProxyResponse; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/appcert/IAppCertService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/appcert/IAppCertService.aidl deleted file mode 100644 index ee7f7338..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/auth/appcert/IAppCertService.aidl +++ /dev/null @@ -1,6 +0,0 @@ -package com.google.android.gms.auth.appcert; - -interface IAppCertService { - boolean fetchDeviceKey() = 0; - String getSpatulaHeader(String packageName) = 1; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/checkin/internal/ICheckinService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/checkin/internal/ICheckinService.aidl deleted file mode 100644 index 973de92f..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/checkin/internal/ICheckinService.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.checkin.internal; - -interface ICheckinService { - String getDeviceDataVersionInfo(); - long getLastCheckinSuccessTime(); - String getLastSimOperator(); -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/common/data/BitmapTeleporter.aidl b/play-services-api/src/main/aidl/com/google/android/gms/common/data/BitmapTeleporter.aidl deleted file mode 100644 index 832f0fd2..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/common/data/BitmapTeleporter.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.common.data; - -parcelable BitmapTeleporter; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/GoogleCertificatesQuery.aidl b/play-services-api/src/main/aidl/com/google/android/gms/common/internal/GoogleCertificatesQuery.aidl deleted file mode 100644 index ae02e068..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/GoogleCertificatesQuery.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.common.internal; - -parcelable GoogleCertificatesQuery; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/ICertData.aidl b/play-services-api/src/main/aidl/com/google/android/gms/common/internal/ICertData.aidl deleted file mode 100644 index 19839d7d..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/ICertData.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package com.google.android.gms.common.internal; - -import com.google.android.gms.dynamic.IObjectWrapper; - -interface ICertData { - IObjectWrapper getWrappedBytes(); - int remoteHashCode(); -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/IGoogleCertificatesApi.aidl b/play-services-api/src/main/aidl/com/google/android/gms/common/internal/IGoogleCertificatesApi.aidl deleted file mode 100644 index da539f32..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/IGoogleCertificatesApi.aidl +++ /dev/null @@ -1,12 +0,0 @@ -package com.google.android.gms.common.internal; - -import com.google.android.gms.common.internal.GoogleCertificatesQuery; -import com.google.android.gms.dynamic.IObjectWrapper; - -interface IGoogleCertificatesApi { - IObjectWrapper getGoogleCertficates(); - IObjectWrapper getGoogleReleaseCertificates(); - boolean isGoogleReleaseSigned(String packageName, IObjectWrapper certData); - boolean isGoogleSigned(String packageName, IObjectWrapper certData); - boolean isGoogleOrPlatformSigned(in GoogleCertificatesQuery query, IObjectWrapper packageManager); -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/ISignInButtonCreator.aidl b/play-services-api/src/main/aidl/com/google/android/gms/common/internal/ISignInButtonCreator.aidl deleted file mode 100644 index f6c53996..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/common/internal/ISignInButtonCreator.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.common.internal; - -import com.google.android.gms.dynamic.IObjectWrapper; - -interface ISignInButtonCreator { - IObjectWrapper createSignInButton(IObjectWrapper context, int size, int color); // returns View -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/common/server/FavaDiagnosticsEntity.aidl b/play-services-api/src/main/aidl/com/google/android/gms/common/server/FavaDiagnosticsEntity.aidl deleted file mode 100644 index 69b856bc..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/common/server/FavaDiagnosticsEntity.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.common.server; - -parcelable FavaDiagnosticsEntity; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/feedback/ErrorReport.aidl b/play-services-api/src/main/aidl/com/google/android/gms/feedback/ErrorReport.aidl deleted file mode 100644 index 0b4980d3..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/feedback/ErrorReport.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -parcelable ErrorReport; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/feedback/FileTeleporter.aidl b/play-services-api/src/main/aidl/com/google/android/gms/feedback/FileTeleporter.aidl deleted file mode 100644 index d6dd1583..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/feedback/FileTeleporter.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -parcelable FileTeleporter; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/feedback/LogOptions.aidl b/play-services-api/src/main/aidl/com/google/android/gms/feedback/LogOptions.aidl deleted file mode 100644 index 433575b0..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/feedback/LogOptions.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -parcelable LogOptions; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/feedback/ThemeSettings.aidl b/play-services-api/src/main/aidl/com/google/android/gms/feedback/ThemeSettings.aidl deleted file mode 100644 index 7b189c99..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/feedback/ThemeSettings.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -parcelable ThemeSettings; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/feedback/internal/IFeedbackCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/feedback/internal/IFeedbackCallbacks.aidl deleted file mode 100644 index eeb50c94..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/feedback/internal/IFeedbackCallbacks.aidl +++ /dev/null @@ -1,10 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback.internal; - -interface IFeedbackCallbacks { - void onServiceDestroy(); -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/feedback/internal/IFeedbackService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/feedback/internal/IFeedbackService.aidl deleted file mode 100644 index 48401b0d..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/feedback/internal/IFeedbackService.aidl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback.internal; - -import com.google.android.gms.feedback.FeedbackOptions; -import android.os.IBinder; -import android.os.IInterface; -import android.os.Parcel; -import com.google.android.gms.googlehelp.GoogleHelp; -import com.google.android.gms.feedback.ErrorReport; -import android.content.Context; -import android.os.Bundle; -import android.content.Intent; - - -interface IFeedbackService { - - boolean startFeedbackFlow(in ErrorReport errorReport) = 0; - - boolean silentSendFeedback(in ErrorReport errorReport) = 2; - - void saveFeedbackDataAsync(in Bundle bundle, long id) = 3; - - void saveFeedbackDataAsyncWithOption(in FeedbackOptions options, in Bundle bundle, long id) = 4; - - void startFeedbackFlowAsync(in ErrorReport errorReport, long id) = 5; - - boolean isValidConfiguration(in FeedbackOptions options) = 6; - -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassRequestParcel.aidl b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassRequestParcel.aidl deleted file mode 100644 index ffe2ae73..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassRequestParcel.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.gass.internal; - -parcelable GassRequestParcel; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassResponseParcel.aidl b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassResponseParcel.aidl deleted file mode 100644 index f8f40a73..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassResponseParcel.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.gass.internal; - -parcelable GassResponseParcel; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/IGassService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/IGassService.aidl deleted file mode 100644 index 7fafe56a..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/IGassService.aidl +++ /dev/null @@ -1,16 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.gass.internal; - -import android.os.Bundle; -import android.os.IInterface; -import com.google.android.gms.gass.internal.GassRequestParcel; -import com.google.android.gms.gass.internal.GassResponseParcel; - -interface IGassService { - GassResponseParcel getGassResponse(in GassRequestParcel gassRequestParcel) = 0; - Bundle getGassBundle(in Bundle bundle, int code) = 3; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/http/IGoogleHttpService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/http/IGoogleHttpService.aidl deleted file mode 100644 index 58ea0ba5..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/http/IGoogleHttpService.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.http; - -import android.os.Bundle; - -interface IGoogleHttpService { - Bundle checkUrl(String url); -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/people/internal/IPeopleCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/people/internal/IPeopleCallbacks.aidl deleted file mode 100644 index 75db9fae..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/people/internal/IPeopleCallbacks.aidl +++ /dev/null @@ -1,12 +0,0 @@ -package com.google.android.gms.people.internal; - -import android.os.Bundle; -import android.os.ParcelFileDescriptor; - -import com.google.android.gms.common.data.DataHolder; - -interface IPeopleCallbacks { - void onDataHolder(int code, in Bundle resolution, in DataHolder holder) = 1; - void onDataHolders(int code, in Bundle resolution, in DataHolder[] holders) = 3; - void onParcelFileDescriptor(int code, in Bundle resolution, in ParcelFileDescriptor fileDescriptor, in Bundle extras) = 4; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/people/internal/IPeopleService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/people/internal/IPeopleService.aidl deleted file mode 100644 index 62ae1478..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/people/internal/IPeopleService.aidl +++ /dev/null @@ -1,44 +0,0 @@ -package com.google.android.gms.people.internal; - -import android.os.Bundle; - -import com.google.android.gms.people.internal.IPeopleCallbacks; -import com.google.android.gms.common.server.FavaDiagnosticsEntity; -import com.google.android.gms.common.internal.ICancelToken; - -interface IPeopleService { - // void loadOwners1(IPeopleCallbacks var1, boolean var2, boolean var3, String var4, String var5); - // void loadCirclesOld(IPeopleCallbacks var1, String var2, String var3, String var4, int var5, String var6); - // void loadPeopleOld(IPeopleCallbacks var1, String var2, String var3, String var4, in List var5, int var6, boolean var7, long var8); - // void loadAvatarLegacy(IPeopleCallbacks var1, String var2, int var3, int var4); - // void loadContactImageLegacy(IPeopleCallbacks var1, long var2, boolean var4); - // void blockPerson(IPeopleCallbacks var1, String var2, String var3, String var4, boolean var5); - // Bundle syncRawContact(in Uri var1); - // void loadPeopleForAggregation8(IPeopleCallbacks var1, String var2, String var3, String var4, boolean var5, int var6); - // void setSyncToContactsSettings(IPeopleCallbacks var1, String var2, boolean var3, in String[] var4); - - // Bundle startSync(String var1, String var2); - // void requestSync(IPeopleCallbacks var1, String var2, String var3, in Uri var4); - // void updatePersonCirclesOld(IPeopleCallbacks var1, String var2, String var3, String var4, in List var5, in List var6); - // boolean isSyncToContactsEnabled(); - // Bundle requestSyncOld(String var1, String var2); - // void setAvatar(IPeopleCallbacks var1, String var2, String var3, in Uri var4, boolean var5); - // void loadCircles(IPeopleCallbacks var1, String var2, String var3, String var4, int var5, String var6, boolean var7); - // Bundle requestSyncOld19(String var1, String var2, long var3); - // void loadPeople20(IPeopleCallbacks var1, String var2, String var3, String var4, in List var5, int var6, boolean var7, long var8, String var10, int var11); - // void loadPeopleLive(IPeopleCallbacks var1, String var2, String var3, String var4, int var5, String var6); - // void updatePersonCircles(IPeopleCallbacks var1, String var2, String var3, String var4, in List var5, in List var6, in FavaDiagnosticsEntity var7); - // void loadRemoteImageLegacy(IPeopleCallbacks var1, String var2); - // void loadContactsGaiaIds24(IPeopleCallbacks var1, String var2, String var3); - // Bundle requestSyncOld25(String var1, String var2, long var3, boolean var5); - // void addCircle(IPeopleCallbacks var1, String var2, String var3, String var4, String var5); - // void addPeopleToCircle(IPeopleCallbacks var1, String var2, String var3, String var4, in List var5); - - Bundle registerDataChangedListener(IPeopleCallbacks callbacks, boolean register, String var3, String var4, int scopes) = 10; - void loadCircles(IPeopleCallbacks callbacks, String account, String pageGaiaId, String circleId, int type, String var6, boolean var7) = 18; - Bundle requestSync(String account, String var2, long var3, boolean var5, boolean var6) = 204; - void loadOwners(IPeopleCallbacks callbacks, boolean var2, boolean var3, String account, String var5, int sortOrder) = 304; - void loadPeopleForAggregation(IPeopleCallbacks callbacks, String account, String var3, String filter, int var5, boolean var6, int var7, int var8, String var9, boolean var10, int var11, int var12) = 401; - ICancelToken loadOwnerAvatar(IPeopleCallbacks callbacks, String account, String pageId, int size, int flags) = 504; - ICancelToken loadAutocompleteList(IPeopleCallbacks callbacks, String account, String pageId, boolean directorySearch, String var5, String query, int autocompleteType, int var8, int numberOfResults, boolean var10) = 506; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/phenotype/internal/IPhenotypeService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/phenotype/internal/IPhenotypeService.aidl deleted file mode 100644 index 3b306d53..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/phenotype/internal/IPhenotypeService.aidl +++ /dev/null @@ -1,35 +0,0 @@ -package com.google.android.gms.phenotype.internal; - -import com.google.android.gms.common.api.internal.IStatusCallback; -import com.google.android.gms.phenotype.internal.IPhenotypeCallbacks; -import com.google.android.gms.phenotype.Flag; -import com.google.android.gms.phenotype.RegistrationInfo; - -interface IPhenotypeService { - oneway void register(IPhenotypeCallbacks callbacks, String packageName, int version, in String[] p3, in byte[] p4) = 0; // returns via callbacks.onRegistered() - oneway void weakRegister(IPhenotypeCallbacks callbacks, String packageName, int version, in String[] p3, in int[] p4, in byte[] p5) = 1; // returns via callbacks.onWeakRegistered() - oneway void unregister(IPhenotypeCallbacks callbacks, String packageName) = 2; // returns via callbacks.onUnregistered() - oneway void getConfigurationSnapshot(IPhenotypeCallbacks callbacks, String packageName, String user) = 3; // returns via callbacks.onConfiguration() - oneway void commitToConfiguration(IPhenotypeCallbacks callbacks, String snapshotToken) = 4; // returns via callbacks.onCommitedToConfiguration() - oneway void getExperimentTokens(IPhenotypeCallbacks callbacks, String packageName, String logSourceName) = 5; // returns via callbacks.onExperimentTokens() - oneway void getDogfoodsToken(IPhenotypeCallbacks callbacks) = 6; // returns via callbacks.onDogfoodsToken() - oneway void setDogfoodsToken(IPhenotypeCallbacks callbacks, in byte[] p1) = 7; // returns via callbacks.onDogfoodsTokenSet() - oneway void getFlag(IPhenotypeCallbacks callbacks, String packageName, String name, int type) = 8; // returns via callbacks.onFlag() - oneway void getCommitedConfiguration(IPhenotypeCallbacks callbacks, String packageName) = 9; // returns via callbacks.onCommittedConfiguration() - oneway void getConfigurationSnapshot2(IPhenotypeCallbacks callbacks, String packageName, String user, String p3) = 10; // returns via callbacks.onConfiguration() - oneway void syncAfterOperation(IPhenotypeCallbacks callbacks, String packageName, long version) = 11; // returns via callbacks.onSyncFinished() - oneway void registerSync(IPhenotypeCallbacks callbacks, String packageName, int version, in String[] p3, in byte[] p4, String p5, String p6) = 12; // returns via callbacks.onConfiguration() - oneway void setFlagOverrides(IPhenotypeCallbacks callbacks, String packageName, String user, String flagName, int flagType, int flagDataType, String flagValue) = 13; // returns via callbacks.onFlagOverridesSet() - oneway void deleteFlagOverrides(IPhenotypeCallbacks callbacks, String packageName, String user, String flagName) = 14; // returns via callbacks.onFlagOverrides() - oneway void listFlagOverrides(IPhenotypeCallbacks callbacks, String packageName, String user, String flagName) = 15; // returns via callbacks.onFlagOverrides() - - oneway void clearFlagOverrides(IPhenotypeCallbacks callbacks, String packageName, String user) = 17; // returns via callbacks.onFlagOverridesSet() - oneway void bulkRegister(IPhenotypeCallbacks callbacks, in RegistrationInfo[] infos) = 18; // returns via callbacks.onRegister() - oneway void setAppSpecificProperties(IPhenotypeCallbacks callbacks, String packageName, in byte[] p2) = 19; // returns via callbacks.onAppSpecificPropertiesSet() - - oneway void getServingVersion(IPhenotypeCallbacks callbacks) = 21; // returns via callbacks.onServingVersion() - oneway void getExperimentTokensForLogging(IPhenotypeCallbacks callbacks, String packageName, String logSourceName, String p3, String clientPackageName) = 22; // returns via callbacks.onExperimentTokens() - oneway void syncAllAfterOperation(IPhenotypeCallbacks callbacks, long p1) = 23; // returns via callbacks.onSyncFinished() - oneway void setRuntimeProperties(IStatusCallback callbacks, String p1, in byte[] p2) = 24; -// oneway void setExternalExperiments(IStatusCallback callbacks, String p1, in List p2) = 25; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/potokens/PoToken.aidl b/play-services-api/src/main/aidl/com/google/android/gms/potokens/PoToken.aidl deleted file mode 100644 index 8cf0bb7e..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/potokens/PoToken.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.potokens; - -parcelable PoToken; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/potokens/internal/IPoTokensService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/potokens/internal/IPoTokensService.aidl deleted file mode 100644 index 938c848a..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/potokens/internal/IPoTokensService.aidl +++ /dev/null @@ -1,14 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.potokens.internal; - -import com.google.android.gms.common.api.internal.IStatusCallback; -import com.google.android.gms.potokens.internal.ITokenCallbacks; - -interface IPoTokensService { - void responseStatus(IStatusCallback call, int code) = 1; - void responseStatusToken(ITokenCallbacks call, int i, in byte[] bArr) = 2; -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/potokens/internal/ITokenCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/potokens/internal/ITokenCallbacks.aidl deleted file mode 100644 index 55c71dfe..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/potokens/internal/ITokenCallbacks.aidl +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.potokens.internal; - -import com.google.android.gms.common.api.Status; -import com.google.android.gms.potokens.PoToken; - -interface ITokenCallbacks { - void responseToken(in Status status, in PoToken token) = 1; -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/PseudonymousIdToken.aidl b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/PseudonymousIdToken.aidl deleted file mode 100644 index b8d88c14..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/PseudonymousIdToken.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.pseudonymous; - -parcelable PseudonymousIdToken; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdCallbacks.aidl deleted file mode 100644 index f6a47ded..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdCallbacks.aidl +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.pseudonymous.internal; - -import com.google.android.gms.common.api.Status; -import com.google.android.gms.pseudonymous.PseudonymousIdToken; - -interface IPseudonymousIdCallbacks { - void onGetTokenResponse(in Status status, in PseudonymousIdToken token) = 0; - void onSetTokenResponse(in Status status) = 1; - void onGetLastResetWallTimeMsResponse(in Status status, long time) = 2; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdService.aidl deleted file mode 100644 index e99f7df6..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdService.aidl +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.pseudonymous.internal; - -import com.google.android.gms.pseudonymous.internal.IPseudonymousIdCallbacks; -import com.google.android.gms.pseudonymous.PseudonymousIdToken; - -interface IPseudonymousIdService { - void getToken(IPseudonymousIdCallbacks call) = 0; - void setToken(IPseudonymousIdCallbacks call, in PseudonymousIdToken token) = 1; - void getLastResetWallTimeMs(IPseudonymousIdCallbacks callbacks) = 2; -} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.aidl deleted file mode 100644 index 715a75c0..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.aidl +++ /dev/null @@ -1,7 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ -package com.google.android.gms.semanticlocation; - -parcelable SemanticLocationEventRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/ISemanticLocationService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/ISemanticLocationService.aidl deleted file mode 100644 index de75deff..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/ISemanticLocationService.aidl +++ /dev/null @@ -1,18 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ -package com.google.android.gms.semanticlocation.internal; - -import android.app.PendingIntent; -import android.os.IInterface; -import com.google.android.gms.semanticlocation.SemanticLocationEventRequest; -import com.google.android.gms.semanticlocation.internal.SemanticLocationParameters; -import com.google.android.gms.common.api.internal.IStatusCallback; - -interface ISemanticLocationService { - void registerSemanticLocationEvents(in SemanticLocationParameters params, IStatusCallback callback, in SemanticLocationEventRequest request, in PendingIntent pendingIntent) = 0; - void unregisterSemanticLocationEvents(in SemanticLocationParameters params, IStatusCallback callback, in PendingIntent pendingIntent) = 1; - - void setIncognitoMode(in SemanticLocationParameters params, IStatusCallback callback, boolean mode) = 4; -} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.aidl b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.aidl deleted file mode 100644 index 1ac959eb..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.aidl +++ /dev/null @@ -1,7 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ -package com.google.android.gms.semanticlocation.internal; - -parcelable SemanticLocationParameters; diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEvent.java b/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEvent.java deleted file mode 100644 index c147bcac..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth; - -import org.microg.safeparcel.AutoSafeParcelable; - -<<<<<<< HEAD:play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEvent.java -public class AccountChangeEvent extends AutoSafeParcelable { - public static Creator CREATOR = new AutoCreator<>(AccountChangeEvent.class); -======= -import java.util.List; - -public class GetAllCapabilitiesResponse extends AutoSafeParcelable { - @Field(1) - private int versionCode = 1; - @Field(2) - public int statusCode; - @Field(3) - public List capabilities; - - public static final Creator CREATOR = findCreator(GetAllCapabilitiesResponse.class); ->>>>>>> 1cc72500 (Wearable: Invoke callback on WearableService.getAllCapabilities()):play-services-wearable/src/main/java/com/google/android/gms/wearable/internal/GetAllCapabilitiesResponse.java -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEventsRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEventsRequest.java deleted file mode 100644 index cf8561df..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEventsRequest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth; - -import static org.microg.gms.auth.AuthConstants.DEFAULT_ACCOUNT_TYPE; - -import android.accounts.Account; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class AccountChangeEventsRequest extends AutoSafeParcelable { - @Field(3) - @Deprecated - private final String accountName; - @Field(4) - private final Account account; - - public AccountChangeEventsRequest(String accountName, Account account) { - this.accountName = accountName; - this.account = account; - } - - public Account getAccount() { - if (account != null) return account; - if (accountName != null) return new Account(accountName, DEFAULT_ACCOUNT_TYPE); - return null; - } - - public static Creator CREATOR = new AutoCreator<>(AccountChangeEventsRequest.class); - -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEventsResponse.java b/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEventsResponse.java deleted file mode 100644 index 10491379..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/AccountChangeEventsResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class AccountChangeEventsResponse extends AutoSafeParcelable { - - public AccountChangeEventsResponse() { - } - - public static Creator CREATOR = new AutoCreator<>(AccountChangeEventsResponse.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/GetHubTokenInternalResponse.java b/play-services-api/src/main/java/com/google/android/gms/auth/GetHubTokenInternalResponse.java deleted file mode 100644 index 4845ed41..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/GetHubTokenInternalResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class GetHubTokenInternalResponse extends AutoSafeParcelable { - @Field(2) - public String status; - public static final Creator CREATOR = new AutoCreator<>(GetHubTokenInternalResponse.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/GetHubTokenRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/GetHubTokenRequest.java deleted file mode 100644 index 2c4e973c..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/GetHubTokenRequest.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class GetHubTokenRequest extends AutoSafeParcelable { - @Field(1) - public String accountName; - @Field(2) - public String service; - @Field(3) - public String packageName; - public static final Creator CREATOR = new AutoCreator<>(GetHubTokenRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/HasCababilitiesRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/HasCababilitiesRequest.java deleted file mode 100644 index c9907fa8..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/HasCababilitiesRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth; - -import android.accounts.Account; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class HasCababilitiesRequest extends AutoSafeParcelable { - @Field(1) - public Account account; - public static final Creator CREATOR = new AutoCreator<>(HasCababilitiesRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/TokenData.java b/play-services-api/src/main/java/com/google/android/gms/auth/TokenData.java deleted file mode 100644 index df3768c8..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/TokenData.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth; - -import com.google.android.gms.common.api.Scope; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.List; - -public class TokenData extends AutoSafeParcelable { - - @SafeParceled(2) - public final String token; - - @SafeParceled(3) - public final Long expiry; - - @SafeParceled(5) - public final boolean isOAuth; - - @SafeParceled(value = 6, subClass = Scope.class) - public final List scopes; - - public TokenData() { - token = null; - expiry = null; - isOAuth = false; - scopes = null; - } - - public TokenData(String token, Long expiry, boolean isOAuth, List scopes) { - this.token = token; - this.expiry = expiry; - this.isOAuth = isOAuth; - this.scopes = scopes; - } - - public TokenData(String token, Long expiry) { - this.token = token; - this.expiry = expiry; - this.isOAuth = false; - this.scopes = null; - } - - public static final Creator CREATOR = new AutoCreator<>(TokenData.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/Credential.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/Credential.java deleted file mode 100644 index 9ade5cc0..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/Credential.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2016, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.credentials; - -import android.net.Uri; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; - -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -@PublicApi -public class Credential extends AutoSafeParcelable { - - @Field(1) - private String id; - @Field(2) - private String name; - @Field(3) - private Uri profilePictureUri; - @Field(value = 4, subClass = IdToken.class) - private List tokens; - @Field(5) - private String password; - @Field(6) - private String accountType; - @Field(7) - private String generatedPassword; - - private Credential() { - } - - /** - * Returns the type of federated identity account used to sign in the user. While this may be - * any string, it is strongly recommended that values from {@link com.google.android.gms.auth.api.credentials.IdentityProviders} - * are used, which are the login domains for common identity providers. - * - * @return A string identifying the federated identity provider associated with this account, - * typically in the form of the identity provider's login domain. null will be returned if the - * credential is a password credential. - */ - public String getAccountType() { - return accountType; - } - - /** - * Returns the credential identifier, typically an email address or user name, though it may - * also be some encoded unique identifier for a federated identity account. - */ - public String getId() { - return id; - } - - /** - * Returns the display name of the credential, if available. Typically, the display name will - * be the name of the user, or some other string which the user can easily recognize and - * distinguish from other accounts they may have. - */ - public String getName() { - return name; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof Credential)) return false; - - Credential that = (Credential) o; - - if (!Objects.equals(id, that.id)) return false; - if (!Objects.equals(name, that.name)) return false; - if (!Objects.equals(profilePictureUri, that.profilePictureUri)) - return false; - if (!Objects.equals(password, that.password)) - return false; - if (!Objects.equals(accountType, that.accountType)) - return false; - return Objects.equals(generatedPassword, that.generatedPassword); - - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{id, name, profilePictureUri, password, accountType, generatedPassword}); - } - - public static class Builder { - private final String id; - private String name; - private final Uri profilePictureUri; - private final String password; - private String accountType; - - @PublicApi(exclude = true) - public List tokens; - @PublicApi(exclude = true) - private final String generatedPassword; - - /** - * Copies the information stored in an existing credential, in order to allow that information to be modified. - * - * @param credential the existing credential - */ - public Builder(Credential credential) { - this.id = credential.id; - this.name = credential.name; - this.profilePictureUri = credential.profilePictureUri; - this.password = credential.password; - this.accountType = credential.accountType; - this.tokens = credential.tokens; - this.generatedPassword = credential.generatedPassword; - } - - public Credential build() { - Credential credential = new Credential(); - credential.id = id; - credential.name = name; - credential.profilePictureUri = profilePictureUri; - credential.password = password; - credential.accountType = accountType; - credential.tokens = tokens; - credential.generatedPassword = generatedPassword; - return credential; - } - - /** - * Specifies the account type for a federated credential. The value should be set to - * identity provider's login domain, such as "https://accounts.google.com" for Google - * accounts. The login domains for common identity providers are listed in {@link IdentityProviders}. - * - * @param accountType The type of the account. Typically, one of the values in {@link IdentityProviders}. - */ - public Builder setAccountType(String accountType) { - this.accountType = accountType; - return this; - } - - /** - * Sets the display name for the credential, which should be easy for the user to recognize - * as associated to the credential, and distinguishable from other credentials they may - * have. This string will be displayed more prominently than, or instead of, the account ID - * whenever available. In most cases, the name of the user is sufficient. - */ - public Builder setName(String name) { - this.name = name; - return this; - } - - } - - public static final Creator CREATOR = new AutoCreator<>(Credential.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialPickerConfig.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialPickerConfig.java deleted file mode 100644 index 41ca2191..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialPickerConfig.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2016, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.credentials; - -import androidx.annotation.NonNull; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; - -@PublicApi -public class CredentialPickerConfig extends AutoSafeParcelable { - - @Field(1) - private final boolean showAddAccountButton; - @Field(2) - private final boolean showCancelButton; - @Field(3) - private final boolean forNewAccount; - - public CredentialPickerConfig(boolean showAddAccountButton, boolean showCancelButton, boolean forNewAccount) { - this.showAddAccountButton = showAddAccountButton; - this.showCancelButton = showCancelButton; - this.forNewAccount = forNewAccount; - } - - /** - * @deprecated It was determined that this method was not useful for developers. - */ - @Deprecated - public boolean isForNewAccount() { - return forNewAccount; - } - - @NonNull - @Override - public String toString() { - return "CredentialPickerConfig{" + - "showAddAccountButton=" + showAddAccountButton + - ", showCancelButton=" + showCancelButton + - '}'; - } - - public static class Builder { - private final boolean showAddAccountButton; - private final boolean showCancelButton; - private final boolean forNewAccount; - - public Builder(boolean showAddAccountButton, boolean showCancelButton, boolean forNewAccount) { - this.showAddAccountButton = showAddAccountButton; - this.showCancelButton = showCancelButton; - this.forNewAccount = forNewAccount; - } - - public CredentialPickerConfig build() { - return new CredentialPickerConfig(showAddAccountButton, showCancelButton, forNewAccount); - } - - } - - public static final Creator CREATOR = new AutoCreator<>(CredentialPickerConfig.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialRequest.java deleted file mode 100644 index c4961d14..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialRequest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2016, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.credentials; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class CredentialRequest extends AutoSafeParcelable { - - @Field(1) - private final boolean passwordLoginSupported; - - public CredentialRequest(boolean passwordLoginSupported) { - this.passwordLoginSupported = passwordLoginSupported; - } - - /** - * @deprecated Use {@link #isPasswordLoginSupported()} - */ - @Deprecated - public boolean getSupportsPasswordLogin() { - return isPasswordLoginSupported(); - } - - public boolean isPasswordLoginSupported() { - return passwordLoginSupported; - } - - public static final Creator CREATOR = new AutoCreator(CredentialRequest.class); - - public static class Builder { - - public Builder() { - } - - public void setAccountTypes(String... accountTypes) { - accountTypes.clone(); - } - } -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/HintRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/HintRequest.java deleted file mode 100644 index 3f9336f4..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/HintRequest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.credentials; - -import androidx.annotation.NonNull; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; - -import java.util.Arrays; - -/** - * Parameters for requesting the display of the hint picker, via {@link CredentalsApi#getHintPickerIntent()}. - * Instances can be created using {@link HintRequest.Builder}. - */ -@PublicApi -public class HintRequest extends AutoSafeParcelable { - - @Field(1) - private final CredentialPickerConfig hintPickerConfig; - @Field(2) - private final boolean emailAddressIdentifierSupported; - @Field(3) - private final boolean phoneNumberIdentifierSupported; - @Field(4) - private final String[] accountTypes; - @Field(5) - private final boolean idTokenRequested; - @Field(6) - private final String serverClientId; - @Field(7) - private final String idTokenNonce; - - public HintRequest(CredentialPickerConfig hintPickerConfig, boolean emailAddressIdentifierSupported, boolean phoneNumberIdentifierSupported, String[] accountTypes, boolean idTokenRequested, String serverClientId, String idTokenNonce) { - this.hintPickerConfig = hintPickerConfig; - this.emailAddressIdentifierSupported = emailAddressIdentifierSupported; - this.phoneNumberIdentifierSupported = phoneNumberIdentifierSupported; - this.accountTypes = accountTypes; - this.idTokenRequested = idTokenRequested; - this.serverClientId = serverClientId; - this.idTokenNonce = idTokenNonce; - } - - public static final Creator CREATOR = new AutoCreator<>(HintRequest.class); - - @NonNull - @Override - public String toString() { - return "HintRequest{" + - "hintPickerConfig=" + hintPickerConfig + - ", emailAddressIdentifierSupported=" + emailAddressIdentifierSupported + - ", phoneNumberIdentifierSupported=" + phoneNumberIdentifierSupported + - ", accountTypes=" + Arrays.toString(accountTypes) + - ", idTokenRequested=" + idTokenRequested + - ", serverClientId='" + serverClientId + '\'' + - ", idTokenNonce='" + idTokenNonce + '\'' + - '}'; - } - - public static class Builder { - private final CredentialPickerConfig hintPickerConfig; - private final boolean emailAddressIdentifierSupported; - private final boolean phoneNumberIdentifierSupported; - private final String[] accountTypes; - private final String serverClientId; - private final String idTokenNonce; - - public Builder(CredentialPickerConfig hintPickerConfig, boolean emailAddressIdentifierSupported, boolean phoneNumberIdentifierSupported, String[] accountTypes, String serverClientId, String idTokenNonce) { - this.hintPickerConfig = hintPickerConfig; - this.emailAddressIdentifierSupported = emailAddressIdentifierSupported; - this.phoneNumberIdentifierSupported = phoneNumberIdentifierSupported; - this.accountTypes = accountTypes; - this.serverClientId = serverClientId; - this.idTokenNonce = idTokenNonce; - } - - /** - * Builds a {@link HintRequest}. - */ - public HintRequest build() { - boolean idTokenRequested = true; - return new HintRequest(hintPickerConfig, emailAddressIdentifierSupported, phoneNumberIdentifierSupported, accountTypes, idTokenRequested, serverClientId, idTokenNonce); - } - - } -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdToken.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdToken.java deleted file mode 100644 index 5d84423e..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdToken.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2016, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.credentials; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; - -@PublicApi -public class IdToken extends AutoSafeParcelable { - - @Field(1) - private final String accountType; - - @Field(2) - private final String id; - - public IdToken(String accountType, String id) { - this.accountType = accountType; - this.id = id; - } - - /** - * Returns {@code AccountManager} account type for the token. - */ - public String getAccountType() { - return accountType; - } - - public static final Creator CREATOR = new AutoCreator<>(IdToken.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdentityProviders.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdentityProviders.java deleted file mode 100644 index 1d974993..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdentityProviders.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.credentials; - -/** - * Identity provider constants for use with {@link CredentialRequest.Builder#setAccountTypes(String...)} - */ -public final class IdentityProviders { -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.java deleted file mode 100644 index e560ddc5..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.api.credentials.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class DeleteRequest extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator<>(DeleteRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.java deleted file mode 100644 index 5fd6fcb7..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.api.credentials.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class GeneratePasswordRequest extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator<>(GeneratePasswordRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/SaveRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/SaveRequest.java deleted file mode 100644 index 24a9d92f..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/SaveRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.api.credentials.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class SaveRequest extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator<>(SaveRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/proxy/ProxyRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/proxy/ProxyRequest.java deleted file mode 100644 index dc1fbd39..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/proxy/ProxyRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.proxy; - -import androidx.annotation.NonNull; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class ProxyRequest extends AutoSafeParcelable { - - @Field(1) - public String url; - - @NonNull - @Override - public String toString() { - return url; - } - - public static final Creator CREATOR = new AutoCreator<>(ProxyRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/proxy/ProxyResponse.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/proxy/ProxyResponse.java deleted file mode 100644 index 263d2e20..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/api/proxy/ProxyResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.proxy; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class ProxyResponse extends AutoSafeParcelable { - @Field(1) - public int gmsStatusCode; - - public static final Creator CREATOR = new AutoCreator<>(ProxyResponse.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/AccountRecoveryGuidanceRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/AccountRecoveryGuidanceRequest.java deleted file mode 100644 index 1c267ed1..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/AccountRecoveryGuidanceRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.dataservice; - -import android.accounts.Account; - -import org.microg.gms.auth.AuthConstants; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class AccountRecoveryGuidanceRequest extends AutoSafeParcelable { - - @SafeParceled(2) - @Deprecated - public final String accountName; - @SafeParceled(3) - public final Account account; - - public AccountRecoveryGuidanceRequest(String accountName) { - this.accountName = accountName; - this.account = new Account(accountName, AuthConstants.DEFAULT_ACCOUNT_TYPE); - } - - public AccountRecoveryGuidanceRequest(Account account) { - this.accountName = account.name; - this.account = account; - } - - public static final Creator CREATOR = new AutoCreator<>(AccountRecoveryGuidanceRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/AccountRemovalRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/AccountRemovalRequest.java deleted file mode 100644 index dc90a7d0..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/AccountRemovalRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.dataservice; - -import android.accounts.Account; - -import org.microg.gms.auth.AuthConstants; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class AccountRemovalRequest extends AutoSafeParcelable { - - @SafeParceled(2) - @Deprecated - public final String accountName; - @SafeParceled(3) - public final Account account; - - public AccountRemovalRequest(String accountName) { - this.accountName = accountName; - this.account = new Account(accountName, AuthConstants.DEFAULT_ACCOUNT_TYPE); - } - - public AccountRemovalRequest(Account account) { - this.accountName = account.name; - this.account = account; - } - - public static final Creator CREATOR = new AutoCreator(AccountRemovalRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/ConfirmCredentialsRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/ConfirmCredentialsRequest.java deleted file mode 100644 index 9edad8b2..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/ConfirmCredentialsRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.dataservice; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class ConfirmCredentialsRequest extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator<>(ConfirmCredentialsRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/TokenRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/TokenRequest.java deleted file mode 100644 index 73062668..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/dataservice/TokenRequest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.dataservice; - -import android.accounts.Account; -import android.os.Bundle; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -// TODO -public class TokenRequest extends AutoSafeParcelable{ - - @SafeParceled(3) - public String accountName; - @SafeParceled(4) - public Bundle extras; - @SafeParceled(9) - public String consent; - @SafeParceled(15) - public String accountType; - - public Account getAccount() { - return new Account(accountName, accountType); - } - - public static final Creator CREATOR = new AutoCreator<>(TokenRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/delegate/ConfirmCredentialsWorkflowRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/delegate/ConfirmCredentialsWorkflowRequest.java deleted file mode 100644 index b8e5ed63..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/delegate/ConfirmCredentialsWorkflowRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.delegate; - -import android.accounts.Account; -import android.os.Bundle; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class ConfirmCredentialsWorkflowRequest extends AutoSafeParcelable { - @SafeParceled(2) - public String accountName; - @SafeParceled(4) - public Bundle extras; - @SafeParceled(5) - public Account account; - - public static final Creator CREATOR = new AutoCreator<>(ConfirmCredentialsWorkflowRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/AccountCredentials.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/AccountCredentials.java deleted file mode 100644 index 67e7c7db..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/AccountCredentials.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.shared; - -import android.accounts.Account; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -// TODO -public class AccountCredentials extends AutoSafeParcelable { - @SafeParceled(3) - public String accountName; - @SafeParceled(9) - public String accountType; - - public Account getAccount() { - return new Account(accountName, accountType); - } - - public static final Creator CREATOR = new AutoCreator<>(AccountCredentials.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/AppDescription.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/AppDescription.java deleted file mode 100644 index 1ccdf4f6..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/AppDescription.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.shared; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class AppDescription extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator<>(AppDescription.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/CaptchaSolution.java b/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/CaptchaSolution.java deleted file mode 100644 index ce1d3f61..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/auth/firstparty/shared/CaptchaSolution.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.auth.firstparty.shared; - -import org.microg.safeparcel.AutoSafeParcelable; - -// TODO -public class CaptchaSolution extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator<>(CaptchaSolution.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/common/data/BitmapTeleporter.java b/play-services-api/src/main/java/com/google/android/gms/common/data/BitmapTeleporter.java deleted file mode 100644 index 1af37b66..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/common/data/BitmapTeleporter.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.common.data; - -import android.graphics.Bitmap; -import android.os.Parcel; -import android.os.ParcelFileDescriptor; -import android.util.Log; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -import java.io.Closeable; -import java.io.DataInputStream; -import java.io.File; -import java.io.IOException; -import java.nio.ByteBuffer; - -@SafeParcelable.Class -public class BitmapTeleporter extends AbstractSafeParcelable { - - @Field(1) - public int versionCode; - @Field(2) - public ParcelFileDescriptor fileDescriptor; - @Field(3) - public int status; - public boolean isParceled; - public Bitmap targetBitmap; - public File targetDirectory; - - public BitmapTeleporter() { - } - - public BitmapTeleporter(int version, ParcelFileDescriptor parcelFileDescriptor, int status) { - this.versionCode = version; - this.fileDescriptor = parcelFileDescriptor; - this.status = status; - this.targetBitmap = null; - this.isParceled = false; - } - - public BitmapTeleporter(Bitmap bitmap) { - this.versionCode = 1; - this.fileDescriptor = null; - this.status = 0; - this.targetBitmap = bitmap; - this.isParceled = true; - } - - public final Bitmap createTargetBitmap() { - if (!this.isParceled) { - ParcelFileDescriptor parcelFileDescriptor = this.fileDescriptor; - if (parcelFileDescriptor == null) { - throw new NullPointerException("null reference"); - } - DataInputStream dataInputStream = new DataInputStream(new ParcelFileDescriptor.AutoCloseInputStream(parcelFileDescriptor)); - try { - try { - byte[] bArr = new byte[dataInputStream.readInt()]; - int readInt = dataInputStream.readInt(); - int readInt2 = dataInputStream.readInt(); - Bitmap.Config valueOf = Bitmap.Config.valueOf(dataInputStream.readUTF()); - dataInputStream.read(bArr); - close(dataInputStream); - ByteBuffer wrap = ByteBuffer.wrap(bArr); - Bitmap createBitmap = Bitmap.createBitmap(readInt, readInt2, valueOf); - createBitmap.copyPixelsFromBuffer(wrap); - this.targetBitmap = createBitmap; - this.isParceled = true; - } catch (IOException e) { - throw new IllegalStateException("Could not read from parcel file descriptor", e); - } - } catch (Throwable th) { - close(dataInputStream); - throw th; - } - } - return this.targetBitmap; - } - - public final void setTargetDirectory(File file) { - if (file == null) { - throw new NullPointerException("Cannot set null temp directory"); - } - this.targetDirectory = file; - } - - private static void close(Closeable closeable) { - try { - closeable.close(); - } catch (IOException e) { - Log.w("BitmapTeleporter", "Could not close stream", e); - } - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(BitmapTeleporter.class); - -} diff --git a/play-services-api/src/main/java/com/google/android/gms/common/internal/CertData.java b/play-services-api/src/main/java/com/google/android/gms/common/internal/CertData.java deleted file mode 100644 index 38b86bc8..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/common/internal/CertData.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.internal; - -import android.os.IBinder; -import android.os.RemoteException; - -import androidx.annotation.Nullable; -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; - -import java.util.Arrays; - -public class CertData extends ICertData.Stub { - private final byte[] bytes; - private final int hashCode; - - public CertData(byte[] bytes) { - this.bytes = bytes; - if (bytes.length < 25) throw new RuntimeException("CertData to small"); - hashCode = Arrays.hashCode(Arrays.copyOfRange(bytes, 0, 25)); - } - - @Override - public int hashCode() { - return hashCode; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof ICertData)) return false; - ICertData cert = (ICertData) obj; - try { - if (cert.remoteHashCode() != hashCode()) return false; - return Arrays.equals(ObjectWrapper.unwrapTyped(cert.getWrappedBytes(), byte[].class), getBytes()); - } catch (RemoteException e) { - return false; - } - } - - public byte[] getBytes() { - return bytes; - } - - @Override - public IObjectWrapper getWrappedBytes() { - return ObjectWrapper.wrap(getBytes()); - } - - @Override - public int remoteHashCode() { - return hashCode(); - } - - @Nullable - public static CertData unwrap(IBinder certDataBinder) { - if (certDataBinder instanceof CertData) { - return (CertData) certDataBinder; - } else if (certDataBinder instanceof IObjectWrapper) { - return unwrap((IObjectWrapper) certDataBinder); - } else if (certDataBinder instanceof ICertData) { - return unwrap((ICertData) certDataBinder); - } - return null; - } - - public static CertData unwrap(IObjectWrapper certDataWrapper) { - CertData certData = ObjectWrapper.unwrapTyped(certDataWrapper, CertData.class); - if (certData != null) return certData; - byte[] bytes = ObjectWrapper.unwrapTyped(certDataWrapper, byte[].class); - if (bytes != null) return new CertData(bytes); - ICertData iCertData = ObjectWrapper.unwrapTyped(certDataWrapper, ICertData.class); - if (iCertData != null) return unwrap(iCertData); - return null; - } - - public static CertData unwrap(ICertData iCertData) { - if (iCertData == null) return null; - if (iCertData instanceof CertData) return (CertData) iCertData; - try { - byte[] bytes = ObjectWrapper.unwrapTyped(iCertData.getWrappedBytes(), byte[].class); - if (bytes != null) { - return new CertData(bytes); - } - } catch (RemoteException e) { - // Ignore - } - return null; - } -} diff --git a/play-services-api/src/main/java/com/google/android/gms/common/internal/GoogleCertificatesQuery.java b/play-services-api/src/main/java/com/google/android/gms/common/internal/GoogleCertificatesQuery.java deleted file mode 100644 index 86445d32..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/common/internal/GoogleCertificatesQuery.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.internal; - -import android.os.IBinder; -import android.os.RemoteException; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GoogleCertificatesQuery extends AutoSafeParcelable { - @SafeParceled(1) - private final String packageName; - @SafeParceled(2) - private final IBinder certDataBinder; - private CertData certData; - @SafeParceled(3) - private final boolean allowNonRelease; - - public GoogleCertificatesQuery(String packageName, IBinder certDataBinder, boolean allowNonRelease) { - this.packageName = packageName; - this.certDataBinder = certDataBinder; - this.allowNonRelease = allowNonRelease; - } - - public String getPackageName() { - return packageName; - } - - public CertData getCertData() { - if (certData == null && certDataBinder != null) { - certData = CertData.unwrap(certDataBinder); - } - return certData; - } - - public static final Creator CREATOR = new AutoCreator(GoogleCertificatesQuery.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/common/server/FavaDiagnosticsEntity.java b/play-services-api/src/main/java/com/google/android/gms/common/server/FavaDiagnosticsEntity.java deleted file mode 100644 index d32e668b..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/common/server/FavaDiagnosticsEntity.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.server; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class FavaDiagnosticsEntity extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator<>(FavaDiagnosticsEntity.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/feedback/ErrorReport.java b/play-services-api/src/main/java/com/google/android/gms/feedback/ErrorReport.java deleted file mode 100644 index 55d6d359..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/feedback/ErrorReport.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -import android.app.ApplicationErrorReport; -import android.graphics.Bitmap; -import android.graphics.RectF; -import android.os.Bundle; -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.data.BitmapTeleporter; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -import java.util.List; - -@SafeParcelable.Class -public class ErrorReport extends AbstractSafeParcelable { - @Field(2) - public ApplicationErrorReport applicationErrorReport; - @Field(3) - public String feedbackMsg; - @Field(4) - public int versionCode; - @Field(5) - public String versionName; - @Field(6) - public String mobileDevice; - @Field(7) - public String mobileDisplay; - @Field(8) - public String mobileType; - @Field(9) - public String mobileModel; - @Field(10) - public String mobileProduct; - @Field(11) - public String mobileFingerprint; - @Field(12) - public int mobileSdkInt; - @Field(13) - public String mobileRelease; - @Field(14) - public String mobileIncremental; - @Field(15) - public String mobileCodeName; - @Field(16) - public String mobileBoard; - @Field(17) - public String mobileBrand; - @Field(18) - public String[] unknownStringArray18; - @Field(19) - public String[] unknownStringArray19; - @Field(20) - public String[] unknownStringArray20; - @Field(21) - public String unknownString21; - @Field(22) - public String screenshotImgSrc; - @Field(23) - public byte[] screenshotImgData; - @Field(24) - public int screenshotHeight; - @Field(25) - public int screenshotWidth; - @Field(26) - public int phoneType; - @Field(27) - public int networkType; - @Field(28) - public String networkOperatorName; - @Field(29) - public String email; - @Field(30) - public String languageTag; - @Field(31) - public Bundle bundle; - @Field(32) - public boolean isFixedUri; - @Field(33) - public int mobileCountryCode; - @Field(34) - public int mobileNetworkCode; - @Field(35) - public boolean unknownBool35; - @Field(36) - public String exceptionClassName; - @Field(37) - public String throwFileName; - @Field(38) - public int throwLineNumber; - @Field(39) - public String throwClassName; - @Field(40) - public String throwMethodName; - @Field(41) - public String stackTrace; - @Field(42) - public String exceptionMessage; - @Field(43) - public String unknownString43; - @Field(44) - public String unknownString44; - @Field(45) - public String packageName; - @Field(46) - public BitmapTeleporter bitmapTeleporter; - @Field(47) - public String unknownString47; - @Field(48) - public FileTeleporter[] files; - @Field(49) - public String[] unknownByteArray49; - @Field(50) - public boolean unknownBool50; - @Field(51) - public String unknownString51; - @Field(52) - public ThemeSettings themeSettings; - @Field(53) - public LogOptions logOptions; - @Field(54) - public String unknownString54; - @Field(55) - public boolean unknownBool55; - @Field(56) - public Bundle bundleText; - @Field(57) - public List rectFS; - @Field(58) - public boolean unknownBool58; - @Field(59) - public Bitmap bitmap; - @Field(60) - public String unknownString60; - @Field(61) - public List camList; - @Field(62) - public int unknownInt62; - @Field(63) - public int unknownInt63; - @Field(64) - public String[] unknownStringArray64; - @Field(65) - public String[] unknownStringArray65; - @Field(66) - public String[] unknownStringArray66; - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(ErrorReport.class); - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - -} diff --git a/play-services-api/src/main/java/com/google/android/gms/feedback/FeedbackOptions.java b/play-services-api/src/main/java/com/google/android/gms/feedback/FeedbackOptions.java deleted file mode 100644 index 679fe0f2..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/feedback/FeedbackOptions.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -import android.app.ApplicationErrorReport; -import android.graphics.Bitmap; -import android.os.Bundle; -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.data.BitmapTeleporter; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -import java.util.List; - -@SafeParcelable.Class -public class FeedbackOptions extends AbstractSafeParcelable { - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(FeedbackOptions.class); - - @Field(2) - public String unknownString2; - @Field(3) - public Bundle unknownBundle3; - @Field(5) - public String unknownString3; - @Field(6) - public ApplicationErrorReport applicationErrorReport; - @Field(7) - public String unknownString7; - @Field(8) - public BitmapTeleporter bitmapTeleporter; - @Field(9) - public String packageName; - @Field(10) - public List files; - @Field(11) - public boolean unknownBoolean11; - @Field(12) - public ThemeSettings themeSettings; - @Field(13) - public LogOptions logOptions; - @Field(14) - public boolean unknownBoolean14; - @Field(15) - public Bitmap screenshot; - @Field(16) - public String unknownString16; - @Field(17) - public boolean unknownBoolean17; - @Field(18) - public long unknownLong18; - @Field(19) - public boolean unknownBool19; - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - -} diff --git a/play-services-api/src/main/java/com/google/android/gms/feedback/FileTeleporter.java b/play-services-api/src/main/java/com/google/android/gms/feedback/FileTeleporter.java deleted file mode 100644 index 445200bf..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/feedback/FileTeleporter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -@SafeParcelable.Class -public class FileTeleporter extends AbstractSafeParcelable { - @Field(3) - public String contentType; - @Field(4) - public String content; - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(FileTeleporter.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/feedback/LogOptions.java b/play-services-api/src/main/java/com/google/android/gms/feedback/LogOptions.java deleted file mode 100644 index ce1f8201..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/feedback/LogOptions.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.feedback; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -@SafeParcelable.Class -public class LogOptions extends AbstractSafeParcelable { - - @Field(2) - public String options; - @Field(3) - public boolean unknownBool3; - @Field(4) - public boolean unknownBool4; - @Field(5) - public boolean unknownBool5; - @Field(6) - public boolean unknownBool6; - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(LogOptions.class); - -} diff --git a/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassRequestParcel.java b/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassRequestParcel.java deleted file mode 100644 index 66669683..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassRequestParcel.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.gass.internal; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -@SafeParcelable.Class -public class GassRequestParcel extends AbstractSafeParcelable { - - @Field(1) - public int versionCode; - @Field(2) - public String packageName; - @Field(3) - public String appVersionCode; - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(GassRequestParcel.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassResponseParcel.java b/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassResponseParcel.java deleted file mode 100644 index 34e2c617..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassResponseParcel.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.gass.internal; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import com.google.android.gms.feedback.ErrorReport; - -@SafeParcelable.Class -public class GassResponseParcel extends AbstractSafeParcelable { - - @Field(1) - public int versionCode; - - @Field(2) - public byte[] data; - - public ErrorReport report; - - public GassResponseParcel() { - } - - public GassResponseParcel(int i, byte[] bArr) { - this.versionCode = i; - this.report = null; - this.data = bArr; - } - - public GassResponseParcel(ErrorReport report) { - this.versionCode = 1; - this.report = report; - this.data = null; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(GassResponseParcel.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/measurement/internal/AppMetadata.java b/play-services-api/src/main/java/com/google/android/gms/measurement/internal/AppMetadata.java deleted file mode 100644 index d3726249..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/measurement/internal/AppMetadata.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.measurement.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -import java.util.List; - -public class AppMetadata extends AutoSafeParcelable { - @Field(2) - public String packageName; - @Field(3) - public String googleAppId; - @Field(4) - public String versionName; - @Field(5) - public String installerPackageName; - @Field(6) - private long googleVersion; - @Field(7) - private long devCertHash; - @Field(8) - private String healthMonitor; - @Field(9) - private boolean measurementEnabled = true; - @Field(10) - private boolean firstOpen; - @Field(11) - public long versionCode = Integer.MIN_VALUE; - @Field(12) - public String firebaseInstanceId; - @Field(13) - private long androidId; - @Field(14) - private long instantiationTime; - @Field(15) - public int appType; - @Field(16) - private boolean adIdReportingEnabled; - @Field(17) - public boolean ssaidCollectionEnabled = true; - @Field(18) - public boolean deferredAnalyticsCollection; - @Field(19) - public String admobAppId; - @Field(21) - public Boolean allowAdPersonalization; - @Field(22) - private long dynamiteVersion; - @Field(23) - public List safelistedEvents; - @Field(24) - public String gaAppId; - @Field(25) - private String consentSettings; - @Field(26) - public String ephemeralAppInstanceId; - @Field(27) - private String sessionStitchingToken; - @Field(28) - private boolean sgtmUploadEnabled; - @Field(29) - private long targetOsVersion; - @Field(30) - private int consentSource; - @Field(31) - private String dmaConsent; - @Field(32) - private int adServicesVersion; - - public String toString() { - return "AppMetadata[" + packageName + "]"; - } - - public static final Creator CREATOR = new AutoCreator<>(AppMetadata.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/people/internal/ParcelableLoadImageOptions.java b/play-services-api/src/main/java/com/google/android/gms/people/internal/ParcelableLoadImageOptions.java deleted file mode 100644 index 64322959..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/people/internal/ParcelableLoadImageOptions.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.people.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class ParcelableLoadImageOptions extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator<>(ParcelableLoadImageOptions.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/people/model/AccountMetadata.java b/play-services-api/src/main/java/com/google/android/gms/people/model/AccountMetadata.java deleted file mode 100644 index dfb64544..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/people/model/AccountMetadata.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.people.model; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class AccountMetadata extends AutoSafeParcelable { - - public static Creator CREATOR = new AutoCreator<>(AccountMetadata.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/people/model/AvatarReference.java b/play-services-api/src/main/java/com/google/android/gms/people/model/AvatarReference.java deleted file mode 100644 index 6e3da8e2..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/people/model/AvatarReference.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.people.model; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class AvatarReference extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator<>(AvatarReference.class); - - public AvatarReference() { - } -} diff --git a/play-services-api/src/main/java/com/google/android/gms/phenotype/RegistrationInfo.java b/play-services-api/src/main/java/com/google/android/gms/phenotype/RegistrationInfo.java deleted file mode 100644 index 7b9f6cd1..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/phenotype/RegistrationInfo.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.phenotype; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class RegistrationInfo extends AutoSafeParcelable { - @Field(1) - public String packageName; - @Field(2) - public int version; - @Field(3) - public String[] field3; - @Field(4) - public byte[] field4; - @Field(5) - public boolean weak; - @Field(6) - public int[] field6; - @Field(7) - public String clientPackageName; - - public static final Creator CREATOR = new AutoCreator<>(RegistrationInfo.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/potokens/PoToken.java b/play-services-api/src/main/java/com/google/android/gms/potokens/PoToken.java deleted file mode 100644 index 9f5a3f4c..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/potokens/PoToken.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.potokens; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class PoToken extends AutoSafeParcelable { - - @Field(1) - public byte[] data; - - public PoToken(byte[] data) { - this.data = data; - } - - public static Creator CREATOR = findCreator(PoToken.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/pseudonymous/PseudonymousIdToken.java b/play-services-api/src/main/java/com/google/android/gms/pseudonymous/PseudonymousIdToken.java deleted file mode 100644 index 18df15cb..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/pseudonymous/PseudonymousIdToken.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.pseudonymous; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -@SafeParcelable.Class -public class PseudonymousIdToken extends AbstractSafeParcelable { - - @Field(2) - public String name; - - @Constructor - public PseudonymousIdToken(@Param(2) String name) { - this.name = name; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(PseudonymousIdToken.class); - -} diff --git a/play-services-api/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.java b/play-services-api/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.java deleted file mode 100644 index 65ee1379..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ -package com.google.android.gms.semanticlocation; - - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -@SafeParcelable.Class -public class SemanticLocationEventRequest extends AbstractSafeParcelable { - @Field(1) - public final float position; - - @Constructor - public SemanticLocationEventRequest(@Param(1) float position) { - this.position = position; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SemanticLocationEventRequest.class); -} diff --git a/play-services-api/src/main/java/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.java b/play-services-api/src/main/java/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.java deleted file mode 100644 index 3dc753eb..00000000 --- a/play-services-api/src/main/java/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ -package com.google.android.gms.semanticlocation.internal; - -import android.accounts.Account; -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -@SafeParcelable.Class -public class SemanticLocationParameters extends AbstractSafeParcelable { - @Field(1) - public final Account account; - @Field(2) - public final String clientIdentifier; - @Field(3) - public final String packageName; - - @Constructor - public SemanticLocationParameters(@Param(1) Account account, @Param(2) String clientIdentifier, @Param(3) String packageName) { - this.account = account; - this.clientIdentifier = clientIdentifier; - this.packageName = packageName; - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SemanticLocationParameters.class); - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } -} diff --git a/play-services-appinvite/core/src/main/kotlin/org/microg/gms/appinivite/AppInviteActivity.kt b/play-services-appinvite/core/src/main/kotlin/org/microg/gms/appinivite/AppInviteActivity.kt deleted file mode 100644 index 526f10b1..00000000 --- a/play-services-appinvite/core/src/main/kotlin/org/microg/gms/appinivite/AppInviteActivity.kt +++ /dev/null @@ -1,185 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.appinivite - -import android.content.Intent -import android.net.Uri -import android.os.Build.VERSION.SDK_INT -import android.os.Bundle -import android.os.LocaleList -import android.util.Log -import android.view.ViewGroup -import android.view.Window -import android.widget.ProgressBar -import androidx.appcompat.app.AppCompatActivity -import androidx.core.content.pm.PackageInfoCompat -import androidx.core.os.bundleOf -import androidx.core.view.setPadding -import androidx.lifecycle.lifecycleScope -import com.android.volley.* -import com.android.volley.toolbox.Volley -import com.squareup.wire.Message -import com.squareup.wire.ProtoAdapter -import kotlinx.coroutines.CompletableDeferred -import okio.ByteString.Companion.decodeHex -import org.microg.gms.appinvite.* -import org.microg.gms.common.Constants -import org.microg.gms.utils.singleInstanceOf -import java.util.* - -private const val TAG = "AppInviteActivity" - -private const val APPINVITE_DEEP_LINK = "com.google.android.gms.appinvite.DEEP_LINK" -private const val APPINVITE_INVITATION_ID = "com.google.android.gms.appinvite.INVITATION_ID" -private const val APPINVITE_OPENED_FROM_PLAY_STORE = "com.google.android.gms.appinvite.OPENED_FROM_PLAY_STORE" -private const val APPINVITE_REFERRAL_BUNDLE = "com.google.android.gms.appinvite.REFERRAL_BUNDLE" - -class AppInviteActivity : AppCompatActivity() { - private val queue by lazy { singleInstanceOf { Volley.newRequestQueue(applicationContext) } } - - private val Int.px: Int get() = (this * resources.displayMetrics.density).toInt() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - requestWindowFeature(Window.FEATURE_NO_TITLE) - setContentView(ProgressBar(this).apply { - layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) - setPadding(20.px) - isIndeterminate = true - }) - val extras = intent.extras - extras?.keySet() - Log.d(TAG, "Intent: $intent $extras") - if (intent?.data == null) return finish() - lifecycleScope.launchWhenStarted { run() } - } - - private fun redirectToBrowser() { - try { - startActivity(Intent(Intent.ACTION_VIEW).apply { - addCategory(Intent.CATEGORY_DEFAULT) - data = intent.data - }) - } catch (e: Exception) { - Log.w(TAG, e) - } - finish() - } - - private fun open(appInviteLink: MutateAppInviteLinkResponse) { - val intent = Intent(Intent.ACTION_VIEW).apply { - addCategory(Intent.CATEGORY_DEFAULT) - data = appInviteLink.data_?.intentData?.let { Uri.parse(it) } - `package` = appInviteLink.data_?.packageName - flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP - putExtra( - APPINVITE_REFERRAL_BUNDLE, bundleOf( - APPINVITE_DEEP_LINK to appInviteLink, - APPINVITE_INVITATION_ID to "", - APPINVITE_OPENED_FROM_PLAY_STORE to false - ) - ) - } - val fallbackIntent = Intent(Intent.ACTION_VIEW).apply { - addCategory(Intent.CATEGORY_DEFAULT) - data = appInviteLink.data_?.fallbackUrl?.let { Uri.parse(it) } - } - val installedVersionCode = runCatching { - intent.resolveActivity(packageManager)?.let { - PackageInfoCompat.getLongVersionCode(packageManager.getPackageInfo(it.packageName, 0)) - } - }.getOrNull() - if (installedVersionCode != null && (appInviteLink.data_?.app?.minAppVersion == null || installedVersionCode >= appInviteLink.data_.app.minAppVersion)) { - startActivity(intent) - finish() - } else { - try { - startActivity(fallbackIntent) - } catch (e: Exception) { - Log.w(TAG, e) - } - finish() - } - } - - private suspend fun run() { - val request = ProtobufPostRequest( - "https://datamixer-pa.googleapis.com/v1/mutateonekey?alt=proto&key=AIzaSyAP-gfH3qvi6vgHZbSYwQ_XHqV_mXHhzIk", MutateOperation( - id = MutateOperationId.AppInviteLink, - mutateRequest = MutateDataRequest( - appInviteLink = MutateAppInviteLinkRequest( - client = ClientIdInfo( - packageName = Constants.GMS_PACKAGE_NAME, - signature = Constants.GMS_PACKAGE_SIGNATURE_SHA1.decodeHex().base64(), - language = Locale.getDefault().language - ), - link = LinkInfo( - empty = "", - uri = intent.data.toString() - ), - system = SystemInfo( - gms = SystemInfo.GmsInfo( - versionCode = Constants.GMS_VERSION_CODE - ) - ) - ) - ) - ), MutateDataResponseWithError.ADAPTER - ) - val response = try { - request.sendAndAwait(queue) - } catch (e: Exception) { - Log.w(TAG, e) - return redirectToBrowser() - } - if (response.errorStatus != null || response.dataResponse?.appInviteLink == null) return redirectToBrowser() - open(response.dataResponse.appInviteLink) - } -} - -class ProtobufPostRequest, O>(url: String, private val i: I, private val oAdapter: ProtoAdapter) : - Request(Method.POST, url, null) { - private val deferred = CompletableDeferred() - - override fun getHeaders(): Map { - val headers = HashMap(super.getHeaders()) - headers["Accept-Language"] = if (SDK_INT >= 24) LocaleList.getDefault().toLanguageTags() else Locale.getDefault().language - headers["X-Android-Package"] = Constants.GMS_PACKAGE_NAME - headers["X-Android-Cert"] = Constants.GMS_PACKAGE_SIGNATURE_SHA1 - return headers - } - - override fun getBody(): ByteArray = i.encode() - - override fun getBodyContentType(): String = "application/x-protobuf" - - override fun parseNetworkResponse(response: NetworkResponse): Response { - try { - return Response.success(oAdapter.decode(response.data), null) - } catch (e: VolleyError) { - return Response.error(e) - } catch (e: Exception) { - return Response.error(VolleyError()) - } - } - - override fun deliverResponse(response: O) { - Log.d(TAG, "Got response: $response") - deferred.complete(response) - } - - override fun deliverError(error: VolleyError) { - deferred.completeExceptionally(error) - } - - suspend fun await(): O = deferred.await() - - suspend fun sendAndAwait(queue: RequestQueue): O { - Log.d(TAG, "Sending request: $i") - queue.add(this) - return await() - } -} \ No newline at end of file diff --git a/play-services-appset/build.gradle b/play-services-appset/build.gradle deleted file mode 100644 index cb838e7e..00000000 --- a/play-services-appset/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -apply plugin: 'com.android.library' - -android { - namespace "com.google.android.gms.appset" - - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - buildFeatures { - aidl = true - } - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } -} - -description = 'microG implementation of play-services-appset' - -dependencies { - api project(':play-services-base') - api project(':play-services-basement') - - annotationProcessor project(':safe-parcel-processor') -} diff --git a/play-services-appset/core/build.gradle b/play-services-appset/core/build.gradle deleted file mode 100644 index c6017e1a..00000000 --- a/play-services-appset/core/build.gradle +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'maven-publish' -apply plugin: 'signing' - -dependencies { - api project(':play-services-appset') - - implementation project(':play-services-base-core') - - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion" -} - -android { - namespace "org.microg.gms.appset.core" - - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - sourceSets { - main { - java.srcDirs = ['src/main/kotlin'] - } - } - - lintOptions { - disable 'MissingTranslation' - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } - - kotlinOptions { - jvmTarget = 1.8 - } -} - -// Nothing to publish yet -//apply from: '../gradle/publish-android.gradle' - -description = 'microG service implementation for play-services-appset' diff --git a/play-services-appset/core/src/main/AndroidManifest.xml b/play-services-appset/core/src/main/AndroidManifest.xml deleted file mode 100644 index 0df43222..00000000 --- a/play-services-appset/core/src/main/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt b/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt deleted file mode 100644 index 72e20682..00000000 --- a/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.appset - -import android.util.Log -import com.google.android.gms.appset.AppSetIdInfo -import com.google.android.gms.appset.AppSetIdRequestParams -import com.google.android.gms.appset.AppSetInfoParcel -import com.google.android.gms.appset.internal.IAppSetIdCallback -import com.google.android.gms.appset.internal.IAppSetService -import com.google.android.gms.common.ConnectionResult -import com.google.android.gms.common.Feature -import com.google.android.gms.common.api.Status -import com.google.android.gms.common.internal.ConnectionInfo -import com.google.android.gms.common.internal.GetServiceRequest -import com.google.android.gms.common.internal.IGmsCallbacks -import org.microg.gms.BaseService -import org.microg.gms.common.GmsService - -private const val TAG = "AppSetService" -private val FEATURES = arrayOf(Feature("app_set_id", 1L)) - -class AppSetService : BaseService(TAG, GmsService.APP_SET) { - - override fun handleServiceRequest(callback: IGmsCallbacks?, request: GetServiceRequest?, service: GmsService?) { - callback?.onPostInitCompleteWithConnectionInfo( - ConnectionResult.SUCCESS, - AppSetServiceImpl().asBinder(), - ConnectionInfo().apply { features = FEATURES } - ) - } -} - -class AppSetServiceImpl : IAppSetService.Stub() { - override fun getAppSetIdInfo(params: AppSetIdRequestParams?, callback: IAppSetIdCallback?) { - Log.d(TAG, "AppSetServiceImp getAppSetIdInfo is called -> ${params?.toString()} ") - callback?.onAppSetInfo(Status.SUCCESS, AppSetInfoParcel("", AppSetIdInfo.SCOPE_APP)) - } -} diff --git a/play-services-appset/src/main/AndroidManifest.xml b/play-services-appset/src/main/AndroidManifest.xml deleted file mode 100644 index 8bdb7e14..00000000 --- a/play-services-appset/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetIdRequestParams.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetIdRequestParams.aidl deleted file mode 100644 index 5beef708..00000000 --- a/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetIdRequestParams.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.appset; - -parcelable AppSetIdRequestParams; diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetInfoParcel.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetInfoParcel.aidl deleted file mode 100644 index c2d4818a..00000000 --- a/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetInfoParcel.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.appset; - -parcelable AppSetInfoParcel; diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetIdCallback.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetIdCallback.aidl deleted file mode 100644 index 1b453de3..00000000 --- a/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetIdCallback.aidl +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.appset.internal; - -import com.google.android.gms.appset.AppSetInfoParcel; -import com.google.android.gms.common.api.Status; - -interface IAppSetIdCallback { - void onAppSetInfo(in Status status, in AppSetInfoParcel info) = 0; -} \ No newline at end of file diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetService.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetService.aidl deleted file mode 100644 index 59dbb6f9..00000000 --- a/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetService.aidl +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.appset.internal; - -import com.google.android.gms.appset.AppSetIdRequestParams; -import com.google.android.gms.appset.internal.IAppSetIdCallback; - -interface IAppSetService { - void getAppSetIdInfo(in AppSetIdRequestParams params, in IAppSetIdCallback callback) = 0; -} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSet.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSet.java deleted file mode 100644 index f3616527..00000000 --- a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSet.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.appset; - -import android.content.Context; -import androidx.annotation.NonNull; - -/** - * Entry point of the app set APIs. - */ -public class AppSet { - /** - * Creates a new instance of {@link AppSetIdClient}. - */ - @NonNull - public static AppSetIdClient getClient (Context context) { - throw new UnsupportedOperationException(); - } -} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdClient.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdClient.java deleted file mode 100644 index 91b6a671..00000000 --- a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdClient.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.appset; - -import androidx.annotation.NonNull; -import com.google.android.gms.tasks.Task; - -/** - * A client for interacting with the {@link AppSetIdInfo} API. - */ -public interface AppSetIdClient { - /** - * Gets the AppSetIdInfo asynchronously. - * - * @return a {@link Task} of the returned {@link AppSetIdInfo}. - */ - @NonNull - Task getAppSetIdInfo(); -} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdInfo.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdInfo.java deleted file mode 100644 index 29608f5f..00000000 --- a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdInfo.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.appset; - -import androidx.annotation.IntDef; -import org.microg.gms.common.Hide; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Contains information about app set ID. - */ -public class AppSetIdInfo { - /** - * The app set ID is scoped to the app. - */ - public static final int SCOPE_APP = 1; - /** - * The app set ID is scoped to a developer account on an app store. All apps from the same developer on a device will have - * the same developer scoped app set ID. - */ - public static final int SCOPE_DEVELOPER = 2; - - private final String id; - private final @Scope int scope; - - @Hide - public AppSetIdInfo(String id, @Scope int scope) { - this.id = id; - this.scope = scope; - } - - /** - * Gets the app set ID. - * - * @return the app set ID. - */ - public String getId() { - return id; - } - - /** - * Returns the {@link AppSetIdInfo.Scope} of the app set ID. Possible values include {@link #SCOPE_APP} and {@link #SCOPE_DEVELOPER}. - * - * @return the app set ID's {@link AppSetIdInfo.Scope}. - */ - public @Scope int getScope() { - return scope; - } - - /** - * Allowed constants for {@link AppSetIdInfo#getScope()}. - *

- * Supported constants: - *

    - *
  • {@link #SCOPE_APP}
  • - *
  • {@link #SCOPE_DEVELOPER}
  • - *
- */ - @Target({ElementType.TYPE_USE}) - @Retention(RetentionPolicy.SOURCE) - @IntDef({SCOPE_APP, SCOPE_DEVELOPER}) - public @interface Scope { - - } -} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdRequestParams.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdRequestParams.java deleted file mode 100644 index 2bc9b0d0..00000000 --- a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdRequestParams.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.appset; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -import org.microg.gms.common.Hide; -import org.microg.gms.utils.ToStringHelper; - -@SafeParcelable.Class -@Hide -public class AppSetIdRequestParams extends AbstractSafeParcelable { - @Field(1) - public final String version; - @Field(2) - public final String clientAppPackageName; - - @Constructor - public AppSetIdRequestParams(@Param(1) String version, @Param(2) String clientAppPackageName) { - this.version = version; - this.clientAppPackageName = clientAppPackageName; - } - - @NonNull - @Override - public String toString() { - return ToStringHelper.name("AppSetIdRequestParams").field("version", version).field("clientAppPackageName", clientAppPackageName).end(); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AppSetIdRequestParams.class); -} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetInfoParcel.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetInfoParcel.java deleted file mode 100644 index dd47b947..00000000 --- a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetInfoParcel.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.appset; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import org.microg.gms.common.Hide; - -@SafeParcelable.Class -@Hide -public class AppSetInfoParcel extends AbstractSafeParcelable { - @Field(1) - public final String id; - @Field(2) - public final int scope; - - @Constructor - public AppSetInfoParcel(@Param(1) String id, @Param(2) int scope) { - this.id = id; - this.scope = scope; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AppSetInfoParcel.class); - -} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/package-info.java b/play-services-appset/src/main/java/com/google/android/gms/appset/package-info.java deleted file mode 100644 index e9ab491d..00000000 --- a/play-services-appset/src/main/java/com/google/android/gms/appset/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: CC-BY-4.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ -/** - * For analytics or fraud prevention use cases, on a given device you may - need to correlate usage or actions across a set of apps owned by your organization. - */ -package com.google.android.gms.appset; diff --git a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt deleted file mode 100644 index 14096e4e..00000000 --- a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt +++ /dev/null @@ -1,353 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.auth.phone - -import android.Manifest.permission.READ_CONTACTS -import android.Manifest.permission.RECEIVE_SMS -import android.annotation.TargetApi -import android.app.Activity -import android.app.AlarmManager -import android.app.PendingIntent -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import android.content.IntentFilter -import android.content.pm.PackageManager.PERMISSION_GRANTED -import android.os.* -import android.os.Build.VERSION.SDK_INT -import android.provider.ContactsContract -import android.provider.ContactsContract.CommonDataKinds.Phone -import android.provider.Telephony -import android.telephony.SmsMessage -import android.text.TextUtils -import android.util.Base64 -import android.util.Log -import androidx.core.app.PendingIntentCompat -import androidx.core.content.ContextCompat -import androidx.core.os.bundleOf -import androidx.lifecycle.DefaultLifecycleObserver -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleOwner -import com.google.android.gms.auth.api.phone.SmsRetriever -import com.google.android.gms.common.api.CommonStatusCodes -import com.google.android.gms.common.api.Status -import kotlinx.coroutines.CompletableDeferred -import kotlinx.coroutines.Deferred -import kotlinx.coroutines.sync.Mutex -import kotlinx.coroutines.sync.withLock -import org.microg.gms.auth.phone.SmsRetrieverRequestType.RETRIEVER -import org.microg.gms.auth.phone.SmsRetrieverRequestType.USER_CONSENT -import org.microg.gms.common.Constants -import org.microg.gms.utils.getSignatures -import java.nio.charset.StandardCharsets -import java.security.MessageDigest -import java.util.concurrent.atomic.AtomicInteger - - -private const val TAG = "SmsRetrieverCore" - -private const val ACTION_SMS_RETRIEVE_TIMEOUT = "org.microg.gms.auth.phone.ACTION_SMS_RETRIEVE_TIMEOUT" -private const val EXTRA_REQUEST_ID = "requestId" -private const val TIMEOUT = 1000 * 60 * 5 // 5 minutes -private const val MESSAGE_MAX_LEN = 140 - -class SmsRetrieverCore(private val context: Context, override val lifecycle: Lifecycle) : LifecycleOwner, DefaultLifecycleObserver { - private val requests: HashMap = hashMapOf() - private val requestIdCounter = AtomicInteger(0) - private lateinit var timeoutBroadcastReceiver: BroadcastReceiver - private lateinit var smsBroadcastReceiver: BroadcastReceiver - private var requestCode = 0 - private val alarmManager: AlarmManager - get() = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager - - init { - lifecycle.addObserver(this) - } - - @TargetApi(19) - private fun configureBroadcastListenersIfNeeded() { - synchronized(this) { - if (!this::timeoutBroadcastReceiver.isInitialized) { - val intentFilter = IntentFilter(ACTION_SMS_RETRIEVE_TIMEOUT) - timeoutBroadcastReceiver = TimeoutReceiver() - ContextCompat.registerReceiver(context, timeoutBroadcastReceiver, intentFilter, ContextCompat.RECEIVER_NOT_EXPORTED) - } - if (!this::smsBroadcastReceiver.isInitialized) { - val intentFilter = IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION) - intentFilter.priority = 999 - smsBroadcastReceiver = SmsReceiver() - context.registerReceiver(smsBroadcastReceiver, intentFilter) - } - } - } - - private suspend fun ensureReady(permissions: Array): Boolean { - if (SDK_INT < 19) throw RuntimeException("Version not supported") - if (!ensurePermission(permissions)) return false - configureBroadcastListenersIfNeeded() - return true - } - - suspend fun startSmsRetriever(packageName: String) { - val appHashString = getHashString(packageName) - - if (!ensureReady(arrayOf(RECEIVE_SMS))) - throw RuntimeException("Initialization failed") - if (anyOtherPackageHasHashString(packageName, appHashString)) - throw RuntimeException("Collision in hash string, can't use SMS Retriever API") - if (requests.values.any { it.packageName == packageName && it.appHashString == appHashString && it.type == RETRIEVER }) - throw RuntimeException("App already listening") - - val request = SmsRetrieverRequest( - id = requestIdCounter.incrementAndGet(), - type = RETRIEVER, - packageName = packageName, - appHashString = appHashString, - timeoutPendingIntent = getTimeoutPendingIntent(context, packageName) - ) - requests[request.id] = request - alarmManager.set(AlarmManager.RTC, request.creation + TIMEOUT, request.timeoutPendingIntent) - } - - suspend fun startWithConsentPrompt(packageName: String, senderPhoneNumber: String?) { - if (!ensureReady(arrayOf(RECEIVE_SMS, READ_CONTACTS))) - throw RuntimeException("Initialization failed") - if (requests.values.any { it.packageName == packageName && it.senderPhoneNumber == senderPhoneNumber && it.type == USER_CONSENT }) - throw RuntimeException("App already listening") - - val request = SmsRetrieverRequest( - id = requestIdCounter.incrementAndGet(), - type = USER_CONSENT, - packageName = packageName, - senderPhoneNumber = senderPhoneNumber, - timeoutPendingIntent = getTimeoutPendingIntent(context, packageName) - ) - requests[request.id] = request - alarmManager.set(AlarmManager.RTC, request.creation + TIMEOUT, request.timeoutPendingIntent) - } - - fun hasOngoingUserConsentRequest(): Boolean { - return requests.values.any { it.type == USER_CONSENT } - } - - private fun sendRetrieverBroadcast(request: SmsRetrieverRequest, message: SmsMessage) { - sendReply(request, Status.SUCCESS, bundleOf(SmsRetriever.EXTRA_SMS_MESSAGE to message.messageBody)) - } - - private fun sendUserConsentBroadcast(request: SmsRetrieverRequest, message: SmsMessage) { - val userConsentIntent = Intent(context, UserConsentPromptActivity::class.java) - userConsentIntent.setPackage(Constants.GMS_PACKAGE_NAME) - userConsentIntent.putExtra(EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) { - override fun handleMessage(msg: Message) { - if (Binder.getCallingUid() == Process.myUid()) { - if (msg.what == MSG_REQUEST_MESSAGE_BODY) { - msg.replyTo?.send(Message.obtain().apply { - what = 1 - data = bundleOf("message" to message.messageBody) - }) - } else if (msg.what == MSG_CONSUME_MESSAGE) { - finishRequest(request) - } - } - } - })) - - sendReply(request, Status.SUCCESS, bundleOf(SmsRetriever.EXTRA_CONSENT_INTENT to userConsentIntent), false) - } - - private fun getTimeoutPendingIntent(context: Context, packageName: String): PendingIntent { - val intent = Intent(ACTION_SMS_RETRIEVE_TIMEOUT) - intent.setPackage(packageName) - return PendingIntentCompat.getBroadcast(context, ++requestCode, intent, 0, false)!! - } - - private fun tryHandleIncomingMessageAsRetrieverMessage(message: SmsMessage): Boolean { - for (request in requests.values) { - if (request.type == RETRIEVER) { - // 11-digit hash code that uniquely identifies your app - if (request.appHashString.isNullOrBlank() || !message.messageBody.contains(request.appHashString)) continue - - sendRetrieverBroadcast(request, message) - return true - } - } - return false - } - - private fun tryHandleIncomingMessageAsUserConsentMessage(message: SmsMessage): Boolean { - val senderPhoneNumber = message.originatingAddress ?: return false - - // 4-10 digit alphanumeric code containing at least one number - if (message.messageBody.split("[^A-Za-z0-9]".toRegex()).none { it.length in 4..10 && it.any(Char::isDigit) }) return false - - // Sender cannot be in the user's Contacts list - if (isPhoneNumberInContacts(context, senderPhoneNumber)) return false - - for (request in requests.values) { - if (request.type == USER_CONSENT) { - if (!request.senderPhoneNumber.isNullOrBlank() && request.senderPhoneNumber != senderPhoneNumber) continue - - sendUserConsentBroadcast(request, message) - return true - } - } - return false - } - - private fun handleIncomingSmsMessage(message: SmsMessage) { - if (message.messageBody.isNullOrBlank()) return - if (message.messageBody.length > MESSAGE_MAX_LEN) return - - if (tryHandleIncomingMessageAsRetrieverMessage(message)) return - if (tryHandleIncomingMessageAsUserConsentMessage(message)) return - } - - fun handleTimeout(requestId: Int) { - val request = requests[requestId] ?: return - sendReply(request, Status(CommonStatusCodes.TIMEOUT)) - } - - private fun sendReply(request: SmsRetrieverRequest, status: Status, extras: Bundle = Bundle.EMPTY, finish: Boolean = true) { - Log.d(TAG, "Send reply to ${request.packageName} ${CommonStatusCodes.getStatusCodeString(status.statusCode)}") - - val intent = Intent(SmsRetriever.SMS_RETRIEVED_ACTION) - intent.setPackage(request.packageName) - intent.putExtras(extras) - intent.putExtra(SmsRetriever.EXTRA_STATUS, status) - context.sendBroadcast(intent) - - if (finish) finishRequest(request) - } - - fun finishRequest(request: SmsRetrieverRequest) { - alarmManager.cancel(request.timeoutPendingIntent) - requests.remove(request.id) - } - - override fun onDestroy(owner: LifecycleOwner) { - super.onDestroy(owner) - - if (this::smsBroadcastReceiver.isInitialized) context.unregisterReceiver(smsBroadcastReceiver) - if (this::timeoutBroadcastReceiver.isInitialized) context.unregisterReceiver(timeoutBroadcastReceiver) - - for (request in requests.values) { - sendReply(request, Status(CommonStatusCodes.TIMEOUT)) - } - - requests.clear() - } - - @TargetApi(19) - private inner class SmsReceiver : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - if (Telephony.Sms.Intents.SMS_RECEIVED_ACTION == intent.action) { - val messages = Telephony.Sms.Intents.getMessagesFromIntent(intent) - for (message in messages) { - try { - handleIncomingSmsMessage(message) - } catch (e: Exception) { - Log.w(TAG, "Error handling incoming SMS", e) - } - } - } - } - } - - private inner class TimeoutReceiver : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - val requestId = intent.getIntExtra(EXTRA_REQUEST_ID, -1) - if (requestId != -1) { - handleTimeout(requestId) - } - } - } - - @TargetApi(19) - fun getHashString(packageName: String): String { - val signature = - context.packageManager.getSignatures(packageName).firstOrNull()?.toCharsString() ?: throw RuntimeException("No signature found for $packageName") - val appInfo = "$packageName $signature" - val messageDigest = MessageDigest.getInstance("SHA-256") - messageDigest.update(appInfo.toByteArray(StandardCharsets.UTF_8)) - return Base64.encodeToString(messageDigest.digest(), Base64.NO_PADDING or Base64.NO_WRAP).substring(0, 11) - } - - private fun anyOtherPackageHasHashString(packageName: String, hashString: String): Boolean { - val collision = context.packageManager.getInstalledPackages(0) - .firstOrNull { it.packageName != packageName && getHashString(it.packageName) == hashString } ?: return false - - Log.w(TAG, "Hash string collision between $packageName and ${collision.packageName} (both are $hashString)") - return true - } - - private fun isPhoneNumberInContacts(context: Context, phoneNumber: String): Boolean { - fun normalizePhoneNumber(input: String): String { - var output = "" - if (!TextUtils.isEmpty(input)) { - // only keep digits - val temp = input.replace("[^0-9]".toRegex(), "") - // trim leading zeroes - output = temp.replaceFirst("^0*".toRegex(), "") - } - return output - } - - val normalizePhoneNumber = normalizePhoneNumber(phoneNumber) - val cursor = context.contentResolver.query(Phone.CONTENT_URI, arrayOf(Phone.NUMBER), null, null, null) ?: return false - try { - while (cursor.moveToNext()) { - val addressIndex = cursor.getColumnIndex(Phone.NUMBER) - val contactPhoneNumber = normalizePhoneNumber(cursor.getString(addressIndex)) - if (normalizePhoneNumber == contactPhoneNumber) { - return true - } - } - } catch (e: Exception) { - Log.w(TAG, e) - } finally { - cursor.close() - } - return false - } - - private val activePermissionRequestLock = Mutex() - private var activePermissionRequest: Deferred? = null - - private suspend fun ensurePermission(permissions: Array): Boolean { - if (SDK_INT < 23) - return true - - if (permissions.all { ContextCompat.checkSelfPermission(context, it) == PERMISSION_GRANTED }) - return true - - val (completable, deferred) = activePermissionRequestLock.withLock { - if (activePermissionRequest == null) { - val completable = CompletableDeferred() - activePermissionRequest = completable - completable to activePermissionRequest!! - } else { - null to activePermissionRequest!! - } - } - if (completable != null) { - val intent = Intent(context, AskPermissionActivity::class.java) - intent.putExtra(EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) { - override fun handleMessage(msg: Message) { - if (msg.what == Activity.RESULT_OK) { - val grantResults = msg.data?.getIntArray(EXTRA_GRANT_RESULTS) ?: IntArray(0) - completable.complete(grantResults.size == permissions.size && grantResults.all { it == PERMISSION_GRANTED }) - } else { - completable.complete(false) - } - } - })) - intent.putExtra(EXTRA_PERMISSIONS, permissions) - intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK - context.startActivity(intent) - } - return deferred.await() - } -} \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverService.kt b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverService.kt deleted file mode 100644 index 76fe5359..00000000 --- a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverService.kt +++ /dev/null @@ -1,131 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.auth.phone - -import android.util.Log -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.lifecycleScope -import com.google.android.gms.auth.api.phone.SmsRetrieverStatusCodes -import com.google.android.gms.auth.api.phone.internal.IAutofillPermissionStateCallback -import com.google.android.gms.auth.api.phone.internal.IOngoingSmsRequestCallback -import com.google.android.gms.auth.api.phone.internal.ISmsRetrieverApiService -import com.google.android.gms.auth.api.phone.internal.ISmsRetrieverResultCallback -import com.google.android.gms.common.Feature -import com.google.android.gms.common.api.CommonStatusCodes -import com.google.android.gms.common.api.Status -import com.google.android.gms.common.api.internal.IStatusCallback -import com.google.android.gms.common.internal.ConnectionInfo -import com.google.android.gms.common.internal.GetServiceRequest -import com.google.android.gms.common.internal.IGmsCallbacks -import org.microg.gms.BaseService -import org.microg.gms.common.GmsService -import org.microg.gms.common.PackageUtils - - -private const val TAG = "SmsRetrieverService" -private val FEATURES = arrayOf( - Feature("sms_retrieve", 1), - Feature("user_consent", 3) -) - -class SmsRetrieverService : BaseService(TAG, GmsService.SMS_RETRIEVER) { - private val smsRetriever = SmsRetrieverCore(this, lifecycle) - - override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { - val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName) - ?: throw IllegalArgumentException("Missing package name") - callback.onPostInitCompleteWithConnectionInfo( - CommonStatusCodes.SUCCESS, - SmsRetrieverServiceImpl(smsRetriever, packageName, lifecycle), - ConnectionInfo().apply { features = FEATURES } - ) - } -} - - -class SmsRetrieverServiceImpl(private val smsRetriever: SmsRetrieverCore, private val packageName: String, override val lifecycle: Lifecycle) : - ISmsRetrieverApiService.Stub(), LifecycleOwner { - - override fun startSmsRetriever(callback: ISmsRetrieverResultCallback) { - Log.d(TAG, "startSmsRetriever()") - lifecycleScope.launchWhenStarted { - val status = try { - smsRetriever.startSmsRetriever(packageName) - Status.SUCCESS - } catch (e: Exception) { - Status(CommonStatusCodes.INTERNAL_ERROR, e.message) - } - try { - callback.onResult(status) - } catch (e: Exception) { - Log.w(TAG, "Failed delivering $status for startSmsRetriever()", e) - } - } - } - - override fun startWithConsentPrompt(senderPhoneNumber: String?, callback: ISmsRetrieverResultCallback) { - Log.d(TAG, "startWithConsentPrompt($senderPhoneNumber)") - lifecycleScope.launchWhenStarted { - val status = try { - smsRetriever.startWithConsentPrompt(packageName, senderPhoneNumber) - Status.SUCCESS - } catch (e: Exception) { - Status(CommonStatusCodes.INTERNAL_ERROR, e.message) - } - try { - callback.onResult(status) - } catch (e: Exception) { - Log.w(TAG, "Failed delivering $status for startWithConsentPrompt()", e) - } - } - } - - override fun startSmsCodeAutofill(callback: IStatusCallback) { - Log.d(TAG, "startSmsCodeAutofill()") - try { - callback.onResult(Status(SmsRetrieverStatusCodes.API_NOT_AVAILABLE)) - } catch (e: Exception) { - Log.w(TAG, "Failed delivering result for startSmsCodeAutofill()", e) - } - } - - override fun checkAutofillPermissionState(callback: IAutofillPermissionStateCallback) { - Log.d(TAG, "checkAutofillPermissionState()") - try { - callback.onCheckPermissionStateResult(Status.SUCCESS, 1) - } catch (e: Exception) { - Log.w(TAG, "Failed delivering result for checkAutofillPermissionState()", e) - } - } - - override fun checkOngoingSmsRequest(packageName: String?, callback: IOngoingSmsRequestCallback) { - Log.d(TAG, "checkOngoingSmsRequest($packageName)") - lifecycleScope.launchWhenStarted { - val result = try { - smsRetriever.hasOngoingUserConsentRequest() - } catch (e: Exception) { - true - } - - try { - callback.onHasOngoingSmsRequestResult(Status.SUCCESS, result) - } catch (e: Exception) { - Log.w(TAG, "Failed delivering $result for checkOngoingSmsRequest()", e) - } - } - } - - - override fun startSmsCodeBrowser(callback: IStatusCallback) { - Log.d(TAG, "startSmsCodeBrowser()") - try { - callback.onResult(Status(SmsRetrieverStatusCodes.API_NOT_AVAILABLE)) - } catch (e: Exception) { - Log.w(TAG, "Failed delivering result for startSmsCodeBrowser()", e) - } - } -} \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/res/values-be/strings.xml b/play-services-auth-api-phone/core/src/main/res/values-be/strings.xml deleted file mode 100644 index 9ae425ad..00000000 --- a/play-services-auth-api-phone/core/src/main/res/values-be/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Дазволіць %s прачытаць паведамленне ніжэй і ўвесці код? - Дазволіць - Адхіліць - \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/res/values-de/strings.xml b/play-services-auth-api-phone/core/src/main/res/values-de/strings.xml deleted file mode 100644 index ca6ebacf..00000000 --- a/play-services-auth-api-phone/core/src/main/res/values-de/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Erlauben - Ablehnen - %s erlauben, die folgende Nachricht zu lesen und den Code einzugeben? - \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/res/values-es/strings.xml b/play-services-auth-api-phone/core/src/main/res/values-es/strings.xml deleted file mode 100644 index 28cb6c38..00000000 --- a/play-services-auth-api-phone/core/src/main/res/values-es/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - ¿Permitir que %s lean el mensaje de abajo e introduzcan el código? - Permitir - Denegar - \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/res/values-pt-rBR/strings.xml b/play-services-auth-api-phone/core/src/main/res/values-pt-rBR/strings.xml deleted file mode 100644 index 2af67da2..00000000 --- a/play-services-auth-api-phone/core/src/main/res/values-pt-rBR/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Permitir %s à ler a mensagem abaixo e inserir o código? - Permitir - Negar - \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/res/values-ru/strings.xml b/play-services-auth-api-phone/core/src/main/res/values-ru/strings.xml deleted file mode 100644 index 8857cd90..00000000 --- a/play-services-auth-api-phone/core/src/main/res/values-ru/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Разрешить %s прочитать сообщение ниже и ввести код? - Разрешить - Отклонить - \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/res/values-uk/strings.xml b/play-services-auth-api-phone/core/src/main/res/values-uk/strings.xml deleted file mode 100644 index f8b7e515..00000000 --- a/play-services-auth-api-phone/core/src/main/res/values-uk/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Дозволити - Дозволити %s прочитати наведене нижче повідомлення та ввести код? - Відхилити - \ No newline at end of file diff --git a/play-services-auth-api-phone/core/src/main/res/values-zh-rCN/strings.xml b/play-services-auth-api-phone/core/src/main/res/values-zh-rCN/strings.xml deleted file mode 100644 index 6d1cf71f..00000000 --- a/play-services-auth-api-phone/core/src/main/res/values-zh-rCN/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 允许%s读取以下消息并输入代码吗? - 允许 - 拒绝 - \ No newline at end of file diff --git a/play-services-auth-base/src/main/aidl/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.aidl b/play-services-auth-base/src/main/aidl/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.aidl deleted file mode 100644 index 950fc2fb..00000000 --- a/play-services-auth-base/src/main/aidl/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.firstparty.dataservice; - -parcelable DeviceManagementInfoResponse; diff --git a/play-services-auth-base/src/main/java/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.java b/play-services-auth-base/src/main/java/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.java deleted file mode 100644 index bb93f63a..00000000 --- a/play-services-auth-base/src/main/java/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.firstparty.dataservice; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -@SafeParcelable.Class -public class DeviceManagementInfoResponse extends AbstractSafeParcelable { - @Field(1) - public final int versionCode; - @Field(2) - public final String info; - @Field(3) - public final boolean status; - - - @Constructor - public DeviceManagementInfoResponse(@Param(1) int versionCode, @Param(2) String info, @Param(3) boolean status) { - this.versionCode = versionCode; - this.info = info; - this.status = status; - } - - public DeviceManagementInfoResponse(String info, boolean status) { - this(1, info, status); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(DeviceManagementInfoResponse.class); - -} diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IAccountDataService.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IAccountDataService.aidl deleted file mode 100644 index 2fd6c854..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IAccountDataService.aidl +++ /dev/null @@ -1,16 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.account.data; - -import com.google.android.gms.auth.account.data.IDeviceManagementInfoCallback; -import android.accounts.Account; -import com.google.android.gms.common.api.internal.IStatusCallback; - -interface IAccountDataService { - void requestDeviceManagementInfo(in IDeviceManagementInfoCallback callback, in Account account) = 0; - void requestAccountInfo(in IStatusCallback callback, in Account account, boolean isPrimary) = 1; - void requestProfileInfo(in IStatusCallback callback, String profile) = 2; -} diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IDeviceManagementInfoCallback.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IDeviceManagementInfoCallback.aidl deleted file mode 100644 index 801beac3..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IDeviceManagementInfoCallback.aidl +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.account.data; - -import com.google.android.gms.auth.firstparty.dataservice.DeviceManagementInfoResponse; -import com.google.android.gms.common.api.Status; - -interface IDeviceManagementInfoCallback { - void onResult(in Status status, in DeviceManagementInfoResponse response); -} diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/BeginSignInRequest.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/BeginSignInRequest.aidl deleted file mode 100644 index 843cdbfa..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/BeginSignInRequest.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity; - -parcelable BeginSignInRequest; \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/BeginSignInResult.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/BeginSignInResult.aidl deleted file mode 100644 index 994924a7..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/BeginSignInResult.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity; - -parcelable BeginSignInResult; \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/GetPhoneNumberHintIntentRequest.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/GetPhoneNumberHintIntentRequest.aidl deleted file mode 100644 index fc8071fc..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/GetPhoneNumberHintIntentRequest.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity; - -parcelable GetPhoneNumberHintIntentRequest; \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/GetSignInIntentRequest.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/GetSignInIntentRequest.aidl deleted file mode 100644 index 69650b83..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/GetSignInIntentRequest.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity; - -parcelable GetSignInIntentRequest; \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/SignInCredential.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/SignInCredential.aidl deleted file mode 100644 index d2de2746..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/SignInCredential.aidl +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity; - -parcelable SignInCredential; \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IBeginSignInCallback.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IBeginSignInCallback.aidl deleted file mode 100644 index 41b3e006..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IBeginSignInCallback.aidl +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity.internal; - -import com.google.android.gms.auth.api.identity.BeginSignInResult; -import com.google.android.gms.common.api.Status; - -interface IBeginSignInCallback { - void onResult(in Status status, in BeginSignInResult beginSignInResult); -} \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IGetPhoneNumberHintIntentCallback.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IGetPhoneNumberHintIntentCallback.aidl deleted file mode 100644 index a07988a2..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IGetPhoneNumberHintIntentCallback.aidl +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity.internal; - -import com.google.android.gms.common.api.Status; - -interface IGetPhoneNumberHintIntentCallback { - void onResult(in Status status, in PendingIntent pendingIntent); -} \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IGetSignInIntentCallback.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IGetSignInIntentCallback.aidl deleted file mode 100644 index ba6c5850..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IGetSignInIntentCallback.aidl +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity.internal; - -import com.google.android.gms.common.api.Status; - -interface IGetSignInIntentCallback { - void onResult(in Status status, in PendingIntent pendingIntent); -} \ No newline at end of file diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/ISignInService.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/ISignInService.aidl deleted file mode 100644 index cbb5bb66..00000000 --- a/play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/ISignInService.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity.internal; - -import com.google.android.gms.common.api.internal.IStatusCallback; -import com.google.android.gms.auth.api.identity.internal.IBeginSignInCallback; -import com.google.android.gms.auth.api.identity.internal.IGetSignInIntentCallback; -import com.google.android.gms.auth.api.identity.internal.IGetPhoneNumberHintIntentCallback; -import com.google.android.gms.auth.api.identity.BeginSignInRequest; -import com.google.android.gms.auth.api.identity.GetSignInIntentRequest; -import com.google.android.gms.auth.api.identity.GetPhoneNumberHintIntentRequest; - -interface ISignInService { - void beginSignIn(in IBeginSignInCallback callback, in BeginSignInRequest request) = 0; - void signOut(in IStatusCallback callback, String userId) = 1; - void getSignInIntent(in IGetSignInIntentCallback callback, in GetSignInIntentRequest request) = 2; - void getPhoneNumberHintIntent(in IGetPhoneNumberHintIntentCallback callback, in GetPhoneNumberHintIntentRequest request) = 3; -} \ No newline at end of file diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/BeginSignInRequest.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/BeginSignInRequest.java deleted file mode 100644 index f844822c..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/BeginSignInRequest.java +++ /dev/null @@ -1,596 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import androidx.annotation.Nullable; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialRequestOptions; -import org.microg.gms.common.Hide; - -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -/** - * Configurations that can be used to filter acceptable types of credentials returned from a sign-in attempt. - */ -@SafeParcelable.Class -public class BeginSignInRequest extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getPasswordRequestOptions") - private final PasswordRequestOptions passwordRequestOptions; - @Field(value = 2, getterName = "getGoogleIdTokenRequestOptions") - private final GoogleIdTokenRequestOptions googleIdTokenRequestOptions; - @Field(value = 3, getterName = "getSessionId") - private final String sessionId; - @Field(value = 4, getterName = "isAutoSelectEnabled") - private final boolean autoSelectEnabled; - @Field(value = 5, getterName = "getTheme") - private final int theme; - @Field(value = 6, getterName = "getPasskeysRequestOptions") - private final PasskeysRequestOptions passkeysRequestOptions; - @Field(value = 7, getterName = "getPasskeyJsonRequestOptions") - private final PasskeyJsonRequestOptions passkeyJsonRequestOptions; - - @Constructor - BeginSignInRequest(@Param(1) PasswordRequestOptions passwordRequestOptions, @Param(2) GoogleIdTokenRequestOptions googleIdTokenRequestOptions, @Param(3) String sessionId, @Param(4) boolean autoSelectEnabled, @Param(5) int theme, @Param(6) PasskeysRequestOptions passkeysRequestOptions, @Param(7) PasskeyJsonRequestOptions passkeyJsonRequestOptions) { - this.passwordRequestOptions = passwordRequestOptions; - this.googleIdTokenRequestOptions = googleIdTokenRequestOptions; - this.sessionId = sessionId; - this.autoSelectEnabled = autoSelectEnabled; - this.theme = theme; - this.passkeysRequestOptions = passkeysRequestOptions; - this.passkeyJsonRequestOptions = passkeyJsonRequestOptions; - } - - @NonNull - public static Builder builder() { - return new Builder(); - } - - public GoogleIdTokenRequestOptions getGoogleIdTokenRequestOptions() { - return googleIdTokenRequestOptions; - } - - public PasskeyJsonRequestOptions getPasskeyJsonRequestOptions() { - return passkeyJsonRequestOptions; - } - - public PasskeysRequestOptions getPasskeysRequestOptions() { - return passkeysRequestOptions; - } - - public PasswordRequestOptions getPasswordRequestOptions() { - return passwordRequestOptions; - } - - @Hide - public String getSessionId() { - return sessionId; - } - - @Hide - public int getTheme() { - return theme; - } - - /** - * Returns {@code true} if auto-select is requested, {@code false} otherwise. - */ - public boolean isAutoSelectEnabled() { - return autoSelectEnabled; - } - - public static class Builder { - - } - - /** - * Options for requesting Google ID token-backed credentials during sign-in. - */ - @Class - public static class GoogleIdTokenRequestOptions extends AbstractSafeParcelable { - @Field(value = 1, getterName = "isSupported") - private final boolean supported; - @Field(value = 2, getterName = "getServerClientId") - private final String serverClientId; - @Field(value = 3, getterName = "getNonce") - private final String nonce; - @Field(value = 4, getterName = "filterByAuthorizedAccounts") - private final boolean filterByAuthorizedAccounts; - @Field(value = 5, getterName = "getLinkedServiceId") - private final String linkedServiceId; - @Field(value = 6, getterName = "getIdTokenDepositionScopes") - private final List idTokenDepositionScopes; - @Field(value = 7, getterName = "requestVerifiedPhoneNumber") - private final boolean requestVerifiedPhoneNumber; - - @Hide - @Constructor - public GoogleIdTokenRequestOptions(@Param(1) boolean supported, @Param(2) String serverClientId, @Param(3) String nonce, @Param(4) boolean filterByAuthorizedAccounts, @Param(5) String linkedServiceId, @Param(6) List idTokenDepositionScopes, @Param(7) boolean requestVerifiedPhoneNumber) { - this.supported = supported; - this.serverClientId = serverClientId; - this.nonce = nonce; - this.filterByAuthorizedAccounts = filterByAuthorizedAccounts; - this.linkedServiceId = linkedServiceId; - this.idTokenDepositionScopes = idTokenDepositionScopes; - this.requestVerifiedPhoneNumber = requestVerifiedPhoneNumber; - } - - @NonNull - public static Builder builder() { - return new Builder(); - } - - public boolean filterByAuthorizedAccounts() { - return filterByAuthorizedAccounts; - } - - public List getIdTokenDepositionScopes() { - return idTokenDepositionScopes; - } - - public String getLinkedServiceId() { - return linkedServiceId; - } - - public String getNonce() { - return nonce; - } - - public String getServerClientId() { - return serverClientId; - } - - public boolean isSupported() { - return supported; - } - - /** - * @deprecated No replacement. - */ - @Deprecated - public boolean requestVerifiedPhoneNumber() { - return requestVerifiedPhoneNumber; - } - - /** - * Builder for {@link BeginSignInRequest.GoogleIdTokenRequestOptions}. - */ - public static class Builder { - private boolean supported; - @Nullable - private String serverClientId; - @Nullable - private String nonce; - private boolean filterByAuthorizedAccounts = true; - @Nullable - private String linkedServiceId; - @Nullable - private List idTokenDepositionScopes; - private boolean requestVerifiedPhoneNumber; - - /** - * Sets whether to support sign-in using Google accounts that are linked to your users' accounts. - *

- * When such a credential is selected, a Google ID token for the Google account that the selected account is linked to, will - * first be deposited to your server and then returned to you. Similar to the regular sign-in, your backend could use the ID - * token to sign the user in. Note that, the ID token deposition will only happen the first time signing in, using this credential. - * Subsequent sign-ins will not require a deposition, since the ID token will already have been associated with your user's - * account. - * - * @param linkedServiceId service ID used when linking accounts to a Google account. - * @param idTokenDepositionScopes Oauth scopes that Google will need to deposit a Google ID token to your application's backend server. This - * is optional and can be set to null. Only required if Google requires particular scopes to be able to deposit - * the ID token. - */ - public Builder associateLinkedAccounts(@NonNull String linkedServiceId, @Nullable List idTokenDepositionScopes) { - this.linkedServiceId = linkedServiceId; - this.idTokenDepositionScopes = idTokenDepositionScopes; - return this; - } - - /** - * Returns the built {@link BeginSignInRequest.GoogleIdTokenRequestOptions}. - */ - @NonNull - public GoogleIdTokenRequestOptions build() { - return new GoogleIdTokenRequestOptions(supported, serverClientId, nonce, filterByAuthorizedAccounts, linkedServiceId, idTokenDepositionScopes, requestVerifiedPhoneNumber); - } - - /** - * Sets whether to only allow the user to select from Google accounts that are already authorized to sign in to your - * application. The default value is true. - *

- * If {@code true}, the user will not be able to select any Google account that would otherwise require explicit authorization to - * share basic profile/email data with your application. This may reduce some friction in the sign-in user journey, and - * guarantees that the returned credential is for a "returning user", but limits the user's freedom to choose among all the - * Google accounts on the device. - * - * @param filterByAuthorizedAccounts whether to only allow the user to select from Google accounts that are already authorized to sign in to - * your application - */ - @NonNull - public Builder setFilterByAuthorizedAccounts(boolean filterByAuthorizedAccounts) { - this.filterByAuthorizedAccounts = filterByAuthorizedAccounts; - return this; - } - - /** - * Sets the nonce to use when generating a Google ID token. - * - * @param nonce the nonce to use during ID token generation - */ - @NonNull - public Builder setNonce(@Nullable String nonce) { - this.nonce = nonce; - return this; - } - - /** - * Sets whether to request for a verified phone number during sign-ups. - *

- * In order to use this feature, the - * {@link BeginSignInRequest.GoogleIdTokenRequestOptions#filterByAuthorizedAccounts()} field must be explicitly set - * to false, because this feature is only available during sign-ups. - * - * @deprecated No replacement. - */ - @Deprecated - @NonNull - public Builder setRequestVerifiedPhoneNumber(boolean requestVerifiedPhoneNumber) { - this.requestVerifiedPhoneNumber = requestVerifiedPhoneNumber; - return this; - } - - /** - * Sets the server's client ID to use as the audience for Google ID tokens generated during the sign-in. - * - * @param serverClientId the client ID of the server to which the ID token will be issued - */ - @NonNull - public Builder setServerClientId(@NonNull String serverClientId) { - this.serverClientId = serverClientId; - return this; - } - - /** - * Sets whether Google ID token-backed credentials should be returned by the API. - * - * @param supported whether Google ID token-backed credentials should be returned - */ - @NonNull - public Builder setSupported(boolean supported) { - this.supported = supported; - return this; - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof GoogleIdTokenRequestOptions)) return false; - - GoogleIdTokenRequestOptions that = (GoogleIdTokenRequestOptions) o; - - if (supported != that.supported) return false; - if (filterByAuthorizedAccounts != that.filterByAuthorizedAccounts) return false; - if (requestVerifiedPhoneNumber != that.requestVerifiedPhoneNumber) return false; - if (!Objects.equals(serverClientId, that.serverClientId)) return false; - if (!Objects.equals(nonce, that.nonce)) return false; - if (!Objects.equals(linkedServiceId, that.linkedServiceId)) return false; - return Objects.equals(idTokenDepositionScopes, that.idTokenDepositionScopes); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{supported, serverClientId, nonce, filterByAuthorizedAccounts, linkedServiceId, idTokenDepositionScopes, requestVerifiedPhoneNumber}); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(GoogleIdTokenRequestOptions.class); - } - - /** - * Options for requesting passkeys during sign-in. - */ - @Class - public static class PasskeyJsonRequestOptions extends AbstractSafeParcelable { - @Field(value = 1, getterName = "isSupported") - private final boolean supported; - @Field(value = 2, getterName = "getRequestJson") - private final String requestJson; - - @Constructor - @Hide - public PasskeyJsonRequestOptions(@Param(1) boolean supported, @Param(2) String requestJson) { - this.supported = supported; - this.requestJson = requestJson; - } - - public static Builder builder() { - return new Builder(); - } - - public String getRequestJson() { - return requestJson; - } - - public boolean isSupported() { - return supported; - } - - /** - * Builder for {@link BeginSignInRequest.PasskeyJsonRequestOptions}. - */ - public static class Builder { - private boolean supported; - private String requestJson; - - @NonNull - public PasskeyJsonRequestOptions build() { - return new PasskeyJsonRequestOptions(supported, requestJson); - } - - /** - * Sets the {@link PublicKeyCredentialRequestOptions} in JSON format. - * - * @param requestJson the JSON formatted representation of the WebAuthn request. - */ - @NonNull - public Builder setRequestJson(@NonNull String requestJson) { - this.requestJson = requestJson; - return this; - } - - /** - * Sets whether passkey credentials should be returned by this API. - * - * @param supported whether passkey credentials should be returned - */ - @NonNull - public Builder setSupported(boolean supported) { - this.supported = supported; - return this; - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof PasskeyJsonRequestOptions)) return false; - - PasskeyJsonRequestOptions that = (PasskeyJsonRequestOptions) o; - - if (supported != that.supported) return false; - return Objects.equals(requestJson, that.requestJson); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{supported, requestJson}); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(PasskeyJsonRequestOptions.class); - } - - /** - * Options for requesting passkeys during sign-in. - * - * @deprecated Use {@link BeginSignInRequest.PasskeyJsonRequestOptions} instead. - */ - @Deprecated - @Class - public static class PasskeysRequestOptions extends AbstractSafeParcelable { - @Field(value = 1, getterName = "isSupported") - private final boolean supported; - @Field(value = 2, getterName = "getChallenge") - private final byte[] challenge; - @Field(value = 3, getterName = "getRpId") - private final String rpId; - - @Constructor - @Hide - public PasskeysRequestOptions(@Param(1) boolean supported, @Param(2) byte[] challenge, @Param(3) String rpId) { - this.supported = supported; - this.challenge = challenge; - this.rpId = rpId; - } - - public static Builder builder() { - return new Builder(); - } - - public byte[] getChallenge() { - return challenge; - } - - public String getRpId() { - return rpId; - } - - public boolean isSupported() { - return supported; - } - - /** - * Builder for {@link BeginSignInRequest.PasskeysRequestOptions}. - */ - public static class Builder { - private boolean supported; - private byte[] challenge; - private String rpId; - - public PasskeysRequestOptions build() { - return new PasskeysRequestOptions(supported, challenge, rpId); - } - - /** - * Sets the nonce value that the authenticator should sign using a private key corresponding to a public key credential that - * is acceptable for this authentication session. - * - * @param challenge the challenge - */ - @NonNull - public Builder setChallenge(@NonNull byte[] challenge) { - this.challenge = challenge; - return this; - } - - /** - * Sets identifier for a relying party, on whose behalf a given authentication operation is being performed. A public key - * credential can only be used for authentication with the same replying party it was registered with. - *

- * Note: the RpId should be an effective domain (without scheme or port). - * - * @param rpId identifier for a relying party - */ - @NonNull - public Builder setRpId(@NonNull String rpId) { - this.rpId = rpId; - return this; - } - - /** - * Sets whether passkey credentials should be returned by this API. - * - * @param supported whether passkey credentials should be returned - */ - @NonNull - public Builder setSupported(boolean supported) { - this.supported = supported; - return this; - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof PasskeysRequestOptions)) return false; - - PasskeysRequestOptions that = (PasskeysRequestOptions) o; - - if (supported != that.supported) return false; - if (!Arrays.equals(challenge, that.challenge)) return false; - return Objects.equals(rpId, that.rpId); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{supported, challenge, rpId}); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(PasskeysRequestOptions.class); - } - - /** - * Options for requesting password-backed credentials during sign-in. - */ - @Class - public static class PasswordRequestOptions extends AbstractSafeParcelable { - @Field(value = 1, getterName = "isSupported") - public final boolean supported; - - @Constructor - @Hide - public PasswordRequestOptions(@Param(1) boolean supported) { - this.supported = supported; - } - - public static Builder builder() { - return new Builder(); - } - - public boolean isSupported() { - return supported; - } - - /** - * Builder for {@link BeginSignInRequest.PasswordRequestOptions}. - */ - public static class Builder { - private boolean supported = false; - - /** - * Returns the built {@link BeginSignInRequest.PasswordRequestOptions}. - */ - @NonNull - public PasswordRequestOptions build() { - return new PasswordRequestOptions(supported); - } - - /** - * Sets whether password-backed credentials should be returned by the API. - * - * @param supported whether password-backed credentials should be returned - */ - @NonNull - public Builder setSupported(boolean supported) { - this.supported = supported; - return this; - } - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(PasswordRequestOptions.class); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof BeginSignInRequest)) return false; - - BeginSignInRequest that = (BeginSignInRequest) o; - - if (autoSelectEnabled != that.autoSelectEnabled) return false; - if (theme != that.theme) return false; - if (!Objects.equals(passwordRequestOptions, that.passwordRequestOptions)) return false; - if (!Objects.equals(googleIdTokenRequestOptions, that.googleIdTokenRequestOptions)) - return false; - if (!Objects.equals(sessionId, that.sessionId)) return false; - if (!Objects.equals(passkeysRequestOptions, that.passkeysRequestOptions)) return false; - return Objects.equals(passkeyJsonRequestOptions, that.passkeyJsonRequestOptions); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{passwordRequestOptions, googleIdTokenRequestOptions, sessionId, autoSelectEnabled, theme, passkeysRequestOptions, passkeyJsonRequestOptions}); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(BeginSignInRequest.class); - -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/BeginSignInResult.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/BeginSignInResult.java deleted file mode 100644 index ab875a06..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/BeginSignInResult.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.app.PendingIntent; -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import org.microg.gms.common.Hide; - -/** - * Result returned from sign-in initiation that includes a {@link PendingIntent} that can be used to continue the sign-in flow. - */ -@SafeParcelable.Class -public class BeginSignInResult extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getPendingIntent") - private final PendingIntent pendingIntent; - - @Constructor - @Hide - public BeginSignInResult(@Param(1) PendingIntent pendingIntent) { - this.pendingIntent = pendingIntent; - } - - public PendingIntent getPendingIntent() { - return pendingIntent; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(BeginSignInResult.class); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/CredentialSavingClient.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/CredentialSavingClient.java deleted file mode 100644 index 1761d85e..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/CredentialSavingClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.app.PendingIntent; -import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.gms.common.api.HasApiKey; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.tasks.Task; - -/** - * A client for the Credential Saving API. - */ -public interface CredentialSavingClient extends HasApiKey { - /** - * Extracts the {@link Status} from the {@link Intent} object in activity results. - */ - @NonNull - Status getStatusFromIntent(@Nullable Intent intent); - - /** - * Attempts to save a token for account linking. - *

- * Calling this method will provide a {@link PendingIntent} in the response that can be used to launch the flow to complete the - * saving of the account linking token. As part of the request, you need to provide a {@link PendingIntent} for your consent page - * that Google Play services will launch in the middle of the flow. The result must then be sent back to the caller following a - * certain contract described in {@link SaveAccountLinkingTokenRequest.Builder#setConsentPendingIntent(PendingIntent)}. - * - * @param saveAccountLinkingTokenRequest the request that contains the parameters to successfully return a response that can be used to - * launch the appropriate flow. - * @return {@link Task} which may contain the {@link PendingIntent} required to launch the flow. To find out if the response can be used - * to start the flow, first call {@link SaveAccountLinkingTokenResult#hasResolution()}. - */ - @NonNull - Task saveAccountLinkingToken(@NonNull SaveAccountLinkingTokenRequest saveAccountLinkingTokenRequest); - - /** - * Initiates the storage of a password-backed credential that can later be used to sign a user in. - *

- * If the request cannot be honored, an exception will be set on the returned {@link Task}. In all other cases, a - * {@link SavePasswordResult} will be returned. - * - * @param savePasswordRequest container for the {@link SignInPassword} for the password-saving flow - * @return {@link Task} which eventually contains the result of the initialization - */ - @NonNull - Task savePassword(@NonNull SavePasswordRequest savePasswordRequest); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/CredentialSavingOptions.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/CredentialSavingOptions.java deleted file mode 100644 index bfdd7320..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/CredentialSavingOptions.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity; - -import androidx.annotation.Nullable; -import com.google.android.gms.common.api.Api; - -import java.util.Arrays; - -public class CredentialSavingOptions implements Api.ApiOptions.Optional { - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{CredentialSavingOptions.class}); - } - - @Override - public boolean equals(@Nullable Object obj) { - return obj instanceof CredentialSavingOptions; - } -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/GetPhoneNumberHintIntentRequest.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/GetPhoneNumberHintIntentRequest.java deleted file mode 100644 index 89063405..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/GetPhoneNumberHintIntentRequest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import org.microg.gms.common.Hide; - -/** - * Request object used to get an Intent to start the Phone Number Hint flow. - */ -@SafeParcelable.Class -public class GetPhoneNumberHintIntentRequest extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getTheme") - private final int theme; - - @Constructor - GetPhoneNumberHintIntentRequest(@Param(1) int theme) { - this.theme = theme; - } - - @NonNull - public static Builder builder() { - return new Builder(); - } - - @Hide - public int getTheme() { - return theme; - } - - /** - * Builder for {@link GetPhoneNumberHintIntentRequest} - */ - public static class Builder { - private int theme; - - @NonNull - public GetPhoneNumberHintIntentRequest build() { - return new GetPhoneNumberHintIntentRequest(theme); - } - - @Hide - @NonNull - public Builder setTheme(int theme) { - this.theme = theme; - return this; - } - } - - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(GetPhoneNumberHintIntentRequest.class); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/GetSignInIntentRequest.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/GetSignInIntentRequest.java deleted file mode 100644 index c656b329..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/GetSignInIntentRequest.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import androidx.annotation.Nullable; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import org.microg.gms.common.Hide; - -import java.util.Arrays; -import java.util.Objects; - -/** - * Request to get a Google sign-in intent. - */ -@SafeParcelable.Class -public class GetSignInIntentRequest extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getServerClientId") - private final String serverClientId; - @Field(value = 2, getterName = "getHostedDomainFilter") - private final String hostedDomainFilter; - @Field(value = 3, getterName = "getSessionId") - private final String sessionId; - @Field(value = 4, getterName = "getNonce") - private final String nonce; - @Field(value = 5, getterName = "requestVerifiedPhoneNumber") - private final boolean requestVerifiedPhoneNumber; - @Field(value = 6, getterName = "getTheme") - private final int theme; - - @Constructor - GetSignInIntentRequest(@Param(1) String serverClientId, @Param(2) String hostedDomainFilter, @Param(3) String sessionId, @Param(4) String nonce, @Param(5) boolean requestVerifiedPhoneNumber, @Param(6) int theme) { - this.serverClientId = serverClientId; - this.hostedDomainFilter = hostedDomainFilter; - this.sessionId = sessionId; - this.nonce = nonce; - this.requestVerifiedPhoneNumber = requestVerifiedPhoneNumber; - this.theme = theme; - } - - @NonNull - public static Builder builder() { - return new Builder(); - } - - /** - * Returns the {@code hostedDomainFilter} if it was set in the request, or {@code null} otherwise. - */ - public String getHostedDomainFilter() { - return hostedDomainFilter; - } - - /** - * Returns the nonce that was set in the request. - */ - public String getNonce() { - return nonce; - } - - /** - * Returns the {@code serverClientId} that was set in the request. - */ - public String getServerClientId() { - return serverClientId; - } - - @Hide - public String getSessionId() { - return sessionId; - } - - @Hide - public int getTheme() { - return theme; - } - - /** - * Returns whether a verified phone number is requested. - * - * @deprecated No replacement. - */ - @Deprecated - public boolean requestVerifiedPhoneNumber() { - return requestVerifiedPhoneNumber; - } - - /** - * Builder class for {@link GetSignInIntentRequest}. - */ - public static class Builder { - private String serverClientId; - private String hostedDomainFilter; - private String sessionId; - private String nonce; - private boolean requestVerifiedPhoneNumber; - private int theme; - - @NonNull - public GetSignInIntentRequest build() { - return new GetSignInIntentRequest(serverClientId, hostedDomainFilter, sessionId, nonce, requestVerifiedPhoneNumber, theme); - } - - /** - * Sets the hosted domain filter (e.g. myuniveristy.edu). Default is no filter. - */ - @NonNull - public Builder filterByHostedDomain(@Nullable String hostedDomainFilter) { - this.hostedDomainFilter = hostedDomainFilter; - return this; - } - - /** - * Sets the nonce to use when generating a Google ID token. The values for nonce can be any random string and is used to - * prevent replay-attack. Default is no nonce. - * - * @param nonce the nonce to use during ID token generation - */ - @NonNull - public Builder setNonce(@Nullable String nonce) { - this.nonce = nonce; - return this; - } - - /** - * Sets whether to prompt the users to share a verified phone number associated with their Google accounts. - *

- * Note that if the user selects a Google account which has previously been used to sign up to your app, they won't be - * prompted with the phone number selection. - * - * @deprecated No replacement. - */ - @Deprecated - @NonNull - public Builder setRequestVerifiedPhoneNumber(boolean requestsVerifiedPhoneNumber) { - this.requestVerifiedPhoneNumber = requestsVerifiedPhoneNumber; - return this; - } - - /** - * Sets the client ID of the server that will verify the integrity of the token. Calling this method to set the {@code serverClientId} is - * required. - */ - @NonNull - public Builder setServerClientId(@NonNull String serverClientId) { - this.serverClientId = serverClientId; - return this; - } - - @NonNull - public Builder setSessionId(@Nullable String sessionId) { - this.sessionId = sessionId; - return this; - } - - @NonNull - public Builder setTheme(int theme) { - this.theme = theme; - return this; - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof GetSignInIntentRequest)) return false; - - GetSignInIntentRequest that = (GetSignInIntentRequest) o; - - if (requestVerifiedPhoneNumber != that.requestVerifiedPhoneNumber) return false; - if (theme != that.theme) return false; - if (!Objects.equals(serverClientId, that.serverClientId)) return false; - if (!Objects.equals(hostedDomainFilter, that.hostedDomainFilter)) return false; - if (!Objects.equals(sessionId, that.sessionId)) return false; - return Objects.equals(nonce, that.nonce); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{serverClientId, hostedDomainFilter, serverClientId, nonce, requestVerifiedPhoneNumber, theme}); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(GetSignInIntentRequest.class); - -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/Identity.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/Identity.java deleted file mode 100644 index 19647beb..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/Identity.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.app.Activity; -import android.content.Context; -import androidx.annotation.NonNull; - -/** - * The entry point to the Sign-In APIs. - */ -public final class Identity { - -// /** -// * Returns a new instance of {@link AuthorizationClient}. -// */ -// @NonNull -// public static AuthorizationClient getAuthorizationClient(@NonNull Context context) { -// throw new UnsupportedOperationException(); -// } -// -// /** -// * Returns a new instance of {@link AuthorizationClient}. -// */ -// @NonNull -// public static AuthorizationClient getAuthorizationClient(@NonNull Activity activity) { -// throw new UnsupportedOperationException(); -// } - - /** - * Returns a new instance of {@link CredentialSavingClient}. - */ - @NonNull - public static CredentialSavingClient getCredentialSavingClient(@NonNull Activity activity) { - throw new UnsupportedOperationException(); - } - - /** - * Returns a new instance of {@link CredentialSavingClient}. - */ - @NonNull - public static CredentialSavingClient getCredentialSavingClient(@NonNull Context context) { - throw new UnsupportedOperationException(); - } - - /** - * Returns a new instance of {@link SignInClient}. - */ - @NonNull - public static SignInClient getSignInClient(@NonNull Activity activity) { - throw new UnsupportedOperationException(); - } - - /** - * Returns a new instance of {@link SignInClient}. - */ - @NonNull - public static SignInClient getSignInClient(@NonNull Context context) { - throw new UnsupportedOperationException(); - } - - private Identity() { - } -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.java deleted file mode 100644 index ada66da8..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.app.Activity; -import android.app.PendingIntent; -import android.os.Parcel; -import androidx.annotation.NonNull; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import org.microg.gms.common.Hide; - -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -/** - * Configurations that allow saving a token to Google for the purpose of account linking. - */ -public class SaveAccountLinkingTokenRequest extends AbstractSafeParcelable { - public static final String EXTRA_TOKEN = "extra_token"; - /** - * A constant to indicate that the type of token that will be saved is an Authorization Code. - */ - public static final String TOKEN_TYPE_AUTH_CODE = "auth_code"; - - @Field(value = 1, getterName = "getConsentPendingIntent") - private final PendingIntent consentPendingIntent; - @Field(value = 2, getterName = "getTokenType") - private final String tokenType; - @Field(value = 3, getterName = "getServiceId") - private final String serviceId; - @Field(value = 4, getterName = "getScopes") - private final List scopes; - @Field(value = 5, getterName = "getSessionId") - private final String sessionId; - @Field(value = 6, getterName = "getTheme") - private final int theme; - - @Constructor - SaveAccountLinkingTokenRequest(@Param(1) PendingIntent consentPendingIntent, @Param(2) String tokenType, @Param(3) String serviceId, @Param(4) List scopes, @Param(5) String sessionId, @Param(6) int theme) { - this.consentPendingIntent = consentPendingIntent; - this.tokenType = tokenType; - this.serviceId = serviceId; - this.scopes = scopes; - this.sessionId = sessionId; - this.theme = theme; - } - - /** - * Returns an instance of the {@link SaveAccountLinkingTokenRequest.Builder} that can be used to build an instance of {@link SaveAccountLinkingTokenRequest}. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Returns the {@link PendingIntent} that is set in the request and will be used to launch the consent page by Google Play Services during the flow. - */ - public PendingIntent getConsentPendingIntent() { - return consentPendingIntent; - } - - /** - * Returns the scopes that were set in the request. These are the requested scopes for the token that will be issued by your application. - */ - public List getScopes() { - return scopes; - } - - /** - * Returns the service-id that was set in the request. This service-id can be found in your cloud project. - */ - public String getServiceId() { - return serviceId; - } - - @Hide - public String getSessionId() { - return sessionId; - } - - @Hide - public int getTheme() { - return theme; - } - - /** - * Returns the type of token that is requested. - */ - public String getTokenType() { - return tokenType; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof SaveAccountLinkingTokenRequest)) return false; - - SaveAccountLinkingTokenRequest that = (SaveAccountLinkingTokenRequest) o; - - if (theme != that.theme) return false; - if (!Objects.equals(consentPendingIntent, that.consentPendingIntent)) return false; - if (!Objects.equals(tokenType, that.tokenType)) return false; - if (!Objects.equals(serviceId, that.serviceId)) return false; - if (!Objects.equals(scopes, that.scopes)) return false; - return Objects.equals(sessionId, that.sessionId); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{consentPendingIntent, tokenType, serviceId, scopes, serviceId, theme}); - } - - /** - * Builder for {@link SaveAccountLinkingTokenRequest}. - */ - public static class Builder { - private PendingIntent consentPendingIntent; - private String tokenType; - private String serviceId; - private List scopes; - private String sessionId; - private int theme; - - /** - * Builds an immutable instance of the {@link SaveAccountLinkingTokenRequest}. - */ - @NonNull - public SaveAccountLinkingTokenRequest build() { - return new SaveAccountLinkingTokenRequest(consentPendingIntent, tokenType, serviceId, scopes, sessionId, theme); - } - - /** - * Sets the (mandatory) {@link PendingIntent} that can be launched by Google Play services to show the consent page during - * the flow. When the launched Activity is finished, it has to provide the appropriate data in the result that it returns to the - * caller, based on the following contract: - *

    - *
  • - * If the user has accepted the consent, the launched Activity must call {@code setResult} with {@link Activity#RESULT_OK}, along with a - * token as a (string) intent extra in the result, with the key {@link SaveAccountLinkingTokenRequest#EXTRA_TOKEN}, - * similar to the following snippet: - *
    -         *  Intent intent = new Intent();
    -         *  intent.putExtra(SaveAccountLinkingTokenRequest.EXTRA_TOKEN, token);
    -         *  setResult(Activity.RESULT_OK, intent);
    -         *  finish();
    -         *         
    - *
  • - *
  • - * If, however, the user has rejected the consent, the Activity has to call {@code setResult} with {@link Activity#RESULT_CANCELED}. - *
  • - *
- */ - @NonNull - public Builder setConsentPendingIntent(PendingIntent consentPendingIntent) { - this.consentPendingIntent = consentPendingIntent; - return this; - } - - /** - * Sets the list of scopes that are associated with the token that will be saved to Google. Calling this method with the - * correct scope(s) is required. - */ - @NonNull - public Builder setScopes(List scopes) { - this.scopes = scopes; - return this; - } - - /** - * Sets the service-id that can be obtained from your Google Cloud project. Calling this method to set {@code serviceId} - * is required. - */ - @NonNull - public Builder setServiceId(String serviceId) { - this.serviceId = serviceId; - return this; - } - - @Hide - @NonNull - public Builder setSessionId(String sessionId) { - this.sessionId = sessionId; - return this; - } - - @Hide - @NonNull - public Builder setTheme(int theme) { - this.theme = theme; - return this; - } - - /** - * Sets the type of token that will be saved to Google. Valid options are: - *
    - *
  • {@link SaveAccountLinkingTokenRequest#TOKEN_TYPE_AUTH_CODE}
  • - *
- * Calling this method with a valid token type is required. - */ - @NonNull - public Builder setTokenType(String tokenType) { - this.tokenType = tokenType; - return this; - } - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SaveAccountLinkingTokenRequest.class); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenResult.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenResult.java deleted file mode 100644 index 11448995..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenResult.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.app.PendingIntent; -import android.os.Parcel; -import androidx.annotation.NonNull; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import org.microg.gms.common.Hide; - -import java.util.Objects; - -/** - * Result returned from the initial call to save an account linking token that includes a {@link PendingIntent} that can be used to - * continue the flow. - */ -@SafeParcelable.Class -public class SaveAccountLinkingTokenResult extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getPendingIntent") - private final PendingIntent pendingIntent; - - @Constructor - @Hide - public SaveAccountLinkingTokenResult(@Param(1) PendingIntent pendingIntent) { - this.pendingIntent = pendingIntent; - } - - /** - * Returns the {@link PendingIntent} that can be used to launch the flow. Note that this method can return a {@code null} value if such - * flow cannot be started. It is expected that the caller first calls {@link #hasResolution()} to make sure the flow can be started, - * instead of examining the nullness of the result returned by this method. - */ - public PendingIntent getPendingIntent() { - return pendingIntent; - } - - /** - * Returns {@code true} if and only if this result contains a resolution that needs to be launched. - */ - public boolean hasResolution() { - return pendingIntent != null; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof SaveAccountLinkingTokenResult)) return false; - - SaveAccountLinkingTokenResult that = (SaveAccountLinkingTokenResult) o; - - return Objects.equals(pendingIntent, that.pendingIntent); - } - - @Override - public int hashCode() { - return pendingIntent != null ? pendingIntent.hashCode() : 0; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SaveAccountLinkingTokenResult.class); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SavePasswordRequest.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SavePasswordRequest.java deleted file mode 100644 index cd998a20..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SavePasswordRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.os.Parcel; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import org.microg.gms.common.Hide; - -/** - * Configurations that allow saving a {@link SignInPassword} to Google. - */ -@SafeParcelable.Class -public class SavePasswordRequest extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getSignInPassword") - private final SignInPassword signInPassword; - @Field(value = 2, getterName = "getSessionId") - @Nullable - private final String sessionId; - @Field(value = 3, getterName = "getTheme") - private final int theme; - - @Constructor - SavePasswordRequest(@Param(1) SignInPassword signInPassword, @Param(2) @Nullable String sessionId, @Param(3) int theme) { - this.signInPassword = signInPassword; - this.sessionId = sessionId; - this.theme = theme; - } - - /** - * Returns a new instance of the {@link SavePasswordRequest.Builder}. - */ - public static Builder builder() { - return new Builder(); - } - - @Hide - @Nullable - public String getSessionId() { - return sessionId; - } - - public SignInPassword getSignInPassword() { - return signInPassword; - } - - @Hide - public int getTheme() { - return theme; - } - - /** - * Builder for {@link SavePasswordRequest}. - */ - public static class Builder { - private SignInPassword signInPassword; - @Nullable - private String sessionId; - private int theme; - - /** - * Sets the {@link SignInPassword} - */ - @NonNull - public Builder setSignInPassword(@NonNull SignInPassword signInPassword) { - this.signInPassword = signInPassword; - return this; - } - - @Hide - @NonNull - public Builder setSessionId(@Nullable String sessionId) { - this.sessionId = sessionId; - return this; - } - - @Hide - @NonNull - public Builder setTheme(int theme) { - this.theme = theme; - return this; - } - - /** - * Builds and returns a new instance of {@link SavePasswordRequest}. - */ - @NonNull - public SavePasswordRequest build() { - return new SavePasswordRequest(signInPassword, sessionId, theme); - } - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SavePasswordRequest.class); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SavePasswordResult.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SavePasswordResult.java deleted file mode 100644 index 9360a1c3..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SavePasswordResult.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.app.PendingIntent; -import android.os.Parcel; -import androidx.annotation.NonNull; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -import java.util.Objects; - -/** - * The result returned from calling {@link CredentialSavingClient#savePassword(SavePasswordRequest)} that includes a - * {@link PendingIntent} that can be used to launch the password saving flow. - */ -@SafeParcelable.Class -public class SavePasswordResult extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getPendingIntent") - private final PendingIntent pendingIntent; - - @Constructor - public SavePasswordResult(@Param(1) PendingIntent pendingIntent) { - this.pendingIntent = pendingIntent; - } - - /** - * Returns the {@link PendingIntent} that should be launched to start the UI flow for saving the password. - */ - public PendingIntent getPendingIntent() { - return pendingIntent; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof SavePasswordResult)) return false; - - SavePasswordResult that = (SavePasswordResult) o; - - return Objects.equals(pendingIntent, that.pendingIntent); - } - - @Override - public int hashCode() { - return pendingIntent != null ? pendingIntent.hashCode() : 0; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SavePasswordResult.class); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInClient.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInClient.java deleted file mode 100644 index 0268ef85..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInClient.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.app.PendingIntent; -import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.gms.common.api.ApiException; -import com.google.android.gms.common.api.HasApiKey; -import com.google.android.gms.tasks.Task; - -public interface SignInClient extends HasApiKey { - /** - * Initiates the retrieval of a credential that can assist the caller in signing a user in to their application. - *

- * If the request cannot be honored, an exception will be set on the returned {@link Task}. In all other cases, a - * {@link BeginSignInResult} will be returned. - * - * @param signInRequest configuration for the sign-in operation - * @return {@link Task} which eventually contains the result of the initialization - */ - @NonNull - Task beginSignIn(@NonNull BeginSignInRequest signInRequest); - - /** - * Retrieves the Phone Number from the {@link Intent} returned upon a successful Phone Number Hint request, throwing an - * {@link ApiException} if no phone number is available or the input {@link Intent} is null. - * - * @throws ApiException - */ - @NonNull - String getPhoneNumberFromIntent(@Nullable Intent data) throws ApiException; - - /** - * Gets the {@link PendingIntent} that initiates the Phone Number Hint flow. - *

- * If there is no phone number on the device, an exception will be set on the returned {@link Task}. In all other cases, a - * {@link PendingIntent} will be returned. - * - * @return {@link Task} which can be used to start the Phone Number Hint flow. - */ - @NonNull - Task getPhoneNumberHintIntent(@NonNull GetPhoneNumberHintIntentRequest getPhoneNumberHintIntentRequest); - - /** - * Retrieves the {@link SignInCredential} from the {@link Intent} returned upon successful sign-in, throwing an {@link ApiException} if no - * credential is present. - * - * @throws ApiException - */ - @NonNull - SignInCredential getSignInCredentialFromIntent(@Nullable Intent data) throws ApiException; - - /** - * Gets the {@link PendingIntent} that initiates the Google Sign-in flow. - *

- * If the request cannot be honored, an exception will be set on the returned {@link Task}. In all other cases, a {@link PendingIntent} - * will be returned. - * - * @param getSignInIntentRequest configuration for Google Sign-in flow - * @return {@link Task} which eventually contains the {@link PendingIntent} to start the Google Sign-in flow. - */ - @NonNull - Task getSignInIntent(@NonNull GetSignInIntentRequest getSignInIntentRequest); - - /** - * Resets internal state related to sign-in. - *

- * This method should be invoked when a user signs out of your app. - * - * @return {@link Task} which eventually terminates in success or failure - */ - @NonNull - Task signOut(); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInCredential.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInCredential.java deleted file mode 100644 index 85ef8e92..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInCredential.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.net.Uri; -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; -import com.google.android.gms.fido.fido2.api.common.PublicKeyCredential; -import org.microg.gms.common.Hide; - -import java.util.Arrays; -import java.util.Objects; - -/** - * The credential returned as a result of a successful sign-in. Data returned within this object depends on the type of - * credential that user has selected; for example a password is returned only when a password-backed credential was - * selected. - */ -@SafeParcelable.Class -public class SignInCredential extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getId") - private final String id; - @Field(value = 2, getterName = "getDisplayName") - private final String displayName; - @Field(value = 3, getterName = "getGivenName") - private final String givenName; - @Field(value = 4, getterName = "getFamilyName") - private final String familyName; - @Field(value = 5, getterName = "getProfilePictureUri") - private final Uri profilePictureUri; - @Field(value = 6, getterName = "getPassword") - private final String password; - @Field(value = 7, getterName = "getGoogleIdToken") - private final String googleIdToken; - @Field(value = 8, getterName = "getPhoneNumber") - private final String phoneNumber; - @Field(value = 9, getterName = "getPublicKeyCredential") - private final PublicKeyCredential publicKeyCredential; - - @Hide - @Constructor - public SignInCredential(@Param(1) String id, @Param(2) String displayName, @Param(3) String givenName, @Param(4) String familyName, @Param(5) Uri profilePictureUri, @Param(6) String password, @Param(7) String googleIdToken, @Param(8) String phoneNumber, @Param(9) PublicKeyCredential publicKeyCredential) { - this.id = id; - this.displayName = displayName; - this.givenName = givenName; - this.familyName = familyName; - this.profilePictureUri = profilePictureUri; - this.password = password; - this.googleIdToken = googleIdToken; - this.phoneNumber = phoneNumber; - this.publicKeyCredential = publicKeyCredential; - } - - public String getDisplayName() { - return displayName; - } - - public String getFamilyName() { - return familyName; - } - - public String getGivenName() { - return givenName; - } - - public String getGoogleIdToken() { - return googleIdToken; - } - - public String getPassword() { - return password; - } - - /** - * Returns the identifier of the credential. For an ID token credential, this returns the email address of the user's account - * and for a password-backed credential, it returns the username for that password. - */ - public String getId() { - return id; - } - - /** - * @deprecated No replacement. - */ - @Deprecated - public String getPhoneNumber() { - return phoneNumber; - } - - public Uri getProfilePictureUri() { - return profilePictureUri; - } - - /** - * Returns {@code publicKeyCredential}. - */ - public PublicKeyCredential getPublicKeyCredential() { - return publicKeyCredential; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof SignInCredential)) return false; - - SignInCredential that = (SignInCredential) o; - - if (!Objects.equals(id, that.id)) return false; - if (!Objects.equals(displayName, that.displayName)) return false; - if (!Objects.equals(givenName, that.givenName)) return false; - if (!Objects.equals(familyName, that.familyName)) return false; - if (!Objects.equals(profilePictureUri, that.profilePictureUri)) return false; - if (!Objects.equals(password, that.password)) return false; - if (!Objects.equals(googleIdToken, that.googleIdToken)) return false; - if (!Objects.equals(phoneNumber, that.phoneNumber)) return false; - return Objects.equals(publicKeyCredential, that.publicKeyCredential); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{id, displayName, givenName, familyName, profilePictureUri, password, googleIdToken, phoneNumber, publicKeyCredential}); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SignInCredential.class); -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInOptions.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInOptions.java deleted file mode 100644 index c1078df4..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInOptions.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.identity; - -import androidx.annotation.Nullable; -import com.google.android.gms.common.api.Api; - -import java.util.Arrays; - -public class SignInOptions implements Api.ApiOptions.Optional { - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{SignInOptions.class}); - } - - @Override - public boolean equals(@Nullable Object obj) { - return obj instanceof SignInOptions; - } -} diff --git a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInPassword.java b/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInPassword.java deleted file mode 100644 index a2889522..00000000 --- a/play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/SignInPassword.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.auth.api.identity; - -import android.os.Parcel; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelable; -import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; - -import java.util.Arrays; - -/** - * An account ID such as a username or an email, and a password that can be used to sign a user in. - */ -@SafeParcelable.Class -public class SignInPassword extends AbstractSafeParcelable { - @Field(value = 1, getterName = "getId") - @NonNull - private final String id; - @Field(value = 2, getterName = "getPassword") - @NonNull - private final String password; - - @Constructor - public SignInPassword(@Param(1) @NonNull String id, @Param(2) @NonNull String password) { - this.id = id; - this.password = password; - } - - @NonNull - public String getId() { - return id; - } - - @NonNull - public String getPassword() { - return password; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof SignInPassword)) return false; - - SignInPassword that = (SignInPassword) o; - - if (!id.equals(that.id)) return false; - return password.equals(that.password); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new String[]{id, password}); - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - CREATOR.writeToParcel(this, dest, flags); - } - - public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SignInPassword.class); -} diff --git a/play-services-base-api/build.gradle b/play-services-base-api/build.gradle deleted file mode 100644 index 59dc1be7..00000000 --- a/play-services-base-api/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2013-2015 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' - -dependencies { - api project(':play-services-basement') -} - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion androidBuildVersionTools - - aidlPackageWhiteList "com/google/android/gms/common/data/DataHolder.aidl" - aidlPackageWhiteList "com/google/android/gms/common/images/WebImage.aidl" - aidlPackageWhiteList "com/google/android/gms/common/api/internal/IStatusCallback.aidl" - - defaultConfig { - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } - namespace 'org.microg.gms.base.api' - buildFeatures { - aidl true - } -} \ No newline at end of file diff --git a/play-services-base-api/src/main/aidl/com/google/android/gms/common/api/internal/IStatusCallback.aidl b/play-services-base-api/src/main/aidl/com/google/android/gms/common/api/internal/IStatusCallback.aidl deleted file mode 100644 index 6355a13b..00000000 --- a/play-services-base-api/src/main/aidl/com/google/android/gms/common/api/internal/IStatusCallback.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.common.api.internal; - -import com.google.android.gms.common.api.Status; - -interface IStatusCallback { - void onResult(in Status status); -} diff --git a/play-services-base-api/src/main/aidl/com/google/android/gms/common/data/DataHolder.aidl b/play-services-base-api/src/main/aidl/com/google/android/gms/common/data/DataHolder.aidl deleted file mode 100644 index 3bbd1174..00000000 --- a/play-services-base-api/src/main/aidl/com/google/android/gms/common/data/DataHolder.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.common.data; - -parcelable DataHolder; diff --git a/play-services-base-api/src/main/aidl/com/google/android/gms/common/images/WebImage.aidl b/play-services-base-api/src/main/aidl/com/google/android/gms/common/images/WebImage.aidl deleted file mode 100644 index e31f15ab..00000000 --- a/play-services-base-api/src/main/aidl/com/google/android/gms/common/images/WebImage.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.common.images; - -parcelable WebImage; diff --git a/play-services-base-api/src/main/java/com/google/android/gms/auth/api/signin/GoogleSignInAccount.java b/play-services-base-api/src/main/java/com/google/android/gms/auth/api/signin/GoogleSignInAccount.java deleted file mode 100644 index 031c5b37..00000000 --- a/play-services-base-api/src/main/java/com/google/android/gms/auth/api/signin/GoogleSignInAccount.java +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.auth.api.signin; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class GoogleSignInAccount extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator<>(GoogleSignInAccount.class); -} diff --git a/play-services-base-api/src/main/java/com/google/android/gms/common/data/DataHolder.java b/play-services-base-api/src/main/java/com/google/android/gms/common/data/DataHolder.java deleted file mode 100644 index 77acbb1b..00000000 --- a/play-services-base-api/src/main/java/com/google/android/gms/common/data/DataHolder.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.data; - -import android.annotation.SuppressLint; -import android.database.Cursor; -import android.database.CursorWindow; -import android.os.Bundle; -import android.os.Parcel; - -import androidx.annotation.NonNull; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.io.Closeable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Class for accessing collections of data, organized into columns. This provides the backing - * support for DataBuffer. Much like a cursor, the holder supports the notion of a current - * position, and has methods for extracting various types of data from named columns. - */ -@PublicApi(until = "1") -public class DataHolder extends AutoSafeParcelable implements Closeable { - @SafeParceled(1) - private final String[] columns; - - @SafeParceled(2) - private final CursorWindow[] windows; - - @SafeParceled(3) - private final int statusCode; - - @SafeParceled(4) - private final Bundle metadata; - - private boolean closed = false; - private Map columnIndices; - - protected static final int FIELD_TYPE_NULL = 0; - protected static final int FIELD_TYPE_INTEGER = 1; - protected static final int FIELD_TYPE_FLOAT = 2; - protected static final int FIELD_TYPE_STRING = 3; - protected static final int FIELD_TYPE_BLOB = 4; - - /** - * Creates a data holder with the specified data. - * - * @param columns The column names corresponding to the data in the given windows. - * @param windows The {@link CursorWindow} instances holding the data. - * @param statusCode The status code of this {@link DataHolder}. - * @param metadata The metadata associated with this {@link DataHolder} (may be null). - */ - public DataHolder(String[] columns, CursorWindow[] windows, int statusCode, Bundle metadata) { - this.columns = columns; - this.windows = windows; - this.statusCode = statusCode; - this.metadata = metadata; - validateContents(); - } - - /** - * Creates a data holder wrapping the provided cursor, with provided status code and metadata. - * - * @param cursor The cursor containing the data. - * @param statusCode The status code of this {@link DataHolder}. - * @param metadata The metadata associated with this {@link DataHolder} (may be null). - */ - public DataHolder(Cursor cursor, int statusCode, Bundle metadata) { - this(cursor.getColumnNames(), createCursorWindows(cursor), statusCode, metadata); - } - - /** - * Get a {@link DataHolder.Builder} to create a new {@link DataHolder} manually. - * - * @param columns The array of column names that the object supports. - * @return {@link DataHolder.Builder} object to work with. - */ - public static Builder builder(String[] columns) { - return new Builder(columns); - } - - @SuppressLint({"NewApi", "ObsoleteSdkInt"}) - static int getCursorType(Cursor cursor, int i) { - return cursor.getType(i); - } - - /** - * Closes the data holder, releasing all of its resources and making it completely invalid. - */ - @Override - public void close() { - synchronized (this) { - if (!closed) { - closed = true; - for (CursorWindow window : windows) { - window.close(); - } - } - } - } - - @SuppressWarnings("deprecation") - private static CursorWindow[] createCursorWindows(Builder builder) { - if (builder.columns.length == 0) return new CursorWindow[0]; - List windows = new ArrayList<>(); - try { - CursorWindow current = null; - for (int rowIndex = 0; rowIndex < builder.rows.size(); rowIndex++) { - Map row = builder.rows.get(rowIndex); - if (current == null || !current.allocRow()) { - current = new CursorWindow(false); - current.setStartPosition(rowIndex); - current.setNumColumns(builder.columns.length); - windows.add(current); - if (!current.allocRow()) { - windows.remove(current); - return windows.toArray(new CursorWindow[0]); - } - } - for (int columnIndex = 0; columnIndex < builder.columns.length; columnIndex++) { - Object val = row.get(builder.columns[columnIndex]); - if (val == null) { - current.putNull(rowIndex, columnIndex); - } else if (val instanceof String) { - current.putString((String) val, rowIndex, columnIndex); - } else if (val instanceof Long) { - current.putLong((Long) val, rowIndex, columnIndex); - } else if (val instanceof Integer) { - current.putLong((Integer) val, rowIndex, columnIndex); - } else if (val instanceof Boolean) { - if ((Boolean) val) - current.putLong(1, rowIndex, columnIndex); - } else if (val instanceof byte[]) { - current.putBlob((byte[]) val, rowIndex, columnIndex); - } else if (val instanceof Double) { - current.putDouble((Double) val, rowIndex, columnIndex); - } else if (val instanceof Float) { - current.putDouble((Float) val, rowIndex, columnIndex); - } else { - throw new IllegalArgumentException("Unsupported object for column " + columnIndex + ": " + val); - } - } - } - } catch (RuntimeException e) { - for (CursorWindow window : windows) { - window.close(); - } - throw e; - } - return windows.toArray(new CursorWindow[0]); - } - - private static CursorWindow[] createCursorWindows(Cursor cursor) { - if (cursor.getColumnCount() == 0) return new CursorWindow[0]; - List windows = new ArrayList<>(); - CursorWindow current = null; - int rowIndex = 0; - while (cursor.moveToNext()) { - if (current == null || !current.allocRow()) { - current = new CursorWindow(false); - current.setStartPosition(rowIndex); - current.setNumColumns(cursor.getColumnCount()); - windows.add(current); - if (!current.allocRow()) { - windows.remove(current); - return windows.toArray(new CursorWindow[0]); - } - } - for (int i = 0; i < cursor.getColumnCount(); i++) { - switch (getCursorType(cursor, i)) { - case FIELD_TYPE_NULL: - current.putNull(rowIndex, i); - break; - case FIELD_TYPE_BLOB: - current.putBlob(cursor.getBlob(i), rowIndex, i); - break; - case FIELD_TYPE_FLOAT: - current.putDouble(cursor.getDouble(i), rowIndex, i); - break; - case FIELD_TYPE_INTEGER: - current.putLong(cursor.getLong(i), rowIndex, i); - break; - case FIELD_TYPE_STRING: - current.putString(cursor.getString(i), rowIndex, i); - break; - } - } - rowIndex++; - } - cursor.close(); - return windows.toArray(new CursorWindow[0]); - } - - /** - * Gets the number of rows in the data holder. - * - * @return the number of rows in the data holder. - */ - public int getCount() { - int c = 0; - if (windows != null) { - for (CursorWindow window : windows) { - c += window.getNumRows(); - } - } - return c; - } - - /** - * Retrieves the string value for a given column at the provided position. - * This will throw an {@link IllegalArgumentException} if the column does not exist, the - * position is invalid, or the data holder has been closed. - * - * @param column The column to retrieve. - * @param row The row to retrieve the data from. - * @param windowIndex Index of the cursor window to extract the data from. - * @return The string value in that column. - */ - public String getString(String column, int row, int windowIndex) { - return windows[windowIndex].getString(row, columnIndices.get(column)); - } - - @NonNull - @Override - public String toString() { - return "DataHolder{" + - "columns=" + Arrays.toString(columns) + - ", windows=" + Arrays.toString(windows) + - ", statusCode=" + statusCode + - ", metadata=" + metadata + - '}'; - } - - public void validateContents() { - columnIndices = new HashMap<>(); - for (int i = 0; i < columns.length; i++) { - columnIndices.put(columns[i], i); - } - } - - /** - * Helper class to build {@link DataHolder} instances containing arbitrary data. - *

- * Note that the constructor is private; use DataHolder.builder() to create instances of this class. - */ - public static class Builder { - private final String[] columns; - private final ArrayList> rows; - - private Builder(String[] columns) { - this.columns = columns; - this.rows = new ArrayList<>(); - } - - /** - * Instantiate an {@link DataHolder} from this {@link DataHolder.Builder} with the given status code and metadata. - * - * @param statusCode The status code of this {@link DataHolder}. - * @param metadata The metadata associated with this {@link DataHolder} (may be null). - * @return {@link DataHolder} representation of this object. - */ - public DataHolder build(int statusCode, Bundle metadata) { - return new DataHolder(columns, createCursorWindows(this), statusCode, metadata); - } - - /** - * Instantiate an {@link DataHolder} from this {@link DataHolder.Builder} with the given status code and null metadata. - * - * @param statusCode The status code of this {@link DataHolder}. - * @return {@link DataHolder} representation of this object. - */ - public DataHolder build(int statusCode) { - return build(statusCode, null); - } - - /** - * @return The number of rows that the resulting DataHolder will contain. - */ - public int getCount() { - return rows.size(); - } - - } - - public static final Creator CREATOR = new AutoCreator(DataHolder.class) { - @Override - public DataHolder createFromParcel(Parcel parcel) { - DataHolder res = super.createFromParcel(parcel); - res.validateContents(); - return res; - } - }; -} diff --git a/play-services-base-api/src/main/java/com/google/android/gms/common/images/WebImage.java b/play-services-base-api/src/main/java/com/google/android/gms/common/images/WebImage.java deleted file mode 100644 index 4b5e4ad7..00000000 --- a/play-services-base-api/src/main/java/com/google/android/gms/common/images/WebImage.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2013-2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.images; - -import android.net.Uri; - -import androidx.annotation.NonNull; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.Locale; - -public class WebImage extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator<>(WebImage.class); - - public WebImage () { - this.uri = null; - } - - public WebImage (Uri uri) { - this.uri = uri; - } - - @SafeParceled(1) - private final int versionCode = 1; - - @SafeParceled(2) - private final Uri uri; - - @SafeParceled(3) - private final int width = 0; - - @SafeParceled(4) - private final int height = 0; - - public Uri getUrl() { - return uri; - } - - public int getWidth() { - return width; - } - - public int getHeight() { - return height; - } - - @NonNull - public String toString() { - assert uri != null; - return String.format(Locale.getDefault(), "Image %dx%d %s", width, height, uri); - } -} diff --git a/play-services-base-core/build.gradle b/play-services-base-core/build.gradle deleted file mode 100644 index 5a5dfa30..00000000 --- a/play-services-base-core/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'maven-publish' -apply plugin: 'signing' - -dependencies { - api project(':play-services-basement') - api "androidx.lifecycle:lifecycle-service:$lifecycleVersion" - - implementation "androidx.annotation:annotation:$annotationVersion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" -} - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion androidBuildVersionTools - - defaultConfig { - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - compileOptions { - sourceCompatibility = 17 - targetCompatibility = 17 - } - namespace 'org.microg.gms.base.core' -} \ No newline at end of file diff --git a/play-services-base-core/src/main/AndroidManifest.xml b/play-services-base-core/src/main/AndroidManifest.xml deleted file mode 100644 index 6585028c..00000000 --- a/play-services-base-core/src/main/AndroidManifest.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/play-services-base-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java b/play-services-base-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java deleted file mode 100644 index 9ff67ff8..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms; - -import android.os.Bundle; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.common.internal.GetServiceRequest; -import com.google.android.gms.common.internal.IGmsCallbacks; -import com.google.android.gms.common.internal.IGmsServiceBroker; -import com.google.android.gms.common.internal.ValidateAccountRequest; - -import org.microg.gms.common.GmsService; - -import java.util.EnumSet; - -public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub { - private static final String TAG = "GmsServiceBroker"; - private final EnumSet supportedServices; - - public AbstractGmsServiceBroker(EnumSet supportedServices) { - this.supportedServices = supportedServices; - } - - @Deprecated - @Override - public void getPeopleService(IGmsCallbacks callback, int versionCode, String packageName, - Bundle params) throws RemoteException { - callGetService(GmsService.PEOPLE, callback, versionCode, packageName, params); - } - - @Deprecated - @Override - public void getGoogleIdentityService(IGmsCallbacks callback, int versionCode, - String packageName, Bundle params) throws RemoteException { - callGetService(GmsService.ACCOUNT, callback, versionCode, packageName, params); - } - - @Deprecated - @Override - public void getAddressService(IGmsCallbacks callback, int versionCode, String packageName) - throws RemoteException { - callGetService(callback, versionCode, packageName); - } - - private void callGetService(IGmsCallbacks callback, int gmsVersion, - String packageName) throws RemoteException { - callGetService(GmsService.ADDRESS, callback, gmsVersion, packageName, null); - } - - private void callGetService(GmsService service, IGmsCallbacks callback, int gmsVersion, String packageName, Bundle extras) throws RemoteException { - GetServiceRequest request = new GetServiceRequest(service.SERVICE_ID); - request.gmsVersion = gmsVersion; - request.packageName = packageName; - request.extras = extras; - request.account = null; - request.scopes = null; - getService(callback, request); - } - - @Override - public void getService(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - GmsService gmsService = GmsService.byServiceId(request.serviceId); - if ((supportedServices.contains(gmsService)) || supportedServices.contains(GmsService.ANY)) { - handleServiceRequest(callback, request, gmsService); - } else { - Log.d(TAG, "Service not supported: " + request); - throw new IllegalArgumentException("Service not supported: " + request.serviceId); - } - } - - public abstract void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException; - - @Override - public void validateAccount(IGmsCallbacks callback, ValidateAccountRequest request) { - throw new IllegalArgumentException("ValidateAccountRequest not supported"); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/BaseService.java b/play-services-base-core/src/main/java/org/microg/gms/BaseService.java deleted file mode 100644 index 38545ff0..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/BaseService.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms; - -import android.content.Intent; -import android.os.IBinder; -import android.os.RemoteException; -import android.util.Log; - -import androidx.annotation.NonNull; -import androidx.lifecycle.LifecycleService; - -import com.google.android.gms.common.internal.GetServiceRequest; -import com.google.android.gms.common.internal.IGmsCallbacks; -import com.google.android.gms.common.internal.IGmsServiceBroker; - -import org.microg.gms.common.GmsService; - -import java.io.FileDescriptor; -import java.io.PrintWriter; -import java.util.Arrays; -import java.util.EnumSet; - -public abstract class BaseService extends LifecycleService { - private final IGmsServiceBroker broker; - private final EnumSet services; - protected final String TAG; - - public BaseService(String tag, GmsService supportedService, GmsService... supportedServices) { - this.TAG = tag; - services = EnumSet.of(supportedService); - services.addAll(Arrays.asList(supportedServices)); - broker = new AbstractGmsServiceBroker(services) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { - try { - request.extras.keySet(); // call to unparcel() - } catch (Exception e) { - // Sometimes we need to define the correct ClassLoader before unparcel(). Ignore those. - } - Log.d(TAG, "bound by: " + request); - BaseService.this.handleServiceRequest(callback, request, service); - } - }; - } - - @Override - public IBinder onBind(@NonNull Intent intent) { - super.onBind(intent); - Log.d(TAG, "onBind: " + intent); - return broker.asBinder(); - } - - @Override - protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) { - writer.println(TAG + " providing services " + services.toString()); - } - - public abstract void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException; -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/DummyService.java b/play-services-base-core/src/main/java/org/microg/gms/DummyService.java deleted file mode 100644 index 5e19cc31..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/DummyService.java +++ /dev/null @@ -1,75 +0,0 @@ -/* -<<<<<<< HEAD:play-services-base-core/src/main/java/org/microg/gms/DummyService.java - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -======= - * SPDX-FileCopyrightText: 2017 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. ->>>>>>> 2e4d3ae4 (Location: Implement settings request (#2216)):play-services-location/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java - */ - -package org.microg.gms; - -import android.os.RemoteException; - -import androidx.annotation.NonNull; -import com.google.android.gms.common.api.CommonStatusCodes; -import com.google.android.gms.common.internal.GetServiceRequest; -import com.google.android.gms.common.internal.IGmsCallbacks; - -<<<<<<< HEAD:play-services-base-core/src/main/java/org/microg/gms/DummyService.java -import org.microg.gms.common.GmsService; - -public class DummyService extends BaseService { - public DummyService() { - super("GmsDummySvc", GmsService.ANY); - } - - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { - callback.onPostInitComplete(CommonStatusCodes.ERROR, null, null); -======= -import org.microg.gms.common.Hide; -import org.microg.gms.common.PublicApi; - -/** - * Location settings specific status codes, for use in {@link Status#getStatusCode()} - */ -@PublicApi -public class LocationSettingsStatusCodes extends CommonStatusCodes { - /** - * Location settings can't be changed to meet the requirements, no dialog pops up - */ - public static final int SETTINGS_CHANGE_UNAVAILABLE = 8502; - - @NonNull - @Hide - public static String getStatusCodeString(int statusCode) { - switch (statusCode) { - case SETTINGS_CHANGE_UNAVAILABLE: - return "SETTINGS_CHANGE_UNAVAILABLE"; - case 8500: - case 8501: - case 8503: - case 8505: - return "INTERNAL_LOCATION_SETTINGS_STATUS_CODE"; - default: - return CommonStatusCodes.getStatusCodeString(statusCode); - } ->>>>>>> 2e4d3ae4 (Location: Implement settings request (#2216)):play-services-location/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/DeviceConfiguration.java b/play-services-base-core/src/main/java/org/microg/gms/common/DeviceConfiguration.java deleted file mode 100644 index d4ab5940..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/DeviceConfiguration.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import android.app.ActivityManager; -import android.content.Context; -import android.content.pm.ConfigurationInfo; -import android.content.pm.FeatureInfo; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.opengl.GLES10; -import android.os.Build; -import android.util.DisplayMetrics; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.egl.EGLDisplay; - -public class DeviceConfiguration { - public List availableFeatures; - public int densityDpi; - public int glEsVersion; - public List glExtensions; - public boolean hasFiveWayNavigation; - public boolean hasHardKeyboard; - public int heightPixels; - public int keyboardType; - public List locales; - public List nativePlatforms; - public int navigation; - public int screenLayout; - public List sharedLibraries; - public int touchScreen; - public int widthPixels; - - public DeviceConfiguration(Context context) { - ConfigurationInfo configurationInfo = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getDeviceConfigurationInfo(); - touchScreen = configurationInfo.reqTouchScreen; - keyboardType = configurationInfo.reqKeyboardType; - navigation = configurationInfo.reqNavigation; - Configuration configuration = context.getResources().getConfiguration(); - screenLayout = configuration.screenLayout; - hasHardKeyboard = (configurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD) > 0; - hasFiveWayNavigation = (configurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV) > 0; - DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); - densityDpi = displayMetrics.densityDpi; - glEsVersion = configurationInfo.reqGlEsVersion; - PackageManager packageManager = context.getPackageManager(); - String[] systemSharedLibraryNames = packageManager.getSystemSharedLibraryNames(); - sharedLibraries = new ArrayList<>(); - if (systemSharedLibraryNames != null) sharedLibraries.addAll(Arrays.asList(systemSharedLibraryNames)); - for (String s : new String[]{"com.google.android.maps", "com.google.android.media.effects", "com.google.widevine.software.drm"}) { - if (!sharedLibraries.contains(s)) { - sharedLibraries.add(s); - } - } - Collections.sort(sharedLibraries); - availableFeatures = new ArrayList<>(); - if (packageManager.getSystemAvailableFeatures() != null) { - for (FeatureInfo featureInfo : packageManager.getSystemAvailableFeatures()) { - if (featureInfo != null && featureInfo.name != null) availableFeatures.add(featureInfo.name); - } - } - Collections.sort(availableFeatures); - this.nativePlatforms = getNativePlatforms(); - widthPixels = displayMetrics.widthPixels; - heightPixels = displayMetrics.heightPixels; - locales = new ArrayList<>(Arrays.asList(context.getAssets().getLocales())); - for (int i = 0; i < locales.size(); i++) { - locales.set(i, locales.get(i).replace("-", "_")); - } - Collections.sort(locales); - Set glExtensions = new HashSet<>(); - addEglExtensions(glExtensions); - this.glExtensions = new ArrayList<>(glExtensions); - Collections.sort(this.glExtensions); - } - - @SuppressWarnings({"deprecation", "InlinedApi"}) - private static List getNativePlatforms() { - List nativePlatforms; - return Arrays.asList(Build.SUPPORTED_ABIS); - } - - private static void addEglExtensions(Set glExtensions) { - EGL10 egl10 = (EGL10) EGLContext.getEGL(); - if (egl10 != null) { - EGLDisplay display = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); - egl10.eglInitialize(display, new int[2]); - int[] cf = new int[1]; - if (egl10.eglGetConfigs(display, null, 0, cf)) { - EGLConfig[] configs = new EGLConfig[cf[0]]; - if (egl10.eglGetConfigs(display, configs, cf[0], cf)) { - int[] a1 = - new int[]{EGL10.EGL_WIDTH, EGL10.EGL_PBUFFER_BIT, EGL10.EGL_HEIGHT, EGL10.EGL_PBUFFER_BIT, - EGL10.EGL_NONE}; - int[] a2 = new int[]{12440, EGL10.EGL_PIXMAP_BIT, EGL10.EGL_NONE}; - int[] a3 = new int[1]; - for (int i = 0; i < cf[0]; i++) { - egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_CONFIG_CAVEAT, a3); - if (a3[0] != EGL10.EGL_SLOW_CONFIG) { - egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_SURFACE_TYPE, a3); - if ((1 & a3[0]) != 0) { - egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_RENDERABLE_TYPE, a3); - if ((1 & a3[0]) != 0) { - addExtensionsForConfig(egl10, display, configs[i], a1, null, glExtensions); - } - if ((4 & a3[0]) != 0) { - addExtensionsForConfig(egl10, display, configs[i], a1, a2, glExtensions); - } - } - } - } - } - } - egl10.eglTerminate(display); - } - } - - private static void addExtensionsForConfig(EGL10 egl10, EGLDisplay egldisplay, EGLConfig eglconfig, int[] ai, - int[] ai1, Set set) { - EGLContext eglcontext = egl10.eglCreateContext(egldisplay, eglconfig, EGL10.EGL_NO_CONTEXT, ai1); - if (eglcontext != EGL10.EGL_NO_CONTEXT) { - javax.microedition.khronos.egl.EGLSurface eglsurface = - egl10.eglCreatePbufferSurface(egldisplay, eglconfig, ai); - if (eglsurface != EGL10.EGL_NO_SURFACE) { - egl10.eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglcontext); - String s = GLES10.glGetString(7939); - if (s != null && !s.isEmpty()) { - String[] as = s.split(" "); - set.addAll(Arrays.asList(as).subList(0, as.length)); - } - egl10.eglMakeCurrent(egldisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); - egl10.eglDestroySurface(egldisplay, eglsurface); - } - egl10.eglDestroyContext(egldisplay, eglcontext); - } - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/DeviceIdentifier.java b/play-services-base-core/src/main/java/org/microg/gms/common/DeviceIdentifier.java deleted file mode 100644 index ab5d22cb..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/DeviceIdentifier.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import java.util.Random; - -public class DeviceIdentifier { - public String wifiMac = randomMacAddress(); // TODO: static - public String meid = randomMeid(); - public String esn; - - - private static String randomMacAddress() { - StringBuilder mac = new StringBuilder("b407f9"); - Random rand = new Random(); - for (int i = 0; i < 6; i++) { - mac.append(Integer.toString(rand.nextInt(16), 16)); - } - return mac.toString(); - } - - private static String randomMeid() { - // http://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity - // We start with a known base, and generate random MEID - String meid; - Random rand = new Random(); - StringBuilder meidBuilder = new StringBuilder("35503104"); - for (int i = 0; i < 6; i++) { - meidBuilder.append(rand.nextInt(10)); - } - meid = meidBuilder.toString(); - - // Luhn algorithm (check digit) - int sum = 0; - for (int i = 0; i < meid.length(); i++) { - int c = Integer.parseInt(String.valueOf(meid.charAt(i))); - if ((meid.length() - i - 1) % 2 == 0) { - c *= 2; - c = c % 10 + c / 10; - } - - sum += c; - } - final int check = (100 - sum) % 10; - meid += Integer.toString(check); - - return meid; - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceContext.java b/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceContext.java deleted file mode 100644 index c7a2ff52..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceContext.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.microg.gms.common; - -import android.annotation.SuppressLint; -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.app.Service; -import android.content.ComponentName; -import android.content.Context; -import android.content.ContextWrapper; -import android.content.Intent; -import android.net.Uri; -import android.os.Build; -import android.os.PowerManager; -import android.provider.Settings; -import android.util.Log; - -import androidx.core.app.NotificationCompat; - -import org.microg.gms.base.core.R; - -public class ForegroundServiceContext extends ContextWrapper { - private static final String TAG = "ForegroundService"; - public static final String EXTRA_FOREGROUND = "foreground"; - - public ForegroundServiceContext(Context base) { - super(base); - } - - @Override - public ComponentName startService(Intent service) { - if (!isIgnoringBatteryOptimizations()) { - Log.d(TAG, "Starting in foreground mode."); - service.putExtra(EXTRA_FOREGROUND, true); - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - return super.startForegroundService(service); - } else { - return super.startService(service); - } - } - return super.startService(service); - } - - private boolean isIgnoringBatteryOptimizations() { - PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); - return powerManager.isIgnoringBatteryOptimizations(getPackageName()); - } - - private static String getServiceName(Service service) { - String serviceName = null; - try { - ForegroundServiceInfo annotation = service.getClass().getAnnotation(ForegroundServiceInfo.class); - if (annotation != null) { - if (annotation.res() != 0) { - try { - serviceName = service.getString(annotation.res()); - } catch (Exception ignored) { - } - } - if (serviceName == null) { - serviceName = annotation.value(); - } - } - } catch (Exception ignored) { - } - if (serviceName == null) { - serviceName = service.getClass().getSimpleName(); - } - return serviceName; - } - - public static void completeForegroundService(Service service, Intent intent, String tag) { - if (intent != null && intent.getBooleanExtra(EXTRA_FOREGROUND, false)) { - String serviceName = getServiceName(service); - Log.d(tag, "Started " + serviceName + " in foreground mode."); - try { - Notification notification = buildForegroundNotification(service, serviceName); - service.startForeground(serviceName.hashCode(), notification); - Log.d(tag, "Notification: " + notification); - } catch (Exception e) { - Log.w(tag, e); - } - } - } - - @SuppressLint("BatteryLife") - private static Notification buildForegroundNotification(Context context, String serviceName) { - Intent notificationIntent = new Intent(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { - notificationIntent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - notificationIntent.setData(Uri.parse("package:" + context.getPackageName())); - } else { - notificationIntent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS); - notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - PendingIntent notificationPendingIntent = PendingIntent.getActivity(context, - 0, - notificationIntent, - 0); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel Channel = new NotificationChannel("foreground-service", - context.getResources().getString(R.string.notification_service_name), - NotificationManager.IMPORTANCE_LOW); - Channel.setShowBadge(false); - Channel.setVibrationPattern(new long[]{0}); - Channel.setLockscreenVisibility(0); - context.getSystemService(NotificationManager.class).createNotificationChannel(Channel); - } - return new NotificationCompat.Builder(context, "foreground-service") - .setOngoing(true) - .setContentIntent(notificationPendingIntent) - .setSmallIcon(R.drawable.ic_foreground_notification) - .setContentTitle(context.getResources().getString(R.string.small_notification_service_title)) - .setStyle(new NotificationCompat.BigTextStyle() - .setBigContentTitle(context.getResources().getString(R.string.big_notification_service_title)) - .bigText(context.getResources().getString(R.string.notification_service_content))) - .build(); - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceInfo.java b/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceInfo.java deleted file mode 100644 index 8a8102a6..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceInfo.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.common; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ForegroundServiceInfo { - String value(); - int res() default 0; -} \ No newline at end of file diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/HttpFormClient.java b/play-services-base-core/src/main/java/org/microg/gms/common/HttpFormClient.java deleted file mode 100644 index ee9c79f7..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/HttpFormClient.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import android.net.Uri; -import android.util.Log; - -import java.io.IOException; -import java.io.OutputStream; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.reflect.Field; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.List; -import java.util.Map; - -public class HttpFormClient { - private static final String TAG = "GmsHttpFormClient"; - - public static T request(String url, Request request, Class tClass) throws IOException { - HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); - connection.setRequestMethod("POST"); - connection.setDoInput(true); - connection.setDoOutput(true); - connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); - StringBuilder content = new StringBuilder(); - request.prepare(); - for (Field field : request.getClass().getDeclaredFields()) { - try { - field.setAccessible(true); - Object objVal = field.get(request); - if (field.isAnnotationPresent(RequestContentDynamic.class)) { - Map contentParams = (Map) objVal; - for (Map.Entry param : contentParams.entrySet()) { - appendParam(content, param.getKey(), param.getValue()); - } - continue; - } - String value = objVal != null ? String.valueOf(objVal) : null; - Boolean boolVal = null; - if (field.getType().equals(boolean.class)) { - boolVal = field.getBoolean(request); - } - if (field.isAnnotationPresent(RequestHeader.class)) { - RequestHeader annotation = field.getAnnotation(RequestHeader.class); - value = valueFromBoolVal(value, boolVal, annotation.truePresent(), annotation.falsePresent()); - if (value != null || annotation.nullPresent()) { - for (String key : annotation.value()) { - connection.setRequestProperty(key, String.valueOf(value)); - } - } - } - if (field.isAnnotationPresent(RequestContent.class)) { - RequestContent annotation = field.getAnnotation(RequestContent.class); - value = valueFromBoolVal(value, boolVal, annotation.truePresent(), annotation.falsePresent()); - if (value != null || annotation.nullPresent()) { - for (String key : annotation.value()) { - appendParam(content, key, value); - } - } - } - } catch (Exception ignored) { - } - } - - Log.d(TAG, "-- Request --\n" + content); - String replace = content.toString().trim().replace("\n", ""); - OutputStream os = connection.getOutputStream(); - os.write(replace.trim().getBytes()); - os.close(); - - if (connection.getResponseCode() != 200) { - String error = connection.getResponseMessage(); - try { - error = new String(Utils.readStreamToEnd(connection.getErrorStream())); - } catch (IOException e) { - // Ignore - } - throw new IOException(error); - } - - String result = new String(Utils.readStreamToEnd(connection.getInputStream())); - Log.d(TAG, "-- Response --\n" + result); - return parseResponse(tClass, connection, result); - } - - private static String valueFromBoolVal(String value, Boolean boolVal, boolean truePresent, boolean falsePresent) { - if (boolVal != null) { - if (boolVal && truePresent) { - return "1"; - } else if (!boolVal && falsePresent) { - return "0"; - } else { - return null; - } - } else { - return value; - } - } - - private static void appendParam(StringBuilder content, String key, String value) { - if (content.length() > 0) - content.append("&"); - if (key.equals("token_request_options")) { - content.append(Uri.encode(key)).append("=").append(value); - } else { - content.append(Uri.encode(key)).append("=").append(Uri.encode(String.valueOf(value))); - } - } - - private static T parseResponse(Class tClass, HttpURLConnection connection, String result) throws IOException { - Map> headerFields = connection.getHeaderFields(); - T response; - try { - response = tClass.getConstructor().newInstance(); - } catch (Exception e) { - return null; - } - String[] entries = result.split("\n"); - for (String s : entries) { - String[] keyValuePair = s.split("=", 2); - String key = keyValuePair[0].trim(); - String value = keyValuePair[1].trim(); - boolean matched = false; - try { - for (Field field : tClass.getDeclaredFields()) { - if (field.isAnnotationPresent(ResponseField.class) && - key.equals(field.getAnnotation(ResponseField.class).value())) { - field.setAccessible(true); - matched = true; - if (field.getType().equals(String.class)) { - field.set(response, value); - } else if (field.getType().equals(boolean.class)) { - field.setBoolean(response, value.equals("1")); - } else if (field.getType().equals(long.class)) { - field.setLong(response, Long.parseLong(value)); - } else if (field.getType().equals(int.class)) { - field.setInt(response, Integer.parseInt(value)); - } - } - } - } catch (Exception e) { - Log.w(TAG, e); - } - if (!matched) { - Log.w(TAG, "Response line '" + s + "' not processed"); - } - } - for (Field field : tClass.getDeclaredFields()) { - if (field.isAnnotationPresent(ResponseHeader.class)) { - List strings = headerFields.get(field.getAnnotation(ResponseHeader.class).value()); - if (strings == null || strings.size() != 1) continue; - String value = strings.get(0); - try { - field.setAccessible(true); - if (field.getType().equals(String.class)) { - field.set(response, value); - } else if (field.getType().equals(boolean.class)) { - field.setBoolean(response, value.equals("1")); - } else if (field.getType().equals(long.class)) { - field.setLong(response, Long.parseLong(value)); - } else if (field.getType().equals(int.class)) { - field.setInt(response, Integer.parseInt(value)); - } - } catch (Exception e) { - Log.w(TAG, e); - } - } - if (field.isAnnotationPresent(ResponseStatusCode.class) && field.getType() == int.class) { - try { - field.setAccessible(true); - field.setInt(response, connection.getResponseCode()); - } catch (IllegalAccessException e) { - Log.w(TAG, e); - } - } - if (field.isAnnotationPresent(ResponseStatusText.class) && field.getType() == String.class) { - try { - field.setAccessible(true); - field.set(response, connection.getResponseMessage()); - } catch (IllegalAccessException e) { - Log.w(TAG, e); - } - } - } - return response; - } - - public static void requestAsync(final String url, final Request request, final Class tClass, - final Callback callback) { - new Thread(new Runnable() { - @Override - public void run() { - try { - callback.onResponse(request(url, request, tClass)); - } catch (Exception e) { - callback.onException(e); - } - } - }).start(); - } - - public static abstract class Request { - protected void prepare() { - } - } - - public interface Callback { - void onResponse(T response); - - void onException(Exception exception); - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - public @interface RequestHeader { - public String[] value(); - - public boolean truePresent() default true; - - public boolean falsePresent() default false; - - public boolean nullPresent() default false; - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - public @interface RequestContent { - public String[] value(); - - public boolean truePresent() default true; - - public boolean falsePresent() default false; - - public boolean nullPresent() default false; - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - public @interface RequestContentDynamic { - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - public @interface ResponseField { - public String value(); - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - public @interface ResponseHeader { - public String value(); - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - public @interface ResponseStatusCode { - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - public @interface ResponseStatusText { - } -} \ No newline at end of file diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/MultiListenerProxy.java b/play-services-base-core/src/main/java/org/microg/gms/common/MultiListenerProxy.java deleted file mode 100644 index 66f44776..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/MultiListenerProxy.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import android.os.IInterface; -import android.util.Log; - -import androidx.annotation.NonNull; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; - -public class MultiListenerProxy implements InvocationHandler { - private static final String TAG = "GmsMultiListener"; - - public static T get(Class tClass, final Collection listeners) { - return get(tClass, new CollectionListenerPool<>(listeners)); - } - - public static T get(Class tClass, final ListenerPool listenerPool) { - return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass}, new MultiListenerProxy<>(listenerPool)); - } - - private final ListenerPool listeners; - - private MultiListenerProxy(ListenerPool listeners) { - this.listeners = listeners; - } - - @Override - public Object invoke(Object proxy, Method method, Object[] args) { - for (T listener : new HashSet<>(listeners)) { - try { - method.invoke(listener, args); - } catch (Exception e) { - Log.w(TAG, e); - listeners.remove(listener); - } - } - return null; - } - - public static abstract class ListenerPool implements Collection { - @Override - public boolean addAll(Collection collection) { - return false; - } - - @Override - public boolean add(T object) { - return false; - } - - @Override - public boolean containsAll(Collection collection) { - for (Object o : collection) { - if (!contains(o)) return false; - } - return true; - } - - @Override - public boolean removeAll(Collection collection) { - boolean x = true; - for (Object o : collection) { - if (!remove(o)) x = false; - } - return x; - } - - @Override - public boolean retainAll(Collection collection) { - return false; - } - - @NonNull - @Override - public Object[] toArray() { - throw new IllegalArgumentException(); - } - - @NonNull - @Override - public T1[] toArray(T1[] array) { - throw new IllegalArgumentException(); - } - } - - private static class CollectionListenerPool extends ListenerPool { - - private final Collection listeners; - - public CollectionListenerPool(Collection listeners) { - this.listeners = listeners; - } - - @Override - public void clear() { - listeners.clear(); - } - - @Override - public boolean contains(Object object) { - return listeners.contains(object); - } - - @Override - public boolean isEmpty() { - return listeners.isEmpty(); - } - - @NonNull - @Override - public Iterator iterator() { - return listeners.iterator(); - } - - @Override - public boolean remove(Object object) { - return listeners.remove(object); - } - - @Override - public int size() { - return listeners.size(); - } - } - - public static class MultiCollectionListenerPool extends ListenerPool { - private final Collection> multiCol; - - public MultiCollectionListenerPool(Collection> multiCol) { - this.multiCol = multiCol; - } - - @Override - public void clear() { - for (Collection ts : multiCol) { - ts.clear(); - } - } - - @Override - public boolean contains(Object object) { - for (Collection ts : multiCol) { - if (ts.contains(object)) return true; - } - return false; - } - - @Override - public boolean isEmpty() { - for (Collection ts : multiCol) { - if (!ts.isEmpty()) return false; - } - return true; - } - - @NonNull - @Override - public Iterator iterator() { - final Iterator> interMed = multiCol.iterator(); - return new Iterator() { - private Iterator med; - - @Override - public boolean hasNext() { - while ((med == null || !med.hasNext()) && interMed.hasNext()) { - med = interMed.next().iterator(); - } - return med != null && med.hasNext(); - } - - @Override - public T next() { - while (med == null || !med.hasNext()) { - med = interMed.next().iterator(); - } - return med.next(); - } - - @Override - public void remove() { - med.remove(); - } - }; - } - - @Override - public boolean remove(Object object) { - for (Collection ts : multiCol) { - if (ts.remove(object)) return true; - } - return false; - } - - @Override - public int size() { - int sum = 0; - for (Collection ts : multiCol) { - sum += ts.size(); - } - return sum; - } - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/NonCancelToken.java b/play-services-base-core/src/main/java/org/microg/gms/common/NonCancelToken.java deleted file mode 100644 index 29cdba34..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/NonCancelToken.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import android.os.RemoteException; - -import com.google.android.gms.common.internal.ICancelToken; - -public class NonCancelToken extends ICancelToken.Stub { - @Override - public void cancel() throws RemoteException { - - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java b/play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java deleted file mode 100644 index 62c2a478..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import android.app.ActivityManager; -import android.app.Application; -import android.app.PendingIntent; -import android.content.Context; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.Signature; -import android.os.Binder; -import android.util.Log; - -import androidx.annotation.Nullable; -import org.microg.gms.utils.ExtendedPackageInfo; - -import java.lang.reflect.Method; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.List; - -import static android.os.Build.VERSION.SDK_INT; -import static org.microg.gms.common.Constants.GMS_PACKAGE_NAME; -import static org.microg.gms.common.Constants.GMS_PACKAGE_SIGNATURE_SHA1; -import static org.microg.gms.common.Constants.GMS_SECONDARY_PACKAGE_SIGNATURE_SHA1; - -public class PackageUtils { - - private static final String GOOGLE_PLATFORM_KEY = GMS_PACKAGE_SIGNATURE_SHA1; - private static final String GOOGLE_PLATFORM_KEY_2 = GMS_SECONDARY_PACKAGE_SIGNATURE_SHA1; - private static final String GOOGLE_APP_KEY = "24bb24c05e47e0aefa68a58a766179d9b613a600"; - private static final String[] GOOGLE_PRIMARY_KEYS = {GOOGLE_PLATFORM_KEY, GOOGLE_PLATFORM_KEY_2, GOOGLE_APP_KEY}; - -<<<<<<< HEAD:play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java - private static final Map KNOWN_GOOGLE_PACKAGES; - - static { - KNOWN_GOOGLE_PACKAGES = new HashMap<>(); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.youtube.music", "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"); -<<<<<<< HEAD:play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java - KNOWN_GOOGLE_PACKAGES.put("com.google.android.youtube", "24bb24c05e47e0aefa68a58a766179d9b613a600"); -======= - KNOWN_GOOGLE_PACKAGES.put("com.google.android.vr.home", "fc1edc68f7e3e4963c998e95fc38f3de8d1bfc96"); - KNOWN_GOOGLE_PACKAGES.put("com.google.vr.cyclops", "188c5ca3863fa121216157a5baa80755ceda70ab"); - KNOWN_GOOGLE_PACKAGES.put("com.waze", "35b438fe1bc69d975dc8702dc16ab69ebf65f26f"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.wellbeing", "4ebdd02380f1fa0b6741491f0af35625dba76e9f"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.village.boond", "48e7985b8f901df335b5d5223579c81618431c7b"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.subscriptions.red", "de8304ace744ae4c4e05887a27a790815e610ff0"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.meetings", "47a6936b733dbdb45d71997fbe1d610eca36b8bf"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.nbu.paisa.user", "80df78bb700f9172bc671779b017ddefefcbf552"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.dynamite", "519c5a17a60596e6fe5933b9cb4285e7b0e5eb7b"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.projection.gearhead", "9ca91f9e704d630ef67a23f52bf1577a92b9ca5d"); - KNOWN_GOOGLE_PACKAGES.put("com.google.stadia.android", "133aad3b3d3b580e286573c37f20549f9d3d1cce"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.kids.familylink", "88652b8464743e5ce80da0d4b890d13f9b1873df"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.walletnfcrel", "82759e2db43f9ccbafce313bc674f35748fabd7a"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.recorder", "394d84cd2cf89d3453702c663f98ec6554afc3cd"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.messaging", "0980a12be993528c19107bc21ad811478c63cefc"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.tachyon", "a0bc09af527b6397c7a9ef171d6cf76f757becc3"); - KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.access.wifi.consumer", "d850379540d68fbec82a742ab6a8321a3f9a4c7c"); ->>>>>>> 21ac41f4 (Fix account access for google wifi (#2205)):play-services-base/core/src/main/java/org/microg/gms/common/PackageUtils.java - } - -======= - @Deprecated ->>>>>>> a9906e52 (Rework known google package system):play-services-base/core/src/main/java/org/microg/gms/common/PackageUtils.java - public static boolean isGooglePackage(Context context, String packageName) { - return new ExtendedPackageInfo(context, packageName).isGoogleOrPlatformPackage(); - } - - /** - * @deprecated Extended access is a deprecated concept - */ - @Deprecated - public static boolean callerHasExtendedAccessPermission(Context context) { - return context.checkCallingPermission("org.microg.gms.EXTENDED_ACCESS") == PackageManager.PERMISSION_GRANTED; - } - - public static void assertGooglePackagePermission(Context context, GooglePackagePermission permission) { - try { - if (!callerHasGooglePackagePermission(context, permission)) - throw new SecurityException("Access denied, missing google package permission for " + permission.name()); - } catch (SecurityException e) { - Log.w("ExtendedAccess", e); - throw e; - } - } - -<<<<<<< HEAD:play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java - public static boolean isGooglePackage(String packageName, String signatureDigest) { - if (signatureDigest == null) return false; - if (Arrays.asList(GOOGLE_PRIMARY_KEYS).contains(signatureDigest)) return true; - if (!KNOWN_GOOGLE_PACKAGES.containsKey(packageName)) return false; - return KNOWN_GOOGLE_PACKAGES.get(packageName).equals(signatureDigest); - } - - public static void assertExtendedAccess(Context context) { - if (!callerHasExtendedAccess(context)) - throw new SecurityException("Access denied, missing EXTENDED_ACCESS permission"); - } - - public static boolean callerHasExtendedAccess(Context context) { - String[] packagesForUid = context.getPackageManager().getPackagesForUid(Binder.getCallingUid()); - if (packagesForUid != null && packagesForUid.length != 0) { - for (String packageName : packagesForUid) { - packageName = PackageSpoofUtils.spoofPackageName(context.getPackageManager(), packageName); - if (isGooglePackage(context, packageName) || GMS_PACKAGE_NAME.equals(packageName)) - return true; - } - } - return context.checkCallingPermission("org.mgoogle.gms.EXTENDED_ACCESS") == PackageManager.PERMISSION_GRANTED; -======= - public static boolean callerHasGooglePackagePermission(Context context, GooglePackagePermission permission) { - for (String packageCandidate : getCallingPackageCandidates(context)) { - if (new ExtendedPackageInfo(context, packageCandidate).hasGooglePackagePermission(permission)) { - return true; - } - } - - // TODO: Replace with explicit permission instead of generic "extended access" - if (callerHasExtendedAccessPermission(context)) return true; - - return false; ->>>>>>> a9906e52 (Rework known google package system):play-services-base/core/src/main/java/org/microg/gms/common/PackageUtils.java - } - - public static void checkPackageUid(Context context, String packageName, int callingUid) { - getAndCheckPackage(context, packageName, callingUid, 0); - } - - /** - * @deprecated We should stop using SHA-1 for certificate fingerprints! - */ - @Deprecated - @Nullable - public static String firstSignatureDigest(Context context, String packageName) { - return firstSignatureDigest(context.getPackageManager(), packageName); - } - - /** - * @deprecated We should stop using SHA-1 for certificate fingerprints! - */ - @Deprecated - @Nullable - public static String firstSignatureDigest(PackageManager packageManager, String packageName) { - if (packageName.equals("com.google.android.apps.youtube.music") || packageName.contains("youtube.music")) { - return "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"; - } - if (packageName.equals("com.google.android.apps.youtube.unplugged") || packageName.contains("youtube.unplugged")) { - return "3a82b5ee26bc46bf68113d920e610cd090198d4a"; - } - if (packageName.equals("com.google.android.youtube.tv") || packageName.contains("youtube.tv")) { - return "61226bdb57cc32c8a2a9ef71f7bc9548e95dcc0b"; - } - if (packageName.equals("com.google.android.youtube") || packageName.contains("youtube")) { - return "24bb24c05e47e0aefa68a58a766179d9b613a600"; - } - final PackageInfo info; - try { - info = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES); - } catch (PackageManager.NameNotFoundException e) { - return null; - } - if (info != null && info.signatures != null && info.signatures.length > 0) { - for (Signature sig : info.signatures) { - String digest = sha1sum(sig.toByteArray()); - if (digest != null) { - // spoof or use real one - return PackageSpoofUtils.spoofStringSignature(packageManager, packageName, digest); - } - } - } - return null; - } - - /** - * @deprecated We should stop using SHA-1 for certificate fingerprints! - */ - @Deprecated - @Nullable - public static byte[] firstSignatureDigestBytes(Context context, String packageName) { - return firstSignatureDigestBytes(context.getPackageManager(), packageName); - } - - /** - * @deprecated We should stop using SHA-1 for certificate fingerprints! - */ - @Deprecated - @Nullable - public static byte[] firstSignatureDigestBytes(PackageManager packageManager, String packageName) { - final PackageInfo info; - try { - info = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES); - } catch (PackageManager.NameNotFoundException e) { - return null; - } - if (info != null && info.signatures != null && info.signatures.length > 0) { - for (Signature sig : info.signatures) { - byte[] digest = sha1bytes(sig.toByteArray()); - if (digest != null) { - // spoof or use real one - return PackageSpoofUtils.spoofBytesSignature(packageManager, packageName, digest); - } - } - } - return null; - } - - @Nullable - public static String getCallingPackage(Context context) { - int callingUid = Binder.getCallingUid(), callingPid = Binder.getCallingPid(); - String packageName = packageFromProcessId(context, callingPid); - if (packageName == null) { - packageName = firstPackageFromUserId(context, callingUid); - } - - // spoof or use real one - return PackageSpoofUtils.spoofPackageName(context.getPackageManager(), packageName); - } - - public static byte[] sha1bytes(byte[] bytes) { - MessageDigest md; - try { - md = MessageDigest.getInstance("SHA1"); - } catch (final NoSuchAlgorithmException e) { - return null; - } - if (md != null) { - return md.digest(bytes); - } - return null; - } - - public static String[] getCallingPackageCandidates(Context context) { - int callingUid = Binder.getCallingUid(), callingPid = Binder.getCallingPid(); - String packageName = packageFromProcessId(context, callingPid); - if (packageName != null) return new String[]{packageName}; - String[] candidates = context.getPackageManager().getPackagesForUid(callingUid); - if (candidates == null) return new String[0]; - return candidates; - } - - @Nullable - public static String getAndCheckCallingPackage(Context context, String suggestedPackageName) { - return getAndCheckCallingPackage(context, suggestedPackageName, 0); - } - - @Nullable - public static String getAndCheckCallingPackageOrImpersonation(Context context, String suggestedPackageName) { - try { - return getAndCheckCallingPackage(context, suggestedPackageName, 0); - } catch (Exception e) { - if (callerHasGooglePackagePermission(context, GooglePackagePermission.IMPERSONATE)) { - return suggestedPackageName; - } - throw e; - } - } - - @Nullable - public static String getAndCheckCallingPackage(Context context, int suggestedCallerUid) { - return getAndCheckCallingPackage(context, null, suggestedCallerUid); - } - - @Nullable - public static String getAndCheckCallingPackage(Context context, String suggestedPackageName, int suggestedCallerUid) { - return getAndCheckCallingPackage(context, suggestedPackageName, suggestedCallerUid, 0); - } - - @Nullable - public static String getAndCheckCallingPackage(Context context, String suggestedPackageName, int suggestedCallerUid, int suggestedCallerPid) { - int callingUid = Binder.getCallingUid(), callingPid = Binder.getCallingPid(); - if (suggestedCallerUid > 0 && suggestedCallerUid != callingUid) { - throw new SecurityException("suggested UID [" + suggestedCallerUid + "] and real calling UID [" + callingUid + "] mismatch!"); - } - if (suggestedCallerPid > 0 && suggestedCallerPid != callingPid) { - throw new SecurityException("suggested PID [" + suggestedCallerPid + "] and real calling PID [" + callingPid + "] mismatch!"); - } - return getAndCheckPackage(context, suggestedPackageName, callingUid, Binder.getCallingPid()); - } - - @Nullable - public static String getAndCheckPackage(Context context, String suggestedPackageName, int callingUid) { - return getAndCheckPackage(context, suggestedPackageName, callingUid, 0); - } - - @Nullable - public static String getAndCheckPackage(Context context, String suggestedPackageName, int callingUid, int callingPid) { - String packageName = packageFromProcessId(context, callingPid); - if (packageName == null) { - String[] packagesForUid = context.getPackageManager().getPackagesForUid(callingUid); - if (packagesForUid != null && packagesForUid.length != 0) { - if (packagesForUid.length == 1) { - packageName = packagesForUid[0]; - } else if (Arrays.asList(packagesForUid).contains(suggestedPackageName)) { - packageName = suggestedPackageName; - } else { - packageName = packagesForUid[0]; - } - } - } - if (packageName != null && suggestedPackageName != null && !packageName.equals(suggestedPackageName)) { - throw new SecurityException("UID [" + callingUid + "] is not related to packageName [" + suggestedPackageName + "] (seems to be " + packageName + ")"); - } - - // spoof or use real one - return PackageSpoofUtils.spoofPackageName(context.getPackageManager(), packageName); - } - - @Nullable - @Deprecated - public static String packageFromProcessId(Context context, int pid) { - ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); - if (manager == null) return null; - if (pid <= 0) return null; - List runningAppProcesses = manager.getRunningAppProcesses(); - if (runningAppProcesses != null) { - for (ActivityManager.RunningAppProcessInfo processInfo : runningAppProcesses) { - if (processInfo.pid == pid && processInfo.pkgList.length == 1) { - return processInfo.pkgList[0]; - } - } - } - return null; - } - - @Nullable - public static String firstPackageFromUserId(Context context, int uid) { - String[] packagesForUid = context.getPackageManager().getPackagesForUid(uid); - if (packagesForUid != null && packagesForUid.length != 0) { - return packagesForUid[0]; - } - return null; - } - - @SuppressWarnings("deprecation") - public static String packageFromPendingIntent(PendingIntent pi) { - if (pi == null) return null; - return pi.getCreatorPackage(); - } - - public static String getProcessName() { - if (android.os.Build.VERSION.SDK_INT >= 28) - return Application.getProcessName(); - try { - Class activityThread = Class.forName("android.app.ActivityThread"); - String methodName = "currentProcessName"; - Method getProcessName = activityThread.getDeclaredMethod(methodName); - return (String) getProcessName.invoke(null); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static boolean isPersistentProcess() { - String processName = getProcessName(); - if (processName == null) { - Log.w("GmsPackageUtils", "Can't determine process name of current process"); - return false; - } - return processName.endsWith(":persistent"); - } - - public static boolean isMainProcess(Context context) { - String processName = getProcessName(); - if (processName == null) { - Log.w("GmsPackageUtils", "Can't determine process name of current process"); - return false; - } - return processName.equals(context.getPackageName()); - } - - public static void warnIfNotPersistentProcess(Class clazz) { - if (!isPersistentProcess()) { - Log.w("GmsPackageUtils", clazz.getSimpleName() + " initialized outside persistent process", new RuntimeException()); - } - } - - public static void warnIfNotMainProcess(Context context, Class clazz) { - if (!isMainProcess(context)) { - Log.w("GmsPackageUtils", clazz.getSimpleName() + " initialized outside main process", new RuntimeException()); - } - } - - /** - * @deprecated We should stop using SHA-1 for certificate fingerprints! - */ - @Deprecated - public static String sha1sum(byte[] bytes) { - MessageDigest md; - try { - md = MessageDigest.getInstance("SHA1"); - } catch (final NoSuchAlgorithmException e) { - return null; - } - if (md != null) { - bytes = md.digest(bytes); - if (bytes != null) { - StringBuilder sb = new StringBuilder(2 * bytes.length); - for (byte b : bytes) { - sb.append(String.format("%02x", b)); - } - return sb.toString(); - } - } - return null; - } - -<<<<<<< HEAD:play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java -======= - /** - * @deprecated We should stop using SHA-1 for certificate fingerprints! - */ - @Deprecated - public static byte[] sha1bytes(byte[] bytes) { - MessageDigest md; - try { - md = MessageDigest.getInstance("SHA1"); - } catch (final NoSuchAlgorithmException e) { - return null; - } - if (md != null) { - return md.digest(bytes); - } - return null; - } - - @Deprecated ->>>>>>> a9906e52 (Rework known google package system):play-services-base/core/src/main/java/org/microg/gms/common/PackageUtils.java - public static int versionCode(Context context, String packageName) { - return new ExtendedPackageInfo(context, packageName).getShortVersionCode(); - } - - @Deprecated - public static String versionName(Context context, String packageName) { - return new ExtendedPackageInfo(context, packageName).getVersionName(); - } - - @Deprecated - public static int targetSdkVersion(Context context, String packageName) { - return new ExtendedPackageInfo(context, packageName).getTargetSdkVersion(); - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/PhoneInfo.java b/play-services-base-core/src/main/java/org/microg/gms/common/PhoneInfo.java deleted file mode 100644 index 1fbc4bf9..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/PhoneInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import java.util.Random; - -public class PhoneInfo { - public String cellOperator = "26207"; - public String roaming = "mobile-notroaming"; - public String simOperator = "26207"; - public String imsi = randomImsi(); - - private String randomImsi() { - Random random = new Random(); - StringBuilder sb = new StringBuilder(simOperator); - while (sb.length() < 15) { - sb.append(random.nextInt(10)); - } - return sb.toString(); - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/RemoteListenerProxy.java b/play-services-base-core/src/main/java/org/microg/gms/common/RemoteListenerProxy.java deleted file mode 100644 index bc310c1c..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/RemoteListenerProxy.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2013-2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.content.pm.ResolveInfo; -import android.os.IBinder; -import android.os.IInterface; -import android.util.Log; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.List; - -public class RemoteListenerProxy implements ServiceConnection, InvocationHandler { - private static final String TAG = "GmsRemoteListener"; - private final Context context; - private final Intent searchIntent; - private final String bindAction; - private IBinder remote; - private boolean connecting; - private final List waiting = new ArrayList<>(); - private final Class tClass; - - public static T get(Context context, Intent intent, Class tClass, String bindAction) { - return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass}, - new RemoteListenerProxy<>(context, intent, tClass, bindAction)); - } - - private RemoteListenerProxy(Context context, Intent intent, Class tClass, String bindAction) { - this.context = context; - this.searchIntent = intent; - this.tClass = tClass; - this.bindAction = bindAction; - } - - private boolean connect() { - synchronized (this) { - if (!connecting) { - try { - ResolveInfo resolveInfo = context.getPackageManager().resolveService(searchIntent, 0); - if (resolveInfo != null) { - Intent intent = new Intent(bindAction); - intent.setPackage(resolveInfo.serviceInfo.packageName); - intent.setClassName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); - connecting = context.bindService(intent, this, Context.BIND_AUTO_CREATE); - if (!connecting) Log.d(TAG, "Could not connect to: " + intent); - return connecting; - } - return false; - } catch (Exception e) { - Log.w(TAG, e); - } - } - return true; - } - } - - private void runOncePossible(Runnable runnable) { - synchronized (this) { - if (remote == null) { - waiting.add(runnable); - } else { - runnable.run(); - } - } - } - - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - synchronized (this) { - remote = service; - if (!waiting.isEmpty()) { - try { - for (Runnable runnable : waiting) { - runnable.run(); - } - } catch (Exception e) { - } - waiting.clear(); - try { - context.unbindService(RemoteListenerProxy.this); - } catch (Exception e) { - } - connecting = false; - remote = null; - } - } - } - - @Override - public void onServiceDisconnected(ComponentName name) { - synchronized (this) { - remote = null; - } - } - - @Override - public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { - if (method.getDeclaringClass().equals(tClass)) { - runOncePossible(() -> { - try { - Object asInterface = Class.forName(tClass.getName() + "$Stub").getMethod("asInterface", IBinder.class).invoke(null, remote); - method.invoke(asInterface, args); - } catch (Exception e) { - Log.w(TAG, e); - } - }); - connect(); - return null; - } else if (method.getDeclaringClass().equals(Object.class)) { - return method.invoke(this, args); - } - return null; - } -} diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/Utils.java b/play-services-base-core/src/main/java/org/microg/gms/common/Utils.java deleted file mode 100644 index 1aa984a2..00000000 --- a/play-services-base-core/src/main/java/org/microg/gms/common/Utils.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import static android.content.pm.PackageManager.PERMISSION_GRANTED; - -import android.content.Context; -import android.util.Log; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Locale; - -public class Utils { - - public static Locale getLocale(Context context) { - return Locale.getDefault(); // TODO - } - - public static DeviceIdentifier getDeviceIdentifier(Context context) { - return new DeviceIdentifier(); - } - - public static PhoneInfo getPhoneInfo(Context context) { - return new PhoneInfo(); - } - - public static boolean hasSelfPermissionOrNotify(Context context, String permission) { - if (context.checkCallingOrSelfPermission(permission) != PERMISSION_GRANTED) { - Log.w("GmsUtils", "Lacking permission to " + permission + " for pid:" + android.os.Process.myPid() + " uid:" + android.os.Process.myUid()); - try { - //TODO: Toast.makeText(context, context.getString(R.string.lacking_permission_toast, permission), Toast.LENGTH_SHORT).show(); - } catch (RuntimeException e) { - } - return false; - } - return true; - } - - public static byte[] readStreamToEnd(final InputStream is) throws IOException { - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - if (is != null) { - final byte[] buff = new byte[1024]; - int read; - do { - bos.write(buff, 0, (read = is.read(buff)) < 0 ? 0 : read); - } while (read >= 0); - is.close(); - } - return bos.toByteArray(); - } -} diff --git a/play-services-base-core/src/main/kotlin/org/microg/gms/common/PackageSpoofUtils.kt b/play-services-base-core/src/main/kotlin/org/microg/gms/common/PackageSpoofUtils.kt deleted file mode 100644 index 94ec088d..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/gms/common/PackageSpoofUtils.kt +++ /dev/null @@ -1,155 +0,0 @@ -package org.microg.gms.common - -import android.content.pm.PackageManager -import android.os.Bundle -import android.util.Log - -/** - * utilities to spoof package information - */ -internal object PackageSpoofUtils { - private const val TAG = "SpoofUtils" - private const val META_SPOOF_PACKAGE_NAME = - "com.mgoogle.android.gms.SPOOFED_PACKAGE_NAME" - private const val META_SPOOF_PACKAGE_SIGNATURE = - "com.mgoogle.android.gms.SPOOFED_PACKAGE_SIGNATURE" - - private val spoofedPackageNameCache = HashMap() - private val spoofedPackageSignatureCache = HashMap() - - /** - * spoof the package name of a package, if a spoofed name is set - * - * @param packageManager manager used to get package information - * @param realPackageName the real package name - * @return either the spoofed or the real package name, depending on if the package requested spoofing - */ - @JvmStatic - fun spoofPackageName( - packageManager: PackageManager, - realPackageName: String? - ): String? { - if (realPackageName.isNullOrEmpty()) return realPackageName - - val spoofedPackageName = getSpoofedPackageName(packageManager, realPackageName) - return if (!spoofedPackageName.isNullOrEmpty()) { - Log.i(TAG, "package name of $realPackageName spoofed to $spoofedPackageName") - spoofedPackageName - } else realPackageName - } - - /** - * spoof the signature of a package, if a spoofed name is set - * - * @param packageManager manager used to get package information - * @param packageName name of the package to check - * @param realSignature the real package signature - * @return either the spoofed or the real signature, depending on if the package requested spoofing - */ - @JvmStatic - @JvmName("spoofStringSignature") - fun spoofSignature( - packageManager: PackageManager, - packageName: String, - realSignature: String? - ): String? { - val spoofedSignature = getSpoofedSignature(packageManager, packageName) - return if (!spoofedSignature.isNullOrEmpty()) { - Log.i(TAG, "package signature of $packageName spoofed to $spoofedSignature") - spoofedSignature - } else realSignature - } - - /** - * spoof the signature of a package, if a spoofed name is set - * - * @param packageManager manager used to get package information - * @param packageName name of the package to check - * @param realSignature the real package signature - * @return either the spoofed or the real signature, depending on if the package requested spoofing - */ - @JvmStatic - @JvmName("spoofBytesSignature") - fun spoofSignature( - packageManager: PackageManager, - packageName: String, - realSignature: ByteArray? - ): ByteArray? { - val spoofedSignatureString = getSpoofedSignature(packageManager, packageName) - return if (!spoofedSignatureString.isNullOrEmpty()) { - Log.i(TAG, "package signature of $packageName spoofed to $spoofedSignatureString") - - // convert hex string to bytes - spoofedSignatureString.chunked(2) - .map { it.toInt(16).toByte() } - .toByteArray() - } else realSignature - } - - /** - * get the spoofed package name for a package - * - * @param packageManager manager used to get package information - * @param packageName name of the package to get spoofed name of - * @return spoofed name string, or null if none set - */ - private fun getSpoofedPackageName( - packageManager: PackageManager, - packageName: String - ): String? { - return spoofedPackageNameCache[packageName] ?: run { - // fetch value - val meta = getPackageMetadata(packageManager, packageName) - val spoofedPackageName = meta?.getString(META_SPOOF_PACKAGE_NAME) - if (spoofedPackageName != null) { - spoofedPackageNameCache[packageName] = spoofedPackageName - } - - spoofedPackageName - } - } - - /** - * get the spoofed package signature for a package - * - * @param packageManager manager used to get package information - * @param packageName name of the package to get spoofed signature of - * @return spoofed signature string, or null if none set - */ - private fun getSpoofedSignature( - packageManager: PackageManager, - packageName: String - ): String? { - return spoofedPackageSignatureCache[packageName] ?: run { - // fetch value - val meta = getPackageMetadata(packageManager, packageName) - val spoofedSignature = meta?.getString(META_SPOOF_PACKAGE_SIGNATURE) - if (spoofedSignature != null) { - spoofedPackageSignatureCache[packageName] = spoofedSignature - } - - spoofedSignature - } - } - - /** - * get package metadata - * - * @param packageManager manager used to get package information - * @param packageName name of the package to get metadata of - * @return package metadata bundle - */ - private fun getPackageMetadata(packageManager: PackageManager, packageName: String): Bundle? { - return try { - // PackageManager.getPackageInfo() has been deprecated in targetSdkVersion 30+ - // To solve this, add the QUERY_ALL_PACKAGES permission to AndroidManifest.xml - packageManager - .getPackageInfo(packageName, PackageManager.GET_META_DATA) - ?.applicationInfo - ?.metaData - } catch (e: PackageManager.NameNotFoundException) { - Log.e(TAG, "failed to get application metadata for $packageName", e) - null - } - } -} diff --git a/play-services-base-core/src/main/kotlin/org/microg/gms/profile/Build.kt b/play-services-base-core/src/main/kotlin/org/microg/gms/profile/Build.kt deleted file mode 100644 index c0398c2b..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/gms/profile/Build.kt +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.profile - -object Build { - @JvmField - var BOARD: String? = null - - @JvmField - var BOOTLOADER: String? = null - - @JvmField - var BRAND: String? = null - - @JvmField - var CPU_ABI: String? = null - - @JvmField - var CPU_ABI2: String? = null - - @JvmField - var SUPPORTED_ABIS: Array = emptyArray() - - @JvmField - var DEVICE: String? = null - - @JvmField - var DISPLAY: String? = null - - @JvmField - var FINGERPRINT: String? = null - - @JvmField - var HARDWARE: String? = null - - @JvmField - var HOST: String? = null - - @JvmField - var ID: String? = null - - @JvmField - var MANUFACTURER: String? = null - - @JvmField - var MODEL: String? = null - - @JvmField - var PRODUCT: String? = null - - @JvmField - var RADIO: String? = null - - @JvmField - var SERIAL: String? = null - - @JvmField - var TAGS: String? = null - - @JvmField - var TIME: Long = 0L - - @JvmField - var TYPE: String? = null - - @JvmField - var USER: String? = null - - object VERSION { - @JvmField - var CODENAME: String? = null - - @JvmField - var INCREMENTAL: String? = null - - @JvmField - var RELEASE: String? = null - - @JvmField - var SDK: String? = null - - @JvmField - var SDK_INT: Int = 0 - - @JvmField - var SECURITY_PATCH: String? = null - } - - fun generateWebViewUserAgentString(original: String): String { - if (!original.startsWith("Mozilla/5.0 (")) return original - val closeParen: Int = original.indexOf(')') - - return "Mozilla/5.0 (Linux; Android ${VERSION.RELEASE}; $MODEL Build/$ID; wv)${original.substring(closeParen + 1)}" - } -} diff --git a/play-services-base-core/src/main/kotlin/org/microg/gms/profile/ProfileManager.kt b/play-services-base-core/src/main/kotlin/org/microg/gms/profile/ProfileManager.kt deleted file mode 100644 index abcdb8d1..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/gms/profile/ProfileManager.kt +++ /dev/null @@ -1,377 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.profile - -import android.annotation.SuppressLint -import android.content.Context -import android.content.pm.PackageManager -import android.content.res.XmlResourceParser -import android.net.Uri -import android.os.Bundle -import android.util.Log -import org.microg.gms.utils.FileXmlResourceParser -import org.microg.mgms.settings.SettingsContract -import org.microg.mgms.settings.SettingsContract.Profile -import org.xmlpull.v1.XmlPullParser -import java.io.File -import java.util.* -import kotlin.random.Random - -@Suppress("Warnings") -object ProfileManager { - private const val TAG = "ProfileManager" - const val META_DATA_KEY_SOURCE_PACKAGE = "org.microg.gms.profile:source-package" - const val PROFILE_REAL = "real" - const val PROFILE_AUTO = "auto" - const val PROFILE_NATIVE = "native" - const val PROFILE_USER = "user" - const val PROFILE_SYSTEM = "system" - const val PROFILE_REMOTE = "remote" - - private var activeProfile: String? = null - - private fun getUserProfileFile(context: Context): File = File(context.filesDir, "device_profile.xml") - private fun getSystemProfileFile(): File = File("/system/etc/microg_device_profile.xml") - private fun getProfileResId(context: Context, profile: String) = context.resources.getIdentifier("${context.packageName}:xml/profile_$profile".lowercase(Locale.US), null, null) - - fun getConfiguredProfile(context: Context): String = Profile.getContentUri(context)?.let { - SettingsContract.getSettings(context, - it, arrayOf(Profile.PROFILE)) { it.getString(0) } - } - ?: PROFILE_AUTO - - fun getAutoProfile(context: Context): String { - if (hasProfile(context, PROFILE_SYSTEM) && isAutoProfile(context, PROFILE_SYSTEM)) return PROFILE_SYSTEM - val profile = "${android.os.Build.PRODUCT}_${android.os.Build.VERSION.SDK_INT}" - if (hasProfile(context, profile) && isAutoProfile(context, profile)) return profile - return PROFILE_NATIVE - } - - fun hasProfile(context: Context, profile: String): Boolean = when (profile) { - PROFILE_AUTO -> hasProfile(context, getAutoProfile(context)) - PROFILE_NATIVE, PROFILE_REAL -> true - PROFILE_USER -> getUserProfileFile(context).exists() - PROFILE_SYSTEM -> getSystemProfileFile().exists() - else -> getProfileResId(context, profile) != 0 - } - - private fun getProfileXml(context: Context, profile: String): XmlResourceParser? = kotlin.runCatching { - when (profile) { - PROFILE_AUTO -> getProfileXml(context, getAutoProfile(context)) - PROFILE_NATIVE, PROFILE_REAL -> null - PROFILE_USER -> FileXmlResourceParser(getUserProfileFile(context)) - PROFILE_SYSTEM -> FileXmlResourceParser(getSystemProfileFile()) - else -> { - val profileResId = getProfileResId(context, profile) - if (profileResId == 0) return@runCatching null - context.resources.getXml(profileResId) - } - } - }.getOrNull() - - fun isAutoProfile(context: Context, profile: String): Boolean = kotlin.runCatching { - when (profile) { - PROFILE_AUTO -> false - PROFILE_REAL -> false - PROFILE_NATIVE -> true - else -> getProfileXml(context, profile)?.use { - var next = it.next() - while (next != XmlPullParser.END_DOCUMENT) { - when (next) { - XmlPullParser.START_TAG -> when (it.name) { - "profile" -> { - return@use it.getAttributeBooleanValue(null, "auto", false) - } - } - } - next = it.next() - } - } == true - } - }.getOrDefault(false) - - private fun getProfileData(context: Context, profile: String, realData: Map): Map { - try { - if (profile in listOf(PROFILE_REAL, PROFILE_NATIVE)) return realData - val profileResId = getProfileResId(context, profile) - if (profileResId == 0) return realData - val resultData = mutableMapOf() - resultData.putAll(realData) - getProfileXml(context, profile)?.use { - var next = it.next() - while (next != XmlPullParser.END_DOCUMENT) { - when (next) { - XmlPullParser.START_TAG -> when (it.name) { - "data" -> { - val key = it.getAttributeValue(null, "key") - val value = it.getAttributeValue(null, "value") - resultData[key] = value - Log.d(TAG, "Overwrite from profile: $key = $value") - } - } - } - next = it.next() - } - } - return resultData - } catch (e: Exception) { - Log.w(TAG, e) - return realData - } - } - - private fun getRemoteProfileData(context: Context, packageName: String): Map { - val data = mutableMapOf() - val cursor = context.contentResolver.query(Uri.parse("content://${packageName}.microg.profile"), null, null, null, null) - cursor?.use { - while (cursor.moveToNext()) { - data[cursor.getString(0)] = cursor.getString(1) - } - } - return data - } - - private fun getProfile(context: Context) = getConfiguredProfile(context).let { if (it != PROFILE_AUTO) it else getAutoProfile(context) } - private fun getSerialFromSettings(context: Context): String? = - Profile.getContentUri(context)?.let { - SettingsContract.getSettings(context, - it, arrayOf(Profile.SERIAL)) { it.getString(0) } - } - private fun saveSerial(context: Context, serial: String) = - Profile.getContentUri(context) - ?.let { SettingsContract.setSettings(context, it) { put(Profile.SERIAL, serial) } } - - private fun randomSerial(template: String, prefixLength: Int = (template.length / 2).coerceAtMost(6)): String { - val serial = StringBuilder() - template.forEachIndexed { index, c -> - serial.append(when { - index < prefixLength -> c - c.isDigit() -> '0' + Random.nextInt(10) - c.isLowerCase() && c <= 'f' -> 'a' + Random.nextInt(6) - c.isLowerCase() -> 'a' + Random.nextInt(26) - c.isUpperCase() && c <= 'F' -> 'A' + Random.nextInt(6) - c.isUpperCase() -> 'A' + Random.nextInt(26) - else -> c - }) - } - return serial.toString() - } - - @SuppressLint("MissingPermission") - private fun getProfileSerialTemplate(context: Context, profile: String): String { - // Native - if (profile in listOf(PROFILE_REAL, PROFILE_NATIVE)) { - var candidate = try { - if (android.os.Build.VERSION.SDK_INT >= 26) { - android.os.Build.getSerial() - } else { - android.os.Build.SERIAL - } - } catch (e: Exception) { - android.os.Build.SERIAL - } - if (candidate != android.os.Build.UNKNOWN) return candidate - } - - // From profile - try { - getProfileXml(context, profile)?.use { - var next = it.next() - while (next != XmlPullParser.END_DOCUMENT) { - when (next) { - XmlPullParser.START_TAG -> when (it.name) { - "serial" -> return it.getAttributeValue(null, "template") - } - } - next = it.next() - } - } - } catch (e: Exception) { - Log.w(TAG, e) - } - - // Fallback - return randomSerial("008741A0B2C4D6E8") - } - - @SuppressLint("MissingPermission") - fun getSerial(context: Context, profile: String = getProfile(context), local: Boolean = false): String { - if (!local) getSerialFromSettings(context)?.let { return it } - val serialTemplate = getProfileSerialTemplate(context, profile) - val serial = when { - profile == PROFILE_REAL && serialTemplate != android.os.Build.UNKNOWN -> serialTemplate - else -> randomSerial(serialTemplate) - } - if (!local) saveSerial(context, serial) - return serial - } - - private fun getRealData(): Map = mutableMapOf( - "Build.BOARD" to android.os.Build.BOARD, - "Build.BOOTLOADER" to android.os.Build.BOOTLOADER, - "Build.BRAND" to android.os.Build.BRAND, - "Build.CPU_ABI" to android.os.Build.CPU_ABI, - "Build.CPU_ABI2" to android.os.Build.CPU_ABI2, - "Build.DEVICE" to android.os.Build.DEVICE, - "Build.DISPLAY" to android.os.Build.DISPLAY, - "Build.FINGERPRINT" to android.os.Build.FINGERPRINT, - "Build.HARDWARE" to android.os.Build.HARDWARE, - "Build.HOST" to android.os.Build.HOST, - "Build.ID" to android.os.Build.ID, - "Build.MANUFACTURER" to android.os.Build.MANUFACTURER, - "Build.MODEL" to android.os.Build.MODEL, - "Build.PRODUCT" to android.os.Build.PRODUCT, - "Build.RADIO" to android.os.Build.RADIO, - "Build.SERIAL" to android.os.Build.SERIAL, - "Build.TAGS" to android.os.Build.TAGS, - "Build.TIME" to android.os.Build.TIME.toString(), - "Build.TYPE" to android.os.Build.TYPE, - "Build.USER" to android.os.Build.USER, - "Build.VERSION.CODENAME" to android.os.Build.VERSION.CODENAME, - "Build.VERSION.INCREMENTAL" to android.os.Build.VERSION.INCREMENTAL, - "Build.VERSION.RELEASE" to android.os.Build.VERSION.RELEASE, - "Build.VERSION.SDK" to android.os.Build.VERSION.SDK, - "Build.VERSION.SDK_INT" to android.os.Build.VERSION.SDK_INT.toString() - ).apply { - if (android.os.Build.VERSION.SDK_INT >= 21) { - put("Build.SUPPORTED_ABIS", android.os.Build.SUPPORTED_ABIS.joinToString(",")) - } - if (android.os.Build.VERSION.SDK_INT >= 23) { - put("Build.VERSION.SECURITY_PATCH", android.os.Build.VERSION.SECURITY_PATCH) - } - } - - private fun applyProfileData(profileData: Map) { - fun applyStringField(key: String, valueSetter: (String) -> Unit) = profileData[key]?.let { valueSetter(it) } - fun applyIntField(key: String, valueSetter: (Int) -> Unit) = profileData[key]?.toIntOrNull()?.let { valueSetter(it) } - fun applyLongField(key: String, valueSetter: (Long) -> Unit) = profileData[key]?.toLongOrNull()?.let { valueSetter(it) } - - applyStringField("Build.BOARD") { Build.BOARD = it } - applyStringField("Build.BOOTLOADER") { Build.BOOTLOADER = it } - applyStringField("Build.BRAND") { Build.BRAND = it } - applyStringField("Build.CPU_ABI") { Build.CPU_ABI = it } - applyStringField("Build.CPU_ABI2") { Build.CPU_ABI2 = it } - applyStringField("Build.DEVICE") { Build.DEVICE = it } - applyStringField("Build.DISPLAY") { Build.DISPLAY = it } - applyStringField("Build.FINGERPRINT") { Build.FINGERPRINT = it } - applyStringField("Build.HARDWARE") { Build.HARDWARE = it } - applyStringField("Build.HOST") { Build.HOST = it } - applyStringField("Build.ID") { Build.ID = it } - applyStringField("Build.MANUFACTURER") { Build.MANUFACTURER = it } - applyStringField("Build.MODEL") { Build.MODEL = it } - applyStringField("Build.PRODUCT") { Build.PRODUCT = it } - applyStringField("Build.RADIO") { Build.RADIO = it } - applyStringField("Build.SERIAL") { Build.SERIAL = it } - applyStringField("Build.TAGS") { Build.TAGS = it } - applyLongField("Build.TIME") { Build.TIME = it } - applyStringField("Build.TYPE") { Build.TYPE = it } - applyStringField("Build.USER") { Build.USER = it } - applyStringField("Build.VERSION.CODENAME") { Build.VERSION.CODENAME = it } - applyStringField("Build.VERSION.INCREMENTAL") { Build.VERSION.INCREMENTAL = it } - applyStringField("Build.VERSION.RELEASE") { Build.VERSION.RELEASE = it } - applyStringField("Build.VERSION.SDK") { Build.VERSION.SDK = it } - applyIntField("Build.VERSION.SDK_INT") { Build.VERSION.SDK_INT = it } - if (android.os.Build.VERSION.SDK_INT >= 21) { - Build.SUPPORTED_ABIS = profileData["Build.SUPPORTED_ABIS"]?.split(",")?.toTypedArray() ?: emptyArray() - } else { - Build.SUPPORTED_ABIS = emptyArray() - } - if (android.os.Build.VERSION.SDK_INT >= 23) { - Build.VERSION.SECURITY_PATCH = profileData["Build.VERSION.SECURITY_PATCH"] - } else { - Build.VERSION.SECURITY_PATCH = null - } - } - - private fun applyProfile(context: Context, profile: String, serial: String = getSerial(context, profile)) { - val profileData = getProfileData(context, profile, getRealData()) - if (Log.isLoggable(TAG, Log.VERBOSE)) { - for ((key, value) in profileData) { - Log.v(TAG, "") - } - } - applyProfileData(profileData) - Build.SERIAL = serial - Log.d(TAG, "Using Serial ${Build.SERIAL}") - activeProfile = profile - } - - private fun applyRemoteProfile(context: Context, packageName: String) { - val profileData = getRemoteProfileData(context, packageName) - if (Log.isLoggable(TAG, Log.VERBOSE)) { - for ((key, value) in profileData) { - Log.v(TAG, "") - } - } - applyProfileData(profileData) - activeProfile = PROFILE_REMOTE - } - - fun getProfileName(context: Context, profile: String): String? = getProfileName { getProfileXml(context, profile) } - - private fun getProfileName(parserCreator: () -> XmlResourceParser?): String? = parserCreator()?.use { - var next = it.next() - while (next != XmlPullParser.END_DOCUMENT) { - when (next) { - XmlPullParser.START_TAG -> when (it.name) { - "profile" -> { - return@use it.getAttributeValue(null, "name") - } - } - } - next = it.next() - } - null - } - - fun setProfile(context: Context, profile: String?) { - val changed = getProfile(context) != profile - val newProfile = profile ?: PROFILE_AUTO - val newSerial = if (changed) getSerial(context, newProfile, true) else getSerial(context) - Profile.getContentUri(context)?.let { - SettingsContract.setSettings(context, it) { - put(Profile.PROFILE, newProfile) - if (changed) put(Profile.SERIAL, newSerial) - } - } - if (changed && activeProfile != null) applyProfile(context, newProfile, newSerial) - } - - fun importUserProfile(context: Context, file: File): Boolean { - val profileName = getProfileName { FileXmlResourceParser(file) } ?: return false - try { - Log.d(TAG, "Importing user profile '$profileName'") - file.copyTo(getUserProfileFile(context)) - if (activeProfile == PROFILE_USER) applyProfile(context, PROFILE_USER) - return true - } catch (e: Exception) { - Log.w(TAG, e) - return false - } - } - - @JvmStatic - fun ensureInitialized(context: Context) { - val metaData = runCatching { context.packageManager.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA).metaData }.getOrNull() ?: Bundle.EMPTY - synchronized(this) { - try { - if (metaData.containsKey(META_DATA_KEY_SOURCE_PACKAGE)) { - if (activeProfile != PROFILE_REMOTE) { - val packageName = metaData.getString(META_DATA_KEY_SOURCE_PACKAGE)!! - applyRemoteProfile(context, packageName) - } - } else { - val profile = getProfile(context) - if (activeProfile == profile) return - applyProfile(context, profile) - } - } catch (e: Exception) { - Log.w(TAG, e) - } - Unit - } - } -} diff --git a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/BinderUtils.kt b/play-services-base-core/src/main/kotlin/org/microg/gms/utils/BinderUtils.kt deleted file mode 100644 index 79e8ff8f..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/BinderUtils.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.utils - -import android.os.Binder -import android.os.IBinder -import android.os.Parcel -import android.util.Log - -private const val TAG = "BinderUtils" - -fun IBinder.warnOnTransactionIssues(code: Int, reply: Parcel?, flags: Int, base: () -> Boolean): Boolean { - if (base.invoke()) { - if ((flags and Binder.FLAG_ONEWAY) > 0 && (reply?.dataSize() ?: 0) > 0) { - Log.w(TAG, "Method $code in $interfaceDescriptor is oneway, but returned data") - } - return true - } - Log.w(TAG, "Unknown method $code in $interfaceDescriptor, skipping") - return (flags and Binder.FLAG_ONEWAY) > 0 // Don't return false on oneway transaction to suppress warning -} diff --git a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/ExtendedPackageInfo.kt b/play-services-base-core/src/main/kotlin/org/microg/gms/utils/ExtendedPackageInfo.kt deleted file mode 100644 index af5a4b15..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/ExtendedPackageInfo.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.utils - -import android.content.Context -import android.content.pm.PackageManager -import androidx.core.content.pm.PackageInfoCompat -import org.microg.gms.common.* - -class ExtendedPackageInfo(private val packageManager: PackageManager, val packageName: String) { - constructor(context: Context, packageName: String) : this(context.packageManager, packageName) - - private val basicPackageInfo by lazy { kotlin.runCatching { packageManager.getPackageInfo(packageName, 0) }.getOrNull() } - private val basicApplicationInfo by lazy { kotlin.runCatching { packageManager.getApplicationInfo(packageName, 0) }.getOrNull() } - - val isInstalled by lazy { basicPackageInfo != null } - - val certificates by lazy { packageManager.getCertificates(packageName) } - private val certificatesHashSha1 by lazy { certificates.map { it.digest("SHA1") } } - val firstCertificateSha1 by lazy { certificatesHashSha1.firstOrNull() } - val firstCertificateSha1Hex by lazy { firstCertificateSha1?.toHexString() } - private val certificatesHashSha256 by lazy { certificates.map { it.digest("SHA-256") } } - val firstCertificateSha256 by lazy { certificatesHashSha256.firstOrNull() } - private val certificatesHashSha1Strings by lazy { certificatesHashSha1.map { it.toHexString() } } - private val certificatesHashSha256Strings by lazy { certificatesHashSha256.map { it.toHexString() } } - - val applicationLabel by lazy { packageManager.getApplicationLabel(packageName) } - - @Deprecated("version code is now a long", replaceWith = ReplaceWith("versionCode")) - val shortVersionCode by lazy { basicPackageInfo?.versionCode ?: -1 } - val versionCode by lazy { basicPackageInfo?.let { PackageInfoCompat.getLongVersionCode(it) } ?: -1 } - val versionName by lazy { basicPackageInfo?.versionName } - - val targetSdkVersion by lazy { basicApplicationInfo?.targetSdkVersion ?: -1 } - - private val packageAndCertHashes by lazy { - listOf( - certificatesHashSha1Strings.map { PackageAndCertHash(packageName, "SHA1", it) }, - certificatesHashSha256Strings.map { PackageAndCertHash(packageName, "SHA-256", it) }, - ).flatten() - } - val isGooglePackage by lazy { packageAndCertHashes.any { isGooglePackage(it) } } - val isPlatformPackage by lazy { - val platformCertificates = packageManager.getPlatformCertificates() - certificates.any { it in platformCertificates } - } - val isGoogleOrPlatformPackage by lazy { isGooglePackage || isPlatformPackage } - - private val googlePackagePermissions by lazy { packageAndCertHashes.flatMap { getGooglePackagePermissions(it) }.toSet() } - fun hasGooglePackagePermission(permission: GooglePackagePermission) = permission in googlePackagePermissions -} \ No newline at end of file diff --git a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/FileXmlResourceParser.kt b/play-services-base-core/src/main/kotlin/org/microg/gms/utils/FileXmlResourceParser.kt deleted file mode 100644 index 689d0f46..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/FileXmlResourceParser.kt +++ /dev/null @@ -1,127 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.utils - -import android.content.res.XmlResourceParser -import android.util.Xml -import org.xmlpull.v1.XmlPullParser -import java.io.Closeable -import java.io.File -import java.io.FileReader -import java.io.Reader - -class FileXmlResourceParser(private val reader: Reader, private val parser: XmlPullParser = Xml.newPullParser()) : - XmlResourceParser, - XmlPullParser by parser, - Closeable by reader { - constructor(file: File) : this(FileReader(file)) - - init { - parser.setInput(reader) - } - - override fun getAttributeNameResource(index: Int): Int { - return 0 - } - - override fun getAttributeListValue( - namespace: String?, attribute: String?, - options: Array?, defaultValue: Int - ): Int { - val s = getAttributeValue(namespace, attribute) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeBooleanValue( - namespace: String?, attribute: String?, - defaultValue: Boolean - ): Boolean { - - val s = getAttributeValue(namespace, attribute) - return s?.toBooleanStrictOrNull() ?: defaultValue - } - - override fun getAttributeResourceValue( - namespace: String?, attribute: String?, - defaultValue: Int - ): Int { - val s = getAttributeValue(namespace, attribute) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeIntValue( - namespace: String?, attribute: String?, - defaultValue: Int - ): Int { - val s = getAttributeValue(namespace, attribute) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeUnsignedIntValue( - namespace: String?, attribute: String?, - defaultValue: Int - ): Int { - val s = getAttributeValue(namespace, attribute) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeFloatValue( - namespace: String?, attribute: String?, - defaultValue: Float - ): Float { - val s = getAttributeValue(namespace, attribute) - return s?.toFloat() ?: defaultValue - } - - override fun getAttributeListValue( - index: Int, - options: Array?, defaultValue: Int - ): Int { - val s = getAttributeValue(index) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeBooleanValue(index: Int, defaultValue: Boolean): Boolean { - val s = getAttributeValue(index) - return s?.toBooleanStrictOrNull() ?: defaultValue - } - - override fun getAttributeResourceValue(index: Int, defaultValue: Int): Int { - val s = getAttributeValue(index) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeIntValue(index: Int, defaultValue: Int): Int { - val s = getAttributeValue(index) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeUnsignedIntValue(index: Int, defaultValue: Int): Int { - val s = getAttributeValue(index) - return s?.toInt() ?: defaultValue - } - - override fun getAttributeFloatValue(index: Int, defaultValue: Float): Float { - val s = getAttributeValue(index) - return s?.toFloat() ?: defaultValue - } - - override fun getIdAttribute(): String? { - return getAttributeValue(null, "id") - } - - override fun getClassAttribute(): String? { - return getAttributeValue(null, "class") - } - - override fun getIdAttributeResourceValue(defaultValue: Int): Int { - return getAttributeResourceValue(null, "id", defaultValue) - } - - override fun getStyleAttribute(): Int { - return getAttributeResourceValue(null, "style", 0) - } -} diff --git a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/SingleInstanceUtil.kt b/play-services-base-core/src/main/kotlin/org/microg/gms/utils/SingleInstanceUtil.kt deleted file mode 100644 index 0b5dc89d..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/gms/utils/SingleInstanceUtil.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.utils - -private val singleInstanceLock = Any() -private val singleInstanceMap: MutableMap, Any> = hashMapOf() - -fun singleInstanceOf(tClass: Class, tCreator: () -> T): T { - val tVolatileItem = singleInstanceMap[tClass] - @Suppress("UNCHECKED_CAST") - if (tVolatileItem != null && tClass.isAssignableFrom(tVolatileItem.javaClass)) return tVolatileItem as T - val tLock = synchronized(singleInstanceLock) { - val tItem = singleInstanceMap[tClass] - if (tItem != null) { - @Suppress("UNCHECKED_CAST") - if (tClass.isAssignableFrom(tItem.javaClass)) return tItem as T - tItem - } else { - val tLock = Any() - singleInstanceMap[tClass] = tLock - tLock - } - } - synchronized(tLock) { - val tItem = synchronized(singleInstanceMap) { singleInstanceMap[tClass] } - if (tItem == null) throw IllegalStateException() - @Suppress("UNCHECKED_CAST") - if (tClass.isAssignableFrom(tItem.javaClass)) return tItem as T - if (tItem != tLock) throw IllegalStateException() - - val tNewItem = tCreator() - synchronized(singleInstanceMap) { - singleInstanceMap[tClass] = tNewItem - } - return tNewItem - } -} - -inline fun singleInstanceOf(noinline tCreator: () -> T): T = singleInstanceOf(T::class.java, tCreator) \ No newline at end of file diff --git a/play-services-base-core/src/main/kotlin/org/microg/mgms/settings/SettingsContract.kt b/play-services-base-core/src/main/kotlin/org/microg/mgms/settings/SettingsContract.kt deleted file mode 100644 index 4f930962..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/mgms/settings/SettingsContract.kt +++ /dev/null @@ -1,125 +0,0 @@ -package org.microg.mgms.settings - -import android.content.ContentValues -import android.content.Context -import android.database.Cursor -import android.net.Uri -import android.os.Binder - -object SettingsContract { - fun getAuthority(context: Context) = "${context.packageName}.microg.settings" - fun getAuthorityUri(context: Context): Uri = Uri.parse("content://${getAuthority(context)}") - - object CheckIn { - private const val id = "check-in" - fun getContentUri(context: Context): Uri? = Uri.withAppendedPath(getAuthorityUri(context), id) - - const val ENABLED = "checkin_enable_service" - const val ANDROID_ID = "androidId" - const val DIGEST = "digest" - const val LAST_CHECK_IN = "lastCheckin" - const val SECURITY_TOKEN = "securityToken" - const val VERSION_INFO = "versionInfo" - const val DEVICE_DATA_VERSION_INFO = "deviceDataVersionInfo" - - const val BRAND_SPOOF = "brandSpoof" - - const val HIDE_LAUNCHER_ICON = "hideLauncherIcon" - - val PROJECTION = arrayOf( - ENABLED, - ANDROID_ID, - DIGEST, - LAST_CHECK_IN, - SECURITY_TOKEN, - VERSION_INFO, - DEVICE_DATA_VERSION_INFO, - BRAND_SPOOF, - HIDE_LAUNCHER_ICON, - ) - const val PREFERENCES_NAME = "checkin" - const val INITIAL_DIGEST = "1-929a0dca0eee55513280171a8585da7dcd3700f8" - } - - object Gcm { - private const val id = "gcm" - fun getContentUri(context: Context): Uri? = Uri.withAppendedPath(getAuthorityUri(context), id) - - const val FULL_LOG = "gcm_full_log" - const val LAST_PERSISTENT_ID = "gcm_last_persistent_id" - const val ENABLE_GCM = "gcm_enable_mcs_service" - - const val NETWORK_MOBILE = "gcm_network_mobile" - const val NETWORK_WIFI = "gcm_network_wifi" - const val NETWORK_ROAMING = "gcm_network_roaming" - const val NETWORK_OTHER = "gcm_network_other" - - const val LEARNT_MOBILE = "gcm_learnt_mobile" - const val LEARNT_WIFI = "gcm_learnt_wifi" - const val LEARNT_OTHER = "gcm_learnt_other" - - val PROJECTION = arrayOf( - FULL_LOG, - LAST_PERSISTENT_ID, - ENABLE_GCM, - NETWORK_MOBILE, - NETWORK_WIFI, - NETWORK_ROAMING, - NETWORK_OTHER, - LEARNT_MOBILE, - LEARNT_WIFI, - LEARNT_OTHER, - ) - } - - object Auth { - private const val id = "auth" - fun getContentUri(context: Context): Uri? = Uri.withAppendedPath(getAuthorityUri(context), id) - - const val TRUST_GOOGLE = "auth_manager_trust_google" - const val VISIBLE = "auth_manager_visible" - - val PROJECTION = arrayOf( - TRUST_GOOGLE, - VISIBLE, - ) - } - - object Profile { - private const val id = "profile" - fun getContentUri(context: Context): Uri? = Uri.withAppendedPath(getAuthorityUri(context), id) - - const val PROFILE = "device_profile" - const val SERIAL = "device_profile_serial" - - val PROJECTION = arrayOf( - PROFILE, - SERIAL - ) - } - - private fun withoutCallingIdentity(f: () -> T): T { - val identity = Binder.clearCallingIdentity() - try { - return f.invoke() - } finally { - Binder.restoreCallingIdentity(identity) - } - } - - @JvmStatic - fun getSettings(context: Context, uri: Uri, projection: Array?, f: (Cursor) -> T): T = withoutCallingIdentity { - context.contentResolver.query(uri, projection, null, null, null).use { c -> - require(c != null) { "Cursor for query $uri ${projection?.toList()} was null" } - if (!c.moveToFirst()) error("Cursor for query $uri ${projection?.toList()} was empty") - f.invoke(c) - } - } - - @JvmStatic - fun setSettings(context: Context, uri: Uri, v: ContentValues.() -> Unit) = withoutCallingIdentity { - val values = ContentValues().apply { v.invoke(this) } - val affected = context.contentResolver.update(uri, values, null, null) - require(affected == 1) { "Update for $uri with $values affected 0 rows"} - } -} diff --git a/play-services-base-core/src/main/kotlin/org/microg/mgms/settings/SettingsProvider.kt b/play-services-base-core/src/main/kotlin/org/microg/mgms/settings/SettingsProvider.kt deleted file mode 100644 index ba7e2e25..00000000 --- a/play-services-base-core/src/main/kotlin/org/microg/mgms/settings/SettingsProvider.kt +++ /dev/null @@ -1,280 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ -@file:Suppress("DEPRECATION") - -package org.microg.mgms.settings - -import android.annotation.SuppressLint -import android.content.ContentProvider -import android.content.ContentValues -import android.content.Context -import android.content.Context.MODE_PRIVATE -import android.content.SharedPreferences -import android.database.Cursor -import android.database.MatrixCursor -import android.net.Uri -import android.preference.PreferenceManager -import org.microg.gms.common.PackageUtils.warnIfNotMainProcess -import org.microg.mgms.settings.SettingsContract.Auth -import org.microg.mgms.settings.SettingsContract.CheckIn -import org.microg.mgms.settings.SettingsContract.Gcm -import org.microg.mgms.settings.SettingsContract.Profile -import org.microg.mgms.settings.SettingsContract.getAuthority -import java.io.File - -/** - * All settings access should go through this [ContentProvider], - * because it provides safe access from different processes which normal [SharedPreferences] don't. - */ -@SuppressLint("DiscouragedPrivateApi") -class SettingsProvider : ContentProvider() { - companion object { - const val INTERVAL = 1 * 60 * 1000 // 1 minute - } - - private val preferences: SharedPreferences by lazy { - PreferenceManager.getDefaultSharedPreferences(context) - } - private val checkInPrefs by lazy { - context!!.getSharedPreferences(CheckIn.PREFERENCES_NAME, MODE_PRIVATE) - } - private val systemDefaultPreferences: SharedPreferences? by lazy { - try { - Context::class.java.getDeclaredMethod( - "getSharedPreferences", - File::class.java, - Int::class.javaPrimitiveType - ).invoke(context, File("/system/etc/microg.xml"), MODE_PRIVATE) as SharedPreferences - } catch (ignored: Exception) { - null - } - } - - override fun onCreate(): Boolean { - return true - } - - override fun query( - uri: Uri, - projection: Array?, - selection: String?, - selectionArgs: Array?, - sortOrder: String? - ): Cursor? = when (uri) { - CheckIn.getContentUri(context!!) -> queryCheckIn(projection ?: CheckIn.PROJECTION) - Gcm.getContentUri(context!!) -> queryGcm(projection ?: Gcm.PROJECTION) - Auth.getContentUri(context!!) -> queryAuth(projection ?: Auth.PROJECTION) - Profile.getContentUri(context!!) -> queryProfile(projection ?: Profile.PROJECTION) - else -> null - } - - override fun update( - uri: Uri, - values: ContentValues?, - selection: String?, - selectionArgs: Array? - ): Int { - warnIfNotMainProcess(context, this.javaClass) - if (values == null) return 0 - when (uri) { - CheckIn.getContentUri(context!!) -> updateCheckIn(values) - Gcm.getContentUri(context!!) -> updateGcm(values) - Auth.getContentUri(context!!) -> updateAuth(values) - Profile.getContentUri(context!!) -> updateProfile(values) - else -> return 0 - } - return 1 - } - - private fun queryCheckIn(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - CheckIn.ENABLED -> getSettingsBoolean(key, true) - CheckIn.ANDROID_ID -> checkInPrefs.getLong(key, 0) - CheckIn.DIGEST -> checkInPrefs.getString(key, CheckIn.INITIAL_DIGEST) - ?: CheckIn.INITIAL_DIGEST - CheckIn.LAST_CHECK_IN -> checkInPrefs.getLong(key, 0) - CheckIn.SECURITY_TOKEN -> checkInPrefs.getLong(key, 0) - CheckIn.VERSION_INFO -> checkInPrefs.getString(key, "") ?: "" - CheckIn.DEVICE_DATA_VERSION_INFO -> checkInPrefs.getString(key, "") ?: "" - CheckIn.BRAND_SPOOF -> getSettingsBoolean(key, false) - CheckIn.HIDE_LAUNCHER_ICON -> getSettingsBoolean(key, false) - else -> throw IllegalArgumentException() - } - } - - private fun updateCheckIn(values: ContentValues) { - if (values.size() == 0) return - if (values.size() == 1 && values.containsKey(CheckIn.ENABLED)) { - // special case: only changing enabled state - updateCheckInEnabled(values.getAsBoolean(CheckIn.ENABLED)) - return - } - val editor = checkInPrefs.edit() - values.valueSet().forEach { (key, value) -> - if (key == CheckIn.ENABLED) { - // special case: not saved in checkInPrefs - updateCheckInEnabled(value as Boolean) - } - if (key == CheckIn.BRAND_SPOOF) { - // special case: not saved in checkInPrefs - updateSpoofingEnabled(value as Boolean) - } - if (key == CheckIn.HIDE_LAUNCHER_ICON) { - // special case: not saved in checkInPrefs - updateHideLauncherIcon(value as Boolean) - } - when (key) { - CheckIn.ANDROID_ID -> editor.putLong(key, value as Long) - CheckIn.DIGEST -> editor.putString(key, value as String?) - CheckIn.LAST_CHECK_IN -> editor.putLong(key, value as Long) - CheckIn.SECURITY_TOKEN -> editor.putLong(key, value as Long) - CheckIn.VERSION_INFO -> editor.putString(key, value as String?) - CheckIn.DEVICE_DATA_VERSION_INFO -> editor.putString(key, value as String?) - } - } - editor.apply() - } - - private fun updateCheckInEnabled(enabled: Boolean) { - preferences.edit() - .putBoolean(CheckIn.ENABLED, enabled) - .apply() - } - - private fun updateSpoofingEnabled(enabled: Boolean) { - preferences.edit() - .putBoolean(CheckIn.BRAND_SPOOF, enabled) - .apply() - } - - private fun updateHideLauncherIcon(enabled: Boolean) { - preferences.edit() - .putBoolean(CheckIn.HIDE_LAUNCHER_ICON, enabled) - .apply() - } - - private fun queryGcm(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Gcm.ENABLE_GCM -> getSettingsBoolean(key, true) - Gcm.FULL_LOG -> getSettingsBoolean(key, true) - - Gcm.LAST_PERSISTENT_ID -> preferences.getString(key, "") ?: "" - - Gcm.NETWORK_MOBILE -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - Gcm.NETWORK_WIFI -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - Gcm.NETWORK_ROAMING -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - Gcm.NETWORK_OTHER -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - - Gcm.LEARNT_MOBILE -> preferences.getInt(key, INTERVAL) - Gcm.LEARNT_WIFI -> preferences.getInt(key, INTERVAL) - Gcm.LEARNT_OTHER -> preferences.getInt(key, INTERVAL) - - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateGcm(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Gcm.ENABLE_GCM -> editor.putBoolean(key, value as Boolean) - Gcm.FULL_LOG -> editor.putBoolean(key, value as Boolean) - - Gcm.LAST_PERSISTENT_ID -> editor.putString(key, value as String?) - - Gcm.NETWORK_MOBILE -> editor.putString(key, (value as Int).toString()) - Gcm.NETWORK_WIFI -> editor.putString(key, (value as Int).toString()) - Gcm.NETWORK_ROAMING -> editor.putString(key, (value as Int).toString()) - Gcm.NETWORK_OTHER -> editor.putString(key, (value as Int).toString()) - - Gcm.LEARNT_MOBILE -> editor.putInt(key, value as Int) - Gcm.LEARNT_WIFI -> editor.putInt(key, value as Int) - Gcm.LEARNT_OTHER -> editor.putInt(key, value as Int) - - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryAuth(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Auth.TRUST_GOOGLE -> getSettingsBoolean(key, true) - Auth.VISIBLE -> getSettingsBoolean(key, false) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateAuth(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Auth.TRUST_GOOGLE -> editor.putBoolean(key, value as Boolean) - Auth.VISIBLE -> editor.putBoolean(key, value as Boolean) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryProfile(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Profile.PROFILE -> getSettingsString(key, "auto") - Profile.SERIAL -> getSettingsString(key) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateProfile(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Profile.PROFILE -> editor.putString(key, value as String?) - Profile.SERIAL -> editor.putString(key, value as String?) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun MatrixCursor.addRow( - p: Array, - valueGetter: (String) -> Any? - ): MatrixCursor { - val row = newRow() - for (key in p) row.add(valueGetter.invoke(key)) - return this - } - - override fun getType(uri: Uri): String { - return "vnd.android.cursor.item/vnd.${getAuthority(context!!)}.${uri.path}" - } - - override fun insert(uri: Uri, values: ContentValues?): Uri? { - throw UnsupportedOperationException() - } - - override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int { - throw UnsupportedOperationException() - } - - /** - * Returns the current setting of the given [key] - * using the default value from [systemDefaultPreferences] or [def] if not available. - * @return the current setting as [Int], because [ContentProvider] does not support [Boolean]. - */ - private fun getSettingsBoolean(key: String, def: Boolean): Int { - return listOf(preferences, systemDefaultPreferences).getBooleanAsInt(key, def) - } - - private fun getSettingsString(key: String, def: String? = null): String? = listOf(preferences, systemDefaultPreferences).getString(key, def) - - private fun List.getString(key: String, def: String?): String? = foldRight(def) { preferences, defValue -> preferences?.getString(key, defValue) ?: defValue } - private fun List.getBoolean(key: String, def: Boolean): Boolean = foldRight(def) { preferences, defValue -> preferences?.getBoolean(key, defValue) ?: defValue } - private fun List.getBooleanAsInt(key: String, def: Boolean): Int = if (getBoolean(key, def)) 1 else 0 -} diff --git a/play-services-base-core/src/main/res/drawable/ic_foreground_notification.xml b/play-services-base-core/src/main/res/drawable/ic_foreground_notification.xml deleted file mode 100644 index ace07f8a..00000000 --- a/play-services-base-core/src/main/res/drawable/ic_foreground_notification.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/play-services-base-core/src/main/res/values-ar/strings.xml b/play-services-base-core/src/main/res/values-ar/strings.xml deleted file mode 100644 index e6947e00..00000000 --- a/play-services-base-core/src/main/res/values-ar/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - تحذير توفير البطارية - توسيع الإشعارات - الحفاظ على microG يعمل في الخلفية - انقر هنا لتعطيل تحسين البطارية لـ vanced microG ، ثم أعد تشغيل الجهاز لإزالة هذا الإشعار - diff --git a/play-services-base-core/src/main/res/values-az/strings.xml b/play-services-base-core/src/main/res/values-az/strings.xml deleted file mode 100644 index c24e9758..00000000 --- a/play-services-base-core/src/main/res/values-az/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Batareya qənaət xəbərdarlığı - Bildirişi genişləndir - MicroG-ni arxa planda saxla - MicroG üçün batareyanın optimallaşdırılmasını deaktiv etmək üçün bura klikləyin, sonra bu bildirişi silmək üçün cihazı yenidən başladın - diff --git a/play-services-base-core/src/main/res/values-be/strings.xml b/play-services-base-core/src/main/res/values-be/strings.xml deleted file mode 100644 index d887a045..00000000 --- a/play-services-base-core/src/main/res/values-be/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Папярэджанне аб працы ў рэжыме эканоміі энергіі - Разгарнуць апавяшчэнне - Трымаць microG у фоне - Націсніце тут, каб адключыць аптымізацыю батарэі для Vanced microG, а потым перазапусціце прыладу, каб гэта паведамленне знікла - diff --git a/play-services-base-core/src/main/res/values-bn/strings.xml b/play-services-base-core/src/main/res/values-bn/strings.xml deleted file mode 100644 index 34114e10..00000000 --- a/play-services-base-core/src/main/res/values-bn/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - ব্যাটারি সংরক্ষণ সতর্কতা - বিজ্ঞপ্তি প্রসারিত করুন - microG ব্যাকগ্রাউন্ডে রাখুন - vanced microG কে ব্যাটারি অপটিমাইজেশন থেকে সরাতে এখানে ট্যাপ করুন, এরপর এই বিজ্ঞপ্তি সরাতে ফোন রিস্টার্ট করুন - diff --git a/play-services-base-core/src/main/res/values-de/strings.xml b/play-services-base-core/src/main/res/values-de/strings.xml deleted file mode 100644 index 0ff5c5e0..00000000 --- a/play-services-base-core/src/main/res/values-de/strings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - Battery Saving Warning - Expand notification - Keep microG in background - diff --git a/play-services-base-core/src/main/res/values-es-rES/strings.xml b/play-services-base-core/src/main/res/values-es-rES/strings.xml deleted file mode 100644 index 3ecced44..00000000 --- a/play-services-base-core/src/main/res/values-es-rES/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Advertencia de ahorro de batería - Expandir notificación - Mantener microG en segundo plano - Toque aquí para desactivar la optimización de la batería para vanced microG, luego reinicie el dispositivo para eliminar esta notificación - diff --git a/play-services-base-core/src/main/res/values-fr/strings.xml b/play-services-base-core/src/main/res/values-fr/strings.xml deleted file mode 100644 index 09ccaafa..00000000 --- a/play-services-base-core/src/main/res/values-fr/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Avertissement d\'économie de batterie - Élargir la notification - Garder microG en arrière-plan - Appuyez ici pour désactiver l\'optimisation de la batterie pour la microG vanced, puis redémarrez l\'appareil pour supprimer cette notification - diff --git a/play-services-base-core/src/main/res/values-he/strings.xml b/play-services-base-core/src/main/res/values-he/strings.xml deleted file mode 100644 index ea887fa9..00000000 --- a/play-services-base-core/src/main/res/values-he/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - אזהרת חיסכון בסוללה - הרחב את ההודעה - השאר את microG ברקע - הקש כאן כדי להשבית את אופטימיזציית הסוללה עבור vanced microG, ולאחר מכן הפעל מחדש את המכשיר כדי להסיר את ההתראה הזו - diff --git a/play-services-base-core/src/main/res/values-hi/strings.xml b/play-services-base-core/src/main/res/values-hi/strings.xml deleted file mode 100644 index 91551946..00000000 --- a/play-services-base-core/src/main/res/values-hi/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - बैटरी बचाने की चेतावनी - अधिसूचना का विस्तार करें - माइक्रो जी को बैकग्राउंड में रखें - वैन्ड माइक्रोजी के लिए बैटरी अनुकूलन को अक्षम करने के लिए यहां टैप करें, फिर इस अधिसूचना को हटाने के लिए डिवाइस को पुनरारंभ करें - diff --git a/play-services-base-core/src/main/res/values-hu/strings.xml b/play-services-base-core/src/main/res/values-hu/strings.xml deleted file mode 100644 index 8a6badd3..00000000 --- a/play-services-base-core/src/main/res/values-hu/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Akkumulátorkímélő figyelmeztetés - Értesítés bővítése - Tartsa a microG-t a háttérben - Koppintson ide az akkumulátor-optimalizálás letiltásához a vanced microG számára, majd indítsa újra a készüléket az értesítés eltávolításához - diff --git a/play-services-base-core/src/main/res/values-id/strings.xml b/play-services-base-core/src/main/res/values-id/strings.xml deleted file mode 100644 index 11599ce3..00000000 --- a/play-services-base-core/src/main/res/values-id/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Peringatan daya baterai - Perluas notifikasi - Izinkan microG berjalan di latar belakang - Tekan disini untuk mematikan optimasi baterai untuk vanced microG, lalu mulai ulang perangkat untuk menghapus notifikasi ini - diff --git a/play-services-base-core/src/main/res/values-it/strings.xml b/play-services-base-core/src/main/res/values-it/strings.xml deleted file mode 100644 index 420ece24..00000000 --- a/play-services-base-core/src/main/res/values-it/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Avviso Risparmio Energetico - Espandi la notifica - Mantieni i microG in secondo piano - Tocca qui per disattivare l\'ottimizzazione della batteria per microG, poi riavvia il dispositivo per rimuovere questa notifica. - diff --git a/play-services-base-core/src/main/res/values-ja/strings.xml b/play-services-base-core/src/main/res/values-ja/strings.xml deleted file mode 100644 index 97f279c1..00000000 --- a/play-services-base-core/src/main/res/values-ja/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 電池の最適化 の警告 - 通知を展開する - Vanced microGをバックグラウンドで保持 - ここをタップして、Vanced microGの[電池の最適化]を無効にし、デバイスを再起動して通知を削除してください。 - diff --git a/play-services-base-core/src/main/res/values-ko/strings.xml b/play-services-base-core/src/main/res/values-ko/strings.xml deleted file mode 100644 index 20515386..00000000 --- a/play-services-base-core/src/main/res/values-ko/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 배터리 절약 경고 - 알림 펼치기 - microG를 백그라운드에서 유지 - 여기를 탭하여 vanced microG의 배터리 최적화를 비활성화한 다음 기기를 다시 시작하여 이 알림을 제거하세요 - diff --git a/play-services-base-core/src/main/res/values-lt/strings.xml b/play-services-base-core/src/main/res/values-lt/strings.xml deleted file mode 100644 index 02dfd797..00000000 --- a/play-services-base-core/src/main/res/values-lt/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Baterijos taupymo įspėjimas - Išskleisti pranešimą - Laikyti microG fone - Bakstelėkite čia, kad išjungtumėte microG akumuliatoriaus optimizavimą, tada iš naujo paleiskite įrenginį, kad pašalintumėte šį pranešimą - diff --git a/play-services-base-core/src/main/res/values-pt-rBR/strings.xml b/play-services-base-core/src/main/res/values-pt-rBR/strings.xml deleted file mode 100644 index c0440e52..00000000 --- a/play-services-base-core/src/main/res/values-pt-rBR/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Aviso de carregamento da bateria - Expandir notificações - Manter o microG em segundo plano - Toque aqui para desativar a otimização de bateria para microG. Tancado e reinicie o dispositivo para remover esta notificação - diff --git a/play-services-base-core/src/main/res/values-ru/strings.xml b/play-services-base-core/src/main/res/values-ru/strings.xml deleted file mode 100644 index 169bde62..00000000 --- a/play-services-base-core/src/main/res/values-ru/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Предупреждение о работе в режиме энергосбережения - Развернуть уведомление - Держать microG в фоне - Нажмите здесь, чтобы отключить оптимизацию батареи для vanced microG, а затем перезапустите устройство, чтобы это уведомление пропало - diff --git a/play-services-base-core/src/main/res/values-th/strings.xml b/play-services-base-core/src/main/res/values-th/strings.xml deleted file mode 100644 index 6b918bea..00000000 --- a/play-services-base-core/src/main/res/values-th/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - คำเตือนการประหยัดแบตเตอรี่ - ขยายการแจ้งเตือน - ให้ microG ทำงานเบื้องหลัง - แตะที่นี่เพื่อปิดใช้งานการเพิ่มประสิทธิภาพแบตเตอรี่สำหรับ vanced microG จากนั้นรีสตาร์ทอุปกรณ์เพื่อลบการแจ้งเตือนนี้  - diff --git a/play-services-base-core/src/main/res/values-tr/strings.xml b/play-services-base-core/src/main/res/values-tr/strings.xml deleted file mode 100644 index 7ab0c17f..00000000 --- a/play-services-base-core/src/main/res/values-tr/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Pil tasarrufu uyarısı - Bildirimleri genişlet - MicroG arka planda çalışsın - Vanced microG için batarya optimizasyonunu devre dışı bırakmak için buraya tıklayın, daha sonra bu bildirimi silmek için cihazı yeniden başlatın - diff --git a/play-services-base-core/src/main/res/values-uk/strings.xml b/play-services-base-core/src/main/res/values-uk/strings.xml deleted file mode 100644 index 4d49f0eb..00000000 --- a/play-services-base-core/src/main/res/values-uk/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Попередження про економію батареї - Розгорнути сповіщення - Тримайте microG у фоновому режимі - Торкніться тут, щоб вимкнути оптимізацію акумулятора для vanced microG, а потім перезапустіть пристрій, щоб видалити це сповіщення - diff --git a/play-services-base-core/src/main/res/values-vi/strings.xml b/play-services-base-core/src/main/res/values-vi/strings.xml deleted file mode 100644 index 6df24ce4..00000000 --- a/play-services-base-core/src/main/res/values-vi/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Cảnh báo tối ưu hóa pin - Mở rộng thông báo - Giữ Vanced microG chạy trong nền - Nhấn vào đây để tắt tối ưu hóa pin cho Vanced microG, sau đó khởi động lại thiết bị hoặc buộc dừng ứng dụng để xóa thông báo này - diff --git a/play-services-base-core/src/main/res/values-zh-rCN/strings.xml b/play-services-base-core/src/main/res/values-zh-rCN/strings.xml deleted file mode 100644 index 3afca6ef..00000000 --- a/play-services-base-core/src/main/res/values-zh-rCN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 省电警告 - 展开通知 - 保持 microG 后台服务 - 点此关闭 vanced microG 的电池最适化,然后重启手机以移除该通知 - diff --git a/play-services-base-core/src/main/res/values-zh-rTW/strings.xml b/play-services-base-core/src/main/res/values-zh-rTW/strings.xml deleted file mode 100644 index 4e03cda1..00000000 --- a/play-services-base-core/src/main/res/values-zh-rTW/strings.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - 電池最佳化警示 - 展開完整通知 - 讓microG在背景執行 - 點擊此通知來關閉Vanced microG的電池最佳化 -關閉後重新啟動手機以移除此通知 - diff --git a/play-services-base-core/src/main/res/values/strings.xml b/play-services-base-core/src/main/res/values/strings.xml deleted file mode 100644 index 55d77535..00000000 --- a/play-services-base-core/src/main/res/values/strings.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Battery Saving Warning - Expand notification - Keep Vanced microG in background - Tap here to disable battery optimization for Vanced microG, then restart the device to remove this notification - diff --git a/play-services-base/build.gradle b/play-services-base/build.gradle deleted file mode 100644 index 7c7057d4..00000000 --- a/play-services-base/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2013-2015 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion androidBuildVersionTools - - defaultConfig { - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - namespace 'org.microg.gms.base' -} - -dependencies { - api project(':play-services-base-api') - - // Dependencies from play-services-base:18.1.0 - api "androidx.collection:collection:$collectionVersion" - api "androidx.core:core:$coreVersion" - api "androidx.fragment:fragment:$fragmentVersion" - api project(':play-services-basement') - api project(':play-services-tasks') -} \ No newline at end of file diff --git a/play-services-base/core/build.gradle b/play-services-base/core/build.gradle deleted file mode 100644 index 96ace60a..00000000 --- a/play-services-base/core/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'maven-publish' -apply plugin: 'signing' - -dependencies { - api project(':play-services-basement-ktx') - - implementation "androidx.annotation:annotation:$annotationVersion" - implementation "androidx.appcompat:appcompat:$appcompatVersion" - implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion" - implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion" - implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion" - implementation "androidx.preference:preference-ktx:$preferenceVersion" - - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" -} - -android { - namespace "org.microg.gms.base.core" - - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - buildFeatures { - dataBinding = true - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } - - kotlinOptions { - jvmTarget = 1.8 - } - - lintOptions { - disable 'MissingTranslation' - } -} - -apply from: '../../gradle/publish-android.gradle' - -description = 'microG service implementation for play-services-base' diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/common/KnownGooglePackages.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/common/KnownGooglePackages.kt deleted file mode 100644 index e0a644d7..00000000 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/common/KnownGooglePackages.kt +++ /dev/null @@ -1,198 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.common - -import com.google.android.gms.common.internal.CertData -import org.microg.gms.common.GooglePackagePermission.* -import org.microg.gms.utils.digest -import org.microg.gms.utils.toHexString - -enum class GooglePackagePermission { - ACCOUNT, // Find accounts - AD_ID, // Advertising ID - APP_CERT, // Receive certificate confirming valid app installation (incl. Spatula) - AUTH, // Sign in to Google account without user interface confirmation - CREDENTIALS, // Access to credentials - GAMES, // Google Play Games first party access - IMPERSONATE, // Allow to act as another package - OWNER, // Details about own accounts (name, email, photo) - PEOPLE, // Details about contacts - REPORTING, // Access reporting service - SAFETYNET, // Access SafetyNet UUID -} - -// These are SHA-256 hashes of the Google privileged signing certificates -private val KNOWN_GOOGLE_PRIVILEGED_CERT_HASHES = listOf( - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - "7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053", -) - -// These are the permissions that we grant to apps signed with a Google -// privileged platform signing certificate. Those could be in the same -// shared UID on regular Play Services and thus have full access by -// design, as they could even directly access all private details in GMS. -private val PERMISSIONS_PRIVILEGED = GooglePackagePermission.entries.toSet() - -// These are SHA-256 hashes of signing certificates used by official Google apps -// Signing certificates that are only used for a small number of apps are likely not -// official Google apps, but either acquisitions or independent teams / projects -// within Google. We don't put them here, but via KNOWN_GOOGLE_PACKAGES. -private val KNOWN_GOOGLE_APP_CERT_HASHES = listOf( - "3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a" -) - -// This is a subset of permissions that we grant to apps signed with an official -// Google apps certificate. Note that this has lower priority than the -// KNOWN_GOOGLE_PACKAGES list, so if any app needs more permissions than this, -// this can be handled through KNOWN_GOOGLE_PACKAGES. -private val PERMISSIONS_APP = setOf(ACCOUNT, APP_CERT, AUTH, OWNER, PEOPLE, REPORTING, SAFETYNET) - -private const val SHA1 = "SHA1" -private const val SHA256 = "SHA-256" - -data class PackageAndCertHash(val packageName: String, val algorithm: String, val certHash: String) - -private val KNOWN_GOOGLE_PACKAGES = mapOf( - // Legacy set - // These include all previously KNOWN_GOOGLE_PACKAGES and grant them all google package permissions - // Those should be replaced by new entries that - // - use SHA-256 instead of SHA-1 - // - has more accurate permission set (in most cases, ACCOUNT+AUTH+OWNER is sufficient) - Pair( - PackageAndCertHash("com.google.android.apps.classroom", SHA1, "46f6c8987311e131f4f558d8e0ae145bebab6da3"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.inbox", SHA1, "aa87ce1260c008d801197bb4ecea4ab8929da246"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.playconsole", SHA1, "d6c35e55b481aefddd74152ca7254332739a81d6"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.travel.onthego", SHA1, "0cbe08032217d45e61c0bc72f294395ee9ecb5d5"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.tycho", SHA1, "01b844184e360686aa98b48eb16e05c76d4a72ad"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.contacts", SHA1, "ee3e2b5d95365c5a1ccc2d8dfe48d94eb33b3ebe"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.wearable.app", SHA1, "a197f9212f2fed64f0ff9c2a4edf24b9c8801c8c"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.youtube.music", SHA1, "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.vr.home", SHA1, "fc1edc68f7e3e4963c998e95fc38f3de8d1bfc96"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.vr.cyclops", SHA1, "188c5ca3863fa121216157a5baa80755ceda70ab"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.waze", SHA1, "35b438fe1bc69d975dc8702dc16ab69ebf65f26f"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.wellbeing", SHA1, "4ebdd02380f1fa0b6741491f0af35625dba76e9f"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.village.boond", SHA1, "48e7985b8f901df335b5d5223579c81618431c7b"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.subscriptions.red", SHA1, "de8304ace744ae4c4e05887a27a790815e610ff0"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.meetings", SHA1, "47a6936b733dbdb45d71997fbe1d610eca36b8bf"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.nbu.paisa.user", SHA1, "80df78bb700f9172bc671779b017ddefefcbf552"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.dynamite", SHA1, "519c5a17a60596e6fe5933b9cb4285e7b0e5eb7b"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.projection.gearhead", SHA1, "9ca91f9e704d630ef67a23f52bf1577a92b9ca5d"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.stadia.android", SHA1, "133aad3b3d3b580e286573c37f20549f9d3d1cce"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.kids.familylink", SHA1, "88652b8464743e5ce80da0d4b890d13f9b1873df"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.walletnfcrel", SHA1, "82759e2db43f9ccbafce313bc674f35748fabd7a"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.recorder", SHA1, "394d84cd2cf89d3453702c663f98ec6554afc3cd"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.messaging", SHA1, "0980a12be993528c19107bc21ad811478c63cefc"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.tachyon", SHA1, "a0bc09af527b6397c7a9ef171d6cf76f757becc3"), - PERMISSIONS_PRIVILEGED - ), - Pair( - PackageAndCertHash("com.google.android.apps.access.wifi.consumer", SHA1,"d850379540d68fbec82a742ab6a8321a3f9a4c7c"), - PERMISSIONS_PRIVILEGED - ), - - // Google Jamboard - Pair( - PackageAndCertHash("com.google.android.apps.jam", SHA256, "9db7ff389ab6a30d5f5c92a8629ff0baa93fa8430f0503c04d72640a1cf323f5"), - setOf(ACCOUNT, AUTH, OWNER) - ), - - // Fitbit - Pair( - PackageAndCertHash("com.fitbit.FitbitMobile", SHA256, "fa6a198803aac1939fed6bab9295e5184c00966bf912f8c5faff26576cc770ff"), - setOf(ACCOUNT, AUTH, OWNER) - ), - - // Google Tasks - Pair( - PackageAndCertHash("com.google.android.apps.tasks", SHA256, "99f6cc5308e6f3318a3bf168bf106d5b5defe2b4b9c561e5ddd7924a7a2ba1e2"), - setOf(ACCOUNT, AUTH, OWNER) - ), -) - -fun isGooglePackage(pkg: PackageAndCertHash): Boolean { - if (pkg.algorithm == SHA256 && pkg.certHash in KNOWN_GOOGLE_PRIVILEGED_CERT_HASHES) return true - if (pkg.algorithm == SHA256 && pkg.certHash in KNOWN_GOOGLE_APP_CERT_HASHES) return true - return KNOWN_GOOGLE_PACKAGES.containsKey(pkg) -} -fun getGooglePackagePermissions(pkg: PackageAndCertHash): Set { - if (KNOWN_GOOGLE_PACKAGES.containsKey(pkg)) return KNOWN_GOOGLE_PACKAGES[pkg].orEmpty() - if (pkg.algorithm == SHA256 && pkg.certHash in KNOWN_GOOGLE_PRIVILEGED_CERT_HASHES) return PERMISSIONS_PRIVILEGED - if (pkg.algorithm == SHA256 && pkg.certHash in KNOWN_GOOGLE_APP_CERT_HASHES) return PERMISSIONS_APP - return emptySet() -} -fun hasGooglePackagePermission(pkg: PackageAndCertHash, permission: GooglePackagePermission) = getGooglePackagePermissions(pkg).contains(permission) - -fun isGooglePackage(packageName: String, certificate: CertData): Boolean = - listOf(SHA1, SHA256).any { isGooglePackage(PackageAndCertHash(packageName, it, certificate.digest(it).toHexString())) } \ No newline at end of file diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt deleted file mode 100644 index 9791f4f0..00000000 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt +++ /dev/null @@ -1,225 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.settings - -import android.content.ContentValues -import android.content.Context -import android.content.pm.PackageManager -import android.database.Cursor -import android.net.Uri -import android.os.Binder -import android.os.Bundle - -object SettingsContract { - const val META_DATA_KEY_SOURCE_PACKAGE = "org.microg.gms.settings:source-package" - fun getAuthority(context: Context): String { - val metaData = runCatching { context.packageManager.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA).metaData }.getOrNull() ?: Bundle.EMPTY - val sourcePackage = metaData.getString(META_DATA_KEY_SOURCE_PACKAGE, context.packageName) - return "${sourcePackage}.microg.settings" - } - fun getAuthorityUri(context: Context): Uri = Uri.parse("content://${getAuthority(context)}") - - object CheckIn { - private const val id = "check-in" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val ENABLED = "checkin_enable_service" - const val ANDROID_ID = "androidId" - const val DIGEST = "digest" - const val LAST_CHECK_IN = "lastCheckin" - const val SECURITY_TOKEN = "securityToken" - const val VERSION_INFO = "versionInfo" - const val DEVICE_DATA_VERSION_INFO = "deviceDataVersionInfo" - - val PROJECTION = arrayOf( - ENABLED, - ANDROID_ID, - DIGEST, - LAST_CHECK_IN, - SECURITY_TOKEN, - VERSION_INFO, - DEVICE_DATA_VERSION_INFO, - ) - const val PREFERENCES_NAME = "checkin" - const val INITIAL_DIGEST = "1-929a0dca0eee55513280171a8585da7dcd3700f8" - } - - object Gcm { - private const val id = "gcm" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val FULL_LOG = "gcm_full_log" - const val LAST_PERSISTENT_ID = "gcm_last_persistent_id" - const val CONFIRM_NEW_APPS = "gcm_confirm_new_apps" - const val ENABLE_GCM = "gcm_enable_mcs_service" - - const val NETWORK_MOBILE = "gcm_network_mobile" - const val NETWORK_WIFI = "gcm_network_wifi" - const val NETWORK_ROAMING = "gcm_network_roaming" - const val NETWORK_OTHER = "gcm_network_other" - - const val LEARNT_MOBILE = "gcm_learnt_mobile" - const val LEARNT_WIFI = "gcm_learnt_wifi" - const val LEARNT_OTHER = "gcm_learnt_other" - - val PROJECTION = arrayOf( - FULL_LOG, - LAST_PERSISTENT_ID, - CONFIRM_NEW_APPS, - ENABLE_GCM, - NETWORK_MOBILE, - NETWORK_WIFI, - NETWORK_ROAMING, - NETWORK_OTHER, - LEARNT_MOBILE, - LEARNT_WIFI, - LEARNT_OTHER, - ) - } - - object Auth { - private const val id = "auth" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val TRUST_GOOGLE = "auth_manager_trust_google" - const val VISIBLE = "auth_manager_visible" - const val INCLUDE_ANDROID_ID = "auth_include_android_id" - const val STRIP_DEVICE_NAME = "auth_strip_device_name" - - val PROJECTION = arrayOf( - TRUST_GOOGLE, - VISIBLE, - INCLUDE_ANDROID_ID, - STRIP_DEVICE_NAME, - ) - } - - object Exposure { - private const val id = "exposureNotification" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val SCANNER_ENABLED = "exposure_scanner_enabled" - const val LAST_CLEANUP = "exposure_last_cleanup" - - val PROJECTION = arrayOf( - SCANNER_ENABLED, - LAST_CLEANUP, - ) - } - - object SafetyNet { - private const val id = "safety-net" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val ENABLED = "safetynet_enabled" - - val PROJECTION = arrayOf( - ENABLED - ) - } - - object DroidGuard { - private const val id = "droidguard" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val ENABLED = "droidguard_enabled" - const val MODE = "droidguard_mode" - const val NETWORK_SERVER_URL = "droidguard_network_server_url" - const val FORCE_LOCAL_DISABLED = "droidguard_force_local_disabled" - - val PROJECTION = arrayOf( - ENABLED, - MODE, - NETWORK_SERVER_URL, - FORCE_LOCAL_DISABLED, - ) - } - - object Profile { - private const val id = "profile" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val PROFILE = "device_profile" - const val SERIAL = "device_profile_serial" - - val PROJECTION = arrayOf( - PROFILE, - SERIAL - ) - } - - object Location { - private const val id = "location" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val WIFI_MLS = "location_wifi_mls" - const val WIFI_MOVING = "location_wifi_moving" - const val WIFI_LEARNING = "location_wifi_learning" - const val CELL_MLS = "location_cell_mls" - const val CELL_LEARNING = "location_cell_learning" - const val GEOCODER_NOMINATIM = "location_geocoder_nominatim" - - val PROJECTION = arrayOf( - WIFI_MLS, - WIFI_MOVING, - WIFI_LEARNING, - CELL_MLS, - CELL_LEARNING, - GEOCODER_NOMINATIM, - ) - } - - object Vending { - private const val id = "vending" - fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id) - fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id" - - const val LICENSING = "vending_licensing" - const val BILLING = "vending_billing" - - val PROJECTION = arrayOf( - LICENSING, - BILLING, - ) - } - - private fun withoutCallingIdentity(f: () -> T): T { - val identity = Binder.clearCallingIdentity() - try { - return f.invoke() - } finally { - Binder.restoreCallingIdentity(identity) - } - } - - @JvmStatic - fun getSettings(context: Context, uri: Uri, projection: Array?, f: (Cursor) -> T): T = withoutCallingIdentity { - val c = context.contentResolver.query(uri, projection, null, null, null) - try { - require(c != null) { "Cursor for query $uri ${projection?.toList()} was null" } - if (!c.moveToFirst()) error("Cursor for query $uri ${projection?.toList()} was empty") - f.invoke(c) - } finally { - c?.close() - } - } - - @JvmStatic - fun setSettings(context: Context, uri: Uri, v: ContentValues.() -> Unit) = withoutCallingIdentity { - val values = ContentValues().apply { v.invoke(this) } - val affected = context.contentResolver.update(uri, values, null, null) - require(affected == 1) { "Update for $uri with $values affected 0 rows"} - } - -} diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt deleted file mode 100644 index dfb027d9..00000000 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt +++ /dev/null @@ -1,423 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.settings - -import android.content.ContentProvider -import android.content.ContentValues -import android.content.Context -import android.content.Context.MODE_PRIVATE -import android.content.SharedPreferences -import android.database.Cursor -import android.database.MatrixCursor -import android.net.Uri -import android.os.Build.VERSION.SDK_INT -import android.preference.PreferenceManager -import org.microg.gms.common.PackageUtils.warnIfNotMainProcess -import org.microg.gms.settings.SettingsContract.Auth -import org.microg.gms.settings.SettingsContract.CheckIn -import org.microg.gms.settings.SettingsContract.DroidGuard -import org.microg.gms.settings.SettingsContract.Exposure -import org.microg.gms.settings.SettingsContract.Gcm -import org.microg.gms.settings.SettingsContract.Location -import org.microg.gms.settings.SettingsContract.Vending -import org.microg.gms.settings.SettingsContract.Profile -import org.microg.gms.settings.SettingsContract.SafetyNet -import org.microg.gms.settings.SettingsContract.getAuthority -import java.io.File - -private const val SETTINGS_PREFIX = "org.microg.gms.settings." - -/** - * All settings access should go through this [ContentProvider], - * because it provides safe access from different processes which normal [SharedPreferences] don't. - */ -class SettingsProvider : ContentProvider() { - - private val preferences: SharedPreferences by lazy { - PreferenceManager.getDefaultSharedPreferences(context) - } - private val checkInPrefs by lazy { - context!!.getSharedPreferences(CheckIn.PREFERENCES_NAME, MODE_PRIVATE) - } - private val unifiedNlpPreferences by lazy { - context!!.getSharedPreferences("unified_nlp", MODE_PRIVATE) - } - private val systemDefaultPreferences: SharedPreferences? by lazy { - try { - Context::class.java.getDeclaredMethod( - "getSharedPreferences", - File::class.java, - Int::class.javaPrimitiveType - ).invoke(context, File("/system/etc/microg.xml"), MODE_PRIVATE) as SharedPreferences - } catch (ignored: Exception) { - null - } - } - private val metaDataPreferences: SharedPreferences by lazy { - MetaDataPreferences(context!!, SETTINGS_PREFIX) - } - - override fun onCreate(): Boolean { - return true - } - - override fun query( - uri: Uri, - projection: Array?, - selection: String?, - selectionArgs: Array?, - sortOrder: String? - ): Cursor? = when (uri) { - CheckIn.getContentUri(context!!) -> queryCheckIn(projection ?: CheckIn.PROJECTION) - Gcm.getContentUri(context!!) -> queryGcm(projection ?: Gcm.PROJECTION) - Auth.getContentUri(context!!) -> queryAuth(projection ?: Auth.PROJECTION) - Exposure.getContentUri(context!!) -> queryExposure(projection ?: Exposure.PROJECTION) - SafetyNet.getContentUri(context!!) -> querySafetyNet(projection ?: SafetyNet.PROJECTION) - DroidGuard.getContentUri(context!!) -> queryDroidGuard(projection ?: DroidGuard.PROJECTION) - Profile.getContentUri(context!!) -> queryProfile(projection ?: Profile.PROJECTION) - Location.getContentUri(context!!) -> queryLocation(projection ?: Location.PROJECTION) - Vending.getContentUri(context!!) -> queryVending(projection ?: Vending.PROJECTION) - else -> null - } - - override fun update( - uri: Uri, - values: ContentValues?, - selection: String?, - selectionArgs: Array? - ): Int { - warnIfNotMainProcess(context, this.javaClass) - if (values == null) return 0 - when (uri) { - CheckIn.getContentUri(context!!) -> updateCheckIn(values) - Gcm.getContentUri(context!!) -> updateGcm(values) - Auth.getContentUri(context!!) -> updateAuth(values) - Exposure.getContentUri(context!!) -> updateExposure(values) - SafetyNet.getContentUri(context!!) -> updateSafetyNet(values) - DroidGuard.getContentUri(context!!) -> updateDroidGuard(values) - Profile.getContentUri(context!!) -> updateProfile(values) - Location.getContentUri(context!!) -> updateLocation(values) - Vending.getContentUri(context!!) -> updateVending(values) - else -> return 0 - } - return 1 - } - - private fun queryCheckIn(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - CheckIn.ENABLED -> getSettingsBoolean(key, false) - CheckIn.ANDROID_ID -> checkInPrefs.getLong(key, 0) - CheckIn.DIGEST -> checkInPrefs.getString(key, CheckIn.INITIAL_DIGEST) - ?: CheckIn.INITIAL_DIGEST - CheckIn.LAST_CHECK_IN -> checkInPrefs.getLong(key, 0) - CheckIn.SECURITY_TOKEN -> checkInPrefs.getLong(key, 0) - CheckIn.VERSION_INFO -> checkInPrefs.getString(key, "") ?: "" - CheckIn.DEVICE_DATA_VERSION_INFO -> checkInPrefs.getString(key, "") ?: "" - else -> throw IllegalArgumentException() - } - } - - private fun updateCheckIn(values: ContentValues) { - if (values.size() == 0) return - if (values.size() == 1 && values.containsKey(CheckIn.ENABLED)) { - // special case: only changing enabled state - updateCheckInEnabled(values.getAsBoolean(CheckIn.ENABLED)) - return - } - val editor = checkInPrefs.edit() - values.valueSet().forEach { (key, value) -> - if (key == CheckIn.ENABLED) { - // special case: not saved in checkInPrefs - updateCheckInEnabled(value as Boolean) - } - when (key) { - CheckIn.ANDROID_ID -> editor.putLong(key, value as Long) - CheckIn.DIGEST -> editor.putString(key, value as String?) - CheckIn.LAST_CHECK_IN -> editor.putLong(key, value as Long) - CheckIn.SECURITY_TOKEN -> editor.putLong(key, value as Long) - CheckIn.VERSION_INFO -> editor.putString(key, value as String?) - CheckIn.DEVICE_DATA_VERSION_INFO -> editor.putString(key, value as String?) - } - } - editor.apply() - } - - private fun updateCheckInEnabled(enabled: Boolean) { - preferences.edit() - .putBoolean(CheckIn.ENABLED, enabled) - .apply() - } - - private fun queryGcm(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Gcm.ENABLE_GCM -> getSettingsBoolean(key, false) - Gcm.FULL_LOG -> getSettingsBoolean(key, true) - Gcm.CONFIRM_NEW_APPS -> getSettingsBoolean(key, false) - - Gcm.LAST_PERSISTENT_ID -> preferences.getString(key, "") ?: "" - - Gcm.NETWORK_MOBILE -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - Gcm.NETWORK_WIFI -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - Gcm.NETWORK_ROAMING -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - Gcm.NETWORK_OTHER -> Integer.parseInt(preferences.getString(key, "0") ?: "0") - - Gcm.LEARNT_MOBILE -> preferences.getInt(key, 300000) - Gcm.LEARNT_WIFI -> preferences.getInt(key, 300000) - Gcm.LEARNT_OTHER -> preferences.getInt(key, 300000) - - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateGcm(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Gcm.ENABLE_GCM -> editor.putBoolean(key, value as Boolean) - Gcm.FULL_LOG -> editor.putBoolean(key, value as Boolean) - Gcm.CONFIRM_NEW_APPS -> editor.putBoolean(key, value as Boolean) - - Gcm.LAST_PERSISTENT_ID -> editor.putString(key, value as String?) - - Gcm.NETWORK_MOBILE -> editor.putString(key, (value as Int).toString()) - Gcm.NETWORK_WIFI -> editor.putString(key, (value as Int).toString()) - Gcm.NETWORK_ROAMING -> editor.putString(key, (value as Int).toString()) - Gcm.NETWORK_OTHER -> editor.putString(key, (value as Int).toString()) - - Gcm.LEARNT_MOBILE -> editor.putInt(key, value as Int) - Gcm.LEARNT_WIFI -> editor.putInt(key, value as Int) - Gcm.LEARNT_OTHER -> editor.putInt(key, value as Int) - - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryAuth(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Auth.TRUST_GOOGLE -> getSettingsBoolean(key, true) - Auth.VISIBLE -> getSettingsBoolean(key, false) - Auth.INCLUDE_ANDROID_ID -> getSettingsBoolean(key, true) - Auth.STRIP_DEVICE_NAME -> getSettingsBoolean(key, false) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateAuth(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Auth.TRUST_GOOGLE -> editor.putBoolean(key, value as Boolean) - Auth.VISIBLE -> editor.putBoolean(key, value as Boolean) - Auth.INCLUDE_ANDROID_ID -> editor.putBoolean(key, value as Boolean) - Auth.STRIP_DEVICE_NAME -> editor.putBoolean(key, value as Boolean) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryExposure(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Exposure.SCANNER_ENABLED -> getSettingsBoolean(key, false) - Exposure.LAST_CLEANUP -> preferences.getLong(key, 0L) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateExposure(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Exposure.SCANNER_ENABLED -> editor.putBoolean(key, value as Boolean) - Exposure.LAST_CLEANUP -> editor.putLong(key, value as Long) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun querySafetyNet(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - SafetyNet.ENABLED -> getSettingsBoolean(key, false) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateSafetyNet(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - SafetyNet.ENABLED -> editor.putBoolean(key, value as Boolean) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryDroidGuard(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - DroidGuard.ENABLED -> getSettingsBoolean(key, false) - DroidGuard.MODE -> getSettingsString(key) - DroidGuard.NETWORK_SERVER_URL -> getSettingsString(key) - DroidGuard.FORCE_LOCAL_DISABLED -> systemDefaultPreferences?.getBoolean(key, false) ?: false - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateDroidGuard(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - DroidGuard.ENABLED -> editor.putBoolean(key, value as Boolean) - DroidGuard.MODE -> editor.putString(key, value as String) - DroidGuard.NETWORK_SERVER_URL -> editor.putString(key, value as String) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryProfile(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Profile.PROFILE -> getSettingsString(key, "auto") - Profile.SERIAL -> getSettingsString(key) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateProfile(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Profile.PROFILE -> editor.putString(key, value as String?) - Profile.SERIAL -> editor.putString(key, value as String?) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryLocation(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Location.WIFI_MLS -> getSettingsBoolean(key, hasUnifiedNlpLocationBackend("org.microg.nlp.backend.ichnaea")) - Location.WIFI_MOVING -> getSettingsBoolean(key, hasUnifiedNlpLocationBackend("de.sorunome.unifiednlp.trains")) - Location.WIFI_LEARNING -> getSettingsBoolean(key, hasUnifiedNlpLocationBackend("helium314.localbackend", "org.fitchfamily.android.dejavu")) - Location.CELL_MLS -> getSettingsBoolean(key, hasUnifiedNlpLocationBackend("org.microg.nlp.backend.ichnaea")) - Location.CELL_LEARNING -> getSettingsBoolean(key, hasUnifiedNlpLocationBackend("helium314.localbackend", "org.fitchfamily.android.dejavu")) - Location.GEOCODER_NOMINATIM -> getSettingsBoolean(key, hasUnifiedNlpGeocoderBackend("org.microg.nlp.backend.nominatim") ) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - private fun hasUnifiedNlpPrefixInStringSet(key: String, vararg prefixes: String) = getUnifiedNlpSettingsStringSetCompat(key, emptySet()).any { entry -> prefixes.any { prefix -> entry.startsWith(prefix)}} - private fun hasUnifiedNlpLocationBackend(vararg packageNames: String) = hasUnifiedNlpPrefixInStringSet("location_backends", *packageNames.map { "$it/" }.toTypedArray()) - private fun hasUnifiedNlpGeocoderBackend(vararg packageNames: String) = hasUnifiedNlpPrefixInStringSet("geocoder_backends", *packageNames.map { "$it/" }.toTypedArray()) - - private fun updateLocation(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Location.WIFI_MLS -> editor.putBoolean(key, value as Boolean) - Location.WIFI_MOVING -> editor.putBoolean(key, value as Boolean) - Location.WIFI_LEARNING -> editor.putBoolean(key, value as Boolean) - Location.CELL_MLS -> editor.putBoolean(key, value as Boolean) - Location.CELL_LEARNING -> editor.putBoolean(key, value as Boolean) - Location.GEOCODER_NOMINATIM -> editor.putBoolean(key, value as Boolean) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun queryVending(p: Array): Cursor = MatrixCursor(p).addRow(p) { key -> - when (key) { - Vending.LICENSING -> getSettingsBoolean(key, false) - Vending.BILLING -> getSettingsBoolean(key, false) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - - private fun updateVending(values: ContentValues) { - if (values.size() == 0) return - val editor = preferences.edit() - values.valueSet().forEach { (key, value) -> - when (key) { - Vending.LICENSING -> editor.putBoolean(key, value as Boolean) - Vending.BILLING -> editor.putBoolean(key, value as Boolean) - else -> throw IllegalArgumentException("Unknown key: $key") - } - } - editor.apply() - } - - private fun MatrixCursor.addRow( - p: Array, - valueGetter: (String) -> Any? - ): MatrixCursor { - val row = newRow() - for (key in p) row.add(valueGetter.invoke(key)) - return this - } - - override fun getType(uri: Uri): String { - return "vnd.android.cursor.item/vnd.${getAuthority(context!!)}.${uri.path}" - } - - override fun insert(uri: Uri, values: ContentValues?): Uri? { - throw UnsupportedOperationException() - } - - override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int { - throw UnsupportedOperationException() - } - - /** - * Returns the current setting of the given [key] - * using the default value from [systemDefaultPreferences] or [def] if not available. - * @return the current setting as [Int], because [ContentProvider] does not support [Boolean]. - */ - private fun getSettingsBoolean(key: String, def: Boolean): Int { - return listOf(preferences, systemDefaultPreferences, metaDataPreferences).getBooleanAsInt(key, def) - } - - private fun getSettingsString(key: String, def: String? = null): String? = listOf(preferences, systemDefaultPreferences, metaDataPreferences).getString(key, def) - private fun getSettingsInt(key: String, def: Int): Int = listOf(preferences, systemDefaultPreferences, metaDataPreferences).getInt(key, def) - private fun getSettingsLong(key: String, def: Long): Long = listOf(preferences, systemDefaultPreferences, metaDataPreferences).getLong(key, def) - private fun getUnifiedNlpSettingsStringSetCompat(key: String, def: Set): Set = listOf(unifiedNlpPreferences, preferences, systemDefaultPreferences).getStringSetCompat(key, def) - - private fun SharedPreferences.getStringSetCompat(key: String, def: Set): Set { - if (SDK_INT >= 11) { - try { - val res = getStringSet(key, null) - if (res != null) return res.filter { it.isNotEmpty() }.toSet() - } catch (ignored: Exception) { - // Ignore - } - } - try { - val str = getString(key, null) - if (str != null) return str.split("\\|".toRegex()).filter { it.isNotEmpty() }.toSet() - } catch (ignored: Exception) { - // Ignore - } - return def - } - - private fun List.getStringSetCompat(key: String, def: Set): Set = foldRight(def) { preferences, defValue -> preferences?.getStringSetCompat(key, defValue) ?: defValue } - private fun List.getString(key: String, def: String?): String? = foldRight(def) { preferences, defValue -> preferences?.getString(key, defValue) ?: defValue } - private fun List.getInt(key: String, def: Int): Int = foldRight(def) { preferences, defValue -> preferences?.getInt(key, defValue) ?: defValue } - private fun List.getLong(key: String, def: Long): Long = foldRight(def) { preferences, defValue -> preferences?.getLong(key, defValue) ?: defValue } - private fun List.getBoolean(key: String, def: Boolean): Boolean = foldRight(def) { preferences, defValue -> preferences?.getBoolean(key, defValue) ?: defValue } - private fun List.getBooleanAsInt(key: String, def: Boolean): Int = if (getBoolean(key, def)) 1 else 0 -} diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/ui/SwitchBarPreference.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/ui/SwitchBarPreference.kt deleted file mode 100644 index 446be354..00000000 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/ui/SwitchBarPreference.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.ui - -import android.content.Context -import android.graphics.drawable.Drawable -import android.util.AttributeSet -import androidx.appcompat.widget.SwitchCompat -import androidx.core.content.res.TypedArrayUtils -import androidx.preference.PreferenceViewHolder -import androidx.preference.TwoStatePreference -import org.microg.gms.base.core.R - -// TODO -class SwitchBarPreference : TwoStatePreference { - private val frameId: Int - private val backgroundOn: Drawable? - private val backgroundOff: Drawable? - private val backgroundDisabled: Drawable? - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { - val a = context.obtainStyledAttributes(attrs, R.styleable.SwitchBarPreference, defStyleAttr, defStyleRes) - frameId = a.getResourceId(R.styleable.SwitchBarPreference_switchBarFrameId, 0) - backgroundOn = a.getDrawable(R.styleable.SwitchBarPreference_switchBarFrameBackgroundOn) - backgroundOff = a.getDrawable(R.styleable.SwitchBarPreference_switchBarFrameBackgroundOff) - backgroundDisabled = a.getDrawable(R.styleable.SwitchBarPreference_switchBarFrameBackgroundDisabled) - } - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : this(context, attrs, defStyleAttr, R.style.Preference_SwitchBar) - constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, R.attr.switchBarPreferenceStyle) - constructor(context: Context) : this(context, null) - - override fun onBindViewHolder(holder: PreferenceViewHolder) { - super.onBindViewHolder(holder) - holder.isDividerAllowedBelow = false - holder.isDividerAllowedAbove = false - val switch = holder.findViewById(R.id.switch_widget) as SwitchCompat - switch.setOnCheckedChangeListener(null) - switch.isChecked = isChecked - switch.setOnCheckedChangeListener { view, isChecked -> - if (!callChangeListener(isChecked)) { - view.isChecked = !isChecked - return@setOnCheckedChangeListener - } - this.isChecked = isChecked - } - val frame = if (frameId == 0) null else holder.findViewById(frameId) - val backgroundView = frame ?: holder.itemView - val (backgroundDrawable, backgroundColorAttribute) = when { - !isEnabled -> Pair(backgroundDisabled, androidx.appcompat.R.attr.colorControlHighlight) - isChecked -> Pair(backgroundOn, androidx.appcompat.R.attr.colorControlActivated) - else -> Pair(backgroundOff, androidx.appcompat.R.attr.colorButtonNormal) - } - if (backgroundDrawable != null) { - backgroundView.setBackgroundDrawable(backgroundDrawable) - } else { - backgroundView.setBackgroundColorAttribute(backgroundColorAttribute) - } - } -} \ No newline at end of file diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/utils/IntentCacheManager.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/utils/IntentCacheManager.kt deleted file mode 100644 index 4a5e55be..00000000 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/utils/IntentCacheManager.kt +++ /dev/null @@ -1,149 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.utils - -import android.app.AlarmManager -import android.app.AlarmManager.ELAPSED_REALTIME_WAKEUP -import android.app.PendingIntent.FLAG_NO_CREATE -import android.app.PendingIntent.FLAG_UPDATE_CURRENT -import android.app.Service -import android.content.Context -import android.content.Intent -import android.os.Build.VERSION.SDK_INT -import android.os.Parcelable -import android.os.SystemClock -import android.util.Log -import androidx.core.app.PendingIntentCompat -import androidx.core.content.getSystemService -import java.util.UUID - -class IntentCacheManager(private val context: Context, private val clazz: Class, private val type: Int) { - private val lock = Any() - private lateinit var content: ArrayList - private lateinit var id: String - private var isReady: Boolean = false - private val pendingActions: MutableList<() -> Unit> = arrayListOf() - - init { - val pendingIntent = PendingIntentCompat.getService(context, type, getIntent(), 0, true)!! - val alarmManager = context.getSystemService() - if (SDK_INT >= 19) { - alarmManager?.setWindow(ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + TEN_YEARS, -1, pendingIntent) - } else { - alarmManager?.set(ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + TEN_YEARS, pendingIntent) - } - pendingIntent.send() - } - - private fun getIntent() = Intent(context, clazz).apply { - action = ACTION - putExtra(EXTRA_IS_CACHE, true) - putExtra(EXTRA_CACHE_TYPE, this@IntentCacheManager.type) - } - - fun add(entry: T, check: (T) -> Boolean = { false }) = runIfReady { - val iterator = content.iterator() - while (iterator.hasNext()) { - if (check(iterator.next())) { - iterator.remove() - } - } - content.add(entry) - updateIntent() - } - - fun remove(entry: T) = runIfReady { - if (content.remove(entry)) updateIntent() - } - - fun removeIf(check: (T) -> Boolean) = runIfReady { - var removed = false - val iterator = content.iterator() - while (iterator.hasNext()) { - if (check(iterator.next())) { - iterator.remove() - removed = true - } - } - if (removed) updateIntent() - } - - fun clear() = runIfReady { - content.clear() - updateIntent() - } - - fun getId(): String? = if (this::id.isInitialized) id else null - - fun getEntries(): List = if (this::content.isInitialized) content else emptyList() - - fun processIntent(intent: Intent) { - if (isCache(intent) && getType(intent) == type) { - synchronized(lock) { - content = intent.getParcelableArrayListExtra(EXTRA_DATA) ?: arrayListOf() - id = intent.getStringExtra(EXTRA_ID) ?: UUID.randomUUID().toString() - if (!intent.hasExtra(EXTRA_ID)) { - Log.d(TAG, "Created new intent cache with id $id") - } else if (intent.hasExtra(EXTRA_DATA)) { - Log.d(TAG, "Recovered data from intent cache with id $id") - } - pendingActions.forEach { it() } - pendingActions.clear() - isReady = true - updateIntent() - } - } - } - - private fun runIfReady(action: () -> Unit) { - synchronized(lock) { - if (isReady) { - action() - } else { - pendingActions.add(action) - } - } - } - - private fun updateIntent() { - synchronized(lock) { - if (isReady) { - val intent = getIntent().apply { - putExtra(EXTRA_ID, id) - putParcelableArrayListExtra(EXTRA_DATA, content) - } - val pendingIntent = PendingIntentCompat.getService(context, type, intent, FLAG_NO_CREATE or FLAG_UPDATE_CURRENT, true) - if (pendingIntent == null) { - Log.w(TAG, "Failed to update existing pending intent, will likely have a loss of information") - } - } - } - } - - companion object { - private const val TAG = "IntentCacheManager" - private const val TEN_YEARS = 315360000000L - private const val ACTION = "org.microg.gms.ACTION_INTENT_CACHE_MANAGER" - private const val EXTRA_IS_CACHE = "org.microg.gms.IntentCacheManager.is_cache" - private const val EXTRA_CACHE_TYPE = "org.microg.gms.IntentCacheManager.cache_type" - private const val EXTRA_ID = "org.microg.gms.IntentCacheManager.id" - private const val EXTRA_DATA = "org.microg.gms.IntentCacheManager.data" - - inline fun create(context: Context, type: Int) = IntentCacheManager(context, S::class.java, type) - - fun isCache(intent: Intent): Boolean = try { - intent.getBooleanExtra(EXTRA_IS_CACHE, false) - } catch (e: Exception) { - false - } - - fun getType(intent: Intent): Int { - val ret = intent.getIntExtra(EXTRA_CACHE_TYPE, -1) - if (ret == -1) throw IllegalArgumentException() - return ret - } - } -} \ No newline at end of file diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/utils/PackageManagerUtils.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/utils/PackageManagerUtils.kt deleted file mode 100644 index 5a5e2f72..00000000 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/utils/PackageManagerUtils.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.utils - -import android.content.pm.PackageManager -import android.content.pm.PackageManager.NameNotFoundException -import android.content.pm.Signature -import android.util.Base64 -import com.google.android.gms.common.internal.CertData -import java.security.MessageDigest -import java.util.* - -fun PackageManager.isPlatformCertificate(cert: CertData) = getPlatformCertificates().contains(cert) -fun PackageManager.getPlatformCertificates() = getCertificates("android") - -fun PackageManager.getCertificates(packageName: String): List = try { - getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures.map { CertData(it.toByteArray()) } -} catch (e: NameNotFoundException) { - emptyList() -} - -@Deprecated("It's actually a certificate", ReplaceWith("getCertificates")) -fun PackageManager.getSignatures(packageName: String): Array = try { - getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures -} catch (e: NameNotFoundException) { - emptyArray() -} - -fun PackageManager.getApplicationLabel(packageName: String): CharSequence = try { - getApplicationLabel(getApplicationInfo(packageName, 0)) -} catch (e: Exception) { - packageName -} - -fun PackageManager.getExtendedPackageInfo(packageName: String) = ExtendedPackageInfo(this, packageName) - -fun ByteArray.toBase64(vararg flags: Int): String = Base64.encodeToString(this, flags.fold(0) { a, b -> a or b }) -fun ByteArray.toHexString(separator: String = ""): String = joinToString(separator) { "%02x".format(it) } - -fun PackageManager.getFirstSignatureDigest(packageName: String, md: String): ByteArray? = - getCertificates(packageName).firstOrNull()?.digest(md) - -fun ByteArray.digest(md: String): ByteArray = MessageDigest.getInstance(md).digest(this) -@Deprecated("It's actually a certificate") -fun Signature.digest(md: String): ByteArray = toByteArray().digest(md) -fun CertData.digest(md: String): ByteArray = bytes.digest(md) diff --git a/play-services-base/core/src/main/res/layout/preference_app_heading.xml b/play-services-base/core/src/main/res/layout/preference_app_heading.xml deleted file mode 100644 index 1a229987..00000000 --- a/play-services-base/core/src/main/res/layout/preference_app_heading.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/play-services-base/core/src/main/res/values-fr/strings.xml b/play-services-base/core/src/main/res/values-fr/strings.xml deleted file mode 100644 index baa3b65f..00000000 --- a/play-services-base/core/src/main/res/values-fr/strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Avancé - Aucun - Désactivé - Activé - Automatique - Manuel - Actif en arrière-plan - \ No newline at end of file diff --git a/play-services-base/core/src/main/res/values-pt-rBR/strings.xml b/play-services-base/core/src/main/res/values-pt-rBR/strings.xml deleted file mode 100644 index 999c3508..00000000 --- a/play-services-base/core/src/main/res/values-pt-rBR/strings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - Avançado - Nenhum - %1$s está rodando em segundo plano. - Ligado - Desligado - Ativo em segundo plano - Excluá %1$s das configurações de otimização de bateria ou mude as configurações de notificação para esconder essa notificação. - Ver tudo - Abrir - Desativado - Ativado - Automático - Manual - \ No newline at end of file diff --git a/play-services-base/core/src/main/res/values/themes.xml b/play-services-base/core/src/main/res/values/themes.xml deleted file mode 100644 index a125f9cf..00000000 --- a/play-services-base/core/src/main/res/values/themes.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/play-services-base/gradle.properties b/play-services-base/gradle.properties deleted file mode 100644 index 6949ecb1..00000000 --- a/play-services-base/gradle.properties +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2013-2016 microG Project Team -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -POM_NAME=Play Services Library Base -POM_DESCRIPTION=Base classes used by all Play Services Library modules - -POM_PACKAGING=aar - -POM_URL=https://github.com/microg/android_external_GmsLib - -POM_SCM_URL=https://github.com/microg/android_external_GmsLib -POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mar-v-in -POM_DEVELOPER_NAME=Marvin W \ No newline at end of file diff --git a/play-services-base/src/main/AndroidManifest.xml b/play-services-base/src/main/AndroidManifest.xml deleted file mode 100644 index c31f1c05..00000000 --- a/play-services-base/src/main/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - diff --git a/play-services-base/src/main/java/com/google/android/gms/common/GoogleApiAvailability.java b/play-services-base/src/main/java/com/google/android/gms/common/GoogleApiAvailability.java deleted file mode 100644 index 61ee1ec0..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/GoogleApiAvailability.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common; - -import android.app.Dialog; - -import org.microg.gms.common.PublicApi; - -@PublicApi -public class GoogleApiAvailability { - - private GoogleApiAvailability() { - } - - private static final class InstanceHolder { - static final GoogleApiAvailability instance = new GoogleApiAvailability(); - } - - /** - * Returns the singleton instance of GoogleApiAvailability. - */ - public static GoogleApiAvailability getInstance() { - return InstanceHolder.instance; - } - - - /** - * Returns a dialog to address the provided errorCode. The returned dialog displays a localized - * message about the error and upon user confirmation (by tapping on dialog) will direct them - * to the Play Store if Google Play services is out of date or missing, or to system settings - * if Google Play services is disabled on the device. - * - */ - public Dialog getErrorDialog() { - // TODO - return null; - } - -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesClient.java b/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesClient.java deleted file mode 100644 index 0941e410..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesClient.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common; - -import android.os.Bundle; - -@Deprecated -public interface GooglePlayServicesClient { - void connect(); - - void disconnect(); - - boolean isConnected(); - - @Deprecated - interface OnConnectionFailedListener { - - void onConnectionFailed(ConnectionResult result); - } - - @Deprecated - interface ConnectionCallbacks { - - void onConnected(Bundle connectionHint); - - void onDisconnected(); - } -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java b/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java deleted file mode 100644 index d5399280..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common; - -import android.app.Dialog; -import android.app.PendingIntent; -import android.util.Log; - -import org.microg.gms.common.Constants; -import org.microg.gms.common.PublicApi; - -/** - * Utility class for verifying that the Google Play services APK is available and up-to-date on - * this device. The same checks are performed if one uses {@link AdvertisingIdClient} or - * {@link GoogleAuthUtil} to connect to the service. - *

- * TODO: methods :) - */ -@PublicApi -public class GooglePlayServicesUtil { - private static final String TAG = "GooglePlayServicesUtil"; - - /** - * Package name for Google Play services. - */ - @Deprecated - public static final String GOOGLE_PLAY_SERVICES_PACKAGE = Constants.GMS_PACKAGE_NAME; - - /** - * Google Play services client library version (declared in library's AndroidManifest.xml android:versionCode). - */ - @Deprecated - public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = Constants.GMS_VERSION_CODE; - - /** - * Returns a dialog to address the provided errorCode. The returned dialog displays a localized - * message about the error and upon user confirmation (by tapping on dialog) will direct them - * to the Play Store if Google Play services is out of date or missing, or to system settings - * if Google Play services is disabled on the device. - * - */ - @Deprecated - public static Dialog getErrorDialog() { - return GoogleApiAvailability.getInstance().getErrorDialog(); - } - - /** - * Returns a PendingIntent to address the provided errorCode. It will direct them to one of the - * following places to either the Play Store if Google Play services is out of date or missing, - * or system settings if Google Play services is disabled on the device. - * - */ - @Deprecated - public static PendingIntent getErrorPendingIntent() { - return null; // TODO - } - - /** - * Returns a human-readable string of the error code returned from {@link #isGooglePlayServicesAvailable()}. - */ - @Deprecated - public static String getErrorString() { - return null; // TODO - } - - /** - * Returns the open source software license information for the Google Play services - * application, or null if Google Play services is not available on this device. - */ - @Deprecated - public static String getOpenSourceSoftwareLicenseInfo() { - return null; // TODO - } - - /** - * Verifies that Google Play services is installed and enabled on this device, and that the - * version installed on this device is no older than the one required by this client. - * - * @return status code indicating whether there was an error. Can be one of following in - * {@link ConnectionResult}: SUCCESS, SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED, - * SERVICE_DISABLED, SERVICE_INVALID - */ - @Deprecated - public static int isGooglePlayServicesAvailable() { - Log.d(TAG, "As we can't know right now if the later desired feature is available, " + - "we just pretend it to be."); - return ConnectionResult.SUCCESS; - } - - @Deprecated - public static boolean isGoogleSignedUid() { - return false; // TODO - } - - /** - * Determines whether an error is user-recoverable. If true, proceed by calling - * {@link #getErrorDialog()} and showing the dialog. - * - * @return true if the error is recoverable with {@link #getErrorDialog()} - */ - @Deprecated - public static boolean isUserRecoverableError() { - return false; // TODO - } - - @Deprecated - public static boolean showErrorDialogFragment() { - return false; // TODO - } - - /** - * Displays a notification relevant to the provided error code. This method is similar to - * {@link #getErrorDialog()}, but is provided for background - * tasks that cannot or shouldn't display dialogs. - * - */ - @Deprecated - public static void showErrorNotification() { - // TODO - } -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/AccountInfo.java b/play-services-base/src/main/java/com/google/android/gms/common/api/AccountInfo.java deleted file mode 100644 index fd400c45..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/AccountInfo.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -import org.microg.safeparcel.AutoSafeParcelable; - -@Deprecated -public class AccountInfo extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator<>(AccountInfo.class); -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/Api.java b/play-services-base/src/main/java/com/google/android/gms/common/api/Api.java deleted file mode 100644 index 6b7f15e3..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/Api.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -import org.microg.gms.common.PublicApi; -import org.microg.gms.common.api.ApiClientBuilder; - -/** - * Describes a section of the Google Play Services API that should be made available. Instances of - * this should be passed into {@link GoogleApiClient.Builder#addApi(Api)} to enable the appropriate - * parts of Google Play Services. - *

- * Google APIs are partitioned into sections which allow your application to configure only the - * services it requires. Each Google API provides an API object which can be passed to - * {@link GoogleApiClient.Builder#addApi(Api)} in order to configure and enable that functionality - * in your {@link GoogleApiClient} instance. - *

- * See {@link GoogleApiClient.Builder} for usage examples. - */ -@PublicApi -public final class Api { - private final ApiClientBuilder builder; - - @PublicApi(exclude = true) - public Api(ApiClientBuilder builder) { - this.builder = builder; - } - - @PublicApi(exclude = true) - public ApiClientBuilder getBuilder() { - return builder; - } - - /** - * Base interface for API options. These are used to configure specific parameters for - * individual API surfaces. The default implementation has no parameters. - */ - @PublicApi - public interface ApiOptions { - /** - * Base interface for {@link ApiOptions} in {@link Api}s that have options. - */ - @PublicApi - interface HasOptions extends ApiOptions { - } - - /** - * Base interface for {@link ApiOptions} that are not required, don't exist. - */ - @PublicApi - interface NotRequiredOptions extends ApiOptions { - } - - } - -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApi.java b/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApi.java deleted file mode 100644 index f0adb967..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApi.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.common.api; - -import android.content.Context; - -import org.microg.gms.common.PublicApi; -import org.microg.gms.common.api.GoogleApiManager; - -@PublicApi -public abstract class GoogleApi implements HasApiKey { - @PublicApi(exclude = true) - public Api api; - - @PublicApi(exclude = true) - protected GoogleApi(Context context, Api api) { - this.api = api; - GoogleApiManager.getInstance(); - } - - @PublicApi(exclude = true) - public O getOptions() { - return null; - } -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApiActivity.java b/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApiActivity.java deleted file mode 100644 index 8a6b0690..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApiActivity.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.google.android.gms.common.api; - -import android.app.Activity; - -public class GoogleApiActivity extends Activity { -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApiClient.java b/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApiClient.java deleted file mode 100644 index 0e20b6d5..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/GoogleApiClient.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.os.Looper; - -import com.google.android.gms.common.ConnectionResult; - -import org.microg.gms.common.PublicApi; -import org.microg.gms.common.api.ApiClientSettings; -import org.microg.gms.common.api.GoogleApiClientImpl; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * The main entry point for Google Play services integration. - *

- * GoogleApiClient is used with a variety of static methods. Some of these methods require that - * GoogleApiClient be connected, some will queue up calls before GoogleApiClient is connected; - * check the specific API documentation to determine whether you need to be connected. - *

- * Before any operation is executed, the GoogleApiClient must be connected using the - * {@link #connect()} method. The client is not considered connected until the - * {@link ConnectionCallbacks#onConnected(Bundle)} callback has been called. - *

- * When your app is done using this client, call {@link #disconnect()}, even if the async result - * from {@link #connect()} has not yet been delivered. - *

- * You should instantiate a client object in your Activity's {@link Activity#onCreate(Bundle)} - * method and then call {@link #connect()} in {@link Activity#onStart()} and {@link #disconnect()} - * in {@link Activity#onStop()}, regardless of the state. - */ -@PublicApi -@Deprecated -public interface GoogleApiClient { - - /** - * Connects the client to Google Play services. This method returns immediately, and connects - * to the service in the background. If the connection is successful, - * {@link ConnectionCallbacks#onConnected(Bundle)} is called and enqueued items are executed. - * On a failure, {@link OnConnectionFailedListener#onConnectionFailed(ConnectionResult)} is - * called. - */ - void connect(); - - /** - * Closes the connection to Google Play services. No calls can be made using this client after - * calling this method. Any method calls that haven't executed yet will be canceled. That is - * {@link ResultCallback#onResult(Result)} won't be called, if connection to the service hasn't - * been established yet all calls already made will be canceled. - * - * @see #connect() - */ - void disconnect(); - - /** - * Checks if the client is currently connected to the service, so that requests to other - * methods will succeed. Applications should guard client actions caused by the user with a - * call to this method. - * - * @return {@code true} if the client is connected to the service. - */ - boolean isConnected(); - - /** - * Checks if the client is attempting to connect to the service. - * - * @return {@code true} if the client is attempting to connect to the service. - */ - boolean isConnecting(); - - /** - * Returns {@code true} if the specified listener is currently registered to receive connection - * events. - * - * @param listener The listener to check for. - * @return {@code true} if the specified listener is currently registered to receive connection - * events. - * @see #registerConnectionCallbacks(ConnectionCallbacks) - * @see #unregisterConnectionCallbacks(ConnectionCallbacks) - */ - boolean isConnectionCallbacksRegistered(ConnectionCallbacks listener); - - /** - * Returns {@code true} if the specified listener is currently registered to receive connection - * failed events. - * - * @param listener The listener to check for. - * @return {@code true} if the specified listener is currently registered to receive connection - * failed events. - * @see #registerConnectionFailedListener(OnConnectionFailedListener) - * @see #unregisterConnectionFailedListener(OnConnectionFailedListener) - */ - boolean isConnectionFailedListenerRegistered(OnConnectionFailedListener listener); - - /** - * Registers a listener to receive connection events from this {@link GoogleApiClient}. If the - * service is already connected, the listener's {@link ConnectionCallbacks#onConnected(Bundle)} - * method will be called immediately. Applications should balance calls to this method with - * calls to {@link #unregisterConnectionCallbacks(ConnectionCallbacks)} to avoid leaking - * resources. - *

- * If the specified listener is already registered to receive connection events, this method - * will not add a duplicate entry for the same listener, but will still call the listener's - * {@link ConnectionCallbacks#onConnected(Bundle)} method if currently connected. - *

- * Note that the order of messages received here may not be stable, so clients should not rely - * on the order that multiple listeners receive events in. - * - * @param listener the listener where the results of the asynchronous {@link #connect()} call - * are delivered. - */ - void registerConnectionCallbacks(ConnectionCallbacks listener); - - /** - * Registers a listener to receive connection failed events from this {@link GoogleApiClient}. - * Unlike {@link #registerConnectionCallbacks(ConnectionCallbacks)}, if the service is not - * already connected, the listener's - * {@link OnConnectionFailedListener#onConnectionFailed(ConnectionResult)} method will not be - * called immediately. Applications should balance calls to this method with calls to - * {@link #unregisterConnectionFailedListener(OnConnectionFailedListener)} to avoid leaking - * resources. - *

- * If the specified listener is already registered to receive connection failed events, this - * method will not add a duplicate entry for the same listener. - *

- * Note that the order of messages received here may not be stable, so clients should not rely - * on the order that multiple listeners receive events in. - * - * @param listener the listener where the results of the asynchronous {@link #connect()} call - * are delivered. - */ - void registerConnectionFailedListener(OnConnectionFailedListener listener); - - /** - * Removes a connection listener from this {@link GoogleApiClient}. Note that removing a - * listener does not generate any callbacks. - *

- * If the specified listener is not currently registered to receive connection events, this - * method will have no effect. - * - * @param listener the listener to unregister. - */ - void unregisterConnectionCallbacks(ConnectionCallbacks listener); - - @PublicApi - class Builder { - private final Context context; - private final Map apis = new HashMap<>(); - private final Set connectionCallbacks = new HashSet<>(); - private final Set connectionFailedListeners = new HashSet<>(); - private final Looper looper; - - public Builder(Context context) { - this.context = context; - this.looper = context.getMainLooper(); - } - - /** - * Specify which Apis are requested by your app. See {@link Api} for more information. - * - * @param api The Api requested by your app. - * @see Api - */ - public Builder addApi(Api api) { - apis.put(api, null); - return this; - } - - /** - * Builds a new {@link GoogleApiClient} object for communicating with the Google APIs. - * - * @return The {@link GoogleApiClient} object. - */ - public GoogleApiClient build() { - int clientId = -1; - return new GoogleApiClientImpl(context, looper, getClientSettings(), apis, connectionCallbacks, connectionFailedListeners); - } - - private ApiClientSettings getClientSettings() { - return null; - } - - } - - /** - * Provides callbacks that are called when the client is connected or disconnected from the - * service. Most applications implement {@link #onConnected(Bundle)} to start making requests. - */ - @PublicApi - @Deprecated - interface ConnectionCallbacks extends org.microg.gms.common.api.ConnectionCallbacks { - } - - @PublicApi - @Deprecated - interface OnConnectionFailedListener extends org.microg.gms.common.api.OnConnectionFailedListener { - } -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/HasApiKey.java b/play-services-base/src/main/java/com/google/android/gms/common/api/HasApiKey.java deleted file mode 100644 index 642a636d..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/HasApiKey.java +++ /dev/null @@ -1,9 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.common.api; - -public interface HasApiKey { -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/PendingResult.java b/play-services-base/src/main/java/com/google/android/gms/common/api/PendingResult.java deleted file mode 100644 index e5f92160..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/PendingResult.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -public interface PendingResult { -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/api/internal/ApiKey.java b/play-services-base/src/main/java/com/google/android/gms/common/api/internal/ApiKey.java deleted file mode 100644 index b679b2b9..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/api/internal/ApiKey.java +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.common.api.internal; - -public class ApiKey { - - public ApiKey() { - } -} diff --git a/play-services-base/src/main/java/com/google/android/gms/common/data/DataBuffer.java b/play-services-base/src/main/java/com/google/android/gms/common/data/DataBuffer.java deleted file mode 100644 index 907aee2d..00000000 --- a/play-services-base/src/main/java/com/google/android/gms/common/data/DataBuffer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.data; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.api.Releasable; - -import org.microg.gms.common.PublicApi; - -import java.util.Iterator; - -/** - * TODO - */ -@PublicApi -public abstract class DataBuffer implements Releasable, Iterable { - - @PublicApi(exclude = true) - public DataBuffer() { - } - - /** - * @deprecated use {@link #release()} instead - */ - @Deprecated - public final void close() { - release(); - } - - /** - * @deprecated {@link #release()} is idempotent, and so is safe to call multiple times - */ - @Deprecated - public boolean isClosed() { - return false; - } - - @NonNull - @Override - public Iterator iterator() { - return null; - } - - /** - * Releases resources used by the buffer. This method is idempotent. - */ - @Override - public void release() { - - } - -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/AbstractPendingResult.java b/play-services-base/src/main/java/org/microg/gms/common/api/AbstractPendingResult.java deleted file mode 100644 index cea4229b..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/AbstractPendingResult.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common.api; - -import android.os.Looper; - -import com.google.android.gms.common.api.PendingResult; - -public class AbstractPendingResult implements PendingResult { - - public AbstractPendingResult(Looper looper) { - new ResultCallbackHandler<>(looper); - } - -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/ApiClient.java b/play-services-base/src/main/java/org/microg/gms/common/api/ApiClient.java deleted file mode 100644 index fbe23365..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/ApiClient.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common.api; - -<<<<<<< HEAD:play-services-base/src/main/java/org/microg/gms/common/api/ApiClient.java -public interface ApiClient { - void connect(); - - void disconnect(); - - boolean isConnected(); - - boolean isConnecting(); -======= -public class ModuleDescriptor { - public static final String MODULE_ID = "com.google.android.gms.measurement.dynamite"; - public static final int MODULE_VERSION = 98; ->>>>>>> df6f331a (Dynamite: Bump version of measurement API):play-services-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/measurement/dynamite/ModuleDescriptor.java -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/ApiClientBuilder.java b/play-services-base/src/main/java/org/microg/gms/common/api/ApiClientBuilder.java deleted file mode 100644 index b5aa386f..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/ApiClientBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common.api; - -import android.content.Context; -import android.os.Looper; - -import com.google.android.gms.common.api.Api; - -public interface ApiClientBuilder { - ApiClient build(O options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener); -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/ApiClientSettings.java b/play-services-base/src/main/java/org/microg/gms/common/api/ApiClientSettings.java deleted file mode 100644 index d1e314a7..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/ApiClientSettings.java +++ /dev/null @@ -1,9 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.common.api; - -public class ApiClientSettings { -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/ConnectionCallbacks.java b/play-services-base/src/main/java/org/microg/gms/common/api/ConnectionCallbacks.java deleted file mode 100644 index 738a43d3..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/ConnectionCallbacks.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.common.api; - -import android.os.Bundle; - -import com.google.android.gms.common.api.GoogleApiClient; - -public interface ConnectionCallbacks { - - /** - * After calling {@link #connect()}, this method will be invoked asynchronously when the - * connect request has successfully completed. After this callback, the application can - * make requests on other methods provided by the client and expect that no user - * intervention is required to call methods that use account and scopes provided to the - * client constructor. - *

- * Note that the contents of the {@code connectionHint} Bundle are defined by the specific - * services. Please see the documentation of the specific implementation of - * {@link GoogleApiClient} you are using for more information. - * - * @param connectionHint Bundle of data provided to clients by Google Play services. May - * be null if no content is provided by the service. - */ - void onConnected(Bundle connectionHint); - - /** - * Called when the client is temporarily in a disconnected state. This can happen if there - * is a problem with the remote service (e.g. a crash or resource problem causes it to be - * killed by the system). When called, all requests have been canceled and no outstanding - * listeners will be executed. GoogleApiClient will automatically attempt to restore the - * connection. Applications should disable UI components that require the service, and wait - * for a call to {@link #onConnected(Bundle)} to re-enable them. - * - * @param cause The reason for the disconnection. Defined by constants {@code CAUSE_*}. - */ - void onConnectionSuspended(int cause); -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/GoogleApiClientImpl.java b/play-services-base/src/main/java/org/microg/gms/common/api/GoogleApiClientImpl.java deleted file mode 100644 index 371a6555..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/GoogleApiClientImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common.api; - -import android.content.Context; -import android.os.Bundle; -import android.os.Looper; -import android.util.Log; - -import com.google.android.gms.common.api.Api; -import com.google.android.gms.common.api.GoogleApiClient; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -public class GoogleApiClientImpl implements GoogleApiClient { - private static final String TAG = "GmsApiClientImpl"; - - private final Map apiConnections = new HashMap<>(); - private final Set connectionCallbacks = new HashSet<>(); - private final Set connectionFailedListeners = new HashSet<>(); - private boolean shouldDisconnect = false; - - public GoogleApiClientImpl(Context context, Looper looper, ApiClientSettings clientSettings, - Map apis, - Set connectionCallbacks, - Set connectionFailedListeners) { - this.connectionCallbacks.addAll(connectionCallbacks); - this.connectionFailedListeners.addAll(connectionFailedListeners); - - for (Api api : apis.keySet()) { - ConnectionCallbacks baseConnectionCallbacks = new ConnectionCallbacks() { - @Override - public void onConnected(Bundle connectionHint) { - Log.d(TAG, "ConnectionCallbacks : onConnected()"); - for (ConnectionCallbacks callback : connectionCallbacks) { - callback.onConnected(connectionHint); - } - } - - @Override - public void onConnectionSuspended(int cause) { - Log.d(TAG, "ConnectionCallbacks : onConnectionSuspended()"); - for (ConnectionCallbacks callback : connectionCallbacks) { - callback.onConnectionSuspended(cause); - } - } - }; - OnConnectionFailedListener baseConnectionFailedListener = result -> { - Log.d(TAG, "OnConnectionFailedListener : onConnectionFailed()"); - for (OnConnectionFailedListener listener : connectionFailedListeners) { - listener.onConnectionFailed(result); - } - }; - apiConnections.put(api, api.getBuilder().build(apis.get(api), context, looper, clientSettings, baseConnectionCallbacks, baseConnectionFailedListener)); - } - } - - @Override - public synchronized void connect() { - Log.d(TAG, "connect()"); - if (isConnected() || isConnecting()) { - if (shouldDisconnect) { - shouldDisconnect = false; - return; - } - Log.d(TAG, "Already connected/connecting, nothing to do"); - return; - } - for (ApiClient connection : apiConnections.values()) { - if (!connection.isConnected()) { - connection.connect(); - } - } - } - - @Override - public synchronized void disconnect() { - Log.d(TAG, "disconnect()"); - for (ApiClient connection : apiConnections.values()) { - if (connection.isConnected()) { - connection.disconnect(); - } - } - } - - @Override - public synchronized boolean isConnected() { - for (ApiClient connection : apiConnections.values()) { - if (!connection.isConnected()) return false; - } - return true; - } - - @Override - public synchronized boolean isConnecting() { - for (ApiClient connection : apiConnections.values()) { - if (connection.isConnecting()) return true; - } - return false; - } - - @Override - public boolean isConnectionCallbacksRegistered(ConnectionCallbacks listener) { - return connectionCallbacks.contains(listener); - } - - @Override - public boolean isConnectionFailedListenerRegistered( - OnConnectionFailedListener listener) { - return connectionFailedListeners.contains(listener); - } - - @Override - public void registerConnectionCallbacks(ConnectionCallbacks listener) { - connectionCallbacks.add(listener); - } - - @Override - public void registerConnectionFailedListener(OnConnectionFailedListener listener) { - connectionFailedListeners.add(listener); - } - - @Override - public void unregisterConnectionCallbacks(ConnectionCallbacks listener) { - connectionCallbacks.remove(listener); - } - -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/GoogleApiManager.java b/play-services-base/src/main/java/org/microg/gms/common/api/GoogleApiManager.java deleted file mode 100644 index a5fa2545..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/GoogleApiManager.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.common.api; - -import android.annotation.SuppressLint; - -public class GoogleApiManager { - @SuppressLint("StaticFieldLeak") - private static GoogleApiManager instance; - - private GoogleApiManager() { - } - - public synchronized static void getInstance() { - if (instance == null) instance = new GoogleApiManager(); - } - -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/OnConnectionFailedListener.java b/play-services-base/src/main/java/org/microg/gms/common/api/OnConnectionFailedListener.java deleted file mode 100644 index cd994235..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/OnConnectionFailedListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.microg.gms.common.api; - -import android.app.Activity; - -import com.google.android.gms.common.ConnectionResult; - -public interface OnConnectionFailedListener { - /** - * Called when there was an error connecting the client to the service. - * - * @param result A {@link ConnectionResult} that can be used for resolving the error, and - * deciding what sort of error occurred. To resolve the error, the resolution - * must be started from an activity with a non-negative {@code requestCode} - * passed to {@link ConnectionResult#startResolutionForResult(Activity, int)}. - * Applications should implement {@link Activity#onActivityResult} in their - * Activity to call {@link #connect()} again if the user has resolved the - * issue (resultCode is {@link Activity#RESULT_OK}). - */ - void onConnectionFailed(ConnectionResult result); -} diff --git a/play-services-base/src/main/java/org/microg/gms/common/api/ResultCallbackHandler.java b/play-services-base/src/main/java/org/microg/gms/common/api/ResultCallbackHandler.java deleted file mode 100644 index a737a076..00000000 --- a/play-services-base/src/main/java/org/microg/gms/common/api/ResultCallbackHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common.api; - -import android.os.Handler; -import android.os.Looper; -import android.os.Message; -import android.util.Log; - -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.ResultCallback; - -class ResultCallbackHandler extends Handler { - private static final String TAG = "GmsResultCbackHandler"; - public static final int CALLBACK_ON_COMPLETE = 1; - public static final int CALLBACK_ON_TIMEOUT = 2; - - public ResultCallbackHandler(Looper looper) { - super(looper); - } - - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case CALLBACK_ON_COMPLETE: - OnCompleteObject o = (OnCompleteObject) msg.obj; - Log.d(TAG, "handleMessage() : onResult(" + o.result + ")"); - o.callback.onResult(o.result); - break; - case CALLBACK_ON_TIMEOUT: - // TODO - break; - } - } - - public static class OnCompleteObject { - public ResultCallback callback; - public R result; - - public OnCompleteObject(ResultCallback callback, R result) { - this.callback = callback; - this.result = result; - } - } -} diff --git a/play-services-base/src/main/res/values/version.xml b/play-services-base/src/main/res/values/version.xml deleted file mode 100644 index 318bb1c2..00000000 --- a/play-services-base/src/main/res/values/version.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - 6599436 - diff --git a/play-services-basement/build.gradle b/play-services-basement/build.gradle deleted file mode 100644 index 8971fb98..00000000 --- a/play-services-basement/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2013-2015 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -dependencies { - api "org.microg:safe-parcel:1.7.0" - - // Dependencies from play-services-basement:18.0.0 - api "androidx.collection:collection:$collectionVersion" - api "androidx.core:core-ktx:$coreVersion" - api "androidx.fragment:fragment-ktx:$fragmentVersion" -} - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion androidBuildVersionTools - - aidlPackageWhiteList "com/google/android/gms/common/api/Status.aidl" - aidlPackageWhiteList "com/google/android/gms/common/internal/ICancelToken.aidl" - aidlPackageWhiteList "com/google/android/gms/common/server/FavaDiagnosticsEntity.aidl" - aidlPackageWhiteList "com/google/android/gms/dynamic/IObjectWrapper.aidl" - - defaultConfig { - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - buildConfigField "int", "VERSION_CODE", "$appVersionCode" - } - - buildFeatures { - viewBinding = true - aidl true - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - compileOptions { - sourceCompatibility = 17 - targetCompatibility = 17 - } - namespace 'org.microg.gms.basement' -} \ No newline at end of file diff --git a/play-services-basement/gradle.properties b/play-services-basement/gradle.properties deleted file mode 100644 index f7f3ecc1..00000000 --- a/play-services-basement/gradle.properties +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2013-2016 microG Project Team -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -POM_NAME=Play Services Basement -POM_DESCRIPTION=Interfaces and objects used all over Play Services API, Library and Core - -POM_PACKAGING=aar - -POM_URL=https://github.com/microg/android_external_GmsApi - -POM_SCM_URL=https://github.com/microg/android_external_GmsApi -POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mar-v-in -POM_DEVELOPER_NAME=Marvin W \ No newline at end of file diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/common/api/Status.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/common/api/Status.aidl deleted file mode 100644 index 701f99a9..00000000 --- a/play-services-basement/src/main/aidl/com/google/android/gms/common/api/Status.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.common.api; - -parcelable Status; \ No newline at end of file diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/GetServiceRequest.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/GetServiceRequest.aidl deleted file mode 100644 index 791dbe90..00000000 --- a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/GetServiceRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.common.internal; - -parcelable GetServiceRequest; diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/ICancelToken.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/ICancelToken.aidl deleted file mode 100644 index aebd4794..00000000 --- a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/ICancelToken.aidl +++ /dev/null @@ -1,5 +0,0 @@ -package com.google.android.gms.common.internal; - -interface ICancelToken { - void cancel(); -} diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsCallbacks.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsCallbacks.aidl deleted file mode 100644 index b0210281..00000000 --- a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsCallbacks.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.common.internal; - -import android.os.Bundle; - -interface IGmsCallbacks { - void onPostInitComplete(int statusCode, IBinder binder, in Bundle params); -} diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsServiceBroker.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsServiceBroker.aidl deleted file mode 100644 index 8ff5c840..00000000 --- a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsServiceBroker.aidl +++ /dev/null @@ -1,15 +0,0 @@ -package com.google.android.gms.common.internal; - -import android.os.Bundle; - -import com.google.android.gms.common.internal.IGmsCallbacks; -import com.google.android.gms.common.internal.GetServiceRequest; -import com.google.android.gms.common.internal.ValidateAccountRequest; - -interface IGmsServiceBroker { - void getPeopleService(IGmsCallbacks callback, int code, String str, in Bundle params) = 4; - void getGoogleIdentityService(IGmsCallbacks callback, int code, String str, in Bundle params) = 16; - void getAddressService(IGmsCallbacks callback, int code, String str) = 23; - void getService(IGmsCallbacks callback, in GetServiceRequest request) = 45; - void validateAccount(IGmsCallbacks callback, in ValidateAccountRequest request) = 46; -} diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/ValidateAccountRequest.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/ValidateAccountRequest.aidl deleted file mode 100644 index cef6ad7e..00000000 --- a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/ValidateAccountRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.common.internal; - -parcelable ValidateAccountRequest; diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/dynamic/IObjectWrapper.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/dynamic/IObjectWrapper.aidl deleted file mode 100644 index 35e1474a..00000000 --- a/play-services-basement/src/main/aidl/com/google/android/gms/dynamic/IObjectWrapper.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package com.google.android.gms.dynamic; - -/** - * The concrete class implementing IObjectWrapper must have exactly one declared private field - * for the wrapped object. Preferably, this is an instance of the ObjectWrapper class. - */ -interface IObjectWrapper { -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/ConnectionResult.java b/play-services-basement/src/main/java/com/google/android/gms/common/ConnectionResult.java deleted file mode 100644 index 23ebfb81..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/ConnectionResult.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common; - -import android.app.Activity; -import android.app.PendingIntent; -import android.content.IntentSender; -import android.text.TextUtils; - -import java.util.Arrays; - -/** - * Contains all possible error codes for when a client fails to connect to Google Play services. - * These error codes are used by {@link GoogleApiClient.OnConnectionFailedListener}. - */ -public class ConnectionResult { - /** - * The connection was successful. - */ - public static final int SUCCESS = 0; - /** - * Google Play services is missing on this device. The calling activity should pass this error - * code to {@link GooglePlayServicesUtil#getErrorDialog(int, Activity, int)} to get a localized - * error dialog that will resolve the error when shown. - */ - public static final int SERVICE_MISSING = 1; - /** - * The installed version of Google Play services is out of date. The calling activity should - * pass this error code to {@link GooglePlayServicesUtil#getErrorDialog(int, Activity, int)} to - * get a localized error dialog that will resolve the error when shown. - */ - public static final int SERVICE_VERSION_UPDATE_REQUIRED = 2; - /** - * The installed version of Google Play services has been disabled on this device. The calling - * activity should pass this error code to - * {@link GooglePlayServicesUtil#getErrorDialog(int, Activity, int)} to get a localized error - * dialog that will resolve the error when shown. - */ - public static final int SERVICE_DISABLED = 3; - /** - * The client attempted to connect to the service but the user is not signed in. The client may - * choose to continue without using the API or it may call - * {@link #startResolutionForResult(Activity, int)} to prompt the user to sign in. After the - * sign in activity returns with {@link Activity#RESULT_OK} further attempts to connect should - * succeed. - */ - public static final int SIGN_IN_REQUIRED = 4; - /** - * The client attempted to connect to the service with an invalid account name specified. - */ - public static final int INVALID_ACCOUNT = 5; - /** - * Completing the connection requires some form of resolution. A resolution will be available - * to be started with {@link #startResolutionForResult(Activity, int)}. If the result returned - * is {@link Activity#RESULT_OK}, then further attempts to connect should either complete or - * continue on to the next issue that needs to be resolved. - */ - public static final int RESOLUTION_REQUIRED = 6; - /** - * A network error occurred. Retrying should resolve the problem. - */ - public static final int NETWORK_ERROR = 7; - /** - * An internal error occurred. Retrying should resolve the problem. - */ - public static final int INTERNAL_ERROR = 8; - /** - * The version of the Google Play services installed on this device is not authentic. - */ - public static final int SERVICE_INVALID = 9; - /** - * The application is misconfigured. This error is not recoverable and will be treated as - * fatal. The developer should look at the logs after this to determine more actionable - * information. - */ - public static final int DEVELOPER_ERROR = 10; - /** - * The application is not licensed to the user. This error is not recoverable and will be - * treated as fatal. - */ - public static final int LICENSE_CHECK_FAILED = 11; - /** - * The client canceled the connection by calling {@link GoogleApiClient#disconnect()}. - * Only returned by {@link GoogleApiClient#blockingConnect()}. - */ - public static final int CANCELED = 13; - /** - * The timeout was exceeded while waiting for the connection to complete. Only returned by - * {@link GoogleApiClient#blockingConnect()}. - */ - public static final int TIMEOUT = 14; - /** - * An interrupt occurred while waiting for the connection complete. Only returned by - * {@link GoogleApiClient#blockingConnect()}. - */ - public static final int INTERRUPTED = 15; - /** - * One of the API components you attempted to connect to is not available. The API will not - * work on this device, and updating Google Play services will not likely solve the problem. - * Using the API on the device should be avoided. - */ - public static final int API_UNAVAILABLE = 16; - - /** - * Service doesn't have one or more required permissions. - */ - public static final int SERVICE_MISSING_PERMISSION = 19; - - /** - * The Drive API requires external storage (such as an SD card), but no external storage is - * mounted. This error is recoverable if the user installs external storage (if none is - * present) and ensures that it is mounted (which may involve disabling USB storage mode, - * formatting the storage, or other initialization as required by the device). - *

- * This error should never be returned on a device with emulated external storage. On devices - * with emulated external storage, the emulated "external storage" is always present regardless - * of whether the device also has removable storage. - */ - @Deprecated - public static final int DRIVE_EXTERNAL_STORAGE_REQUIRED = 1500; - - private final int statusCode; - private final PendingIntent pendingIntent; - private final String message; - - /** - * Creates a connection result. - * - * @param statusCode The status code. - */ - public ConnectionResult(int statusCode) { - this(statusCode, null); - } - - /** - * Creates a connection result. - * - * @param statusCode The status code. - * @param pendingIntent A pending intent that will resolve the issue when started, or null. - */ - public ConnectionResult(int statusCode, PendingIntent pendingIntent) { - this(statusCode, pendingIntent, getStatusString(statusCode)); - } - - /** - * Creates a connection result. - * - * @param statusCode The status code. - * @param pendingIntent A pending intent that will resolve the issue when started, or null. - * @param message An additional error message for the connection result, or null. - */ - public ConnectionResult(int statusCode, PendingIntent pendingIntent, String message) { - this.statusCode = statusCode; - this.pendingIntent = pendingIntent; - this.message = message; - } - - static String getStatusString(int statusCode) { - switch (statusCode) { - case -1: - return "UNKNOWN"; - case 0: - return "SUCCESS"; - case 1: - return "SERVICE_MISSING"; - case 2: - return "SERVICE_VERSION_UPDATE_REQUIRED"; - case 3: - return "SERVICE_DISABLED"; - case 4: - return "SIGN_IN_REQUIRED"; - case 5: - return "INVALID_ACCOUNT"; - case 6: - return "RESOLUTION_REQUIRED"; - case 7: - return "NETWORK_ERROR"; - case 8: - return "INTERNAL_ERROR"; - case 9: - return "SERVICE_INVALID"; - case 10: - return "DEVELOPER_ERROR"; - case 11: - return "LICENSE_CHECK_FAILED"; - case 13: - return "CANCELED"; - case 14: - return "TIMEOUT"; - case 15: - return "INTERRUPTED"; - case 16: - return "API_UNAVAILABLE"; - case 17: - return "SIGN_IN_FAILED"; - case 18: - return "SERVICE_UPDATING"; - case 19: - return "SERVICE_MISSING_PERMISSION"; - case 20: - return "RESTRICTED_PROFILE"; - case 21: - return "API_VERSION_UPDATE_REQUIRED"; - case 42: - return "UPDATE_ANDROID_WEAR"; - case 99: - return "UNFINISHED"; - case 1500: - return "DRIVE_EXTERNAL_STORAGE_REQUIRED"; - default: - return "UNKNOWN_ERROR_CODE(" + statusCode + ")"; - } - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } else if (!(o instanceof ConnectionResult)) { - return false; - } else { - ConnectionResult r = (ConnectionResult)o; - return statusCode == r.statusCode && pendingIntent == null ? r.pendingIntent == null : pendingIntent.equals(r.pendingIntent) && TextUtils.equals(message, r.message); - } - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{statusCode, pendingIntent, message}); - } - - /** - * Returns {@code true} if calling {@link #startResolutionForResult(Activity, int)} will start - * any intents requiring user interaction. - * - * @return {@code true} if there is a resolution that can be started. - */ - public boolean hasResolution() { - return statusCode != 0 && pendingIntent != null; - } - - /** - * Resolves an error by starting any intents requiring user interaction. See - * {@link #SIGN_IN_REQUIRED}, and {@link #RESOLUTION_REQUIRED}. - * - * @param activity An Activity context to use to resolve the issue. The activity's - * {@link Activity#onActivityResult} method will be invoked after the user - * is done. If the resultCode is {@link Activity#RESULT_OK}, the application - * should try to connect again. - * @param requestCode The request code to pass to {@link Activity#onActivityResult}. - * @throws IntentSender.SendIntentException If the resolution intent has been canceled or is no - * longer able to execute the request. - */ - public void startResolutionForResult(Activity activity, int requestCode) throws - IntentSender.SendIntentException { - if (hasResolution()) { - activity.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0); - } - } -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/Feature.java b/play-services-basement/src/main/java/com/google/android/gms/common/Feature.java deleted file mode 100644 index 0a5b0813..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/Feature.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.common; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class Feature extends AutoSafeParcelable { - @Field(1) - private String name; - @Field(2) - private int oldVersion; - @Field(3) - private long version = -1; - - private Feature() { - } - - public Feature(String name, long version) { - this.name = name; - this.version = version; - } - - public String getName() { - return name; - } - - public long getVersion() { - if (version == -1) return oldVersion; - return version; - } - - public static final Creator CREATOR = new AutoSafeParcelable.AutoCreator<>(Feature.class); -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/Scopes.java b/play-services-basement/src/main/java/com/google/android/gms/common/Scopes.java deleted file mode 100644 index a359d6b7..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/Scopes.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - * Notice: Portions of this file are reproduced from work created and shared by Google and used - * according to terms described in the Creative Commons 4.0 Attribution License. - * See https://developers.google.com/readme/policies for details. - */ - -package com.google.android.gms.common; - -import org.microg.gms.common.Hide; - -/** - * OAuth 2.0 scopes for use with Google Play services. See the specific client methods for details on which scopes are required. - */ -public class Scopes { - /** - * OAuth 2.0 scope for viewing a user's basic profile information. - */ - public static final String PROFILE = "profile"; - @Hide - public static final String OPENID = "openid"; - /** - * OAuth 2.0 scope for accessing user's Google account email address. - */ - public static final String EMAIL = "email"; - /** - * OAuth 2.0 scope for accessing the user's name, basic profile info and Google+ profile info. - *

- * When using this scope, your app will have access to: - *

    - *
  • the user's full name, profile picture, Google+ profile ID, age range, and language
  • - *
  • any other publicly available information on the user's Google+ profile
  • - *
- * - * @deprecated We recommend switching to {@link #PROFILE} scope to get the one-tap sign-in experience. Your app will get much higher sign-in completion - * rate by switching to profile scopes because of the streamlined user experience. And your existing users with PLUS_LOGIN grant will not be asked to - * sign-in again. - * If you really need user's age range and locale information (which is the only additional information you can get from PLUS_LOGIN as of - * September 2016), use below scopes in addition to PROFILE:
    - *
  • www.googleapis.com/auth/profile.agerange.read
  • - *
  • www.googleapis.com/auth/profile.language.read
  • - *
- */ - @Deprecated - public static final String PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login"; - /** - * This scope was previously named PLUS_PROFILE. - *

- * When using this scope, it does the following: - *

    - *
  • It lets you know who the currently authenticated user is by letting you replace a Google+ user ID with "me", which represents the authenticated - * user, in any call to the Google+ API.
  • - *
- */ - public static final String PLUS_ME = "https://www.googleapis.com/auth/plus.me"; - /** - * Scope for accessing data from Google Play Games. - */ - public static final String GAMES = "https://www.googleapis.com/auth/games"; - @Hide - public static final String GAMES_LITE = "https://www.googleapis.com/auth/games_lite"; - @Hide - public static final String GAMES_FIRSTPARTY = "https://www.googleapis.com/auth/games.firstparty"; - /** - * Scope for using the CloudSave service. - */ - public static final String CLOUD_SAVE = "https://www.googleapis.com/auth/datastoremobile"; - /** - * Scope for using the App State service. - */ - public static final String APP_STATE = "https://www.googleapis.com/auth/appstate"; - /** - * Scope for access user-authorized files from Google Drive. - */ - public static final String DRIVE_FILE = "https://www.googleapis.com/auth/drive.file"; - /** - * Scope for accessing appfolder files from Google Drive. - */ - public static final String DRIVE_APPFOLDER = "https://www.googleapis.com/auth/drive.appdata"; - @Hide - public static final String FITNESS_ACTIVITY_READ = "https://www.googleapis.com/auth/fitness.activity.read"; - @Hide - public static final String FITNESS_ACTIVITY_READ_WRITE = "https://www.googleapis.com/auth/fitness.activity.write"; - @Hide - public static final String FITNESS_LOCATION_READ = "https://www.googleapis.com/auth/fitness.location.read"; - @Hide - public static final String FITNESS_LOCATION_READ_WRITE = "https://www.googleapis.com/auth/fitness.location.write"; - @Hide - public static final String FITNESS_BODY_READ = "https://www.googleapis.com/auth/fitness.body.read"; - @Hide - public static final String FITNESS_BODY_READ_WRITE = "https://www.googleapis.com/auth/fitness.body.write"; - @Hide - public static final String USERINFO_EMAIL = "https://www.googleapis.com/auth/userinfo.email"; - @Hide - public static final String USERINFO_PROFILE = "https://www.googleapis.com/auth/userinfo.profile"; - @Hide - public static final String USER_BIRTHDAY_READ = "https://www.googleapis.com/auth/user.birthday.read"; - @Hide - public static final String GMAIL_READONLY = "https://www.googleapis.com/auth/gmail.readonly"; -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/api/CommonStatusCodes.java b/play-services-basement/src/main/java/com/google/android/gms/common/api/CommonStatusCodes.java deleted file mode 100644 index 984c6fce..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/api/CommonStatusCodes.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -import org.microg.gms.common.PublicApi; - -@PublicApi -public class CommonStatusCodes { - public static final int SUCCESS = 0; - @Deprecated - public static final int SERVICE_MISSING = 1; - @Deprecated - public static final int SERVICE_VERSION_UPDATE_REQUIRED = 2; - @Deprecated - public static final int SERVICE_DISABLED = 3; - public static final int SIGN_IN_REQUIRED = 4; - public static final int RESOLUTION_REQUIRED = 6; - public static final int INTERNAL_ERROR = 8; - public static final int ERROR = 13; - public static final int INTERRUPTED = 14; - public static final int CANCELED = 16; - -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/api/Releasable.java b/play-services-basement/src/main/java/com/google/android/gms/common/api/Releasable.java deleted file mode 100644 index cbbbd4c7..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/api/Releasable.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -/** - * Represents a resource, or a holder of resources, which may be released once they are no longer needed. - */ -public interface Releasable { - void release(); -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/api/Result.java b/play-services-basement/src/main/java/com/google/android/gms/common/api/Result.java deleted file mode 100644 index 6c4f6921..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/api/Result.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -import org.microg.gms.common.PublicApi; - -/** - * Represents the final result of invoking an API method in Google Play Services. - */ -@PublicApi -public interface Result { - Status getStatus(); -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/api/ResultCallback.java b/play-services-basement/src/main/java/com/google/android/gms/common/api/ResultCallback.java deleted file mode 100644 index f6c46b06..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/api/ResultCallback.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -/** - * An interface for receiving a {@link Result} from a {@link PendingResult} as an asynchronous - * callback. - */ -public interface ResultCallback { - /** - * Called when the {@link Result} is ready. It is the responsibility of each callback to - * release any resources associated with the result. Some result types may implement - * {@link Releasable}, in which case {@link Releasable#release()} should be used to free the - * associated resources. - * - * @param result The result from the API call. May not be null. - */ - void onResult(R result); -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/api/Scope.java b/play-services-basement/src/main/java/com/google/android/gms/common/api/Scope.java deleted file mode 100644 index a90803e7..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/api/Scope.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -import androidx.annotation.NonNull; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * Describes an OAuth 2.0 scope to request. This has security implications for the user, and - * requesting additional scopes will result in authorization dialogs. - */ -@PublicApi -public class Scope extends AutoSafeParcelable { - @SafeParceled(1) - private final int versionCode = 1; - @SafeParceled(2) - private final String scopeUri; - - private Scope() { - scopeUri = null; - } - - /** - * Creates a new scope with the given URI. - */ - public Scope(String scopeUri) { - this.scopeUri = scopeUri; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof Scope)) return false; - assert scopeUri != null; - return scopeUri.equals(((Scope) o).scopeUri); - } - - @Override - public int hashCode() { - assert scopeUri != null; - return scopeUri.hashCode(); - } - - @NonNull - @Override - public String toString() { - assert scopeUri != null; - return scopeUri; - } - - public static final Creator CREATOR = new AutoCreator<>(Scope.class); -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/api/Status.java b/play-services-basement/src/main/java/com/google/android/gms/common/api/Status.java deleted file mode 100644 index 433ef043..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/api/Status.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.api; - -import android.app.PendingIntent; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * Represents the results of work. - */ -@PublicApi -public final class Status extends AutoSafeParcelable implements Result { - @PublicApi(exclude = true) - public static final Status INTERNAL_ERROR = new Status(CommonStatusCodes.INTERNAL_ERROR, "Internal error"); - @PublicApi(exclude = true) - public static final Status CANCELED = new Status(CommonStatusCodes.CANCELED, "Cancelled"); - @PublicApi(exclude = true) - public static final Status SUCCESS = new Status(CommonStatusCodes.SUCCESS, "Success"); - - @SafeParceled(1000) - private final int versionCode = 1; - - @SafeParceled(1) - private final int statusCode; - - private Status() { - statusCode = 0; - } - - /** - * Creates a representation of the status resulting from a GoogleApiClient operation. - * - * @param statusCode The status code. - */ - public Status(int statusCode) { - this(statusCode, null); - } - - /** - * Creates a representation of the status resulting from a GoogleApiClient operation. - * - * @param statusCode The status code. - * @param statusMessage The message associated with this status, or null. - */ - public Status(int statusCode, String statusMessage) { - this(statusCode, statusMessage, null); - } - - /** - * Creates a representation of the status resulting from a GoogleApiClient operation. - * - * @param statusCode The status code. - * @param statusMessage The message associated with this status, or null. - * @param resolution A pending intent that will resolve the issue when started, or null. - */ - public Status(int statusCode, String statusMessage, PendingIntent resolution) { - this.statusCode = statusCode; - } - - /** - * Returns the status of this result. Use {@link #isSuccess()} to determine whether the call - * was successful, and {@link #getStatusCode()} to determine what the error cause was. - *

- * Certain errors are due to failures that can be resolved by launching a particular intent. - * The resolution intent is available via {@link #getResolution()}. - */ - @Override - public Status getStatus() { - return this; - } - - /** - * Returns true if the operation was canceled. - */ - public boolean isCanceled() { - return statusCode == CommonStatusCodes.CANCELED; - } - - public static final Creator CREATOR = new AutoCreator<>(Status.class); -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/internal/BinderWrapper.java b/play-services-basement/src/main/java/com/google/android/gms/common/internal/BinderWrapper.java deleted file mode 100644 index 47ec3949..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/internal/BinderWrapper.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.internal; - -import android.os.IBinder; -import android.os.Parcel; -import android.os.Parcelable; - -public class BinderWrapper implements Parcelable { - public IBinder binder; - - public BinderWrapper(IBinder binder) { - this.binder = binder; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeStrongBinder(binder); - } - - public static final Creator CREATOR = new Creator() { - @Override - public BinderWrapper createFromParcel(Parcel source) { - return new BinderWrapper(source.readStrongBinder()); - } - - @Override - public BinderWrapper[] newArray(int size) { - return new BinderWrapper[size]; - } - }; -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java b/play-services-basement/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java deleted file mode 100644 index a203a99f..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.internal; - -import android.accounts.Account; -import android.os.Bundle; -import android.os.IBinder; - -import com.google.android.gms.common.Feature; -import com.google.android.gms.common.api.Scope; - -import org.microg.gms.common.Constants; -import org.microg.gms.common.GmsService; -import org.microg.safeparcel.AutoSafeParcelable; - -import java.util.Arrays; - -public class GetServiceRequest extends AutoSafeParcelable { - @Field(1) - private final int versionCode = 4; - @Field(2) - public final int serviceId; - @Field(3) - public int gmsVersion; - @Field(4) - public String packageName; - @Field(5) - public IBinder accountAccessor; - @Field(6) - public Scope[] scopes; - @Field(7) - public Bundle extras; - @Field(8) - public Account account; - @Field(9) - private long field9; - @Field(10) - public Feature[] defaultFeatures; - @Field(11) - public Feature[] apiFeatures; - @Field(12) - private boolean field12; - @Field(13) - private int field13; - @Field(14) - private boolean field14; - @Field(15) - private String field15; - - private GetServiceRequest() { - serviceId = -1; - gmsVersion = Constants.GMS_VERSION_CODE; - } - - public GetServiceRequest(int serviceId) { - this.serviceId = serviceId; - this.gmsVersion = Constants.GMS_VERSION_CODE; - this.field12 = true; - } - - @Override - public String toString() { - return "GetServiceRequest{" + - "serviceId=" + GmsService.nameFromServiceId(serviceId) + - ", gmsVersion=" + gmsVersion + - ", packageName='" + packageName + '\'' + - (scopes == null || scopes.length == 0 ? "" : (", scopes=" + Arrays.toString(scopes))) + - (extras == null ? "" : (", extras=" + extras)) + - (account == null ? "" : (", account=" + account)) + - '}'; - } - - public static Creator CREATOR = new AutoCreator(GetServiceRequest.class); -} \ No newline at end of file diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/internal/ValidateAccountRequest.java b/play-services-basement/src/main/java/com/google/android/gms/common/internal/ValidateAccountRequest.java deleted file mode 100644 index 75e59d95..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/internal/ValidateAccountRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.common.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class ValidateAccountRequest extends AutoSafeParcelable { - public static Creator CREATOR = new AutoCreator<>(ValidateAccountRequest.class); -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable.java b/play-services-basement/src/main/java/com/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable.java deleted file mode 100644 index 671c3c4a..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -package com.google.android.gms.common.internal.safeparcel; - -public abstract class AbstractSafeParcelable implements SafeParcelable { - - @SuppressWarnings("unchecked") - public static SafeParcelableCreatorAndWriter findCreator(java.lang.Class tClass) { - java.lang.Class upmostClass = tClass; - while (upmostClass.getEnclosingClass() != null) upmostClass = upmostClass.getEnclosingClass(); - String upmostClassName = upmostClass.getName(); - int idx = upmostClassName.lastIndexOf('.'); - String packagePrefix = idx > 0 ? upmostClassName.substring(0, idx + 1) : ""; - String creatorClassName = packagePrefix + tClass.getSimpleName() + "$000Creator"; - try { - return (SafeParcelableCreatorAndWriter) java.lang.Class.forName(creatorClassName).newInstance(); - } catch (Exception e) { - throw new RuntimeException("No Creator found for " + tClass.getName(), e); - } - } - - @Override - public int describeContents() { - return 0; - } - -} diff --git a/play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java b/play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java deleted file mode 100644 index 9158c941..00000000 --- a/play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.dynamic; - -import android.os.IBinder; - -import androidx.annotation.Nullable; - -import java.lang.reflect.Field; - -public class ObjectWrapper extends IObjectWrapper.Stub { - private final T t; - - public ObjectWrapper(T t) { - this.t = t; - } - - @Nullable - public static Object unwrap(IObjectWrapper obj) { - if (obj == null) { - return null; - } - if (obj instanceof ObjectWrapper) { - return ((ObjectWrapper) obj).t; - } - IBinder binder = obj.asBinder(); - Field[] fields = binder.getClass().getDeclaredFields(); - - if (fields.length < 1) { - throw new IllegalArgumentException("No fields were found"); - } - - // Ignore synthetic field(s) from JaCoCo or elsewhere - // https://www.jacoco.org/jacoco/trunk/doc/faq.html - - @Nullable - Field field = null; - - for (Field currentField : fields) { - if (currentField.isSynthetic()) { - continue; - } - - if (field == null) { - field = currentField; - } else { - throw new IllegalArgumentException("Too many non-synthetic fields were found"); - } - } - - if (field == null) { - throw new IllegalArgumentException("No non-synthetic fields were found"); - } - - if (!field.isAccessible()) { - field.setAccessible(true); - try { - return field.get(binder); - } catch (NullPointerException localNullPointerException) { - throw new IllegalArgumentException("Binder object is null.", - localNullPointerException); - } catch (IllegalArgumentException localIllegalArgumentException) { - throw new IllegalArgumentException("remoteBinder is the wrong class.", - localIllegalArgumentException); - } catch (IllegalAccessException localIllegalAccessException) { - throw new IllegalArgumentException("Could not access the field in remoteBinder.", - localIllegalAccessException); - } - } else { - throw new IllegalArgumentException(); - } - } - - @Nullable - public static T unwrapTyped(IObjectWrapper obj, Class clazz) { - try { - return clazz.cast(unwrap(obj)); - } catch (ClassCastException e) { - return null; - } - } - - public static ObjectWrapper wrap(T t) { - return new ObjectWrapper<>(t); - } -} \ No newline at end of file diff --git a/play-services-basement/src/main/java/org/microg/gms/auth/AuthConstants.java b/play-services-basement/src/main/java/org/microg/gms/auth/AuthConstants.java deleted file mode 100644 index 7de65daf..00000000 --- a/play-services-basement/src/main/java/org/microg/gms/auth/AuthConstants.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.auth; - -public class AuthConstants { - public static final String DEFAULT_ACCOUNT = "<>"; - public static final String SCOPE_GET_ACCOUNT_ID = "^^_account_id_^^"; - public static final String PROVIDER_METHOD_GET_ACCOUNTS = "get_accounts"; - public static final String PROVIDER_METHOD_CLEAR_PASSWORD = "clear_password"; - public static final String PROVIDER_EXTRA_CLEAR_PASSWORD = "clear_password"; - public static final String PROVIDER_EXTRA_ACCOUNTS = "accounts"; - public static final String DEFAULT_ACCOUNT_TYPE = "com.google"; - public static final String GOOGLE_USER_ID = "GoogleUserId"; - public static final String GOOGLE_SIGN_IN_STATUS = "googleSignInStatus"; - public static final String GOOGLE_SIGN_IN_ACCOUNT = "googleSignInAccount"; - public static final String SIGN_IN_ACCOUNT = "signInAccount"; - public static final String ERROR_CODE = "errorCode"; - public static final String SIGN_IN_CREDENTIAL = "sign_in_credential"; - public static final String STATUS = "status"; - public static final String SCOPE_OAUTH2 = "oauth2:"; - public static final String SCOPE_EM_OP_PRO = "oauth2:email openid profile"; - -} diff --git a/play-services-basement/src/main/java/org/microg/gms/common/Constants.java b/play-services-basement/src/main/java/org/microg/gms/common/Constants.java deleted file mode 100644 index 077bdbde..00000000 --- a/play-services-basement/src/main/java/org/microg/gms/common/Constants.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2013-2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import org.microg.gms.basement.BuildConfig; - -public class Constants { - public static final int GMS_VERSION_CODE = (BuildConfig.VERSION_CODE / 1000) * 1000; - public static final String GMS_PACKAGE_NAME = "com.google.android.gms"; - public static final String GMS_PACKAGE_SIGNATURE_SHA1 = "38918a453d07199354f8b19af05ec6562ced5788"; - public static final String GMS_SECONDARY_PACKAGE_SIGNATURE_SHA1 = "bd32424203e0fb25f36b57e5aa356f9bdd1da998"; - - @Deprecated - public static final int MAX_REFERENCE_VERSION = GMS_VERSION_CODE; -} diff --git a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java deleted file mode 100644 index 5fb9f315..00000000 --- a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -public enum GmsService { - UNKNOWN(-2), - ANY(-1), - PEOPLE(5, "com.google.android.gms.people.service.START"), - ACCOUNT(9, "com.google.android.gms.accounts.ACCOUNT_SERVICE"), - ADDRESS(12, "com.google.android.gms.identity.service.BIND"), - AUTH_PROXY(16, "com.google.android.gms.auth.service.START"), - INDEX(21, "com.google.android.gms.icing.INDEX_SERVICE"), - COMMON(39, "com.google.android.gms.common.service.START"), - SIGN_IN(44, "com.google.android.gms.signin.service.START"), - CREDENTIALS(68, "com.google.android.gms.auth.api.credentials.service.START"), -<<<<<<< HEAD -======= - NEARBY_BOOTSTRAP(69, "com.google.android.gms.nearby.bootstrap.service.NearbyBootstrapService.START"), - PLUS_INTERNAL(70), - SOURCE_DEVICE(75, "com.google.android.gms.smartdevice.d2d.SourceDeviceService.START"), - TARGET_DEVICE(76, "com.google.android.gms.smartdevice.d2d.TargetDeviceService.START"), - APP_INVITE(77, "com.google.android.gms.appinvite.service.START"), - TAP_AND_PAY(79, "com.google.android.gms.tapandpay.service.BIND"), - CHROME_SYNC(80, "com.google.android.gms.chromesync.service.START"), - ACCOUNTS(81, "com.google.android.gms.smartdevice.setup.accounts.AccountsService.START"), - CAST_REMOTE_DISPLAY(83, "com.google.android.gms.cast.remote_display.service.START"), - TRUST_AGENT(85, "com.google.android.gms.trustagent.StateApi.START"), - AUTH_SIGN_IN(91, "com.google.android.gms.auth.api.signin.service.START"), - MEASUREMENT(93, "com.google.android.gms.measurement.START"), - FREIGHTER(98, "com.google.android.gms.freighter.service.START"), - GUNS(110, "com.google.android.gms.notifications.service.START"), - BLE(111, "com.google.android.gms.beacon.internal.IBleService.START"), - FIREBASE_AUTH(112, "com.google.firebase.auth.api.gms.service.START"), - APP_INDEXING(113), - GASS(116, "com.google.android.gms.gass.START"), - WORK_ACCOUNT(120), - INSTANT_APPS(121, "com.google.android.gms.instantapps.START"), - CAST_FIRSTPATY(122, "com.google.android.gms.cast.firstparty.START"), - AD_CACHE(123, "com.google.android.gms.ads.service.CACHE"), - SMS_RETRIEVER(126, "com.google.android.gms.auth.api.phone.service.SmsRetrieverApiService.START"), - CRYPT_AUTH(129, "com.google.android.gms.auth.cryptauth.cryptauthservice.START"), - DYNAMIC_LINKS(131, "com.google.firebase.dynamiclinks.service.START"), - FONTS(132, "com.google.android.gms.fonts.service.START"), - ROMANESCO(135, "com.google.android.gms.romanesco.service.START"), - TRAINER(139, "com.google.android.gms.learning.trainer.START"), - FIDO2_REGULAR(148, "com.google.android.gms.fido.fido2.regular.START"), - FIDO2_PRIVILEGED(149, "com.google.android.gms.fido.fido2.privileged.START"), - DATA_DOWNLOAD(152, "com.google.android.mdd.service.START"), - ACCOUNT_DATA(153, "com.google.android.gms.auth.account.data.service.START"), - CONSTELLATION(155, "com.google.android.gms.constellation.service.START"), - AUDIT(154, "com.google.android.gms.audit.service.START"), - SYSTEM_UPDATE(157, "com.google.android.gms.update.START_API_SERVICE"), - MOBSTORE(160, "com.google.android.mobstore.service.START"), - USER_LOCATION(163, "com.google.android.gms.userlocation.service.START"), - AD_HTTP(166, "com.google.android.gms.ads.service.HTTP"), - LANGUAGE_PROFILE(167, "com.google.android.gms.languageprofile.service.START"), - MDNS(168, "com.google.android.gms.mdns.service.START"), - SEMANTIC_LOCATION(173, "com.google.android.gms.semanticlocation.service.START_ODLH"), - FIDO2_ZEROPARTY(180, "com.google.android.gms.fido.fido2.zeroparty.START"), - G1_RESTORE(181, "com.google.android.gms.backup.G1_RESTORE"), - G1_BACKUP(182, "com.google.android.gms.backup.G1_BACKUP"), - OSS_LICENSES(185, "com.google.android.gms.oss.licenses.service.START"), - PAYSE(188, "com.google.android.gms.payse.service.BIND"), - RCS(189, "com.google.android.gms.rcs.START"), - CARRIER_AUTH(191, "com.google.android.gms.carrierauth.service.START"), - SYSTEM_UPDATE_SINGLE_UESR(192, "com.google.android.gms.update.START_SINGLE_USER_API_SERVICE"), - APP_USAGE(193, "com.google.android.gms.appusage.service.START"), - NEARBY_SHARING_2(194, "com.google.android.gms.nearby.sharing.START_SERVICE"), - AD_CONSENT_LOOKUP(195, "com.google.android.gms.ads.service.CONSENT_LOOKUP"), - CREDENTIAL_MANAGER(196, "com.google.android.gms.credential.manager.service.firstparty.START"), - PHONE_INTERNAL(197, "com.google.android.gms.auth.api.phone.service.InternalService.START"), - PAY(198, "com.google.android.gms.pay.service.BIND"), - ASTERISM(199, "com.google.android.gms.asterism.service.START"), - MODULE_RESTORE(201, "com.google.android.gms.backup.GMS_MODULE_RESTORE"), - FACS_CACHE(202, "com.google.android.gms.facs.cache.service.START"), - RECAPTCHA(205, "com.google.android.gms.recaptcha.service.START"), - CONTACT_SYNC(208, "com.google.android.gms.people.contactssync.service.START"), ->>>>>>> 37dd2b59 (Add dummy service for SEMANTIC_LOCATION(173) (#2174)) - IDENTITY_SIGN_IN(212, "com.google.android.gms.auth.api.identity.service.signin.START"), -<<<<<<< HEAD -======= - CREDENTIAL_STORE(214, "com.google.android.gms.fido.credentialstore.internal_service.START"), - MDI_SYNC(215, "com.google.android.gms.mdisync.service.START"), - EVENT_ATTESTATION(216, "com.google.android.gms.ads.identifier.service.EVENT_ATTESTATION"), - SCHEDULER(218, "com.google.android.gms.scheduler.ACTION_PROXY_SCHEDULE"), - AUTHORIZATION(219, "com.google.android.gms.auth.api.identity.service.authorization.START"), - FACS_SYNC(220, "com.google.android.gms.facs.internal.service.START"), - AUTH_CONFIG_SYNC(221, "com.google.android.gms.auth.config.service.START"), - CREDENTIAL_SAVING(223, "com.google.android.gms.auth.api.identity.service.credentialsaving.START"), - GOOGLE_AUTH(224, "com.google.android.gms.auth.account.authapi.START"), - ENTERPRISE_LOADER(225, "com.google.android.gms.enterprise.loader.service.START"), - THUNDERBIRD(226, "com.google.android.gms.thunderbird.service.START"), - NEARBY_EXPOSURE(236, "com.google.android.gms.nearby.exposurenotification.START"), - GMS_COMPLIANCE(257, "com.google.android.gms.gmscompliance.service.START"), - BLOCK_STORE(258, "com.google.android.gms.auth.blockstore.service.START"), - FIDO_SOURCE_DEVICE(262, "com.google.android.gms.fido.sourcedevice.service.START"), - FAST_PAIR(265, "com.google.android.gms.nearby.fastpair.START"), - MATCHSTICK_LIGHTER(268, "com.google.android.gms.matchstick.lighter.service.START"), - FIDO_TARGET_DEVICE_INTERNAL(269, "com.google.android.gms.fido.targetdevice.internal_service.START"), - TELEMETRY(270, "com.google.android.gms.common.telemetry.service.START"), - SECOND_DEVICE_AUTH(275, "com.google.android.gms.setup.auth.SecondDeviceAuth.START"), - LOCATION_SHARING_REPORTER(277, "com.google.android.gms.locationsharingreporter.service.START"), - OCR(279, "com.google.android.gms.ocr.service.START"), - POTOKENS(285, "com.google.android.gms.potokens.service.START"), - OCR_INTERNAL(281, "com.google.android.gms.ocr.service.internal.START"), - APP_SET(300, "com.google.android.gms.appset.service.START"), - MODULE_INSTALL(308, "com.google.android.gms.chimera.container.moduleinstall.ModuleInstallService.START"), - IN_APP_REACH(315, "com.google.android.gms.inappreach.service.START"), - APP_ERRORS(334, "com.google.android.gms.apperrors.service.START_APP_ERROR"), ->>>>>>> 9ee35e3c (Add dummy services for PSEUDONYMOUS_ID(52), GASS(116), ACCOUNT_DATA(153) and APP_SET(300) (#2175)) - ; - - public final int SERVICE_ID; - public final String ACTION; - public final String[] SECONDARY_ACTIONS; - - GmsService(int serviceId, String... actions) { - this.SERVICE_ID = serviceId; - this.ACTION = actions.length > 0 ? actions[0] : null; - this.SECONDARY_ACTIONS = actions; - } - - public static GmsService byServiceId(int serviceId) { - for (GmsService service : values()) { - if (service.SERVICE_ID == serviceId) return service; - } - return UNKNOWN; - } - - public static String nameFromServiceId(int serviceId) { - return byServiceId(serviceId).toString(serviceId); - } - - public String toString(int serviceId) { - if (this != UNKNOWN) return toString(); - return "UNKNOWN(" + serviceId + ")"; - } -} \ No newline at end of file diff --git a/play-services-basement/src/main/java/org/microg/gms/common/PublicApi.java b/play-services-basement/src/main/java/org/microg/gms/common/PublicApi.java deleted file mode 100644 index 92663979..00000000 --- a/play-services-basement/src/main/java/org/microg/gms/common/PublicApi.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.common; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * An class, method or field is named public, if it can be used with the original play services - * client library. - */ -@Retention(RetentionPolicy.SOURCE) -@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) -public @interface PublicApi { - /** - * @return the first version that contains the given class, method or field - */ - String since() default "0"; - - /** - * @return the last version that contains the given class, method or field - */ - String until() default "latest"; - - /** - * Used on a method or field to exclude it from the public api if the corresponding class was - * marked as public api. - * - * @return true if the method or field is not part of the public api - */ - boolean exclude() default false; -} diff --git a/play-services-basement/src/main/java/org/microg/gms/gcm/GcmConstants.java b/play-services-basement/src/main/java/org/microg/gms/gcm/GcmConstants.java deleted file mode 100644 index d96fe90a..00000000 --- a/play-services-basement/src/main/java/org/microg/gms/gcm/GcmConstants.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.gcm; - -public final class GcmConstants { - public static final String ACTION_C2DM_RECEIVE = "com.mgoogle.android.c2dm.intent.RECEIVE"; - public static final String ACTION_C2DM_REGISTER = "com.mgoogle.android.c2dm.intent.REGISTER"; - public static final String ACTION_C2DM_REGISTRATION = "com.mgoogle.android.c2dm.intent.REGISTRATION"; - public static final String ACTION_C2DM_UNREGISTER = "com.mgoogle.android.c2dm.intent.UNREGISTER"; - - public static final String EXTRA_APP = "app"; - public static final String EXTRA_APP_OVERRIDE = "org.microg.gms.gcm.APP_OVERRIDE"; - public static final String EXTRA_APP_VERSION_NAME = "app_ver_name"; - public static final String EXTRA_COLLAPSE_KEY = "collapse_key"; - public static final String EXTRA_DELETE = "delete"; - public static final String EXTRA_ERROR = "error"; - public static final String EXTRA_FROM = "from"; - public static final String EXTRA_KID = "kid"; - public static final String EXTRA_MESSENGER = "google.messenger"; - public static final String EXTRA_MESSAGE_ID = "google.message_id"; - public static final String EXTRA_REGISTRATION_ID = "registration_id"; - public static final String EXTRA_RETRY_AFTER = "Retry-After"; - public static final String EXTRA_SENDER = "sender"; - public static final String EXTRA_SEND_TO = "google.to"; - public static final String EXTRA_SEND_FROM = "google.from"; - public static final String EXTRA_TTL = "google.ttl"; - public static final String EXTRA_UNREGISTERED = "unregistered"; - - public static final String ERROR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAILABLE"; -} diff --git a/play-services-basement/src/main/kotlin/com/google/android/gms/dynamic/ObjectWrapper.kt b/play-services-basement/src/main/kotlin/com/google/android/gms/dynamic/ObjectWrapper.kt deleted file mode 100644 index 27996b8f..00000000 --- a/play-services-basement/src/main/kotlin/com/google/android/gms/dynamic/ObjectWrapper.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.gms.dynamic - diff --git a/play-services-core-proto/build.gradle b/play-services-core-proto/build.gradle deleted file mode 100644 index 6edfcb4b..00000000 --- a/play-services-core-proto/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -apply plugin: 'com.squareup.wire' -apply plugin: 'kotlin' - -dependencies { - implementation "com.squareup.wire:wire-runtime:$wireVersion" -} - -wire { - kotlin { - javaInterop = true - } -} - -sourceSets { - main.java.srcDirs += "$buildDir/generated/source/wire" -} - -compileKotlin { - kotlinOptions.jvmTarget = 17 -} - -compileTestKotlin { - kotlinOptions.jvmTarget = 17 -} \ No newline at end of file diff --git a/play-services-core-proto/src/main/proto/appcert.proto b/play-services-core-proto/src/main/proto/appcert.proto deleted file mode 100644 index ee02bf55..00000000 --- a/play-services-core-proto/src/main/proto/appcert.proto +++ /dev/null @@ -1,32 +0,0 @@ -option java_package = "org.microg.gms.auth.appcert"; -option java_outer_classname = "AppCertProto"; - -message DeviceKeyRequest { - optional uint64 androidId = 2; - optional uint64 sessionId = 3; - message VersionInfo { - optional fixed32 sdkVersion = 1; - optional fixed32 gmsVersion = 2; - } - optional VersionInfo versionInfo = 4; - optional string token = 6; -} - -message DeviceKey { - optional uint64 keyId = 1; - optional uint64 deviceId = 3; - optional bytes macSecret = 4; - optional bytes keyCert = 5; -} - -message SpatulaHeaderProto { - message PackageInfo { - optional string packageName = 1; - optional string packageCertificateHash = 3; - } - optional PackageInfo packageInfo = 1; - optional bytes hmac = 2; - optional uint64 deviceId = 3; - optional uint64 keyId = 4; - optional bytes keyCert = 5; -} diff --git a/play-services-core-proto/src/main/proto/auth.proto b/play-services-core-proto/src/main/proto/auth.proto deleted file mode 100644 index d6c759f0..00000000 --- a/play-services-core-proto/src/main/proto/auth.proto +++ /dev/null @@ -1,58 +0,0 @@ -option java_package = "org.microg.gms.auth"; - -option java_outer_classname = "AuthProto"; - -message ConsentData { - message AppDetails { - optional string title = 1; - optional string email = 3; - } - optional AppDetails app = 1; - message ScopeDetails { - optional string title = 1; - optional string description = 2; - optional string id = 6; - } - repeated ScopeDetails scopes = 2; -} - -message RequestOptions { -// optional bool field_1 = 1; -// optional string field_2 = 2; -// optional string field_3 = 3; -// optional int32 field_4 = 4; -// optional int32 field_5 = 5; - optional int32 remote = 7; - optional int32 version = 10; - optional string sessionId = 11; -// optional bool field_12 = 12; -} - -message ConsentUrlResponse { - optional int32 resultCode = 2; - optional string consentUrl = 3; - optional Cookie cookie = 4; -} - -message ConsentCookiesResponse { - optional ConsentCookies consentCookies = 1; -} - -message ConsentCookies { - optional int32 resultCode = 1; - repeated Cookie cookies = 2; -} - -message Cookie { - optional string cookieName = 1; - optional string cookieValue = 2; - optional string domain = 3; - optional string path = 4; - optional int64 sameSite = 5; - optional int64 secure = 6; - optional int64 httpOnly = 7; - optional int64 maxAge = 8; - optional int64 version = 9; - optional string discard = 10; - optional string comment = 12; -} diff --git a/play-services-core-proto/src/main/proto/checkin.proto b/play-services-core-proto/src/main/proto/checkin.proto deleted file mode 100644 index 5b1e8141..00000000 --- a/play-services-core-proto/src/main/proto/checkin.proto +++ /dev/null @@ -1,270 +0,0 @@ -option java_package = "org.microg.gms.checkin"; - -option java_outer_classname = "CheckinProto"; - -// Sample data, if provided, is fished from a Nexus 7 (2013) / flo running Android 5.0 -message CheckinRequest { - // unused - optional string imei = 1; - - // Gservices["android_id"] or 0 on first-checkin - optional int64 androidId = 2; - - // Gservices["digest"] or "" - optional string digest = 3; - - required Checkin checkin = 4; - message Checkin { - // empty Build on pre-checkin - required Build build = 1; - message Build { - // Build.FINGERPRINT - // eg. google/razor/flo:5.0.1/LRX22C/1602158:user/release-keys - optional string fingerprint = 1; - - // Build.HARDWARE - // eg. flo - optional string hardware = 2; - - // Build.BRAND - // eg. google - optional string brand = 3; - - // Build.getRadioVersion() - optional string radio = 4; - - // Build.BOOTLOADER - // eg. FLO-04.04 - optional string bootloader = 5; - - // GoogleSettingsContract.Partner["client_id"] - // eg. android-google - optional string clientId = 6; - - // Build.TIME / 1000L - // eg. 1416533192 - optional int64 time = 7; - - // PackageInfo.versionCode - // eg. 6188736 - optional int32 packageVersionCode = 8; - - // Build.DEVICE - // eg. flo - optional string device = 9; - - // Build.VERSION.SDK_INT - // eg. 21 - optional int32 sdkVersion = 10; - - // Build.MODEL - // eg. Nexus 7 - optional string model = 11; - - // Build.MANUFACTURER - // eg. asus - optional string manufacturer = 12; - - // Build.PRODUCT - // eg. razor - optional string product = 13; - - // fileExists("/system/recovery-from-boot.p") - // eg. false - optional bool otaInstalled = 14; - } - - // last checkin ms or 0 if first checkin - // eg. 0 - optional int64 lastCheckinMs = 2; - - // eg. ("event_log_start",~,1424612602652) on first checkin - repeated Event event = 3; - message Event { - optional string tag = 1; - optional string value = 2; - optional int64 timeMs = 3; - } - - // unknown, n/a on first checkin - repeated Statistic stat = 4; - message Statistic { - required string tag = 1; - optional int32 count = 2; - optional float sum = 3; - } - - // unused - repeated string requestedGroup = 5; - - // TelephonyManager.getNetworkOperator != null|empty - optional string cellOperator = 6; - - // TelephonyManager.getSimOperator != null|empty - optional string simOperator = 7; - - // "WIFI::" | ("mobile" | "notmobile" | "unknown") + "-" + ("roaming" | "notroaming" | "unknown") - optional string roaming = 8; - - // UserHandle.myUserId - // eg. 0 - optional int32 userNumber = 9; - } - - // unused - optional string desiredBuild = 5; - - // Locale.toString - optional string locale = 6; - - // GoogleSettingsContract.Partner["logging_id2"] (choosen randomly on first checkin) - // eg. 12561488293572742346 - optional int64 loggingId = 7; - - // unused - optional string marketCheckin = 8; - - // NetworkInfo.getExtraInfo, WifiInfo.getMacAddress (12 hex-digits) - // eg. d850e6abcdef - repeated string macAddress = 9; - - // TelephonyManager.getDeviceId (14 hex-digits), not set on tablets - optional string meid = 10; - - // "[]" followed by "", empty string on first checkin - repeated string accountCookie = 11; - - // TimeZone.getId - // eg. GMT - optional string timeZone = 12; - - // security token as given on first checkin, not set on first checkin - optional fixed64 securityToken = 13; - - // use 3 - optional int32 version = 14; - - // SHA-1 of each in /system/etc/security/otacerts.zip or "--IOException--" or "--no-output--" - // eg. dKXTm1QH9QShGQwBM/4rg6/lCNQ= - repeated string otaCert = 15; - - // Build.SERIAL != "unknown" - // eg. 07d90b18 - optional string serial = 16; - - // TelephonyManager.getDeviceId (8 hex-digits), not set on tablets - optional string esn = 17; - - optional DeviceConfig deviceConfiguration = 18; - message DeviceConfig { - // ConfigurationInfo.reqTouchScreen - // eg. 3 - optional int32 touchScreen = 1; - - // ConfigurationInfo.reqKeyboardType - // eg. 1 - optional int32 keyboardType = 2; - - // ConfigurationInfo.reqNavigation - // eg. 1 - optional int32 navigation = 3; - // ConfigurationInfo.screenLayout - // eg. 3 - optional int32 screenLayout = 4; - - // ConfigurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD - // eg. 0 - optional bool hasHardKeyboard = 5; - - // ConfigurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV - // eg. 0 - optional bool hasFiveWayNavigation = 6; - - // DisplayMetrics.densityDpi - // eg. 320 - optional int32 densityDpi = 7; - - // ConfigurationInfo.reqGlEsVersion - // eg. 196608 - optional int32 glEsVersion = 8; - - // PackageManager.getSystemSharedLibraryNames - // eg. "android.test.runner", "com.android.future.usb.accessory", - // "com.android.media.remotedisplay", "com.android.mediadrm.signer", "com.google.android.maps", - // "com.google.android.media.effects", "com.google.widevine.software.drm", "javax.obex" - repeated string sharedLibrary = 9; - - // PackageManager.getSystemAvailableFeatures - // eg. android.hardware.[...] - repeated string availableFeature = 10; - - // Build.CPU_ABI and Build.CPU_ABI2 != "unknown" - // eg. "armeabi-v7a", "armeabi" - repeated string nativePlatform = 11; - - // DisplayMetrics.widthPixels - // eg. 1200 - optional int32 widthPixels = 12; - - // DisplayMetrics.heightPixels - // eg. 1824 - optional int32 heightPixels = 13; - - // Context.getAssets.getLocales - // eg. [...], "en-US", [...] - repeated string locale = 14; - - // GLES10.glGetString(GLES10.GL_EXTENSIONS) - // eg. "GL_AMD_compressed_ATC_texture", [...] - repeated string glExtension = 15; - - // unused - optional int32 deviceClass = 16; - // unused - optional int32 maxApkDownloadSizeMb = 17; - } - - // "ethernet" or "wifi" - repeated string macAddressType = 19; - - // unknown, use 0 on pre- and first-checkin, and 1 for later checkins - // also present on pre-checkin - required int32 fragment = 20; - - // unknown - optional string userName = 21; - - // UserManager.getUserSerialNumber - // eg. 0 - optional int32 userSerialNumber = 22; -} - -message CheckinResponse { - optional bool statsOk = 1; - repeated Intent intent = 2; - message Intent { - optional string action = 1; - optional string dataUri = 2; - optional string mimeType = 3; - optional string javaClass = 4; - repeated Extra extra = 5; - message Extra { - optional string name = 6; - optional string value = 7; - } - } - optional int64 timeMs = 3; - optional string digest = 4; - repeated GservicesSetting setting = 5; - message GservicesSetting { - optional bytes name = 1; - optional bytes value = 2; - } - optional bool marketOk = 6; - optional fixed64 androidId = 7; - optional fixed64 securityToken = 8; - optional bool settingsDiff = 9; - repeated string deleteSetting = 10; - optional string versionInfo = 11; - optional string deviceDataVersionInfo = 12; -} diff --git a/play-services-core-proto/src/main/proto/mcs.proto b/play-services-core-proto/src/main/proto/mcs.proto deleted file mode 100644 index 590f7138..00000000 --- a/play-services-core-proto/src/main/proto/mcs.proto +++ /dev/null @@ -1,270 +0,0 @@ -// Derived from mcs.proto in chromium source code. Original license text below. - -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// MCS protocol for communication between Chrome client and Mobile Connection -// Server . - -option java_package = "org.microg.gms.gcm.mcs"; - -/* - Common fields/comments: - - stream_id: no longer sent by server, each side keeps a counter - last_stream_id_received: sent only if a packet was received since last time - a last_stream was sent - status: new bitmask including the 'idle' as bit 0. - - */ - -/** - TAG: 0 - */ -message HeartbeatPing { - optional int32 stream_id = 1; - optional int32 last_stream_id_received = 2; - optional int64 status = 3; -} - -/** - TAG: 1 - */ -message HeartbeatAck { - optional int32 stream_id = 1; - optional int32 last_stream_id_received = 2; - optional int64 status = 3; -} - -message ErrorInfo { - required int32 code = 1; - optional string message = 2; - optional string type = 3; - optional Extension extension = 4; -} - -// MobileSettings class. -// "u:f", "u:b", "u:s" - multi user devices reporting foreground, background -// and stopped users. -// hbping: heatbeat ping interval -// rmq2v: include explicit stream IDs - -message Setting { - required string name = 1; - required string value = 2; -} - -message HeartbeatStat { - required string ip = 1; - required bool timeout = 2; - required int32 interval_ms = 3; -} - -message HeartbeatConfig { - optional bool upload_stat = 1; - optional string ip = 2; - optional int32 interval_ms = 3; -} - -/** - TAG: 2 - */ -message LoginRequest { - enum AuthService { - ANDROID_ID = 2; - } - required string id = 1; // Must be present ( proto required ), may be empty - // string. - // mcs.android.com. - required string domain = 2; - // Decimal android ID - required string user = 3; - - required string resource = 4; - - // Secret - required string auth_token = 5; - - // Format is: android-HEX_DEVICE_ID - // The user is the decimal value. - optional string device_id = 6; - - // RMQ1 - no longer used - optional int64 last_rmq_id = 7; - - repeated Setting setting = 8; - optional int32 compress = 9; - repeated string received_persistent_id = 10; - - // Replaced by "rmq2v" setting - optional bool include_stream_ids = 11; - - optional bool adaptive_heartbeat = 12; - optional HeartbeatStat heartbeat_stat = 13; - // Must be true. - optional bool use_rmq2 = 14; - optional int64 account_id = 15; - - // ANDROID_ID = 2 - optional AuthService auth_service = 16; - - optional int32 network_type = 17; - optional int64 status = 18; -} - -/** - * TAG: 3 - */ -message LoginResponse { - required string id = 1; - // Not used. - optional string jid = 2; - // Null if login was ok. - optional ErrorInfo error = 3; - repeated Setting setting = 4; - optional int32 stream_id = 5; - // Should be "1" - optional int32 last_stream_id_received = 6; - optional HeartbeatConfig heartbeat_config = 7; - // used by the client to synchronize with the server timestamp. - optional int64 server_timestamp = 8; -} - -message StreamErrorStanza { - required string type = 1; - optional string text = 2; -} - -/** - * TAG: 4 - */ -message Close { -} - -message Extension { - // 12: SelectiveAck - // 13: StreamAck - required int32 id = 1; - required bytes data = 2; -} - -/** - * TAG: 7 - * IqRequest must contain a single extension. IqResponse may contain 0 or 1 - * extensions. - */ -message IqStanza { - enum IqType { - GET = 0; - SET = 1; - RESULT = 2; - IQ_ERROR = 3; - } - - optional int64 rmq_id = 1; - required IqType type = 2; - required string id = 3; - optional string from = 4; - optional string to = 5; - optional ErrorInfo error = 6; - - // Only field used in the 38+ protocol (besides common last_stream_id_received, status, rmq_id) - optional Extension extension = 7; - - optional string persistent_id = 8; - optional int32 stream_id = 9; - optional int32 last_stream_id_received = 10; - optional int64 account_id = 11; - optional int64 status = 12; -} - -message AppData { - required string key = 1; - required string value = 2; -} - -/** - * TAG: 8 - */ -message DataMessageStanza { - // Not used. - optional int64 rmq_id = 1; - - // This is the message ID, set by client, DMP.9 (message_id) - optional string id = 2; - - // Project ID of the sender, DMP.1 - required string from = 3; - - // Part of DMRequest - also the key in DataMessageProto. - optional string to = 4; - - // Package name. DMP.2 - required string category = 5; - - // The collapsed key, DMP.3 - optional string token = 6; - - // User data + GOOGLE. prefixed special entries, DMP.4 - repeated AppData app_data = 7; - - // Not used. - optional bool from_trusted_server = 8; - - // Part of the ACK protocol, returned in DataMessageResponse on server side. - // It's part of the key of DMP. - optional string persistent_id = 9; - - // In-stream ack. Increments on each message sent - a bit redundant - // Not used in DMP/DMR. - optional int32 stream_id = 10; - optional int32 last_stream_id_received = 11; - - // Not used. - optional string permission = 12; - - // Sent by the device shortly after registration. - optional string reg_id = 13; - - // Not used. - optional string pkg_signature = 14; - // Not used. - optional string client_id = 15; - - // serial number of the target user, DMP.8 - // It is the 'serial number' according to user manager. - optional int64 device_user_id = 16; - - // Time to live, in seconds. - optional int32 ttl = 17; - // Timestamp ( according to client ) when message was sent by app, in seconds - optional int64 sent = 18; - - // How long has the message been queued before the flush, in seconds. - // This is needed to account for the time difference between server and - // client: server should adjust 'sent' based on his 'receive' time. - optional int32 queued = 19; - - optional int64 status = 20; - - optional bytes raw_data = 21; - - optional int32 delay = 22; -} - -/** - Included in IQ with ID 13, sent from client or server after 10 unconfirmed - messages. - */ -message StreamAck { - // No last_streamid_received required. This is included within an IqStanza, - // which includes the last_stream_id_received. -} - -/** - Included in IQ sent after LoginResponse from server with ID 12. -*/ -message SelectiveAck { - repeated string id = 1; -} diff --git a/play-services-core-proto/src/main/proto/potoken.proto b/play-services-core-proto/src/main/proto/potoken.proto deleted file mode 100644 index 98475912..00000000 --- a/play-services-core-proto/src/main/proto/potoken.proto +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -option java_package = "com.google.android.gms.potokens"; - -option java_multiple_files = true; - -message CipherKey { - optional int32 key = 1; - optional bytes value = 3; -} - -message KeyData { - optional string typeUrl = 1; - optional CipherKey value = 2; - optional int32 keyMaterialType = 3; -} - -message Key { - optional KeyData data = 1; - optional int32 status = 2; - optional int32 keyId = 3; - optional int32 outputPrefixType = 4; -} - -message KeySet { - optional int32 keyId = 1; - repeated Key keyList = 2; -} - -message PoTokenInfo { - optional int32 key = 6; - optional int32 time = 1; - optional bytes inputData = 2; - optional string pkgName = 3; - optional bytes pkgSignSha256 = 4; - optional bytes tokenData = 5; -} - -message GetPoIntegrityTokenRequest { - optional int32 mode = 1; - optional bytes dgResult = 2; - optional bytes dgRandKey = 3; -} - -message GetPoIntegrityTokenResponse { - optional bytes desc = 1; - optional int32 code = 2; - optional bytes backup = 3; -// optional bytes d = 4; -// optional bytes e = 5; -} - -message PoTokenResult { - optional bytes encryptData = 1; - optional bytes tokenData = 2; -} - -message PoTokenResultWrap { - optional PoTokenResult data = 1; -} diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle deleted file mode 100644 index cae9eb8b..00000000 --- a/play-services-core/build.gradle +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2013-2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -dependencies { - implementation "com.squareup.wire:wire-runtime:$wireVersion" -<<<<<<< HEAD - implementation "de.hdodenhof:circleimageview:$circleimageviewVersion" -======= - implementation "de.hdodenhof:circleimageview:1.3.0" - - implementation project(':fake-signature') - implementation project(':firebase-dynamic-links') - implementation project(':firebase-auth-core') - implementation project(':play-services-ads-core') - implementation project(':play-services-ads-identifier-core') - implementation project(':play-services-ads-lite-core') - implementation project(':play-services-appinvite-core') - implementation project(':play-services-appset-core') - implementation project(':play-services-auth-api-phone-core') - implementation project(':play-services-base-core') - implementation project(':play-services-cast-core') - implementation project(':play-services-cast-framework-core') - implementation project(':play-services-conscrypt-provider-core') - implementation project(':play-services-cronet-core') - implementation project(':play-services-droidguard-core') - implementation project(':play-services-fido-core') - implementation project(':play-services-gmscompliance-core') - implementation project(':play-services-location-core') - implementation project(':play-services-location-core-base') - implementation project(':play-services-oss-licenses-core') - implementation project(':play-services-panorama-core') - implementation project(':play-services-pay-core') - implementation project(':play-services-recaptcha-core') - implementation project(':play-services-safetynet-core') - implementation project(':play-services-tapandpay-core') - implementation project(':play-services-vision-core') - implementation project(':play-services-wearable-core') - - implementation project(':play-services-core-proto') - - implementation project(':play-services-core:microg-ui-tools') // deprecated - implementation project(':play-services-base-core-package') - implementation project(':play-services-api') - - implementation project(':play-services-appinvite') - implementation project(':play-services-auth-base') - implementation project(':play-services-auth') - implementation project(':play-services-clearcut') - implementation project(':play-services-drive') - implementation project(':play-services-games') - implementation project(':play-services-maps') - implementation project(':play-services-measurement-base') - implementation project(':play-services-places') - implementation project(':play-services-recaptcha') - implementation project(':play-services-safetynet') - implementation project(':play-services-tasks-ktx') - implementation project(':play-services-fitness') - - mapboxRuntimeOnly project(':play-services-maps-core-mapbox') - vtmRuntimeOnly project(':play-services-maps-core-vtm') - defaultRuntimeOnly project(':play-services-location-core-provider') - - if (hasModule("nearby", true)) runtimeOnly project(':play-services-nearby-core-package') - if (hasModule("hms", false)) hmsRuntimeOnly project(':play-services-maps-core-hms') - - // AndroidX UI - implementation "androidx.multidex:multidex:$multidexVersion" - implementation "androidx.appcompat:appcompat:$appcompatVersion" - implementation "androidx.mediarouter:mediarouter:$mediarouterVersion" - implementation "androidx.preference:preference-ktx:$preferenceVersion" ->>>>>>> 1b34bbd3 (Add dummy service for PANORAMA(3) (#2173)) - implementation "androidx.webkit:webkit:$webkitVersion" - -<<<<<<< HEAD - implementation project(':play-services-base-core') - implementation project(':play-services-core-proto') - implementation project(':play-services-core:microg-ui-tools') // deprecated - implementation project(':play-services-api') - implementation project(':play-services-tasks') - - // AndroidX UI - implementation "androidx.appcompat:appcompat:$appcompatVersion" - implementation "androidx.preference:preference-ktx:$preferenceVersion" - - implementation 'org.microg.gms:conscrypt-gmscore:2.5.2' -======= - // Material Components ->>>>>>> 48e0b00a (Update build tools and dependencies) - implementation "com.google.android.material:material:$materialVersion" - - // Navigation - implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion" - implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion" - - implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion" - implementation "com.android.volley:volley:$volleyVersion" - - api project(':play-services-basement') -} - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion androidBuildVersionTools - - defaultConfig { - versionName version - versionCode appVersionCode - resConfigs 'xxhdpi' - - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - - ndk { - abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64" - } - - } - - buildFeatures { - dataBinding = true - viewBinding = true - } - - sourceSets { - main { - java.srcDirs += 'src/main/kotlin' - } - } - - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - packagingOptions { - jniLibs { - useLegacyPackaging false - } - resources { - excludes += ['META-INF/ASL2.0'] - } - } - lint { - disable 'MissingTranslation', 'BatteryLife', 'ImpliedQuantity', 'MissingQuantity', 'InvalidWakeLockTag', 'Range' - } - namespace 'com.mgoogle.android.gms' -} - -if (file('user.gradle').exists()) { - apply from: 'user.gradle' -} \ No newline at end of file diff --git a/play-services-core/microg-ui-tools/build.gradle b/play-services-core/microg-ui-tools/build.gradle deleted file mode 100644 index d9a5c2bb..00000000 --- a/play-services-core/microg-ui-tools/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2013-2016 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion androidBuildVersionTools - - defaultConfig { - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = 11 - targetCompatibility = 11 - } - lint { - disable 'MissingTranslation' - } - namespace 'org.microg.tools.ui' - -} - -dependencies { - implementation "androidx.appcompat:appcompat:$appcompatVersion" - implementation "androidx.preference:preference:$preferenceVersion" - implementation "com.google.android.material:material:$materialVersion" -} - diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractAboutFragment.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractAboutFragment.java deleted file mode 100644 index 2c4c2399..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractAboutFragment.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import android.content.Context; -import android.content.pm.PackageManager; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; -<<<<<<< HEAD - -import androidx.annotation.NonNull; -======= ->>>>>>> bfabc38e (About: Fix scrolling) -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -public abstract class AbstractAboutFragment extends Fragment { - - protected abstract void collectLibraries(List libraries); - - public static Drawable getIcon(Context context) { - try { - PackageManager pm = context.getPackageManager(); - return pm.getPackageInfo(context.getPackageName(), 0).applicationInfo.loadIcon(pm); - } catch (PackageManager.NameNotFoundException e) { - // Never happens, self package always exists! - throw new RuntimeException(e); - } - } - - public static String getAppName(Context context) { - try { - PackageManager pm = context.getPackageManager(); - CharSequence label = pm.getPackageInfo(context.getPackageName(), 0).applicationInfo.loadLabel(pm); - if (TextUtils.isEmpty(label)) return context.getPackageName(); - return label.toString().trim(); - } catch (PackageManager.NameNotFoundException e) { - // Never happens, self package always exists! - throw new RuntimeException(e); - } - } - - protected String getAppName() { - return getAppName(requireContext()); - } - - public static String getLibVersion(String packageName) { - try { - String versionName = (String) Class.forName(packageName + ".BuildConfig").getField("VERSION_NAME").get(null); - if (TextUtils.isEmpty(versionName)) return ""; - return versionName.trim(); - } catch (Exception e) { - return ""; - } - } - - public static String getSelfVersion(Context context) { - return getLibVersion(context.getPackageName()); - } - - protected String getSelfVersion() { - return getSelfVersion(requireContext()); - } - - protected String getSummary() { - return null; - } - - @Nullable - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View aboutRoot = inflater.inflate(R.layout.about_root, container, false); - ((ImageView) aboutRoot.findViewById(android.R.id.icon)).setImageDrawable(getIcon(requireContext())); - ((TextView) aboutRoot.findViewById(android.R.id.title)).setText(getAppName()); - ((TextView) aboutRoot.findViewById(R.id.about_version)).setText(getString(R.string.about_version_str, getSelfVersion())); - String summary = getSummary(); - if (summary != null) { - ((TextView) aboutRoot.findViewById(android.R.id.summary)).setText(summary); - aboutRoot.findViewById(android.R.id.summary).setVisibility(View.VISIBLE); - } - - List libraries = new ArrayList<>(); - collectLibraries(libraries); - Collections.sort(libraries); -<<<<<<< HEAD - ((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[0]))); - -======= - ViewGroup list = aboutRoot.findViewById(android.R.id.list); - for (Library library : libraries) { - View v = inflater.inflate(android.R.layout.simple_list_item_2, list, false); - ((TextView) v.findViewById(android.R.id.text1)).setText(getString(R.string.about_name_version_str, library.name, getLibVersion(library.packageName))); - ((TextView) v.findViewById(android.R.id.text2)).setText(library.copyright != null ? library.copyright : getString(R.string.about_default_license)); - list.addView(v); - } ->>>>>>> bfabc38e (About: Fix scrolling) - return aboutRoot; - } - - protected static class Library implements Comparable { - private final String packageName; - private final String name; - private final String copyright; - - public Library(String packageName, String name, String copyright) { - this.packageName = packageName; - this.name = name; - this.copyright = copyright; - } - - @NonNull - @Override - public String toString() { - return name + ", " + copyright; - } - - @Override - public int compareTo(Library another) { - return name.toLowerCase(Locale.US).compareTo(another.name.toLowerCase(Locale.US)); - } - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractDashboardActivity.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractDashboardActivity.java deleted file mode 100644 index 85bc123f..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractDashboardActivity.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.microg.tools.ui; - -import android.os.Bundle; -import android.view.ViewGroup; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.fragment.app.Fragment; - -import java.util.ArrayList; -import java.util.List; - -public abstract class AbstractDashboardActivity extends AppCompatActivity { - protected int preferencesResource = 0; - - private final List conditions = new ArrayList<>(); - private ViewGroup conditionContainer; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.dashboard_activity); - conditionContainer = (ViewGroup) findViewById(R.id.condition_container); - - getSupportFragmentManager().beginTransaction() - .replace(R.id.content_wrapper, getFragment()) - .commit(); - } - - @Override - protected void onResume() { - super.onResume(); - forceConditionReevaluation(); - } - - private synchronized void resetConditionViews() { - conditionContainer.removeAllViews(); - for (Condition condition : conditions) { - if (condition.isEvaluated()) { - if (condition.isActive(this)) { - addConditionToView(condition); - } - } else { - evaluateConditionAsync(condition); - } - } - } - - private void evaluateConditionAsync(final Condition condition) { - if (condition.willBeEvaluating()) { - new Thread(() -> { - if (condition.isActive(AbstractDashboardActivity.this)) { - runOnUiThread(() -> { - if (conditions.contains(condition) && condition.isEvaluated()) { - addConditionToView(condition); - } - }); - } - }).start(); - } - } - - protected void forceConditionReevaluation() { - for (Condition condition : conditions) { - condition.resetEvaluated(); - } - resetConditionViews(); - } - - private synchronized void addConditionToView(Condition condition) { - for (int i = 0; i < conditionContainer.getChildCount(); i++) { - if (conditionContainer.getChildAt(i).getTag() == condition) return; - } - conditionContainer.addView(condition.createView(this, conditionContainer)); - } - - protected Fragment getFragment() { - if (preferencesResource == 0) { - throw new IllegalStateException("Neither preferencesResource given, nor overriden getFragment()"); - } - ResourceSettingsFragment fragment = new ResourceSettingsFragment(); - Bundle b = new Bundle(); - b.putInt(ResourceSettingsFragment.EXTRA_PREFERENCE_RESOURCE, preferencesResource); - fragment.setArguments(b); - return fragment; - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractSettingsActivity.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractSettingsActivity.java deleted file mode 100644 index db1da7b2..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractSettingsActivity.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.microg.tools.ui; - -import android.os.Bundle; -import android.view.MenuItem; -import android.view.ViewGroup; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.fragment.app.Fragment; - -import java.util.Objects; - -public abstract class AbstractSettingsActivity extends AppCompatActivity { - protected boolean showHomeAsUp = false; - protected int preferencesResource = 0; - protected int customBarLayout = 0; - protected SwitchBar switchBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.settings_activity); - if (showHomeAsUp) { - Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); - } - - switchBar = (SwitchBar) findViewById(R.id.switch_bar); - - ViewGroup customBarContainer = (ViewGroup) findViewById(R.id.custom_bar); - if (customBarLayout != 0) { - customBarContainer.addView(getLayoutInflater().inflate(customBarLayout, customBarContainer, false)); - } - - getSupportFragmentManager().beginTransaction() - .replace(R.id.content_wrapper, getFragment()) - .commit(); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } - - protected Fragment getFragment() { - if (preferencesResource == 0) { - throw new IllegalStateException("Neither preferencesResource given, nor overriden getFragment()"); - } - ResourceSettingsFragment fragment = new ResourceSettingsFragment(); - Bundle b = new Bundle(); - b.putInt(ResourceSettingsFragment.EXTRA_PREFERENCE_RESOURCE, preferencesResource); - fragment.setArguments(b); - return fragment; - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractSettingsFragment.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractSettingsFragment.java deleted file mode 100644 index 78ac70b0..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractSettingsFragment.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; -import androidx.preference.Preference; -import androidx.preference.PreferenceFragmentCompat; - -public abstract class AbstractSettingsFragment extends PreferenceFragmentCompat { - private static final String TAG = AbstractSettingsFragment.class.getSimpleName(); - - private static final String DIALOG_FRAGMENT_TAG = "androidx.preference.PreferenceFragment.DIALOG"; - - @Override - public void onDisplayPreferenceDialog(@NonNull Preference preference) { - if (preference instanceof DialogPreference) { - DialogFragment f = DialogPreference.DialogPreferenceCompatDialogFragment.newInstance(preference.getKey()); - f.setTargetFragment(this, 0); - assert getFragmentManager() != null; - f.show(getFragmentManager(), DIALOG_FRAGMENT_TAG); - } else { - super.onDisplayPreferenceDialog(preference); - } - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/Condition.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/Condition.java deleted file mode 100644 index c94b3bd6..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/Condition.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.DrawableRes; -import androidx.annotation.PluralsRes; -import androidx.annotation.StringRes; -import androidx.core.content.res.ResourcesCompat; - -public class Condition { - @DrawableRes - private final int iconRes; - private final Drawable icon; - - @StringRes - private final int titleRes; - @PluralsRes - private final int titlePluralsRes; - private final CharSequence title; - - @StringRes - private final int summaryRes; - @PluralsRes - private final int summaryPluralsRes; - private final CharSequence summary; - - @StringRes - private final int firstActionTextRes; - @PluralsRes - private final int firstActionPluralsRes; - private final CharSequence firstActionText; - private final View.OnClickListener firstActionListener; - - @StringRes - private final int secondActionTextRes; - @PluralsRes - private final int secondActionPluralsRes; - private final CharSequence secondActionText; - private final View.OnClickListener secondActionListener; - - private final Evaluation evaluation; - - private boolean evaluated = false; - private boolean evaluating = false; - private int evaluatedPlurals = -1; - private boolean active; - - Condition(Builder builder) { - icon = builder.icon; - title = builder.title; - summary = builder.summary; - firstActionText = builder.firstActionText; - firstActionListener = builder.firstActionListener; - secondActionText = builder.secondActionText; - secondActionListener = builder.secondActionListener; - summaryRes = builder.summaryRes; - iconRes = builder.iconRes; - firstActionTextRes = builder.firstActionTextRes; - secondActionTextRes = builder.secondActionTextRes; - titleRes = builder.titleRes; - evaluation = builder.evaluation; - titlePluralsRes = builder.titlePluralsRes; - summaryPluralsRes = builder.summaryPluralsRes; - firstActionPluralsRes = builder.firstActionPluralsRes; - secondActionPluralsRes = builder.secondActionPluralsRes; - } - - View createView(final Context context, ViewGroup container) { - LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View view = inflater.inflate(R.layout.condition_card, container, false); - Drawable icon = getIcon(context); - if (icon != null) - ((ImageView) view.findViewById(android.R.id.icon)).setImageDrawable(icon); - ((TextView) view.findViewById(android.R.id.title)).setText(getTitle(context)); - ((TextView) view.findViewById(android.R.id.summary)).setText(getSummary(context)); - Button first = (Button) view.findViewById(R.id.first_action); - first.setText(getFirstActionText(context)); - first.setOnClickListener(getFirstActionListener()); - CharSequence secondActionText = getSecondActionText(context); - if (secondActionText != null) { - Button second = (Button) view.findViewById(R.id.second_action); - second.setText(secondActionText); - second.setOnClickListener(getSecondActionListener()); - second.setVisibility(View.VISIBLE); - } - final View detailGroup = view.findViewById(R.id.detail_group); - final ImageView expandIndicator = (ImageView) view.findViewById(R.id.expand_indicator); - View.OnClickListener expandListener = v -> { - if (detailGroup.getVisibility() == View.VISIBLE) { - expandIndicator.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_expand_more, context.getTheme())); - detailGroup.setVisibility(View.GONE); - } else { - expandIndicator.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_expand_less, context.getTheme())); - detailGroup.setVisibility(View.VISIBLE); - } - }; - view.findViewById(R.id.collapsed_group).setOnClickListener(expandListener); - expandIndicator.setOnClickListener(expandListener); - view.setTag(this); - return view; - } - - public Drawable getIcon(Context context) { - if (iconRes != 0) { - return ResourcesCompat.getDrawable(context.getResources(), iconRes, context.getTheme()); - } - return icon; - } - - public CharSequence getTitle(Context context) { - if (titleRes != 0) { - return context.getString(titleRes); - } - if (titlePluralsRes != 0) { - return context.getResources().getQuantityString(titlePluralsRes, evaluatedPlurals); - } - return title; - } - - public CharSequence getSummary(Context context) { - if (summaryRes != 0) { - return context.getString(summaryRes); - } - if (summaryPluralsRes != 0) { - return context.getResources().getQuantityString(summaryPluralsRes, evaluatedPlurals); - } - return summary; - } - - public View.OnClickListener getFirstActionListener() { - return firstActionListener; - } - - public CharSequence getFirstActionText(Context context) { - if (firstActionTextRes != 0) { - return context.getString(firstActionTextRes); - } - if (firstActionPluralsRes != 0) { - return context.getResources().getQuantityString(firstActionPluralsRes, evaluatedPlurals); - } - return firstActionText; - } - - public View.OnClickListener getSecondActionListener() { - return secondActionListener; - } - - public CharSequence getSecondActionText(Context context) { - if (secondActionTextRes != 0) { - return context.getString(secondActionTextRes); - } - if (secondActionPluralsRes != 0) { - return context.getResources().getQuantityString(secondActionPluralsRes, evaluatedPlurals); - } - return secondActionText; - } - - public synchronized boolean willBeEvaluating() { - if (!evaluating && !evaluated && evaluation != null) { - return evaluating = true; - } else { - return false; - } - } - - public boolean isEvaluated() { - return evaluated || evaluation == null; - } - - public synchronized void evaluate(Context context) { - active = evaluation == null || evaluation.isActive(context); - assert evaluation != null; - evaluatedPlurals = evaluation.getPluralsCount(); - evaluated = true; - evaluating = false; - } - - public boolean isActive(Context context) { - if (!evaluated && evaluation != null) evaluate(context); - return active; - } - - public void resetEvaluated() { - this.evaluated = false; - } - - public static abstract class Evaluation { - public abstract boolean isActive(Context context); - - public int getPluralsCount() { - return 1; - } - } - - public static class Builder { - - @DrawableRes - private int iconRes; - private Drawable icon; - @StringRes - private int titleRes; - @PluralsRes - private final int titlePluralsRes; - private CharSequence title; - @StringRes - private int summaryRes; - @PluralsRes - private final int summaryPluralsRes; - private CharSequence summary; - @StringRes - private final int firstActionTextRes; - @PluralsRes - private final int firstActionPluralsRes; - private final CharSequence firstActionText; - private final View.OnClickListener firstActionListener; - @StringRes - private final int secondActionTextRes; - @PluralsRes - private final int secondActionPluralsRes; - private final CharSequence secondActionText; - private final View.OnClickListener secondActionListener; - private final Evaluation evaluation; - - - public Builder(int titlePluralsRes, int summaryPluralsRes, int firstActionTextRes, int firstActionPluralsRes, CharSequence firstActionText, View.OnClickListener firstActionListener, int secondActionTextRes, int secondActionPluralsRes, CharSequence secondActionText, View.OnClickListener secondActionListener, Evaluation evaluation) { - this.titlePluralsRes = titlePluralsRes; - this.summaryPluralsRes = summaryPluralsRes; - this.firstActionTextRes = firstActionTextRes; - this.firstActionPluralsRes = firstActionPluralsRes; - this.firstActionText = firstActionText; - this.firstActionListener = firstActionListener; - this.secondActionTextRes = secondActionTextRes; - this.secondActionPluralsRes = secondActionPluralsRes; - this.secondActionText = secondActionText; - this.secondActionListener = secondActionListener; - this.evaluation = evaluation; - } - - public Builder icon(Drawable val) { - icon = val; - return this; - } - - public Builder icon(@DrawableRes int val) { - iconRes = val; - return this; - } - - public Builder title(CharSequence val) { - title = val; - return this; - } - - public Builder title(@StringRes int val) { - titleRes = val; - return this; - } - - public Builder summary(CharSequence val) { - summary = val; - return this; - } - - public Builder summary(@StringRes int val) { - summaryRes = val; - return this; - } - - public Condition build() { - return new Condition(this); - } - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/DialogPreference.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/DialogPreference.java deleted file mode 100644 index b5335089..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/DialogPreference.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import android.content.Context; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.util.AttributeSet; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; - -import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; -import androidx.preference.Preference; -import androidx.preference.PreferenceDialogFragmentCompat; -import androidx.preference.PreferenceFragmentCompat; -import androidx.preference.PreferenceViewHolder; - -public class DialogPreference extends androidx.preference.DialogPreference implements PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback { - - private static final String DIALOG_FRAGMENT_TAG = - "android.support.v7.preference.PreferenceFragment.DIALOG"; - - public DialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - public DialogPreference(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public DialogPreference(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public DialogPreference(Context context) { - super(context); - } - - protected View onCreateDialogView() { - return null; - } - - /** - * Called when the dialog is dismissed and should be used to save data to - * the {@link SharedPreferences}. - * - */ - protected void onDialogClosed() { - } - - @Override - public boolean onPreferenceDisplayDialog(@NonNull PreferenceFragmentCompat caller, @NonNull Preference pref) { - DialogPreferenceCompatDialogFragment fragment = new DialogPreferenceCompatDialogFragment(); - fragment.setTargetFragment(caller, 0); - assert caller.getFragmentManager() != null; - fragment.show(caller.getFragmentManager(), DIALOG_FRAGMENT_TAG); - return true; - } - - @Override - public void onBindViewHolder(@NonNull PreferenceViewHolder view) { - super.onBindViewHolder(view); - - ViewGroup.LayoutParams layoutParams = view.findViewById(R.id.icon_frame).getLayoutParams(); - if (layoutParams instanceof LinearLayout.LayoutParams) { - if (((LinearLayout.LayoutParams) layoutParams).leftMargin < 0) { - ((LinearLayout.LayoutParams) layoutParams).leftMargin = 0; - } - } - } - - public static class DialogPreferenceCompatDialogFragment extends PreferenceDialogFragmentCompat { - - @Override - protected View onCreateDialogView(@NonNull Context context) { - if (getPreference() instanceof DialogPreference) { - View view = ((DialogPreference) getPreference()).onCreateDialogView(); - if (view != null) return view; - } - return super.onCreateDialogView(context); - } - - @Override - public void onDialogClosed(boolean positiveResult) { - if (getPreference() instanceof DialogPreference) { - ((DialogPreference) getPreference()).onDialogClosed(); - } - } - - public static DialogFragment newInstance(String key) { - final DialogPreferenceCompatDialogFragment fragment = new DialogPreferenceCompatDialogFragment(); - final Bundle b = new Bundle(1); - b.putString(ARG_KEY, key); - fragment.setArguments(b); - return fragment; - } - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/ResourceSettingsFragment.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/ResourceSettingsFragment.java deleted file mode 100644 index 78abc781..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/ResourceSettingsFragment.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import android.os.Bundle; - -import androidx.annotation.Nullable; - -public class ResourceSettingsFragment extends AbstractSettingsFragment { - - public static final String EXTRA_PREFERENCE_RESOURCE = "preferencesResource"; - - protected int preferencesResource; - - @Override - public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) { - Bundle b = getArguments(); - if (b != null) { - preferencesResource = b.getInt(EXTRA_PREFERENCE_RESOURCE, preferencesResource); - } - if (preferencesResource != 0) { - addPreferencesFromResource(preferencesResource); - } - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/SwitchBar.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/SwitchBar.java deleted file mode 100644 index 0a30f683..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/SwitchBar.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * Copyright (C) 2014-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import android.content.Context; -import android.os.Parcel; -import android.os.Parcelable; -import android.text.SpannableStringBuilder; -import android.text.TextUtils; -import android.text.style.TextAppearanceSpan; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.CompoundButton; -import android.widget.LinearLayout; -import android.widget.TextView; - -import androidx.annotation.NonNull; - -import com.google.android.material.switchmaterial.SwitchMaterial; - -import java.util.ArrayList; - -public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener, - View.OnClickListener { - - public interface OnSwitchChangeListener { - /** - * Called when the checked state of the Switch has changed. - * - * @param switchView The Switch view whose state has changed. - * @param isChecked The new checked state of switchView. - */ - void onSwitchChanged(SwitchMaterial switchView, boolean isChecked); - } - - private final TextAppearanceSpan mSummarySpan; - - private final ToggleSwitch mSwitch; - private final TextView mTextView; - private String mLabel; - private String mSummary; - - private final ArrayList mSwitchChangeListeners = - new ArrayList<>(); - - public SwitchBar(Context context) { - this(context, null); - } - - public SwitchBar(Context context, AttributeSet attrs) { - super(context, attrs); - - LayoutInflater.from(context).inflate(R.layout.switch_bar, this); - - mTextView = (TextView) findViewById(R.id.switch_text); - mTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); - mLabel = getResources().getString(R.string.abc_capital_off); - mSummarySpan = new TextAppearanceSpan(context, androidx.appcompat.R.style.TextAppearance_AppCompat_Widget_Switch); - updateText(); - - mSwitch = (ToggleSwitch) findViewById(R.id.switch_widget); - // Prevent onSaveInstanceState() to be called as we are managing the state of the Switch - // on our own - mSwitch.setSaveEnabled(false); - mSwitch.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); - - addOnSwitchChangeListener((switchView, isChecked) -> setTextViewLabel(isChecked)); - - setOnClickListener(this); - - // Default is hide - setVisibility(View.GONE); - } - - public void setTextViewLabel(boolean isChecked) { - mLabel = getResources() - .getString(isChecked ? R.string.abc_capital_on : R.string.abc_capital_off); - updateText(); - } - - public void setSummary(String summary) { - mSummary = summary; - updateText(); - } - - private void updateText() { - if (TextUtils.isEmpty(mSummary)) { - mTextView.setText(mLabel); - return; - } - final SpannableStringBuilder ssb = new SpannableStringBuilder(mLabel).append('\n'); - final int start = ssb.length(); - ssb.append(mSummary); - ssb.setSpan(mSummarySpan, start, ssb.length(), 0); - mTextView.setText(ssb); - } - - public void setChecked(boolean checked) { - setTextViewLabel(checked); - mSwitch.setChecked(checked); - } - - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - mTextView.setEnabled(enabled); - mSwitch.setEnabled(enabled); - } - - public boolean isShowing() { - return (getVisibility() == View.VISIBLE); - } - - @Override - public void onClick(View v) { - final boolean isChecked = !mSwitch.isChecked(); - setChecked(isChecked); - } - - public void propagateChecked(boolean isChecked) { - final int count = mSwitchChangeListeners.size(); - for (int n = 0; n < count; n++) { - mSwitchChangeListeners.get(n).onSwitchChanged(mSwitch, isChecked); - } - } - - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - propagateChecked(isChecked); - } - - public void addOnSwitchChangeListener(OnSwitchChangeListener listener) { - if (mSwitchChangeListeners.contains(listener)) { - throw new IllegalStateException("Cannot add twice the same OnSwitchChangeListener"); - } - mSwitchChangeListeners.add(listener); - } - - static class SavedState extends BaseSavedState { - boolean checked; - boolean visible; - - SavedState(Parcelable superState) { - super(superState); - } - - /** - * Constructor called from {@link #CREATOR} - */ - private SavedState(Parcel in) { - super(in); - checked = (Boolean) in.readValue(Boolean.class.getClassLoader()); - visible = (Boolean) in.readValue(Boolean.class.getClassLoader()); - } - - @Override - public void writeToParcel(Parcel out, int flags) { - super.writeToParcel(out, flags); - out.writeValue(checked); - out.writeValue(visible); - } - - @NonNull - @Override - public String toString() { - return "SwitchBar.SavedState{" - + Integer.toHexString(System.identityHashCode(this)) - + " checked=" + checked - + " visible=" + visible + "}"; - } - - public static final Parcelable.Creator CREATOR - = new Parcelable.Creator() { - public SavedState createFromParcel(Parcel in) { - return new SavedState(in); - } - - public SavedState[] newArray(int size) { - return new SavedState[size]; - } - }; - } - - @Override - public Parcelable onSaveInstanceState() { - Parcelable superState = super.onSaveInstanceState(); - - SavedState ss = new SavedState(superState); - ss.checked = mSwitch.isChecked(); - ss.visible = isShowing(); - return ss; - } - - @Override - public void onRestoreInstanceState(Parcelable state) { - SavedState ss = (SavedState) state; - - super.onRestoreInstanceState(ss.getSuperState()); - - mSwitch.setCheckedInternal(ss.checked); - setTextViewLabel(ss.checked); - setVisibility(ss.visible ? View.VISIBLE : View.GONE); - mSwitch.setOnCheckedChangeListener(ss.visible ? this : null); - - requestLayout(); - } -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/SwitchBarResourceSettingsFragment.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/SwitchBarResourceSettingsFragment.java deleted file mode 100644 index f590aa25..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/SwitchBarResourceSettingsFragment.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import android.os.Bundle; - -import com.google.android.material.switchmaterial.SwitchMaterial; - -public abstract class SwitchBarResourceSettingsFragment extends ResourceSettingsFragment implements SwitchBar.OnSwitchChangeListener { - private final SwitchMaterial switchMaterial; - private boolean listenerSetup = false; - - protected SwitchBarResourceSettingsFragment(SwitchMaterial switchMaterial) { - this.switchMaterial = switchMaterial; - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - } - - @Override - public void onResume() { - super.onResume(); - if (!listenerSetup) { - listenerSetup = true; - } - } - - @Override - public void onPause() { - if (listenerSetup) { - listenerSetup = false; - } - super.onPause(); - } - - @Override - public void onSwitchChanged(SwitchMaterial switchView, boolean isChecked) { - if (switchView == switchMaterial) { - onSwitchBarChanged(isChecked); - } - } - - public abstract void onSwitchBarChanged(boolean isChecked); -} diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/ToggleSwitch.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/ToggleSwitch.java deleted file mode 100644 index 3a3a7bb3..00000000 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/ToggleSwitch.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * Copyright (C) 2014-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.ui; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.util.AttributeSet; - -import com.google.android.material.switchmaterial.SwitchMaterial; - -@SuppressLint("NewApi") -public class ToggleSwitch extends SwitchMaterial { - - private ToggleSwitch.OnBeforeCheckedChangeListener mOnBeforeListener; - - public interface OnBeforeCheckedChangeListener { - boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked); - } - - public ToggleSwitch(Context context) { - super(context); - } - - public ToggleSwitch(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public ToggleSwitch(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - @Override - public void setChecked(boolean checked) { - if (mOnBeforeListener != null - && mOnBeforeListener.onBeforeCheckedChanged(this, checked)) { - return; - } - super.setChecked(checked); - } - - public void setCheckedInternal(boolean checked) { - super.setChecked(checked); - } -} diff --git a/play-services-core/microg-ui-tools/src/main/res/drawable/ic_expand_less.xml b/play-services-core/microg-ui-tools/src/main/res/drawable/ic_expand_less.xml deleted file mode 100644 index 62ff063e..00000000 --- a/play-services-core/microg-ui-tools/src/main/res/drawable/ic_expand_less.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - diff --git a/play-services-core/microg-ui-tools/src/main/res/drawable/ic_expand_more.xml b/play-services-core/microg-ui-tools/src/main/res/drawable/ic_expand_more.xml deleted file mode 100644 index 871f6575..00000000 --- a/play-services-core/microg-ui-tools/src/main/res/drawable/ic_expand_more.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - diff --git a/play-services-core/microg-ui-tools/src/main/res/layout-v21/preference_material.xml b/play-services-core/microg-ui-tools/src/main/res/layout-v21/preference_material.xml deleted file mode 100644 index 3f7906ae..00000000 --- a/play-services-core/microg-ui-tools/src/main/res/layout-v21/preference_material.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/play-services-core/microg-ui-tools/src/main/res/layout/about_root.xml b/play-services-core/microg-ui-tools/src/main/res/layout/about_root.xml deleted file mode 100644 index 32e29bfa..00000000 --- a/play-services-core/microg-ui-tools/src/main/res/layout/about_root.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - -======= - android:layout_height="wrap_content"/> ->>>>>>> bfabc38e (About: Fix scrolling) - diff --git a/play-services-core/microg-ui-tools/src/main/res/layout/condition_card.xml b/play-services-core/microg-ui-tools/src/main/res/layout/condition_card.xml deleted file mode 100644 index d42bf4a6..00000000 --- a/play-services-core/microg-ui-tools/src/main/res/layout/condition_card.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -