Skip to content

Commit b7a52c8

Browse files
authored
Merge FIS Android SDK into master branch (#1048)
* Add Firebase Segmentation SDK and some skeleton code in Firebase Android SDK (#514) * Add Firebase Segmentation SDK and some skeleton code in Firebase Android SDK * Add Firebase Segmentation SDK and some skeleton code in Firebase Android SDK * Address comments #1 * Address comments #1 * Address comments #2 * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * [Firebase Segmentation] Add custom installation id cache layer and tests for it. (#524) * Add type arguments in StorageTaskManager (#517) * Output artifact list during local publishing. (#515) This effort replaces #494. * Implement Firebase segmentation SDK device local cache * fix functions (#523) * fix functions * update minsdk version * remove idea * Set test type to release only in CI. (#522) * Set test type to release only in CI. This fixes Android Studio issue, where it is impossible to run integration tests in debug mode. Additionally move build type configuration to FirebaseLibraryPlugin to avoid projects.all configuration in gradle. * Add comment back. * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Minor fix to error message to match the admin sdk. (#525) * Minor fix to error message to match the admin sdk. In particular, it *is* allowed to have slashes, etc in field paths. * Added clean task to smoke tests. (#527) This change allows the smoke tests to clean all build variants created by the infrastructure. * Update deps to post-androidx gms versions. (#526) * Update deps to post-androidx gms versions. Additionally configure sources.jar for SDKs. * Update functions-ktx deps * Fix versions. * unbump fiam version in fiamui-app * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Copy firebase-firestore-ktx dependencies on firestore into its own subfolder (#528) * Wrap shared pref commit in a async task. * Address comments * Bump firestore version for release (#530) Additionally fix pom filter to exclude multidex from deps. * Google format fix * Replace some deprecated code. * Fix some deprecations (#533) * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code. * Package refactor * nit * nit * package refactor (#534) * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code. * Package refactor * nit * nit * Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend. CL also contains unit tests. (The http client is not implemented yet.) * minor format fix * Address comments #1 * Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend. (#545) * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code. * Package refactor * nit * nit * Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend. CL also contains unit tests. (The http client is not implemented yet.) * minor format fix * Address comments #1 * Http client in Firebase Segmentation SDK to call backend service. * Revert unintentional change * Fix connected device test * Fix connected device test * 1. Add a few annotations to make java code Kotlin friendly 2. Some fixes for the http request format * Fix java format * Fix API version * Change the segmentation API implementation to synchronous and put the entire synchronous code block in async task. * Fix a async getResult race issue. * OkHttpClient -> HttpsUrlConnection * Use gzip for compressing content and fix ourput stream memory leak risk. * Addressed a few comments * Http client in Firebase Segmentation SDK to call backend service. (#573) * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code. * Package refactor * nit * nit * Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend. CL also contains unit tests. (The http client is not implemented yet.) * minor format fix * Address comments #1 * Http client in Firebase Segmentation SDK to call backend service. * Revert unintentional change * Fix connected device test * Fix connected device test * 1. Add a few annotations to make java code Kotlin friendly 2. Some fixes for the http request format * Fix java format * Fix API version * Change the segmentation API implementation to synchronous and put the entire synchronous code block in async task. * Fix a async getResult race issue. * OkHttpClient -> HttpsUrlConnection * Use gzip for compressing content and fix ourput stream memory leak risk. * Addressed a few comments * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Adding http client to call fis backend service (#659) * Adding Firebase Installations module * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Http client to call FIS backend service. * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Http client to call FIS backend service. * Addresing comments and introducing new FirebaseInstallationService Exception. * FirebaseSegmentation SDK 1. Clean up http client response code. 2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later. * FirebaseSegmentation SDK changes (#673) * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code. * Package refactor * nit * nit * Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend. CL also contains unit tests. (The http client is not implemented yet.) * minor format fix * Address comments #1 * Http client in Firebase Segmentation SDK to call backend service. * Revert unintentional change * Fix connected device test * Fix connected device test * 1. Add a few annotations to make java code Kotlin friendly 2. Some fixes for the http request format * Fix java format * Fix API version * Change the segmentation API implementation to synchronous and put the entire synchronous code block in async task. * Fix a async getResult race issue. * OkHttpClient -> HttpsUrlConnection * Use gzip for compressing content and fix ourput stream memory leak risk. * Addressed a few comments * FirebaseSegmentation SDK 1. Clean up http client response code. 2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later. * Restrict Firebase API key to Android app package name. * Restrict Firebase API key to Android app package name. (#690) * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code. * Package refactor * nit * nit * Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend. CL also contains unit tests. (The http client is not implemented yet.) * minor format fix * Address comments #1 * Http client in Firebase Segmentation SDK to call backend service. * Revert unintentional change * Fix connected device test * Fix connected device test * 1. Add a few annotations to make java code Kotlin friendly 2. Some fixes for the http request format * Fix java format * Fix API version * Change the segmentation API implementation to synchronous and put the entire synchronous code block in async task. * Fix a async getResult race issue. * OkHttpClient -> HttpsUrlConnection * Use gzip for compressing content and fix ourput stream memory leak risk. * Addressed a few comments * FirebaseSegmentation SDK 1. Clean up http client response code. 2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later. * Restrict Firebase API key to Android app package name. * Explicitly add internet permission * Arete floc (#691) * Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code. * Package refactor * nit * nit * Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend. CL also contains unit tests. (The http client is not implemented yet.) * minor format fix * Address comments #1 * Http client in Firebase Segmentation SDK to call backend service. * Revert unintentional change * Fix connected device test * Fix connected device test * 1. Add a few annotations to make java code Kotlin friendly 2. Some fixes for the http request format * Fix java format * Fix API version * Change the segmentation API implementation to synchronous and put the entire synchronous code block in async task. * Fix a async getResult race issue. * OkHttpClient -> HttpsUrlConnection * Use gzip for compressing content and fix ourput stream memory leak risk. * Addressed a few comments * FirebaseSegmentation SDK 1. Clean up http client response code. 2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later. * Restrict Firebase API key to Android app package name. * Explicitly add internet permission * Implementing cache for FIS SDK (#694) * Implementing cache for FIS SDK * Implementing cache for FIS SDK * Addressing Di's comments. * Addressing Di's comments. * Adding Util class for FIrebaseInstallations APIs. (#676) * Adding Firebase Installations module * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Http client to call FIS backend service. * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Http client to call FIS backend service. * Addresing comments and introducing new FirebaseInstallationService Exception. * Implementing getId method in FirebaseInstallation to call backend. * 1. Adding instrumentation tests. 2. Introducing serviceClient level and main class exceptions. * Addressing Di's comments. * Addressing Rayo's comments * Updating parameters order in ServiceClient. * Updating createRandomFid as per Rayo's comments. * getId() implementation with instrumented tests. (#703) * getId() implementation with instrumented tests. * Addressing rayo's comments. - Detailed JavaDocs - Renaming FiidCache as PersistedFid * Addressing rayo's comments. - Detailed JavaDocs - Renaming FiidCache as PersistedFid * Addresing comments to resoleve the following: - Make registerAnsSaveFid non blocking call in getId() - PersistedFidEntry builder with default values * Addressing Ciaran and Rayo's comments. * Addressing Ciaran's comments * Addressing Ciaran's comments * Adding param comments and checking if registration status is valid. * Correcting lint warning: uses-permission should be declared before application in AndroidManifest.xml * Adding custom assertThat with more readable assertions * Correcting instrumented tests to be reliable. * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Adding http client to call fis backend service (#659) * Adding Firebase Installations module * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Http client to call FIS backend service. * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Http client to call FIS backend service. * Addresing comments and introducing new FirebaseInstallationService Exception. * Implementing cache for FIS SDK (#694) * Implementing cache for FIS SDK * Implementing cache for FIS SDK * Addressing Di's comments. * Addressing Di's comments. * Adding Util class for FIrebaseInstallations APIs. (#676) * Adding Firebase Installations module * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Http client to call FIS backend service. * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Http client to call FIS backend service. * Http client to call FIS backend service. * Initial Code structure for FIS Android SDK (#648) * Adding an interface library for Firebase Installations SDK * Adding Firebase Installations module * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Adding Firebase Installations module. * Readding .idea files that were deleted in previous commit * Revert "Adding Firebase Installations module" This reverts commit 2ec4aef. * Revert "Readding .idea files that were deleted in previous commit" This reverts commit 7b4ebcf. * Add firebase installations project path * Fixing formattinf issues. * Revert "Adding Firebase Installations module" with hidden files This reverts commit 2ec4aef. * Addressing review comments. * Making InstallationTokenResult an AutoValue class. * Http client to call FIS backend service. * Addresing comments and introducing new FirebaseInstallationService Exception. * Implementing getId method in FirebaseInstallation to call backend. * 1. Adding instrumentation tests. 2. Introducing serviceClient level and main class exceptions. * Addressing Di's comments. * Addressing Rayo's comments * Updating parameters order in ServiceClient. * Updating createRandomFid as per Rayo's comments. * getId() implementation with instrumented tests. (#703) * getId() implementation with instrumented tests. * Addressing rayo's comments. - Detailed JavaDocs - Renaming FiidCache as PersistedFid * Addressing rayo's comments. - Detailed JavaDocs - Renaming FiidCache as PersistedFid * Addresing comments to resoleve the following: - Make registerAnsSaveFid non blocking call in getId() - PersistedFidEntry builder with default values * Addressing Ciaran and Rayo's comments. * Addressing Ciaran's comments * Addressing Ciaran's comments * Adding param comments and checking if registration status is valid. * Correcting lint warning: uses-permission should be declared before application in AndroidManifest.xml * Adding custom assertThat with more readable assertions * Correcting instrumented tests to be reliable. * Updating api.txt to resolve api-information presubmit check. * Adding api.txt for fisbase-installations-interop * Updating subprojects.cfg * FIS getAuthToken implementation. (#769) * FIS getAuthToken implementation. * FIS getAuthToken implementation. * 1. Addressing Ciaran's comments 2. Renaming InstallationTokenResult TokenExpirationTimestampMillis field to TokenExpirationInSecs * 1. Addressing Ciaran's comments 2. Renaming InstallationTokenResult TokenExpirationTimestampMillis field to TokenExpirationInSecs * Updated IntDef usage in firebase-installations * Using CountDownLatch to await instead of executor.awaitTermination * Addressing Di's comments. * Addressing Di's comments. * Addressing Ciaran's comments to replace latch with a custom listener. * Adding onSuccess to AwaitListener. * Cleaning up the code as per the ciaran's comments. * Addressing Di's comments. * 1. Handling multiple calls to getAUthToken() 2. Minor code changes as per the offline discussion with Rayo * Fixing api-information presubmit check. * updating api.txt for firbase-installations-interop * Addressing Ciaran's comments. * Fixing check-changed - GoogleJavaFormat error. * Addressing ciaran`s comments * nit fixes to executor : use unblocking queue. * FID delete() implementation. (#813) * FID delete() implementation. * Addressing ciaran's comments. * Refractoring the code to be inline. * Adding headers for Chemist to check API key restriction. (#821) * Enabling FIS network call timeout. (#827) * Enabling FIS network call timeout. * Addressing Di's comments * Simplifying FirebaseInstallations class by adding listeners. (#847) * Simplifying FirebaseInstallations class by adding listeners. * Addressing ciaran's comments to return same token if multiple getAuthToken() calls are triggered simultaneously. * Cleaning doRegistration method. * Fixing FISClient to correctly parse expiration timestamp. (#848) * Updating getAuthToken to return creation timestamp (#884) * Propagating the exceptions to the clients. (#856) * Merging changes into fis_sdk (#910) * Fixing FISClient to correctly parse expiration timestamp. (#848) * Updating getAuthToken to return creation timestamp (#884) * Propagating the exceptions to the clients. (#856) * Extract FID from FIS createInstallation response (#888) * Addressing Rayo's comment: Rename PersistedFidEntry to (#899) * Implementing retry once for FIS Client. (#895) * Simplifying FirebaseInstallations class by adding listeners. (#847) * Fixing FISClient to correctly parse expiration timestamp. (#848) * Updating getAuthToken to return creation timestamp (#884) * Propagating the exceptions to the clients. (#856) * FIS error handling (#911) 1. Mark PersistedInstallationEntry status UNREGISTERED incase of 500 errors 2. Store detailed 4xx server exceptions in the local storage. In the succeeding getId calls,return these exceptions to the clients * Reuse existing Iid as Fid (#924) * Add FisError to the persisted installation entry. (#931) * touch file (#993) 1 line change on comment * getAuthToken error handling for 401 & 404 response code (#961) * getAuthToken error handling for 401 & 404 response code: - Clear the local storage & throw an exception to call getId() resulting in recreation of fid * Renaming getAuthToken to getToken. (#1026) * Add heartbeat to fis sdk (#1037) * add tests * update api * installations * Fixes for multi-process access (#1042) * Switch from using SharedPreferences to a flat file * Fixes for multi-process access - switch from shared prefs to a flat file - protect generate Fid for cross-process and cross-thread accesses - make doRegistration only read the prefs once at the beginning and clean up the flow - pass the forceRefresh flag into doRegistration rather than storing it in a global * revert the name of the FID prefs write call * fix formatting issues * Fix the cross process locking The check if a new FID was needed was not in the critical region. * some small changes from the review * fix the java format and update the api file * Remove FirebaseSegmentation from fis_sdk branch. (was added by mistake) * Add separator line back * Update api info for FIS SDK
1 parent 6c72014 commit b7a52c8

36 files changed

+3703
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Signature format: 2.0
2+
package com.google.firebase.installations {
3+
4+
public abstract class InstallationTokenResult {
5+
ctor public InstallationTokenResult();
6+
method @NonNull public static com.google.firebase.installations.InstallationTokenResult.Builder builder();
7+
method @NonNull public abstract String getToken();
8+
method @NonNull public abstract long getTokenCreationTimestamp();
9+
method @NonNull public abstract long getTokenExpirationTimestamp();
10+
method @NonNull public abstract com.google.firebase.installations.InstallationTokenResult.Builder toBuilder();
11+
}
12+
13+
public abstract static class InstallationTokenResult.Builder {
14+
ctor public InstallationTokenResult.Builder();
15+
method @NonNull public abstract com.google.firebase.installations.InstallationTokenResult build();
16+
method @NonNull public abstract com.google.firebase.installations.InstallationTokenResult.Builder setToken(@NonNull String);
17+
method @NonNull public abstract com.google.firebase.installations.InstallationTokenResult.Builder setTokenCreationTimestamp(long);
18+
method @NonNull public abstract com.google.firebase.installations.InstallationTokenResult.Builder setTokenExpirationTimestamp(long);
19+
}
20+
21+
}
22+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
16+
plugins {
17+
id 'firebase-library'
18+
}
19+
20+
firebaseLibrary.publishJavadoc = false
21+
22+
android {
23+
compileSdkVersion project.targetSdkVersion
24+
defaultConfig {
25+
minSdkVersion project.minSdkVersion
26+
targetSdkVersion project.targetSdkVersion
27+
versionName version
28+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
29+
}
30+
compileOptions {
31+
sourceCompatibility JavaVersion.VERSION_1_8
32+
targetCompatibility JavaVersion.VERSION_1_8
33+
}
34+
testOptions {
35+
unitTests {
36+
includeAndroidResources = true
37+
}
38+
}
39+
}
40+
41+
dependencies {
42+
implementation 'com.google.android.gms:play-services-tasks:17.0.0'
43+
44+
compileOnly "com.google.auto.value:auto-value-annotations:1.6.5"
45+
annotationProcessor "com.google.auto.value:auto-value:1.6.2"
46+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version=17.1.1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2019 Google LLC -->
3+
<!-- -->
4+
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
5+
<!-- you may not use this file except in compliance with the License. -->
6+
<!-- You may obtain a copy of the License at -->
7+
<!-- -->
8+
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
9+
<!-- -->
10+
<!-- Unless required by applicable law or agreed to in writing, software -->
11+
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
12+
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
13+
<!-- See the License for the specific language governing permissions and -->
14+
<!-- limitations under the License. -->
15+
16+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
17+
package="com.google.firebase.installations.interop" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.installations;
16+
17+
import static java.lang.annotation.RetentionPolicy.SOURCE;
18+
19+
import androidx.annotation.IntDef;
20+
import com.google.android.gms.tasks.Task;
21+
import java.lang.annotation.Retention;
22+
23+
/**
24+
* This is an interface of {@code FirebaseInstallations} that is only exposed to 2p via component
25+
* injection.
26+
*
27+
* @hide
28+
*/
29+
public interface FirebaseInstallationsApi {
30+
31+
/** Specifies the options to get a FIS AuthToken. */
32+
@IntDef({DO_NOT_FORCE_REFRESH, FORCE_REFRESH})
33+
@Retention(SOURCE)
34+
@interface AuthTokenOption {}
35+
/**
36+
* AuthToken is not refreshed until requested by the developer or if one doesn't exist, is expired
37+
* or about to expire.
38+
*/
39+
int DO_NOT_FORCE_REFRESH = 0;
40+
/**
41+
* AuthToken is forcefully refreshed on calling the {@link
42+
* FirebaseInstallationsApi#getToken(int)}.
43+
*/
44+
int FORCE_REFRESH = 1;
45+
46+
/**
47+
* Async function that returns a globally unique identifier of this Firebase app installation.
48+
* This is a url-safe base64 string of a 128-bit integer.
49+
*/
50+
Task<String> getId();
51+
52+
/** Async function that returns a auth token(public key) of this Firebase app installation. */
53+
Task<InstallationTokenResult> getToken(@AuthTokenOption int authTokenOption);
54+
55+
/**
56+
* Async function that deletes this Firebase app installation from Firebase backend. This call
57+
* would possibly lead Firebase Notification, Firebase RemoteConfig, Firebase Predictions or
58+
* Firebase In-App Messaging not function properly.
59+
*/
60+
Task<Void> delete();
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.installations;
16+
17+
import androidx.annotation.NonNull;
18+
import com.google.auto.value.AutoValue;
19+
20+
/** This class represents a set of values describing a FIS Auth Token Result. */
21+
@AutoValue
22+
public abstract class InstallationTokenResult {
23+
24+
/** A new FIS Auth-Token, created for this Firebase Installation. */
25+
@NonNull
26+
public abstract String getToken();
27+
/**
28+
* The amount of time, in seconds, before the auth-token expires for this Firebase Installation.
29+
*/
30+
@NonNull
31+
public abstract long getTokenExpirationTimestamp();
32+
33+
/**
34+
* The amount of time, in seconds, when the auth-token was created for this Firebase Installation.
35+
*/
36+
@NonNull
37+
public abstract long getTokenCreationTimestamp();
38+
39+
@NonNull
40+
public abstract Builder toBuilder();
41+
42+
/** Returns a default Builder object to create an InstallationResponse object */
43+
@NonNull
44+
public static InstallationTokenResult.Builder builder() {
45+
return new AutoValue_InstallationTokenResult.Builder();
46+
}
47+
48+
@AutoValue.Builder
49+
public abstract static class Builder {
50+
@NonNull
51+
public abstract Builder setToken(@NonNull String value);
52+
53+
@NonNull
54+
public abstract Builder setTokenExpirationTimestamp(long value);
55+
56+
@NonNull
57+
public abstract Builder setTokenCreationTimestamp(long value);
58+
59+
@NonNull
60+
public abstract InstallationTokenResult build();
61+
}
62+
}

firebase-installations/api.txt

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
// Signature format: 2.0
2+
package com.google.firebase.installations {
3+
4+
public class FirebaseInstallations implements com.google.firebase.installations.FirebaseInstallationsApi {
5+
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> delete();
6+
method @NonNull public com.google.android.gms.tasks.Task<java.lang.String> getId();
7+
method @NonNull public static com.google.firebase.installations.FirebaseInstallations getInstance();
8+
method @NonNull public static com.google.firebase.installations.FirebaseInstallations getInstance(@NonNull com.google.firebase.FirebaseApp);
9+
method @NonNull public com.google.android.gms.tasks.Task<com.google.firebase.installations.InstallationTokenResult> getToken(@com.google.firebase.installations.FirebaseInstallationsApi.AuthTokenOption int);
10+
}
11+
12+
public class FirebaseInstallationsException extends com.google.firebase.FirebaseException {
13+
ctor public FirebaseInstallationsException(@NonNull com.google.firebase.installations.FirebaseInstallationsException.Status);
14+
ctor public FirebaseInstallationsException(@NonNull String, @NonNull com.google.firebase.installations.FirebaseInstallationsException.Status);
15+
ctor public FirebaseInstallationsException(@NonNull String, @NonNull com.google.firebase.installations.FirebaseInstallationsException.Status, @NonNull Throwable);
16+
method @NonNull public com.google.firebase.installations.FirebaseInstallationsException.Status getStatus();
17+
}
18+
19+
public enum FirebaseInstallationsException.Status {
20+
enum_constant public static final com.google.firebase.installations.FirebaseInstallationsException.Status BAD_CONFIG;
21+
}
22+
23+
public class RandomFidGenerator {
24+
ctor public RandomFidGenerator();
25+
method @NonNull public String createRandomFid();
26+
}
27+
28+
}
29+
30+
package com.google.firebase.installations.local {
31+
32+
public class IidStore {
33+
ctor public IidStore();
34+
method @Nullable public String readIid();
35+
}
36+
37+
public class PersistedInstallation {
38+
ctor public PersistedInstallation(@NonNull com.google.firebase.FirebaseApp);
39+
method public void clearForTesting();
40+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry insertOrUpdatePersistedInstallationEntry(@NonNull com.google.firebase.installations.local.PersistedInstallationEntry);
41+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry readPersistedInstallationEntryValue();
42+
}
43+
44+
public enum PersistedInstallation.RegistrationStatus {
45+
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus ATTEMPT_MIGRATION;
46+
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus NOT_GENERATED;
47+
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus REGISTERED;
48+
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus REGISTER_ERROR;
49+
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus UNREGISTERED;
50+
}
51+
52+
public abstract class PersistedInstallationEntry {
53+
ctor public PersistedInstallationEntry();
54+
method @NonNull public static com.google.firebase.installations.local.PersistedInstallationEntry.Builder builder();
55+
method @Nullable public abstract String getAuthToken();
56+
method public abstract long getExpiresInSecs();
57+
method @Nullable public abstract String getFirebaseInstallationId();
58+
method @Nullable public abstract String getFisError();
59+
method @Nullable public abstract String getRefreshToken();
60+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus getRegistrationStatus();
61+
method public abstract long getTokenCreationEpochInSecs();
62+
method public boolean isErrored();
63+
method public boolean isNotGenerated();
64+
method public boolean isRegistered();
65+
method public boolean isUnregistered();
66+
method public boolean shouldAttemptMigration();
67+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder toBuilder();
68+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withAuthToken(@NonNull String, long, long);
69+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withClearedAuthToken();
70+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withFisError(@NonNull String);
71+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withNoGeneratedFid();
72+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withRegisteredFid(@NonNull String, @NonNull String, long, @Nullable String, long);
73+
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withUnregisteredFid(@NonNull String);
74+
field @NonNull public static com.google.firebase.installations.local.PersistedInstallationEntry INSTANCE;
75+
}
76+
77+
public abstract static class PersistedInstallationEntry.Builder {
78+
ctor public PersistedInstallationEntry.Builder();
79+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry build();
80+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder setAuthToken(@Nullable String);
81+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder setExpiresInSecs(long);
82+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder setFirebaseInstallationId(@NonNull String);
83+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder setFisError(@Nullable String);
84+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder setRefreshToken(@Nullable String);
85+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder setRegistrationStatus(@NonNull com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus);
86+
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder setTokenCreationEpochInSecs(long);
87+
}
88+
89+
}
90+
91+
package com.google.firebase.installations.remote {
92+
93+
public class FirebaseInstallationServiceClient {
94+
ctor public FirebaseInstallationServiceClient(@NonNull android.content.Context, @Nullable com.google.firebase.platforminfo.UserAgentPublisher, @Nullable com.google.firebase.heartbeatinfo.HeartBeatInfo);
95+
method @NonNull public com.google.firebase.installations.remote.InstallationResponse createFirebaseInstallation(@NonNull String, @NonNull String, @NonNull String, @NonNull String) throws java.io.IOException;
96+
method @NonNull public void deleteFirebaseInstallation(@NonNull String, @NonNull String, @NonNull String, @NonNull String) throws com.google.firebase.FirebaseException, java.io.IOException;
97+
method @NonNull public com.google.firebase.installations.remote.TokenResult generateAuthToken(@NonNull String, @NonNull String, @NonNull String, @NonNull String) throws java.io.IOException;
98+
}
99+
100+
public abstract class InstallationResponse {
101+
ctor public InstallationResponse();
102+
method @NonNull public static com.google.firebase.installations.remote.InstallationResponse.Builder builder();
103+
method @Nullable public abstract com.google.firebase.installations.remote.TokenResult getAuthToken();
104+
method @Nullable public abstract String getFid();
105+
method @Nullable public abstract String getRefreshToken();
106+
method @Nullable public abstract com.google.firebase.installations.remote.InstallationResponse.ResponseCode getResponseCode();
107+
method @Nullable public abstract String getUri();
108+
method @NonNull public abstract com.google.firebase.installations.remote.InstallationResponse.Builder toBuilder();
109+
}
110+
111+
public abstract static class InstallationResponse.Builder {
112+
ctor public InstallationResponse.Builder();
113+
method @NonNull public abstract com.google.firebase.installations.remote.InstallationResponse build();
114+
method @NonNull public abstract com.google.firebase.installations.remote.InstallationResponse.Builder setAuthToken(@NonNull com.google.firebase.installations.remote.TokenResult);
115+
method @NonNull public abstract com.google.firebase.installations.remote.InstallationResponse.Builder setFid(@NonNull String);
116+
method @NonNull public abstract com.google.firebase.installations.remote.InstallationResponse.Builder setRefreshToken(@NonNull String);
117+
method @NonNull public abstract com.google.firebase.installations.remote.InstallationResponse.Builder setResponseCode(@NonNull com.google.firebase.installations.remote.InstallationResponse.ResponseCode);
118+
method @NonNull public abstract com.google.firebase.installations.remote.InstallationResponse.Builder setUri(@NonNull String);
119+
}
120+
121+
public enum InstallationResponse.ResponseCode {
122+
enum_constant public static final com.google.firebase.installations.remote.InstallationResponse.ResponseCode BAD_CONFIG;
123+
enum_constant public static final com.google.firebase.installations.remote.InstallationResponse.ResponseCode OK;
124+
}
125+
126+
public abstract class TokenResult {
127+
ctor public TokenResult();
128+
method @NonNull public static com.google.firebase.installations.remote.TokenResult.Builder builder();
129+
method @Nullable public abstract com.google.firebase.installations.remote.TokenResult.ResponseCode getResponseCode();
130+
method @Nullable public abstract String getToken();
131+
method @NonNull public abstract long getTokenExpirationTimestamp();
132+
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder toBuilder();
133+
}
134+
135+
public abstract static class TokenResult.Builder {
136+
ctor public TokenResult.Builder();
137+
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult build();
138+
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder setResponseCode(@NonNull com.google.firebase.installations.remote.TokenResult.ResponseCode);
139+
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder setToken(@NonNull String);
140+
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder setTokenExpirationTimestamp(long);
141+
}
142+
143+
public enum TokenResult.ResponseCode {
144+
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode AUTH_ERROR;
145+
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode BAD_CONFIG;
146+
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode OK;
147+
}
148+
149+
}
150+

0 commit comments

Comments
 (0)