[Launcher Jank] Avoid lock contention on AssetManager in all apps preinflate thread

Create a separate context with a separate AssetManager obj.

Bug: 337056120
Flag: NONE
Test: presubmit
Change-Id: Ic6765f7f19b649605aec6a889f8382ee10f929b0
This commit is contained in:
Fengjiang Li
2024-04-25 15:51:09 -07:00
parent 4e741082dc
commit b2d0845a29
3 changed files with 33 additions and 1 deletions

View File

@@ -412,6 +412,8 @@ public abstract class BaseActivity extends Activity implements ActivityContext {
public static <T extends BaseActivity> T fromContext(Context context) {
if (context instanceof BaseActivity) {
return (T) context;
} else if (context instanceof ActivityContextDelegate) {
return (T) ((ActivityContextDelegate) context).mDelegate;
} else if (context instanceof ContextWrapper) {
return fromContext(((ContextWrapper) context).getBaseContext());
} else {