@@ -32,6 +32,10 @@ const (
3232 // concatenation so that automated sweeps do not break source
3333 // scanning logic that must still match existing generated code.
3434 legacyInterfaceType = "interface" + "{}"
35+
36+ // svcProxyVarPrefix is the "svcProxy." prefix used when scanning
37+ // generated Go source to locate proxy method calls.
38+ svcProxyVarPrefix = "svcProxy."
3539)
3640
3741// primitiveTypes maps Go type names to cobra flag helpers.
@@ -831,9 +835,9 @@ func findMethodKeyForLine(lines []string, lineNo int) string {
831835 for i := lineNo - 1 ; i < len (lines ) && i < lineNo + 200 ; i ++ {
832836 line := strings .TrimSpace (lines [i ])
833837 if strings .HasPrefix (line , "result" ) || strings .HasPrefix (line , "err" ) || strings .HasPrefix (line , "_, err" ) {
834- if strings .Contains (line , "svcProxy." ) {
835- idx := strings .Index (line , "svcProxy." )
836- rest := line [idx + len ("svcProxy." ):]
838+ if strings .Contains (line , svcProxyVarPrefix ) {
839+ idx := strings .Index (line , svcProxyVarPrefix )
840+ rest := line [idx + len (svcProxyVarPrefix ):]
837841 if paren := strings .Index (rest , "(" ); paren > 0 {
838842 methodName = rest [:paren ]
839843 break
@@ -846,9 +850,9 @@ func findMethodKeyForLine(lines []string, lineNo int) string {
846850 if methodName == "" {
847851 for i := lineNo - 1 ; i >= 0 && i > lineNo - 200 ; i -- {
848852 line := strings .TrimSpace (lines [i ])
849- if strings .Contains (line , "svcProxy." ) && ! strings .HasPrefix (line , "svcProxy :=" ) {
850- idx := strings .Index (line , "svcProxy." )
851- rest := line [idx + len ("svcProxy." ):]
853+ if strings .Contains (line , svcProxyVarPrefix ) && ! strings .HasPrefix (line , "svcProxy :=" ) {
854+ idx := strings .Index (line , svcProxyVarPrefix )
855+ rest := line [idx + len (svcProxyVarPrefix ):]
852856 if paren := strings .Index (rest , "(" ); paren > 0 {
853857 methodName = rest [:paren ]
854858 break
@@ -955,31 +959,6 @@ func typeRefToGoType(
955959 ts := typeRefToTypeSpecifier (tr )
956960 goType := codegen .AIDLTypeToGo (ts )
957961
958- // If the type is a user-defined type (not primitive, not generic),
959- // we need to check if it's a cross-package reference. The AIDL type
960- // name in the spec is fully qualified (e.g., "android.app.ProcessMemoryState")
961- // for cross-package types, or short (e.g., "ProcessMemoryState") for same-package.
962- if goType != "" && ! isPrimitiveGoType (goType ) {
963- // Strip pointer/slice prefixes for analysis.
964- bare := goType
965- prefix := ""
966- for strings .HasPrefix (bare , "*" ) || strings .HasPrefix (bare , "[]" ) {
967- if strings .HasPrefix (bare , "*" ) {
968- prefix += "*"
969- bare = bare [1 :]
970- } else {
971- prefix += "[]"
972- bare = bare [2 :]
973- }
974- }
975-
976- // If the bare type doesn't contain a dot but the original AIDL name
977- // was fully qualified and from a different package, we just use the
978- // Go-converted name as-is since the generated Go proxy file will
979- // use unqualified names for same-package types.
980- _ = prefix
981- }
982-
983962 return goType
984963}
985964
@@ -1066,6 +1045,7 @@ func convertInterfaceSpec(
10661045// identityParamNames maps AIDL parameter names that represent caller
10671046// identity to their expected AIDL types. These parameters are auto-filled
10681047// by the generated Go proxy and are NOT included in the Go method signature.
1048+ // TODO: unify with codegen.identityParamNames
10691049var identityParamNames = map [string ]string {
10701050 "callingPackage" : "String" ,
10711051 "opPackageName" : "String" ,
0 commit comments