fix: Override vndk-ext lib name with original lib

vndk-ext should have the same output filename with the lib which it
extends. "extends" property is "module name", not "filename" of output.

Bug: 143130384
Test: add "protox" as a vndk-ext module (extends 'libprotobuf-cpp-full')
      m protox.vendor && check output filename under /vendor/lib/vndk/
      (should have correct suffix)

Change-Id: I5741ea87b4f2ad375b69f54c93dcb8753d9952dd
diff --git a/cc/library.go b/cc/library.go
index 80dc76c..829c617 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -599,7 +599,11 @@
 	name += suffix
 
 	if ctx.isVndkExt() {
-		name = ctx.getVndkExtendsModuleName()
+		// vndk-ext lib should have the same name with original lib
+		ctx.VisitDirectDepsWithTag(vndkExtDepTag, func(module android.Module) {
+			originalName := module.(*Module).outputFile.Path()
+			name = strings.TrimSuffix(originalName.Base(), originalName.Ext())
+		})
 	}
 
 	if ctx.Host() && Bool(library.Properties.Unique_host_soname) {