Shrink surfaceflinger

Before we make it huge with skia, first make it a lot smaller

* Remove unnecessary libsurfaceflinger dependency in unit tests
Since the unit tests include the entire source of the shared
library anyway, depending on them as a prebuilt is redundant.
And also undefined behavior (ODR violation).

* Remove libsurfaceflinger entirely
Build a fat surfacefligner binary instead. This avoids building
both a 32-bit & 64-bit shared library pointlessly, cutting size
in half alone. It also reduces exported symbols.

* Remove obsolete ld export-dynamic option
This was added for sigchain workarounds, but since then the
usage of sigchain itself was removed. This option is therefore
obsolete, shaving even more binary size.

Before:
$ find $OUT/system -name '*surfaceflinger*' | xargs ls -sh
 16K system/bin/surfaceflinger
4.0K system/etc/init/surfaceflinger.rc
2.2M system/lib64/libsurfaceflinger.so
1.5M system/lib/libsurfaceflinger.so

After:
$ find $OUT/system -name '*surfaceflinger*' | xargs ls -sh
1.8M system/bin/surfaceflinger
4.0K system/etc/init/surfaceflinger.rc

Net savings of around 2M

Test: builds, boots, atest libsurfaceflinger_unittest
Change-Id: Ibd43e25aa67027edc0ccc5b5e50edb5b5f2169ca
diff --git a/services/surfaceflinger/Android.bp b/services/surfaceflinger/Android.bp
index b039f6e..40e445b 100644
--- a/services/surfaceflinger/Android.bp
+++ b/services/surfaceflinger/Android.bp
@@ -186,22 +186,18 @@
     ],
 }
 
-cc_library_shared {
-    // Please use libsurfaceflinger_defaults to configure how the sources are
-    // built, so the same settings can be used elsewhere.
-    name: "libsurfaceflinger",
-    defaults: ["libsurfaceflinger_production_defaults"],
-    srcs: [
-        ":libsurfaceflinger_sources",
-
-        // Note: SurfaceFlingerFactory is not in the default sources so that it
-        // can be easily replaced.
-        "SurfaceFlingerFactory.cpp",
+cc_defaults {
+    name: "libsurfaceflinger_binary",
+    defaults: [
+        "surfaceflinger_defaults",
+        "libsurfaceflinger_production_defaults",
     ],
     cflags: [
+        "-DLOG_TAG=\"SurfaceFlinger\"",
         "-DUSE_VR_COMPOSER=1",
     ],
     // VrComposer is not used when building surfaceflinger for vendors
+    // TODO: Is this ever built for vendors?
     target: {
         vendor: {
             cflags: [
@@ -209,15 +205,6 @@
             ],
         },
     },
-    logtags: ["EventLog/EventLogTags.logtags"],
-}
-
-cc_defaults {
-    name: "libsurfaceflinger_binary",
-    defaults: ["surfaceflinger_defaults"],
-    cflags: [
-        "-DLOG_TAG=\"SurfaceFlinger\"",
-    ],
     shared_libs: [
         "android.frameworks.displayservice@1.0",
         "android.hardware.configstore-utils",
@@ -239,12 +226,18 @@
         "libserviceutils",
         "libtrace_proto",
     ],
-    ldflags: ["-Wl,--export-dynamic"],
+    logtags: ["EventLog/EventLogTags.logtags"],
 }
 
 filegroup {
     name: "surfaceflinger_binary_sources",
-    srcs: ["main_surfaceflinger.cpp"],
+    srcs: [
+        ":libsurfaceflinger_sources",
+        // Note: SurfaceFlingerFactory is not in the default sources so that it
+        // can be easily replaced.
+        "SurfaceFlingerFactory.cpp",
+        "main_surfaceflinger.cpp"
+    ],
 }
 
 cc_binary {
@@ -253,7 +246,6 @@
     init_rc: ["surfaceflinger.rc"],
     srcs: [":surfaceflinger_binary_sources"],
     shared_libs: [
-        "libsurfaceflinger",
         "libSurfaceFlingerProp",
     ],
 }