From e1ee43164a2e33475f65b7d6d7af36bdfa6f09a5 Mon Sep 17 00:00:00 2001 From: Oizaro Date: Mon, 28 Dec 2020 06:55:05 +0100 Subject: [PATCH] Restore Firebase + Cleanup code --- README.md | 1 - build.gradle | 1 + firebase-auth-api/build.gradle | 26 + .../src/main/AndroidManifest.xml | 7 + .../firebase/auth/ActionCodeSettings.aidl | 3 + .../firebase/auth/EmailAuthCredential.aidl | 3 + .../firebase/auth/PhoneAuthCredential.aidl | 3 + .../auth/UserProfileChangeRequest.aidl | 3 + .../internal/ApplyActionCodeAidlRequest.aidl | 3 + .../api/internal/ChangeEmailAidlRequest.aidl | 3 + .../internal/ChangePasswordAidlRequest.aidl | 3 + .../internal/CheckActionCodeAidlRequest.aidl | 3 + .../ConfirmPasswordResetAidlRequest.aidl | 3 + .../api/internal/CreateAuthUriResponse.aidl | 3 + ...teUserWithEmailAndPasswordAidlRequest.aidl | 3 + .../auth/api/internal/DeleteAidlRequest.aidl | 3 + .../FinalizeMfaEnrollmentAidlRequest.aidl | 3 + .../FinalizeMfaSignInAidlRequest.aidl | 3 + .../internal/GetAccessTokenAidlRequest.aidl | 3 + .../auth/api/internal/GetAccountInfoUser.aidl | 3 + .../GetProvidersForEmailAidlRequest.aidl | 3 + .../auth/api/internal/GetTokenResponse.aidl | 3 + .../api/internal/IFirebaseAuthCallbacks.aidl | 22 + .../api/internal/IFirebaseAuthService.aidl | 108 +++ .../LinkEmailAuthCredentialAidlRequest.aidl | 3 + .../LinkFederatedCredentialAidlRequest.aidl | 3 + .../LinkPhoneAuthCredentialAidlRequest.aidl | 3 + .../auth/api/internal/ReloadAidlRequest.aidl | 3 + .../api/internal/ResetPasswordResponse.aidl | 3 + ...ilVerificationWithSettingsAidlRequest.aidl | 3 + ...etOobConfirmationCodeEmailAidlRequest.aidl | 3 + .../SendVerificationCodeAidlRequest.aidl | 3 + .../internal/SendVerificationCodeRequest.aidl | 3 + .../SetFirebaseUiVersionAidlRequest.aidl | 3 + .../SignInAnonymouslyAidlRequest.aidl | 3 + .../SignInWithCredentialAidlRequest.aidl | 3 + .../SignInWithCustomTokenAidlRequest.aidl | 3 + ...SignInWithEmailAndPasswordAidlRequest.aidl | 3 + .../SignInWithEmailLinkAidlRequest.aidl | 3 + .../SignInWithPhoneNumberAidlRequest.aidl | 3 + ...rtMfaPhoneNumberEnrollmentAidlRequest.aidl | 3 + .../StartMfaPhoneNumberSignInAidlRequest.aidl | 3 + .../auth/api/internal/StringList.aidl | 3 + .../api/internal/UnenrollMfaAidlRequest.aidl | 3 + .../UnlinkEmailCredentialAidlRequest.aidl | 3 + .../UnlinkFederatedCredentialAidlRequest.aidl | 3 + .../internal/UpdateProfileAidlRequest.aidl | 3 + .../api/internal/VerifyAssertionRequest.aidl | 3 + .../VerifyBeforeUpdateEmailAidlRequest.aidl | 3 + .../firebase/auth/ActionCodeSettings.java | 182 +++++ .../google/firebase/auth/AuthCredential.java | 28 + .../firebase/auth/DefaultOAuthCredential.java | 65 ++ .../firebase/auth/EmailAuthCredential.java | 54 ++ .../google/firebase/auth/OAuthCredential.java | 32 + .../firebase/auth/PhoneAuthCredential.java | 64 ++ .../auth/UserProfileChangeRequest.java | 88 +++ .../internal/ApplyActionCodeAidlRequest.java | 12 + .../api/internal/ChangeEmailAidlRequest.java | 12 + .../internal/ChangePasswordAidlRequest.java | 12 + .../internal/CheckActionCodeAidlRequest.java | 12 + .../ConfirmPasswordResetAidlRequest.java | 12 + .../api/internal/CreateAuthUriResponse.java | 27 + ...teUserWithEmailAndPasswordAidlRequest.java | 19 + .../auth/api/internal/DeleteAidlRequest.java | 12 + .../FinalizeMfaEnrollmentAidlRequest.java | 12 + .../FinalizeMfaSignInAidlRequest.java | 12 + .../internal/GetAccessTokenAidlRequest.java | 15 + .../auth/api/internal/GetAccountInfoUser.java | 43 ++ .../GetProvidersForEmailAidlRequest.java | 16 + .../auth/api/internal/GetTokenResponse.java | 44 ++ .../LinkEmailAuthCredentialAidlRequest.java | 18 + .../LinkFederatedCredentialAidlRequest.java | 12 + .../LinkPhoneAuthCredentialAidlRequest.java | 12 + .../firebase/auth/api/internal/MfaInfo.java | 12 + .../auth/api/internal/ProviderUserInfo.java | 27 + .../api/internal/ProviderUserInfoList.java | 18 + .../auth/api/internal/ReloadAidlRequest.java | 14 + .../api/internal/ResetPasswordResponse.java | 20 + ...ilVerificationWithSettingsAidlRequest.java | 18 + ...etOobConfirmationCodeEmailAidlRequest.java | 20 + .../SendVerificationCodeAidlRequest.java | 14 + .../internal/SendVerificationCodeRequest.java | 25 + .../SetFirebaseUiVersionAidlRequest.java | 12 + .../SignInAnonymouslyAidlRequest.java | 14 + .../SignInWithCredentialAidlRequest.java | 12 + .../SignInWithCustomTokenAidlRequest.java | 17 + ...SignInWithEmailAndPasswordAidlRequest.java | 18 + .../SignInWithEmailLinkAidlRequest.java | 12 + .../SignInWithPhoneNumberAidlRequest.java | 19 + ...rtMfaPhoneNumberEnrollmentAidlRequest.java | 12 + .../StartMfaPhoneNumberSignInAidlRequest.java | 12 + .../auth/api/internal/StringList.java | 19 + .../api/internal/UnenrollMfaAidlRequest.java | 12 + .../UnlinkEmailCredentialAidlRequest.java | 12 + .../UnlinkFederatedCredentialAidlRequest.java | 12 + .../internal/UpdateProfileAidlRequest.java | 18 + .../api/internal/VerifyAssertionRequest.java | 12 + .../VerifyBeforeUpdateEmailAidlRequest.java | 12 + .../microg/gms/firebase/auth/Constants.java | 11 + firebase-auth-core/build.gradle | 45 ++ .../src/main/AndroidManifest.xml | 25 + .../src/main/assets/recaptcha.html | 54 ++ .../gms/firebase/auth/FirebaseAuthService.kt | 651 ++++++++++++++++++ .../firebase/auth/IdentityToolkitClient.kt | 139 ++++ .../gms/firebase/auth/ReCaptchaActivity.kt | 103 +++ .../gms/firebase/auth/ReCaptchaOverlay.kt | 119 ++++ .../main/res/layout/activity_recaptcha.xml | 19 + .../src/main/res/values/themes.xml | 18 + firebase-dynamic-links-api/build.gradle | 49 ++ firebase-dynamic-links-api/gradle.properties | 34 + .../src/main/AndroidManifest.xml | 18 + .../internal/DynamicLinkData.aidl | 3 + .../internal/IDynamicLinksCallbacks.aidl | 11 + .../internal/IDynamicLinksService.aidl | 10 + .../internal/ShortDynamicLink.aidl | 3 + .../dynamiclinks/internal/Warning.aidl | 3 + .../internal/DynamicLinkData.java | 54 ++ .../internal/ShortDynamicLink.java | 46 ++ .../dynamiclinks/internal/Warning.java | 34 + gradlew | 1 - .../idl/CompoundHashParcelable.aidl | 3 + .../connection/idl/ConnectionConfig.aidl | 3 + .../idl/IConnectionAuthTokenProvider.aidl | 7 + .../connection/idl/IGetTokenCallback.aidl | 6 + .../connection/idl/IListenHashProvider.aidl | 11 + .../connection/idl/IPersistentConnection.aidl | 43 ++ .../idl/IPersistentConnectionDelegate.aidl | 19 + .../idl/IRequestResultCallback.aidl | 5 + .../connection/idl/RangeParcelable.aidl | 3 + .../idl/CompoundHashParcelable.java | 23 + .../connection/idl/ConnectionConfig.java | 23 + .../connection/idl/RangeParcelable.java | 23 + .../android/gms/common/data/DataHolder.java | 2 - .../gms/common/GoogleApiAvailability.java | 1 - .../org/microg/gms/common/GmsService.java | 2 + .../com/google/android/gms/cast/Cast.java | 1 - play-services-core/build.gradle | 4 +- .../java/org/microg/tools/ui/Condition.java | 1 - .../src/main/AndroidManifest.xml | 7 +- .../cast/framework/internal/SessionImpl.java | 2 - .../firebase_database/ModuleDescriptor.java | 22 + .../idl/IPersistentConnectionImpl.java | 124 ++++ .../chimera/container/DynamiteLoaderImpl.java | 10 + .../microg/gms/auth/login/LoginActivity.java | 1 - .../java/org/microg/gms/common/Build.java | 1 - .../gms/common/DeviceConfiguration.java | 1 - .../microg/gms/common/DeviceIdentifier.java | 1 - .../org/microg/gms/common/PackageUtils.java | 1 - .../dynamiclinks/DynamicLinksService.java | 49 ++ .../dynamiclinks/DynamicLinksServiceImpl.java | 60 ++ .../java/org/microg/gms/gcm/GcmDatabase.java | 4 - .../java/org/microg/gms/gcm/McsService.java | 1 - .../microg/gms/gcm/PushRegisterManager.java | 2 - .../org/microg/gms/people/DatabaseHelper.java | 1 - .../org/microg/gms/checkin/ServiceInfo.kt | 2 - .../org/microg/gms/gcm/PushRegisterService.kt | 2 +- .../microg/gms/phenotype/PhenotypeService.kt | 2 +- .../gms/ui/DeviceRegistrationFragment.kt | 1 - .../DeviceRegistrationPreferencesFragment.kt | 2 +- .../gms/ui/PushNotificationAppFragment.kt | 1 - .../PushNotificationAppPreferencesFragment.kt | 3 +- .../ui/PushNotificationPreferencesFragment.kt | 2 +- .../gms/location/DetectedActivity.java | 1 - .../android/gms/location/GeofencingEvent.java | 1 - .../gms/location/LocationSettingsResult.java | 1 - .../location/FusedLocationProviderClient.java | 2 - .../FusedLocationProviderApiImpl.java | 1 - .../gms/location/LocationClientImpl.java | 1 - .../com/google/android/gms/tasks/Task.java | 2 - settings.gradle | 9 +- 170 files changed, 3404 insertions(+), 48 deletions(-) create mode 100644 firebase-auth-api/build.gradle create mode 100644 firebase-auth-api/src/main/AndroidManifest.xml create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/ActionCodeSettings.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/EmailAuthCredential.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/PhoneAuthCredential.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/UserProfileChangeRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateAuthUriResponse.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/DeleteAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccountInfoUser.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetTokenResponse.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthCallbacks.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthService.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ReloadAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ResetPasswordResponse.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StringList.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyAssertionRequest.aidl create mode 100644 firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.aidl create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/ActionCodeSettings.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/AuthCredential.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/DefaultOAuthCredential.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/EmailAuthCredential.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/OAuthCredential.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/PhoneAuthCredential.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/UserProfileChangeRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateAuthUriResponse.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/DeleteAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccountInfoUser.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetTokenResponse.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/MfaInfo.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfo.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfoList.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ReloadAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ResetPasswordResponse.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StringList.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyAssertionRequest.java create mode 100644 firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.java create mode 100644 firebase-auth-api/src/main/java/org/microg/gms/firebase/auth/Constants.java create mode 100644 firebase-auth-core/build.gradle create mode 100644 firebase-auth-core/src/main/AndroidManifest.xml create mode 100644 firebase-auth-core/src/main/assets/recaptcha.html create mode 100644 firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/FirebaseAuthService.kt create mode 100644 firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/IdentityToolkitClient.kt create mode 100644 firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaActivity.kt create mode 100644 firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaOverlay.kt create mode 100644 firebase-auth-core/src/main/res/layout/activity_recaptcha.xml create mode 100644 firebase-auth-core/src/main/res/values/themes.xml create mode 100644 firebase-dynamic-links-api/build.gradle create mode 100644 firebase-dynamic-links-api/gradle.properties create mode 100644 firebase-dynamic-links-api/src/main/AndroidManifest.xml create mode 100644 firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/DynamicLinkData.aidl create mode 100644 firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksCallbacks.aidl create mode 100644 firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksService.aidl create mode 100644 firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.aidl create mode 100644 firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/Warning.aidl create mode 100644 firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/DynamicLinkData.java create mode 100644 firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.java create mode 100644 firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/Warning.java create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/CompoundHashParcelable.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/ConnectionConfig.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IConnectionAuthTokenProvider.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IGetTokenCallback.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IListenHashProvider.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnection.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnectionDelegate.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IRequestResultCallback.aidl create mode 100644 play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/RangeParcelable.aidl create mode 100644 play-services-api/src/main/java/com/google/firebase/database/connection/idl/CompoundHashParcelable.java create mode 100644 play-services-api/src/main/java/com/google/firebase/database/connection/idl/ConnectionConfig.java create mode 100644 play-services-api/src/main/java/com/google/firebase/database/connection/idl/RangeParcelable.java create mode 100644 play-services-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/firebase_database/ModuleDescriptor.java create mode 100644 play-services-core/src/main/java/com/google/firebase/database/connection/idl/IPersistentConnectionImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksServiceImpl.java diff --git a/README.md b/README.md index d09f5bcb..6bbc41f1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ This fork tweaks MicroG to be usable by applications that require Google authent - Droidguard - Exposure-Notifications - Feedback - - Firebase - Games - Maps - Recovery diff --git a/build.gradle b/build.gradle index 3f174192..55aa20dd 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ buildscript { ext.recyclerviewVersion = '1.1.0' ext.supportLibraryVersion = "28.0.0" + ext.volleyVersion = '1.1.1' ext.wireVersion = '3.2.2' ext.androidBuildGradleVersion = "4.0.1" diff --git a/firebase-auth-api/build.gradle b/firebase-auth-api/build.gradle new file mode 100644 index 00000000..bb8662f8 --- /dev/null +++ b/firebase-auth-api/build.gradle @@ -0,0 +1,26 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +apply plugin: 'com.android.library' + +android { + compileSdkVersion androidCompileSdk + buildToolsVersion "$androidBuildVersionTools" + + defaultConfig { + versionName version + minSdkVersion androidMinSdk + targetSdkVersion androidTargetSdk + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +} + +dependencies { + api project(':play-services-basement') +} diff --git a/firebase-auth-api/src/main/AndroidManifest.xml b/firebase-auth-api/src/main/AndroidManifest.xml new file mode 100644 index 00000000..95249c36 --- /dev/null +++ b/firebase-auth-api/src/main/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/ActionCodeSettings.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/ActionCodeSettings.aidl new file mode 100644 index 00000000..adedd192 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/ActionCodeSettings.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth; + +parcelable ActionCodeSettings; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/EmailAuthCredential.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/EmailAuthCredential.aidl new file mode 100644 index 00000000..20cabbd4 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/EmailAuthCredential.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth; + +parcelable EmailAuthCredential; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/PhoneAuthCredential.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/PhoneAuthCredential.aidl new file mode 100644 index 00000000..b3d6abbc --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/PhoneAuthCredential.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth; + +parcelable PhoneAuthCredential; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/UserProfileChangeRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/UserProfileChangeRequest.aidl new file mode 100644 index 00000000..123af808 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/UserProfileChangeRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth; + +parcelable UserProfileChangeRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.aidl new file mode 100644 index 00000000..9e0520ba --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable ApplyActionCodeAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.aidl new file mode 100644 index 00000000..e95043ad --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable ChangeEmailAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.aidl new file mode 100644 index 00000000..55457b48 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable ChangePasswordAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.aidl new file mode 100644 index 00000000..6d4afa8f --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable CheckActionCodeAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.aidl new file mode 100644 index 00000000..12f79de9 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable ConfirmPasswordResetAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateAuthUriResponse.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateAuthUriResponse.aidl new file mode 100644 index 00000000..fae42151 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateAuthUriResponse.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable CreateAuthUriResponse; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.aidl new file mode 100644 index 00000000..9191617f --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable CreateUserWithEmailAndPasswordAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/DeleteAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/DeleteAidlRequest.aidl new file mode 100644 index 00000000..d45bda0a --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/DeleteAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable DeleteAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.aidl new file mode 100644 index 00000000..50bfa3b5 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable FinalizeMfaEnrollmentAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.aidl new file mode 100644 index 00000000..2453bd6f --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable FinalizeMfaSignInAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.aidl new file mode 100644 index 00000000..cc44192e --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable GetAccessTokenAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccountInfoUser.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccountInfoUser.aidl new file mode 100644 index 00000000..50c33169 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetAccountInfoUser.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable GetAccountInfoUser; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.aidl new file mode 100644 index 00000000..0760f596 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable GetProvidersForEmailAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetTokenResponse.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetTokenResponse.aidl new file mode 100644 index 00000000..b6838f6d --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/GetTokenResponse.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable GetTokenResponse; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthCallbacks.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthCallbacks.aidl new file mode 100644 index 00000000..9c285521 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthCallbacks.aidl @@ -0,0 +1,22 @@ +package com.google.firebase.auth.api.internal; + +import com.google.android.gms.common.api.Status; +import com.google.firebase.auth.PhoneAuthCredential; +import com.google.firebase.auth.api.internal.CreateAuthUriResponse; +import com.google.firebase.auth.api.internal.GetAccountInfoUser; +import com.google.firebase.auth.api.internal.GetTokenResponse; +import com.google.firebase.auth.api.internal.ResetPasswordResponse; + +interface IFirebaseAuthCallbacks { + void onGetTokenResponse(in GetTokenResponse response) = 0; + void onGetTokenResponseAndUser(in GetTokenResponse response, in GetAccountInfoUser user) = 1; + void onCreateAuthUriResponse(in CreateAuthUriResponse response) = 2; + void onResetPasswordResponse(in ResetPasswordResponse response) = 3; + void onFailure(in Status status) = 4; + void onDeleteAccountResponse() = 5; + void onEmailVerificationResponse() = 6; + + void onSendVerificationCodeResponse(String sessionInfo) = 8; + void onVerificationCompletedResponse(in PhoneAuthCredential credential) = 9; + void onVerificationAutoTimeOut(String sessionInfo) = 10; +} diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthService.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthService.aidl new file mode 100644 index 00000000..07144924 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/IFirebaseAuthService.aidl @@ -0,0 +1,108 @@ +package com.google.firebase.auth.api.internal; + +import com.google.firebase.auth.api.internal.ApplyActionCodeAidlRequest; +import com.google.firebase.auth.api.internal.ChangeEmailAidlRequest; +import com.google.firebase.auth.api.internal.ChangePasswordAidlRequest; +import com.google.firebase.auth.api.internal.CheckActionCodeAidlRequest; +import com.google.firebase.auth.api.internal.ConfirmPasswordResetAidlRequest; +import com.google.firebase.auth.api.internal.CreateUserWithEmailAndPasswordAidlRequest; +import com.google.firebase.auth.api.internal.DeleteAidlRequest; +import com.google.firebase.auth.api.internal.FinalizeMfaEnrollmentAidlRequest; +import com.google.firebase.auth.api.internal.FinalizeMfaSignInAidlRequest; +import com.google.firebase.auth.api.internal.GetAccessTokenAidlRequest; +import com.google.firebase.auth.api.internal.GetProvidersForEmailAidlRequest; +import com.google.firebase.auth.api.internal.IFirebaseAuthCallbacks; +import com.google.firebase.auth.api.internal.LinkEmailAuthCredentialAidlRequest; +import com.google.firebase.auth.api.internal.LinkFederatedCredentialAidlRequest; +import com.google.firebase.auth.api.internal.LinkPhoneAuthCredentialAidlRequest; +import com.google.firebase.auth.api.internal.ReloadAidlRequest; +import com.google.firebase.auth.api.internal.SendEmailVerificationWithSettingsAidlRequest; +import com.google.firebase.auth.api.internal.SendGetOobConfirmationCodeEmailAidlRequest; +import com.google.firebase.auth.api.internal.SendVerificationCodeAidlRequest; +import com.google.firebase.auth.api.internal.SendVerificationCodeRequest; +import com.google.firebase.auth.api.internal.SetFirebaseUiVersionAidlRequest; +import com.google.firebase.auth.api.internal.SignInAnonymouslyAidlRequest; +import com.google.firebase.auth.api.internal.SignInWithCredentialAidlRequest; +import com.google.firebase.auth.api.internal.SignInWithCustomTokenAidlRequest; +import com.google.firebase.auth.api.internal.SignInWithEmailAndPasswordAidlRequest; +import com.google.firebase.auth.api.internal.SignInWithEmailLinkAidlRequest; +import com.google.firebase.auth.api.internal.SignInWithPhoneNumberAidlRequest; +import com.google.firebase.auth.api.internal.StartMfaPhoneNumberEnrollmentAidlRequest; +import com.google.firebase.auth.api.internal.StartMfaPhoneNumberSignInAidlRequest; +import com.google.firebase.auth.api.internal.UnenrollMfaAidlRequest; +import com.google.firebase.auth.api.internal.UnlinkEmailCredentialAidlRequest; +import com.google.firebase.auth.api.internal.UnlinkFederatedCredentialAidlRequest; +import com.google.firebase.auth.api.internal.UpdateProfileAidlRequest; +import com.google.firebase.auth.api.internal.VerifyAssertionRequest; +import com.google.firebase.auth.api.internal.VerifyBeforeUpdateEmailAidlRequest; +import com.google.firebase.auth.ActionCodeSettings; +import com.google.firebase.auth.EmailAuthCredential; +import com.google.firebase.auth.PhoneAuthCredential; +import com.google.firebase.auth.UserProfileChangeRequest; + +interface IFirebaseAuthService { + void getAccessTokenCompat(String refreshToken, IFirebaseAuthCallbacks callbacks) = 0; + void signInWithCustomTokenCompat(String token, IFirebaseAuthCallbacks callbacks) = 1; + void signInWithCredentialCompat(in VerifyAssertionRequest verifyAssertionRequest, IFirebaseAuthCallbacks callbacks) = 2; + void updateProfileCompat(String cachedState, in UserProfileChangeRequest userProfileChangeRequest, IFirebaseAuthCallbacks callbacks) = 3; + void changeEmailCompat(String cachedState, String email, IFirebaseAuthCallbacks callbacks) = 4; + void changePasswordCompat(String cachedState, String password, IFirebaseAuthCallbacks callbacks) = 5; + void createUserWithEmailAndPasswordCompat(String email, String password, IFirebaseAuthCallbacks callbacks) = 6; + void signInWithEmailAndPasswordCompat(String email, String password, IFirebaseAuthCallbacks callbacks) = 7; + void getProvidersForEmailCompat(String email, IFirebaseAuthCallbacks callbacks) = 8; + + void linkEmailAuthCredentialCompat(String email, String password, String cachedState, IFirebaseAuthCallbacks callbacks) = 10; + void linkFederatedCredentialCompat(String cachedState, in VerifyAssertionRequest verifyAssertionRequest, IFirebaseAuthCallbacks callbacks) = 11; + void unlinkEmailCredentialCompat(String cachedState, IFirebaseAuthCallbacks callbacks) = 12; + void unlinkFederatedCredentialCompat(String provider, String cachedState, IFirebaseAuthCallbacks callbacks) = 13; + void reloadCompat(String cachedState, IFirebaseAuthCallbacks callbacks) = 14; + void signInAnonymouslyCompat(IFirebaseAuthCallbacks callbacks) = 15; + void deleteCompat(String cachedState, IFirebaseAuthCallbacks callbacks) = 16; + void checkActionCodeCompat(String code, IFirebaseAuthCallbacks callbacks) = 18; + void applyActionCodeCompat(String code, IFirebaseAuthCallbacks callbacks) = 19; + void confirmPasswordResetCompat(String code, String newPassword, IFirebaseAuthCallbacks callbacks) = 20; + void sendVerificationCodeCompat(in SendVerificationCodeRequest request, IFirebaseAuthCallbacks callbacks) = 21; + void signInWithPhoneNumberCompat(in PhoneAuthCredential credential, IFirebaseAuthCallbacks callbacks) = 22; + void linkPhoneAuthCredentialCompat(String cachedState, in PhoneAuthCredential credential, IFirebaseAuthCallbacks callbacks) = 23; + + void sendEmailVerificationCompat(String token, in ActionCodeSettings actionCodeSettings, IFirebaseAuthCallbacks callbacks) = 25; + void setFirebaseUIVersionCompat(String firebaseUiVersion, IFirebaseAuthCallbacks callbacks) = 26; + void sendGetOobConfirmationCodeEmailCompat(String email, in ActionCodeSettings actionCodeSettings, IFirebaseAuthCallbacks callbacks) = 27; + void signInWithEmailLinkCompat(in EmailAuthCredential credential, IFirebaseAuthCallbacks callbacks) = 28; + + void getAccessToken(in GetAccessTokenAidlRequest request, IFirebaseAuthCallbacks callbacks) = 100; + void signInWithCustomToken(in SignInWithCustomTokenAidlRequest request, IFirebaseAuthCallbacks callbacks) = 101; + void signInWithCredential(in SignInWithCredentialAidlRequest request, IFirebaseAuthCallbacks callbacks) = 102; + void updateProfile(in UpdateProfileAidlRequest request, IFirebaseAuthCallbacks callbacks) = 103; + void changeEmail(in ChangeEmailAidlRequest request, IFirebaseAuthCallbacks callbacks) = 104; + void changePassword(in ChangePasswordAidlRequest request, IFirebaseAuthCallbacks callbacks) = 105; + void createUserWithEmailAndPassword(in CreateUserWithEmailAndPasswordAidlRequest request, IFirebaseAuthCallbacks callbacks) = 106; + void signInWithEmailAndPassword(in SignInWithEmailAndPasswordAidlRequest request, IFirebaseAuthCallbacks callbacks) = 107; + void getProvidersForEmail(in GetProvidersForEmailAidlRequest request, IFirebaseAuthCallbacks callbacks) = 108; + + void linkEmailAuthCredential(in LinkEmailAuthCredentialAidlRequest request, IFirebaseAuthCallbacks callbacks) = 110; + void linkFederatedCredential(in LinkFederatedCredentialAidlRequest request, IFirebaseAuthCallbacks callbacks) = 111; + void unlinkEmailCredential(in UnlinkEmailCredentialAidlRequest request, IFirebaseAuthCallbacks callbacks) = 112; + void unlinkFederatedCredential(in UnlinkFederatedCredentialAidlRequest request, IFirebaseAuthCallbacks callbacks) = 113; + void reload(in ReloadAidlRequest request, IFirebaseAuthCallbacks callbacks) = 114; + void signInAnonymously(in SignInAnonymouslyAidlRequest request, IFirebaseAuthCallbacks callbacks) = 115; + void delete(in DeleteAidlRequest request, IFirebaseAuthCallbacks callbacks) = 116; + void checkActionCode(in CheckActionCodeAidlRequest request, IFirebaseAuthCallbacks callbacks) = 118; + void applyActionCode(in ApplyActionCodeAidlRequest request, IFirebaseAuthCallbacks callbacks) = 119; + void confirmPasswordReset(in ConfirmPasswordResetAidlRequest request, IFirebaseAuthCallbacks callbacks) = 120; + void sendVerificationCode(in SendVerificationCodeAidlRequest request, IFirebaseAuthCallbacks callbacks) = 121; + void signInWithPhoneNumber(in SignInWithPhoneNumberAidlRequest request, IFirebaseAuthCallbacks callbacks) = 122; + void linkPhoneAuthCredential(in LinkPhoneAuthCredentialAidlRequest request, IFirebaseAuthCallbacks callbacks) = 123; + + void sendEmailVerification(in SendEmailVerificationWithSettingsAidlRequest request, IFirebaseAuthCallbacks callbacks) = 125; + void setFirebaseUiVersion(in SetFirebaseUiVersionAidlRequest request, IFirebaseAuthCallbacks callbacks) = 126; + void sendGetOobConfirmationCodeEmail(in SendGetOobConfirmationCodeEmailAidlRequest request, IFirebaseAuthCallbacks callbacks) = 127; + void signInWithEmailLink(in SignInWithEmailLinkAidlRequest request, IFirebaseAuthCallbacks callbacks) = 128; + + void startMfaEnrollmentWithPhoneNumber(in StartMfaPhoneNumberEnrollmentAidlRequest request, IFirebaseAuthCallbacks callbacks) = 129; + void unenrollMfa(in UnenrollMfaAidlRequest request, IFirebaseAuthCallbacks callbacks) = 130; + void finalizeMfaEnrollment(in FinalizeMfaEnrollmentAidlRequest request, IFirebaseAuthCallbacks callbacks) = 131; + void startMfaSignInWithPhoneNumber(in StartMfaPhoneNumberSignInAidlRequest request, IFirebaseAuthCallbacks callbacks) = 132; + void finalizeMfaSignIn(in FinalizeMfaSignInAidlRequest request, IFirebaseAuthCallbacks callbacks) = 133; + void verifyBeforeUpdateEmail(in VerifyBeforeUpdateEmailAidlRequest request, IFirebaseAuthCallbacks callbacks) = 134; +} diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.aidl new file mode 100644 index 00000000..bee0011b --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable LinkEmailAuthCredentialAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.aidl new file mode 100644 index 00000000..3894901d --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable LinkFederatedCredentialAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.aidl new file mode 100644 index 00000000..62caaf6a --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable LinkPhoneAuthCredentialAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ReloadAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ReloadAidlRequest.aidl new file mode 100644 index 00000000..5057e2e4 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ReloadAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable ReloadAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ResetPasswordResponse.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ResetPasswordResponse.aidl new file mode 100644 index 00000000..572587f0 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/ResetPasswordResponse.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable ResetPasswordResponse; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.aidl new file mode 100644 index 00000000..6db47c5b --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SendEmailVerificationWithSettingsAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.aidl new file mode 100644 index 00000000..5e1e5190 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SendGetOobConfirmationCodeEmailAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.aidl new file mode 100644 index 00000000..21b49716 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SendVerificationCodeAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.aidl new file mode 100644 index 00000000..3f797f58 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SendVerificationCodeRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.aidl new file mode 100644 index 00000000..39ff41a0 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SetFirebaseUiVersionAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.aidl new file mode 100644 index 00000000..2b4c21fb --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SignInAnonymouslyAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.aidl new file mode 100644 index 00000000..acda7af4 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SignInWithCredentialAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.aidl new file mode 100644 index 00000000..047489e0 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SignInWithCustomTokenAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.aidl new file mode 100644 index 00000000..77a277de --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SignInWithEmailAndPasswordAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.aidl new file mode 100644 index 00000000..1bb2d32d --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SignInWithEmailLinkAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.aidl new file mode 100644 index 00000000..270d3420 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable SignInWithPhoneNumberAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.aidl new file mode 100644 index 00000000..630a4c93 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable StartMfaPhoneNumberEnrollmentAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.aidl new file mode 100644 index 00000000..65c80630 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable StartMfaPhoneNumberSignInAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StringList.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StringList.aidl new file mode 100644 index 00000000..62446017 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/StringList.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable StringList; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.aidl new file mode 100644 index 00000000..5ce470b8 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable UnenrollMfaAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.aidl new file mode 100644 index 00000000..735a3195 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable UnlinkEmailCredentialAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.aidl new file mode 100644 index 00000000..eb473913 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable UnlinkFederatedCredentialAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.aidl new file mode 100644 index 00000000..db6603cf --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable UpdateProfileAidlRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyAssertionRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyAssertionRequest.aidl new file mode 100644 index 00000000..7f4787ff --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyAssertionRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable VerifyAssertionRequest; diff --git a/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.aidl b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.aidl new file mode 100644 index 00000000..79298927 --- /dev/null +++ b/firebase-auth-api/src/main/aidl/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.auth.api.internal; + +parcelable VerifyBeforeUpdateEmailAidlRequest; diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/ActionCodeSettings.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/ActionCodeSettings.java new file mode 100644 index 00000000..df07dd64 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/ActionCodeSettings.java @@ -0,0 +1,182 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.firebase.auth; + +import org.microg.gms.common.PublicApi; +import org.microg.safeparcel.AutoSafeParcelable; + +/** + * Structure that contains the required continue/state URL with optional Android and iOS bundle identifiers. + * The stateUrl used to initialize this class is the link/deep link/fallback url used while constructing the Firebase dynamic link. + */ +@PublicApi +public class ActionCodeSettings extends AutoSafeParcelable { + @Field(1) + @PublicApi(exclude = true) + public String url; + @Field(2) + @PublicApi(exclude = true) + public String iOSBundle; + @Field(3) + @PublicApi(exclude = true) + public String iOSAppStoreId; + @Field(4) + @PublicApi(exclude = true) + public String androidPackageName; + @Field(5) + @PublicApi(exclude = true) + public boolean androidInstallApp; + @Field(6) + @PublicApi(exclude = true) + public String androidMinimumVersion; + @Field(7) + @PublicApi(exclude = true) + public boolean handleCodeInApp; + @Field(8) + @PublicApi(exclude = true) + public String localeHeader; + @Field(9) + @PublicApi(exclude = true) + public int requestType; + @Field(10) + @PublicApi(exclude = true) + public String dynamicLinkDomain; + + private ActionCodeSettings() { + } + + /** + * @return whether the oob code should be handled by the app. See {@link Builder#setHandleCodeInApp(boolean)} + */ + public boolean canHandleCodeInApp() { + return handleCodeInApp; + } + + /** + * @return the preference for whether to attempt to install the app if it is not present. See {@link Builder#setAndroidPackageName(String, boolean, String)} + */ + public boolean getAndroidInstallApp() { + return androidInstallApp; + } + + /** + * @return the minimum Android app version. See {@link Builder#setAndroidPackageName(String, boolean, String)} + */ + public String getAndroidMinimumVersion() { + return androidMinimumVersion; + } + + /** + * @return the Android Package Name. See {@link Builder#setAndroidPackageName(String, boolean, String)} + */ + public String getAndroidPackageName() { + return androidPackageName; + } + + /** + * @return the iOS Bundle. See {@link Builder#setIOSBundleId(String)} + */ + public String getIOSBundle() { + return iOSBundle; + } + + /** + * @return the URL. See {@link Builder#setUrl(String)} + */ + public String getUrl() { + return url; + } + + /** + * @return a new instance of {@link ActionCodeSettings.Builder}. + */ + public static Builder newBuilder() { + return new Builder(); + } + + /** + * A Builder class for {@link ActionCodeSettings}. Get an instance of this Builder using {@link #newBuilder()}. + */ + public static class Builder { + private String url; + private String iOSBundleId; + private String androidPackageName; + private boolean androidInstallApp; + private String androidMinimumVersion; + private boolean canHandleCodeInApp; + private String dynamicLinkDomain; + + public ActionCodeSettings build() { + ActionCodeSettings settings = new ActionCodeSettings(); + settings.url = url; + settings.iOSBundle = iOSBundleId; + settings.androidPackageName = androidPackageName; + settings.androidInstallApp = androidInstallApp; + settings.handleCodeInApp = canHandleCodeInApp; + settings.dynamicLinkDomain = dynamicLinkDomain; + return settings; + } + + /** + * Sets the Android package name and returns the current builder instance. + * If {@code installIfNotAvailable} is set to true and the link is opened on an android device, it will try to install the app if not already available. + * Otherwise the web URL is used. + *

+ * A minimum version string is also available. If the installed app is an older version, the user is taken to the Play Store to upgrade the app. + */ + public Builder setAndroidPackageName(String androidPackageName, boolean installIfNotAvailable, String minimumVersion) { + this.androidPackageName = androidPackageName; + this.androidInstallApp = installIfNotAvailable; + this.androidMinimumVersion = minimumVersion; + return this; + } + + /** + * Sets the optional FDL domain, overriding the default FDL domain that would be used. + * Must be one of the 5 domains configured in the Firebase console. + */ + public Builder setDynamicLinkDomain(String dynamicLinkDomain) { + this.dynamicLinkDomain = dynamicLinkDomain; + return this; + } + + /** + * The default is false. When set to true, the action code link will be sent as a universal link and will be open by the app if installed. + * In the false case, the code will be sent to the web widget first and then on continue will redirect to the app if installed. + */ + public Builder setHandleCodeInApp(boolean status) { + this.canHandleCodeInApp = status; + return this; + } + + /** + * To be used if the email link that is sent might be opened on an iOS device. + *

+ * Sets the iOS bundle Id and returns the current {@link ActionCodeSettings.Builder} instance. + */ + public Builder setIOSBundleId(String iOSBundleId) { + this.iOSBundleId = iOSBundleId; + return this; + } + + /** + * Sets the URL, which has different meanings in different contexts. For email actions, this is the state/continue URL. + * When the app is not installed, this is the web continue URL with any developer provided state appended (the continueURL query parameter). + * When the app is installed, this is contained in the Firebase dynamic link payload. + * In the case where the code is sent directly to the app and the app is installed, this is the continueURL query parameter in the dynamic link payload. + * Otherwise, when the code is handled by the widget itself, it is the payload itself. + */ + public Builder setUrl(String url) { + this.url = url; + return this; + } + } + + public static final Creator CREATOR = new AutoCreator<>(ActionCodeSettings.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/AuthCredential.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/AuthCredential.java new file mode 100644 index 00000000..bf3b7e6e --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/AuthCredential.java @@ -0,0 +1,28 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.firebase.auth; + +import org.microg.gms.common.PublicApi; +import org.microg.safeparcel.AutoSafeParcelable; + +/** + * Represents a credential that the Firebase Authentication server can use to authenticate a user. + */ +@PublicApi +public abstract class AuthCredential extends AutoSafeParcelable { + /** + * Returns the unique string identifier for the provider type with which the credential is associated. + */ + public abstract String getProvider(); + + /** + * Returns the unique string identifier for the sign in method with which the credential is associated. Should match that returned by {@link FirebaseAuth#fetchSignInMethodsForEmail(String)} after this user has signed in with this type of credential. + */ + public abstract String getSignInMethod(); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/DefaultOAuthCredential.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/DefaultOAuthCredential.java new file mode 100644 index 00000000..7321f818 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/DefaultOAuthCredential.java @@ -0,0 +1,65 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.firebase.auth; + +import com.google.firebase.auth.api.internal.VerifyAssertionRequest; + +import org.microg.gms.common.PublicApi; + +@PublicApi +public class DefaultOAuthCredential extends OAuthCredential { + @Field(1) + @PublicApi(exclude = true) + public String provider; + @Field(2) + @PublicApi(exclude = true) + public String idToken; + @Field(3) + @PublicApi(exclude = true) + public String accessToken; + @Field(4) + @PublicApi(exclude = true) + public VerifyAssertionRequest webSignInToken; + @Field(5) + @PublicApi(exclude = true) + public String pendingToken; + @Field(6) + @PublicApi(exclude = true) + public String secret; + @Field(7) + @PublicApi(exclude = true) + public String rawNonce; + + @Override + public String getAccessToken() { + return accessToken; + } + + @Override + public String getIdToken() { + return idToken; + } + + @Override + public String getSecret() { + return secret; + } + + @Override + public String getProvider() { + return provider; + } + + @Override + public String getSignInMethod() { + return provider; + } + + public static final Creator CREATOR = new AutoCreator<>(DefaultOAuthCredential.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/EmailAuthCredential.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/EmailAuthCredential.java new file mode 100644 index 00000000..d6adfd2c --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/EmailAuthCredential.java @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.firebase.auth; + +import org.microg.gms.common.PublicApi; + +/** + * Wraps an email and password tuple for authentication purposes. + */ +@PublicApi +public class EmailAuthCredential extends AuthCredential { + @Field(1) + @PublicApi(exclude = true) + public String email; + @Field(2) + @PublicApi(exclude = true) + public String password; + @Field(3) + @PublicApi(exclude = true) + public String signInLink; + @Field(4) + @PublicApi(exclude = true) + public String cachedState; + @Field(5) + @PublicApi(exclude = true) + public boolean isForLinking; + + /** + * Returns the unique string identifier for the provider type with which the credential is associated. + */ + @Override + public String getProvider() { + return "password"; + } + + /** + * Returns either {@link EmailAuthProvider#EMAIL_LINK_SIGN_IN_METHOD} for a credential generated with {@link EmailAuthProvider#getCredentialWithLink(String, String)} or {@link EmailAuthProvider#EMAIL_PASSWORD_SIGN_IN_METHOD} for a credential generated with {@link EmailAuthProvider#getCredential(String, String)}. + */ + @Override + public String getSignInMethod() { + if (password != null && !password.isEmpty()) { + return "password"; + } + return "emailLink"; + } + + public static final Creator CREATOR = new AutoCreator<>(EmailAuthCredential.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/OAuthCredential.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/OAuthCredential.java new file mode 100644 index 00000000..772a456e --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/OAuthCredential.java @@ -0,0 +1,32 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.firebase.auth; + +import org.microg.gms.common.PublicApi; + +/** + * Holds credentials generated by a sign-in with a credential to an IDP that uses OAuth + */ +@PublicApi +public abstract class OAuthCredential extends AuthCredential { + /** + * Returns the OAuth access token associated with this credential. + */ + public abstract String getAccessToken(); + + /** + * Returns the OAuth ID token associated with this credential. + */ + public abstract String getIdToken(); + + /** + * Returns the OAuth secret associated with this credential. This will be null for OAuth 2.0 providers. + */ + public abstract String getSecret(); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/PhoneAuthCredential.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/PhoneAuthCredential.java new file mode 100644 index 00000000..1798a307 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/PhoneAuthCredential.java @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.firebase.auth; + +import org.microg.gms.common.PublicApi; + +/** + * Wraps phone number and verification information for authentication purposes. + */ +@PublicApi +public class PhoneAuthCredential extends AuthCredential { + @Field(1) + @PublicApi(exclude = true) + public String sessionInfo; + @Field(2) + @PublicApi(exclude = true) + public String smsCode; + @Field(3) + @PublicApi(exclude = true) + public boolean hasVerificationCode; + @Field(4) + @PublicApi(exclude = true) + public String phoneNumber; + @Field(5) + @PublicApi(exclude = true) + public boolean autoCreate; + @Field(6) + @PublicApi(exclude = true) + public String temporaryProof; + @Field(7) + @PublicApi(exclude = true) + public String mfaEnrollmentId; + + /** + * Returns the unique string identifier for the provider type with which the credential is associated. + */ + @Override + public String getProvider() { + return "phone"; + } + + /** + * Returns the unique string identifier for the sign in method with which the credential is associated. Should match that returned by {@link FirebaseAuth#fetchSignInMethodsForEmail(String)} after this user has signed in with this type of credential. + */ + @Override + public String getSignInMethod() { + return "phone"; + } + + /** + * Gets the auto-retrieved SMS verification code if applicable. When SMS verification is used, you will be called back first via onCodeSent(String, PhoneAuthProvider.ForceResendingToken), and later onVerificationCompleted(PhoneAuthCredential) with a {@link PhoneAuthCredential} containing a non-null SMS code if auto-retrieval succeeded. If Firebase used another approach to verify the phone number and triggers a callback via onVerificationCompleted(PhoneAuthCredential), then SMS code can be null. + */ + public String getSmsCode() { + return smsCode; + } + + public static final Creator CREATOR = new AutoCreator<>(PhoneAuthCredential.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/UserProfileChangeRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/UserProfileChangeRequest.java new file mode 100644 index 00000000..a86c21da --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/UserProfileChangeRequest.java @@ -0,0 +1,88 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.firebase.auth; + +import android.net.Uri; + +import org.microg.gms.common.PublicApi; +import org.microg.safeparcel.AutoSafeParcelable; + +/** + * Request used to update user profile information. + */ +@PublicApi +public class UserProfileChangeRequest extends AutoSafeParcelable { + @Field(1) + @PublicApi(exclude = true) + public String displayName; + @Field(2) + @PublicApi(exclude = true) + public String photoUrl; + @Field(3) + @PublicApi(exclude = true) + public boolean shouldRemoveDisplayName; + @Field(4) + @PublicApi(exclude = true) + public boolean shouldRemovePhotoUri; + + private UserProfileChangeRequest() { + } + + public String getDisplayName() { + return displayName; + } + + public Uri getPhotoUri() { + return Uri.parse(photoUrl); + } + + /** + * The request builder. + */ + public static class Builder { + private String displayName; + private Uri photoUri; + private boolean shouldRemoveDisplayName; + private boolean shouldRemovePhotoUri; + + /** + * Sets the updated display name. + * @return the {@link UserProfileChangeRequest.Builder} for chaining + */ + public Builder setDisplayName(String displayName) { + this.displayName = displayName; + shouldRemoveDisplayName = displayName == null; + return this; + } + + /** + * Sets the updated photo {@link Uri}. + * @return the {@link UserProfileChangeRequest.Builder} for chaining + */ + public Builder setPhotoUri(Uri photoUri) { + this.photoUri = photoUri; + shouldRemovePhotoUri = photoUri == null; + return this; + } + + /** + * Returns a {@link UserProfileChangeRequest} instance + */ + public UserProfileChangeRequest build() { + UserProfileChangeRequest request = new UserProfileChangeRequest(); + request.displayName = displayName; + request.photoUrl = photoUri.toString(); + request.shouldRemoveDisplayName = shouldRemoveDisplayName; + request.shouldRemovePhotoUri = shouldRemovePhotoUri; + return request; + } + } + + public static final Creator CREATOR = new AutoCreator<>(UserProfileChangeRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.java new file mode 100644 index 00000000..d68ed77c --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ApplyActionCodeAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ApplyActionCodeAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(ApplyActionCodeAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.java new file mode 100644 index 00000000..70b4e103 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangeEmailAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ChangeEmailAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(ChangeEmailAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.java new file mode 100644 index 00000000..70823dad --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ChangePasswordAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ChangePasswordAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(ChangePasswordAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.java new file mode 100644 index 00000000..57f3f942 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CheckActionCodeAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class CheckActionCodeAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(CheckActionCodeAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.java new file mode 100644 index 00000000..f9505ed8 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ConfirmPasswordResetAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ConfirmPasswordResetAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(ConfirmPasswordResetAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateAuthUriResponse.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateAuthUriResponse.java new file mode 100644 index 00000000..e32735a4 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateAuthUriResponse.java @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +import java.util.ArrayList; +import java.util.List; + +public class CreateAuthUriResponse extends AutoSafeParcelable { + @Field(2) + public String authUri; + @Field(3) + public boolean isRegistered; + @Field(4) + public String providerId; + @Field(5) + public boolean isForExistingProvider; + @Field(6) + public StringList stringList = new StringList(); + @Field(7) + public List signInMethods = new ArrayList<>(); + public static final Creator CREATOR = new AutoCreator<>(CreateAuthUriResponse.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.java new file mode 100644 index 00000000..a1eb8b99 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/CreateUserWithEmailAndPasswordAidlRequest.java @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class CreateUserWithEmailAndPasswordAidlRequest extends AutoSafeParcelable { + @Field(1) + public String email; + @Field(2) + public String password; + @Field(3) + public String tenantId; + + public static final Creator CREATOR = new AutoCreator<>(CreateUserWithEmailAndPasswordAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/DeleteAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/DeleteAidlRequest.java new file mode 100644 index 00000000..3d815a6e --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/DeleteAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class DeleteAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(DeleteAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.java new file mode 100644 index 00000000..d76ac82f --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaEnrollmentAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class FinalizeMfaEnrollmentAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(FinalizeMfaEnrollmentAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.java new file mode 100644 index 00000000..f578a740 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/FinalizeMfaSignInAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class FinalizeMfaSignInAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(FinalizeMfaSignInAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.java new file mode 100644 index 00000000..6b7d9e99 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccessTokenAidlRequest.java @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class GetAccessTokenAidlRequest extends AutoSafeParcelable { + @Field(1) + public String refreshToken; + + public static final Creator CREATOR = new AutoCreator<>(GetAccessTokenAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccountInfoUser.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccountInfoUser.java new file mode 100644 index 00000000..6113649c --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetAccountInfoUser.java @@ -0,0 +1,43 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import com.google.firebase.auth.DefaultOAuthCredential; + +import org.microg.safeparcel.AutoSafeParcelable; + +import java.util.List; + +public class GetAccountInfoUser extends AutoSafeParcelable { + @Field(2) + public String localId; + @Field(3) + public String email; + @Field(4) + public boolean isEmailVerified; + @Field(5) + public String displayName; + @Field(6) + public String photoUrl; + @Field(7) + public ProviderUserInfoList providerInfoList = new ProviderUserInfoList(); + @Field(8) + public String password; + @Field(9) + public String phoneNumber; + @Field(10) + public long creationTimestamp; + @Field(11) + public long lastSignInTimestamp; + @Field(12) + public boolean isNewUser; + @Field(13) + public DefaultOAuthCredential defaultOAuthCredential; + @Field(14) + public List mfaInfoList; + + public static final Creator CREATOR = new AutoCreator<>(GetAccountInfoUser.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.java new file mode 100644 index 00000000..393bf119 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetProvidersForEmailAidlRequest.java @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class GetProvidersForEmailAidlRequest extends AutoSafeParcelable { + @Field(1) + public String email; + @Field(2) + public String tenantId; + public static final Creator CREATOR = new AutoCreator<>(GetProvidersForEmailAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetTokenResponse.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetTokenResponse.java new file mode 100644 index 00000000..66e786f7 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/GetTokenResponse.java @@ -0,0 +1,44 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.json.JSONException; +import org.json.JSONObject; +import org.microg.safeparcel.AutoSafeParcelable; + +public class GetTokenResponse extends AutoSafeParcelable { + @Field(2) + public String refreshToken; + @Field(3) + public String accessToken; + @Field(4) + public Long expiresIn; + @Field(5) + public String tokenType; + @Field(6) + public Long issuedAt; + + public GetTokenResponse() { + issuedAt = System.currentTimeMillis(); + } + + public static GetTokenResponse parseJson(String json) { + try { + JSONObject object = new JSONObject(json); + GetTokenResponse response = new GetTokenResponse(); + response.refreshToken = object.optString("refresh_token", null); + response.accessToken = object.optString("access_token", null); + response.tokenType = object.optString("token_type", null); + response.expiresIn = object.optLong("expires_in"); + response.issuedAt = object.optLong("issued_at"); + return response; + } catch (JSONException e) { + throw new RuntimeException(e); + } + } + + public static final Creator CREATOR = new AutoCreator<>(GetTokenResponse.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.java new file mode 100644 index 00000000..f80f2cee --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkEmailAuthCredentialAidlRequest.java @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class LinkEmailAuthCredentialAidlRequest extends AutoSafeParcelable { + @Field(1) + public String email; + @Field(2) + public String password; + @Field(3) + public String cachedState; + public static final Creator CREATOR = new AutoCreator<>(LinkEmailAuthCredentialAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.java new file mode 100644 index 00000000..6fd81225 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkFederatedCredentialAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class LinkFederatedCredentialAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(LinkFederatedCredentialAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.java new file mode 100644 index 00000000..afc653b4 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/LinkPhoneAuthCredentialAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class LinkPhoneAuthCredentialAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(LinkPhoneAuthCredentialAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/MfaInfo.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/MfaInfo.java new file mode 100644 index 00000000..204fd464 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/MfaInfo.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class MfaInfo extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(MfaInfo.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfo.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfo.java new file mode 100644 index 00000000..1f7a19b0 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfo.java @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ProviderUserInfo extends AutoSafeParcelable { + @Field(2) + public String federatedId; + @Field(3) + public String displayName; + @Field(4) + public String photoUrl; + @Field(5) + public String providerId; + @Field(6) + public String rawUserInfo; + @Field(7) + public String phoneNumber; + @Field(8) + public String email; + + public static final Creator CREATOR = new AutoCreator<>(ProviderUserInfo.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfoList.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfoList.java new file mode 100644 index 00000000..0424b011 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ProviderUserInfoList.java @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +import java.util.ArrayList; +import java.util.List; + +public class ProviderUserInfoList extends AutoSafeParcelable { + @Field(2) + public List providerUserInfos = new ArrayList<>(); + + public static final Creator CREATOR = new AutoCreator<>(ProviderUserInfoList.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ReloadAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ReloadAidlRequest.java new file mode 100644 index 00000000..de609f76 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ReloadAidlRequest.java @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ReloadAidlRequest extends AutoSafeParcelable { + @Field(1) + public String cachedState; + public static final Creator CREATOR = new AutoCreator<>(ReloadAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ResetPasswordResponse.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ResetPasswordResponse.java new file mode 100644 index 00000000..06af0636 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/ResetPasswordResponse.java @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ResetPasswordResponse extends AutoSafeParcelable { + @Field(2) + public String email; + @Field(3) + public String newEmail; + @Field(4) + public String requestType; + @Field(5) + public MfaInfo mfaInfo; + public static final Creator CREATOR = new AutoCreator<>(ResetPasswordResponse.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.java new file mode 100644 index 00000000..9bda971e --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendEmailVerificationWithSettingsAidlRequest.java @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import com.google.firebase.auth.ActionCodeSettings; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SendEmailVerificationWithSettingsAidlRequest extends AutoSafeParcelable { + @Field(1) + public String token; + @Field(2) + public ActionCodeSettings settings; + public static final Creator CREATOR = new AutoCreator<>(SendEmailVerificationWithSettingsAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.java new file mode 100644 index 00000000..04dd49cc --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendGetOobConfirmationCodeEmailAidlRequest.java @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import com.google.firebase.auth.ActionCodeSettings; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SendGetOobConfirmationCodeEmailAidlRequest extends AutoSafeParcelable { + @Field(1) + public String email; + @Field(2) + public ActionCodeSettings settings; + @Field(3) + public String tenantId; + public static final Creator CREATOR = new AutoCreator<>(SendGetOobConfirmationCodeEmailAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.java new file mode 100644 index 00000000..9b3eccd3 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeAidlRequest.java @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SendVerificationCodeAidlRequest extends AutoSafeParcelable { + @Field(1) + public SendVerificationCodeRequest request; + public static final Creator CREATOR = new AutoCreator<>(SendVerificationCodeAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.java new file mode 100644 index 00000000..971d6fa7 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SendVerificationCodeRequest.java @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SendVerificationCodeRequest extends AutoSafeParcelable { + @Field(1) + public String phoneNumber; + @Field(2) + public Long timeoutInSeconds; + @Field(3) + public boolean forceNewSmsVerificationSession; + @Field(4) + public String languageHeader; + @Field(5) + public String tenantId; + @Field(6) + public String recaptchaToken; + + public static final Creator CREATOR = new AutoCreator<>(SendVerificationCodeRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.java new file mode 100644 index 00000000..964382e8 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SetFirebaseUiVersionAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SetFirebaseUiVersionAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(SetFirebaseUiVersionAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.java new file mode 100644 index 00000000..2549412d --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInAnonymouslyAidlRequest.java @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SignInAnonymouslyAidlRequest extends AutoSafeParcelable { + @Field(1) + public String tenantId; + public static final Creator CREATOR = new AutoCreator<>(SignInAnonymouslyAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.java new file mode 100644 index 00000000..94190acb --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCredentialAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SignInWithCredentialAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(SignInWithCredentialAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.java new file mode 100644 index 00000000..0f7f1077 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithCustomTokenAidlRequest.java @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SignInWithCustomTokenAidlRequest extends AutoSafeParcelable { + @Field(1) + public String token; + @Field(2) + public String tenantId; + + public static final Creator CREATOR = new AutoCreator<>(SignInWithCustomTokenAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.java new file mode 100644 index 00000000..c8aa04d9 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailAndPasswordAidlRequest.java @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SignInWithEmailAndPasswordAidlRequest extends AutoSafeParcelable { + @Field(1) + public String email; + @Field(2) + public String password; + @Field(3) + public String tenantId; + public static final Creator CREATOR = new AutoCreator<>(SignInWithEmailAndPasswordAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.java new file mode 100644 index 00000000..71028fa1 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithEmailLinkAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SignInWithEmailLinkAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(SignInWithEmailLinkAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.java new file mode 100644 index 00000000..d076cf30 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/SignInWithPhoneNumberAidlRequest.java @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import com.google.firebase.auth.PhoneAuthCredential; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class SignInWithPhoneNumberAidlRequest extends AutoSafeParcelable { + @Field(1) + public PhoneAuthCredential credential; + @Field(2) + public String tenantId; + + public static final Creator CREATOR = new AutoCreator<>(SignInWithPhoneNumberAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.java new file mode 100644 index 00000000..b4a93b6b --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberEnrollmentAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class StartMfaPhoneNumberEnrollmentAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(StartMfaPhoneNumberEnrollmentAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.java new file mode 100644 index 00000000..151d4e6e --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StartMfaPhoneNumberSignInAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class StartMfaPhoneNumberSignInAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(StartMfaPhoneNumberSignInAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StringList.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StringList.java new file mode 100644 index 00000000..8c72245c --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/StringList.java @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +import java.util.ArrayList; +import java.util.List; + +public class StringList extends AutoSafeParcelable { + @Field(1) + public int versionCode = 1; + @Field(2) + public List values = new ArrayList<>(); + public static final Creator CREATOR = new AutoCreator<>(StringList.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.java new file mode 100644 index 00000000..49c4b0f6 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnenrollMfaAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class UnenrollMfaAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(UnenrollMfaAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.java new file mode 100644 index 00000000..55770dd9 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkEmailCredentialAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class UnlinkEmailCredentialAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(UnlinkEmailCredentialAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.java new file mode 100644 index 00000000..1533997c --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UnlinkFederatedCredentialAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class UnlinkFederatedCredentialAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(UnlinkFederatedCredentialAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.java new file mode 100644 index 00000000..25d40202 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/UpdateProfileAidlRequest.java @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import com.google.firebase.auth.UserProfileChangeRequest; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class UpdateProfileAidlRequest extends AutoSafeParcelable { + @Field(1) + public UserProfileChangeRequest request; + @Field(2) + public String cachedState; + public static final Creator CREATOR = new AutoCreator<>(UpdateProfileAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyAssertionRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyAssertionRequest.java new file mode 100644 index 00000000..47e3c220 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyAssertionRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class VerifyAssertionRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(VerifyAssertionRequest.class); +} diff --git a/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.java b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.java new file mode 100644 index 00000000..d6d5c121 --- /dev/null +++ b/firebase-auth-api/src/main/java/com/google/firebase/auth/api/internal/VerifyBeforeUpdateEmailAidlRequest.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.firebase.auth.api.internal; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class VerifyBeforeUpdateEmailAidlRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(VerifyBeforeUpdateEmailAidlRequest.class); +} diff --git a/firebase-auth-api/src/main/java/org/microg/gms/firebase/auth/Constants.java b/firebase-auth-api/src/main/java/org/microg/gms/firebase/auth/Constants.java new file mode 100644 index 00000000..0f83c9fe --- /dev/null +++ b/firebase-auth-api/src/main/java/org/microg/gms/firebase/auth/Constants.java @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.firebase.auth; + +public class Constants { + public static final String EXTRA_API_KEY = "com.google.firebase.auth.API_KEY"; + public static final String EXTRA_LIBRARY_VERSION = "com.google.firebase.auth.LIBRARY_VERSION"; +} diff --git a/firebase-auth-core/build.gradle b/firebase-auth-core/build.gradle new file mode 100644 index 00000000..ffd72760 --- /dev/null +++ b/firebase-auth-core/build.gradle @@ -0,0 +1,45 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +dependencies { + api project(':firebase-auth-api') + + implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion" + implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion" + + implementation "androidx.appcompat:appcompat:1.2.0" + + implementation project(':play-services-core') + + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion" + + implementation "com.android.volley:volley:$volleyVersion" +} + +android { + compileSdkVersion androidCompileSdk + buildToolsVersion "$androidBuildVersionTools" + + defaultConfig { + versionName version + minSdkVersion androidMinSdk + targetSdkVersion androidTargetSdk + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +} diff --git a/firebase-auth-core/src/main/AndroidManifest.xml b/firebase-auth-core/src/main/AndroidManifest.xml new file mode 100644 index 00000000..d3507793 --- /dev/null +++ b/firebase-auth-core/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + diff --git a/firebase-auth-core/src/main/assets/recaptcha.html b/firebase-auth-core/src/main/assets/recaptcha.html new file mode 100644 index 00000000..3da22b32 --- /dev/null +++ b/firebase-auth-core/src/main/assets/recaptcha.html @@ -0,0 +1,54 @@ + + + + +

+
+ + + + + + + + + + + + + + +
+ + + + + + + + diff --git a/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/FirebaseAuthService.kt b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/FirebaseAuthService.kt new file mode 100644 index 00000000..45a648ff --- /dev/null +++ b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/FirebaseAuthService.kt @@ -0,0 +1,651 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +@file:Suppress("WARNINGS") + +package org.microg.gms.firebase.auth + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.os.Build +import android.os.Handler +import android.os.Parcel +import android.provider.Telephony +import android.telephony.SmsMessage +import android.util.Log +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.lifecycleScope +import com.google.android.gms.common.api.CommonStatusCodes +import com.google.android.gms.common.api.Status +import com.google.android.gms.common.internal.GetServiceRequest +import com.google.android.gms.common.internal.IGmsCallbacks +import com.google.firebase.auth.ActionCodeSettings +import com.google.firebase.auth.EmailAuthCredential +import com.google.firebase.auth.PhoneAuthCredential +import com.google.firebase.auth.UserProfileChangeRequest +import com.google.firebase.auth.api.internal.* +import org.json.JSONArray +import org.json.JSONObject +import org.microg.gms.BaseService +import org.microg.gms.common.GmsService +import org.microg.gms.common.PackageUtils + +private const val TAG = "GmsFirebaseAuth" + +fun JSONObject.getStringOrNull(key: String) = if (has(key)) getString(key) else null +fun JSONObject.getJSONArrayOrNull(key: String) = if (has(key)) getJSONArray(key) else null +fun JSONArray?.orEmpty() = this ?: JSONArray() +fun JSONObject.getJSONArrayLength(key: String) = getJSONArrayOrNull(key).orEmpty().length() + +private val ActionCodeSettings.requestTypeAsString: String + get() = when (requestType) { + 1 -> "PASSWORD_RESET" + 2 -> "OLD_EMAIL_AGREE" + 3 -> "NEW_EMAIL_ACCEPT" + 4 -> "VERIFY_EMAIL" + 5 -> "RECOVER_EMAIL" + 6 -> "EMAIL_SIGNIN" + 7 -> "VERIFY_AND_CHANGE_EMAIL" + 8 -> "REVERT_SECOND_FACTOR_ADDITION" + else -> "OOB_REQ_TYPE_UNSPECIFIED" + } + +private val UserProfileChangeRequest.deleteAttributeList: List + get() { + val list = arrayListOf() + if (shouldRemoveDisplayName) list.add("DISPLAY_NAME") + if (shouldRemovePhotoUri) list.add("PHOTO_URL") + return list + } + +private fun Intent.getSmsMessages(): Array { + return if (Build.VERSION.SDK_INT >= 19) { + Telephony.Sms.Intents.getMessagesFromIntent(this) + } else { + (getSerializableExtra("pdus") as? Array)?.map { SmsMessage.createFromPdu(it) }.orEmpty().toTypedArray() + } +} + +class FirebaseAuthService : BaseService(TAG, GmsService.FIREBASE_AUTH) { + override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService?) { + PackageUtils.getAndCheckCallingPackage(this, request.packageName) + val apiKey = request.extras?.getString(Constants.EXTRA_API_KEY) + val libraryVersion = request.extras?.getString(Constants.EXTRA_LIBRARY_VERSION) + if (apiKey == null) { + callback.onPostInitComplete(CommonStatusCodes.DEVELOPER_ERROR, null, null) + } else { + callback.onPostInitComplete(0, FirebaseAuthServiceImpl(this, lifecycle, request.packageName, libraryVersion, apiKey).asBinder(), null) + } + } +} + +class FirebaseAuthServiceImpl(private val context: Context, private val lifecycle: Lifecycle, private val packageName: String, private val libraryVersion: String?, private val apiKey: String) : IFirebaseAuthService.Stub(), LifecycleOwner { + private val client = IdentityToolkitClient(context, apiKey) + private var authorizedDomain: String? = null + + private suspend fun getAuthorizedDomain(): String { + authorizedDomain?.let { return it } + val authorizedDomain = try { + client.getProjectConfig().getJSONArray("authorizedDomains").getString(0) + } catch (e: Exception) { + Log.w(TAG, e) + "localhost" + } + this.authorizedDomain = authorizedDomain + return authorizedDomain + } + + private suspend fun refreshTokenResponse(cachedState: String): GetTokenResponse { + var tokenResponse = GetTokenResponse.parseJson(cachedState) + if (System.currentTimeMillis() + 300000L < tokenResponse.issuedAt + tokenResponse.expiresIn * 1000) { + return tokenResponse + } + return client.getTokenByRefreshToken(tokenResponse.refreshToken).toGetTokenResponse() + } + + private fun JSONObject.toGetTokenResponse() = GetTokenResponse().apply { + refreshToken = getStringOrNull("refresh_token") + accessToken = getStringOrNull("access_token") + expiresIn = getStringOrNull("expires_in")?.toLong() + tokenType = getStringOrNull("token_type") + } + + private fun JSONObject.toGetAccountInfoUser(): GetAccountInfoUser = GetAccountInfoUser().apply { + localId = getStringOrNull("localId") + email = getStringOrNull("email") + isEmailVerified = optBoolean("emailVerified") + displayName = getStringOrNull("displayName") + photoUrl = getStringOrNull("photoUrl") + for (i in 0 until getJSONArrayLength("providerUserInfo")) { + getJSONArray("providerUserInfo").getJSONObject(i).run { + providerInfoList.providerUserInfos.add(ProviderUserInfo().apply { + federatedId = getStringOrNull("federatedId") + displayName = getStringOrNull("displayName") + photoUrl = getStringOrNull("photoUrl") + providerId = getStringOrNull("providerId") + phoneNumber = getStringOrNull("phoneNumber") + email = getStringOrNull("email") + rawUserInfo = this@run.toString() + }) + } + } + password = getStringOrNull("rawPassword") + phoneNumber = getStringOrNull("phoneNumber") + creationTimestamp = getStringOrNull("createdAt")?.toLong() ?: 0L + lastSignInTimestamp = getStringOrNull("lastLoginAt")?.toLong() ?: 0L + } + + private fun JSONObject.toCreateAuthUriResponse(): CreateAuthUriResponse = CreateAuthUriResponse().apply { + authUri = getStringOrNull("authUri") + isRegistered = optBoolean("registered") + providerId = getStringOrNull("providerId") + isForExistingProvider = optBoolean("forExistingProvider") + for (i in 0 until getJSONArrayLength("allProviders")) { + stringList.values.add(getJSONArray("allProviders").getString(i)) + } + for (i in 0 until getJSONArrayLength("signinMethods")) { + signInMethods.add(getJSONArray("signinMethods").getString(i)) + } + } + + override fun getLifecycle(): Lifecycle = lifecycle + + override fun applyActionCode(request: ApplyActionCodeAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: applyActionCode") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun applyActionCodeCompat(code: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: applyActionCodeCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun changeEmail(request: ChangeEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: changeEmail") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun changeEmailCompat(cachedState: String?, email: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: changeEmailCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun changePassword(request: ChangePasswordAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: changePassword") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun changePasswordCompat(cachedState: String?, password: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: changePasswordCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun checkActionCode(request: CheckActionCodeAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: checkActionCode") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun checkActionCodeCompat(code: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: checkActionCodeCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun confirmPasswordReset(request: ConfirmPasswordResetAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: confirmPasswordReset") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun confirmPasswordResetCompat(code: String?, newPassword: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: confirmPasswordResetCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun createUserWithEmailAndPassword(request: CreateUserWithEmailAndPasswordAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "createUserWithEmailAndPassword") + try { + val tokenResult = client.signupNewUser(email = request.email, password = request.password, tenantId = request.tenantId) + val idToken = tokenResult.getString("idToken") + val refreshToken = tokenResult.getString("refreshToken") + val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() + val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = true } + Log.d(TAG, "callback: onGetTokenResponseAndUser") + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun createUserWithEmailAndPasswordCompat(email: String?, password: String?, callbacks: IFirebaseAuthCallbacks) { + createUserWithEmailAndPassword(CreateUserWithEmailAndPasswordAidlRequest().apply { this.email = email; this.password = password }, callbacks) + } + + override fun delete(request: DeleteAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: delete") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun deleteCompat(cachedState: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: deleteCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun finalizeMfaEnrollment(request: FinalizeMfaEnrollmentAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: finalizeMfaEnrollment") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun finalizeMfaSignIn(request: FinalizeMfaSignInAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: finalizeMfaSignIn") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun getAccessToken(request: GetAccessTokenAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "getAccessToken") + try { + callbacks.onGetTokenResponse(client.getTokenByRefreshToken(request.refreshToken).toGetTokenResponse()) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun getAccessTokenCompat(refreshToken: String?, callbacks: IFirebaseAuthCallbacks) { + getAccessToken(GetAccessTokenAidlRequest().apply { this.refreshToken = refreshToken }, callbacks) + } + + override fun getProvidersForEmail(request: GetProvidersForEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "getProvidersForEmail") + try { + callbacks.onCreateAuthUriResponse(client.createAuthUri(identifier = request.email, tenantId = request.tenantId).toCreateAuthUriResponse()) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun getProvidersForEmailCompat(email: String?, callbacks: IFirebaseAuthCallbacks) { + getProvidersForEmail(GetProvidersForEmailAidlRequest().apply { this.email = email }, callbacks) + } + + override fun linkEmailAuthCredential(request: LinkEmailAuthCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "linkEmailAuthCredential") + try { + val getTokenResponse = refreshTokenResponse(request.cachedState) + val accountInfoResult = client.getAccountInfo(idToken = getTokenResponse.accessToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() + val setAccountInfo = client.setAccountInfo(idToken = getTokenResponse.accessToken, localId = accountInfoResult.localId, email = request.email, password = request.password).toGetAccountInfoUser() + accountInfoResult.email = setAccountInfo.email + accountInfoResult.isEmailVerified = setAccountInfo.isEmailVerified + accountInfoResult.providerInfoList = setAccountInfo.providerInfoList + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun linkEmailAuthCredentialCompat(email: String?, password: String?, cachedState: String?, callbacks: IFirebaseAuthCallbacks) { + linkEmailAuthCredential(LinkEmailAuthCredentialAidlRequest().apply { this.email = email; this.password = password; this.cachedState = cachedState }, callbacks) + } + + override fun linkFederatedCredential(request: LinkFederatedCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: linkFederatedCredential") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun linkFederatedCredentialCompat(cachedState: String?, verifyAssertionRequest: VerifyAssertionRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: linkFederatedCredentialCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun linkPhoneAuthCredential(request: LinkPhoneAuthCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: linkPhoneAuthCredential") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun linkPhoneAuthCredentialCompat(cachedState: String?, credential: PhoneAuthCredential?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: linkPhoneAuthCredentialCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun reload(request: ReloadAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + try { + Log.d(TAG, "reload") + val getTokenResponse = refreshTokenResponse(request.cachedState) + val accountInfoResult = client.getAccountInfo(idToken = getTokenResponse.accessToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() + Log.d(TAG, "callback: onGetTokenResponseAndUser") + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun reloadCompat(cachedState: String?, callbacks: IFirebaseAuthCallbacks) { + reload(ReloadAidlRequest().apply { this.cachedState = cachedState }, callbacks) + } + + override fun sendEmailVerification(request: SendEmailVerificationWithSettingsAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + try { + Log.d(TAG, "sendEmailVerification") + client.getOobConfirmationCode( + requestType = "VERIFY_EMAIL", + idToken = request.token, + iOSBundleId = request.settings?.iOSBundle, + iOSAppStoreId = request.settings?.iOSAppStoreId, + continueUrl = request.settings?.url, + androidInstallApp = request.settings?.androidInstallApp, + androidMinimumVersion = request.settings?.androidMinimumVersion, + androidPackageName = request.settings?.androidPackageName, + canHandleCodeInApp = request.settings?.handleCodeInApp + ) + callbacks.onEmailVerificationResponse() + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun sendEmailVerificationCompat(token: String?, actionCodeSettings: ActionCodeSettings?, callbacks: IFirebaseAuthCallbacks) { + sendEmailVerification(SendEmailVerificationWithSettingsAidlRequest().apply { this.token = token; this.settings = actionCodeSettings }, callbacks) + } + + @Suppress("DEPRECATION") + override fun sendVerificationCode(request: SendVerificationCodeAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + try { + Log.d(TAG, "sendVerificationCode") + val reCaptchaToken = when { + request.request.recaptchaToken != null -> request.request.recaptchaToken + ReCaptchaOverlay.isSupported(context) -> ReCaptchaOverlay.awaitToken(context, apiKey, getAuthorizedDomain()) + ReCaptchaActivity.isSupported() -> ReCaptchaActivity.awaitToken(context, apiKey, getAuthorizedDomain()) + else -> throw RuntimeException("No recaptcha token available") + } + var sessionInfo: String? = null + var registered = true + val receiver = object : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + var smsCode: String? = null + for (message in intent.getSmsMessages()) { + smsCode = Regex("\\b([0-9]{6})\\b").find(message.messageBody)?.groups?.get(1)?.value + ?: continue + Log.d(TAG, "Received SMS verification code: $smsCode") + break + } + if (smsCode == null) return + registered = false + context.unregisterReceiver(this) + try { + callbacks.onVerificationCompletedResponse(PhoneAuthCredential().apply { + this.phoneNumber = request.request.phoneNumber + this.sessionInfo = sessionInfo + this.smsCode = smsCode + }) + Log.d(TAG, "callback: onVerificationCompletedResponse") + } catch (e: Exception) { + Log.w(TAG, e) + } + } + } + context.registerReceiver(receiver, IntentFilter("android.provider.Telephony.SMS_RECEIVED")) + var timeout = request.request.timeoutInSeconds * 1000L + if (timeout <= 0L) timeout = 120000L + Handler().postDelayed({ + if (registered) { + Log.d(TAG, "Waited ${timeout}ms for verification code SMS, timeout.") + context.unregisterReceiver(receiver) + callbacks.onVerificationAutoTimeOut(sessionInfo) + Log.d(TAG, "callback: onVerificationAutoTimeOut") + } + }, timeout) + sessionInfo = client.sendVerificationCode(phoneNumber = request.request.phoneNumber, reCaptchaToken = reCaptchaToken).getString("sessionInfo") + callbacks.onSendVerificationCodeResponse(sessionInfo) + Log.d(TAG, "callback: onSendVerificationCodeResponse") + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun sendVerificationCodeCompat(request: SendVerificationCodeRequest, callbacks: IFirebaseAuthCallbacks) { + sendVerificationCode(SendVerificationCodeAidlRequest().apply { this.request = request }, callbacks) + } + + override fun sendGetOobConfirmationCodeEmail(request: SendGetOobConfirmationCodeEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + try { + Log.d(TAG, "sendGetOobConfirmationCodeEmail") + client.getOobConfirmationCode( + requestType = request.settings?.requestTypeAsString + ?: "OOB_REQ_TYPE_UNSPECIFIED", + email = request.email, + iOSBundleId = request.settings?.iOSBundle, + iOSAppStoreId = request.settings?.iOSAppStoreId, + continueUrl = request.settings?.url, + androidInstallApp = request.settings?.androidInstallApp, + androidMinimumVersion = request.settings?.androidMinimumVersion, + androidPackageName = request.settings?.androidPackageName, + canHandleCodeInApp = request.settings?.handleCodeInApp + ) + Log.d(TAG, "callback: onResetPasswordResponse") + callbacks.onResetPasswordResponse(null) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun sendGetOobConfirmationCodeEmailCompat(email: String?, actionCodeSettings: ActionCodeSettings?, callbacks: IFirebaseAuthCallbacks) { + sendGetOobConfirmationCodeEmail(SendGetOobConfirmationCodeEmailAidlRequest().apply { this.email = email; this.settings = actionCodeSettings }, callbacks) + } + + override fun setFirebaseUiVersion(request: SetFirebaseUiVersionAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: setFirebaseUiVersion") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun setFirebaseUIVersionCompat(firebaseUiVersion: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: setFirebaseUIVersionCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun signInAnonymously(request: SignInAnonymouslyAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "signInAnonymously") + try { + val tokenResult = client.signupNewUser(tenantId = request.tenantId) + val idToken = tokenResult.getString("idToken") + val refreshToken = tokenResult.getString("refreshToken") + val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() + val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = true } + Log.d(TAG, "callback: onGetTokenResponseAndUser") + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun signInAnonymouslyCompat(callbacks: IFirebaseAuthCallbacks) { + signInAnonymously(SignInAnonymouslyAidlRequest(), callbacks) + } + + override fun signInWithCredential(request: SignInWithCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: signInWithCredential") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun signInWithCredentialCompat(verifyAssertionRequest: VerifyAssertionRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: signInWithCredentialCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun signInWithCustomToken(request: SignInWithCustomTokenAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "signInWithCustomToken") + try { + val tokenResult = client.verifyCustomToken(token = request.token) + val idToken = tokenResult.getString("idToken") + val refreshToken = tokenResult.getString("refreshToken") + val isNewUser = tokenResult.optBoolean("isNewUser") + val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() + val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = isNewUser } + Log.d(TAG, "callback: onGetTokenResponseAndUser") + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun signInWithCustomTokenCompat(token: String, callbacks: IFirebaseAuthCallbacks) { + signInWithCustomToken(SignInWithCustomTokenAidlRequest().apply { this.token = token }, callbacks) + } + + override fun signInWithEmailAndPassword(request: SignInWithEmailAndPasswordAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "signInWithEmailAndPassword") + try { + val tokenResult = client.verifyPassword(email = request.email, password = request.password, tenantId = request.tenantId) + val idToken = tokenResult.getString("idToken") + val refreshToken = tokenResult.getString("refreshToken") + val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() + val accountInfoResult = client.getAccountInfo(idToken = idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() + Log.d(TAG, "callback: onGetTokenResponseAndUser") + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun signInWithEmailAndPasswordCompat(email: String?, password: String?, callbacks: IFirebaseAuthCallbacks) { + signInWithEmailAndPassword(SignInWithEmailAndPasswordAidlRequest().apply { this.email = email; this.password = password }, callbacks) + } + + override fun signInWithEmailLink(request: SignInWithEmailLinkAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: signInWithEmailLink") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun signInWithEmailLinkCompat(credential: EmailAuthCredential?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: signInWithEmailLinkCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun signInWithPhoneNumber(request: SignInWithPhoneNumberAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "signInWithPhoneNumber") + try { + val tokenResult = client.verifyPhoneNumber( + phoneNumber = request.credential.phoneNumber, + temporaryProof = request.credential.temporaryProof, + sessionInfo = request.credential.sessionInfo, + code = request.credential.smsCode + ) + val idToken = tokenResult.getString("idToken") + val refreshToken = tokenResult.getString("refreshToken") + val isNewUser = tokenResult.optBoolean("isNewUser") + val getTokenResponse = client.getTokenByRefreshToken(refreshToken).toGetTokenResponse() + val accountInfoResult = client.getAccountInfo(idToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser().apply { this.isNewUser = isNewUser } + Log.d(TAG, "callback: onGetTokenResponseAndUser") + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun signInWithPhoneNumberCompat(credential: PhoneAuthCredential?, callbacks: IFirebaseAuthCallbacks) { + signInWithPhoneNumber(SignInWithPhoneNumberAidlRequest().apply { this.credential = credential }, callbacks) + } + + override fun startMfaEnrollmentWithPhoneNumber(request: StartMfaPhoneNumberEnrollmentAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: startMfaEnrollmentWithPhoneNumber") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun startMfaSignInWithPhoneNumber(request: StartMfaPhoneNumberSignInAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: startMfaSignInWithPhoneNumber") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun unenrollMfa(request: UnenrollMfaAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: unenrollMfa") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun unlinkEmailCredential(request: UnlinkEmailCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: unlinkEmailCredential") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun unlinkEmailCredentialCompat(cachedState: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: unlinkEmailCredentialCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun unlinkFederatedCredential(request: UnlinkFederatedCredentialAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: unlinkFederatedCredential") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun unlinkFederatedCredentialCompat(provider: String?, cachedState: String?, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: unlinkFederatedCredentialCompat") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun updateProfile(request: UpdateProfileAidlRequest, callbacks: IFirebaseAuthCallbacks) { + lifecycleScope.launchWhenStarted { + Log.d(TAG, "updateProfile") + try { + val getTokenResponse = refreshTokenResponse(request.cachedState) + val accountInfoResult = client.getAccountInfo(idToken = getTokenResponse.accessToken).getJSONArray("users").getJSONObject(0).toGetAccountInfoUser() + val setAccountInfo = client.setAccountInfo(idToken = getTokenResponse.accessToken, localId = accountInfoResult.localId, displayName = request.request.displayName, photoUrl = request.request.photoUrl, deleteAttribute = request.request.deleteAttributeList).toGetAccountInfoUser() + accountInfoResult.photoUrl = setAccountInfo.photoUrl + accountInfoResult.displayName = setAccountInfo.displayName + callbacks.onGetTokenResponseAndUser(getTokenResponse, accountInfoResult) + } catch (e: Exception) { + Log.w(TAG, "callback: onFailure", e) + callbacks.onFailure(Status(CommonStatusCodes.INTERNAL_ERROR, e.message)) + } + } + } + + override fun updateProfileCompat(cachedState: String?, userProfileChangeRequest: UserProfileChangeRequest, callbacks: IFirebaseAuthCallbacks) { + updateProfile(UpdateProfileAidlRequest().apply { this.cachedState = cachedState; this.request = userProfileChangeRequest }, callbacks) + } + + override fun verifyBeforeUpdateEmail(request: VerifyBeforeUpdateEmailAidlRequest, callbacks: IFirebaseAuthCallbacks) { + Log.d(TAG, "Not yet implemented: verifyBeforeUpdateEmail") + callbacks.onFailure(Status(CommonStatusCodes.CANCELED, "Not supported")) + } + + override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean { + if (super.onTransact(code, data, reply, flags)) return true + Log.d(TAG, "onTransact: $code, $data, $flags") + return false + } +} diff --git a/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/IdentityToolkitClient.kt b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/IdentityToolkitClient.kt new file mode 100644 index 00000000..0bfa7621 --- /dev/null +++ b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/IdentityToolkitClient.kt @@ -0,0 +1,139 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +@file:Suppress("WARNINGS") + +package org.microg.gms.firebase.auth + +import android.content.Context +import android.util.Log +import com.android.volley.NetworkResponse +import com.android.volley.ParseError +import com.android.volley.Request.Method.GET +import com.android.volley.Request.Method.POST +import com.android.volley.Response +import com.android.volley.VolleyError +import com.android.volley.toolbox.HttpHeaderParser +import com.android.volley.toolbox.JsonObjectRequest +import com.android.volley.toolbox.JsonRequest +import com.android.volley.toolbox.Volley +import org.json.JSONArray +import org.json.JSONException +import org.json.JSONObject +import java.io.UnsupportedEncodingException +import java.lang.RuntimeException +import java.nio.charset.Charset +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException +import kotlin.coroutines.suspendCoroutine + +private const val TAG = "GmsFirebaseAuthClient" + +class IdentityToolkitClient(context: Context, private val apiKey: String) { + private val queue = Volley.newRequestQueue(context) + + private fun buildRelyingPartyUrl(method: String) = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/$method?key=$apiKey" + private fun buildStsUrl(method: String) = "https://securetoken.googleapis.com/v1/$method?key=$apiKey" + + private suspend fun request(method: String, data: JSONObject): JSONObject = suspendCoroutine { continuation -> + queue.add(JsonObjectRequest(POST, buildRelyingPartyUrl(method), data, { + continuation.resume(it) + }, { + Log.d(TAG, String(it.networkResponse.data)) + continuation.resumeWithException(RuntimeException(it)) + })) + } + + suspend fun createAuthUri(identifier: String? = null, tenantId: String? = null, continueUri: String? = "http://localhost"): JSONObject = + request("createAuthUri", JSONObject() + .put("identifier", identifier) + .put("tenantId", tenantId) + .put("continueUri", continueUri)) + + suspend fun getAccountInfo(idToken: String? = null): JSONObject = + request("getAccountInfo", JSONObject() + .put("idToken", idToken)) + + suspend fun getProjectConfig(): JSONObject = suspendCoroutine { continuation -> + queue.add(JsonObjectRequest(GET, buildRelyingPartyUrl("getProjectConfig"), null, { continuation.resume(it) }, { continuation.resumeWithException(RuntimeException(it)) })) + } + + suspend fun getOobConfirmationCode(requestType: String, email: String? = null, newEmail: String? = null, continueUrl: String? = null, idToken: String? = null, iOSBundleId: String? = null, iOSAppStoreId: String? = null, androidMinimumVersion: String? = null, androidInstallApp: Boolean? = null, androidPackageName: String? = null, canHandleCodeInApp: Boolean? = null): JSONObject = + request("getOobConfirmationCode", JSONObject() + .put("kind", "identitytoolkit#relyingparty") + .put("requestType", requestType) + .put("email", email) + .put("newEmail", newEmail) + .put("continueUrl", continueUrl) + .put("idToken", idToken) + .put("iOSBundleId", iOSBundleId) + .put("iOSAppStoreId", iOSAppStoreId) + .put("androidMinimumVersion", androidMinimumVersion) + .put("androidInstallApp", androidInstallApp) + .put("androidPackageName", androidPackageName) + .put("canHandleCodeInApp", canHandleCodeInApp)) + + suspend fun sendVerificationCode(phoneNumber: String? = null, reCaptchaToken: String? = null): JSONObject = + request("sendVerificationCode", JSONObject() + .put("phoneNumber", phoneNumber) + .put("recaptchaToken", reCaptchaToken)) + + suspend fun setAccountInfo(idToken: String? = null, localId: String? = null, email: String? = null, password: String? = null, displayName: String? = null, photoUrl: String? = null, deleteAttribute: List = emptyList()): JSONObject = + request("setAccountInfo", JSONObject() + .put("idToken", idToken) + .put("localId", localId) + .put("email", email) + .put("password", password) + .put("displayName", displayName) + .put("photoUrl", photoUrl) + .put("deleteAttribute", JSONArray().apply { deleteAttribute.forEach { put(it) } })) + + suspend fun signupNewUser(email: String? = null, password: String? = null, tenantId: String? = null): JSONObject = + request("signupNewUser", JSONObject() + .put("email", email) + .put("password", password) + .put("tenantId", tenantId)) + + suspend fun verifyCustomToken(token: String? = null, returnSecureToken: Boolean = true): JSONObject = + request("verifyCustomToken", JSONObject() + .put("token", token) + .put("returnSecureToken", returnSecureToken)) + + suspend fun verifyPassword(email: String? = null, password: String? = null, tenantId: String? = null, returnSecureToken: Boolean = true): JSONObject = + request("verifyPassword", JSONObject() + .put("email", email) + .put("password", password) + .put("tenantId", tenantId) + .put("returnSecureToken", returnSecureToken)) + + suspend fun verifyPhoneNumber(phoneNumber: String? = null, sessionInfo: String? = null, code: String? = null, idToken: String? = null, verificationProof: String? = null, temporaryProof: String? = null): JSONObject = + request("verifyPhoneNumber", JSONObject() + .put("verificationProof", verificationProof) + .put("code", code) + .put("idToken", idToken) + .put("temporaryProof", temporaryProof) + .put("phoneNumber", phoneNumber) + .put("sessionInfo", sessionInfo)) + + suspend fun getTokenByRefreshToken(refreshToken: String): JSONObject = suspendCoroutine { continuation -> + queue.add(StsRequest(POST, buildStsUrl("token"), "grant_type=refresh_token&refresh_token=$refreshToken", { continuation.resume(it) }, { continuation.resumeWithException(RuntimeException(it)) })) + } +} + +private class StsRequest(method: Int, url: String, request: String?, listener: (JSONObject) -> Unit, errorListener: (VolleyError) -> Unit) : JsonRequest(method, url, request, listener, errorListener) { + override fun parseNetworkResponse(response: NetworkResponse?): Response { + return try { + val jsonString = String(response!!.data, Charset.forName(HttpHeaderParser.parseCharset(response!!.headers, PROTOCOL_CHARSET))) + Response.success(JSONObject(jsonString), HttpHeaderParser.parseCacheHeaders(response)) + } catch (e: UnsupportedEncodingException) { + Response.error(ParseError(e)) + } catch (je: JSONException) { + Response.error(ParseError(je)) + } + } + + override fun getBodyContentType(): String { + return "application/x-www-form-urlencoded" + } +} diff --git a/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaActivity.kt b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaActivity.kt new file mode 100644 index 00000000..ed254e07 --- /dev/null +++ b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaActivity.kt @@ -0,0 +1,103 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.firebase.auth + +import android.annotation.SuppressLint +import android.app.Activity +import android.content.Context +import android.content.Intent +import android.content.Intent.* +import android.os.Bundle +import android.os.ResultReceiver +import android.util.Log +import android.webkit.JavascriptInterface +import android.webkit.WebSettings +import android.webkit.WebView +import androidx.appcompat.app.AppCompatActivity +import org.microg.gms.firebase.auth.core.R +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException +import kotlin.coroutines.suspendCoroutine + +private const val TAG = "GmsFirebaseAuthCaptcha" + +class ReCaptchaActivity : AppCompatActivity() { + private val receiver: ResultReceiver? + get() = intent.getParcelableExtra(EXTRA_RESULT_RECEIVER) + private val hostname: String + get() = intent.getStringExtra(EXTRA_HOSTNAME) ?: "localhost:5000" + private var finished = false + + @SuppressLint("SetJavaScriptEnabled", "AddJavascriptInterface") + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + openWebsite() + } + + private fun openWebsite() { + val apiKey = intent.getStringExtra(EXTRA_API_KEY) ?: return finishResult(Activity.RESULT_CANCELED) + setContentView(R.layout.activity_recaptcha) + val view = findViewById(R.id.web) + val settings = view.settings + settings.javaScriptEnabled = true + settings.useWideViewPort = false + settings.setSupportZoom(false) + settings.displayZoomControls = false + settings.cacheMode = WebSettings.LOAD_NO_CACHE + view.addJavascriptInterface(object : Any() { + @JavascriptInterface + fun onReCaptchaToken(token: String) { + Log.d(TAG, "onReCaptchaToken: $token") + finishResult(Activity.RESULT_OK, token) + } + }, "MyCallback") + val captcha = assets.open("recaptcha.html").bufferedReader().readText().replace("%apikey%", apiKey) + view.loadDataWithBaseURL("https://$hostname/", captcha, null, null, "https://$hostname/") + } + + fun finishResult(resultCode: Int, token: String? = null) { + finished = true + setResult(resultCode, token?.let { Intent().apply { putExtra(EXTRA_TOKEN, it) } }) + receiver?.send(resultCode, token?.let { Bundle().apply { putString(EXTRA_TOKEN, it) } }) + finish() + } + + override fun onDestroy() { + super.onDestroy() + if (!finished) receiver?.send(Activity.RESULT_CANCELED, null) + } + + companion object { + const val EXTRA_TOKEN = "token" + const val EXTRA_API_KEY = "api_key" + const val EXTRA_HOSTNAME = "hostname" + const val EXTRA_RESULT_RECEIVER = "receiver" + + fun isSupported(): Boolean = true + + suspend fun awaitToken(context: Context, apiKey: String, hostname: String? = null) = suspendCoroutine { continuation -> + val intent = Intent(context, ReCaptchaActivity::class.java) + val resultReceiver = object : ResultReceiver(null) { + override fun onReceiveResult(resultCode: Int, resultData: Bundle?) { + try { + if (resultCode == Activity.RESULT_OK) { + continuation.resume(resultData?.getString(EXTRA_TOKEN)!!) + } + } catch (e: Exception) { + continuation.resumeWithException(e) + } + } + } + intent.putExtra(EXTRA_API_KEY, apiKey) + intent.putExtra(EXTRA_RESULT_RECEIVER, resultReceiver) + intent.putExtra(EXTRA_HOSTNAME, hostname) + intent.addFlags(FLAG_ACTIVITY_NEW_TASK) + intent.addFlags(FLAG_ACTIVITY_REORDER_TO_FRONT) + intent.addFlags(FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + context.startActivity(intent) + } + } +} diff --git a/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaOverlay.kt b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaOverlay.kt new file mode 100644 index 00000000..9f9988d7 --- /dev/null +++ b/firebase-auth-core/src/main/kotlin/org/microg/gms/firebase/auth/ReCaptchaOverlay.kt @@ -0,0 +1,119 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +@file:Suppress("WARNINGS") + +package org.microg.gms.firebase.auth + +import android.content.Context +import android.graphics.PixelFormat +import android.os.Build +import android.provider.Settings +import android.util.DisplayMetrics +import android.util.Log +import android.view.* +import android.webkit.JavascriptInterface +import android.webkit.WebSettings +import android.webkit.WebView +import android.widget.FrameLayout +import org.microg.gms.firebase.auth.core.R +import kotlin.coroutines.Continuation +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException +import kotlin.coroutines.suspendCoroutine + +private const val TAG = "GmsFirebaseAuthCaptcha" + +class ReCaptchaOverlay(val context: Context, val apiKey: String, val hostname: String?, val continuation: Continuation) { + + val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager + var finished = false + var container: View? = null + + private fun show() { + val layoutParamsType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY + } else { + WindowManager.LayoutParams.TYPE_SYSTEM_ALERT + } + + val params = WindowManager.LayoutParams( + WindowManager.LayoutParams.MATCH_PARENT, + WindowManager.LayoutParams.WRAP_CONTENT, + layoutParamsType, + 0, + PixelFormat.TRANSLUCENT) + + params.gravity = Gravity.CENTER or Gravity.START + params.x = 0 + params.y = 0 + + val interceptorLayout: FrameLayout = object : FrameLayout(context) { + override fun dispatchKeyEvent(event: KeyEvent): Boolean { + if (event.action == KeyEvent.ACTION_DOWN) { + if (event.keyCode == KeyEvent.KEYCODE_BACK || event.keyCode == KeyEvent.KEYCODE_HOME) { + cancel() + return true + } + } + return super.dispatchKeyEvent(event) + } + } + + val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as? LayoutInflater? + if (inflater != null) { + val container = inflater.inflate(R.layout.activity_recaptcha, interceptorLayout) + this.container = container + container.setBackgroundResource(androidx.appcompat.R.drawable.abc_dialog_material_background) + val pad = (5.0 * (context.resources.displayMetrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)).toInt() + container.setOnTouchListener { v, _ -> + v.performClick() + cancel() + return@setOnTouchListener true + } + val view = container.findViewById(R.id.web) + view.setPadding(pad, pad, pad, pad) + val settings = view.settings + settings.javaScriptEnabled = true + settings.useWideViewPort = false + settings.setSupportZoom(false) + settings.displayZoomControls = false + settings.cacheMode = WebSettings.LOAD_NO_CACHE + view.addJavascriptInterface(object : Any() { + @JavascriptInterface + fun onReCaptchaToken(token: String) { + Log.d(TAG, "onReCaptchaToken: $token") + if (!finished) { + finished = true + continuation.resume(token) + } + close() + } + }, "MyCallback") + val captcha = context.assets.open("recaptcha.html").bufferedReader().readText().replace("%apikey%", apiKey) + view.loadDataWithBaseURL("https://$hostname/", captcha, null, null, "https://$hostname/") + windowManager.addView(container, params) + } + } + + fun cancel() { + if (!finished) { + finished = true + continuation.resumeWithException(RuntimeException("User cancelled")) + } + close() + } + + fun close() { + container?.let { windowManager.removeView(it) } + } + + companion object { + fun isSupported(context: Context): Boolean = Build.VERSION.SDK_INT < Build.VERSION_CODES.M || Settings.canDrawOverlays(context) + + suspend fun awaitToken(context: Context, apiKey: String, hostname: String? = null) = suspendCoroutine { continuation -> + ReCaptchaOverlay(context, apiKey, hostname ?: "localhost:5000", continuation).show() + } + } +} diff --git a/firebase-auth-core/src/main/res/layout/activity_recaptcha.xml b/firebase-auth-core/src/main/res/layout/activity_recaptcha.xml new file mode 100644 index 00000000..36ea80bb --- /dev/null +++ b/firebase-auth-core/src/main/res/layout/activity_recaptcha.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/firebase-auth-core/src/main/res/values/themes.xml b/firebase-auth-core/src/main/res/values/themes.xml new file mode 100644 index 00000000..a32388e2 --- /dev/null +++ b/firebase-auth-core/src/main/res/values/themes.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/firebase-dynamic-links-api/build.gradle b/firebase-dynamic-links-api/build.gradle new file mode 100644 index 00000000..ff813256 --- /dev/null +++ b/firebase-dynamic-links-api/build.gradle @@ -0,0 +1,49 @@ +/* + * Copyright 2019 e Foundation + * + * 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' + +String getMyVersionName() { + def stdout = new ByteArrayOutputStream() + if (rootProject.file("gradlew").exists()) + exec { commandLine 'git', 'describe', '--tags', '--always', '--dirty'; standardOutput = stdout } + else // automatic build system, don't tag dirty + exec { commandLine 'git', 'describe', '--tags', '--always'; standardOutput = stdout } + return stdout.toString().trim().substring(1) +} + +group = 'org.microg' +version = getMyVersionName() + +android { + compileSdkVersion androidCompileSdk + buildToolsVersion "$androidBuildVersionTools" + + defaultConfig { + versionName version + minSdkVersion androidMinSdk + targetSdkVersion androidTargetSdk + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +} + +dependencies { + api project(':play-services-basement') +} diff --git a/firebase-dynamic-links-api/gradle.properties b/firebase-dynamic-links-api/gradle.properties new file mode 100644 index 00000000..c601b6d6 --- /dev/null +++ b/firebase-dynamic-links-api/gradle.properties @@ -0,0 +1,34 @@ +# +# Copyright 2019 e Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +POM_NAME=Firebase Dynamic Links API +POM_DESCRIPTION=Interfaces and objects for IPC between Firebase Library and microG + +POM_PACKAGING=aar + +POM_URL=https://github.com/microg/android_external_GmsApi + +POM_SCM_URL=https://github.com/microg/android_external_GmsApi +POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git + +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo + +POM_DEVELOPER_ID=alexandruchircu +POM_DEVELOPER_NAME=Alexandru Chircu + diff --git a/firebase-dynamic-links-api/src/main/AndroidManifest.xml b/firebase-dynamic-links-api/src/main/AndroidManifest.xml new file mode 100644 index 00000000..ae17555c --- /dev/null +++ b/firebase-dynamic-links-api/src/main/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + diff --git a/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/DynamicLinkData.aidl b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/DynamicLinkData.aidl new file mode 100644 index 00000000..5862178a --- /dev/null +++ b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/DynamicLinkData.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.dynamiclinks.internal; + +parcelable DynamicLinkData; \ No newline at end of file diff --git a/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksCallbacks.aidl b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksCallbacks.aidl new file mode 100644 index 00000000..28a1cff5 --- /dev/null +++ b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksCallbacks.aidl @@ -0,0 +1,11 @@ +package com.google.firebase.dynamiclinks.internal; + +import com.google.firebase.dynamiclinks.internal.DynamicLinkData; +import com.google.firebase.dynamiclinks.internal.ShortDynamicLink; + +import com.google.android.gms.common.api.Status; + +interface IDynamicLinksCallbacks { + void onStatusDynamicLinkData(in Status status, in DynamicLinkData dldata) = 0; + void onStatusShortDynamicLink(in Status status, in ShortDynamicLink sdlink) = 1; +} diff --git a/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksService.aidl b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksService.aidl new file mode 100644 index 00000000..c7022740 --- /dev/null +++ b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/IDynamicLinksService.aidl @@ -0,0 +1,10 @@ +package com.google.firebase.dynamiclinks.internal; + +import com.google.firebase.dynamiclinks.internal.IDynamicLinksCallbacks; + +import android.os.Bundle; + +interface IDynamicLinksService { + void getInitialLink(IDynamicLinksCallbacks callback, String var2) = 0; + void func2(IDynamicLinksCallbacks callback, in Bundle var2) = 1; +} diff --git a/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.aidl b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.aidl new file mode 100644 index 00000000..f4852a03 --- /dev/null +++ b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.dynamiclinks.internal; + +parcelable ShortDynamicLink; \ No newline at end of file diff --git a/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/Warning.aidl b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/Warning.aidl new file mode 100644 index 00000000..4331c92a --- /dev/null +++ b/firebase-dynamic-links-api/src/main/aidl/com/google/firebase/dynamiclinks/internal/Warning.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.dynamiclinks.internal; + +parcelable Warning; \ No newline at end of file diff --git a/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/DynamicLinkData.java b/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/DynamicLinkData.java new file mode 100644 index 00000000..0279f9ae --- /dev/null +++ b/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/DynamicLinkData.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2019 e Foundation + * + * 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.firebase.dynamiclinks.internal; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import android.os.Bundle; +import android.net.Uri; + +public class DynamicLinkData extends AutoSafeParcelable { + @SafeParceled(1) + public final String dynamicLink; + + @SafeParceled(2) + public final String deepLink; + + @SafeParceled(3) + public final int minVersion; + + @SafeParceled(4) + public final long clickTimestamp; + + @SafeParceled(5) + public final Bundle extensionBundle; + + @SafeParceled(6) + public final Uri redirectUrl; + + public DynamicLinkData() { + dynamicLink = new String(); + deepLink = new String(); + minVersion = 0; + clickTimestamp = 0; + extensionBundle = new Bundle(); + redirectUrl = Uri.EMPTY; + } + + public static final Creator CREATOR = new AutoCreator(DynamicLinkData.class); +} \ No newline at end of file diff --git a/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.java b/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.java new file mode 100644 index 00000000..9889767b --- /dev/null +++ b/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/ShortDynamicLink.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2019 e Foundation + * + * 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.firebase.dynamiclinks.internal; + +import com.google.firebase.dynamiclinks.internal.Warning; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import android.net.Uri; +import java.util.List; +import java.util.ArrayList; + +public class ShortDynamicLink extends AutoSafeParcelable { + @SafeParceled(1) + public final Uri shortLink; + + @SafeParceled(2) + public final Uri previewLink; + + @SafeParceled(3) + public final List warnings; + + public ShortDynamicLink() { + shortLink = Uri.EMPTY; + previewLink = Uri.EMPTY; + + warnings = new ArrayList<>(); + } + + public static final Creator CREATOR = new AutoCreator(ShortDynamicLink.class); +} \ No newline at end of file diff --git a/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/Warning.java b/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/Warning.java new file mode 100644 index 00000000..af62ef24 --- /dev/null +++ b/firebase-dynamic-links-api/src/main/java/com/google/firebase/dynamiclinks/internal/Warning.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2019 e Foundation + * + * 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.firebase.dynamiclinks.internal; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class Warning extends AutoSafeParcelable { + @SafeParceled(1) + private int versionCode = 1; + + @SafeParceled(2) + public final String message; + + public Warning() { + message = null; + } + + public static final Creator CREATOR = new AutoCreator(Warning.class); +} \ No newline at end of file diff --git a/gradlew b/gradlew index fbd7c515..1b090c2c 100755 --- a/gradlew +++ b/gradlew @@ -82,7 +82,6 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/CompoundHashParcelable.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/CompoundHashParcelable.aidl new file mode 100644 index 00000000..689e5918 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/CompoundHashParcelable.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.database.connection.idl; + +parcelable CompoundHashParcelable; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/ConnectionConfig.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/ConnectionConfig.aidl new file mode 100644 index 00000000..d6c1fc31 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/ConnectionConfig.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.database.connection.idl; + +parcelable ConnectionConfig; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IConnectionAuthTokenProvider.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IConnectionAuthTokenProvider.aidl new file mode 100644 index 00000000..447f9f4a --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IConnectionAuthTokenProvider.aidl @@ -0,0 +1,7 @@ +package com.google.firebase.database.connection.idl; + +import com.google.firebase.database.connection.idl.IGetTokenCallback; + +interface IConnectionAuthTokenProvider { + void zero(boolean var1, IGetTokenCallback var2) = 0; +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IGetTokenCallback.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IGetTokenCallback.aidl new file mode 100644 index 00000000..c4d45cdd --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IGetTokenCallback.aidl @@ -0,0 +1,6 @@ +package com.google.firebase.database.connection.idl; + +interface IGetTokenCallback { + void zero(String s) = 0; + void onError(String s) = 1; +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IListenHashProvider.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IListenHashProvider.aidl new file mode 100644 index 00000000..a5aaa187 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IListenHashProvider.aidl @@ -0,0 +1,11 @@ +package com.google.firebase.database.connection.idl; + +import com.google.firebase.database.connection.idl.CompoundHashParcelable; + +interface IListenHashProvider { + String zzPY() = 0; + + boolean zzPZ() = 1; + + CompoundHashParcelable zzQF() = 2; +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnection.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnection.aidl new file mode 100644 index 00000000..0f4a2dac --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnection.aidl @@ -0,0 +1,43 @@ +package com.google.firebase.database.connection.idl; + +import com.google.android.gms.dynamic.IObjectWrapper; + +import com.google.firebase.database.connection.idl.ConnectionConfig; +import com.google.firebase.database.connection.idl.IConnectionAuthTokenProvider; +import com.google.firebase.database.connection.idl.IListenHashProvider; +import com.google.firebase.database.connection.idl.IPersistentConnectionDelegate; +import com.google.firebase.database.connection.idl.IRequestResultCallback; + +interface IPersistentConnection { + void setup(in ConnectionConfig var1, IConnectionAuthTokenProvider var2, IObjectWrapper var3, IPersistentConnectionDelegate var4) = 0; + + void initialize() = 1; + + void shutdown() = 2; + + void refreshAuthToken() = 3; + + void listen(in List var1, IObjectWrapper var2, IListenHashProvider var3, long var4, IRequestResultCallback var6) = 4; + + void unlisten(in List var1, IObjectWrapper var2) = 5; + + void purgeOutstandingWrites() = 6; + + void put(in List var1, IObjectWrapper var2, IRequestResultCallback var3) = 7; + + void compareAndPut(in List var1, IObjectWrapper var2, String var3, IRequestResultCallback var4) = 8; + + void merge(in List var1, IObjectWrapper var2, IRequestResultCallback var3) = 9; + + void onDisconnectPut(in List var1, IObjectWrapper var2, IRequestResultCallback var3) = 10; + + void onDisconnectMerge(in List var1, IObjectWrapper var2, IRequestResultCallback var3) = 11; + + void onDisconnectCancel(in List var1, IRequestResultCallback var2) = 12; + + void interrupt(String var1) = 13; + + void resume(String var1) = 14; + + boolean isInterrupted(String var1) = 15; +} diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnectionDelegate.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnectionDelegate.aidl new file mode 100644 index 00000000..9ae649d0 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IPersistentConnectionDelegate.aidl @@ -0,0 +1,19 @@ +package com.google.firebase.database.connection.idl; + +import com.google.android.gms.dynamic.IObjectWrapper; + +import com.google.firebase.database.connection.idl.RangeParcelable; + +interface IPersistentConnectionDelegate { + void zero(in List var1, IObjectWrapper var2, boolean var3, long var4) = 0; + + void one(in List var1, in List var2, IObjectWrapper var3, long var4) = 1; + + void two() = 2; + + void onDisconnect() = 3; + + void four(boolean var1) = 4; + + void five(IObjectWrapper var1) = 5; +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IRequestResultCallback.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IRequestResultCallback.aidl new file mode 100644 index 00000000..5806bc35 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/IRequestResultCallback.aidl @@ -0,0 +1,5 @@ +package com.google.firebase.database.connection.idl; + +interface IRequestResultCallback { + void zero(String var1, String var2) = 0; +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/RangeParcelable.aidl b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/RangeParcelable.aidl new file mode 100644 index 00000000..08d6df18 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/firebase/database/connection/idl/RangeParcelable.aidl @@ -0,0 +1,3 @@ +package com.google.firebase.database.connection.idl; + +parcelable RangeParcelable; \ No newline at end of file diff --git a/play-services-api/src/main/java/com/google/firebase/database/connection/idl/CompoundHashParcelable.java b/play-services-api/src/main/java/com/google/firebase/database/connection/idl/CompoundHashParcelable.java new file mode 100644 index 00000000..4b72c85d --- /dev/null +++ b/play-services-api/src/main/java/com/google/firebase/database/connection/idl/CompoundHashParcelable.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2013-2017 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.firebase.database.connection.idl; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class CompoundHashParcelable extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator(CompoundHashParcelable.class); +} diff --git a/play-services-api/src/main/java/com/google/firebase/database/connection/idl/ConnectionConfig.java b/play-services-api/src/main/java/com/google/firebase/database/connection/idl/ConnectionConfig.java new file mode 100644 index 00000000..290467b2 --- /dev/null +++ b/play-services-api/src/main/java/com/google/firebase/database/connection/idl/ConnectionConfig.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2013-2017 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.firebase.database.connection.idl; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ConnectionConfig extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator(ConnectionConfig.class); +} diff --git a/play-services-api/src/main/java/com/google/firebase/database/connection/idl/RangeParcelable.java b/play-services-api/src/main/java/com/google/firebase/database/connection/idl/RangeParcelable.java new file mode 100644 index 00000000..cfd0fd7c --- /dev/null +++ b/play-services-api/src/main/java/com/google/firebase/database/connection/idl/RangeParcelable.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2013-2017 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.firebase.database.connection.idl; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class RangeParcelable extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator(RangeParcelable.class); +} diff --git a/play-services-base-api/src/main/java/com/google/android/gms/common/data/DataHolder.java b/play-services-base-api/src/main/java/com/google/android/gms/common/data/DataHolder.java index 2d9113d0..57dc1aae 100644 --- a/play-services-base-api/src/main/java/com/google/android/gms/common/data/DataHolder.java +++ b/play-services-base-api/src/main/java/com/google/android/gms/common/data/DataHolder.java @@ -152,7 +152,6 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { return empty(statusCode, null); } - @SuppressWarnings("deprecation") @SuppressLint({"NewApi", "ObsoleteSdkInt"}) static int getCursorType(Cursor cursor, int i) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { @@ -208,7 +207,6 @@ public class DataHolder extends AutoSafeParcelable implements Closeable { throw new RuntimeException("Not yet available"); } - @SuppressWarnings("deprecation") private static CursorWindow[] createCursorWindows(Builder builder) { if (builder.columns.length == 0) return new CursorWindow[0]; List windows = new ArrayList<>(); diff --git a/play-services-base/src/main/java/com/google/android/gms/common/GoogleApiAvailability.java b/play-services-base/src/main/java/com/google/android/gms/common/GoogleApiAvailability.java index 0439619e..2d14765a 100644 --- a/play-services-base/src/main/java/com/google/android/gms/common/GoogleApiAvailability.java +++ b/play-services-base/src/main/java/com/google/android/gms/common/GoogleApiAvailability.java @@ -76,7 +76,6 @@ public class GoogleApiAvailability { return instance; } - /** * Returns a dialog to address the provided errorCode. The returned dialog displays a localized * message about the error and upon user confirmation (by tapping on dialog) will direct them diff --git a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java index 760ae244..07c07366 100644 --- a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java +++ b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java @@ -45,7 +45,9 @@ public enum GmsService { PLACE_DETECTION(67, "com.google.android.gms.location.places.PlaceDetectionApi"), CREDENTIALS(68, "com.google.android.gms.auth.api.credentials.service.START"), MEASUREMENT(93, "com.google.android.gms.measurement.START"), + FIREBASE_AUTH(112, "com.google.firebase.auth.api.gms.service.START"), GASS(116, "com.google.android.gms.gass.START"), + DYNAMIC_LINKS(131, "com.google.firebase.dynamiclinks.service.START"), IDENTITY_SIGN_IN(212, "com.google.android.gms.auth.api.identity.service.signin.START"), ; diff --git a/play-services-cast/src/main/java/com/google/android/gms/cast/Cast.java b/play-services-cast/src/main/java/com/google/android/gms/cast/Cast.java index aa5e06a5..c9b884cf 100755 --- a/play-services-cast/src/main/java/com/google/android/gms/cast/Cast.java +++ b/play-services-cast/src/main/java/com/google/android/gms/cast/Cast.java @@ -85,7 +85,6 @@ public final class Cast { */ public static final int STANDBY_STATE_YES = 1; - /** * Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Cast features. */ diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index c69867bb..93517ca0 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -28,9 +28,7 @@ dependencies { // implementation "su.litvak.chromecast:api-v2:0.10.4" implementation "info.armills.chromecast-java-api-v2:api-v2-raw-request:0.10.4-raw-request-1" - // Specified manually due to - // https://github.com/vitalidze/chromecast-java-api-v2/issues/91 - + implementation project(':firebase-dynamic-links-api') implementation project(':play-services-core-proto') implementation project(':play-services-core:microg-ui-tools') // deprecated implementation project(':play-services-api') diff --git a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/Condition.java b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/Condition.java index 5adeeb88..710b7228 100644 --- a/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/Condition.java +++ b/play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/Condition.java @@ -243,7 +243,6 @@ public class Condition { private View.OnClickListener secondActionListener; private Evaluation evaluation; - public Builder() { } diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 5e323cd7..3ce7a231 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -348,7 +348,6 @@ - + + + + + + diff --git a/play-services-core/src/main/java/com/google/android/gms/cast/framework/internal/SessionImpl.java b/play-services-core/src/main/java/com/google/android/gms/cast/framework/internal/SessionImpl.java index 954405d8..8eae49bc 100644 --- a/play-services-core/src/main/java/com/google/android/gms/cast/framework/internal/SessionImpl.java +++ b/play-services-core/src/main/java/com/google/android/gms/cast/framework/internal/SessionImpl.java @@ -19,8 +19,6 @@ package com.google.android.gms.cast.framework.internal; import android.os.Bundle; import android.os.RemoteException; import android.util.Log; - - import com.google.android.gms.cast.ApplicationMetadata; import com.google.android.gms.cast.CastDevice; import com.google.android.gms.cast.framework.ISession; diff --git a/play-services-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/firebase_database/ModuleDescriptor.java b/play-services-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/firebase_database/ModuleDescriptor.java new file mode 100644 index 00000000..8f1043a4 --- /dev/null +++ b/play-services-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/firebase_database/ModuleDescriptor.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2013-2017 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database; + +public class ModuleDescriptor { + public static final String MODULE_ID = "com.google.android.gms.firebase_database"; + public static final int MODULE_VERSION = 3; +} diff --git a/play-services-core/src/main/java/com/google/firebase/database/connection/idl/IPersistentConnectionImpl.java b/play-services-core/src/main/java/com/google/firebase/database/connection/idl/IPersistentConnectionImpl.java new file mode 100644 index 00000000..a8efde6e --- /dev/null +++ b/play-services-core/src/main/java/com/google/firebase/database/connection/idl/IPersistentConnectionImpl.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2013-2017 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.firebase.database.connection.idl; + +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.dynamic.IObjectWrapper; + +import java.util.List; + +public class IPersistentConnectionImpl extends IPersistentConnection.Stub { + private static final String TAG = "GmsFirebaseDbConImpl"; + + @Override + public void setup(ConnectionConfig var1, IConnectionAuthTokenProvider var2, IObjectWrapper var3, IPersistentConnectionDelegate var4) throws RemoteException { + Log.d(TAG, "unimplemented Method: setup"); + + } + + @Override + public void initialize() throws RemoteException { + Log.d(TAG, "unimplemented Method: initialize"); + + } + + @Override + public void shutdown() throws RemoteException { + Log.d(TAG, "unimplemented Method: shutdown"); + + } + + @Override + public void refreshAuthToken() throws RemoteException { + Log.d(TAG, "unimplemented Method: refreshAuthToken"); + + } + + @Override + public void listen(List var1, IObjectWrapper var2, IListenHashProvider var3, long var4, IRequestResultCallback var6) throws RemoteException { + Log.d(TAG, "unimplemented Method: listen"); + + } + + @Override + public void unlisten(List var1, IObjectWrapper var2) throws RemoteException { + Log.d(TAG, "unimplemented Method: unlisten"); + + } + + @Override + public void purgeOutstandingWrites() throws RemoteException { + Log.d(TAG, "unimplemented Method: purgeOutstandingWrites"); + + } + + @Override + public void put(List var1, IObjectWrapper var2, IRequestResultCallback var3) throws RemoteException { + Log.d(TAG, "unimplemented Method: put"); + + } + + @Override + public void compareAndPut(List var1, IObjectWrapper var2, String var3, IRequestResultCallback var4) throws RemoteException { + Log.d(TAG, "unimplemented Method: compareAndPut"); + + } + + @Override + public void merge(List var1, IObjectWrapper var2, IRequestResultCallback var3) throws RemoteException { + Log.d(TAG, "unimplemented Method: merge"); + + } + + @Override + public void onDisconnectPut(List var1, IObjectWrapper var2, IRequestResultCallback var3) throws RemoteException { + Log.d(TAG, "unimplemented Method: onDisconnectPut"); + + } + + @Override + public void onDisconnectMerge(List var1, IObjectWrapper var2, IRequestResultCallback var3) throws RemoteException { + Log.d(TAG, "unimplemented Method: onDisconnectMerge"); + + } + + @Override + public void onDisconnectCancel(List var1, IRequestResultCallback var2) throws RemoteException { + Log.d(TAG, "unimplemented Method: onDisconnectCancel"); + + } + + @Override + public void interrupt(String var1) throws RemoteException { + Log.d(TAG, "unimplemented Method: interrupt"); + + } + + @Override + public void resume(String var1) throws RemoteException { + Log.d(TAG, "unimplemented Method: resume"); + + } + + @Override + public boolean isInterrupted(String var1) throws RemoteException { + Log.d(TAG, "unimplemented Method: isInterrupted"); + return false; + } +} diff --git a/play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java b/play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java index 390ddd06..634d8923 100644 --- a/play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java +++ b/play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java @@ -55,6 +55,16 @@ public class DynamiteLoaderImpl extends IDynamiteLoader.Stub { @Override public int getModuleVersion2(IObjectWrapper context, String moduleId, boolean updateConfigIfRequired) throws RemoteException { + try { + return Class.forName("com.google.android.gms.dynamite.descriptors." + moduleId + ".ModuleDescriptor").getDeclaredField("MODULE_VERSION").getInt(null); + } catch (Exception e) { + Log.w(TAG, "No such module known: " + moduleId); + } + + if (moduleId.equals("com.google.android.gms.firebase_database")) { + Log.d(TAG, "returning temp fix module version for " + moduleId + ". Firebase Database will not be functional!"); + return com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.ModuleDescriptor.MODULE_VERSION; + } if (moduleId.equals("com.google.android.gms.googlecertificates")) { return com.google.android.gms.dynamite.descriptors.com.google.android.gms.googlecertificates.ModuleDescriptor.MODULE_VERSION; } diff --git a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java index e63c2223..5bf80c39 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java @@ -556,7 +556,6 @@ public class LoginActivity extends AssistantActivity { getWindow().getDecorView().setSystemUiVisibility(visibility); } - @JavascriptInterface public final void setNewAccountCreated() { Log.d(TAG, "JSBridge: setNewAccountCreated"); diff --git a/play-services-core/src/main/java/org/microg/gms/common/Build.java b/play-services-core/src/main/java/org/microg/gms/common/Build.java index 423d90d5..87590563 100644 --- a/play-services-core/src/main/java/org/microg/gms/common/Build.java +++ b/play-services-core/src/main/java/org/microg/gms/common/Build.java @@ -34,7 +34,6 @@ public class Build { public String id = android.os.Build.ID; public String serial = generateSerialNumber(); // TODO: static - @SuppressWarnings("deprecation") private static String getRadio() { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { return android.os.Build.getRadioVersion(); diff --git a/play-services-core/src/main/java/org/microg/gms/common/DeviceConfiguration.java b/play-services-core/src/main/java/org/microg/gms/common/DeviceConfiguration.java index 99fed5ef..431d4ccc 100644 --- a/play-services-core/src/main/java/org/microg/gms/common/DeviceConfiguration.java +++ b/play-services-core/src/main/java/org/microg/gms/common/DeviceConfiguration.java @@ -98,7 +98,6 @@ public class DeviceConfiguration { Collections.sort(this.glExtensions); } - @SuppressWarnings({"deprecation", "InlinedApi"}) private static List getNativePlatforms() { List nativePlatforms; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { diff --git a/play-services-core/src/main/java/org/microg/gms/common/DeviceIdentifier.java b/play-services-core/src/main/java/org/microg/gms/common/DeviceIdentifier.java index ab5d22cb..dd63794a 100644 --- a/play-services-core/src/main/java/org/microg/gms/common/DeviceIdentifier.java +++ b/play-services-core/src/main/java/org/microg/gms/common/DeviceIdentifier.java @@ -23,7 +23,6 @@ public class DeviceIdentifier { public String meid = randomMeid(); public String esn; - private static String randomMacAddress() { StringBuilder mac = new StringBuilder("b407f9"); Random rand = new Random(); diff --git a/play-services-core/src/main/java/org/microg/gms/common/PackageUtils.java b/play-services-core/src/main/java/org/microg/gms/common/PackageUtils.java index c7a6fc8d..d490278d 100644 --- a/play-services-core/src/main/java/org/microg/gms/common/PackageUtils.java +++ b/play-services-core/src/main/java/org/microg/gms/common/PackageUtils.java @@ -233,7 +233,6 @@ public class PackageUtils { return null; } - @SuppressWarnings("deprecation") public static String packageFromPendingIntent(PendingIntent pi) { if (pi == null) return null; if (SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { diff --git a/play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksService.java b/play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksService.java new file mode 100644 index 00000000..064d7ead --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksService.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 e Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.microg.gms.firebase.dynamiclinks; + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; +import android.util.Log; +import android.os.RemoteException; + +import com.google.android.gms.common.api.CommonStatusCodes; +import com.google.android.gms.common.internal.GetServiceRequest; +import com.google.android.gms.common.internal.IGmsCallbacks; + +import org.microg.gms.BaseService; +import org.microg.gms.common.GmsService; +import org.microg.gms.common.PackageUtils; + +import org.microg.gms.firebase.dynamiclinks.DynamicLinksServiceImpl; + +public class DynamicLinksService extends BaseService { + private static final String TAG = "GmsDynamicLinksService"; + + public DynamicLinksService() { + super("GmsDynamicLinksSvc", GmsService.DYNAMIC_LINKS); + } + + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { + PackageUtils.getAndCheckCallingPackage(this, request.packageName); + Log.d(TAG, "callb: " + callback + " ; req: " + request + " ; serv: " + service); + + callback.onPostInitComplete(0, new DynamicLinksServiceImpl(this, request.packageName, request.extras), null); + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksServiceImpl.java b/play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksServiceImpl.java new file mode 100644 index 00000000..ce2085af --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/firebase/dynamiclinks/DynamicLinksServiceImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2019 e Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.microg.gms.firebase.dynamiclinks; + +import android.os.Parcel; +import android.os.RemoteException; +import android.os.Bundle; +import android.util.Log; +import android.content.Context; +import android.content.Intent; + +import com.google.android.gms.common.api.Status; +import com.google.android.gms.common.api.CommonStatusCodes; + +import com.google.firebase.dynamiclinks.internal.IDynamicLinksService; +import com.google.firebase.dynamiclinks.internal.IDynamicLinksCallbacks; +import com.google.firebase.dynamiclinks.internal.DynamicLinkData; +import com.google.firebase.dynamiclinks.internal.ShortDynamicLink; + +public class DynamicLinksServiceImpl extends IDynamicLinksService.Stub { + private static final String TAG = "GmsDynamicLinksServImpl"; + + public DynamicLinksServiceImpl(Context context, String packageName, Bundle extras) { + } + + @Override + public void getInitialLink(IDynamicLinksCallbacks callback, String var2) throws RemoteException { + callback.onStatusDynamicLinkData(Status.SUCCESS, new DynamicLinkData()); + } + + @Override + public void func2(IDynamicLinksCallbacks callback, Bundle var2) throws RemoteException { + Log.d(TAG, "func2: " + callback + ", " + var2); + callback.onStatusShortDynamicLink(Status.SUCCESS, new ShortDynamicLink()); + } + + @Override + public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { + if (super.onTransact(code, data, reply, flags)) { + return true; + } + + Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); + return false; + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/GcmDatabase.java b/play-services-core/src/main/java/org/microg/gms/gcm/GcmDatabase.java index bc524047..24ff9610 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/GcmDatabase.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/GcmDatabase.java @@ -144,7 +144,6 @@ public class GcmDatabase extends SQLiteOpenHelper { return Collections.emptyList(); } - public synchronized List getRegistrationsByApp(String packageName) { SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(TABLE_REGISTRATIONS, null, FIELD_PACKAGE_NAME + " LIKE ?", new String[]{packageName}, null, null, null); @@ -173,7 +172,6 @@ public class GcmDatabase extends SQLiteOpenHelper { db.update(TABLE_APPS, cv, FIELD_PACKAGE_NAME + " LIKE ?", new String[]{packageName}); } - public synchronized void removeApp(String packageName) { SQLiteDatabase db = getWritableDatabase(); db.delete(TABLE_REGISTRATIONS, FIELD_PACKAGE_NAME + " LIKE ?", new String[]{packageName}); @@ -294,8 +292,6 @@ public class GcmDatabase extends SQLiteOpenHelper { return null; } - - @SuppressWarnings("deprecation") private void importLegacyData(SQLiteDatabase db) { db.beginTransaction(); diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java index cdf5b3ca..b11bdcb8 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java @@ -299,7 +299,6 @@ public class McsService extends Service implements Handler.Callback { currentDelay = 0; } - @Override public int onStartCommand(Intent intent, int flags, int startId) { ForegroundServiceContext.completeForegroundService(this, intent, TAG); diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/PushRegisterManager.java b/play-services-core/src/main/java/org/microg/gms/gcm/PushRegisterManager.java index 3c1846f3..70cc2e65 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/PushRegisterManager.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/PushRegisterManager.java @@ -116,8 +116,6 @@ public class PushRegisterManager { }); } - - private static Bundle handleResponse(GcmDatabase database, RegisterRequest request, RegisterResponse response, String requestId) { return handleResponse(database, request, response, null, requestId); } diff --git a/play-services-core/src/main/java/org/microg/gms/people/DatabaseHelper.java b/play-services-core/src/main/java/org/microg/gms/people/DatabaseHelper.java index a15d4cca..6008d31f 100644 --- a/play-services-core/src/main/java/org/microg/gms/people/DatabaseHelper.java +++ b/play-services-core/src/main/java/org/microg/gms/people/DatabaseHelper.java @@ -73,7 +73,6 @@ public class DatabaseHelper extends SQLiteOpenHelper { public static final String OWNERS_TABLE = "owners"; public static final String CIRCLES_TABLE = "circles"; - public DatabaseHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/checkin/ServiceInfo.kt b/play-services-core/src/main/kotlin/org/microg/gms/checkin/ServiceInfo.kt index d8902b8f..e49217c7 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/checkin/ServiceInfo.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/checkin/ServiceInfo.kt @@ -55,8 +55,6 @@ class ServiceInfoReceiver : BroadcastReceiver() { } } - - private suspend fun sendToServiceInfoReceiver(intent: Intent, context: Context): ServiceInfo = suspendCoroutine { context.registerReceiver(object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { diff --git a/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt b/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt index 1b0e0c94..44719eab 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -@file:Suppress("DEPRECATION") +@file:Suppress("WARNINGS") package org.microg.gms.gcm diff --git a/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt b/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt index caf317a5..5dfaef89 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -@file:Suppress("DEPRECATION") +@file:Suppress("WARNINGS") package org.microg.gms.phenotype diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationFragment.kt index d0c3f0ed..8e8b987b 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationFragment.kt @@ -42,7 +42,6 @@ class DeviceRegistrationFragment : Fragment(R.layout.device_registration_fragmen binding.checkinEnabled = serviceInfo.configuration.enabled } - override fun onResume() { super.onResume() lifecycleScope.launchWhenResumed { diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt index 9e37b9b7..b6af813f 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -@file:Suppress("DEPRECATION") +@file:Suppress("WARNINGS") package org.microg.gms.ui diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppFragment.kt index 567bfe28..695095e7 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppFragment.kt @@ -19,7 +19,6 @@ import androidx.lifecycle.lifecycleScope import com.mgoogle.android.gms.R import com.mgoogle.android.gms.databinding.PushNotificationAppFragmentBinding - class PushNotificationAppFragment : Fragment(R.layout.push_notification_fragment) { lateinit var binding: PushNotificationAppFragmentBinding val packageName: String? diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt index cae63c36..cda9ac09 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -@file:Suppress("DEPRECATION") +@file:Suppress("WARNINGS") package org.microg.gms.ui @@ -69,7 +69,6 @@ class PushNotificationAppPreferencesFragment : PreferenceFragmentCompat() { } } - private fun showUnregisterConfirm(unregisterConfirmDesc: Int) { val pm = requireContext().packageManager val applicationInfo = pm.getApplicationInfoIfExists(packageName) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt index 39093757..26fcf5d6 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -@file:Suppress("DEPRECATION") +@file:Suppress("WARNINGS") package org.microg.gms.ui diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java b/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java index 4a75a4d2..3fdcd1ba 100644 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java @@ -80,7 +80,6 @@ public class DetectedActivity extends AutoSafeParcelable { private DetectedActivity() { } - /** * Constructs a DetectedActivity. * diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java index 3c014f94..97c8f469 100644 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java @@ -98,7 +98,6 @@ public class GeofencingEvent { return geofenceTransition; } - /** * Returns a list of geofences that triggered this geofence transition alert. * diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java index 4269b429..0482da89 100644 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java @@ -44,7 +44,6 @@ public class LocationSettingsResult extends AutoSafeParcelable implements Result @SafeParceled(2) private LocationSettingsStates settings; - /** * Retrieves the location settings states. */ diff --git a/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderClient.java b/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderClient.java index a391c720..7e873684 100644 --- a/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderClient.java +++ b/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderClient.java @@ -37,6 +37,4 @@ public class FusedLocationProviderClient extends GoogleApi getLastLocation() { return scheduleTask((InstantGoogleApiCall) LocationClientImpl::getLastLocation); } - - } diff --git a/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java index df10c6a8..145174ee 100644 --- a/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java +++ b/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java @@ -32,7 +32,6 @@ import com.google.android.gms.location.LocationServices; import org.microg.gms.common.GmsConnector; -@SuppressWarnings("deprecation") public class FusedLocationProviderApiImpl implements FusedLocationProviderApi { private static final String TAG = "GmsFusedApiImpl"; diff --git a/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java b/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java index b2464774..b563ab29 100644 --- a/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java +++ b/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java @@ -46,7 +46,6 @@ public class LocationClientImpl extends GoogleLocationManagerClient { private NativeLocationClientImpl nativeLocation = null; private Map listenerMap = new HashMap(); - public LocationClientImpl(Context context, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) { super(context, callbacks, connectionFailedListener); diff --git a/play-services-tasks/src/main/java/com/google/android/gms/tasks/Task.java b/play-services-tasks/src/main/java/com/google/android/gms/tasks/Task.java index f7223779..a02a53f7 100644 --- a/play-services-tasks/src/main/java/com/google/android/gms/tasks/Task.java +++ b/play-services-tasks/src/main/java/com/google/android/gms/tasks/Task.java @@ -135,7 +135,6 @@ public abstract class Task { */ public abstract Task addOnFailureListener(Executor executor, OnFailureListener listener); - /** * Adds a listener that is called if the Task completes successfully. *

@@ -171,7 +170,6 @@ public abstract class Task { */ public abstract Task addOnSuccessListener(Activity activity, OnSuccessListener listener); - /** * Returns a new Task that will be completed with the result of applying the specified * Continuation to this Task. diff --git a/settings.gradle b/settings.gradle index fbb32a77..cc81ff3d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,7 +15,10 @@ include ':play-services-tasks' include ':play-services-core-proto' include ':play-services-conscrypt-provider-core' -include ':play-services-core' +include ':firebase-auth-api' +include ':firebase-dynamic-links-api' + +include ':firebase-auth-core' + include ':play-services-core:microg-ui-tools' - - +include ':play-services-core' \ No newline at end of file