Skip to content

Commit a97dc6e

Browse files
Merge
2 parents a0d8dc4 + 484371e commit a97dc6e

File tree

160 files changed

+1335
-1985
lines changed

Some content is hidden

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

160 files changed

+1335
-1985
lines changed

buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/measurement/apksize/ApkSizeTableBuilder.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class ApkSizeTableBuilder {
2929
throw new IllegalStateException("No sizes added")
3030
}
3131

32-
def table = "|------------------ APK Sizes ------------------|\n"
33-
table += "|-- project --|-- build type --|-- size in bytes --|\n"
32+
def table = "|-------------------- APK Sizes ------------------|\n"
33+
table += "|--- project ---|-- build type --|-- size in bytes --|\n"
3434

3535
table += sdkSizes.collect {
36-
sprintf("|%-19s|%-19s|%-21s|", it.get(0), it.get(1), it.get(2))
36+
sprintf("|%-21s|%-19s|%-21s|", it.get(0), it.get(1), it.get(2))
3737
}.join("\n")
3838

3939
return table

buildSrc/src/test/groovy/com/google/firebase/gradle/plugins/measurement/apksize/ApkSizeTableBuilderTest.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import org.junit.runners.JUnit4
2525
public class ApkSizeTableBuilderTest {
2626

2727
private static final String HEADER =
28-
"|------------------ APK Sizes ------------------|\n" +
29-
"|-- project --|-- build type --|-- size in bytes --|\n"
28+
"|-------------------- APK Sizes ------------------|\n" +
29+
"|--- project ---|-- build type --|-- size in bytes --|\n"
3030

3131
@Test(expected = IllegalStateException.class)
3232
public void toTableString_throwsWhenZeroAdded() {
@@ -37,7 +37,7 @@ public class ApkSizeTableBuilderTest {
3737
@Test
3838
public void toTableString_withOneMeasurement() {
3939
def expected = HEADER +
40-
"|firebase foo |debug |255000 |"
40+
"|firebase foo |debug |255000 |"
4141

4242
def builder = new ApkSizeTableBuilder()
4343
builder.addApkSize("firebase foo", "debug", 255000)
@@ -48,9 +48,9 @@ public class ApkSizeTableBuilderTest {
4848
@Test
4949
public void toTableString_withThreeMeasurements() {
5050
def expected = HEADER +
51-
"|firebase foo |debug |255000 |\n" +
52-
"|google loo |release |4000 |\n" +
53-
"|Appy Snap App |Snappy |781000 |"
51+
"|firebase foo |debug |255000 |\n" +
52+
"|google loo |release |4000 |\n" +
53+
"|Appy Snap App |Snappy |781000 |"
5454

5555
def builder = new ApkSizeTableBuilder()
5656
builder.addApkSize("firebase foo", "debug", 255000)

firebase-abt/firebase-abt.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ plugins {
2020
firebaseLibrary {
2121
testLab.enabled = false
2222
publishSources = true
23-
staticAnalysis.disableKotlinInteropLint()
2423
}
2524

2625
// TODO(issue/568): Remove this once legacy logic is removed from Remote Config.

firebase-common/firebase-common.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ plugins {
1919
firebaseLibrary {
2020
testLab.enabled = true
2121
publishSources = true
22-
staticAnalysis.disableKotlinInteropLint()
2322
}
2423

2524
android {

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import com.google.android.gms.common.internal.Preconditions;
3939
import com.google.android.gms.common.util.PlatformVersion;
4040
import com.google.android.gms.common.util.ProcessUtils;
41-
import com.google.firebase.annotations.PublicApi;
4241
import com.google.firebase.components.Component;
4342
import com.google.firebase.components.ComponentDiscovery;
4443
import com.google.firebase.components.ComponentRegistrar;
@@ -85,12 +84,11 @@
8584
* Use of Firebase in processes other than the main process is not supported and will likely cause
8685
* problems related to resource contention.
8786
*/
88-
@PublicApi
8987
public class FirebaseApp {
9088

9189
private static final String LOG_TAG = "FirebaseApp";
9290

93-
public static final String DEFAULT_APP_NAME = "[DEFAULT]";
91+
public static final @NonNull String DEFAULT_APP_NAME = "[DEFAULT]";
9492

9593
private static final Object LOCK = new Object();
9694

@@ -121,23 +119,20 @@ public class FirebaseApp {
121119

122120
/** Returns the application {@link Context}. */
123121
@NonNull
124-
@PublicApi
125122
public Context getApplicationContext() {
126123
checkNotDeleted();
127124
return applicationContext;
128125
}
129126

130127
/** Returns the unique name of this app. */
131128
@NonNull
132-
@PublicApi
133129
public String getName() {
134130
checkNotDeleted();
135131
return name;
136132
}
137133

138134
/** Returns the specified {@link FirebaseOptions}. */
139135
@NonNull
140-
@PublicApi
141136
public FirebaseOptions getOptions() {
142137
checkNotDeleted();
143138
return options;
@@ -162,8 +157,8 @@ public String toString() {
162157
}
163158

164159
/** Returns a mutable list of all FirebaseApps. */
165-
@PublicApi
166-
public static List<FirebaseApp> getApps(Context context) {
160+
@NonNull
161+
public static List<FirebaseApp> getApps(@NonNull Context context) {
167162
synchronized (LOCK) {
168163
return new ArrayList<>(INSTANCES.values());
169164
}
@@ -175,7 +170,6 @@ public static List<FirebaseApp> getApps(Context context) {
175170
* @throws IllegalStateException if the default app was not initialized.
176171
*/
177172
@NonNull
178-
@PublicApi
179173
public static FirebaseApp getInstance() {
180174
synchronized (LOCK) {
181175
FirebaseApp defaultApp = INSTANCES.get(DEFAULT_APP_NAME);
@@ -199,7 +193,6 @@ public static FirebaseApp getInstance() {
199193
* #initializeApp(Context, FirebaseOptions, String)}.
200194
*/
201195
@NonNull
202-
@PublicApi
203196
public static FirebaseApp getInstance(@NonNull String name) {
204197
synchronized (LOCK) {
205198
FirebaseApp firebaseApp = INSTANCES.get(normalize(name));
@@ -239,7 +232,6 @@ public static FirebaseApp getInstance(@NonNull String name) {
239232
* keys are present in string resources. Returns null otherwise.
240233
*/
241234
@Nullable
242-
@PublicApi
243235
public static FirebaseApp initializeApp(@NonNull Context context) {
244236
synchronized (LOCK) {
245237
if (INSTANCES.containsKey(DEFAULT_APP_NAME)) {
@@ -267,7 +259,6 @@ public static FirebaseApp initializeApp(@NonNull Context context) {
267259
* initialization that way is the expected situation.
268260
*/
269261
@NonNull
270-
@PublicApi
271262
public static FirebaseApp initializeApp(
272263
@NonNull Context context, @NonNull FirebaseOptions options) {
273264
return initializeApp(context, options, DEFAULT_APP_NAME);
@@ -284,7 +275,6 @@ public static FirebaseApp initializeApp(
284275
* @return an instance of {@link FirebaseApp}
285276
*/
286277
@NonNull
287-
@PublicApi
288278
public static FirebaseApp initializeApp(
289279
@NonNull Context context, @NonNull FirebaseOptions options, @NonNull String name) {
290280
GlobalBackgroundStateListener.ensureBackgroundStateListenerRegistered(context);
@@ -319,7 +309,6 @@ public static FirebaseApp initializeApp(
319309
*
320310
* @hide
321311
*/
322-
@PublicApi
323312
public void delete() {
324313
boolean valueChanged = deleted.compareAndSet(false /* expected */, true);
325314
if (!valueChanged) {
@@ -348,7 +337,6 @@ public <T> T get(Class<T> anInterface) {
348337
* If set to true it indicates that Firebase should close database connections automatically when
349338
* the app is in the background. Disabled by default.
350339
*/
351-
@PublicApi
352340
public void setAutomaticResourceManagementEnabled(boolean enabled) {
353341
checkNotDeleted();
354342
boolean updated =

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
package com.google.firebase;
1616

1717
import androidx.annotation.NonNull;
18-
import com.google.firebase.annotations.PublicApi;
1918

2019
/**
2120
* Exception thrown when a request to a Firebase service has failed due to a network error. Inspect
2221
* the device's network connectivity state or retry later to resolve.
2322
*/
24-
@PublicApi
2523
public class FirebaseNetworkException extends FirebaseException {
2624

27-
@PublicApi
2825
public FirebaseNetworkException(@NonNull String detailMessage) {
2926
super(detailMessage);
3027
}

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

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525
import com.google.android.gms.common.internal.Objects;
2626
import com.google.android.gms.common.internal.Preconditions;
2727
import com.google.android.gms.common.internal.StringResourceValueReader;
28-
import com.google.firebase.annotations.PublicApi;
2928

3029
/** Configurable Firebase options. */
31-
@PublicApi
3230
public final class FirebaseOptions {
3331

3432
// TODO: deprecate and remove it once we can fetch these from Remote Config.
@@ -50,7 +48,6 @@ public final class FirebaseOptions {
5048
private final String projectId;
5149

5250
/** Builder for constructing FirebaseOptions. */
53-
@PublicApi
5451
public static final class Builder {
5552
private String apiKey;
5653
private String applicationId;
@@ -61,7 +58,6 @@ public static final class Builder {
6158
private String projectId;
6259

6360
/** Constructs an empty builder. */
64-
@PublicApi
6561
public Builder() {}
6662

6763
/**
@@ -70,8 +66,7 @@ public Builder() {}
7066
* <p>The new builder is not backed by this objects values, that is changes made to the new
7167
* builder don't change the values of the origin object.
7268
*/
73-
@PublicApi
74-
public Builder(FirebaseOptions options) {
69+
public Builder(@NonNull FirebaseOptions options) {
7570
applicationId = options.applicationId;
7671
apiKey = options.apiKey;
7772
databaseUrl = options.databaseUrl;
@@ -81,51 +76,52 @@ public Builder(FirebaseOptions options) {
8176
projectId = options.projectId;
8277
}
8378

84-
@PublicApi
79+
@NonNull
8580
public Builder setApiKey(@NonNull String apiKey) {
8681
this.apiKey = checkNotEmpty(apiKey, "ApiKey must be set.");
8782
return this;
8883
}
8984

90-
@PublicApi
85+
@NonNull
9186
public Builder setApplicationId(@NonNull String applicationId) {
9287
this.applicationId = checkNotEmpty(applicationId, "ApplicationId must be set.");
9388
return this;
9489
}
9590

96-
@PublicApi
91+
@NonNull
9792
public Builder setDatabaseUrl(@Nullable String databaseUrl) {
9893
this.databaseUrl = databaseUrl;
9994
return this;
10095
}
10196

10297
/** @hide */
10398
// TODO: unhide once an API (AppInvite) starts reading it.
99+
@NonNull
104100
@KeepForSdk
105101
public Builder setGaTrackingId(@Nullable String gaTrackingId) {
106102
this.gaTrackingId = gaTrackingId;
107103
return this;
108104
}
109105

110-
@PublicApi
106+
@NonNull
111107
public Builder setGcmSenderId(@Nullable String gcmSenderId) {
112108
this.gcmSenderId = gcmSenderId;
113109
return this;
114110
}
115111

116-
@PublicApi
112+
@NonNull
117113
public Builder setStorageBucket(@Nullable String storageBucket) {
118114
this.storageBucket = storageBucket;
119115
return this;
120116
}
121117

122-
@PublicApi
118+
@NonNull
123119
public Builder setProjectId(@Nullable String projectId) {
124120
this.projectId = projectId;
125121
return this;
126122
}
127123

128-
@PublicApi
124+
@NonNull
129125
public FirebaseOptions build() {
130126
return new FirebaseOptions(
131127
applicationId, apiKey, databaseUrl, gaTrackingId, gcmSenderId, storageBucket, projectId);
@@ -155,8 +151,8 @@ private FirebaseOptions(
155151
*
156152
* @return The populated options or null if applicationId is missing from resources.
157153
*/
158-
@PublicApi
159-
public static FirebaseOptions fromResource(Context context) {
154+
@Nullable
155+
public static FirebaseOptions fromResource(@NonNull Context context) {
160156
StringResourceValueReader reader = new StringResourceValueReader(context);
161157
String applicationId = reader.getString(APP_ID_RESOURCE_NAME);
162158
if (TextUtils.isEmpty(applicationId)) {
@@ -176,19 +172,19 @@ public static FirebaseOptions fromResource(Context context) {
176172
* API key used for authenticating requests from your app, e.g.
177173
* AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk, used to identify your app to Google servers.
178174
*/
179-
@PublicApi
175+
@NonNull
180176
public String getApiKey() {
181177
return apiKey;
182178
}
183179

184180
/** The Google App ID that is used to uniquely identify an instance of an app. */
185-
@PublicApi
181+
@NonNull
186182
public String getApplicationId() {
187183
return applicationId;
188184
}
189185

190186
/** The database root URL, e.g. http://abc-xyz-123.firebaseio.com. */
191-
@PublicApi
187+
@Nullable
192188
public String getDatabaseUrl() {
193189
return databaseUrl;
194190
}
@@ -199,6 +195,7 @@ public String getDatabaseUrl() {
199195
* @hide
200196
*/
201197
// TODO: unhide once an API (AppInvite) starts reading it.
198+
@Nullable
202199
@KeepForSdk
203200
public String getGaTrackingId() {
204201
return gaTrackingId;
@@ -208,19 +205,19 @@ public String getGaTrackingId() {
208205
* The Project Number from the Google Developer's console, for example 012345678901, used to
209206
* configure Google Cloud Messaging.
210207
*/
211-
@PublicApi
208+
@Nullable
212209
public String getGcmSenderId() {
213210
return gcmSenderId;
214211
}
215212

216213
/** The Google Cloud Storage bucket name, e.g. abc-xyz-123.storage.firebase.com. */
217-
@PublicApi
214+
@Nullable
218215
public String getStorageBucket() {
219216
return storageBucket;
220217
}
221218

222219
/** The Google Cloud project ID, e.g. my-project-1234 */
223-
@PublicApi
220+
@Nullable
224221
public String getProjectId() {
225222
return projectId;
226223
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@
1414

1515
package com.google.firebase;
1616

17-
import com.google.firebase.annotations.PublicApi;
17+
import androidx.annotation.NonNull;
1818

1919
/**
2020
* Exception thrown when a request to a Firebase service has been blocked due to having received too
2121
* many consecutive requests from the same device. Retry the request later to resolve.
2222
*/
23-
@PublicApi
2423
public class FirebaseTooManyRequestsException extends FirebaseException {
2524

26-
@PublicApi
27-
public FirebaseTooManyRequestsException(String message) {
25+
public FirebaseTooManyRequestsException(@NonNull String message) {
2826
super(message);
2927
}
3028
}

firebase-common/src/main/java/com/google/firebase/annotations/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
// limitations under the License.
1414

1515
/** @hide */
16-
package com.google.firebase.annotations;
16+
package com.google.firebase.annotations;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/** @hide */
16+
package com.google.firebase.internal;

0 commit comments

Comments
 (0)