From c6f5d25850d86a78119c0175678c81178b0500e1 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 27 Aug 2016 12:28:00 +0200 Subject: [PATCH] Update Gradle, Add initial Credential API files --- build.gradle | 38 +++ extern/SafeParcel | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- play-services-api/build.gradle | 13 +- .../gms/auth/api/credentials/Credential.aidl | 3 + .../api/credentials/CredentialRequest.aidl | 3 + .../credentials/internal/DeleteRequest.aidl | 3 + .../internal/GeneratePasswordRequest.aidl | 3 + .../internal/ICredentialsCallbacks.aidl | 10 + .../internal/ICredentialsService.aidl | 15 ++ .../api/credentials/internal/SaveRequest.aidl | 3 + .../gms/auth/api/credentials/Credential.java | 248 ++++++++++++++++++ .../credentials/CredentialPickerConfig.java | 92 +++++++ .../api/credentials/CredentialRequest.java | 75 ++++++ .../gms/auth/api/credentials/IdToken.java | 58 ++++ .../credentials/internal/DeleteRequest.java | 23 ++ .../internal/GeneratePasswordRequest.java | 23 ++ .../api/credentials/internal/SaveRequest.java | 23 ++ play-services-basement/build.gradle | 13 +- .../android/gms/common/data/DataHolder.java | 24 +- play-services-cast-api/build.gradle | 13 +- play-services-iid-api/build.gradle | 13 +- play-services-location-api/build.gradle | 13 +- play-services-wearable-api/build.gradle | 13 +- 24 files changed, 643 insertions(+), 83 deletions(-) create mode 100644 build.gradle create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/Credential.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/CredentialRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsCallbacks.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsService.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/SaveRequest.aidl create mode 100644 play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/Credential.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialPickerConfig.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdToken.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/SaveRequest.java diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..4b3b586b --- /dev/null +++ b/build.gradle @@ -0,0 +1,38 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.1.3' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' + } +} + +allprojects { + apply plugin: 'idea' + ext.androidBuildVersionTools = "23.0.3" +} + +def androidCompileSdk() { return 23 } + +subprojects { + repositories { + jcenter() + } +} diff --git a/extern/SafeParcel b/extern/SafeParcel index 6e2e63bd..7e7fcee2 160000 --- a/extern/SafeParcel +++ b/extern/SafeParcel @@ -1 +1 @@ -Subproject commit 6e2e63bdf0016b094b41f66b15accb4915cf7561 +Subproject commit 7e7fcee20047116b87406ae0e1296489a46bac73 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa76e3eb..06df1f78 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/play-services-api/build.gradle b/play-services-api/build.gradle index 3e899acf..33871ca2 100644 --- a/play-services-api/build.gradle +++ b/play-services-api/build.gradle @@ -14,15 +14,6 @@ * limitations under the License. */ -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' - } -} - apply plugin: 'com.android.library' String getMyVersionName() { @@ -38,8 +29,8 @@ group = 'org.microg' version = getMyVersionName() android { - compileSdkVersion 23 - buildToolsVersion "23.0.3" + compileSdkVersion androidCompileSdk() + buildToolsVersion "$androidBuildVersionTools" defaultConfig { versionName getMyVersionName() diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/Credential.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/Credential.aidl new file mode 100644 index 00000000..82536b93 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/Credential.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.auth.api.credentials; + +parcelable Credential; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/CredentialRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/CredentialRequest.aidl new file mode 100644 index 00000000..d000f32e --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/CredentialRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.auth.api.credentials; + +parcelable CredentialRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.aidl new file mode 100644 index 00000000..7fa0d4ab --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.auth.api.credentials.internal; + +parcelable DeleteRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.aidl new file mode 100644 index 00000000..814f68da --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.auth.api.credentials.internal; + +parcelable GeneratePasswordRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsCallbacks.aidl new file mode 100644 index 00000000..da248c33 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsCallbacks.aidl @@ -0,0 +1,10 @@ +package com.google.android.gms.auth.api.credentials.internal; + +import com.google.android.gms.common.api.Status; +import com.google.android.gms.auth.api.credentials.Credential; + +interface ICredentialsCallbacks { + void onStatusAndCredential(in Status status, in Credential credential) = 0; + void onStatus(in Status status) = 1; + void onStatusAndString(in Status status, String string) = 2; +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsService.aidl new file mode 100644 index 00000000..89c6c7e2 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/ICredentialsService.aidl @@ -0,0 +1,15 @@ +package com.google.android.gms.auth.api.credentials.internal; + +import com.google.android.gms.auth.api.credentials.CredentialRequest; +import com.google.android.gms.auth.api.credentials.internal.ICredentialsCallbacks; +import com.google.android.gms.auth.api.credentials.internal.DeleteRequest; +import com.google.android.gms.auth.api.credentials.internal.GeneratePasswordRequest; +import com.google.android.gms.auth.api.credentials.internal.SaveRequest; + +interface ICredentialsService { + void request(ICredentialsCallbacks callbacks, in CredentialRequest request) = 0; + void save(ICredentialsCallbacks callbacks, in SaveRequest request) = 1; + void delete(ICredentialsCallbacks callbacks, in DeleteRequest request) = 2; + void disableAutoSignIn(ICredentialsCallbacks callbacks) = 3; + void generatePassword(ICredentialsCallbacks callbacks, in GeneratePasswordRequest request) = 4; +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/SaveRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/SaveRequest.aidl new file mode 100644 index 00000000..b5bcb593 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/auth/api/credentials/internal/SaveRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.auth.api.credentials.internal; + +parcelable SaveRequest; \ No newline at end of file diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/Credential.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/Credential.java new file mode 100644 index 00000000..db4b41f7 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/Credential.java @@ -0,0 +1,248 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.auth.api.credentials; + +import android.net.Uri; +import android.text.TextUtils; + +import org.microg.gms.common.PublicApi; +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import java.util.Arrays; +import java.util.List; + +@PublicApi +public class Credential extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + private String id; + + @SafeParceled(2) + private String name; + + @SafeParceled(3) + private Uri profilePictureUri; + + @SafeParceled(value = 4, subClass = IdToken.class) + private List tokens; + + @SafeParceled(5) + private String password; + + @SafeParceled(6) + private String accountType; + + @SafeParceled(7) + private String generatedPassword; + + private Credential() { + } + + /** + * Returns the type of federated identity account used to sign in the user. While this may be + * any string, it is strongly recommended that values from {@link com.google.android.gms.auth.api.credentials.IdentityProviders} + * are used, which are the login domains for common identity providers. + * + * @return A string identifying the federated identity provider associated with this account, + * typically in the form of the identity provider's login domain. null will be returned if the + * credential is a password credential. + */ + public String getAccountType() { + return accountType; + } + + /** + * Returns the generated password for an account hint. + */ + public String getGeneratedPassword() { + return generatedPassword; + } + + /** + * Returns the credential identifier, typically an email address or user name, though it may + * also be some encoded unique identifier for a federated identity account. + */ + public String getId() { + return id; + } + + /** + * Returns the ID tokens that assert the identity of the user, if available. ID tokens provide + * a secure mechanism to verify that the user owns the identity asserted by the credential. + *

+ * This is useful for account hints, where the ID token can replace the need to separately + * verify that the user owns their claimed email address - with a valid ID token, it is not + * necessary to send an account activation link to the address, simplifying the account + * creation process for the user. + *

+ * A signed ID token is returned automatically for credential hints when the credential ID is a + * Google account that is authenticated on the device. This ID token can be sent along with + * your application's account creation operation, where the signature can be verified. + */ + public List getIdTokens() { + return tokens; + } + + /** + * Returns the display name of the credential, if available. Typically, the display name will + * be the name of the user, or some other string which the user can easily recognize and + * distinguish from other accounts they may have. + */ + public String getName() { + return name; + } + + /** + * Returns the password used to sign in the user. + */ + public String getPassword() { + return password; + } + + /** + * Returns the URL to an image of the user, if available. + */ + public Uri getProfilePictureUri() { + return profilePictureUri; + } + + @PublicApi(exclude = true) + public String getAsString() { + if (TextUtils.isEmpty(accountType)) { + return id.toLowerCase() + "|"; + } else { + Uri uri = Uri.parse(accountType); + return id.toLowerCase() + "|" + (TextUtils.isEmpty(uri.getScheme()) ? "" : uri.getScheme().toLowerCase()) + "://" + + (TextUtils.isEmpty(uri.getHost()) ? "unknown" : uri.getHost().toLowerCase()) + ":" + uri.getPort(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || !(o instanceof Credential)) return false; + + Credential that = (Credential) o; + + if (id != null ? !id.equals(that.id) : that.id != null) return false; + if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (profilePictureUri != null ? !profilePictureUri.equals(that.profilePictureUri) : that.profilePictureUri != null) + return false; + if (password != null ? !password.equals(that.password) : that.password != null) + return false; + if (accountType != null ? !accountType.equals(that.accountType) : that.accountType != null) + return false; + return generatedPassword != null ? generatedPassword.equals(that.generatedPassword) : that.generatedPassword == null; + + } + + @Override + public int hashCode() { + return Arrays.hashCode(new Object[]{id, name, profilePictureUri, password, accountType, generatedPassword}); + } + + public static class Builder { + private String id; + private String name; + private Uri profilePictureUri; + private String password; + private String accountType; + + @PublicApi(exclude = true) + public List tokens; + @PublicApi(exclude = true) + private String generatedPassword; + + public Builder(String id) { + this.id = id; + } + + /** + * Copies the information stored in an existing credential, in order to allow that information to be modified. + * + * @param credential the existing credential + */ + public Builder(Credential credential) { + this.id = credential.id; + this.name = credential.name; + this.profilePictureUri = credential.profilePictureUri; + this.password = credential.password; + this.accountType = credential.accountType; + this.tokens = credential.tokens; + this.generatedPassword = credential.generatedPassword; + } + + public Credential build() { + Credential credential = new Credential(); + credential.id = id; + credential.name = name; + credential.profilePictureUri = profilePictureUri; + credential.password = password; + credential.accountType = accountType; + credential.tokens = tokens; + credential.generatedPassword = generatedPassword; + return credential; + } + + /** + * Specifies the account type for a federated credential. The value should be set to + * identity provider's login domain, such as "https://accounts.google.com" for Google + * accounts. The login domains for common identity providers are listed in {@link IdentityProviders}. + * + * @param accountType The type of the account. Typically, one of the values in {@link IdentityProviders}. + */ + public Builder setAccountType(String accountType) { + this.accountType = accountType; + return this; + } + + /** + * Sets the display name for the credential, which should be easy for the user to recognize + * as associated to the credential, and distinguishable from other credentials they may + * have. This string will be displayed more prominently than, or instead of, the account ID + * whenever available. In most cases, the name of the user is sufficient. + */ + public Builder setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the password for the credential. Either the password or the account type must be + * set for a credential, but not both. + */ + public Builder setPassword(String password) { + this.password = password; + return this; + } + + /** + * Sets a profile picture associated with the credential, typically a picture the user has + * selected to represent the account. + */ + public Builder setProfilePictureUri(Uri profilePictureUri) { + this.profilePictureUri = profilePictureUri; + return this; + } + } + + public static final Creator CREATOR = new AutoCreator(Credential.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialPickerConfig.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialPickerConfig.java new file mode 100644 index 00000000..3cd60f62 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialPickerConfig.java @@ -0,0 +1,92 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.auth.api.credentials; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class CredentialPickerConfig extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + private boolean showAddAccountButton; + + @SafeParceled(2) + private boolean showCancelButton; + + @SafeParceled(3) + private boolean forNewAccount; + + private CredentialPickerConfig() { + } + + public CredentialPickerConfig(boolean showAddAccountButton, boolean showCancelButton, boolean forNewAccount) { + this.showAddAccountButton = showAddAccountButton; + this.showCancelButton = showCancelButton; + this.forNewAccount = forNewAccount; + } + + public boolean isForNewAccount() { + return forNewAccount; + } + + public boolean shouldShowAddAccountButton() { + return showAddAccountButton; + } + + public boolean shouldShowCancelButton() { + return showCancelButton; + } + + public class Builder { + private boolean showAddAccountButton; + private boolean showCancelButton; + private boolean forNewAccount; + + public CredentialPickerConfig build() { + return new CredentialPickerConfig(showAddAccountButton, showCancelButton, forNewAccount); + } + + /** + * Sets whether the hint request is for a new account sign-up flow. + */ + public Builder setForNewAccount(boolean forNewAccount) { + this.forNewAccount = forNewAccount; + return this; + } + + /** + * Sets whether the add account button should be shown in credential picker dialog. + */ + public Builder setShowAddAccountButton(boolean showAddAccountButton) { + this.showAddAccountButton = showAddAccountButton; + return this; + } + + /** + * Sets whether the cancel button should be shown in credential picker dialog. + */ + public Builder setShowCancelButton(boolean showCancelButton) { + this.showCancelButton = showCancelButton; + return this; + } + } + + public static final Creator CREATOR = new AutoCreator(CredentialPickerConfig.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialRequest.java new file mode 100644 index 00000000..632ae5f6 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/CredentialRequest.java @@ -0,0 +1,75 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.auth.api.credentials; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +/** + * Parameters for requesting a Credential, via Auth.CredentialsApi.request(). Instances can be + * created using CredentialRequest.Builder. + */ +public class CredentialRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + private boolean passwordLoginSupported; + + @SafeParceled(2) + private String[] accountTypes; + + @SafeParceled(3) + private CredentialPickerConfig credentialPickerConfig; + + @SafeParceled(4) + private CredentialPickerConfig credentialHintPickerConfig; + + public CredentialRequest(boolean passwordLoginSupported, String[] accountTypes, CredentialPickerConfig credentialPickerConfig, CredentialPickerConfig credentialHintPickerConfig) { + this.passwordLoginSupported = passwordLoginSupported; + this.accountTypes = accountTypes; + this.credentialPickerConfig = credentialPickerConfig; + this.credentialHintPickerConfig = credentialHintPickerConfig; + } + + public String[] getAccountTypes() { + return accountTypes; + } + + public CredentialPickerConfig getCredentialHintPickerConfig() { + return credentialHintPickerConfig; + } + + public CredentialPickerConfig getCredentialPickerConfig() { + return credentialPickerConfig; + } + + /** + * @deprecated Use {@link #isPasswordLoginSupported()} + */ + @Deprecated + public boolean getSupportsPasswordLogin() { + return isPasswordLoginSupported(); + } + + public boolean isPasswordLoginSupported() { + return passwordLoginSupported; + } + + public static final Creator CREATOR = new AutoCreator(CredentialRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdToken.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdToken.java new file mode 100644 index 00000000..497ee887 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/IdToken.java @@ -0,0 +1,58 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.auth.api.credentials; + +import org.microg.gms.common.PublicApi; +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +@PublicApi +public class IdToken extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + private String accountType; + + @SafeParceled(2) + private String id; + + private IdToken() { + } + + public IdToken(String accountType, String id) { + this.accountType = accountType; + this.id = id; + } + + /** + * Returns {@code AccountManager} account type for the token. + */ + public String getAccountType() { + return accountType; + } + + /** + * Returns the ID token, formatted according to the rules defined by the account type. + */ + public String getIdToken() { + return id; + } + + public static final Creator CREATOR = new AutoCreator(IdToken.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.java new file mode 100644 index 00000000..973c1854 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/DeleteRequest.java @@ -0,0 +1,23 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.auth.api.credentials.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class DeleteRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator(DeleteRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.java new file mode 100644 index 00000000..b412bd50 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/GeneratePasswordRequest.java @@ -0,0 +1,23 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.auth.api.credentials.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class GeneratePasswordRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator(GeneratePasswordRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/SaveRequest.java b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/SaveRequest.java new file mode 100644 index 00000000..d028e30f --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/auth/api/credentials/internal/SaveRequest.java @@ -0,0 +1,23 @@ +/* + * Copyright 2013-2016 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.auth.api.credentials.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SaveRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator(SaveRequest.class); +} diff --git a/play-services-basement/build.gradle b/play-services-basement/build.gradle index 796ea36c..38d7eb7f 100644 --- a/play-services-basement/build.gradle +++ b/play-services-basement/build.gradle @@ -14,15 +14,6 @@ * limitations under the License. */ -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' - } -} - apply plugin: 'com.android.library' String getMyVersionName() { @@ -40,8 +31,8 @@ group = 'org.microg' version = getMyVersionName() android { - compileSdkVersion 23 - buildToolsVersion "23.0.3" + compileSdkVersion androidCompileSdk() + buildToolsVersion "$androidBuildVersionTools" aidlPackageWhiteList "com/google/android/gms/common/internal/ICancelToken.aidl" aidlPackageWhiteList "com/google/android/gms/dynamic/IObjectWrapper.aidl" diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/data/DataHolder.java b/play-services-basement/src/main/java/com/google/android/gms/common/data/DataHolder.java index 51a4a602..e749abfd 100644 --- a/play-services-basement/src/main/java/com/google/android/gms/common/data/DataHolder.java +++ b/play-services-basement/src/main/java/com/google/android/gms/common/data/DataHolder.java @@ -61,7 +61,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { private final Bundle metadata; private boolean closed = false; - private Map columnIndizes; + private Map columnIndices; protected static final int FIELD_TYPE_NULL = 0; protected static final int FIELD_TYPE_INTEGER = 1; @@ -300,12 +300,6 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { return windows.toArray(new CursorWindow[windows.size()]); } - @PublicApi(exclude = true) - @Deprecated - public static DataHolder fromCursor(Cursor cursor, int statusCode, Bundle metadata) { - return new DataHolder(cursor, statusCode, metadata); - } - /** * Retrieves the boolean value for a given column at the provided position. * This will throw an {@link IllegalArgumentException} if the column does not exist, the @@ -317,7 +311,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { * @return The boolean value in that column. */ public boolean getBoolean(String column, int row, int windowIndex) { - return windows[windowIndex].getLong(row, columnIndizes.get(column)) == 1; + return windows[windowIndex].getLong(row, columnIndices.get(column)) == 1; } /** @@ -331,7 +325,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { * @return The byte array value in that column. */ public byte[] getByteArray(String column, int row, int windowIndex) { - return windows[windowIndex].getBlob(row, columnIndizes.get(column)); + return windows[windowIndex].getBlob(row, columnIndices.get(column)); } /** @@ -360,7 +354,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { * @return The integer value in that column. */ public int getInteger(String column, int row, int windowIndex) { - return windows[windowIndex].getInt(row, columnIndizes.get(column)); + return windows[windowIndex].getInt(row, columnIndices.get(column)); } /** @@ -374,7 +368,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { * @return The long value in that column. */ public long getLong(String column, int row, int windowIndex) { - return windows[windowIndex].getLong(row, columnIndizes.get(column)); + return windows[windowIndex].getLong(row, columnIndices.get(column)); } public int getStatusCode() { @@ -392,7 +386,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { * @return The string value in that column. */ public String getString(String column, int row, int windowIndex) { - return windows[windowIndex].getString(row, columnIndizes.get(column)); + return windows[windowIndex].getString(row, columnIndices.get(column)); } /** @@ -406,7 +400,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { * @return Whether the column value is null at this position. */ public boolean isNull(String column, int row, int windowIndex) { - return windows[windowIndex].isNull(row, columnIndizes.get(column)); + return windows[windowIndex].isNull(row, columnIndices.get(column)); } public boolean isClosed() { @@ -442,9 +436,9 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { } public void validateContents() { - columnIndizes = new HashMap(); + columnIndices = new HashMap(); for (int i = 0; i < columns.length; i++) { - columnIndizes.put(columns[i], i); + columnIndices.put(columns[i], i); } } diff --git a/play-services-cast-api/build.gradle b/play-services-cast-api/build.gradle index 3ce1445d..b4ddb5c3 100644 --- a/play-services-cast-api/build.gradle +++ b/play-services-cast-api/build.gradle @@ -14,15 +14,6 @@ * limitations under the License. */ -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' - } -} - apply plugin: 'com.android.library' String getMyVersionName() { @@ -38,8 +29,8 @@ group = 'org.microg' version = getMyVersionName() android { - compileSdkVersion 23 - buildToolsVersion "23.0.3" + compileSdkVersion androidCompileSdk() + buildToolsVersion "$androidBuildVersionTools" defaultConfig { versionName getMyVersionName() diff --git a/play-services-iid-api/build.gradle b/play-services-iid-api/build.gradle index 3ce1445d..b4ddb5c3 100644 --- a/play-services-iid-api/build.gradle +++ b/play-services-iid-api/build.gradle @@ -14,15 +14,6 @@ * limitations under the License. */ -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' - } -} - apply plugin: 'com.android.library' String getMyVersionName() { @@ -38,8 +29,8 @@ group = 'org.microg' version = getMyVersionName() android { - compileSdkVersion 23 - buildToolsVersion "23.0.3" + compileSdkVersion androidCompileSdk() + buildToolsVersion "$androidBuildVersionTools" defaultConfig { versionName getMyVersionName() diff --git a/play-services-location-api/build.gradle b/play-services-location-api/build.gradle index 3ce1445d..b4ddb5c3 100644 --- a/play-services-location-api/build.gradle +++ b/play-services-location-api/build.gradle @@ -14,15 +14,6 @@ * limitations under the License. */ -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' - } -} - apply plugin: 'com.android.library' String getMyVersionName() { @@ -38,8 +29,8 @@ group = 'org.microg' version = getMyVersionName() android { - compileSdkVersion 23 - buildToolsVersion "23.0.3" + compileSdkVersion androidCompileSdk() + buildToolsVersion "$androidBuildVersionTools" defaultConfig { versionName getMyVersionName() diff --git a/play-services-wearable-api/build.gradle b/play-services-wearable-api/build.gradle index 3ce1445d..b4ddb5c3 100644 --- a/play-services-wearable-api/build.gradle +++ b/play-services-wearable-api/build.gradle @@ -14,15 +14,6 @@ * limitations under the License. */ -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' - } -} - apply plugin: 'com.android.library' String getMyVersionName() { @@ -38,8 +29,8 @@ group = 'org.microg' version = getMyVersionName() android { - compileSdkVersion 23 - buildToolsVersion "23.0.3" + compileSdkVersion androidCompileSdk() + buildToolsVersion "$androidBuildVersionTools" defaultConfig { versionName getMyVersionName()