Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c5d6343 authored by Derek Sollenberger's avatar Derek Sollenberger
Browse files

Create a version_script to explicitly define exported symbols for libhwui

The linker script defines both the C and C++ headers exported by libhwui
and libskia (included via whole_static_libs).  Reducing the surface
area makes it clear what libhwui's external dependencies are as well
as reducing the binary size by about ~12% (1.04 MB on 64-bit and 789KB
on 32-bit builds for the Pixel 3a in userdebug).

Test: compiles and links
Bug: 150782769
Change-Id: Ia202a12c1605c851c52d953f0db0f4814ade8dfd
parent 19a92e7e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -603,6 +603,11 @@ cc_library {
        "android_graphics_jni",
    ],
    export_header_lib_headers: ["android_graphics_apex_headers"],
    target: {
        android: {
            version_script: "libhwui.map.txt",
        }
    },
}

cc_library_static {
+70 −0
Original line number Diff line number Diff line
LIBHWUI {
  global:
    /* listing of all C APIs to be exposed by libhwui to consumers outside of the module */
    ABitmap_getInfoFromJava;
    ABitmap_acquireBitmapFromJava;
    ABitmap_copy;
    ABitmap_acquireRef;
    ABitmap_releaseRef;
    ABitmap_getInfo;
    ABitmap_getDataSpace;
    ABitmap_getPixels;
    ABitmap_notifyPixelsChanged;
    ABitmapConfig_getFormatFromConfig;
    ABitmapConfig_getConfigFromFormat;
    ABitmap_compress;
    ABitmap_getHardwareBuffer;
    ACanvas_isSupportedPixelFormat;
    ACanvas_getNativeHandleFromJava;
    ACanvas_createCanvas;
    ACanvas_destroyCanvas;
    ACanvas_setBuffer;
    ACanvas_clipRect;
    ACanvas_clipOutRect;
    ACanvas_drawRect;
    ACanvas_drawBitmap;
    init_android_graphics;
    register_android_graphics_classes;
    register_android_graphics_GraphicsStatsService;
    zygote_preload_graphics;
    AMatrix_getContents;
    APaint_createPaint;
    APaint_destroyPaint;
    APaint_setBlendMode;
    ARegionIterator_acquireIterator;
    ARegionIterator_releaseIterator;
    ARegionIterator_isComplex;
    ARegionIterator_isDone;
    ARegionIterator_next;
    ARegionIterator_getRect;
    ARegionIterator_getTotalBounds;
    ARenderThread_dumpGraphicsMemory;
  local:
    *;
};

LIBHWUI_PLATFORM {
  global:
    extern "C++" {
      /* required by libwebviewchromium_plat_support */
      android::uirenderer::ColorSpaceToADataSpace*;
      android::uirenderer::WebViewFunctor_*;
      GraphicsJNI::getNativeCanvas*;
      SkCanvasStateUtils::ReleaseCanvasState*;
      SkColorSpace::toXYZD50*;
      SkColorSpace::transferFn*;
      /* required by libjnigraphics */
      android::ImageDecoder::*;
      android::uirenderer::DataSpaceToColorSpace*;
      android::uirenderer::ColorSpaceToADataSpace*;
      getMimeType*;
      SkAndroidCodec::*;
      SkCodec::MakeFromStream*;
      SkColorInfo::*;
      SkFILEStream::SkFILEStream*;
      SkImageInfo::*;
      SkMemoryStream::SkMemoryStream*;
    };
  local:
    *;
};