proguard icon indicating copy to clipboard operation
proguard copied to clipboard

Filename is retraced incorrectly.

Open snowpardx opened this issue 5 years ago • 3 comments

We have FragmentManagerImpl:moveToState method in FragmentManager.java file https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/FragmentManager.java#1485

If we have stackrace like

java.lang.RuntimeException: Unable to resume activity {com.example.com/com.example.com.llp.activity.OnlineSessionActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4228)
  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4330)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1867)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:148)
  at android.app.ActivityThread.main(ActivityThread.java:7422)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
    at com.android.internal.policy.PhoneWindow.requestFeature(PhoneWindow.java:411)
    at android.app.Dialog.requestWindowFeature(Dialog.java:1491)
    at is.setupDialog(DialogFragment.java:353)
    at is.onGetLayoutInflater(DialogFragment.java:333)
    at androidx.fragment.app.Fragment.performGetLayoutInflater(Fragment.java:1308)
    at ix.a(FragmentManager.java:1460)
    at ix.f(FragmentManager.java:1784)
    at ix.a(FragmentManager.java:1852)
    at ir.g(BackStackRecord.java:802)
    at ix.b(FragmentManager.java:2625)
    at ix.a(FragmentManager.java:2411)
    at ix.b(FragmentManager.java:2366)
    at ix.h(FragmentManager.java:2273)
    at iu.m(FragmentController.java:391)
    at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:517)
...

and in particular line at ix.a(FragmentManager.java:1460) it deobfuscated as androidx.fragment.app.FragmentManagerImpl(FragmentManagerImpl.java:1460)

While expected behaviour is androidx.fragment.app.FragmentManagerImpl(FragmentManager.java:1460)

snowpardx avatar Dec 19 '19 11:12 snowpardx

We tested this on 6.0.3, 6.2.2, 6.3.0-beta1 and on all of these versions bug is reproduced.

ruslan-bikkinin avatar Dec 19 '19 11:12 ruslan-bikkinin

The retracing of the sourcefile information is simply a heuristic. There is no information stored in the mapping file to correctly retrace this information.

The sourcefile is simply set by to classname.java

This would be a useful enhancement though, as especially with the emerging use of kotlin this heuristic is flawed, unfortunately, updating the mapping file make break a lot of tools.

netomi avatar Dec 19 '19 11:12 netomi

Having a second though on this issue: from your stacktrace it looks like that you keep the original SourceFile attribute, but retrace overrides the correct original sourcefile with the heuristic.

In general why do you keep the SourceFile while enabling obfuscation of cassnames? From the sourcefile the original classname can be deduced most of the time.

netomi avatar Dec 19 '19 11:12 netomi