Skip to content

Commit 42f2715

Browse files
authored
Merge branch 'main' into rl.deps.2
2 parents 0f3baa5 + ecd5392 commit 42f2715

File tree

14 files changed

+50
-85
lines changed

14 files changed

+50
-85
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ internal constructor(
5151
/**
5252
* Instantiates a new [GenerativeModel] given the provided parameters.
5353
*
54-
* @param modelName The name of the model to use, for example `"gemini-2.0-flash-exp"`.
54+
* @param modelName The name of the model to use. See the documentation for a list of
55+
* [supported models](https://firebase.google.com/docs/ai-logic/models).
5556
* @param generationConfig The configuration parameters to use for content generation.
5657
* @param safetySettings The safety bounds the model will abide to during content generation.
5758
* @param tools A list of [Tool]s the model may use to generate content.
@@ -106,7 +107,8 @@ internal constructor(
106107
/**
107108
* Instantiates a new [LiveGenerationConfig] given the provided parameters.
108109
*
109-
* @param modelName The name of the model to use, for example `"gemini-2.0-flash-exp"`.
110+
* @param modelName The name of the model to use. See the documentation for a list of
111+
* [supported models](https://firebase.google.com/docs/ai-logic/models).
110112
* @param generationConfig The configuration parameters to use for content generation.
111113
* @param tools A list of [Tool]s the model may use to generate content.
112114
* @param systemInstruction [Content] instructions that direct the model to behave a certain way.
@@ -157,7 +159,8 @@ internal constructor(
157159
/**
158160
* Instantiates a new [ImagenModel] given the provided parameters.
159161
*
160-
* @param modelName The name of the model to use, for example `"imagen-3.0-generate-001"`.
162+
* @param modelName The name of the model to use. See the documentation for a list of
163+
* [supported models](https://firebase.google.com/docs/ai-logic/models).
161164
* @param generationConfig The configuration parameters to use for image generation.
162165
* @param safetySettings The safety bounds the model will abide by during image generation.
163166
* @param requestOptions Configuration options for sending requests to the backend.

firebase-ai/src/main/kotlin/com/google/firebase/ai/ImagenModel.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ import com.google.firebase.auth.internal.InternalAuthProvider
4141
/**
4242
* Represents a generative model (like Imagen), capable of generating images based on various input
4343
* types.
44+
*
45+
* See the documentation for a list of
46+
* [supported models](https://firebase.google.com/docs/ai-logic/models).
4447
*/
4548
@PublicPreviewAPI
4649
public class ImagenModel

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Candidate.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ internal constructor(
7676
*
7777
* @property category The category of harm being assessed (e.g., Hate speech).
7878
* @property probability The likelihood of the content causing harm.
79-
* @property probabilityScore A numerical score representing the probability of harm, between 0 and
80-
* 1.
79+
* @property probabilityScore A numerical score representing the probability of harm, between `0`
80+
* and `1`.
8181
* @property blocked Indicates whether the content was blocked due to safety concerns.
8282
* @property severity The severity of the potential harm.
8383
* @property severityScore A numerical score representing the severity of harm.

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ import kotlinx.serialization.Serializable
2222
* The model's response to a count tokens request.
2323
*
2424
* **Important:** The counters in this class do not include billable image, video or other non-text
25-
* input. See [Vertex AI pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) for
26-
* details.
25+
* input. See [Pricing](https://firebase.google.com/docs/ai-logic/pricing) for details.
2726
*
2827
* @property totalTokens The total number of tokens in the input given to the model as a prompt.
2928
* @property totalBillableCharacters The total number of billable characters in the text input given
3029
* to the model as a prompt. **Important:** this property does not include billable image, video or
31-
* other non-text input. See
32-
* [Vertex AI pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) for details.
30+
* other non-text input. See [Pricing](https://firebase.google.com/docs/ai-logic/pricing) for
31+
* details.
3332
* @property promptTokensDetails The breakdown, by modality, of how many tokens are consumed by the
3433
* prompt.
3534
*/

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Part.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ internal constructor(
132132
*
133133
* @param inlineData the binary data as a [ByteArray]
134134
* @param mimeType an IANA standard MIME type. For supported values, see the
135-
* [Vertex AI documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/send-multimodal-prompts#media_requirements)
135+
* [Firebase documentation](https://firebase.google.com/docs/vertex-ai/input-file-requirements).
136136
*/
137137
public class InlineDataPart
138138
internal constructor(

firebase-common/src/main/java/com/google/firebase/datastorage/JavaDataStorage.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
package com.google.firebase.datastorage
1818

1919
import android.content.Context
20+
import android.os.Process
21+
import android.util.Log
2022
import androidx.datastore.core.DataStore
23+
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
2124
import androidx.datastore.preferences.SharedPreferencesMigration
2225
import androidx.datastore.preferences.core.MutablePreferences
2326
import androidx.datastore.preferences.core.Preferences
2427
import androidx.datastore.preferences.core.edit
28+
import androidx.datastore.preferences.core.emptyPreferences
2529
import androidx.datastore.preferences.preferencesDataStore
2630
import com.google.firebase.annotations.concurrent.Background
2731
import kotlinx.coroutines.flow.firstOrNull
@@ -60,7 +64,16 @@ class JavaDataStorage(val context: Context, val name: String) {
6064
private val Context.dataStore: DataStore<Preferences> by
6165
preferencesDataStore(
6266
name = name,
63-
produceMigrations = { listOf(SharedPreferencesMigration(it, name)) }
67+
produceMigrations = { listOf(SharedPreferencesMigration(it, name)) },
68+
corruptionHandler =
69+
ReplaceFileCorruptionHandler { ex ->
70+
Log.w(
71+
JavaDataStorage::class.simpleName,
72+
"CorruptionException in ${name} DataStore running in process ${Process.myPid()}",
73+
ex
74+
)
75+
emptyPreferences()
76+
}
6477
)
6578

6679
private val dataStore = context.dataStore

firebase-crashlytics-ndk/CHANGELOG.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Unreleased
2-
2+
* [changed] Updated `firebase-crashlytics` dependency to 20.0.1
33

44
# 20.0.0
55
* [changed] **Breaking Change**: Updated minSdkVersion to API level 23 or higher.
@@ -243,12 +243,12 @@ change. The following release notes describe changes in the new SDK.
243243
<li>If you're using [crashlytics] for NDK crash reporting in your app for
244244
the first time, follow the
245245
<a href="/docs/crashlytics/get-started-new-sdk?platform=android">getting
246-
started instructions</a>.
246+
started instructions</a>.
247247
</li>
248248
<li>If you're upgrading from the legacy Fabric SDK to the
249249
[firebase_crashlytics] SDK for NDK crash reporting, follow the
250250
<a href="/docs/crashlytics/upgrade-sdk?platform=android">upgrade
251-
instructions</a> to update your app with the following SDK changes.
251+
instructions</a> to update your app with the following SDK changes.
252252
</li>
253253
</ul>
254254
</aside>
@@ -259,4 +259,3 @@ change. The following release notes describe changes in the new SDK.
259259
uploading symbol files to [crashlytics] servers. See the
260260
[[crashlytics] Gradle plugin documentation](/docs/crashlytics/ndk-reports-new-sdk)
261261
for more information.
262-

firebase-crashlytics/CHANGELOG.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Unreleased
2-
2+
** [changed] Updated `firebase-sessions` dependency to v3.0.1
33

44
# 20.0.0
55
* [changed] **Breaking Change**: Removed deprecated public constructor `KeyValueBuilder(crashlytics: FirebaseCrashlytics)`
@@ -683,12 +683,12 @@ The following release notes describe changes in the new SDK.
683683
<li>If you're using [crashlytics] for NDK crash reporting in your app for
684684
the first time, follow the
685685
<a href="/docs/crashlytics/get-started-new-sdk?platform=android">getting
686-
started instructions</a>.
686+
started instructions</a>.
687687
</li>
688688
<li>If you're upgrading from the legacy Fabric SDK to the
689689
[firebase_crashlytics] SDK, follow the
690690
<a href="/docs/crashlytics/upgrade-sdk?platform=android">upgrade
691-
instructions</a> to update your app with the following SDK changes.
691+
instructions</a> to update your app with the following SDK changes.
692692
</li>
693693
</ul>
694694
</aside>
@@ -702,4 +702,3 @@ The following release notes describe changes in the new SDK.
702702
from your `AndroidManifest.xml` file.
703703
* [removed] The `fabric.properties` and `crashlytics.properties` files are no
704704
longer supported. Remove them from your app.
705-

firebase-perf/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Unreleased
22
* [fixed] Fixed an ANR on app launch. [#4831]
3-
* [fixed] Fixed app start traces on API 34+. [#5920]
43

54
# 22.0.0
65
* [changed] **Breaking Change**: Updated minSdkVersion to API level 23 or higher.

firebase-perf/src/main/java/com/google/firebase/perf/metrics/AppStartTrace.java

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ public class AppStartTrace implements ActivityLifecycleCallbacks, LifecycleObser
7575
private static final @NonNull Timer PERF_CLASS_LOAD_TIME = new Clock().getTime();
7676
private static final long MAX_LATENCY_BEFORE_UI_INIT = TimeUnit.MINUTES.toMicros(1);
7777

78-
private static final long MAX_BACKGROUND_RUNNABLE_DELAY = TimeUnit.MILLISECONDS.toMicros(100);
79-
8078
// Core pool size 0 allows threads to shut down if they're idle
8179
private static final int CORE_POOL_SIZE = 0;
8280
private static final int MAX_POOL_SIZE = 1; // Only need single thread
@@ -113,8 +111,6 @@ public class AppStartTrace implements ActivityLifecycleCallbacks, LifecycleObser
113111
private final @Nullable Timer processStartTime;
114112
private final @Nullable Timer firebaseClassLoadTime;
115113
private Timer onCreateTime = null;
116-
117-
private Timer mainThreadRunnableTime = null;
118114
private Timer onStartTime = null;
119115
private Timer onResumeTime = null;
120116
private Timer firstForegroundTime = null;
@@ -323,26 +319,8 @@ private void recordOnDrawFrontOfQueue() {
323319
logExperimentTrace(this.experimentTtid);
324320
}
325321

326-
private void resolveIsStartedFromBackground() {
327-
// If the mainThreadRunnableTime is null, either the runnable hasn't run, or this check has
328-
// already been made.
329-
if (mainThreadRunnableTime == null) {
330-
return;
331-
}
332-
333-
// Set it to true if the runnable ran more than 100ms prior to onActivityCreated()
334-
if (mainThreadRunnableTime.getDurationMicros() > MAX_BACKGROUND_RUNNABLE_DELAY) {
335-
isStartedFromBackground = true;
336-
}
337-
338-
// Set this to null to prevent additional checks if `onActivityCreated()` is called again.
339-
mainThreadRunnableTime = null;
340-
}
341-
342322
@Override
343323
public synchronized void onActivityCreated(Activity activity, Bundle savedInstanceState) {
344-
resolveIsStartedFromBackground();
345-
346324
if (isStartedFromBackground || onCreateTime != null // An activity already called onCreate()
347325
) {
348326
return;
@@ -582,7 +560,8 @@ public static boolean isScreenOn(Context appContext) {
582560
* We use StartFromBackgroundRunnable to detect if app is started from background or foreground.
583561
* If app is started from background, we do not generate AppStart trace. This runnable is posted
584562
* to main UI thread from FirebasePerfEarly. If app is started from background, this runnable will
585-
* be executed earlier than 100ms of any activity's onCreate() method.
563+
* be executed before any activity's onCreate() method. If app is started from foreground,
564+
* activity's onCreate() method is executed before this runnable.
586565
*/
587566
public static class StartFromBackgroundRunnable implements Runnable {
588567
private final AppStartTrace trace;
@@ -593,7 +572,10 @@ public StartFromBackgroundRunnable(final AppStartTrace trace) {
593572

594573
@Override
595574
public void run() {
596-
trace.mainThreadRunnableTime = new Timer();
575+
// if no activity has ever been created.
576+
if (trace.onCreateTime == null) {
577+
trace.isStartedFromBackground = true;
578+
}
597579
}
598580
}
599581

@@ -632,7 +614,7 @@ Timer getOnResumeTime() {
632614
}
633615

634616
@VisibleForTesting
635-
void setMainThreadRunnableTime(Timer timer) {
636-
mainThreadRunnableTime = timer;
617+
void setIsStartFromBackground() {
618+
isStartedFromBackground = true;
637619
}
638620
}

0 commit comments

Comments
 (0)