Revert "Revert "Revert "Revert "Export static libraries.""""

This reverts commit 555c1142838937c63b7cfd5a4a757c7d39d4422f.

Reason for revert: The namespace issue in the pi-dev-plus-aosp-without-vendor branch is now fixed.

Change-Id: I26ed591447797a8ee505f43bdd209162418b6c5e
diff --git a/cc/cc_test.go b/cc/cc_test.go
index d6ffe51..3e78ec7 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -1545,6 +1545,43 @@
 	checkRuntimeLibs(t, []string{"libvendor_available1", "libvendor1"}, module)
 }
 
+func checkStaticLibs(t *testing.T, expected []string, module *Module) {
+	actual := module.Properties.AndroidMkStaticLibs
+	if !reflect.DeepEqual(actual, expected) {
+		t.Errorf("incorrect static_libs"+
+			"\nactual:   %v"+
+			"\nexpected: %v",
+			actual,
+			expected,
+		)
+	}
+}
+
+const staticLibAndroidBp = `
+	cc_library {
+		name: "lib1",
+	}
+	cc_library {
+		name: "lib2",
+		static_libs: ["lib1"],
+	}
+`
+
+func TestStaticLibDepExport(t *testing.T) {
+	ctx := testCc(t, staticLibAndroidBp)
+
+	// Check the shared version of lib2.
+	variant := "android_arm64_armv8-a_core_shared"
+	module := ctx.ModuleForTests("lib2", variant).Module().(*Module)
+	checkStaticLibs(t, []string{"lib1", "libclang_rt.builtins-aarch64-android", "libatomic", "libgcc"}, module)
+
+	// Check the static version of lib2.
+	variant = "android_arm64_armv8-a_core_static"
+	module = ctx.ModuleForTests("lib2", variant).Module().(*Module)
+	// libc++_static is linked additionally.
+	checkStaticLibs(t, []string{"lib1", "libc++_static", "libclang_rt.builtins-aarch64-android", "libatomic", "libgcc"}, module)
+}
+
 var compilerFlagsTestCases = []struct {
 	in  string
 	out bool