Skip to content

Aqs sdk processinfo #5488

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

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2c30305
Setup scaffolding for SessionMaintainer (#5393)
mrober Oct 10, 2023
5e93dd1
Merge branch 'master' into sessions-nine
mrober Oct 11, 2023
f85056c
Introduces a SessionDataService which is bound to by clients in each …
bryanatkinson Oct 11, 2023
8e2255c
New datastore for holding session id and timestamp (#5399)
jrothfeder Oct 11, 2023
c7e23f6
Splits the SessionDataService into a service and client (#5403)
bryanatkinson Oct 12, 2023
e80929f
Avoid changing api surface (#5406)
mrober Oct 12, 2023
2a7e354
Rename SessionCoordinator to SessionFirelogPublisher and add `getInst…
jrothfeder Oct 12, 2023
3cb8371
Make SessionGenerator injectable (#5412)
mrober Oct 13, 2023
ddfa4f5
Notify subscribers on session update. (#5411)
jrothfeder Oct 13, 2023
42ec418
Fix a bunch of warnings on this class so that bryan can continue to h…
jrothfeder Oct 13, 2023
cdc78b7
Hooks up the SessionGenerator to the SessionLifecycleService (#5416)
bryanatkinson Oct 13, 2023
716b65c
Make SessionsSettings injectable (#5415)
mrober Oct 13, 2023
83d407e
Wire datastore in to FirebaseLifecycleService (#5420)
jrothfeder Oct 16, 2023
bcca211
Only support the default Firebase app (#5422)
mrober Oct 17, 2023
771ffb7
Hooks up the SessionLifecycleService to the FirelogPublisher, and has…
bryanatkinson Oct 17, 2023
9276770
Update SessionDatastore.kt's name (#5433)
jrothfeder Oct 17, 2023
cd58103
Updates the service to run on a looper on it's own thread and not use…
bryanatkinson Oct 17, 2023
113b771
Refactors SessionLifecycleService to make the message handler static …
bryanatkinson Oct 17, 2023
f3543de
Removes unecessary setup code from FirebaseSessions and SessionInitia…
bryanatkinson Oct 18, 2023
c515585
Rebase sessions-nine. (#5440)
jrothfeder Oct 18, 2023
f00c59e
Merge branch 'master' into sessions-nine
mrober Oct 18, 2023
1a70bdc
Replaces info level log messages with debug messages and adds a coupl…
bryanatkinson Oct 18, 2023
859cb0c
Controls whether or not the sessions SDK hooks up any lifecycle callb…
bryanatkinson Oct 19, 2023
10f8ad5
Merge branch 'master' into sessions-nine
mrober Oct 20, 2023
4beb35a
Remove passthrough `register` method from `FirebaseSessions` since `F…
jrothfeder Oct 20, 2023
f75bbf2
Add sampling, data collection, and disabled checks to newSession (#5451)
mrober Oct 20, 2023
746da95
Looper on a different thread for the SessionLifecycleClient's callbac…
jrothfeder Oct 20, 2023
5c8bf24
Moves SessionFirelogPublisher and SessionDatastore behind an interfac…
bryanatkinson Oct 20, 2023
360d74c
Don't wrap sendLifecycleEvents twice (#5463)
mrober Oct 20, 2023
26ed392
Sessions fake registrar (#5464)
bryanatkinson Oct 20, 2023
9d548b5
Project level dep on sessions (#5460)
mrober Oct 21, 2023
ec89794
Fixes issue where handler thread is started/stopped based on activity…
bryanatkinson Oct 23, 2023
2ac4229
Merge branch 'master' into sessions-nine
mrober Oct 23, 2023
6ed2dbb
Fix sessions test app android test (#5471)
mrober Oct 23, 2023
4f5da7e
Adds unit test for SessionLifecycleService using the fake registrar i…
bryanatkinson Oct 26, 2023
26990ac
Refactors the SessionLifecycleClient to be a class instead ofan objec…
bryanatkinson Oct 26, 2023
7a1b9f7
Adds unit test for SessionLifecycleClient. (#5475)
bryanatkinson Oct 26, 2023
25e8956
Fix tests and network exception in gradle task config (#5476)
mrober Oct 26, 2023
f884d1a
Merge branch 'master' into sessions-nine
Oct 27, 2023
4d935cd
Keep track of pending foreground before settings fetched (#5482)
mrober Oct 27, 2023
b78b7ea
Remove AQS based session ID dependency from Fireperf. (#5454)
visumickey Oct 27, 2023
d9bdc42
Updates test app to have more functionality so we can verify multiple…
bryanatkinson Oct 30, 2023
a88ba37
Merge branch 'master' into sessions-nine
Oct 30, 2023
e32ecd1
Incremental
Oct 30, 2023
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 @@ -85,7 +85,7 @@ class FirebaseLibraryPlugin : BaseFirebaseLibraryPlugin() {
android.testServer(FirebaseTestServer(project, firebaseLibrary.testLab, android))
setupStaticAnalysis(project, firebaseLibrary)
getIsPomValidTask(project, firebaseLibrary)
setupVersionCheckTasks(project, firebaseLibrary)
// setupVersionCheckTasks(project, firebaseLibrary)
configurePublishing(project, firebaseLibrary, android)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.google.firebase.processinfo;

import androidx.annotation.NonNull;

import com.google.auto.value.AutoValue;

@AutoValue
public abstract class ProcessDetails {
@NonNull
public abstract String getProcessName();

public abstract int getPid();

public abstract int getImportance();

public abstract boolean isDefaultProcess();

@NonNull
public static Builder builder() {
return new AutoValue_ProcessDetails
.Builder();
}

/** Builder for {@link ProcessDetails}. */
@AutoValue.Builder
public abstract static class Builder {
@NonNull
public abstract Builder setProcessName(@NonNull String processName);

@NonNull
public abstract Builder setPid(int pid);

@NonNull
public abstract Builder setImportance(int importance);

@NonNull
public abstract Builder setDefaultProcess(boolean isDefaultProcess);

@NonNull
public abstract ProcessDetails build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@
* limitations under the License.
*/

package com.google.firebase.crashlytics.internal
package com.google.firebase.processinfo

import android.app.ActivityManager
import android.content.Context
import android.os.Build
import android.os.Process
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.ProcessDetails

/**
* Provider of ProcessDetails.
*
* @hide
*/
internal object ProcessDetailsProvider {
object ProcessDetailsProvider {
/** Gets the details of all running app processes. */
fun getAppProcessDetails(context: Context): List<ProcessDetails> {
val defaultProcessName = context.applicationInfo.processName
Expand Down
6 changes: 3 additions & 3 deletions firebase-crashlytics/firebase-crashlytics.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ dependencies {
exclude group: 'com.google.firebase', module: 'firebase-components'
}
implementation(libs.androidx.annotation)
implementation("com.google.firebase:firebase-common:20.4.2")
implementation("com.google.firebase:firebase-common-ktx:20.4.2")
implementation("com.google.firebase:firebase-common:20.4.3")
implementation("com.google.firebase:firebase-common-ktx:20.4.3")
implementation("com.google.firebase:firebase-components:17.1.3")
implementation("com.google.firebase:firebase-installations:17.2.0")
implementation("com.google.firebase:firebase-sessions:1.1.0") {
implementation(project(':firebase-sessions')) {
exclude group: 'com.google.firebase', module: 'firebase-common'
exclude group: 'com.google.firebase', module: 'firebase-components'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.Execution;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.Execution.Signal;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.Execution.Thread.Frame;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.ProcessDetails;
import com.google.firebase.crashlytics.internal.settings.Settings;
import com.google.firebase.crashlytics.internal.settings.Settings.FeatureFlagData;
import com.google.firebase.crashlytics.internal.settings.SettingsProvider;
import com.google.firebase.processinfo.ProcessDetails;

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ private FirebaseCrashlytics buildCrashlytics(ComponentContainer container) {
FirebaseSessions firebaseSessions = container.get(FirebaseSessions.class);

return FirebaseCrashlytics.init(
app, firebaseInstallations, firebaseSessions, nativeComponent, analyticsConnector);
app, firebaseInstallations, nativeComponent, analyticsConnector);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import com.google.firebase.crashlytics.internal.settings.SettingsController;
import com.google.firebase.inject.Deferred;
import com.google.firebase.installations.FirebaseInstallationsApi;
import com.google.firebase.sessions.FirebaseSessions;
import com.google.firebase.sessions.api.FirebaseSessionsDependencies;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
Expand All @@ -64,7 +64,6 @@ public class FirebaseCrashlytics {
static @Nullable FirebaseCrashlytics init(
@NonNull FirebaseApp app,
@NonNull FirebaseInstallationsApi firebaseInstallationsApi,
@NonNull FirebaseSessions firebaseSessions,
@NonNull Deferred<CrashlyticsNativeComponent> nativeComponent,
@NonNull Deferred<AnalyticsConnector> analyticsConnector) {

Expand Down Expand Up @@ -93,7 +92,7 @@ public class FirebaseCrashlytics {

CrashlyticsAppQualitySessionsSubscriber sessionsSubscriber =
new CrashlyticsAppQualitySessionsSubscriber(arbiter, fileStore);
firebaseSessions.register(sessionsSubscriber);
FirebaseSessionsDependencies.register(sessionsSubscriber);

final CrashlyticsCore core =
new CrashlyticsCore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@
import android.os.StatFs;
import android.text.TextUtils;
import com.google.firebase.crashlytics.BuildConfig;
import com.google.firebase.crashlytics.internal.ProcessDetailsProvider;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Architecture;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.Execution;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.Execution.BinaryImage;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event.Application.ProcessDetails;
import com.google.firebase.crashlytics.internal.settings.SettingsProvider;
import com.google.firebase.crashlytics.internal.stacktrace.StackTraceTrimmingStrategy;
import com.google.firebase.crashlytics.internal.stacktrace.TrimmedThrowableData;
import com.google.firebase.processinfo.ProcessDetails;
import com.google.firebase.processinfo.ProcessDetailsProvider;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.google.firebase.encoders.annotations.Encodable;
import com.google.firebase.encoders.annotations.Encodable.Field;
import com.google.firebase.encoders.annotations.Encodable.Ignore;
import com.google.firebase.processinfo.ProcessDetails;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.charset.Charset;
Expand Down Expand Up @@ -962,43 +964,6 @@ public abstract static class Builder {
}
}

@AutoValue
public abstract static class ProcessDetails {
@NonNull
public abstract String getProcessName();

public abstract int getPid();

public abstract int getImportance();

public abstract boolean isDefaultProcess();

@NonNull
public static Builder builder() {
return new AutoValue_CrashlyticsReport_Session_Event_Application_ProcessDetails
.Builder();
}

/** Builder for {@link ProcessDetails}. */
@AutoValue.Builder
public abstract static class Builder {
@NonNull
public abstract Builder setProcessName(@NonNull String processName);

@NonNull
public abstract Builder setPid(int pid);

@NonNull
public abstract Builder setImportance(int importance);

@NonNull
public abstract Builder setDefaultProcess(boolean isDefaultProcess);

@NonNull
public abstract ProcessDetails build();
}
}

/** Builder for {@link Application}. */
@AutoValue.Builder
public abstract static class Builder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event;
import com.google.firebase.encoders.DataEncoder;
import com.google.firebase.encoders.json.JsonDataEncoderBuilder;
import com.google.firebase.processinfo.ProcessDetails;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
Expand Down Expand Up @@ -497,9 +499,9 @@ private static Event.Application parseEventApp(@NonNull JsonReader jsonReader)
}

@NonNull
private static Event.Application.ProcessDetails parseProcessDetails(
private static ProcessDetails parseProcessDetails(
@NonNull JsonReader jsonReader) throws IOException {
Event.Application.ProcessDetails.Builder builder = Event.Application.ProcessDetails.builder();
ProcessDetails.Builder builder = ProcessDetails.builder();

jsonReader.beginObject();
while (jsonReader.hasNext()) {
Expand Down
10 changes: 2 additions & 8 deletions firebase-perf/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
# Unreleased

* [changed] Make Fireperf generate its own session Id.

# 20.5.0
* [changed] Added Kotlin extensions (KTX) APIs from `com.google.firebase:firebase-perf-ktx`
to `com.google.firebase:firebase-perf` under the `com.google.firebase.perf` package.
For details, see the
[FAQ about this initiative](https://firebase.google.com/docs/android/kotlin-migration)

* [deprecated] All the APIs from `com.google.firebase:firebase-perf-ktx` have been added to
`com.google.firebase:firebase-perf` under the `com.google.firebase.perf` package,
and all the Kotlin extensions (KTX) APIs in `com.google.firebase:firebase-perf-ktx` are
now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the
[FAQ about this initiative](https://firebase.google.com/docs/android/kotlin-migration)


## Kotlin
The Kotlin extensions library transitively includes the updated
`firebase-performance` library. The Kotlin extensions library has no additional
updates.

# 20.4.1
* [changed] Updated `firebase-sessions` dependency to v1.0.2
* [fixed] Make fireperf data collection state is reliable for Firebase Sessions library.
Expand Down Expand Up @@ -369,4 +364,3 @@ updates.

# 16.1.0
* [fixed] Fixed a `SecurityException` crash on certain devices that do not have Google Play Services on them.

2 changes: 1 addition & 1 deletion firebase-perf/firebase-perf.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ dependencies {
implementation("com.google.firebase:firebase-components:17.1.3")
implementation("com.google.firebase:firebase-config:21.5.0")
implementation("com.google.firebase:firebase-installations:17.2.0")
implementation("com.google.firebase:firebase-sessions:1.1.0") {
implementation(project(':firebase-sessions')) {
exclude group: 'com.google.firebase', module: 'firebase-common'
exclude group: 'com.google.firebase', module: 'firebase-common-ktx'
exclude group: 'com.google.firebase', module: 'firebase-components'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
package com.google.firebase.perf;

import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.firebase.FirebaseApp;
import com.google.firebase.StartupTime;
import com.google.firebase.perf.application.AppStateMonitor;
import com.google.firebase.perf.config.ConfigResolver;
import com.google.firebase.perf.metrics.AppStartTrace;
import com.google.firebase.perf.session.PerfSession;
import com.google.firebase.perf.session.SessionManager;
import com.google.firebase.sessions.FirebaseSessions;
import com.google.firebase.sessions.api.SessionSubscriber;
import java.util.concurrent.Executor;

/**
Expand All @@ -38,10 +34,7 @@
public class FirebasePerfEarly {

public FirebasePerfEarly(
FirebaseApp app,
FirebaseSessions firebaseSessions,
@Nullable StartupTime startupTime,
Executor uiExecutor) {
FirebaseApp app, @Nullable StartupTime startupTime, Executor uiExecutor) {
Context context = app.getApplicationContext();

// Initialize ConfigResolver early for accessing device caching layer.
Expand All @@ -58,31 +51,7 @@ public FirebasePerfEarly(
uiExecutor.execute(new AppStartTrace.StartFromBackgroundRunnable(appStartTrace));
}

// Register with Firebase sessions to receive updates about session changes.
firebaseSessions.register(
new SessionSubscriber() {
@Override
public void onSessionChanged(@NonNull SessionDetails sessionDetails) {
PerfSession perfSession = PerfSession.createWithId(sessionDetails.getSessionId());
SessionManager.getInstance().updatePerfSession(perfSession);
}

@Override
public boolean isDataCollectionEnabled() {
// If there is no cached config data available for data collection, be conservative.
// Return false.
if (!configResolver.isCollectionEnabledConfigValueAvailable()) {
return false;
}
return ConfigResolver.getInstance().isPerformanceMonitoringEnabled();
}

@NonNull
@Override
public Name getSessionSubscriberName() {
return SessionSubscriber.Name.PERFORMANCE;
}
});
// TODO: Bring back Firebase Sessions dependency to watch for updates to sessions.

// In the case of cold start, we create a session and start collecting gauges as early as
// possible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
import com.google.firebase.perf.injection.modules.FirebasePerformanceModule;
import com.google.firebase.platforminfo.LibraryVersionComponent;
import com.google.firebase.remoteconfig.RemoteConfigComponent;
import com.google.firebase.sessions.FirebaseSessions;
import com.google.firebase.sessions.api.FirebaseSessionsDependencies;
import com.google.firebase.sessions.api.SessionSubscriber;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executor;
Expand All @@ -50,10 +47,6 @@ public class FirebasePerfRegistrar implements ComponentRegistrar {
private static final String LIBRARY_NAME = "fire-perf";
private static final String EARLY_LIBRARY_NAME = "fire-perf-early";

static {
FirebaseSessionsDependencies.INSTANCE.addDependency(SessionSubscriber.Name.PERFORMANCE);
}

@Override
@Keep
public List<Component<?>> getComponents() {
Expand All @@ -71,15 +64,13 @@ public List<Component<?>> getComponents() {
Component.builder(FirebasePerfEarly.class)
.name(EARLY_LIBRARY_NAME)
.add(Dependency.required(FirebaseApp.class))
.add(Dependency.required(FirebaseSessions.class))
.add(Dependency.optionalProvider(StartupTime.class))
.add(Dependency.required(uiExecutor))
.eagerInDefaultApp()
.factory(
container ->
new FirebasePerfEarly(
container.get(FirebaseApp.class),
container.get(FirebaseSessions.class),
container.getProvider(StartupTime.class).get(),
container.get(uiExecutor)))
.build(),
Expand Down
Loading