Skip to content

Cleaning up unnecessary use of "@hide annotations" (b/177448055) #2544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
*
* @hide
*/
/** @hide */
@Keep
public class FirebasePerfRegistrar implements ComponentRegistrar {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ public void setPerformanceCollectionEnabled(boolean enable) {
* collection enablement
* @hide
*/
/** @hide */
public synchronized void setPerformanceCollectionEnabled(@Nullable Boolean enable) {
// If FirebaseApp is not initialized, Firebase Performance API is not effective yet.
try {
Expand Down Expand Up @@ -328,7 +327,6 @@ public boolean isPerformanceCollectionEnabled() {
* @hide
*/
@Override
/** @hide */
public void putAttribute(@NonNull String attribute, @NonNull String value) {
boolean noError = true;
try {
Expand Down Expand Up @@ -371,7 +369,6 @@ private void checkAttribute(@Nullable String key, @Nullable String value) {
* @hide
*/
@Override
/** @hide */
public void removeAttribute(@NonNull String attribute) {
mCustomAttributes.remove(attribute);
}
Expand All @@ -385,7 +382,6 @@ public void removeAttribute(@NonNull String attribute) {
*/
@Override
@Nullable
/** @hide */
public String getAttribute(@NonNull String attribute) {
return mCustomAttributes.get(attribute);
}
Expand All @@ -398,7 +394,6 @@ public String getAttribute(@NonNull String attribute) {
*/
@Override
@NonNull
/** @hide */
public Map<String, String> getAttributes() {
return new HashMap<>(mCustomAttributes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*
* @hide
*/
/** @hide */
public interface FirebasePerformanceAttributable {

// Redefining some constants for javadoc as Constants class is hidden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
*
* @hide
*/
/** @hide */
public final class FirebasePerformanceInitializer implements AppStateMonitor.AppColdStartCallback {

/** @hide */
@Override
public void onAppColdStart() {
// Initialize FirebasePerformance when app cold starts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@
import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicInteger;

/**
* Trace timer implementation to send foreground and background session log.
*
* @hide
*/

/** @hide */
/** Trace timer implementation to send foreground and background session log. */
public class AppStateMonitor implements ActivityLifecycleCallbacks {

private static final AndroidLogger logger = AndroidLogger.getInstance();
Expand Down Expand Up @@ -128,8 +122,6 @@ public synchronized void unregisterActivityLifecycleCallbacks(Context context) {
}
}

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

/** @hide */
/** @hide */
public void incrementTsnsCount(int value) {
tsnsCount.addAndGet(value);
}

/** @hide */
/** @hide */
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {}

/** @hide */
/** @hide */
@Override
public void onActivityDestroyed(Activity activity) {}

/** @hide */
/** @hide */
@Override
public synchronized void onActivityStarted(Activity activity) {
if (isScreenTraceSupported(activity) && configResolver.isPerformanceMonitoringEnabled()) {
Expand All @@ -174,8 +158,6 @@ public synchronized void onActivityStarted(Activity activity) {
}
}

/** @hide */
/** @hide */
@Override
public synchronized void onActivityStopped(Activity activity) {
if (isScreenTraceSupported(activity)) {
Expand All @@ -194,8 +176,6 @@ public synchronized void onActivityStopped(Activity activity) {
}
}

/** @hide */
/** @hide */
@Override
public synchronized void onActivityResumed(Activity activity) {
// cases:
Expand Down Expand Up @@ -226,22 +206,16 @@ public boolean isColdStart() {
return isColdStart;
}

/**
* @return current app state.
* @hide
*/
/** @hide */
/** @return current app state. */
public ApplicationProcessState getAppState() {
return currentAppState;
}

/**
* Register a subscriber to receive app state update.
*
* @param client an AppStateCallback instance.
* @hide
* @param subscriber an AppStateCallback instance.
*/
/** @hide */
public void registerForAppState(WeakReference<AppStateCallback> subscriber) {
synchronized (appStateSubscribers) {
appStateSubscribers.add(subscriber);
Expand All @@ -252,9 +226,7 @@ public void registerForAppState(WeakReference<AppStateCallback> subscriber) {
* Unregister the subscriber to stop receiving app state update.
*
* @param subscriber an AppStateCallback instance.
* @hide
*/
/** @hide */
public void unregisterForAppState(WeakReference<AppStateCallback> subscriber) {
synchronized (appStateSubscribers) {
appStateSubscribers.remove(subscriber);
Expand All @@ -265,9 +237,7 @@ public void unregisterForAppState(WeakReference<AppStateCallback> subscriber) {
* Register a subscriber to receive app cold start update.
*
* @param subscriber the {@link AppColdStartCallback} instance.
* @hide
*/
/** @hide */
public void registerForAppColdStart(AppColdStartCallback subscriber) {
synchronized (appStateSubscribers) {
appColdStartSubscribers.add(subscriber);
Expand Down Expand Up @@ -452,23 +422,12 @@ private boolean hasFrameMetricsAggregatorClass() {
}
}

/**
* An interface to be implemented by subscribers which needs to receive app state update.
*
* @hide
*/
/** @hide */
/** An interface to be implemented by subscribers which needs to receive app state update. */
public static interface AppStateCallback {
/** @hide */
/** @hide */
public void onUpdateAppState(ApplicationProcessState newState);
}

/**
* An interface to be implemented by subscribers which needs to receive app cold start update.
*
* @hide
*/
/** An interface to be implemented by subscribers which needs to receive app cold start update. */
public static interface AppColdStartCallback {
public void onAppColdStart();
}
Expand All @@ -478,9 +437,7 @@ public static interface AppColdStartCallback {
*
* @param activity activity object.
* @return screen trace name.
* @hide
*/
/** @hide */
public static String getScreenTraceName(Activity activity) {
return Constants.SCREEN_TRACE_PREFIX + activity.getClass().getSimpleName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
/**
* A client that can be registered with AppStateMonitor class to receive foreground/background app
* state update.
*
* @hide
*/
/** @hide */
public abstract class AppStateUpdateHandler implements AppStateCallback {

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

/** @hide */
/** @hide */
protected AppStateUpdateHandler() {
this(AppStateMonitor.getInstance());
}

/** @hide */
/** @hide */
protected AppStateUpdateHandler(@NonNull AppStateMonitor appStateMonitor) {
this.appStateMonitor = appStateMonitor;
appStateCallback = new WeakReference<AppStateCallback>(this);
}

/** @hide */
/** @hide */
protected void registerForAppState() {
if (isRegisteredForAppState) {
return;
Expand All @@ -63,8 +54,6 @@ protected void registerForAppState() {
isRegisteredForAppState = true;
}

/** @hide */
/** @hide */
protected void unregisterForAppState() {
if (!isRegisteredForAppState) {
return;
Expand All @@ -73,14 +62,21 @@ protected void unregisterForAppState() {
isRegisteredForAppState = false;
}

/** @hide */
/** @hide */
protected void incrementTsnsCount(int count) {
appStateMonitor.incrementTsnsCount(count);
}

/** @hide */
/** @hide */
/**
* Reason: HIDE_ANNOTATION_REQUIRED_IN_CHILD_CLASS
*
* <p>Hide annotation is needed here even if the entire package (containing this class) is hidden.
* This is because this class is extended by a Public API class and thus any public methods in
* this class would then become a part of the Public API transitively. Adding the hide annotation
* to the class level does not work either and it has to be added to the concerned public method
* specifically.
*
* @hide
*/
@Override
public void onUpdateAppState(ApplicationProcessState newState) {
// For Trace and NetworkRequestMetricBuilder, the app state means all app states the app
Expand All @@ -95,8 +91,11 @@ public void onUpdateAppState(ApplicationProcessState newState) {
}
}

/** @hide */
/** @hide */
/**
* Reason: HIDE_ANNOTATION_REQUIRED_IN_CHILD_CLASS
*
* @hide
*/
public ApplicationProcessState getAppState() {
return currentAppState;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
// limitations under the License.

/** @hide */
/** @hide */
package com.google.firebase.perf.application;
package com.google.firebase.perf.application;
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
* Retrieves configuration value from various config storage sources and returns resolved
* configuration value to the caller. This class is the single source of truth for all
* configurations across Firebase Performance.
*
* @hide
*/
/** @hide */
public class ConfigResolver {

private static final AndroidLogger logger = AndroidLogger.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
import java.util.HashMap;
import java.util.Map;

/**
* Stores all configuration flag names and their constant values.
*
* @hide
*/
/** @hide */
/** Stores all configuration flag names and their constant values. */
final class ConfigurationConstants {

protected static final class CollectionDeactivated extends ConfigurationFlag<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
/**
* Parent class to be extended for each configuration flag. Provides basic constant fields and
* common methods for all flags.
*
* @hide
*/
/** @hide */
abstract class ConfigurationFlag<T> {

ConfigurationFlag() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
/**
* Utilizes platform supported APIs for storing and retrieving Firebase Performance related
* configurations.
*
* @hide
*/
/** @hide */
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
public class DeviceCacheManager {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
*
* <p>The source of Remote config is currently Firebase Remote Config. Read more at
* go/fireperf-remote-config-android.
*
* @hide
*/
/** @hide */
@Keep // Needed because of b/117526359.
public class RemoteConfigManager {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2021 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.

/** @hide */
package com.google.firebase.perf.config;
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
import dagger.Component;
import javax.inject.Singleton;

/**
* Dagger component to create FirebasePerformanceComponent Objects.
*
* @hide
*/
/** Dagger component to create FirebasePerformanceComponent Objects. */
@Component(modules = {FirebasePerformanceModule.class})
@Singleton
public interface FirebasePerformanceComponent {
Expand Down
Loading