Skip to content

Commit d8b3976

Browse files
authored
Merge branch 'master' into rl.mcc12
2 parents 89c47e3 + 35e5bd8 commit d8b3976

File tree

50 files changed

+11114
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+11114
-308
lines changed

buildSrc/src/main/java/com/google/firebase/gradle/bomgenerator/BomGeneratorTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public class BomGeneratorTask extends DefaultTask {
5656
"com.google.firebase:firebase-appcheck-debug-testing",
5757
"com.google.firebase:firebase-appcheck-ktx",
5858
"com.google.firebase:firebase-appcheck-playintegrity",
59-
"com.google.firebase:firebase-appcheck-safetynet",
6059
"com.google.firebase:firebase-appcheck",
6160
"com.google.firebase:firebase-auth",
6261
"com.google.firebase:firebase-auth-ktx",
@@ -104,6 +103,7 @@ public class BomGeneratorTask extends DefaultTask {
104103
"firebase-analytics-license",
105104
"firebase-annotations",
106105
"firebase-appcheck-interop",
106+
"firebase-appcheck-safetynet",
107107
"firebase-appdistribution-gradle",
108108
"firebase-appindexing-license",
109109
"firebase-appindexing",

encoders/firebase-encoders-json/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=18.0.1
16-
latestReleasedVersion=18.0.0
15+
version=18.0.2
16+
latestReleasedVersion=18.0.1

firebase-appdistribution-api/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Unreleased
22
* [fixed] Fixed a crash when showing feedback notification on devices running Android 4 and below.
33

4+
5+
# 16.0.0-beta08
6+
* [fixed] Fixed an issue where a crash happened whenever a feedback
7+
notification was shown on devices running Android 4.4 and lower.
8+
9+
10+
## Kotlin
11+
The Kotlin extensions library transitively includes the updated
12+
`firebase-appdistribution-api` library. The Kotlin extensions library has no
13+
additional updates.
14+
415
# 16.0.0-beta07
516
* [feature] Added support for testers to attach JPEG screenshots to their
617
feedback.

firebase-appdistribution-api/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=16.0.0-beta08
16-
latestReleasedVersion=16.0.0-beta07
15+
version=16.0.0-beta09
16+
latestReleasedVersion=16.0.0-beta08

firebase-appdistribution/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Unreleased
22
* [fixed] Fixed a crash when showing feedback notification on devices running Android 4 and below.
33

4+
5+
# 16.0.0-beta08
6+
* [fixed] Fixed an issue where a crash happened whenever a feedback
7+
notification was shown on devices running Android 4.4 and lower.
8+
49
# 16.0.0-beta07
510
* [feature] Added support for testers to attach JPEG screenshots to their
611
feedback.

firebase-appdistribution/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=16.0.0-beta08
16-
latestReleasedVersion=16.0.0-beta07
15+
version=16.0.0-beta09
16+
latestReleasedVersion=16.0.0-beta08

firebase-database/CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
* [unchanged] Updated to accommodate the release of the updated
33
[database] Kotlin extensions library.
44

5+
6+
# 20.2.0
7+
* [unchanged] Updated to accommodate the release of the updated
8+
[database] Kotlin extensions library.
9+
10+
511
## Kotlin
612
* [feature] Added
713
[`Query.values<T>()`](/docs/reference/kotlin/com/google/firebase/database/ktx/package-summary#values)
8-
Kotlin Flows to listen for realtime updates and convert its values to a specific type.
9-
14+
Kotlin Flows to listen for realtime updates and convert its values to a
15+
specific type.
1016
# 20.1.0
1117
* [unchanged] Updated to accommodate the release of the updated
1218
[database] Kotlin extensions library.

firebase-database/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=20.2.0
16-
latestReleasedVersion=20.1.0
15+
version=20.2.1
16+
latestReleasedVersion=20.2.0
1717
android.enableUnitTestBinaryResources=true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=18.1.8
2-
latestReleasedVersion=18.1.7
1+
version=18.1.9
2+
latestReleasedVersion=18.1.8
33
android.enableUnitTestBinaryResources=true
44

firebase-firestore/CHANGELOG.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,34 @@
22
* [fixed] Fixed stack overflow caused by deeply nested server timestamps (#4702).
33
* [feature] Add new cache config APIs to customize SDK's cache setup.
44

5+
6+
# 24.5.0
7+
* [fixed] Fixed stack overflow caused by deeply nested server timestamps.
8+
(GitHub [#4702](//github.com/firebase/firebase-android-sdk/issues/4702){: .external})
9+
10+
511
## Kotlin
612
* [feature] Added
713
[`Query.dataObjects<T>()`](/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary#dataObjects)
814
and
915
[`DocumentReference.dataObjects<T>()`](/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary#dataObjects_1)
10-
Kotlin Flows to listen for realtime updates and convert its values to a specific type.
11-
16+
Kotlin Flows to listen for realtime updates and convert its values to a
17+
specific type.
1218
# 24.4.5
13-
* [feature] Add support for disjunctions in queries (`OR` queries).
19+
* [feature] Added support for disjunctions in queries (`OR` queries).
20+
1421

1522
## Kotlin
1623
The Kotlin extensions library transitively includes the updated
1724
`firebase-firestore` library. The Kotlin extensions library has no additional
1825
updates.
1926

2027
# 24.4.4
21-
* [changed] Relaxed certain query validations performed by the SDK (#4231).
22-
* [changed] Updated grpc to 1.52.1 and javalite, protoc, protobufjavautil to 3.21.11.
28+
* [changed] Relaxed certain query validations performed by the SDK
29+
([GitHub Issue #4231](//github.com/firebase/firebase-android-sdk/issues/4231)).
30+
* [changed] Updated gRPC to 1.52.1, and updated JavaLite, protoc, and
31+
protobuf-java-util to 3.21.11.
32+
2333

2434
## Kotlin
2535
The Kotlin extensions library transitively includes the updated
@@ -374,7 +384,7 @@ updates.
374384
and
375385
[`Query.whereNotEqualTo()`](/docs/reference/android/com/google/firebase/firestore/Query#whereNotEqualTo(java.lang.String,%20java.lang.Object))
376386
query operators.
377-
387+
378388
* `Query.whereNotIn()` finds documents where a specified field's value is
379389
not in a specified array.
380390
* `Query.whereNotEqualTo()` finds documents where a specified field's value
@@ -486,7 +496,7 @@ updates.
486496
is IN a specified array. `Query.whereArrayContainsAny()` finds documents
487497
where a specified field is an array and contains ANY element of a specified
488498
array.
489-
499+
490500
- [changed] Improved the performance of repeatedly executed queries. Recently
491501
executed queries should see dramatic improvements. This benefit is reduced
492502
if changes accumulate while the query is inactive. Queries that use the
@@ -744,7 +754,7 @@ updates.
744754
https://github.com/firebase/firebase-android-sdk/issues/134
745755

746756
# 17.1.4
747-
* [fixed] Fixed a SQLite transaction-handling issue that occasionally masked
757+
* [fixed] Fixed a SQLite transaction-handling issue that occasionally masked
748758
exceptions when Firestore closed a transaction that was never started. For
749759
more information, see the [issue report in GitHub](https://github.com/firebase/firebase-android-sdk/issues/115).
750760
* [fixed] Fixed a race condition that caused a `SQLiteDatabaseLockedException`
@@ -792,3 +802,4 @@ updates.
792802
or
793803
[`FieldValue.serverTimestamp()`](/docs/reference/android/com/google/firebase/firestore/FieldValue.html#serverTimestamp())
794804
values.
805+

firebase-firestore/api.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,34 @@ package com.google.firebase.firestore {
316316
}
317317

318318
public final class MemoryCacheSettings implements com.google.firebase.firestore.LocalCacheSettings {
319+
method @NonNull public com.google.firebase.firestore.MemoryGarbageCollectorSettings getGarbageCollectorSettings();
319320
method @NonNull public static com.google.firebase.firestore.MemoryCacheSettings.Builder newBuilder();
320321
}
321322

322323
public static class MemoryCacheSettings.Builder {
323324
method @NonNull public com.google.firebase.firestore.MemoryCacheSettings build();
325+
method @NonNull public com.google.firebase.firestore.MemoryCacheSettings.Builder setGcSettings(@NonNull com.google.firebase.firestore.MemoryGarbageCollectorSettings);
326+
}
327+
328+
public final class MemoryEagerGcSettings implements com.google.firebase.firestore.MemoryGarbageCollectorSettings {
329+
method @NonNull public static com.google.firebase.firestore.MemoryEagerGcSettings.Builder newBuilder();
330+
}
331+
332+
public static class MemoryEagerGcSettings.Builder {
333+
method @NonNull public com.google.firebase.firestore.MemoryEagerGcSettings build();
334+
}
335+
336+
public interface MemoryGarbageCollectorSettings {
337+
}
338+
339+
public final class MemoryLruGcSettings implements com.google.firebase.firestore.MemoryGarbageCollectorSettings {
340+
method public long getSizeBytes();
341+
method @NonNull public static com.google.firebase.firestore.MemoryLruGcSettings.Builder newBuilder();
342+
}
343+
344+
public static class MemoryLruGcSettings.Builder {
345+
method @NonNull public com.google.firebase.firestore.MemoryLruGcSettings build();
346+
method public void setSizeBytes(long);
324347
}
325348

326349
public enum MetadataChanges {

firebase-firestore/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=24.5.0
2-
latestReleasedVersion=24.4.5
1+
version=24.5.1
2+
latestReleasedVersion=24.5.0

firebase-firestore/ktx/api.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ package com.google.firebase.firestore.ktx {
1212
method public static inline <reified T> T getField(@NonNull com.google.firebase.firestore.DocumentSnapshot, @NonNull com.google.firebase.firestore.FieldPath fieldPath, @NonNull com.google.firebase.firestore.DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior);
1313
method @NonNull public static com.google.firebase.firestore.FirebaseFirestore getFirestore(@NonNull com.google.firebase.ktx.Firebase);
1414
method @NonNull public static com.google.firebase.firestore.MemoryCacheSettings memoryCacheSettings(@NonNull kotlin.jvm.functions.Function1<? super com.google.firebase.firestore.MemoryCacheSettings.Builder,kotlin.Unit> init);
15+
method @NonNull public static com.google.firebase.firestore.MemoryEagerGcSettings memoryEagerGcSettings(@NonNull kotlin.jvm.functions.Function1<? super com.google.firebase.firestore.MemoryEagerGcSettings.Builder,kotlin.Unit> init);
16+
method @NonNull public static com.google.firebase.firestore.MemoryLruGcSettings memoryLruGcSettings(@NonNull kotlin.jvm.functions.Function1<? super com.google.firebase.firestore.MemoryLruGcSettings.Builder,kotlin.Unit> init);
1517
method @NonNull public static com.google.firebase.firestore.PersistentCacheSettings persistentCacheSettings(@NonNull kotlin.jvm.functions.Function1<? super com.google.firebase.firestore.PersistentCacheSettings.Builder,kotlin.Unit> init);
1618
method @NonNull public static kotlinx.coroutines.flow.Flow<com.google.firebase.firestore.DocumentSnapshot> snapshots(@NonNull com.google.firebase.firestore.DocumentReference, @NonNull com.google.firebase.firestore.MetadataChanges metadataChanges = com.google.firebase.firestore.MetadataChanges.EXCLUDE);
1719
method @NonNull public static kotlinx.coroutines.flow.Flow<com.google.firebase.firestore.QuerySnapshot> snapshots(@NonNull com.google.firebase.firestore.Query, @NonNull com.google.firebase.firestore.MetadataChanges metadataChanges = com.google.firebase.firestore.MetadataChanges.EXCLUDE);

firebase-firestore/ktx/src/main/kotlin/com/google/firebase/firestore/ktx/Firestore.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ fun memoryCacheSettings(init: MemoryCacheSettings.Builder.() -> Unit): MemoryCac
182182
return builder.build()
183183
}
184184

185+
fun memoryEagerGcSettings(init: MemoryEagerGcSettings.Builder.() -> Unit): MemoryEagerGcSettings {
186+
val builder = MemoryEagerGcSettings.newBuilder()
187+
builder.init()
188+
return builder.build()
189+
}
190+
191+
fun memoryLruGcSettings(init: MemoryLruGcSettings.Builder.() -> Unit): MemoryLruGcSettings {
192+
val builder = MemoryLruGcSettings.newBuilder()
193+
builder.init()
194+
return builder.build()
195+
}
196+
185197
fun persistentCacheSettings(
186198
init: PersistentCacheSettings.Builder.() -> Unit
187199
): PersistentCacheSettings {

firebase-firestore/ktx/src/test/kotlin/com/google/firebase/firestore/ktx/FirestoreTests.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,34 @@ class FirestoreTests : BaseTestCase() {
124124
assertThat(otherSettings.isSslEnabled).isEqualTo(true)
125125
assertThat(otherSettings.isPersistenceEnabled).isFalse()
126126
}
127+
128+
@Test
129+
fun `MemoryCacheSettings Garbage Collector builder works`() {
130+
val host = "http://10.0.2.2:8080"
131+
val isSslEnabled = false
132+
133+
val settings = firestoreSettings {
134+
this.host = host
135+
this.isSslEnabled = isSslEnabled
136+
this.setLocalCacheSettings(memoryCacheSettings {})
137+
}
138+
139+
assertThat(host).isEqualTo(settings.host)
140+
assertThat(isSslEnabled).isEqualTo(settings.isSslEnabled)
141+
assertThat(settings.isPersistenceEnabled).isFalse()
142+
assertThat(settings.cacheSettings)
143+
.isEqualTo(memoryCacheSettings { setGcSettings(memoryEagerGcSettings {}) })
144+
145+
val otherSettings = firestoreSettings {
146+
this.setLocalCacheSettings(
147+
memoryCacheSettings { setGcSettings(memoryLruGcSettings { setSizeBytes(1_000) }) }
148+
)
149+
}
150+
151+
assertThat(otherSettings.host).isEqualTo(FirebaseFirestoreSettings.DEFAULT_HOST)
152+
assertThat(otherSettings.isPersistenceEnabled).isFalse()
153+
assertThat(otherSettings.cacheSizeBytes).isEqualTo(1_000)
154+
}
127155
}
128156

129157
@RunWith(RobolectricTestRunner::class)

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/FirestoreTest.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,4 +1298,43 @@ public void testNewCacheConfigForPersistentCache() {
12981298
DocumentSnapshot snap = waitFor(instance.document("coll/doc").get(Source.CACHE));
12991299
assertEquals(map("foo", "bar"), snap.getData());
13001300
}
1301+
1302+
@Test
1303+
public void testCanGetDocumentWithMemoryLruGCEnabled() {
1304+
FirebaseFirestore db = testFirestore();
1305+
db.setFirestoreSettings(
1306+
new FirebaseFirestoreSettings.Builder(db.getFirestoreSettings())
1307+
.setLocalCacheSettings(
1308+
MemoryCacheSettings.newBuilder()
1309+
.setGcSettings(MemoryLruGcSettings.newBuilder().build())
1310+
.build())
1311+
.build());
1312+
1313+
DocumentReference doc = db.collection("abc").document("123");
1314+
waitFor(doc.set(map("key", "value")));
1315+
1316+
DocumentSnapshot snapshot = waitFor(doc.get(Source.CACHE));
1317+
assertTrue(snapshot.exists());
1318+
assertTrue(snapshot.getMetadata().isFromCache());
1319+
assertEquals(snapshot.getData(), map("key", "value"));
1320+
}
1321+
1322+
@Test
1323+
public void testCannotGetDocumentWithMemoryEagerGcEnabled() {
1324+
FirebaseFirestore db = testFirestore();
1325+
db.setFirestoreSettings(
1326+
new FirebaseFirestoreSettings.Builder(db.getFirestoreSettings())
1327+
.setLocalCacheSettings(
1328+
MemoryCacheSettings.newBuilder()
1329+
.setGcSettings(MemoryEagerGcSettings.newBuilder().build())
1330+
.build())
1331+
.build());
1332+
1333+
DocumentReference doc = db.collection("abc").document("123");
1334+
waitFor(doc.set(map("key", "value")));
1335+
1336+
Exception e = waitForException(doc.get(Source.CACHE));
1337+
assertTrue(e instanceof FirebaseFirestoreException);
1338+
assertEquals(((FirebaseFirestoreException) e).getCode(), Code.UNAVAILABLE);
1339+
}
13011340
}

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestoreSettings.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static final class Builder {
4040
private String host;
4141
private boolean sslEnabled;
4242
private boolean persistenceEnabled;
43+
4344
private long cacheSizeBytes;
4445
private LocalCacheSettings cacheSettings;
4546

@@ -319,6 +320,12 @@ public long getCacheSizeBytes() {
319320
if (cacheSettings instanceof PersistentCacheSettings) {
320321
return ((PersistentCacheSettings) cacheSettings).getSizeBytes();
321322
} else {
323+
MemoryCacheSettings memorySettings = (MemoryCacheSettings) cacheSettings;
324+
if (memorySettings.getGarbageCollectorSettings() instanceof MemoryLruGcSettings) {
325+
return ((MemoryLruGcSettings) memorySettings.getGarbageCollectorSettings())
326+
.getSizeBytes();
327+
}
328+
322329
return CACHE_SIZE_UNLIMITED;
323330
}
324331
}

0 commit comments

Comments
 (0)