0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-10-31 16:32:39 +00:00

Major update to lib implementations

This commit is contained in:
Marvin W 2020-07-26 12:01:03 +02:00
parent 396965f407
commit cda60817f2
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
68 changed files with 1187 additions and 193 deletions

208
LICENSES/Apache-2.0.txt Normal file
View file

@ -0,0 +1,208 @@
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.

324
LICENSES/CC-BY-4.0.txt Normal file
View file

@ -0,0 +1,324 @@
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
reasonfor example, because of any applicable exception or limitation to copyrightthen
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.

View file

@ -4,8 +4,8 @@
*/ */
buildscript { buildscript {
ext.nlpVersion = '2.0-alpha1' ext.nlpVersion = '2.0-alpha2'
ext.remoteDroidGuardVersion = '0.1.1' ext.remoteDroidGuardVersion = '0.1.2'
ext.safeParcelVersion = '1.6.0' ext.safeParcelVersion = '1.6.0'
ext.wearableVersion = '0.1.1' ext.wearableVersion = '0.1.1'
@ -53,7 +53,7 @@ def execResult(...args) {
return stdout.toString().trim() return stdout.toString().trim()
} }
def gmsVersion = "19.4.20" def gmsVersion = "20.24.14"
def gmsVersionCode = Integer.parseInt(gmsVersion.replaceAll('\\.', '')) def gmsVersionCode = Integer.parseInt(gmsVersion.replaceAll('\\.', ''))
def gitVersionBase = execResult('git', 'describe', '--tags', '--abbrev=0', '--match=v[0-9]*').substring(1) def gitVersionBase = execResult('git', 'describe', '--tags', '--abbrev=0', '--match=v[0-9]*').substring(1)
def gitCommitCount = Integer.parseInt(execResult('git', 'rev-list', '--count', "v$gitVersionBase..HEAD")) def gitCommitCount = Integer.parseInt(execResult('git', 'rev-list', '--count', "v$gitVersionBase..HEAD"))

View file

@ -0,0 +1,40 @@
/*
* 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"
defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2020, microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest package="org.microg.gms.base.api"/>

View file

@ -0,0 +1,7 @@
package com.google.android.gms.common.api.internal;
import com.google.android.gms.common.api.Status;
interface IStatusCallback {
void onResult(in Status status);
}

View file

@ -0,0 +1,12 @@
/*
* 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<GoogleSignInAccount> CREATOR = new AutoCreator<GoogleSignInAccount>(GoogleSignInAccount.class);
}

View file

@ -35,6 +35,7 @@ android {
dependencies { dependencies {
api project(':play-services-basement') api project(':play-services-basement')
api project(':play-services-tasks') api project(':play-services-tasks')
api project(':play-services-base-api')
implementation "androidx.fragment:fragment:$fragmentVersion" implementation "androidx.fragment:fragment:$fragmentVersion"
} }

View file

@ -18,6 +18,7 @@ package com.google.android.gms.common.api;
import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.AutoSafeParcelable;
@Deprecated
public class AccountInfo extends AutoSafeParcelable { public class AccountInfo extends AutoSafeParcelable {
public static final Creator<AccountInfo> CREATOR = new AutoCreator<AccountInfo>(AccountInfo.class); public static final Creator<AccountInfo> CREATOR = new AutoCreator<AccountInfo>(AccountInfo.class);
} }

View file

@ -16,8 +16,12 @@
package com.google.android.gms.common.api; package com.google.android.gms.common.api;
import android.accounts.Account;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import org.microg.gms.common.PublicApi; import org.microg.gms.common.PublicApi;
import org.microg.gms.common.api.ApiBuilder; import org.microg.gms.common.api.ApiClientBuilder;
/** /**
* Describes a section of the Google Play Services API that should be made available. Instances of * Describes a section of the Google Play Services API that should be made available. Instances of
@ -33,16 +37,15 @@ import org.microg.gms.common.api.ApiBuilder;
*/ */
@PublicApi @PublicApi
public final class Api<O extends Api.ApiOptions> { public final class Api<O extends Api.ApiOptions> {
private final ApiClientBuilder<O> builder;
private final ApiBuilder<O> builder;
@PublicApi(exclude = true) @PublicApi(exclude = true)
public Api(ApiBuilder<O> builder) { public Api(ApiClientBuilder<O> builder) {
this.builder = builder; this.builder = builder;
} }
@PublicApi(exclude = true) @PublicApi(exclude = true)
public ApiBuilder<O> getBuilder() { public ApiClientBuilder<O> getBuilder() {
return builder; return builder;
} }
@ -79,6 +82,22 @@ public final class Api<O extends Api.ApiOptions> {
@PublicApi @PublicApi
interface Optional extends HasOptions, NotRequiredOptions { interface Optional extends HasOptions, NotRequiredOptions {
} }
/**
* An interface for {@link ApiOptions} that include an account.
*/
@PublicApi
interface HasAccountOptions extends HasOptions, NotRequiredOptions {
Account getAccount();
}
/**
* An interface for {@link ApiOptions} that includes a {@link GoogleSignInAccount}
*/
@PublicApi
interface HasGoogleSignInAccountOptions extends HasOptions {
GoogleSignInAccount getGoogleSignInAccount();
}
} }
} }

View file

@ -0,0 +1,48 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.common.api;
import android.content.Context;
import com.google.android.gms.common.api.internal.ApiKey;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import org.microg.gms.common.PublicApi;
import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.GoogleApiManager;
import org.microg.gms.common.api.PendingGoogleApiCall;
@PublicApi
public abstract class GoogleApi<O extends Api.ApiOptions> implements HasApiKey<O> {
private GoogleApiManager manager;
@PublicApi(exclude = true)
public Api<O> api;
@PublicApi(exclude = true)
protected GoogleApi(Context context, Api<O> api) {
this.api = api;
this.manager = GoogleApiManager.getInstance(context);
}
@PublicApi(exclude = true)
protected <R, A extends ApiClient> Task<R> scheduleTask(PendingGoogleApiCall<R, A> apiCall) {
TaskCompletionSource<R> completionSource = new TaskCompletionSource<>();
manager.scheduleTask(this, apiCall, completionSource);
return completionSource.getTask();
}
@Override
@PublicApi(exclude = true)
public ApiKey<O> getApiKey() {
return null;
}
@PublicApi(exclude = true)
public O getOptions() {
return null;
}
}

View file

@ -29,6 +29,7 @@ import com.google.android.gms.common.ConnectionResult;
import org.microg.gms.auth.AuthConstants; import org.microg.gms.auth.AuthConstants;
import org.microg.gms.common.PublicApi; import org.microg.gms.common.PublicApi;
import org.microg.gms.common.api.ApiClientSettings;
import org.microg.gms.common.api.GoogleApiClientImpl; import org.microg.gms.common.api.GoogleApiClientImpl;
import java.util.HashMap; import java.util.HashMap;
@ -56,6 +57,7 @@ import java.util.concurrent.TimeUnit;
* in {@link Activity#onStop()}, regardless of the state. * in {@link Activity#onStop()}, regardless of the state.
*/ */
@PublicApi @PublicApi
@Deprecated
public interface GoogleApiClient { public interface GoogleApiClient {
/** /**
* Connects the client to Google Play services. Blocks until the connection either succeeds or * Connects the client to Google Play services. Blocks until the connection either succeeds or
@ -271,7 +273,7 @@ public interface GoogleApiClient {
* attempt fails. * attempt fails.
*/ */
public Builder(Context context, ConnectionCallbacks connectedListener, public Builder(Context context, ConnectionCallbacks connectedListener,
OnConnectionFailedListener connectionFailedListener) { OnConnectionFailedListener connectionFailedListener) {
this(context); this(context);
addConnectionCallbacks(connectedListener); addConnectionCallbacks(connectedListener);
addOnConnectionFailedListener(connectionFailedListener); addOnConnectionFailedListener(connectionFailedListener);
@ -358,16 +360,15 @@ public interface GoogleApiClient {
* @return The {@link GoogleApiClient} object. * @return The {@link GoogleApiClient} object.
*/ */
public GoogleApiClient build() { public GoogleApiClient build() {
return new GoogleApiClientImpl(context, looper, getAccountInfo(), apis, return new GoogleApiClientImpl(context, looper, getClientSettings(), apis, connectionCallbacks, connectionFailedListeners, clientId);
connectionCallbacks, connectionFailedListeners, clientId);
} }
private AccountInfo getAccountInfo() { private ApiClientSettings getClientSettings() {
return null; return null;
} }
public Builder enableAutoManage(FragmentActivity fragmentActivity, int cliendId, public Builder enableAutoManage(FragmentActivity fragmentActivity, int cliendId,
OnConnectionFailedListener unresolvedConnectionFailedListener) OnConnectionFailedListener unresolvedConnectionFailedListener)
throws NullPointerException, IllegalArgumentException, IllegalStateException { throws NullPointerException, IllegalArgumentException, IllegalStateException {
this.fragmentActivity = fragmentActivity; this.fragmentActivity = fragmentActivity;
this.clientId = cliendId; this.clientId = cliendId;
@ -433,7 +434,8 @@ public interface GoogleApiClient {
* service. Most applications implement {@link #onConnected(Bundle)} to start making requests. * service. Most applications implement {@link #onConnected(Bundle)} to start making requests.
*/ */
@PublicApi @PublicApi
interface ConnectionCallbacks { @Deprecated
interface ConnectionCallbacks extends org.microg.gms.common.api.ConnectionCallbacks {
/** /**
* A suspension cause informing that the service has been killed. * A suspension cause informing that the service has been killed.
*/ */
@ -442,34 +444,6 @@ public interface GoogleApiClient {
* A suspension cause informing you that a peer device connection was lost. * A suspension cause informing you that a peer device connection was lost.
*/ */
int CAUSE_NETWORK_LOST = 2; int CAUSE_NETWORK_LOST = 2;
/**
* 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.
* <p/>
* 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);
} }
/** /**
@ -478,18 +452,7 @@ public interface GoogleApiClient {
* resolution. * resolution.
*/ */
@PublicApi @PublicApi
interface OnConnectionFailedListener { @Deprecated
/** interface OnConnectionFailedListener extends org.microg.gms.common.api.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);
} }
} }

View file

@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.common.api;
import com.google.android.gms.common.api.internal.ApiKey;
public interface HasApiKey<O extends Api.ApiOptions> {
ApiKey<O> getApiKey();
}

View file

@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.common.api.internal;
import com.google.android.gms.common.api.Api;
public class ApiKey<O extends Api.ApiOptions> {
private Api<O> api;
}

View file

@ -16,9 +16,9 @@
package org.microg.gms.common; package org.microg.gms.common;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClient;
public class DummyApiConnection implements ApiConnection { public class DummyApiClient implements ApiClient {
private boolean connected = false; private boolean connected = false;
@Override @Override

View file

@ -27,19 +27,20 @@ import android.os.RemoteException;
import android.util.Log; import android.util.Log;
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.internal.GetServiceRequest; import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.IGmsCallbacks; import com.google.android.gms.common.internal.IGmsCallbacks;
import com.google.android.gms.common.internal.IGmsServiceBroker; import com.google.android.gms.common.internal.IGmsServiceBroker;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public abstract class GmsClient<I extends IInterface> implements ApiConnection { public abstract class GmsClient<I extends IInterface> implements ApiClient {
private static final String TAG = "GmsClient"; private static final String TAG = "GmsClient";
private final Context context; private final Context context;
protected final GoogleApiClient.ConnectionCallbacks callbacks; protected final ConnectionCallbacks callbacks;
protected final GoogleApiClient.OnConnectionFailedListener connectionFailedListener; protected final OnConnectionFailedListener connectionFailedListener;
protected ConnectionState state = ConnectionState.NOT_CONNECTED; protected ConnectionState state = ConnectionState.NOT_CONNECTED;
private ServiceConnection serviceConnection; private ServiceConnection serviceConnection;
private I serviceInterface; private I serviceInterface;
@ -49,8 +50,7 @@ public abstract class GmsClient<I extends IInterface> implements ApiConnection {
protected Account account = null; protected Account account = null;
protected Bundle extras = new Bundle(); protected Bundle extras = new Bundle();
public GmsClient(Context context, GoogleApiClient.ConnectionCallbacks callbacks, public GmsClient(Context context, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener, String actionString) {
GoogleApiClient.OnConnectionFailedListener connectionFailedListener, String actionString) {
this.context = context; this.context = context;
this.callbacks = callbacks; this.callbacks = callbacks;
this.connectionFailedListener = connectionFailedListener; this.connectionFailedListener = connectionFailedListener;
@ -89,8 +89,7 @@ public abstract class GmsClient<I extends IInterface> implements ApiConnection {
} }
public void handleConnectionFailed() { public void handleConnectionFailed() {
connectionFailedListener.onConnectionFailed(new ConnectionResult(ConnectionResult connectionFailedListener.onConnectionFailed(new ConnectionResult(ConnectionResult.API_UNAVAILABLE, null));
.API_UNAVAILABLE, null));
} }
@Override @Override
@ -147,8 +146,7 @@ public abstract class GmsClient<I extends IInterface> implements ApiConnection {
public void onServiceConnected(ComponentName componentName, IBinder iBinder) { public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
try { try {
Log.d(TAG, "ServiceConnection : onServiceConnected(" + componentName + ")"); Log.d(TAG, "ServiceConnection : onServiceConnected(" + componentName + ")");
onConnectedToBroker(IGmsServiceBroker.Stub.asInterface(iBinder), onConnectedToBroker(IGmsServiceBroker.Stub.asInterface(iBinder), new GmsCallbacks());
new GmsCallbacks());
} catch (RemoteException e) { } catch (RemoteException e) {
disconnect(); disconnect();
} }

View file

@ -27,10 +27,10 @@ import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Result; import com.google.android.gms.common.api.Result;
import org.microg.gms.common.api.AbstractPendingResult; import org.microg.gms.common.api.AbstractPendingResult;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.GoogleApiClientImpl; import org.microg.gms.common.api.GoogleApiClientImpl;
public class GmsConnector<C extends ApiConnection, R extends Result> { public class GmsConnector<C extends ApiClient, R extends Result> {
private static final String TAG = "GmsConnector"; private static final String TAG = "GmsConnector";
private final GoogleApiClientImpl apiClient; private final GoogleApiClientImpl apiClient;
@ -43,7 +43,7 @@ public class GmsConnector<C extends ApiConnection, R extends Result> {
this.callback = callback; this.callback = callback;
} }
public static <C extends ApiConnection, R extends Result> PendingResult<R> call(GoogleApiClient client, Api api, GmsConnector.Callback<C, R> callback) { public static <C extends ApiClient, R extends Result> PendingResult<R> call(GoogleApiClient client, Api api, GmsConnector.Callback<C, R> callback) {
return new GmsConnector<C, R>(client, api, callback).connect(); return new GmsConnector<C, R>(client, api, callback).connect();
} }

View file

@ -16,7 +16,7 @@
package org.microg.gms.common.api; package org.microg.gms.common.api;
public interface ApiConnection { public interface ApiClient {
void connect(); void connect();
void disconnect(); void disconnect();

View file

@ -19,12 +19,8 @@ package org.microg.gms.common.api;
import android.content.Context; import android.content.Context;
import android.os.Looper; import android.os.Looper;
import com.google.android.gms.common.api.AccountInfo;
import com.google.android.gms.common.api.Api; import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
public interface ApiBuilder<O extends Api.ApiOptions> { public interface ApiClientBuilder<O extends Api.ApiOptions> {
ApiConnection build(Context context, Looper looper, O options, AccountInfo accountInfo, ApiClient build(O options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener);
GoogleApiClient.ConnectionCallbacks callbacks,
GoogleApiClient.OnConnectionFailedListener connectionFailedListener);
} }

View file

@ -0,0 +1,9 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package org.microg.gms.common.api;
public class ApiClientSettings {
}

View file

@ -0,0 +1,41 @@
/*
* 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.
* <p/>
* 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);
}

View file

@ -20,11 +20,12 @@ import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import android.util.Log; import android.util.Log;
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.AccountInfo;
import com.google.android.gms.common.api.Api; import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.PendingResult;
@ -41,10 +42,9 @@ public class GoogleApiClientImpl implements GoogleApiClient {
private final Context context; private final Context context;
private final Looper looper; private final Looper looper;
private final AccountInfo accountInfo; private final ApiClientSettings clientSettings;
private final Map<Api, Api.ApiOptions> apis = new HashMap<Api, Api.ApiOptions>(); private final Map<Api, Api.ApiOptions> apis = new HashMap<Api, Api.ApiOptions>();
private final Map<Api, ApiConnection> apiConnections = new HashMap<Api, ApiConnection>(); private final Map<Api, ApiClient> apiConnections = new HashMap<Api, ApiClient>();
private final Handler handler;
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<ConnectionCallbacks>(); private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<ConnectionCallbacks>();
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<OnConnectionFailedListener>(); private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<OnConnectionFailedListener>();
private final int clientId; private final int clientId;
@ -78,23 +78,20 @@ public class GoogleApiClientImpl implements GoogleApiClient {
private int usageCounter = 0; private int usageCounter = 0;
private boolean shouldDisconnect = false; private boolean shouldDisconnect = false;
public GoogleApiClientImpl(Context context, Looper looper, AccountInfo accountInfo, public GoogleApiClientImpl(Context context, Looper looper, ApiClientSettings clientSettings,
Map<Api, Api.ApiOptions> apis, Map<Api, Api.ApiOptions> apis,
Set<ConnectionCallbacks> connectionCallbacks, Set<ConnectionCallbacks> connectionCallbacks,
Set<OnConnectionFailedListener> connectionFailedListeners, int clientId) { Set<OnConnectionFailedListener> connectionFailedListeners, int clientId) {
this.context = context; this.context = context;
this.looper = looper; this.looper = looper;
this.handler = new Handler(looper); this.clientSettings = clientSettings;
this.accountInfo = accountInfo;
this.apis.putAll(apis); this.apis.putAll(apis);
this.connectionCallbacks.addAll(connectionCallbacks); this.connectionCallbacks.addAll(connectionCallbacks);
this.connectionFailedListeners.addAll(connectionFailedListeners); this.connectionFailedListeners.addAll(connectionFailedListeners);
this.clientId = clientId; this.clientId = clientId;
for (Api api : apis.keySet()) { for (Api api : apis.keySet()) {
apiConnections.put(api, api.getBuilder().build(context, looper, apiConnections.put(api, api.getBuilder().build(apis.get(api), context, looper, clientSettings, baseConnectionCallbacks, baseConnectionFailedListener));
apis.get(api), accountInfo, baseConnectionCallbacks,
baseConnectionFailedListener));
} }
} }
@ -111,7 +108,7 @@ public class GoogleApiClientImpl implements GoogleApiClient {
return looper; return looper;
} }
public ApiConnection getApiConnection(Api api) { public ApiClient getApiConnection(Api api) {
return apiConnections.get(api); return apiConnections.get(api);
} }
@ -141,7 +138,7 @@ public class GoogleApiClientImpl implements GoogleApiClient {
Log.d(TAG, "Already connected/connecting, nothing to do"); Log.d(TAG, "Already connected/connecting, nothing to do");
return; return;
} }
for (ApiConnection connection : apiConnections.values()) { for (ApiClient connection : apiConnections.values()) {
if (!connection.isConnected()) { if (!connection.isConnected()) {
connection.connect(); connection.connect();
} }
@ -154,7 +151,7 @@ public class GoogleApiClientImpl implements GoogleApiClient {
shouldDisconnect = true; shouldDisconnect = true;
} else { } else {
Log.d(TAG, "disconnect()"); Log.d(TAG, "disconnect()");
for (ApiConnection connection : apiConnections.values()) { for (ApiClient connection : apiConnections.values()) {
if (connection.isConnected()) { if (connection.isConnected()) {
connection.disconnect(); connection.disconnect();
} }
@ -164,7 +161,7 @@ public class GoogleApiClientImpl implements GoogleApiClient {
@Override @Override
public synchronized boolean isConnected() { public synchronized boolean isConnected() {
for (ApiConnection connection : apiConnections.values()) { for (ApiClient connection : apiConnections.values()) {
if (!connection.isConnected()) return false; if (!connection.isConnected()) return false;
} }
return true; return true;
@ -172,7 +169,7 @@ public class GoogleApiClientImpl implements GoogleApiClient {
@Override @Override
public synchronized boolean isConnecting() { public synchronized boolean isConnecting() {
for (ApiConnection connection : apiConnections.values()) { for (ApiClient connection : apiConnections.values()) {
if (connection.isConnecting()) return true; if (connection.isConnecting()) return true;
} }
return false; return false;
@ -220,23 +217,4 @@ public class GoogleApiClientImpl implements GoogleApiClient {
public void unregisterConnectionFailedListener(OnConnectionFailedListener listener) { public void unregisterConnectionFailedListener(OnConnectionFailedListener listener) {
connectionFailedListeners.remove(listener); connectionFailedListeners.remove(listener);
} }
private class Handler extends android.os.Handler {
private Handler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
if (msg.what == 0 && msg.obj instanceof Runnable) {
((Runnable) msg.obj).run();
} else {
super.handleMessage(msg);
}
}
public void sendRunnable(Runnable runnable) {
sendMessage(obtainMessage(1, runnable));
}
}
} }

View file

@ -0,0 +1,180 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package org.microg.gms.common.api;
import android.content.Context;
import android.os.Bundle;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApi;
import com.google.android.gms.tasks.TaskCompletionSource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GoogleApiManager {
private static GoogleApiManager instance;
private Context context;
private Map<ApiInstance, ApiClient> clientMap = new HashMap<>();
private Map<ApiInstance, List<WaitingApiCall<?>>> waitingApiCallMap = new HashMap<>();
private GoogleApiManager(Context context) {
this.context = context;
}
public synchronized static GoogleApiManager getInstance(Context context) {
if (instance == null) instance = new GoogleApiManager(context);
return instance;
}
private synchronized <O extends Api.ApiOptions, A extends ApiClient> A clientForApi(GoogleApi<O> api) {
ApiInstance apiInstance = new ApiInstance(api);
if (clientMap.containsKey(apiInstance)) {
return (A) clientMap.get(apiInstance);
} else {
ApiClient client = api.api.getBuilder().build(api.getOptions(), context, context.getMainLooper(), null, new ConnectionCallback(apiInstance), new ConnectionFailedListener(apiInstance));
clientMap.put(apiInstance, client);
waitingApiCallMap.put(apiInstance, new ArrayList<>());
return (A) client;
}
}
public synchronized <O extends Api.ApiOptions, R, A extends ApiClient> void scheduleTask(GoogleApi<O> api, PendingGoogleApiCall<R, A> apiCall, TaskCompletionSource<R> completionSource) {
A client = clientForApi(api);
boolean connecting = client.isConnecting();
boolean connected = client.isConnected();
if (connected) {
apiCall.execute(client, completionSource);
} else {
waitingApiCallMap.get(new ApiInstance(api)).add(new WaitingApiCall<R>((PendingGoogleApiCall<R, ApiClient>) apiCall, completionSource));
if (!connecting) {
client.connect();
}
}
}
private synchronized void onInstanceConnected(ApiInstance apiInstance, Bundle connectionHint) {
List<WaitingApiCall<?>> waitingApiCalls = waitingApiCallMap.get(apiInstance);
for (WaitingApiCall<?> waitingApiCall : waitingApiCalls) {
waitingApiCall.execute(clientMap.get(apiInstance));
}
waitingApiCalls.clear();
}
private synchronized void onInstanceSuspended(ApiInstance apiInstance, int cause) {
}
private synchronized void onInstanceFailed(ApiInstance apiInstance, ConnectionResult result) {
List<WaitingApiCall<?>> waitingApiCalls = waitingApiCallMap.get(apiInstance);
for (WaitingApiCall<?> waitingApiCall : waitingApiCalls) {
waitingApiCall.failed(new RuntimeException(result.getErrorMessage()));
}
waitingApiCalls.clear();
}
private class ConnectionCallback implements ConnectionCallbacks {
private ApiInstance apiInstance;
public ConnectionCallback(ApiInstance apiInstance) {
this.apiInstance = apiInstance;
}
@Override
public void onConnected(Bundle connectionHint) {
onInstanceConnected(apiInstance, connectionHint);
}
@Override
public void onConnectionSuspended(int cause) {
onInstanceSuspended(apiInstance, cause);
}
}
private class ConnectionFailedListener implements OnConnectionFailedListener {
private ApiInstance apiInstance;
public ConnectionFailedListener(ApiInstance apiInstance) {
this.apiInstance = apiInstance;
}
@Override
public void onConnectionFailed(ConnectionResult result) {
onInstanceFailed(apiInstance, result);
}
}
private static class WaitingApiCall<R> {
private PendingGoogleApiCall<R, ApiClient> apiCall;
private TaskCompletionSource<R> completionSource;
public WaitingApiCall(PendingGoogleApiCall<R, ApiClient> apiCall, TaskCompletionSource<R> completionSource) {
this.apiCall = apiCall;
this.completionSource = completionSource;
}
public void execute(ApiClient client) {
apiCall.execute(client, completionSource);
}
public void failed(Exception e) {
completionSource.setException(e);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WaitingApiCall<?> that = (WaitingApiCall<?>) o;
if (apiCall != null ? !apiCall.equals(that.apiCall) : that.apiCall != null) return false;
return completionSource != null ? completionSource.equals(that.completionSource) : that.completionSource == null;
}
@Override
public int hashCode() {
int result = apiCall != null ? apiCall.hashCode() : 0;
result = 31 * result + (completionSource != null ? completionSource.hashCode() : 0);
return result;
}
}
private static class ApiInstance {
private Class<?> apiClass;
private Api.ApiOptions apiOptions;
public ApiInstance(Class<?> apiClass, Api.ApiOptions apiOptions) {
this.apiClass = apiClass;
this.apiOptions = apiOptions;
}
public ApiInstance(GoogleApi<?> api) {
this(api.getClass(), api.getOptions());
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ApiInstance that = (ApiInstance) o;
if (apiClass != null ? !apiClass.equals(that.apiClass) : that.apiClass != null) return false;
return apiOptions != null ? apiOptions.equals(that.apiOptions) : that.apiOptions == null;
}
@Override
public int hashCode() {
int result = apiClass != null ? apiClass.hashCode() : 0;
result = 31 * result + (apiOptions != null ? apiOptions.hashCode() : 0);
return result;
}
}
}

View file

@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package org.microg.gms.common.api;
import com.google.android.gms.tasks.TaskCompletionSource;
public interface InstantGoogleApiCall<R, A extends ApiClient> extends PendingGoogleApiCall<R, A> {
R execute(A client) throws Exception;
@Override
default void execute(A client, TaskCompletionSource<R> completionSource) {
try {
completionSource.setResult(execute(client));
} catch (Exception e) {
completionSource.setException(e);
}
}
}

View file

@ -0,0 +1,25 @@
/*
* 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);
}

View file

@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package org.microg.gms.common.api;
import com.google.android.gms.tasks.TaskCompletionSource;
public interface PendingGoogleApiCall<R, A extends ApiClient> {
void execute(A client, TaskCompletionSource<R> completionSource);
}

View file

@ -30,8 +30,6 @@ android {
buildToolsVersion "$androidBuildVersionTools" buildToolsVersion "$androidBuildVersionTools"
aidlPackageWhiteList "com/google/android/gms/common/api/Status.aidl" aidlPackageWhiteList "com/google/android/gms/common/api/Status.aidl"
aidlPackageWhiteList "com/google/android/gms/common/data/DataHolder.aidl"
aidlPackageWhiteList "com/google/android/gms/common/images/WebImage.aidl"
aidlPackageWhiteList "com/google/android/gms/common/internal/ICancelToken.aidl" aidlPackageWhiteList "com/google/android/gms/common/internal/ICancelToken.aidl"
aidlPackageWhiteList "com/google/android/gms/common/server/FavaDiagnosticsEntity.aidl" aidlPackageWhiteList "com/google/android/gms/common/server/FavaDiagnosticsEntity.aidl"
aidlPackageWhiteList "com/google/android/gms/dynamic/IObjectWrapper.aidl" aidlPackageWhiteList "com/google/android/gms/dynamic/IObjectWrapper.aidl"

View file

@ -17,7 +17,7 @@
package org.microg.gms.common; package org.microg.gms.common;
public class Constants { public class Constants {
public static final int MAX_REFERENCE_VERSION = 19420 * 1000; public static final int MAX_REFERENCE_VERSION = 202414 * 1000;
public static final String GMS_PACKAGE_NAME = "com.google.android.gms"; public static final String GMS_PACKAGE_NAME = "com.google.android.gms";
public static final String GSF_PACKAGE_NAME = "com.google.android.gsf"; public static final String GSF_PACKAGE_NAME = "com.google.android.gsf";
public static final String GMS_PACKAGE_SIGNATURE_SHA1 = "38918a453d07199354f8b19af05ec6562ced5788"; public static final String GMS_PACKAGE_SIGNATURE_SHA1 = "38918a453d07199354f8b19af05ec6562ced5788";

View file

@ -98,6 +98,7 @@ public enum GmsService {
GASS(116, "com.google.android.gms.gass.START"), GASS(116, "com.google.android.gms.gass.START"),
WORK_ACCOUNT(120), WORK_ACCOUNT(120),
AD_CACHE(123, "com.google.android.gms.ads.service.CACHE"), AD_CACHE(123, "com.google.android.gms.ads.service.CACHE"),
NEARBY_EXPOSURE(236, "com.google.android.gms.nearby.exposurenotification.START")
; ;
public int SERVICE_ID; public int SERVICE_ID;

View file

@ -37,4 +37,6 @@ android {
dependencies { dependencies {
api project(':play-services-basement') api project(':play-services-basement')
api project(':play-services-base-api')
} }

View file

@ -34,5 +34,7 @@ android {
dependencies { dependencies {
api project(':play-services-basement') api project(':play-services-basement')
api project(':play-services-base-api')
api project(':play-services-cast-api') api project(':play-services-cast-api')
} }

View file

@ -24,7 +24,7 @@ import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Result; import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status; import com.google.android.gms.common.api.Status;
import org.microg.gms.cast.CastApiBuilder; import org.microg.gms.cast.CastApiClientBuilder;
import org.microg.gms.cast.CastApiImpl; import org.microg.gms.cast.CastApiImpl;
import org.microg.gms.common.PublicApi; import org.microg.gms.common.PublicApi;
@ -89,7 +89,7 @@ public final class Cast {
/** /**
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Cast features. * Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Cast features.
*/ */
public static final Api<CastOptions> API = new Api<CastOptions>(new CastApiBuilder()); public static final Api<CastOptions> API = new Api<CastOptions>(new CastApiClientBuilder());
/** /**
* An implementation of the CastApi interface. The interface is used to interact with a cast device. * An implementation of the CastApi interface. The interface is used to interact with a cast device.

View file

@ -23,7 +23,7 @@ import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Result; import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status; import com.google.android.gms.common.api.Status;
import org.microg.gms.cast.CastRemoteDisplayApiBuilder; import org.microg.gms.cast.CastRemoteDisplayApiClientBuilder;
import org.microg.gms.cast.CastRemoteDisplayApiImpl; import org.microg.gms.cast.CastRemoteDisplayApiImpl;
import org.microg.gms.common.PublicApi; import org.microg.gms.common.PublicApi;
@ -32,7 +32,7 @@ public final class CastRemoteDisplay {
/** /**
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the CastRemoteDisplay features. * Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the CastRemoteDisplay features.
*/ */
public static final Api<CastRemoteDisplayOptions> API = new Api<CastRemoteDisplayOptions>(new CastRemoteDisplayApiBuilder()); public static final Api<CastRemoteDisplayOptions> API = new Api<CastRemoteDisplayOptions>(new CastRemoteDisplayApiClientBuilder());
/** /**
* An implementation of the CastRemoteDisplayAPI interface. The interface is used to interact with a cast device. * An implementation of the CastRemoteDisplayAPI interface. The interface is used to interact with a cast device.

View file

@ -20,15 +20,16 @@ import android.content.Context;
import android.os.Looper; import android.os.Looper;
import com.google.android.gms.cast.Cast; import com.google.android.gms.cast.Cast;
import com.google.android.gms.common.api.AccountInfo;
import com.google.android.gms.common.api.GoogleApiClient;
import org.microg.gms.common.api.ApiBuilder; import org.microg.gms.common.api.ApiClientBuilder;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClientSettings;
import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class CastApiBuilder implements ApiBuilder<Cast.CastOptions>{ public class CastApiClientBuilder implements ApiClientBuilder<Cast.CastOptions> {
@Override @Override
public ApiConnection build(Context context, Looper looper, Cast.CastOptions options, AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { public ApiClient build(Cast.CastOptions options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
return new CastClientImpl(context, options, callbacks, connectionFailedListener); return new CastClientImpl(context, options, callbacks, connectionFailedListener);
} }
} }

View file

@ -19,11 +19,12 @@ package org.microg.gms.cast;
import android.content.Context; import android.content.Context;
import com.google.android.gms.cast.Cast; import com.google.android.gms.cast.Cast;
import com.google.android.gms.common.api.GoogleApiClient;
import org.microg.gms.common.DummyApiConnection; import org.microg.gms.common.DummyApiClient;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class CastClientImpl extends DummyApiConnection { public class CastClientImpl extends DummyApiClient {
public CastClientImpl(Context context, Cast.CastOptions options, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { public CastClientImpl(Context context, Cast.CastOptions options, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
} }
} }

View file

@ -20,16 +20,17 @@ import android.content.Context;
import android.os.Looper; import android.os.Looper;
import com.google.android.gms.cast.CastRemoteDisplay; import com.google.android.gms.cast.CastRemoteDisplay;
import com.google.android.gms.common.api.AccountInfo;
import com.google.android.gms.common.api.GoogleApiClient;
import org.microg.gms.common.DummyApiConnection; import org.microg.gms.common.DummyApiClient;
import org.microg.gms.common.api.ApiBuilder; import org.microg.gms.common.api.ApiClientBuilder;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClientSettings;
import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class CastRemoteDisplayApiBuilder implements ApiBuilder<CastRemoteDisplay.CastRemoteDisplayOptions> { public class CastRemoteDisplayApiClientBuilder implements ApiClientBuilder<CastRemoteDisplay.CastRemoteDisplayOptions> {
@Override @Override
public ApiConnection build(Context context, Looper looper, CastRemoteDisplay.CastRemoteDisplayOptions options, AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { public ApiClient build(CastRemoteDisplay.CastRemoteDisplayOptions options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
return new DummyApiConnection(); return new DummyApiClient();
} }
} }

View file

@ -43,5 +43,6 @@ android {
dependencies { dependencies {
api project(':play-services-iid') api project(':play-services-iid')
// compile project(':play-services-measurement')
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0' // TODO
} }

View file

@ -24,9 +24,9 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo; import android.content.pm.ServiceInfo;
import android.os.Build; import android.os.Build;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import androidx.legacy.content.WakefulBroadcastReceiver;
import static org.microg.gms.gcm.GcmConstants.ACTION_C2DM_REGISTRATION; import static org.microg.gms.gcm.GcmConstants.ACTION_C2DM_REGISTRATION;
import static org.microg.gms.gcm.GcmConstants.ACTION_INSTANCE_ID; import static org.microg.gms.gcm.GcmConstants.ACTION_INSTANCE_ID;

View file

@ -44,4 +44,6 @@ android {
dependencies { dependencies {
api project(':play-services-base') api project(':play-services-base')
api project(':play-services-iid-api') api project(':play-services-iid-api')
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0' // TODO
} }

View file

@ -25,7 +25,7 @@ import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.support.v4.content.WakefulBroadcastReceiver; import androidx.legacy.content.WakefulBroadcastReceiver;
import static org.microg.gms.gcm.GcmConstants.ACTION_C2DM_REGISTRATION; import static org.microg.gms.gcm.GcmConstants.ACTION_C2DM_REGISTRATION;
import static org.microg.gms.gcm.GcmConstants.ACTION_INSTANCE_ID; import static org.microg.gms.gcm.GcmConstants.ACTION_INSTANCE_ID;

View file

@ -34,4 +34,6 @@ android {
dependencies { dependencies {
api project(':play-services-basement') api project(':play-services-basement')
api project(':play-services-base-api')
} }

View file

@ -44,4 +44,6 @@ android {
dependencies { dependencies {
api project(':play-services-base') api project(':play-services-base')
api project(':play-services-location-api') api project(':play-services-location-api')
implementation 'androidx.annotation:annotation:1.1.0'
} }

View file

@ -19,7 +19,7 @@ package com.google.android.gms.location;
import com.google.android.gms.common.api.Api; import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient.Builder; import com.google.android.gms.common.api.GoogleApiClient.Builder;
import org.microg.gms.location.ActivityRecognitionApiBuilder; import org.microg.gms.location.ActivityRecognitionApiClientBuilder;
import org.microg.gms.location.ActivityRecognitionApiImpl; import org.microg.gms.location.ActivityRecognitionApiImpl;
/** /**
@ -31,7 +31,7 @@ public class ActivityRecognition {
/** /**
* Token to pass to {@link Builder#addApi(Api)} to enable ContextServices. * Token to pass to {@link Builder#addApi(Api)} to enable ContextServices.
*/ */
public static final Api<Api.ApiOptions.NoOptions> API = new Api<Api.ApiOptions.NoOptions>(new ActivityRecognitionApiBuilder()); public static final Api<Api.ApiOptions.NoOptions> API = new Api<Api.ApiOptions.NoOptions>(new ActivityRecognitionApiClientBuilder());
/** /**
* Entry point to the activity recognition APIs. * Entry point to the activity recognition APIs.

View file

@ -26,6 +26,7 @@ import com.google.android.gms.common.api.Status;
import org.microg.gms.location.LocationConstants; import org.microg.gms.location.LocationConstants;
@Deprecated
public interface FusedLocationProviderApi { public interface FusedLocationProviderApi {
@Deprecated @Deprecated
String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION"; String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";

View file

@ -0,0 +1,42 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.location;
import android.content.Context;
import android.location.Location;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApi;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import org.microg.gms.common.PublicApi;
import org.microg.gms.common.api.InstantGoogleApiCall;
import org.microg.gms.common.api.PendingGoogleApiCall;
import org.microg.gms.location.LocationClientImpl;
@PublicApi
public class FusedLocationProviderClient extends GoogleApi<Api.ApiOptions.NoOptions> {
@PublicApi(exclude = true)
public FusedLocationProviderClient(Context context) {
super(context, LocationServices.API);
}
public Task<Void> flushLocations() {
return scheduleTask(new PendingGoogleApiCall<Void, LocationClientImpl>() {
@Override
public void execute(LocationClientImpl client, TaskCompletionSource<Void> completionSource) {
completionSource.setResult(null);
}
});
}
public Task<Location> getLastLocation() {
return scheduleTask((InstantGoogleApiCall<Location, LocationClientImpl>) LocationClientImpl::getLastLocation);
}
}

View file

@ -36,6 +36,7 @@ import java.util.List;
* .build() * .build()
* </pre> * </pre>
*/ */
@Deprecated
public interface GeofencingApi { public interface GeofencingApi {
PendingResult<Status> addGeofences(GoogleApiClient client, GeofencingRequest geofencingRequest, PendingIntent pendingIntent); PendingResult<Status> addGeofences(GoogleApiClient client, GeofencingRequest geofencingRequest, PendingIntent pendingIntent);

View file

@ -16,12 +16,14 @@
package com.google.android.gms.location; package com.google.android.gms.location;
import android.content.Context;
import com.google.android.gms.common.api.Api; import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient.Builder; import com.google.android.gms.common.api.GoogleApiClient.Builder;
import org.microg.gms.location.FusedLocationProviderApiImpl; import org.microg.gms.location.FusedLocationProviderApiImpl;
import org.microg.gms.location.GeofencingApiImpl; import org.microg.gms.location.GeofencingApiImpl;
import org.microg.gms.location.LocationServicesApiBuilder; import org.microg.gms.location.LocationServicesApiClientBuilder;
import org.microg.gms.location.SettingsApiImpl; import org.microg.gms.location.SettingsApiImpl;
/** /**
@ -31,20 +33,27 @@ public class LocationServices {
/** /**
* Token to pass to {@link Builder#addApi(Api)} to enable LocationServices. * Token to pass to {@link Builder#addApi(Api)} to enable LocationServices.
*/ */
public static final Api<Api.ApiOptions.NoOptions> API = new Api<Api.ApiOptions.NoOptions>(new LocationServicesApiBuilder()); public static final Api<Api.ApiOptions.NoOptions> API = new Api<Api.ApiOptions.NoOptions>(new LocationServicesApiClientBuilder());
/** /**
* Entry point to the fused location APIs. * Entry point to the fused location APIs.
*/ */
@Deprecated
public static final FusedLocationProviderApi FusedLocationApi = new FusedLocationProviderApiImpl(); public static final FusedLocationProviderApi FusedLocationApi = new FusedLocationProviderApiImpl();
/** /**
* Entry point to the geofencing APIs. * Entry point to the geofencing APIs.
*/ */
@Deprecated
public static final GeofencingApi GeofencingApi = new GeofencingApiImpl(); public static final GeofencingApi GeofencingApi = new GeofencingApiImpl();
/** /**
* Entry point to the location settings-enabler dialog APIs. * Entry point to the location settings-enabler dialog APIs.
*/ */
@Deprecated
public static final SettingsApi SettingsApi = new SettingsApiImpl(); public static final SettingsApi SettingsApi = new SettingsApiImpl();
public static FusedLocationProviderClient getFusedLocationProviderClient(Context context) {
return new FusedLocationProviderClient(context);
}
} }

View file

@ -25,6 +25,7 @@ import com.google.android.gms.common.api.PendingResult;
* This API makes it easy for an app to ensure that the device's system settings are properly * This API makes it easy for an app to ensure that the device's system settings are properly
* configured for the app's location needs. * configured for the app's location needs.
*/ */
@Deprecated
public interface SettingsApi { public interface SettingsApi {
/** /**
* Checks if the relevant system settings are enabled on the device to carry out the desired * Checks if the relevant system settings are enabled on the device to carry out the desired

View file

@ -19,16 +19,17 @@ package org.microg.gms.location;
import android.content.Context; import android.content.Context;
import android.os.Looper; import android.os.Looper;
import com.google.android.gms.common.api.AccountInfo; import com.google.android.gms.common.api.Api.ApiOptions.NoOptions;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import org.microg.gms.common.api.ApiBuilder; import org.microg.gms.common.api.ApiClientBuilder;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClientSettings;
import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class ActivityRecognitionApiBuilder implements ApiBuilder<Api.ApiOptions.NoOptions> { public class ActivityRecognitionApiClientBuilder implements ApiClientBuilder<NoOptions> {
@Override @Override
public ApiConnection build(Context context, Looper looper, Api.ApiOptions.NoOptions options, AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { public ApiClient build(NoOptions options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
return new ActivityRecognitionClientImpl(context, callbacks, connectionFailedListener); return new ActivityRecognitionClientImpl(context, callbacks, connectionFailedListener);
} }
} }

View file

@ -20,10 +20,11 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.os.RemoteException; import android.os.RemoteException;
import com.google.android.gms.common.api.GoogleApiClient; import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class ActivityRecognitionClientImpl extends GoogleLocationManagerClient { public class ActivityRecognitionClientImpl extends GoogleLocationManagerClient {
public ActivityRecognitionClientImpl(Context context, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { public ActivityRecognitionClientImpl(Context context, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
super(context, callbacks, connectionFailedListener); super(context, callbacks, connectionFailedListener);
} }

View file

@ -24,7 +24,6 @@ import android.util.Log;
import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status; import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.FusedLocationProviderApi; import com.google.android.gms.location.FusedLocationProviderApi;
import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationListener;
@ -32,8 +31,8 @@ import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices; import com.google.android.gms.location.LocationServices;
import org.microg.gms.common.GmsConnector; import org.microg.gms.common.GmsConnector;
import org.microg.gms.common.api.ApiConnection;
@SuppressWarnings("deprecation")
public class FusedLocationProviderApiImpl implements FusedLocationProviderApi { public class FusedLocationProviderApiImpl implements FusedLocationProviderApi {
private static final String TAG = "GmsFusedApiImpl"; private static final String TAG = "GmsFusedApiImpl";

View file

@ -18,8 +18,8 @@ package org.microg.gms.location;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.os.RemoteException; import android.os.RemoteException;
import android.support.annotation.NonNull;
import android.util.Log; import androidx.annotation.NonNull;
import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.PendingResult;

View file

@ -21,17 +21,18 @@ import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.internal.IGmsServiceBroker; import com.google.android.gms.common.internal.IGmsServiceBroker;
import com.google.android.gms.location.internal.IGoogleLocationManagerService; import com.google.android.gms.location.internal.IGoogleLocationManagerService;
import org.microg.gms.common.Constants; import org.microg.gms.common.Constants;
import org.microg.gms.common.GmsClient; import org.microg.gms.common.GmsClient;
import org.microg.gms.common.GmsService; import org.microg.gms.common.GmsService;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public abstract class GoogleLocationManagerClient extends GmsClient<IGoogleLocationManagerService> { public abstract class GoogleLocationManagerClient extends GmsClient<IGoogleLocationManagerService> {
public GoogleLocationManagerClient(Context context, GoogleApiClient.ConnectionCallbacks public GoogleLocationManagerClient(Context context, ConnectionCallbacks
callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { callbacks, OnConnectionFailedListener connectionFailedListener) {
super(context, callbacks, connectionFailedListener, GmsService.LOCATION_MANAGER.ACTION); super(context, callbacks, connectionFailedListener, GmsService.LOCATION_MANAGER.ACTION);
} }

View file

@ -33,7 +33,9 @@ import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.internal.IGeofencerCallbacks; import com.google.android.gms.location.internal.IGeofencerCallbacks;
import com.google.android.gms.location.internal.ParcelableGeofence; import com.google.android.gms.location.internal.ParcelableGeofence;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.GoogleApiClientImpl; import org.microg.gms.common.api.GoogleApiClientImpl;
import org.microg.gms.common.api.OnConnectionFailedListener;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -45,8 +47,8 @@ public class LocationClientImpl extends GoogleLocationManagerClient {
private Map<LocationListener, ILocationListener> listenerMap = new HashMap<LocationListener, ILocationListener>(); private Map<LocationListener, ILocationListener> listenerMap = new HashMap<LocationListener, ILocationListener>();
public LocationClientImpl(Context context, GoogleApiClient.ConnectionCallbacks callbacks, public LocationClientImpl(Context context, ConnectionCallbacks callbacks,
GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { OnConnectionFailedListener connectionFailedListener) {
super(context, callbacks, connectionFailedListener); super(context, callbacks, connectionFailedListener);
Log.d(TAG, "<init>"); Log.d(TAG, "<init>");
} }

View file

@ -19,19 +19,17 @@ package org.microg.gms.location;
import android.content.Context; import android.content.Context;
import android.os.Looper; import android.os.Looper;
import com.google.android.gms.common.api.AccountInfo; import com.google.android.gms.common.api.Api.ApiOptions.NoOptions;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import org.microg.gms.common.api.ApiBuilder; import org.microg.gms.common.api.ApiClientBuilder;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClientSettings;
import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class LocationServicesApiBuilder implements ApiBuilder<Api.ApiOptions.NoOptions> { public class LocationServicesApiClientBuilder implements ApiClientBuilder<NoOptions> {
@Override @Override
public ApiConnection build(Context context, Looper looper, public ApiClient build(NoOptions options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
Api.ApiOptions.NoOptions options,
AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks,
GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
return new LocationClientImpl(context, callbacks, connectionFailedListener); return new LocationClientImpl(context, callbacks, connectionFailedListener);
} }
} }

View file

@ -34,4 +34,6 @@ android {
dependencies { dependencies {
api project(':play-services-basement') api project(':play-services-basement')
api project(':play-services-base-api')
} }

View file

@ -23,7 +23,7 @@ import org.microg.gms.common.PublicApi;
import org.microg.gms.wearable.DataApiImpl; import org.microg.gms.wearable.DataApiImpl;
import org.microg.gms.wearable.MessageApiImpl; import org.microg.gms.wearable.MessageApiImpl;
import org.microg.gms.wearable.NodeApiImpl; import org.microg.gms.wearable.NodeApiImpl;
import org.microg.gms.wearable.WearableApiBuilder; import org.microg.gms.wearable.WearableApiClientBuilder;
/** /**
* An API for the Android Wear platform. * An API for the Android Wear platform.
@ -33,7 +33,7 @@ public class Wearable {
/** /**
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Wearable features. * Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Wearable features.
*/ */
public static final Api<WearableOptions> API = new Api<WearableOptions>(new WearableApiBuilder()); public static final Api<WearableOptions> API = new Api<WearableOptions>(new WearableApiClientBuilder());
public static final DataApi DataApi = new DataApiImpl(); public static final DataApi DataApi = new DataApiImpl();
public static final MessageApi MessageApi = new MessageApiImpl(); public static final MessageApi MessageApi = new MessageApiImpl();

View file

@ -19,20 +19,19 @@ package org.microg.gms.wearable;
import android.content.Context; import android.content.Context;
import android.os.Looper; import android.os.Looper;
import com.google.android.gms.common.api.AccountInfo;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.Wearable; import com.google.android.gms.wearable.Wearable;
import org.microg.gms.common.api.ApiBuilder; import org.microg.gms.common.api.ApiClientBuilder;
import org.microg.gms.common.api.ApiConnection; import org.microg.gms.common.api.ApiClientSettings;
import org.microg.gms.common.api.ApiClient;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class WearableApiBuilder implements ApiBuilder<Wearable.WearableOptions> { public class WearableApiClientBuilder implements ApiClientBuilder<Wearable.WearableOptions> {
private static final String TAG = "GmsWearableApi"; private static final String TAG = "GmsWearableApi";
@Override @Override
public ApiConnection build(Context context, Looper looper, Wearable.WearableOptions options, public ApiClient build(Wearable.WearableOptions options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks,
GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
return new WearableClientImpl(context, options, callbacks, connectionFailedListener); return new WearableClientImpl(context, options, callbacks, connectionFailedListener);
} }
} }

View file

@ -26,12 +26,14 @@ import com.google.android.gms.wearable.internal.IWearableService;
import org.microg.gms.common.GmsClient; import org.microg.gms.common.GmsClient;
import org.microg.gms.common.GmsService; import org.microg.gms.common.GmsService;
import org.microg.gms.common.api.ConnectionCallbacks;
import org.microg.gms.common.api.GoogleApiClientImpl; import org.microg.gms.common.api.GoogleApiClientImpl;
import org.microg.gms.common.api.OnConnectionFailedListener;
public class WearableClientImpl extends GmsClient<IWearableService> { public class WearableClientImpl extends GmsClient<IWearableService> {
private static final String TAG = "GmsWearClient"; private static final String TAG = "GmsWearClient";
public WearableClientImpl(Context context, Wearable.WearableOptions options, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { public WearableClientImpl(Context context, Wearable.WearableOptions options, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
super(context, callbacks, connectionFailedListener, GmsService.WEARABLE.ACTION); super(context, callbacks, connectionFailedListener, GmsService.WEARABLE.ACTION);
serviceId = GmsService.WEARABLE.SERVICE_ID; serviceId = GmsService.WEARABLE.SERVICE_ID;
if (options != null && options.firstPartyMode) if (options != null && options.firstPartyMode)

View file

@ -2,24 +2,33 @@ include ':wearable-lib'
include ':play-services-basement' include ':play-services-basement'
include ':play-services-api' include ':play-services-tasks'
include ':play-services-base-api'
include ':play-services-cast-api' include ':play-services-cast-api'
include ':play-services-cast-framework-api' include ':play-services-cast-framework-api'
include ':play-services-iid-api' include ':play-services-iid-api'
include ':play-services-location-api' include ':play-services-location-api'
//include ':play-services-nearby-api'
include ':play-services-wearable-api' include ':play-services-wearable-api'
include ':play-services-base' include ':play-services-api'
include ':play-services-tasks'
include ':play-services-wearable'
include ':play-services-base-core' include ':play-services-base-core'
include ':play-services-location-core' include ':play-services-location-core'
include ':play-services-maps-core-mapbox' include ':play-services-maps-core-mapbox'
include ':play-services-maps-core-vtm'
include ':play-services-maps-core-vtm:vtm-microg-theme' include ':play-services-maps-core-vtm:vtm-microg-theme'
include ':play-services-maps-core-vtm'
include ':play-services-core:microg-ui-tools' // Legacy
include ':play-services-core' include ':play-services-core'
include ':play-services-core:microg-ui-tools'
include ':play-services-base'
include ':play-services-cast'
include ':play-services-gcm'
include ':play-services-iid'
include ':play-services-location'
//include ':play-services-nearby'
include ':play-services-wearable'
include ':play-services'