MCPcopy Create free account
hub / github.com/google/gapid / waitForOnCreate

Function waitForOnCreate

gapii/client/jdwp_loader.go:61–106  ·  view source on GitHub ↗

waitForOnCreate waits for android.app.Application.onCreate to be called, and then suspends all threads.

(ctx context.Context, conn *jdwp.Connection)

Source from the content-addressed store, hash-verified

59// waitForOnCreate waits for android.app.Application.onCreate to be called, and
60// then suspends all threads.
61func waitForOnCreate(ctx context.Context, conn *jdwp.Connection) (*jdwp.EventMethodEntry, error) {
62 app, err := conn.GetClassBySignature("Landroid/app/Application;")
63 if err != nil {
64 return nil, err
65 }
66
67 constructor, err := conn.GetClassMethod(app.ClassID(), "<init>", "()V")
68 if err != nil {
69 return nil, err
70 }
71
72 log.I(ctx, " Waiting for Application.<init>()")
73 initEntry, err := conn.WaitForMethodEntry(ctx, app.ClassID(), constructor.ID)
74 if err != nil {
75 return nil, err
76 }
77
78 var entry *jdwp.EventMethodEntry
79 err = jdbg.Do(conn, initEntry.Thread, func(j *jdbg.JDbg) error {
80 class := j.This().Call("getClass").AsType().(*jdbg.Class)
81 var onCreate jdwp.Method
82 for class != nil {
83 var err error
84 onCreate, err = conn.GetClassMethod(class.ID(), "onCreate", "()V")
85 if err == nil {
86 break
87 }
88 class = class.Super()
89 }
90 if class == nil {
91 return fmt.Errorf("Couldn't find Application.onCreate")
92 }
93 log.I(ctx, " Waiting for %v.onCreate()", class.String())
94 out, err := conn.WaitForMethodEntry(ctx, class.ID(), onCreate.ID)
95 if err != nil {
96 return err
97 }
98 entry = out
99 return nil
100 })
101 if err != nil {
102 return nil, err
103 }
104
105 return entry, nil
106}
107
108// waitForVulkanLoad for android.app.ApplicationLoaders.getClassLoader to be called,
109// and then suspends the thread.

Callers 1

loadAndConnectViaJDWPMethod · 0.85

Calls 12

GetClassBySignatureMethod · 0.80
GetClassMethodMethod · 0.80
ClassIDMethod · 0.80
IMethod · 0.80
WaitForMethodEntryMethod · 0.80
AsTypeMethod · 0.80
ThisMethod · 0.80
SuperMethod · 0.80
DoMethod · 0.65
CallMethod · 0.65
IDMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected