Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New pass to reduce non-existent class loads
Summary: Inflating an .xml file to class instances is kinda strange. Elements in xml files for SDK classes are using the class simple name, which makes [PhoneLayoutInflater guess what package it is in](https://cs.android.com/android/platform/superproject/+/android-13.0.0_r1:frameworks/base/core/java/com/android/internal/policy/PhoneLayoutInflater.java;l=28?q=PhoneLayoutInflater&ss=android) at runtime. In practice, most of the elements will be either: - application classes, which are fully qualified - SDK classes for which PhoneLayoutInflater's first guess is correct But, there are some classes for which the first few guesses are wrong, like: https://developer.android.com/reference/android/view/ViewStub?hl=en, https://developer.android.com/reference/android/view/View This means in practice, load of non-existent `android.widget.ViewStub` is attempted and so is `android.webkit.ViewStub`, etc. These are probably not the ones the application developer is expecting. We exploit the fact that [LayoutInflater looks for a special tag](https://cs.android.com/android/platform/superproject/+/android-13.0.0_r1:frameworks/base/core/java/android/view/LayoutInflater.java;l=986?q=LayoutInflater&ss=android) `<view class="fully qualified class name" />` and rewrite the binary files to use this form. Should save some erroneous class loads on startup. Reviewed By: agampe Differential Revision: D47616756 fbshipit-source-id: e47343517157175ee16e09f1c37edf5ec36816fd
- Loading branch information