Skip to content

Fixes for multi-process access #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 10, 2019
Merged

Fixes for multi-process access #1042

merged 8 commits into from
Dec 10, 2019

Conversation

fredquintana
Copy link
Contributor

 - 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
 - changed Utils to use Calendar in order to make testing expired auth tokens easier.
   Also introduced a FakeCalendar whose time can be easily manipulated.
 - added some withXXX calls to the PersistentInstallationsEntry object to make
   it easy to change an entry to a desired state
 - refined the instrumentation tests a bit
   - made it more explicit how the backend is being mocked
   - no longer create a custom FirebaseInstallations object per test
   - no longer mock Utils, so that all the tests use the actual Utils.authTokenExpired()
     implementation

 - 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
@google-oss-bot
Copy link
Contributor

The public api surface has changed for the subproject firebase-installations:
error: Added method com.google.firebase.installations.local.PersistedInstallation.insertOrUpdatePersistedInstallationEntry(com.google.firebase.installations.local.PersistedInstallationEntry) [AddedMethod]
error: Removed method com.google.firebase.installations.local.PersistedInstallation.writePreferencesToDisk(com.google.firebase.installations.local.PersistedInstallationEntry) [RemovedMethod]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

@fredquintana fredquintana requested a review from ciarand December 9, 2019 21:20
private long timeInMillis;

public FakeCalendar() {
timeInMillis = 5000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

epochInMillis?

Maybe consider passing the fake current time in via the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the start time as a constructor param.

I think "timeInMillis" is more accurate, or timeSinceEpochInMillis.

public enum Status {
SDK_INTERNAL_ERROR,
OK,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a OK? since this is the exception status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, removed


// Snapshot the temp file to the actual file
if (!tmpFile.renameTo(dataFile)) {
throw new IOException("unable to rename the tmpfile to " + SETTINGS_FILE_NAME);
Copy link
Contributor

@diwu-arete diwu-arete Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : SETTINGS_FILE_NAME -> dataFile.getFileName() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -100,16 +98,15 @@ public void testUpdateAndReadPersistedInstallationEntry_successful() throws Exce
assertThat(entryValue).hasCreationTimestamp(TEST_CREATION_TIMESTAMP_1);

// Update Persisted Fid Entry with Registered status in Shared Prefs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shared prefs -> local persist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


/**
* A layer that locally persists a few Firebase Installation attributes on top the Firebase
* Installation API.
*/
public class PersistedInstallation {
private final File dataFile;
@NonNull private final FirebaseApp firebaseApp;

// Registration Status of each persisted fid entry
// NOTE: never change the ordinal of the enum values because the enum values are stored in shared
// prefs as their ordinal numbers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shared prefs -> local file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@diwu-arete diwu-arete self-requested a review December 9, 2019 23:46
@google-oss-bot
Copy link
Contributor

The public api surface has changed for the subproject firebase-installations:
error: Removed enum constant com.google.firebase.installations.FirebaseInstallationsException.Status.OK [RemovedField]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

@diwu-arete diwu-arete merged commit 56d72ee into fis_sdk Dec 10, 2019
@diwu-arete diwu-arete deleted the mp branch December 10, 2019 01:26
diwu-arete added a commit that referenced this pull request Dec 10, 2019
* 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
fredquintana added a commit that referenced this pull request Jan 6, 2020
* 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

* changed the instrumentation tests into unit tests (#1053)

* changed the instrumentation tests into unit tests

unit tests are easier and faster to run and debug
the unit tests are also included in the code coverage tests

* remove the FirebaseInstallations instrumentation tests

These have been moved into unit tests and so are no longer needed.
Also removed constants that are no longer referenced.

* fix a format error

* fixed a leak when cross process locking didn't close a file

An intermediate RandomAccessFile created while acquiring the lock
was not closed.

Also pulled the cross process locking logic out into a separate class.

Co-authored-by: Di Wu <[email protected]>
Co-authored-by: Ankita <[email protected]>
Co-authored-by: ChaoqunCHEN <[email protected]>
Co-authored-by: Vinay Guthal <[email protected]>
andirayo pushed a commit that referenced this pull request Jan 8, 2020
* 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

* changed the instrumentation tests into unit tests (#1053)

* changed the instrumentation tests into unit tests

unit tests are easier and faster to run and debug
the unit tests are also included in the code coverage tests

* remove the FirebaseInstallations instrumentation tests

These have been moved into unit tests and so are no longer needed.
Also removed constants that are no longer referenced.

* fix a format error

* fixed a leak when cross process locking didn't close a file

An intermediate RandomAccessFile created while acquiring the lock
was not closed.

Also pulled the cross process locking logic out into a separate class.

* Reading the iid token from iid shared prefs.

* Adding iidMigrationToken  in the create installation request header. (#1096)

* Addressing Rayo's comments

* Pass the iid token to authenticate Instance-ID migration to FIS.

Co-authored-by: Di Wu <[email protected]>
Co-authored-by: ChaoqunCHEN <[email protected]>
Co-authored-by: Vinay Guthal <[email protected]>
Co-authored-by: Fred Quintana <[email protected]>
@firebase firebase locked and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants