Skip to content

Commit d18cc40

Browse files
Cleaning up unnecessary use of "@hide annotations" (b/177448055) (#2544)
1 parent 39ce055 commit d18cc40

Some content is hidden

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

45 files changed

+110
-204
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/FirebasePerfRegistrar.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
*
3939
* @hide
4040
*/
41-
/** @hide */
4241
@Keep
4342
public class FirebasePerfRegistrar implements ComponentRegistrar {
4443

firebase-perf/src/main/java/com/google/firebase/perf/FirebasePerformance.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ public void setPerformanceCollectionEnabled(boolean enable) {
266266
* collection enablement
267267
* @hide
268268
*/
269-
/** @hide */
270269
public synchronized void setPerformanceCollectionEnabled(@Nullable Boolean enable) {
271270
// If FirebaseApp is not initialized, Firebase Performance API is not effective yet.
272271
try {
@@ -328,7 +327,6 @@ public boolean isPerformanceCollectionEnabled() {
328327
* @hide
329328
*/
330329
@Override
331-
/** @hide */
332330
public void putAttribute(@NonNull String attribute, @NonNull String value) {
333331
boolean noError = true;
334332
try {
@@ -371,7 +369,6 @@ private void checkAttribute(@Nullable String key, @Nullable String value) {
371369
* @hide
372370
*/
373371
@Override
374-
/** @hide */
375372
public void removeAttribute(@NonNull String attribute) {
376373
mCustomAttributes.remove(attribute);
377374
}
@@ -385,7 +382,6 @@ public void removeAttribute(@NonNull String attribute) {
385382
*/
386383
@Override
387384
@Nullable
388-
/** @hide */
389385
public String getAttribute(@NonNull String attribute) {
390386
return mCustomAttributes.get(attribute);
391387
}
@@ -398,7 +394,6 @@ public String getAttribute(@NonNull String attribute) {
398394
*/
399395
@Override
400396
@NonNull
401-
/** @hide */
402397
public Map<String, String> getAttributes() {
403398
return new HashMap<>(mCustomAttributes);
404399
}

firebase-perf/src/main/java/com/google/firebase/perf/FirebasePerformanceAttributable.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* @hide
2727
*/
28-
/** @hide */
2928
public interface FirebasePerformanceAttributable {
3029

3130
// Redefining some constants for javadoc as Constants class is hidden

firebase-perf/src/main/java/com/google/firebase/perf/FirebasePerformanceInitializer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
*
2222
* @hide
2323
*/
24-
/** @hide */
2524
public final class FirebasePerformanceInitializer implements AppStateMonitor.AppColdStartCallback {
2625

27-
/** @hide */
2826
@Override
2927
public void onAppColdStart() {
3028
// Initialize FirebasePerformance when app cold starts.

firebase-perf/src/main/java/com/google/firebase/perf/application/AppStateMonitor.java

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,7 @@
4545
import java.util.WeakHashMap;
4646
import java.util.concurrent.atomic.AtomicInteger;
4747

48-
/**
49-
* Trace timer implementation to send foreground and background session log.
50-
*
51-
* @hide
52-
*/
53-
54-
/** @hide */
48+
/** Trace timer implementation to send foreground and background session log. */
5549
public class AppStateMonitor implements ActivityLifecycleCallbacks {
5650

5751
private static final AndroidLogger logger = AndroidLogger.getInstance();
@@ -128,8 +122,6 @@ public synchronized void unregisterActivityLifecycleCallbacks(Context context) {
128122
}
129123
}
130124

131-
/** @hide */
132-
/** @hide */
133125
public void incrementCount(@NonNull String name, long value) {
134126
// This method is called by RateLimiter.java when a log exceeds rate limit and to be dropped
135127
// It can be on any thread. sendSessionLog() method is called in callback methods from main UI
@@ -144,24 +136,16 @@ public void incrementCount(@NonNull String name, long value) {
144136
}
145137
}
146138

147-
/** @hide */
148-
/** @hide */
149139
public void incrementTsnsCount(int value) {
150140
tsnsCount.addAndGet(value);
151141
}
152142

153-
/** @hide */
154-
/** @hide */
155143
@Override
156144
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {}
157145

158-
/** @hide */
159-
/** @hide */
160146
@Override
161147
public void onActivityDestroyed(Activity activity) {}
162148

163-
/** @hide */
164-
/** @hide */
165149
@Override
166150
public synchronized void onActivityStarted(Activity activity) {
167151
if (isScreenTraceSupported(activity) && configResolver.isPerformanceMonitoringEnabled()) {
@@ -174,8 +158,6 @@ public synchronized void onActivityStarted(Activity activity) {
174158
}
175159
}
176160

177-
/** @hide */
178-
/** @hide */
179161
@Override
180162
public synchronized void onActivityStopped(Activity activity) {
181163
if (isScreenTraceSupported(activity)) {
@@ -194,8 +176,6 @@ public synchronized void onActivityStopped(Activity activity) {
194176
}
195177
}
196178

197-
/** @hide */
198-
/** @hide */
199179
@Override
200180
public synchronized void onActivityResumed(Activity activity) {
201181
// cases:
@@ -226,22 +206,16 @@ public boolean isColdStart() {
226206
return isColdStart;
227207
}
228208

229-
/**
230-
* @return current app state.
231-
* @hide
232-
*/
233-
/** @hide */
209+
/** @return current app state. */
234210
public ApplicationProcessState getAppState() {
235211
return currentAppState;
236212
}
237213

238214
/**
239215
* Register a subscriber to receive app state update.
240216
*
241-
* @param client an AppStateCallback instance.
242-
* @hide
217+
* @param subscriber an AppStateCallback instance.
243218
*/
244-
/** @hide */
245219
public void registerForAppState(WeakReference<AppStateCallback> subscriber) {
246220
synchronized (appStateSubscribers) {
247221
appStateSubscribers.add(subscriber);
@@ -252,9 +226,7 @@ public void registerForAppState(WeakReference<AppStateCallback> subscriber) {
252226
* Unregister the subscriber to stop receiving app state update.
253227
*
254228
* @param subscriber an AppStateCallback instance.
255-
* @hide
256229
*/
257-
/** @hide */
258230
public void unregisterForAppState(WeakReference<AppStateCallback> subscriber) {
259231
synchronized (appStateSubscribers) {
260232
appStateSubscribers.remove(subscriber);
@@ -265,9 +237,7 @@ public void unregisterForAppState(WeakReference<AppStateCallback> subscriber) {
265237
* Register a subscriber to receive app cold start update.
266238
*
267239
* @param subscriber the {@link AppColdStartCallback} instance.
268-
* @hide
269240
*/
270-
/** @hide */
271241
public void registerForAppColdStart(AppColdStartCallback subscriber) {
272242
synchronized (appStateSubscribers) {
273243
appColdStartSubscribers.add(subscriber);
@@ -452,23 +422,12 @@ private boolean hasFrameMetricsAggregatorClass() {
452422
}
453423
}
454424

455-
/**
456-
* An interface to be implemented by subscribers which needs to receive app state update.
457-
*
458-
* @hide
459-
*/
460-
/** @hide */
425+
/** An interface to be implemented by subscribers which needs to receive app state update. */
461426
public static interface AppStateCallback {
462-
/** @hide */
463-
/** @hide */
464427
public void onUpdateAppState(ApplicationProcessState newState);
465428
}
466429

467-
/**
468-
* An interface to be implemented by subscribers which needs to receive app cold start update.
469-
*
470-
* @hide
471-
*/
430+
/** An interface to be implemented by subscribers which needs to receive app cold start update. */
472431
public static interface AppColdStartCallback {
473432
public void onAppColdStart();
474433
}
@@ -478,9 +437,7 @@ public static interface AppColdStartCallback {
478437
*
479438
* @param activity activity object.
480439
* @return screen trace name.
481-
* @hide
482440
*/
483-
/** @hide */
484441
public static String getScreenTraceName(Activity activity) {
485442
return Constants.SCREEN_TRACE_PREFIX + activity.getClass().getSimpleName();
486443
}

firebase-perf/src/main/java/com/google/firebase/perf/application/AppStateUpdateHandler.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
/**
2323
* A client that can be registered with AppStateMonitor class to receive foreground/background app
2424
* state update.
25-
*
26-
* @hide
2725
*/
28-
/** @hide */
2926
public abstract class AppStateUpdateHandler implements AppStateCallback {
3027

3128
private final AppStateMonitor appStateMonitor;
@@ -39,21 +36,15 @@ public abstract class AppStateUpdateHandler implements AppStateCallback {
3936
private ApplicationProcessState currentAppState =
4037
ApplicationProcessState.APPLICATION_PROCESS_STATE_UNKNOWN;
4138

42-
/** @hide */
43-
/** @hide */
4439
protected AppStateUpdateHandler() {
4540
this(AppStateMonitor.getInstance());
4641
}
4742

48-
/** @hide */
49-
/** @hide */
5043
protected AppStateUpdateHandler(@NonNull AppStateMonitor appStateMonitor) {
5144
this.appStateMonitor = appStateMonitor;
5245
appStateCallback = new WeakReference<AppStateCallback>(this);
5346
}
5447

55-
/** @hide */
56-
/** @hide */
5748
protected void registerForAppState() {
5849
if (isRegisteredForAppState) {
5950
return;
@@ -63,8 +54,6 @@ protected void registerForAppState() {
6354
isRegisteredForAppState = true;
6455
}
6556

66-
/** @hide */
67-
/** @hide */
6857
protected void unregisterForAppState() {
6958
if (!isRegisteredForAppState) {
7059
return;
@@ -73,14 +62,21 @@ protected void unregisterForAppState() {
7362
isRegisteredForAppState = false;
7463
}
7564

76-
/** @hide */
77-
/** @hide */
7865
protected void incrementTsnsCount(int count) {
7966
appStateMonitor.incrementTsnsCount(count);
8067
}
8168

82-
/** @hide */
83-
/** @hide */
69+
/**
70+
* Reason: HIDE_ANNOTATION_REQUIRED_IN_CHILD_CLASS
71+
*
72+
* <p>Hide annotation is needed here even if the entire package (containing this class) is hidden.
73+
* This is because this class is extended by a Public API class and thus any public methods in
74+
* this class would then become a part of the Public API transitively. Adding the hide annotation
75+
* to the class level does not work either and it has to be added to the concerned public method
76+
* specifically.
77+
*
78+
* @hide
79+
*/
8480
@Override
8581
public void onUpdateAppState(ApplicationProcessState newState) {
8682
// For Trace and NetworkRequestMetricBuilder, the app state means all app states the app
@@ -95,8 +91,11 @@ public void onUpdateAppState(ApplicationProcessState newState) {
9591
}
9692
}
9793

98-
/** @hide */
99-
/** @hide */
94+
/**
95+
* Reason: HIDE_ANNOTATION_REQUIRED_IN_CHILD_CLASS
96+
*
97+
* @hide
98+
*/
10099
public ApplicationProcessState getAppState() {
101100
return currentAppState;
102101
}

firebase-perf/src/main/java/com/google/firebase/perf/application/package-info.java

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

1515
/** @hide */
16-
/** @hide */
17-
package com.google.firebase.perf.application;
16+
package com.google.firebase.perf.application;

firebase-perf/src/main/java/com/google/firebase/perf/config/ConfigResolver.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@
4848
* Retrieves configuration value from various config storage sources and returns resolved
4949
* configuration value to the caller. This class is the single source of truth for all
5050
* configurations across Firebase Performance.
51-
*
52-
* @hide
5351
*/
54-
/** @hide */
5552
public class ConfigResolver {
5653

5754
private static final AndroidLogger logger = AndroidLogger.getInstance();

firebase-perf/src/main/java/com/google/firebase/perf/config/ConfigurationConstants.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
import java.util.HashMap;
2121
import java.util.Map;
2222

23-
/**
24-
* Stores all configuration flag names and their constant values.
25-
*
26-
* @hide
27-
*/
28-
/** @hide */
23+
/** Stores all configuration flag names and their constant values. */
2924
final class ConfigurationConstants {
3025

3126
protected static final class CollectionDeactivated extends ConfigurationFlag<Boolean> {

firebase-perf/src/main/java/com/google/firebase/perf/config/ConfigurationFlag.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
/**
2020
* Parent class to be extended for each configuration flag. Provides basic constant fields and
2121
* common methods for all flags.
22-
*
23-
* @hide
2422
*/
25-
/** @hide */
2623
abstract class ConfigurationFlag<T> {
2724

2825
ConfigurationFlag() {}

firebase-perf/src/main/java/com/google/firebase/perf/config/DeviceCacheManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
/**
2929
* Utilizes platform supported APIs for storing and retrieving Firebase Performance related
3030
* configurations.
31-
*
32-
* @hide
3331
*/
34-
/** @hide */
3532
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
3633
public class DeviceCacheManager {
3734

firebase-perf/src/main/java/com/google/firebase/perf/config/RemoteConfigManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@
3838
*
3939
* <p>The source of Remote config is currently Firebase Remote Config. Read more at
4040
* go/fireperf-remote-config-android.
41-
*
42-
* @hide
4341
*/
44-
/** @hide */
4542
@Keep // Needed because of b/117526359.
4643
public class RemoteConfigManager {
4744

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2021 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.perf.config;

firebase-perf/src/main/java/com/google/firebase/perf/injection/components/FirebasePerformanceComponent.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@
2020
import dagger.Component;
2121
import javax.inject.Singleton;
2222

23-
/**
24-
* Dagger component to create FirebasePerformanceComponent Objects.
25-
*
26-
* @hide
27-
*/
23+
/** Dagger component to create FirebasePerformanceComponent Objects. */
2824
@Component(modules = {FirebasePerformanceModule.class})
2925
@Singleton
3026
public interface FirebasePerformanceComponent {

0 commit comments

Comments
 (0)