Do not propagate dynamic dependencies for stub libs.

Test: m nothing
Test: Build an SDK snapshot including libc, check that the generated
  cc_prebuilt_library_shared for it is a stub that doesn't depend on
  ld-android.
Bug: 152255951
Bug: 154310674
Change-Id: Ie5ec02aebdf00b75756a6eda40db821488d30065
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 754b96a..953e85f 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -375,7 +375,10 @@
 		specifiedDeps := specifiedDeps{}
 		specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
 
-		p.SharedLibs = specifiedDeps.sharedLibs
+		if !ccModule.HasStubsVariants() {
+			// Propagate dynamic dependencies for implementation libs, but not stubs.
+			p.SharedLibs = specifiedDeps.sharedLibs
+		}
 		p.SystemSharedLibs = specifiedDeps.systemSharedLibs
 	}
 	p.exportedGeneratedHeaders = ccModule.ExportedGeneratedHeaders()