/
ConfigFetchHandler.java
599 lines (539 loc) · 23.3 KB
/
ConfigFetchHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
// Copyright 2018 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.
package com.google.firebase.remoteconfig.internal;
import static com.google.firebase.remoteconfig.internal.ConfigMetadataClient.LAST_FETCH_TIME_NO_FETCH_YET;
import static java.net.HttpURLConnection.HTTP_BAD_GATEWAY;
import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
import static java.net.HttpURLConnection.HTTP_GATEWAY_TIMEOUT;
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
import static java.net.HttpURLConnection.HTTP_UNAVAILABLE;
import static java.util.concurrent.TimeUnit.HOURS;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
import android.text.format.DateUtils;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
import com.google.android.gms.common.util.Clock;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.analytics.connector.AnalyticsConnector;
import com.google.firebase.installations.FirebaseInstallationsApi;
import com.google.firebase.installations.InstallationTokenResult;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchThrottledException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException;
import com.google.firebase.remoteconfig.internal.ConfigFetchHandler.FetchResponse.Status;
import com.google.firebase.remoteconfig.internal.ConfigMetadataClient.BackoffMetadata;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.HttpURLConnection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Executor;
/**
* A handler for fetch requests to the Firebase Remote Config backend.
*
* <p>Checks cache and throttling status before sending a request to the backend.
*
* @author Miraziz Yusupov
*/
public class ConfigFetchHandler {
/** The default minimum interval between fetch requests to the Firebase Remote Config server. */
public static final long DEFAULT_MINIMUM_FETCH_INTERVAL_IN_SECONDS = HOURS.toSeconds(12);
/**
* The exponential backoff intervals, up to ~4 hours.
*
* <p>Every value must be even.
*/
@VisibleForTesting
static final int[] BACKOFF_TIME_DURATIONS_IN_MINUTES = {2, 4, 8, 16, 32, 64, 128, 256};
/**
* HTTP status code for a throttled request.
*
* <p>Defined here since {@link HttpURLConnection} does not provide this code.
*/
@VisibleForTesting static final int HTTP_TOO_MANY_REQUESTS = 429;
private final FirebaseInstallationsApi firebaseInstallations;
@Nullable private final AnalyticsConnector analyticsConnector;
private final Executor executor;
private final Clock clock;
private final Random randomGenerator;
private final ConfigCacheClient fetchedConfigsCache;
private final ConfigFetchHttpClient frcBackendApiClient;
private final ConfigMetadataClient frcMetadata;
private final Map<String, String> customHttpHeaders;
/** FRC Fetch Handler constructor. */
public ConfigFetchHandler(
FirebaseInstallationsApi firebaseInstallations,
@Nullable AnalyticsConnector analyticsConnector,
Executor executor,
Clock clock,
Random randomGenerator,
ConfigCacheClient fetchedConfigsCache,
ConfigFetchHttpClient frcBackendApiClient,
ConfigMetadataClient frcMetadata,
Map<String, String> customHttpHeaders) {
this.firebaseInstallations = firebaseInstallations;
this.analyticsConnector = analyticsConnector;
this.executor = executor;
this.clock = clock;
this.randomGenerator = randomGenerator;
this.fetchedConfigsCache = fetchedConfigsCache;
this.frcBackendApiClient = frcBackendApiClient;
this.frcMetadata = frcMetadata;
this.customHttpHeaders = customHttpHeaders;
}
/**
* Calls {@link #fetch(long)} with the {@link
* ConfigMetadataClient#getMinimumFetchIntervalInSeconds()}.
*/
public Task<FetchResponse> fetch() {
return fetch(frcMetadata.getMinimumFetchIntervalInSeconds());
}
/**
* Starts fetching configs from the Firebase Remote Config server.
*
* <p>Guarantees consistency between memory and disk; fetched configs are saved to memory only
* after they have been written to disk.
*
* <p>Fetches even if the read of the fetch cache fails (assumes there are no cached fetched
* configs in that case).
*
* <p>If the fetch request could not be created or there was error connecting to the server, the
* returned Task throws a {@link FirebaseRemoteConfigClientException}.
*
* <p>If the server responds with an error, the returned Task throws a {@link
* FirebaseRemoteConfigServerException}.
*
* <p>If any of the following is true, then the returned Task throws a {@link
* FirebaseRemoteConfigFetchThrottledException}:
*
* <ul>
* <li>The backoff duration from a previous throttled exception has not expired,
* <li>The backend responded with a throttled error, or
* <li>The backend responded with unavailable errors for the last two fetch requests.
* </ul>
*
* @return A {@link Task} representing the fetch call that returns a {@link FetchResponse} with
* the configs fetched from the backend. If the backend was not called or the backend had no
* updates, the {@link FetchResponse}'s configs will be {@code null}.
*/
public Task<FetchResponse> fetch(long minimumFetchIntervalInSeconds) {
long fetchIntervalInSeconds =
frcMetadata.isDeveloperModeEnabled() ? 0L : minimumFetchIntervalInSeconds;
return fetchedConfigsCache
.get()
.continueWithTask(
executor,
(cachedFetchConfigsTask) ->
fetchIfCacheExpiredAndNotThrottled(cachedFetchConfigsTask, fetchIntervalInSeconds));
}
/**
* Fetches from the backend if the fetched configs cache has expired and the client is not
* currently throttled.
*
* <p>If a fetch request is made to the backend, updates the last fetch status, last successful
* fetch time and {@link BackoffMetadata} in {@link ConfigMetadataClient}.
*/
private Task<FetchResponse> fetchIfCacheExpiredAndNotThrottled(
Task<ConfigContainer> cachedFetchConfigsTask, long minimumFetchIntervalInSeconds) {
Date currentTime = new Date(clock.currentTimeMillis());
if (cachedFetchConfigsTask.isSuccessful()
&& areCachedFetchConfigsValid(minimumFetchIntervalInSeconds, currentTime)) {
// Keep the cached fetch values if the cache has not expired yet.
return Tasks.forResult(FetchResponse.forLocalStorageUsed(currentTime));
}
Task<FetchResponse> fetchResponseTask;
Date backoffEndTime = getBackoffEndTimeInMillis(currentTime);
if (backoffEndTime != null) {
// TODO(issues/260): Provide a way for users to check for throttled status so exceptions
// aren't the only way for users to determine if they're throttled.
fetchResponseTask =
Tasks.forException(
new FirebaseRemoteConfigFetchThrottledException(
createThrottledMessage(backoffEndTime.getTime() - currentTime.getTime()),
backoffEndTime.getTime()));
} else {
Task<String> installationIdTask = firebaseInstallations.getId();
Task<InstallationTokenResult> installationAuthTokenTask =
firebaseInstallations.getToken(false);
fetchResponseTask =
Tasks.whenAllComplete(installationIdTask, installationAuthTokenTask)
.continueWithTask(
executor,
(completedInstallationsTasks) -> {
if (!installationIdTask.isSuccessful()) {
return Tasks.forException(
new FirebaseRemoteConfigClientException(
"Firebase Installations failed to get installation ID for fetch.",
installationIdTask.getException()));
}
if (!installationAuthTokenTask.isSuccessful()) {
return Tasks.forException(
new FirebaseRemoteConfigClientException(
"Firebase Installations failed to get installation auth token for fetch.",
installationAuthTokenTask.getException()));
}
String installationId = installationIdTask.getResult();
String installationToken = installationAuthTokenTask.getResult().getToken();
return fetchFromBackendAndCacheResponse(
installationId, installationToken, currentTime);
});
}
return fetchResponseTask.continueWithTask(
executor,
(completedFetchTask) -> {
updateLastFetchStatusAndTime(completedFetchTask, currentTime);
return completedFetchTask;
});
}
/**
* Returns true if the last successfully fetched configs are not stale, or if developer mode is
* on.
*/
private boolean areCachedFetchConfigsValid(long cacheExpirationInSeconds, Date newFetchTime) {
Date lastSuccessfulFetchTime = frcMetadata.getLastSuccessfulFetchTime();
// RC always fetches if the client has not previously had a successful fetch.
if (lastSuccessfulFetchTime.equals(LAST_FETCH_TIME_NO_FETCH_YET)) {
return false;
}
Date cacheExpirationTime =
new Date(lastSuccessfulFetchTime.getTime() + SECONDS.toMillis(cacheExpirationInSeconds));
return newFetchTime.before(cacheExpirationTime);
}
/**
* Returns the earliest possible time, in millis since epoch, when a fetch request won't be
* throttled by the server, or {@code null} if the client is not currently throttled by the
* server.
*/
@Nullable
private Date getBackoffEndTimeInMillis(Date currentTime) {
Date backoffEndTime = frcMetadata.getBackoffMetadata().getBackoffEndTime();
if (currentTime.before(backoffEndTime)) {
return backoffEndTime;
}
return null;
}
/**
* Returns a human-readable throttled message with how long the client has to wait before fetching
* again.
*/
private String createThrottledMessage(long throttledDurationInMillis) {
return String.format(
"Fetch is throttled. Please wait before calling fetch again: %s",
DateUtils.formatElapsedTime(MILLISECONDS.toSeconds(throttledDurationInMillis)));
}
/**
* Fetches configs from the FRC backend. If there are any updates, writes the configs to the
* {@code fetchedConfigsCache}.
*/
private Task<FetchResponse> fetchFromBackendAndCacheResponse(
String installationId, String installationToken, Date fetchTime) {
try {
FetchResponse fetchResponse = fetchFromBackend(installationId, installationToken, fetchTime);
if (fetchResponse.getStatus() != Status.BACKEND_UPDATES_FETCHED) {
return Tasks.forResult(fetchResponse);
}
return fetchedConfigsCache
.put(fetchResponse.getFetchedConfigs())
.onSuccessTask(executor, (putContainer) -> Tasks.forResult(fetchResponse));
} catch (FirebaseRemoteConfigException frce) {
return Tasks.forException(frce);
}
}
/**
* Creates a fetch request, sends it to the FRC backend and converts the server's response into a
* {@link FetchResponse}.
*
* @return The {@link FetchResponse} from the FRC backend.
* @throws FirebaseRemoteConfigServerException if the server returned an error.
* @throws FirebaseRemoteConfigClientException if the request could not be created or there's an
* error connecting to the server.
*/
@WorkerThread
private FetchResponse fetchFromBackend(
String installationId, String installationToken, Date currentTime)
throws FirebaseRemoteConfigException {
try {
HttpURLConnection urlConnection = frcBackendApiClient.createHttpURLConnection();
FetchResponse response =
frcBackendApiClient.fetch(
urlConnection,
installationId,
installationToken,
getUserProperties(),
frcMetadata.getLastFetchETag(),
customHttpHeaders,
currentTime);
if (response.getLastFetchETag() != null) {
frcMetadata.setLastFetchETag(response.getLastFetchETag());
}
// If the execute method did not throw exceptions, then the server sent a successful response
// and the client can stop backing off.
frcMetadata.resetBackoff();
return response;
} catch (FirebaseRemoteConfigServerException serverHttpError) {
BackoffMetadata backoffMetadata =
updateAndReturnBackoffMetadata(serverHttpError.getHttpStatusCode(), currentTime);
if (shouldThrottle(backoffMetadata, serverHttpError.getHttpStatusCode())) {
throw new FirebaseRemoteConfigFetchThrottledException(
backoffMetadata.getBackoffEndTime().getTime());
}
// TODO(issues/264): Move the generic message logic to the ConfigFetchHttpClient.
throw createExceptionWithGenericMessage(serverHttpError);
}
}
/**
* Returns a {@link FirebaseRemoteConfigServerException} with a generic message based on the
* {@code statusCode}.
*
* @throws FirebaseRemoteConfigClientException if {@code statusCode} is {@link
* #HTTP_TOO_MANY_REQUESTS}. Throttled responses should be handled before calls to this
* method.
*/
private FirebaseRemoteConfigServerException createExceptionWithGenericMessage(
FirebaseRemoteConfigServerException httpError) throws FirebaseRemoteConfigClientException {
String errorMessage;
switch (httpError.getHttpStatusCode()) {
case HTTP_UNAUTHORIZED:
// The 401 HTTP Code is mapped from UNAUTHENTICATED in the gRPC world.
errorMessage =
"The request did not have the required credentials. "
+ "Please make sure your google-services.json is valid.";
break;
case HTTP_FORBIDDEN:
errorMessage =
"The user is not authorized to access the project. Please make sure "
+ "you are using the API key that corresponds to your Firebase project.";
break;
case HTTP_INTERNAL_ERROR:
errorMessage = "There was an internal server error.";
break;
case HTTP_BAD_GATEWAY:
case HTTP_UNAVAILABLE:
case HTTP_GATEWAY_TIMEOUT:
// The 504 HTTP Code is mapped from DEADLINE_EXCEEDED in the gRPC world.
errorMessage = "The server is unavailable. Please try again later.";
break;
case HTTP_TOO_MANY_REQUESTS:
// Should never happen.
// The throttled response should be handled before the call to this method.
throw new FirebaseRemoteConfigClientException(
"The throttled response from the server was not handled correctly by the FRC SDK.");
default:
errorMessage = "The server returned an unexpected error.";
break;
}
return new FirebaseRemoteConfigServerException(
httpError.getHttpStatusCode(), "Fetch failed: " + errorMessage, httpError);
}
/**
* Updates and returns the backoff metadata if the server returned a throttle-able error.
*
* <p>The list of throttle-able errors:
*
* <ul>
* <li>{@link #HTTP_TOO_MANY_REQUESTS},
* <li>{@link HttpURLConnection#HTTP_BAD_GATEWAY},
* <li>{@link HttpURLConnection#HTTP_UNAVAILABLE},
* <li>{@link HttpURLConnection#HTTP_GATEWAY_TIMEOUT}.
* </ul>
*/
private BackoffMetadata updateAndReturnBackoffMetadata(int statusCode, Date currentTime) {
if (isThrottleableServerError(statusCode)) {
updateBackoffMetadataWithLastFailedFetchTime(currentTime);
}
return frcMetadata.getBackoffMetadata();
}
/**
* Returns true for server errors that are throttle-able.
*
* <p>The {@link HttpURLConnection#HTTP_GATEWAY_TIMEOUT} error is included here since it is
* similar to the other unavailable errors in the previously linked doc.
*/
private boolean isThrottleableServerError(int httpStatusCode) {
return httpStatusCode == HTTP_TOO_MANY_REQUESTS
|| httpStatusCode == HttpURLConnection.HTTP_BAD_GATEWAY
|| httpStatusCode == HttpURLConnection.HTTP_UNAVAILABLE
|| httpStatusCode == HttpURLConnection.HTTP_GATEWAY_TIMEOUT;
}
// TODO(issues/265): Make this an atomic operation within the Metadata class to avoid possible
// concurrency issues.
/**
* Increment the number of failed fetch attempts, increase the backoff duration, set the backoff
* end time to "backoff duration" after {@code lastFailedFetchTime} and persist the new values to
* disk-backed metadata.
*/
private void updateBackoffMetadataWithLastFailedFetchTime(Date lastFailedFetchTime) {
int numFailedFetches = frcMetadata.getBackoffMetadata().getNumFailedFetches();
numFailedFetches++;
long backoffDurationInMillis = getRandomizedBackoffDurationInMillis(numFailedFetches);
Date backoffEndTime = new Date(lastFailedFetchTime.getTime() + backoffDurationInMillis);
frcMetadata.setBackoffMetadata(numFailedFetches, backoffEndTime);
}
/**
* Returns a random backoff duration from the range {@code timeoutDuration} +/- 50% of {@code
* timeoutDuration}, where {@code timeoutDuration = }{@link
* #BACKOFF_TIME_DURATIONS_IN_MINUTES}{@code [numFailedFetches-1]}.
*/
private long getRandomizedBackoffDurationInMillis(int numFailedFetches) {
// The backoff duration length after numFailedFetches.
long timeOutDurationInMillis =
MINUTES.toMillis(
BACKOFF_TIME_DURATIONS_IN_MINUTES[
Math.min(numFailedFetches, BACKOFF_TIME_DURATIONS_IN_MINUTES.length) - 1]);
// A random duration that is in the range: timeOutDuration +/- 50% of timeOutDuration.
return timeOutDurationInMillis / 2 + randomGenerator.nextInt((int) timeOutDurationInMillis);
}
/**
* Determines whether a given {@code httpStatusCode} should be throttled based on recent fetch
* results.
*
* <p>A fetch is considered throttle-able if the {@code httpStatusCode} is {@link
* #HTTP_TOO_MANY_REQUESTS}, or if the fetch is the second consecutive request to receive an
* unavailable response from the server.
*
* <p>The two fetch requirement guards against the possibility of a transient error from the
* server. In such cases, an immediate retry should fix the problem. If the retry also fails, then
* the error is probably not transient and the client should enter exponential backoff mode.
*
* <p>So, unless the server explicitly responds with a throttled error, the client should not
* throttle on the first throttle-able error from the server.
*
* @return True if the current fetch request should be throttled.
*/
private boolean shouldThrottle(BackoffMetadata backoffMetadata, int httpStatusCode) {
return backoffMetadata.getNumFailedFetches() > 1 || httpStatusCode == HTTP_TOO_MANY_REQUESTS;
}
/**
* Updates last fetch status and last successful fetch time in FRC metadata based on the result of
* {@code completedFetchTask}.
*/
private void updateLastFetchStatusAndTime(
Task<FetchResponse> completedFetchTask, Date fetchTime) {
if (completedFetchTask.isSuccessful()) {
frcMetadata.updateLastFetchAsSuccessfulAt(fetchTime);
return;
}
Exception fetchException = completedFetchTask.getException();
if (fetchException == null) {
// Fetch was cancelled, which should never happen.
return;
}
if (fetchException instanceof FirebaseRemoteConfigFetchThrottledException) {
frcMetadata.updateLastFetchAsThrottled();
} else {
frcMetadata.updateLastFetchAsFailed();
}
}
/**
* Returns the list of user properties in Analytics. If the Analytics SDK is not available,
* returns an empty list.
*/
@WorkerThread
private Map<String, String> getUserProperties() {
Map<String, String> userPropertiesMap = new HashMap<>();
if (analyticsConnector == null) {
return userPropertiesMap;
}
for (Map.Entry<String, Object> userPropertyEntry :
analyticsConnector.getUserProperties(/*includeInternal=*/ false).entrySet()) {
userPropertiesMap.put(userPropertyEntry.getKey(), userPropertyEntry.getValue().toString());
}
return userPropertiesMap;
}
/** Used to verify that the fetch handler is getting Analytics as expected. */
@VisibleForTesting
@Nullable
public AnalyticsConnector getAnalyticsConnector() {
return analyticsConnector;
}
/**
* The response of a fetch call that contains the configs fetched from the backend as well as
* metadata about the fetch operation.
*/
public static class FetchResponse {
private final Date fetchTime;
@Status private final int status;
private final ConfigContainer fetchedConfigs;
@Nullable private final String lastFetchETag;
/** Creates a fetch response with the given parameters. */
private FetchResponse(
Date fetchTime,
@Status int status,
ConfigContainer fetchedConfigs,
@Nullable String lastFetchETag) {
this.fetchTime = fetchTime;
this.status = status;
this.fetchedConfigs = fetchedConfigs;
this.lastFetchETag = lastFetchETag;
}
public static FetchResponse forBackendUpdatesFetched(
ConfigContainer fetchedConfigs, String lastFetchETag) {
return new FetchResponse(
fetchedConfigs.getFetchTime(),
Status.BACKEND_UPDATES_FETCHED,
fetchedConfigs,
lastFetchETag);
}
public static FetchResponse forBackendHasNoUpdates(Date fetchTime) {
return new FetchResponse(
fetchTime,
Status.BACKEND_HAS_NO_UPDATES,
/*fetchedConfigs=*/ null,
/*lastFetchETag=*/ null);
}
public static FetchResponse forLocalStorageUsed(Date fetchTime) {
return new FetchResponse(
fetchTime, Status.LOCAL_STORAGE_USED, /*fetchedConfigs=*/ null, /*lastFetchETag=*/ null);
}
Date getFetchTime() {
return fetchTime;
}
@Nullable
String getLastFetchETag() {
return lastFetchETag;
}
@Status
int getStatus() {
return status;
}
/**
* Returns the configs fetched from the backend, or {@code null} if the backend wasn't called or
* there were no updates from the backend.
*/
public ConfigContainer getFetchedConfigs() {
return fetchedConfigs;
}
/** The response status of a fetch operation. */
@IntDef({
Status.BACKEND_UPDATES_FETCHED,
Status.BACKEND_HAS_NO_UPDATES,
Status.LOCAL_STORAGE_USED
})
@Retention(RetentionPolicy.SOURCE)
public @interface Status {
int BACKEND_UPDATES_FETCHED = 0;
int BACKEND_HAS_NO_UPDATES = 1;
int LOCAL_STORAGE_USED = 2;
}
}
}