Skip to content

Commit dbd831e

Browse files
authored
Merge branch 'main' into OOS93/root_detection_util
2 parents 763f8c1 + d09782d commit dbd831e

11 files changed

Lines changed: 279 additions & 21 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ vertexai-sdk-test-data/
2424
firebase-appdistribution-gradle/service-credentials.json
2525

2626
# Ignore generated credentials from google-github-actions/auth
27-
gha-creds-*.json
27+
gha-creds-*.json
28+
29+
# Jetski CLI artifacts
30+
.jetskicli/

firebase-common/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- [feature] Added support for reading the `recaptcha_site_key` value from the `google-services.json`
4+
file. (#8216)
35
- [fixed] Resolved a thread deadlock in HeartBeatInfoStorage when using Jetpack DataStore background executors.(#8182)
46

57
# 22.0.1

firebase-common/api.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ package com.google.firebase {
3939
method public String? getDatabaseUrl();
4040
method public String? getGcmSenderId();
4141
method public String? getProjectId();
42+
method public String? getRecaptchaSiteKey();
4243
method public String? getStorageBucket();
4344
}
4445

@@ -51,6 +52,7 @@ package com.google.firebase {
5152
method public com.google.firebase.FirebaseOptions.Builder setDatabaseUrl(String?);
5253
method public com.google.firebase.FirebaseOptions.Builder setGcmSenderId(String?);
5354
method public com.google.firebase.FirebaseOptions.Builder setProjectId(String?);
55+
method public com.google.firebase.FirebaseOptions.Builder setRecaptchaSiteKey(String?);
5456
method public com.google.firebase.FirebaseOptions.Builder setStorageBucket(String?);
5557
}
5658

firebase-common/firebase-common.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ android {
5050
targetSdk = targetSdkVersion
5151
unitTests { isIncludeAndroidResources = true }
5252
}
53-
lint { targetSdk = targetSdkVersion }
53+
lint {
54+
targetSdk = targetSdkVersion
55+
baseline = file("lint-baseline.xml")
56+
}
5457
}
5558

5659
kotlin { compilerOptions { jvmTarget = JvmTarget.JVM_1_8 } }

firebase-common/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=22.0.2
1+
version=22.1.0
22
latestReleasedVersion=22.0.1
33
android.enableUnitTestBinaryResources=true

firebase-common/lint-baseline.xml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 8.6.1" type="baseline" client="gradle" dependencies="false" name="AGP (8.6.1)" variant="all" version="8.6.1">
3+
4+
<issue
5+
id="UnusedAttribute"
6+
message="Attribute `directBootAware` is only used in API level 24 and higher (current min is 23)"
7+
errorLine1=" android:directBootAware=&quot;true&quot;"
8+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
9+
<location
10+
file="src/main/AndroidManifest.xml"
11+
line="25"
12+
column="13"/>
13+
</issue>
14+
15+
<issue
16+
id="DiscouragedApi"
17+
message="Use of `scheduleAtFixedRate` is strongly discouraged because it can lead to unexpected behavior when Android processes become cached (tasks may unexpectedly execute hundreds or thousands of times in quick succession when a process changes from cached to uncached); prefer using `scheduleWithFixedDelay`"
18+
errorLine1=" scheduler.scheduleAtFixedRate("
19+
errorLine2=" ^">
20+
<location
21+
file="src/main/java/com/google/firebase/concurrent/DelegatingScheduledExecutorService.java"
22+
line="151"
23+
column="13"/>
24+
</issue>
25+
26+
<issue
27+
id="UnclosedTrace"
28+
message="The `beginSection()` call is not always closed with a matching `endSection()` because the code in between may return early"
29+
errorLine1=" Trace.beginSection(name);"
30+
errorLine2=" ~~~~~~~~~~~~">
31+
<location
32+
file="src/main/java/com/google/firebase/tracing/FirebaseTrace.java"
33+
line="27"
34+
column="13"/>
35+
</issue>
36+
37+
<issue
38+
id="ObsoleteSdkInt"
39+
message="Unnecessary; SDK_INT is always >= 23"
40+
errorLine1=" if (Build.VERSION.SDK_INT >= 23) {"
41+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
42+
<location
43+
file="src/main/java/com/google/firebase/concurrent/ExecutorsRegistrar.java"
44+
line="114"
45+
column="9"/>
46+
</issue>
47+
48+
<issue
49+
id="ObsoleteSdkInt"
50+
message="Unnecessary; SDK_INT is always >= 14"
51+
errorLine1=" @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)"
52+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
53+
<location
54+
file="src/main/java/com/google/firebase/FirebaseApp.java"
55+
line="683"
56+
column="3"/>
57+
</issue>
58+
59+
<issue
60+
id="ObsoleteSdkInt"
61+
message="Unnecessary; SDK_INT is always >= 23"
62+
errorLine1=" if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN"
63+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
64+
<location
65+
file="src/main/java/com/google/firebase/FirebaseCommonRegistrar.java"
66+
line="77"
67+
column="19"/>
68+
</issue>
69+
70+
<issue
71+
id="ObsoleteSdkInt"
72+
message="Unnecessary; SDK_INT is always >= 23"
73+
errorLine1=" if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH"
74+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
75+
<location
76+
file="src/main/java/com/google/firebase/FirebaseCommonRegistrar.java"
77+
line="81"
78+
column="19"/>
79+
</issue>
80+
81+
<issue
82+
id="ObsoleteSdkInt"
83+
message="Unnecessary; SDK_INT is always >= 23"
84+
errorLine1=" if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M"
85+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
86+
<location
87+
file="src/main/java/com/google/firebase/FirebaseCommonRegistrar.java"
88+
line="85"
89+
column="19"/>
90+
</issue>
91+
92+
<issue
93+
id="ObsoleteSdkInt"
94+
message="Unnecessary; SDK_INT is always >= 23"
95+
errorLine1=" if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {"
96+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
97+
<location
98+
file="src/main/java/com/google/firebase/tracing/FirebaseTrace.java"
99+
line="26"
100+
column="9"/>
101+
</issue>
102+
103+
<issue
104+
id="ObsoleteSdkInt"
105+
message="Unnecessary; SDK_INT is always >= 23"
106+
errorLine1=" if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {"
107+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
108+
<location
109+
file="src/main/java/com/google/firebase/tracing/FirebaseTrace.java"
110+
line="32"
111+
column="9"/>
112+
</issue>
113+
114+
</issues>

firebase-common/src/androidTest/java/com/google/firebase/FirebaseOptionsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class FirebaseOptionsTest {
3030
private static final String GA_TRACKING_ID = "UA-123456-2";
3131
private static final String GCM_SENDER_ID = "309678045053";
3232
private static final String STORAGE_BUCKET = "ghconfigtest-644f2";
33+
private static final String RECAPTCHA_SITE_KEY = "6L00000sAAAAAAaaaaaAAaa00000_AAAaAaaAa00";
3334
private static final String GCP_PROJECT_ID = "test-product-id";
3435

3536
private static final FirebaseOptions ALL_VALUES_OPTIONS =
@@ -40,6 +41,7 @@ public class FirebaseOptionsTest {
4041
.setGaTrackingId(GA_TRACKING_ID)
4142
.setGcmSenderId(GCM_SENDER_ID)
4243
.setStorageBucket(STORAGE_BUCKET)
44+
.setRecaptchaSiteKey(RECAPTCHA_SITE_KEY)
4345
.setProjectId(GCP_PROJECT_ID)
4446
.build();
4547

@@ -53,6 +55,7 @@ public void createOptionsWithAllValuesSet() {
5355
.setGaTrackingId(GA_TRACKING_ID)
5456
.setGcmSenderId(GCM_SENDER_ID)
5557
.setStorageBucket(STORAGE_BUCKET)
58+
.setRecaptchaSiteKey(RECAPTCHA_SITE_KEY)
5659
.setProjectId(GCP_PROJECT_ID)
5760
.build();
5861
assertThat(firebaseOptions.getApplicationId()).isEqualTo(GOOGLE_APP_ID);
@@ -61,6 +64,7 @@ public void createOptionsWithAllValuesSet() {
6164
assertThat(firebaseOptions.getGaTrackingId()).isEqualTo(GA_TRACKING_ID);
6265
assertThat(firebaseOptions.getGcmSenderId()).isEqualTo(GCM_SENDER_ID);
6366
assertThat(firebaseOptions.getStorageBucket()).isEqualTo(STORAGE_BUCKET);
67+
assertThat(firebaseOptions.getRecaptchaSiteKey()).isEqualTo(RECAPTCHA_SITE_KEY);
6468
assertThat(firebaseOptions.getProjectId()).isEqualTo(GCP_PROJECT_ID);
6569
}
6670

firebase-common/src/main/java/com/google/firebase/FirebaseOptions.java

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ public final class FirebaseOptions {
3636
private static final String DATABASE_URL_RESOURCE_NAME = "firebase_database_url";
3737
private static final String GA_TRACKING_ID_RESOURCE_NAME = "ga_trackingId";
3838
private static final String GCM_SENDER_ID_RESOURCE_NAME = "gcm_defaultSenderId";
39-
private static final String STORAGE_BUCKET_RESOURCE_NAME = "google_storage_bucket";
4039
private static final String PROJECT_ID_RESOURCE_NAME = "project_id";
40+
private static final String RECAPTCHA_SITE_KEY_RESOURCE_NAME = "recaptcha_site_key";
41+
private static final String STORAGE_BUCKET_RESOURCE_NAME = "google_storage_bucket";
4142

4243
private final String apiKey;
4344
private final String applicationId;
4445
private final String databaseUrl;
4546
private final String gaTrackingId;
4647
private final String gcmSenderId;
4748
private final String storageBucket;
49+
private final String recaptchaSiteKey;
4850
private final String projectId;
4951

5052
/** Builder for constructing FirebaseOptions. */
@@ -55,6 +57,7 @@ public static final class Builder {
5557
private String gaTrackingId;
5658
private String gcmSenderId;
5759
private String storageBucket;
60+
private String recaptchaSiteKey;
5861
private String projectId;
5962

6063
/** Constructs an empty builder. */
@@ -73,6 +76,7 @@ public Builder(@NonNull FirebaseOptions options) {
7376
gaTrackingId = options.gaTrackingId;
7477
gcmSenderId = options.gcmSenderId;
7578
storageBucket = options.storageBucket;
79+
recaptchaSiteKey = options.recaptchaSiteKey;
7680
projectId = options.projectId;
7781
}
7882

@@ -115,6 +119,12 @@ public Builder setStorageBucket(@Nullable String storageBucket) {
115119
return this;
116120
}
117121

122+
@NonNull
123+
public Builder setRecaptchaSiteKey(@Nullable String recaptchaSiteKey) {
124+
this.recaptchaSiteKey = recaptchaSiteKey;
125+
return this;
126+
}
127+
118128
@NonNull
119129
public Builder setProjectId(@Nullable String projectId) {
120130
this.projectId = projectId;
@@ -124,7 +134,14 @@ public Builder setProjectId(@Nullable String projectId) {
124134
@NonNull
125135
public FirebaseOptions build() {
126136
return new FirebaseOptions(
127-
applicationId, apiKey, databaseUrl, gaTrackingId, gcmSenderId, storageBucket, projectId);
137+
applicationId,
138+
apiKey,
139+
databaseUrl,
140+
gaTrackingId,
141+
gcmSenderId,
142+
storageBucket,
143+
recaptchaSiteKey,
144+
projectId);
128145
}
129146
}
130147

@@ -135,6 +152,7 @@ private FirebaseOptions(
135152
@Nullable String gaTrackingId,
136153
@Nullable String gcmSenderId,
137154
@Nullable String storageBucket,
155+
@Nullable String recaptchaSiteKey,
138156
@Nullable String projectId) {
139157
Preconditions.checkState(!isEmptyOrWhitespace(applicationId), "ApplicationId must be set.");
140158
this.applicationId = applicationId;
@@ -143,6 +161,7 @@ private FirebaseOptions(
143161
this.gaTrackingId = gaTrackingId;
144162
this.gcmSenderId = gcmSenderId;
145163
this.storageBucket = storageBucket;
164+
this.recaptchaSiteKey = recaptchaSiteKey;
146165
this.projectId = projectId;
147166
}
148167

@@ -165,6 +184,7 @@ public static FirebaseOptions fromResource(@NonNull Context context) {
165184
reader.getString(GA_TRACKING_ID_RESOURCE_NAME),
166185
reader.getString(GCM_SENDER_ID_RESOURCE_NAME),
167186
reader.getString(STORAGE_BUCKET_RESOURCE_NAME),
187+
reader.getString(RECAPTCHA_SITE_KEY_RESOURCE_NAME),
168188
reader.getString(PROJECT_ID_RESOURCE_NAME));
169189
}
170190

@@ -216,6 +236,12 @@ public String getStorageBucket() {
216236
return storageBucket;
217237
}
218238

239+
/** The Google Cloud Storage bucket name, e.g. abc-xyz-123.storage.firebase.com. */
240+
@Nullable
241+
public String getRecaptchaSiteKey() {
242+
return recaptchaSiteKey;
243+
}
244+
219245
/** The Google Cloud project ID, e.g. my-project-1234 */
220246
@Nullable
221247
public String getProjectId() {
@@ -234,13 +260,21 @@ public boolean equals(Object o) {
234260
&& Objects.equal(gaTrackingId, other.gaTrackingId)
235261
&& Objects.equal(gcmSenderId, other.gcmSenderId)
236262
&& Objects.equal(storageBucket, other.storageBucket)
263+
&& Objects.equal(recaptchaSiteKey, other.recaptchaSiteKey)
237264
&& Objects.equal(projectId, other.projectId);
238265
}
239266

240267
@Override
241268
public int hashCode() {
242269
return Objects.hashCode(
243-
applicationId, apiKey, databaseUrl, gaTrackingId, gcmSenderId, storageBucket, projectId);
270+
applicationId,
271+
apiKey,
272+
databaseUrl,
273+
gaTrackingId,
274+
gcmSenderId,
275+
storageBucket,
276+
recaptchaSiteKey,
277+
projectId);
244278
}
245279

246280
@Override
@@ -251,6 +285,7 @@ public String toString() {
251285
.add("databaseUrl", databaseUrl)
252286
.add("gcmSenderId", gcmSenderId)
253287
.add("storageBucket", storageBucket)
288+
.add("recaptchaSiteKey", recaptchaSiteKey)
254289
.add("projectId", projectId)
255290
.toString();
256291
}

plugins/src/main/java/com/google/firebase/gradle/plugins/BaseFirebaseLibraryPlugin.kt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,23 @@ abstract class BaseFirebaseLibraryPlugin : Plugin<Project> {
178178
}
179179

180180
protected fun getGenerateApiTxt(project: Project, srcDirs: ConfigurableFileCollection) =
181-
project.tasks.register<GenerateApiTxtTask>("generateApiTxtFile") {
182-
sources.from(project.provider { srcDirs })
183-
apiTxtFile.set(project.file("api.txt"))
184-
baselineFile.set(project.file("baseline.txt"))
185-
updateBaseline.set(project.hasProperty("updateBaseline"))
186-
}
181+
project.tasks
182+
.register<GenerateApiTxtTask>("generateApiTxtFile") {
183+
sources.from(project.provider { srcDirs })
184+
apiTxtFile.set(project.file("api.txt"))
185+
baselineFile.set(project.file("baseline.txt"))
186+
updateBaseline.set(project.hasProperty("updateBaseline"))
187+
}
188+
.also { taskProvider ->
189+
if (project.name == "firebase-firestore") {
190+
project.tasks.withType(org.gradle.api.tasks.bundling.Jar::class.java).configureEach {
191+
if (name == "sourceReleaseJar") {
192+
from(project.layout.buildDirectory.dir("agent-docs"))
193+
dependsOn(taskProvider)
194+
}
195+
}
196+
}
197+
}
187198

188199
protected fun getDocStubs(project: Project, srcDirs: ConfigurableFileCollection) =
189200
project.tasks.register<GenerateStubsTask>("docStubs") {

0 commit comments

Comments
 (0)