Skip to content
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

Link Gate to determine link launch/attest behaviour #9956

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

toluo-stripe
Copy link
Contributor

@toluo-stripe toluo-stripe commented Jan 22, 2025

Summary

Link Gate to determine whether to use native link and attestation endpoints. This will be used in

  • LinkActivityContract - to determine how to launch link
  • LinkActivityViewModel - to determine whether to prepare Play Integrity
  • SignUpViewModel - to determine whether to use attest endpoints

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Screen.Recording.2025-01-22.at.2.11.01.PM.mov

Changelog

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │            compressed            │          uncompressed          
          ├───────────┬───────────┬──────────┼──────────┬──────────┬──────────
 APK      │ old       │ new       │ diff     │ old      │ new      │ diff     
──────────┼───────────┼───────────┼──────────┼──────────┼──────────┼──────────
      dex │     4 MiB │     4 MiB │ -1.2 KiB │  8.7 MiB │  8.7 MiB │ +2.4 KiB 
     arsc │   2.3 MiB │   2.3 MiB │      0 B │  2.3 MiB │  2.3 MiB │      0 B 
 manifest │   5.1 KiB │   5.1 KiB │      0 B │ 25.7 KiB │ 25.7 KiB │      0 B 
      res │ 908.4 KiB │ 908.4 KiB │      0 B │  1.4 MiB │  1.4 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │      0 B │    6 MiB │    6 MiB │      0 B 
    asset │   1.6 MiB │   1.6 MiB │     -3 B │  1.6 MiB │  1.6 MiB │     -3 B 
    other │   1.4 MiB │   1.4 MiB │     -5 B │  1.6 MiB │  1.6 MiB │      0 B 
──────────┼───────────┼───────────┼──────────┼──────────┼──────────┼──────────
    total │  12.7 MiB │  12.7 MiB │ -1.2 KiB │ 21.6 MiB │ 21.6 MiB │ +2.4 KiB 

 DEX     │ old   │ new   │ diff                
─────────┼───────┼───────┼─────────────────────
   files │     1 │     1 │   0                 
 strings │ 40949 │ 40958 │  +9 (+2971 -2962)   
   types │ 14141 │ 14142 │  +1 (+2962 -2961)   
 classes │ 11803 │ 11803 │   0 (+2353 -2353)   
 methods │ 60121 │ 60149 │ +28 (+24152 -24124) 
  fields │ 40210 │ 40221 │ +11 (+17304 -17293) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  243 │  243 │  0   
 entries │ 6209 │ 6209 │  0
APK
     compressed      │     uncompressed     │                                           
──────────┬──────────┼───────────┬──────────┤                                           
 size     │ diff     │ size      │ diff     │ path                                      
──────────┼──────────┼───────────┼──────────┼───────────────────────────────────────────
    4 MiB │ -1.2 KiB │   8.7 MiB │ +2.4 KiB │ ∆ classes.dex                             
    127 B │   +127 B │       5 B │     +5 B │ + META-INF/services/N9.w                  
    127 B │   +127 B │       5 B │     +5 B │ + META-INF/services/O9.a                  
          │   -127 B │           │     -5 B │ - META-INF/services/M9.w                  
          │   -127 B │           │     -5 B │ - META-INF/services/N9.a                  
  7.8 KiB │    -16 B │   7.7 KiB │    -16 B │ ∆ assets/dexopt/baseline.prof             
  1,006 B │    +13 B │     874 B │    +13 B │ ∆ assets/dexopt/baseline.profm            
 53.5 KiB │    -13 B │ 118.7 KiB │      0 B │ ∆ META-INF/CERT.SF                        
 50.3 KiB │     +5 B │ 118.6 KiB │      0 B │ ∆ META-INF/MANIFEST.MF                    
  1.2 KiB │     +2 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA                       
    272 B │     +1 B │     120 B │      0 B │ ∆ META-INF/version-control-info.textproto 
──────────┼──────────┼───────────┼──────────┼───────────────────────────────────────────
  4.1 MiB │ -1.2 KiB │   8.9 MiB │ +2.4 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff             
  ───────┼───────┼──────────────────
   40949 │ 40958 │ +9 (+2971 -2962) 
  
  + LA6/A;
  + LA6/B;
  + LA6/C;
  + LA6/D;
  + LA6/E;
  + LA6/F;
  + LA6/G;
  + LA6/H;
  + LA6/I;
  + LA6/J;
  + LA6/K;
  + LA6/L;
  + LA6/M;
  + LA6/N;
  + LA6/O;
  + LA6/P;
  + LA6/Q;
  + LA6/S;
  + LA6/T;
  + LA6/U;
  + LA6/V;
  + LA6/W;
  + LA6/X;
  + LA6/Y;
  + LA6/b;
  + LA6/c;
  + LA6/d;
  + LA6/e;
  + LA6/f;
  + LA6/g;
  + LA6/h;
  + LA6/i;
  + LA6/j;
  + LA6/k;
  + LA6/l;
  + LA6/m;
  + LA6/n;
  + LA6/o;
  + LA6/p;
  + LA6/q;
  + LA6/r;
  + LA6/s;
  + LA6/t;
  + LA6/u;
  + LA6/v;
  + LA6/w;
  + LA6/x;
  + LA6/y;
  + LA6/z;
  + LA7/A;
  + LA7/B;
  + LA7/C;
  + LA7/D;
  + LA7/E;
  + LA7/F;
  + LA7/G;
  + LA7/H;
  + LA7/I;
  + LA7/J;
  + LA7/K;
  + LA7/L;
  + LA7/M;
  + LA7/N;
  + LA7/O;
  + LA7/P;
  + LA7/Q;
  + LA7/S;
  + LA7/l;
  + LA7/m;
  + LA7/n;
  + LA7/o;
  + LA7/p;
  + LA7/q;
  + LA7/r;
  + LA7/s;
  + LA7/t;
  + LA7/u;
  + LA7/v;
  + LA7/w;
  + LA7/x;
  + LA7/y;
  + LA7/z;
  + LA8/a;
  + LA8/b;
  + LA8/c;
  + LA8/d;
  + LA8/e;
  + LA8/f;
  + LA8/g;
  + LAa/e;
  + LAa/f;
  + LAa/g;
  + LAa/h;
  + LAa/i;
  + LAa/j;
  + LAa/k;
  + LAa/l;
  + LAa/m;
  + LAa/n;
  + LAa/o;
  + LAa/p;
  + LAa/q;
  + LB/n0;
  + LB9/A;
  + LB9/g;
  + LB9/h;
  + LB9/i;
  + LB9/j;
  + LB9/k;
  + LB9/l;
  + LB9/m;
  + LB9/n;
  + LB9/o;
  + LB9/p;
  + LB9/q;
  + LB9/r;
  + LB9/s;
  + LB9/t;
  + LB9/u;
  + LB9/v;
  + LB9/w;
  + LB9/x;
  + LB9/y;
  + LB9/z;
  + LC/J0;
  + LC6/A;
  + LC6/B;
  + LC6/C;
  + LC6/D;
  + LC6/E;
  + LC6/F;
  + LC6/G;
  + LC6/H;
  + LC6/I;
  + LC6/J;
  + LC6/K;
  + LC6/L;
  + LC6/M;
  + LC6/N;
  + LC6/O;
  + LC6/c;
  + LC6/d;
  + LC6/e;
  + LC6/f;
  + LC6/g;
  + LC6/h;
  + LC6/i;
  + LC6/j;
  + LC6/k;
  + LC6/l;
  + LC6/m;
  + LC6/n;
  + LC6/o;
  + LC6/p;
  + LC6/q;
  + LC6/r;
  + LC6/s;
  + LC6/t;
  + LC6/u;
  + LC6/v;
  + LC6/w;
  + LC6/x;
  + LC6/y;
  + LC6/z;
  + LC9/c;
  + LC9/d;
  + LC9/e;
  + LC9/f;
  + LCa/d;
  + LCa/e;
  + LD7/A0;
  + LD7/A;
  + LD7/B0;
  + LD7/B;
  + LD7/C0;
  + LD7/C;
  + LD7/D0;
  + LD7/D;
  + LD7/E0;
  + LD7/E;
  + LD7/F0;
  + LD7/F;
  + LD7/G0;
  + LD7/G;
  + LD7/H0;
  + LD7/H;
  + LD7/I0;
  + LD7/I;
  + LD7/J0;
  + LD7/J;
  + LD7/K0;
  + LD7/K;
  + LD7/L0;
  + LD7/L;
  + LD7/M;
  + LD7/N;
  + LD7/O;
  + LD7/P;
  + LD7/Q;
  + LD7/S;
  + LD7/T;
  + LD7/U;
  + LD7/V;
  + LD7/W;
  + LD7/X;
  + LD7/Y;
  + LD7/Z;
  + LD7/a0;
  + LD7/b0;
  + LD7/c0;
  + LD7/d0;
  + LD7/d;
  + LD7/e0;
  + LD7/e;
  + LD7/f0;
  + LD7/f;
  + LD7/g0;
  + LD7/g;
  + LD7/h0;
  + LD7/h;
  + LD7/i0;
  + LD7/i;
  + LD7/j0;
  + LD7/j;
  + LD7/k0;
  + LD7/k;
  + LD7/l0;
  + LD7/l;
  + LD7/m0;
  + LD7/m;
  + LD7/n0;
  + LD7/n;
  + LD7/o0;
  + LD7/o;
  + LD7/p0;
  + LD7/p;
  + LD7/q0;
  + LD7/q;
  + LD7/r0;
  + LD7/r;
  + LD7/s0;
  + LD7/s;
  + LD7/t0;
  + LD7/t;
  + LD7/u0;
  + LD7/u;
  + LD7/v0;
  + LD7/v;
  + LD7/w0;
  + LD7/w;
  + LD7/x0;
  + LD7/x;
  + LD7/y0;
  + LD7/y;
  + LD7/z0;
  + LD7/z;
  + LD9/b;
  + LE8/i;
  + LE8/j;
  + LE8/k;
  + LE8/l;
  + LF6/p;
  + LF6/q;
  + LF6/r;
  + LF7/A;
  + LF7/B;
  + LF7/C;
  + LF7/D;
  + LF7/E;
  + LF7/F;
  + LF7/G;
  + LF7/H;
  + LF7/I;
  + LF7/J;
  + LF7/b;
  + LF7/c;
  + LF7/d;
  + LF7/e;
  + LF7/f;
  + LF7/g;
  + LF7/h;
  + LF7/i;
  + LF7/j;
  + LF7/k;
  + LF7/l;
  + LF7/m;
  + LF7/n;
  + LF7/o;
  + LF7/p;
  + LF7/q;
  + LF7/r;
  + LF7/s;
  + LF7/t;
  + LF7/u;
  + LF7/v;
  + LF7/w;
  + LF7/x;
  + LF7/y;
  + LF7/z;
  + LF8/d;
  + LF8/e;
  + LF8/f;
  + LF8/g;
  + LF8/h;
  + LF9/b;
  + LF9/c;
  + LF9/d;
  + LF9/e;
  + LH6/A;
  + LH6/B;
  + LH6/C;
  + LH6/D;
  + LH6/E;
  + LH6/F;
  + LH6/G;
  + LH6/c;
  + LH6/d;
  + LH6/e;
  + LH6/f;
  + LH6/g;
  + LH6/h;
  + LH6/i;
  + LH6/j;
  + LH6/k;
  + LH6/l;
  + LH6/m;
  + LH6/n;
  + LH6/o;
  + LH6/p;
  + LH6/q;
  + LH6/r;
  + LH6/s;
  + LH6/t;
  + LH6/u;
  + LH6/v;
  + LH6/w;
  + LH6/x;
  + LH6/y;
  + LH6/z;
  + LH8/a;
  + LH8/b;
  + LH8/c;
  + LH8/d;
  + LH8/e;
  + LH8/f;
  + LH8/g;
  + LH8/h;
  + LH8/i;
  + LH8/j;
  + LH8/k;
  + LH9/f;
  + LH9/g;
  + LH9/h;
  + LH9/i;
  + LHa/g;
  + LHa/h;
  + LHa/i;
  + LHa/j;
  + LHa/k;
  + LHa/l;
  + LHa/m;
  + LI6/b;
  + LI7/i;
  + LI7/j;
  + LI7/k;
  + LI7/l;
  + LI7/m;
  + LI7/n;
  + LI7/o;
  + LI7/p;
  + LI7/q;
  + LIa/f;
  + LJ8/a;
  + LJ8/b;
  + LJ8/c;
  + LJ8/d;
  + LJ8/e;
  + LJa/c;
  + LJa/d;
  + LJa/e;
  + LK9/f;
  + LK9/g;
  + LK9/h;
  + LK9/i;
  + LK9/j;
  + LK9/k;
  + LK9/l;
  + LK9/m;
  + LK9/n;
  + LK9/o;
  + LK9/p;
  + LK9/q;
  + LK9/r;
  + LK9/s;
  + 
...✂

@toluo-stripe toluo-stripe changed the title Link Gate to determine link behaviour Link Gate to determine link launch/attest behaviour Jan 22, 2025
@toluo-stripe toluo-stripe marked this pull request as ready for review January 23, 2025 19:28
@toluo-stripe toluo-stripe requested review from a team as code owners January 23, 2025 19:28
internal class DefaultLinkGate @Inject constructor(
private val configuration: LinkConfiguration
) : LinkGate {
override val useNativeLink: Boolean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the advantage of keeping track of useNativeLink separately from useAttestationEndpoints if useNativeLink's value is equal to useAttestationEndpoints value?

ie is "native" link as opposed to "native + attest" going to exist in production? And if not, do we need to test it now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Native link without attestation will be the default in test-mode (there's no need to attest in this scenario). Since useAttestationEndpoints could be false in test mode, we'll use useNativeLink for the LinkActivityContract. This PR doesn't reflect the test mode logic. I'll push an update.

) : LinkGate {
override val useNativeLink: Boolean
get() {
if (FeatureFlags.nativeLinkEnabled.isEnabled) return true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it a bit confusing that we are only using the value of the feature flag if it is true -- wdyt of renaming the flags to something like "forceNativeLinkEnabled" and "forceUseAttestationEndpoints"? Or just using the feature flag values directly.

I think either solution would work bc my main concern here is that I'll be frustrated if I set native link to off in the playground and then see native link anyways (bc config.useAttestation... is true e.g.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just updated the logic, we shouldn't run into the scenario where config.useAttestation overrides the FeatureFlag anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants