Skip to content

[Obsolete] Capture frame metrics in fragment monitor #3584

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

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d7a468f
implementation
leotianlizhan Mar 21, 2022
296808d
gjf
leotianlizhan Mar 21, 2022
3c8e017
Add frame metrics to fragment screen traces.
jeremyjiang-dev Mar 23, 2022
e9c8f4f
Add tests for FrameMetricsCalculator
jeremyjiang-dev Mar 23, 2022
4740cfd
Add tests for FragmentStateMonitor
jeremyjiang-dev Mar 24, 2022
5b129bb
Add more comments.
jeremyjiang-dev Mar 24, 2022
4cdc767
Add copyright
jeremyjiang-dev Mar 24, 2022
a0e6491
Fix style.
jeremyjiang-dev Mar 24, 2022
1d2f3fa
Update CHANGELOG from m112 release (#3547)
Mar 17, 2022
4981e4a
Change DocumentOverlayCache.saveOverlays() to require non-null values…
dconeybe Mar 18, 2022
6e0944a
Don't use Indexes for outdated limit queries (#3549)
schmidt-sebastian Mar 18, 2022
f29304d
Add Firebase App Distribution to smoke tests (#3555)
Mar 18, 2022
ba3c99a
Catch RuntimeException when getting analytics Bundle. (#3564)
gsakakihara Mar 18, 2022
9d8a39c
Use assertThrows() in StorageReferenceTest (#3572)
kluever Mar 21, 2022
4b5e63b
Fireperf: start screen trace in `onResume` (#3532)
leotianlizhan Mar 21, 2022
998f1d6
Revert "Add Firebase App Distribution to smoke tests (#3555)" (#3576)
Mar 21, 2022
1214ac2
Java doc updates as per b/190099349 (#3580)
eldhosembabu Mar 22, 2022
a5c4862
Firestore: Migrate unit tests to assertThrows() (#3562)
dconeybe Mar 23, 2022
2999ae7
Fix refresh logic for App Check custom providers. (#3582)
rosalyntan Mar 23, 2022
15dd6de
[firehorn] Revert "Workaround to make smoke-test pass. (#3531)" (#3543)
yifanyang Mar 24, 2022
399ed94
Extending test-app to have buttons for all sdk methods (#3581)
manny-jimenez Mar 24, 2022
3e05a7e
Support App Distribution in smoke tests (#3585)
yifanyang Mar 24, 2022
79b62dc
Address comments.
jeremyjiang-dev Mar 25, 2022
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 @@ -41,6 +41,8 @@ public final class DefaultAppCheckToken extends AppCheckToken {
@VisibleForTesting static final String ISSUED_AT_KEY = "iat";
@VisibleForTesting static final String EXPIRATION_TIME_KEY = "exp";

private static final long ONE_SECOND_MILLIS = 1000L;

// Raw token value
private final String token;
// Timestamp in MS at which this token was generated
Expand Down Expand Up @@ -79,7 +81,7 @@ public static DefaultAppCheckToken constructFromAppCheckTokenResponse(
TokenParser.parseTokenClaims(tokenResponse.getAttestationToken());
long iat = getLongFromClaimsSafely(claimsMap, ISSUED_AT_KEY);
long exp = getLongFromClaimsSafely(claimsMap, EXPIRATION_TIME_KEY);
expiresInMillis = exp - iat;
expiresInMillis = (exp - iat) * ONE_SECOND_MILLIS;
}

return new DefaultAppCheckToken(tokenResponse.getAttestationToken(), expiresInMillis);
Expand Down Expand Up @@ -138,10 +140,10 @@ public static DefaultAppCheckToken constructFromRawToken(@NonNull String token)
Map<String, Object> claimsMap = TokenParser.parseTokenClaims(token);
long iat = getLongFromClaimsSafely(claimsMap, ISSUED_AT_KEY);
long exp = getLongFromClaimsSafely(claimsMap, EXPIRATION_TIME_KEY);
long expiresInMillis = exp - iat;
long expiresInMillis = (exp - iat) * ONE_SECOND_MILLIS;
// We use iat for receivedAtTimestamp as an approximation since we have to guess for raw JWTs
// that we recovered from storage
return new DefaultAppCheckToken(token, expiresInMillis, iat);
return new DefaultAppCheckToken(token, expiresInMillis, iat * ONE_SECOND_MILLIS);
}

private static long getLongFromClaimsSafely(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class DefaultAppCheckTokenTest {
private static final String INVALID_TIME_TO_LIVE = "notanumber";
private static final long EXPIRES_IN_ONE_HOUR = 60L * 60L * 1000L; // 1 hour in millis
private static final long RECEIVED_AT_TIMESTAMP = 1L;
private static final long ONE_SECOND_MILLIS = 1000L;
private static final long IAT = 10L;
private static final long EXP = 30L;
private static final String TOKEN_PREFIX = "prefix";
Expand Down Expand Up @@ -104,8 +105,9 @@ public void testConstructFromRawToken_normalToken_expectSuccess() throws Excepti

assertThat(defaultAppCheckToken).isNotNull();
assertThat(defaultAppCheckToken.getToken()).isEqualTo(rawToken);
assertThat(defaultAppCheckToken.getReceivedAtTimestamp()).isEqualTo(IAT);
assertThat(defaultAppCheckToken.getExpiresInMillis()).isEqualTo(EXP - IAT);
assertThat(defaultAppCheckToken.getReceivedAtTimestamp()).isEqualTo(IAT * ONE_SECOND_MILLIS);
assertThat(defaultAppCheckToken.getExpiresInMillis())
.isEqualTo((EXP - IAT) * ONE_SECOND_MILLIS);
}

@Test
Expand Down Expand Up @@ -143,7 +145,8 @@ public void testConstructFromAppCheckTokenResponse_invalidTimeToLiveFormat_fallb
DefaultAppCheckToken.constructFromAppCheckTokenResponse(mockAppCheckTokenResponse);

assertThat(defaultAppCheckToken.getToken()).isEqualTo(rawToken);
assertThat(defaultAppCheckToken.getExpiresInMillis()).isEqualTo(EXP - IAT);
assertThat(defaultAppCheckToken.getExpiresInMillis())
.isEqualTo((EXP - IAT) * ONE_SECOND_MILLIS);
}

private String constructFakeRawToken() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class StorageHelperTest {
private static final long RECEIVED_AT_TIMESTAMP = 10L;
private static final long IAT = 10L;
private static final long EXP = 30L;
private static final long ONE_SECOND_MILLIS = 1000L;
private static final String TOKEN_PREFIX = "prefix";
private static final String TOKEN_SUFFIX = "suffix";
private static final String SEPARATOR = ".";
Expand Down Expand Up @@ -108,8 +109,8 @@ public void testSaveAndRetrieveToken_TestAppCheckToken_expectEquivalentToken() t
(DefaultAppCheckToken) storageHelper.retrieveAppCheckToken();
assertThat(retrievedToken).isNotNull();
assertThat(retrievedToken.getToken()).isEqualTo(rawToken);
assertThat(retrievedToken.getExpiresInMillis()).isEqualTo(EXP - IAT);
assertThat(retrievedToken.getReceivedAtTimestamp()).isEqualTo(IAT);
assertThat(retrievedToken.getExpiresInMillis()).isEqualTo((EXP - IAT) * ONE_SECOND_MILLIS);
assertThat(retrievedToken.getReceivedAtTimestamp()).isEqualTo(IAT * ONE_SECOND_MILLIS);
}

@Test
Expand Down
17 changes: 16 additions & 1 deletion firebase-appdistribution/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
# Unreleased
- Initial public beta release

# Released

## v20.0.6 (M112)

#### Android library
* {{feature}} The Firebase App Distribution Android SDK is now available in beta. You
can use this SDK to notify testers in-app when a new test build is available.
To learn more, visit the
[reference documentation](https://firebase.google.com/docs/reference/android/com/google/firebase/appdistribution/package-summary).

#### Kotlin extensions
The Android library with Kotlin extensions is now available in
beta. The Kotlin extensions library transitively includes the base
`firebase-app-distribution` library. To learn more, visit the
[KTX reference documentation](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/appdistribution/ktx/package-summary).
33 changes: 16 additions & 17 deletions firebase-appdistribution/test-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googletest.firebase.appdistribution.testapp" >
package="com.googletest.firebase.appdistribution.testapp">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppDistributionTestAppSample" >
<activity android:name="com.googletest.firebase.appdistribution.testapp.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppDistributionTestAppSample">
<activity android:name="com.googletest.firebase.appdistribution.testapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.googletest.firebase.appdistribution.testapp.SecondActivity" >
</activity>
</application>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.googletest.firebase.appdistribution.testapp.SecondActivity"></activity>
</application>

</manifest>
Loading