Fix up discrepancies between v1 and v2 package parsing
For Activity aliases, it's possible some values are already set, which means they cannot be assumed to be 0, and can't be overwritten if a attribute in the alias is undefined. For the parsing v2 refactor, this was cleaned up to avoid redundant != 0 checks, but those checks are indeed necessary. This copies over the old logic and uses it exactly. In some future cleanup, there should be a more structured way of doing this, since it's not immediately obvious which values are overridden or not. For example, description is always overwritten even if no new value is provided in the alias. This also fixes up the comparison tests and other bugs that popped up because of them. The core issue was that when auto-generating the dumpToString methods, the Alt+Insert macro default selects all the fields in the current class, but not all the parent classes, so some shared fields like name/icon were not considered. A notable case that was found when running the comparison tests is that persistableMode is now "fixed" with v2. Previously, a bug in PackageParser caused this value to be dropped if the ActivityInfo object ever had to be copied. This is a change from Q behavior, but there's no good way to reconcile this, and it's better to be correct and consistent than broken, so this fix was left in and excluded from the comparison tests. Bug: 150106908 Test: manual run through steps in bug Test: atest com.android.server.pm.parsing Merged-In: I1301e28540314d0e643b73af7146c1a366eca6b5 Change-Id: I1301e28540314d0e643b73af7146c1a366eca6b5
Loading
Please register or sign in to comment