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

Fix issues in expiry date visual transformation #6411

Merged
merged 3 commits into from
Mar 27, 2023

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Mar 22, 2023

Summary

This pull request fixes an issue where the ExpiryDateVisualTransformation returned an incorrect mapping between transformed and original offsets, resulting in an IllegalStateException being thrown.

I updated the logic to be more robust and added tests to make sure that the mapping works as intended.

Motivation

Resolves #6407

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

@tillh-stripe tillh-stripe force-pushed the tillh/6407-fix-offsetmapping-issue branch from e004f0b to 4e68dab Compare March 22, 2023 18:10
@github-actions
Copy link
Contributor

github-actions bot commented Mar 22, 2023

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 │   3.3 MiB │   3.3 MiB │ +461 B │   7.1 MiB │   7.1 MiB │ +336 B 
     arsc │   2.1 MiB │   2.1 MiB │    0 B │   2.1 MiB │   2.1 MiB │    0 B 
 manifest │   4.4 KiB │   4.4 KiB │    0 B │    21 KiB │    21 KiB │    0 B 
      res │     1 MiB │     1 MiB │    0 B │   1.8 MiB │   1.8 MiB │    0 B 
   native │   2.6 MiB │   2.6 MiB │    0 B │     6 MiB │     6 MiB │    0 B 
    asset │     3 MiB │     3 MiB │   -8 B │     3 MiB │     3 MiB │   -8 B 
    other │ 200.2 KiB │ 200.2 KiB │   -2 B │ 454.1 KiB │ 454.1 KiB │    0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼────────
    total │  12.2 MiB │  12.2 MiB │ +451 B │  20.5 MiB │  20.5 MiB │ +328 B 

 DEX     │ old   │ new   │ diff          
─────────┼───────┼───────┼───────────────
   files │     1 │     1 │ 0             
 strings │ 35163 │ 35163 │ 0 (+1 -1)     
   types │ 11517 │ 11517 │ 0 (+0 -0)     
 classes │  9660 │  9660 │ 0 (+0 -0)     
 methods │ 51726 │ 51726 │ 0 (+126 -126) 
  fields │ 32654 │ 32654 │ 0 (+2 -2)     

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  333 │  333 │  0   
 entries │ 6877 │ 6877 │  0
APK
    compressed     │    uncompressed    │                               
──────────┬────────┼───────────┬────────┤                               
 size     │ diff   │ size      │ diff   │ path                          
──────────┼────────┼───────────┼────────┼───────────────────────────────
  3.3 MiB │ +461 B │   7.1 MiB │ +336 B │ ∆ classes.dex                 
  6.3 KiB │   -8 B │   6.2 KiB │   -8 B │ ∆ assets/dexopt/baseline.prof 
 65.4 KiB │   +7 B │ 146.7 KiB │    0 B │ ∆ META-INF/CERT.SF            
 50.5 KiB │   -7 B │ 146.6 KiB │    0 B │ ∆ META-INF/MANIFEST.MF        
  1.2 KiB │   -2 B │   1.2 KiB │    0 B │ ∆ META-INF/CERT.RSA           
──────────┼────────┼───────────┼────────┼───────────────────────────────
  3.4 MiB │ +451 B │   7.4 MiB │ +328 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   35163 │ 35163 │ 0 (+1 -1) 
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:f5ac369,r8-mode:full,version:4.0.52}
  
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:dc93088,r8-mode:full,version:4.0.52}
  

METHODS:

   old   │ new   │ diff          
  ───────┼───────┼───────────────
   51726 │ 51726 │ 0 (+126 -126) 
  + a8.m A0(h) → int
  + a8.m A1(byte[], int, int) → byte[]
  + a8.m B0() → e
  + a8.m B1(g, b) → int
  + a8.m C0(Context, TypedArray, int) → ColorStateList
  + a8.m C1(k, String) → k
  + a8.m D0(Context, s3, int) → ColorStateList
  + a8.m D1(long, long) → long
  + a8.m E0(Context, TypedArray, int, int) → int
  + a8.m E1(char) → String
  + a8.m F0(Context, int) → Drawable
  + a8.m F1(int, long) → byte[]
  + a8.m G0(Context, TypedArray, int) → Drawable
  + a8.m G1(w0) → s
  + a8.m H0(Throwable) → p
  + a8.m H1(Map) → Map
  + a8.m I0(l2, Resources) → String
  + a8.m I1(l, int, r2, d) → Object
  + a8.m J0(b0) → h1
  + a8.m J1(byte[]) → byte[]
  + a8.m K1(Object) → Object
  + a8.m L0(l2) → Integer
  + a8.m L1(Parcel) → int
  + a8.m M0(v) → e
  + a8.m M1(ByteArrayOutputStream, long, int)
  + a8.m N0(String, Provider, PSSParameterSpec) → Signature
  + a8.m N1(ByteArrayOutputStream, int)
  + a8.m O0(long) → int
  + a8.m O1(Parcel, int, int)
  + a8.m P0(String) → String
  + a8.m Q0(v, int) → e
  + a8.m S0(byte[][]) → boolean
  + a8.m T0(g, g[]) → int
  + a8.m U0(Context) → boolean
  + a8.m V0(int, long) → boolean
  + a8.m W0(View) → boolean
  + a8.m X0(e) → boolean
  + a8.m Y0(Context) → boolean
  + a8.m Z0(char) → boolean
  + a8.m a1(int) → int
  + a8.m b1(e) → Map
  + a8.m c1(c) → d0
  + a8.m d1(o0, Object, i) → b1
  + a8.m e1(int)
  + a8.m f1(Typeface)
  + a8.m g1(Typeface, boolean)
  + a8.m h1(i) → f
  + a8.m i1(JSONObject) → i2
  + a8.m j1(j) → b
  + a8.m k1(Map) → String
  + a8.m l1(String) → long
  + a8.m m1(int, PorterDuff_Mode) → PorterDuff_Mode
  + a8.m n1(int, InputStream) → byte[]
  + a8.m o1(Parcel, int) → boolean
  + a8.m p1(FileInputStream, int, int) → byte[]
  + a8.m q1(Parcel, int) → IBinder
  + a8.m r1(Parcel, int) → int
  + a8.m s0(Context, int) → float
  + a8.m s1(Parcel, int) → long
  + a8.m t0(g, long, long, float)
  + a8.m t1(Parcel, int) → int
  + a8.m u0(Parcel, int)
  + a8.m u1(int, InputStream) → long
  + a8.m v0(char, char, boolean) → boolean
  + a8.m v1(InputStream) → int
  + a8.m w0(r2, int) → String
  + a8.m w1(o0[], i) → a0
  + a8.m x0(byte[], int, int) → byte[]
  + a8.m x1(View, float)
  + a8.m y0(b0, List)
  + a8.m y1(Parcel, int)
  + a8.m z0(g, i, d) → Object
  + a8.m z1(double, double) → double
  + androidx.appcompat.widget.z0 e1(int)
  + androidx.appcompat.widget.z0 f1(Typeface)
  + b7.b e1(int)
  + b7.b g1(Typeface, boolean)
  + i7.a e1(int)
  + i7.a g1(Typeface, boolean)
  + i7.b e1(int)
  + i7.b f1(Typeface)
  + i7.c e1(int)
  + i7.c g1(Typeface, boolean)
  + if.p A1(Iterable, Collection) → ArrayList
  + if.p B1(Collection, Object) → ArrayList
  + if.p C1(AbstractList) → List
  + if.p E1(List) → Object
  + if.p F1(List) → List
  + if.p G1(Comparator, Iterable) → List
  + if.p H1(Iterable, int) → List
  + if.p I1(Iterable, AbstractCollection)
  + if.p J1(List) → int[]
  + if.p K1(Iterable) → List
  + if.p L1(Collection) → ArrayList
  + if.p M1(Iterable) → List
  + if.p O1(Iterable) → Set
  + if.p i1(List) → List
  + if.p j1(Iterable) → ArrayList
  + if.p k1(Iterable) → Object
  + if.p l1(List) → Object
  + if.p m1(Iterable) → Object
  + if.p n1(List) → Object
  + if.p o1(int, List) → Object
  + if.p p1(List, Collection) → Set
  + if.p q1(Iterable, StringBuilder, CharSequence, CharSequence, CharSequence, int, CharSequence, c)
  + if.p r1(Iterable, StringBuilder, o, int)
  + if.p s1(Iterable, String, String, String, c, int) → String
  + if.p t1(List) → Object
  + if.p u1(Iterable) → Object
  + if.p v1(List) → Object
  + if.p w1(Collection) → Comparable
  + if.p y1(Collection) → Float
  + if.p z1(Iterable, Object) → ArrayList
  + if.w P1(Object, Map) → Object
  + if.w Q1(e[]) → Map
  + if.w R1(e[]) → LinkedHashMap
  + if.w S1(LinkedHashMap) → Map
  + if.w T1(Map, Map) → LinkedHashMap
  + if.w U1(ArrayList, Map) → Map
  + if.w V1(Map, e) → Map
  + if.w W1(ArrayList, LinkedHashMap)
  + if.w X1(HashMap, e[])
  + if.w Y1(ArrayList) → Map
  + if.w Z1(Map) → Map
  + if.w a2(Map) → LinkedHas
...✂

@tillh-stripe tillh-stripe marked this pull request as ready for review March 23, 2023 20:14
@tillh-stripe tillh-stripe requested review from a team as code owners March 23, 2023 20:14
@tillh-stripe tillh-stripe merged commit ece01bb into master Mar 27, 2023
@tillh-stripe tillh-stripe deleted the tillh/6407-fix-offsetmapping-issue branch March 27, 2023 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants