Skip to content
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

Merge Firebase Sessions into main line #5108

Merged
merged 73 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
402c686
Initial commit for Firebase Sessions SDK (#4713)
mrober Feb 23, 2023
e12458f
Implement SessionInitiator and hook it up to lifecycle events (#4723)
mrober Feb 28, 2023
6e5072d
Merge branch 'master' into firebase-sessions
mrober Feb 28, 2023
0358ae9
Use kotlin.time.Duration instead of Long for time intervals (#4733)
mrober Mar 3, 2023
14fc4a8
Add SessionGenerator to generate the Session ID (#4747)
samedson Mar 7, 2023
47dcc85
Merge branch 'master' into firebase-sessions
mrober Mar 8, 2023
667a902
Add SessionEvent data class (#4763)
mrober Mar 13, 2023
174d542
Merge branch 'master' into firebase-sessions
mrober Mar 13, 2023
1d6ab9d
Merge branch 'master' into firebase-sessions
mrober Mar 13, 2023
d14dabe
Add Firebase Sessions Test App (#4775)
mrober Mar 14, 2023
2cdfd4e
Merge branch 'master' into firebase-sessions
mrober Mar 14, 2023
8acde15
Add JSON encoder for SessionEvents (#4778)
mrober Mar 14, 2023
0ea9884
Use the private setter pattern on SessionGenerator.currentSession (#4…
mrober Mar 16, 2023
5e2a760
Merge branch 'master' into firebase-sessions
mrober Mar 16, 2023
ac3d738
Integrate with FirebaseInstallations. (#4796)
visumickey Mar 17, 2023
09d35f6
Populate firebaseInstallationId field in session (#4801)
mrober Mar 21, 2023
c8e6b4c
Package session start event's application information. (#4829)
visumickey Mar 31, 2023
a0b86ce
Merge branch 'master' into firebase-sessions
mrober Apr 3, 2023
f1c51b5
Merge branch 'master' into firebase-sessions
mrober Apr 4, 2023
69de793
Fix workflows for Firebase Sessions (#4841)
mrober Apr 5, 2023
9300b74
Setup configuration layer for the library. (#4853)
visumickey Apr 5, 2023
e7050b3
Fix Firebase Sessions test app temporarily (#4858)
samedson Apr 5, 2023
3dc6211
Merge branch 'master' into firebase-sessions
mrober Apr 6, 2023
889d2ac
Add GDT to Firebase Sessions (#4851)
samedson Apr 6, 2023
0d7f778
Add README files (#4857)
mrober Apr 6, 2023
993f497
Add google-services.json file to unit tests (#4868)
mrober Apr 6, 2023
f7fff6b
Setup sessions e2e workflow (#4859)
mrober Apr 6, 2023
48aed7f
Implement local manifest override configs (#4877)
visumickey Apr 10, 2023
188f623
Merge branch 'master' into firebase-sessions
mrober Apr 11, 2023
229d597
Fix encoding for Session Events (#4870)
samedson Apr 11, 2023
cd8cdec
Use test app for Sessions e2e test (#4881)
mrober Apr 11, 2023
60e35e3
Merge branch 'master' into firebase-sessions
mrober Apr 12, 2023
78f303c
Merge branch 'master' into firebase-sessions
mrober Apr 12, 2023
32f5d93
Move currentTimeUs into WallClock (#4890)
samedson Apr 13, 2023
7ca2763
Populate sampling rate in session event (#4891)
mrober Apr 14, 2023
1abd88d
Merge branch 'master' into firebase-sessions
mrober Apr 14, 2023
5f592d2
Add TimeProvider interface to abstract away the clock (#4905)
mrober Apr 19, 2023
c290eca
Merge branch 'master' into firebase-sessions
mrober Apr 19, 2023
b0bea40
Fill in device_model field for AQS (#4892)
samedson Apr 20, 2023
6cd629e
Implement sampling (#4896)
mrober Apr 20, 2023
33f6660
Add Sessions to benchmark config (#4914)
mrober Apr 20, 2023
5402c30
Introduce remote config cache for storing configs fetched remotely. (…
visumickey Apr 20, 2023
c63bc13
Make logging consistent with Apple SDK (#4919)
samedson Apr 21, 2023
d4a30e1
Pass a CoroutineContext, not CoroutineDispatcher, to SessionCoordinat…
mrober Apr 28, 2023
c3b0dcc
Implement remote config fetcher to fetch and cache configs. (#4967)
visumickey May 5, 2023
6c066f3
Add os_version, app_build_version, device_manufacturer for Sessions #…
samedson May 8, 2023
b9d413d
Add App information for config fetching. (#4992)
visumickey May 9, 2023
e06b5ce
Update the header params for network request. (#4995)
visumickey May 11, 2023
c61d5c5
Merge branch 'master' into firebase-sessions
mrober May 12, 2023
97675ee
Add thread safe FirebaseSessionsDependencies (#4983)
mrober May 12, 2023
259fa0c
Add register api to FirebaseSessions so products can integrate (#4989)
mrober May 16, 2023
51175b5
Merge branch 'master' into firebase-sessions
mrober May 16, 2023
d4b6e1c
Merge branch 'master' into firebase-sessions
mrober May 23, 2023
4303a9f
Add Sessions to Crashlytics (#4993)
mrober May 23, 2023
b615ecc
Fix gradle command in README
mrober May 25, 2023
f79e5c4
Use firebase-encoders-processor instead of manually building encoder …
mrober May 25, 2023
62e9e4b
Fix behaviour with multiple subscribers (#5031)
mrober May 25, 2023
29cf590
Integrate Firebase Performance with Firebase Sessions. (#5020)
visumickey May 26, 2023
baa3d13
Clean up how we launch suspend functions (#5028)
mrober Jun 1, 2023
283f024
Add and populate appQualitySessionId in Crashlytics reports (#5045)
mrober Jun 2, 2023
cc302d9
Merge branch 'master' into firebase-sessions
mrober Jun 7, 2023
ef89334
Pin firebase-datatransport version (#5070)
mrober Jun 8, 2023
c210c81
Use AQS provided sessionId for Fireperf events. (#5060)
visumickey Jun 12, 2023
e34dcf2
Merge branch 'master' into firebase-sessions
mrober Jun 15, 2023
0da1dd2
Fix firebase-crashlytics-ktx instrumented tests (#5068)
mrober Jun 16, 2023
70d86f4
Add check if Sessions is disabled (#5061)
mrober Jun 20, 2023
bb4a41a
Merge branch 'master' into firebase-sessions
mrober Jun 20, 2023
5d56114
Add fid to Crashlytics report (#5052)
mrober Jun 20, 2023
2394d7b
Handle IOExceptions when fetching remote settings (#5092)
mrober Jun 21, 2023
5191689
Make remote settings fetch non-blocking (#5095)
mrober Jun 22, 2023
2f30231
Ensure the settings cache has loaded from disk before reading any val…
mrober Jun 26, 2023
6eb5bbe
Fetch remote settings on session, not on launch (#5107)
mrober Jun 26, 2023
b5cc0d2
Merge branch 'master' into firebase-sessions
mrober Jun 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ jobs:
distribution: temurin
cache: gradle

- name: Add google-services.json
env:
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }}
run: |
echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json

- name: ${{ matrix.module }} Unit Tests
env:
FIREBASE_CI: 1
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ buildscript {
classpath 'com.google.gms:google-services:4.3.15'
classpath "com.ncorti.ktfmt.gradle:plugin:0.11.0"
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5'
}
}

Expand Down
1 change: 1 addition & 0 deletions ci/fireci/fireciplugins/macrobenchmark/run/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def _process_changed_modules(path: Path) -> List[str]:
":firebase-messaging-directboot": ["fire-fcm"],
":firebase-ml-modeldownloader": ["firebase-ml-modeldownloader"],
":firebase-perf": ["fire-perf"],
":firebase-sessions": ["fire-sessions"],
":firebase-storage": ["fire-gcs"],
":transport": ["fire-transport"],
}
Expand Down
1 change: 1 addition & 0 deletions firebase-crashlytics/firebase-crashlytics.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ dependencies {
runtimeOnly 'com.google.firebase:firebase-installations:17.1.3'
implementation 'com.google.firebase:firebase-measurement-connector:18.0.2'
implementation "com.google.android.gms:play-services-tasks:18.0.1"
implementation project(':firebase-sessions')

javadocClasspath 'com.google.code.findbugs:jsr305:3.0.2'

Expand Down
78 changes: 31 additions & 47 deletions firebase-crashlytics/ktx/ktx.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,60 +13,44 @@
// limitations under the License.

plugins {
id 'firebase-library'
id 'kotlin-android'
id "firebase-library"
id "kotlin-android"
}

firebaseLibrary {
libraryGroup "crashlytics"
testLab.enabled = true
publishJavadoc = true
publishSources = true
libraryGroup "crashlytics"
testLab.enabled = true
publishJavadoc = true
publishSources = true
}

android {
compileSdkVersion project.targetSdkVersion
defaultConfig {
minSdkVersion 16
multiDexEnabled true
targetSdkVersion project.targetSdkVersion
versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java {
srcDir 'src/test/kotlin'
}
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}
testOptions.unitTests.includeAndroidResources = true
compileSdk 33
defaultConfig {
minSdk 16
multiDexEnabled true
targetSdk 33
versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
testOptions.unitTests.includeAndroidResources = true
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

implementation 'com.google.firebase:firebase-common:20.3.1'
implementation 'com.google.firebase:firebase-components:17.1.0'
implementation 'com.google.firebase:firebase-common-ktx:20.3.1'
implementation project(':firebase-crashlytics')
implementation 'androidx.annotation:annotation:1.1.0'

testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation 'junit:junit:4.12'
testImplementation "com.google.truth:truth:$googleTruthVersion"
testImplementation 'org.mockito:mockito-core:2.25.0'

androidTestImplementation 'junit:junit:4.12'
androidTestImplementation "com.google.truth:truth:$googleTruthVersion"
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:core:1.2.0'
implementation "com.google.firebase:firebase-common-ktx:20.3.2"
implementation "com.google.firebase:firebase-common:20.3.2"
implementation "com.google.firebase:firebase-components:17.1.0"
implementation(libs.androidx.annotation)
implementation project(":firebase-crashlytics")

androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.truth)
}

// ==========================================================================
// Copy from here down if you want to use the google-services plugin in your
// androidTest integration tests.
// ==========================================================================
ext.packageName = "com.google.firebase.crashlytics.ktx"
apply from: '../../gradle/googleServices.gradle'

30 changes: 22 additions & 8 deletions firebase-crashlytics/ktx/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
<!--
~ Copyright 2023 Google LLC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.firebase.crashlytics.ktx">
<!--Although the *SdkVersion is captured in gradle build files, this is required for non gradle builds-->
<!--<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />-->
<uses-permission android:name="android.permission.INTERNET"/>
package="com.google.firebase.crashlytics.ktx"
android:versionCode="1"
android:versionName="1.0.0">

<application>
<uses-library android:name="android.test.runner" />

</application>

<instrumentation
android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.google.firebase.crashlytics.ktx" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,38 @@

package com.google.firebase.crashlytics.ktx

import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.google.firebase.FirebaseApp
import com.google.firebase.FirebaseOptions
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.firebase.ktx.Firebase
import com.google.firebase.ktx.app
import com.google.firebase.ktx.initialize
import com.google.firebase.platforminfo.UserAgentPublisher
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class CrashlyticsTests {
companion object {
lateinit var app: FirebaseApp

@BeforeClass
@JvmStatic
fun setup() {
app = Firebase.initialize(InstrumentationRegistry.getContext())!!
}
@Before
fun setUp() {
Firebase.initialize(
ApplicationProvider.getApplicationContext(),
FirebaseOptions.Builder()
.setApplicationId(APP_ID)
.setApiKey(API_KEY)
.setProjectId(PROJECT_ID)
.build()
)
}

@AfterClass
@JvmStatic
fun cleanup() {
app.delete()
}
@After
fun cleanUp() {
FirebaseApp.clearInstancesForTest()
}

@Test
Expand All @@ -52,32 +54,14 @@ class CrashlyticsTests {
}

@Test
fun testDataCall() {
assertThat("hola").isEqualTo("hola")
fun libraryRegistrationAtRuntime() {
val publisher = Firebase.app.get(UserAgentPublisher::class.java)
assertThat(publisher.userAgent).contains(FirebaseCrashlyticsKtxRegistrar.LIBRARY_NAME)
}
}

@RunWith(AndroidJUnit4::class)
class LibraryVersionTest {
companion object {
lateinit var app: FirebaseApp

@BeforeClass
@JvmStatic
fun setup() {
app = Firebase.initialize(InstrumentationRegistry.getContext())!!
}

@AfterClass
@JvmStatic
fun cleanup() {
app.delete()
}
}

@Test
fun libraryRegistrationAtRuntime() {
val publisher = Firebase.app.get(UserAgentPublisher::class.java)
assertThat(publisher.userAgent).contains(LIBRARY_NAME)
private const val APP_ID = "1:1:android:1a"
private const val API_KEY = "API-KEY-API-KEY-API-KEY-API-KEY-API-KEY"
private const val PROJECT_ID = "PROJECT-ID"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ fun FirebaseCrashlytics.setCustomKeys(init: KeyValueBuilder.() -> Unit) {
builder.init()
}

internal const val LIBRARY_NAME: String = "fire-cls-ktx"

/** @suppress */
@Keep
class FirebaseCrashlyticsKtxRegistrar : ComponentRegistrar {
internal class FirebaseCrashlyticsKtxRegistrar : ComponentRegistrar {
override fun getComponents(): List<Component<*>> =
listOf(LibraryVersionComponent.create(LIBRARY_NAME, BuildConfig.VERSION_NAME))

companion object {
internal const val LIBRARY_NAME: String = "fire-cls-ktx"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public CrashlyticsCore build() {
new DisabledBreadcrumbSource(),
new UnavailableAnalyticsEventLogger(),
fileStore,
crashHandlerExecutor);
crashHandlerExecutor,
mock(CrashlyticsAppQualitySessionsSubscriber.class));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ CrashlyticsCore build(Context context) {
breadcrumbSource,
new UnavailableAnalyticsEventLogger(),
new FileStore(context),
new SameThreadExecutorService());
new SameThreadExecutorService(),
mock(CrashlyticsAppQualitySessionsSubscriber.class));
return crashlyticsCore;
}
}
Expand Down
Loading