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

Commit 2a1b2396 authored by Diego Perez's avatar Diego Perez
Browse files

Update native delegates

After changes 9ff994d9, 6e3658a6 and 18e9f9f3
Test: Existing layoutlib tests

Change-Id: I8e39f26ccb0a8cb73a724f16734e66cf95c08656
parent abf19d1a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -636,6 +636,20 @@ public final class Bitmap_Delegate {
                Bitmap.getDefaultDensity());
    }

    @LayoutlibDelegate
    /*package*/ static Bitmap nativeCreateHardwareBitmap(GraphicBuffer buffer) {
        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                "Bitmap.nativeCreateHardwareBitmap() is not supported", null /*data*/);
        return null;
    }

    @LayoutlibDelegate
    /*package*/ static GraphicBuffer nativeCreateGraphicBufferHandle(long nativeBitmap) {
        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                "Bitmap.nativeCreateGraphicBufferHandle() is not supported", null /*data*/);
        return null;
    }

    // ---- Private delegate/helper methods ----

    private Bitmap_Delegate(BufferedImage image, Config config) {
+6 −1
Original line number Diff line number Diff line
@@ -313,7 +313,8 @@ public class FontFamily_Delegate {
    }

    @LayoutlibDelegate
    /*package*/ static boolean nAddFontFromAsset(long builderPtr, AssetManager mgr, String path) {
    /*package*/ static boolean nAddFontFromAssetManager(long builderPtr, AssetManager mgr, String path,
            int cookie, boolean isAsset) {
        FontFamily_Delegate ffd = sManager.getDelegate(builderPtr);
        if (ffd == null) {
            return false;
@@ -388,6 +389,10 @@ public class FontFamily_Delegate {
        return false;
    }

    @LayoutlibDelegate
    /*package*/ static void nAbort(long builderPtr) {
        sManager.removeJavaReferenceFor(builderPtr);
    }

    // ---- private helper methods ----

+15 −1
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

package android.graphics;

import android.text.FontConfig;
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.impl.DelegateManager;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;

import android.annotation.NonNull;
import android.graphics.FontFamily_Delegate.FontVariant;
import android.text.FontConfig;

import java.awt.Font;
import java.io.File;
@@ -159,6 +161,18 @@ public final class Typeface_Delegate {
                delegate.mWeight));
    }

    @LayoutlibDelegate
    /*package*/ static synchronized long nativeCreateFromTypefaceWithVariation(long native_instance,
            List<FontConfig.Axis> axes) {
        long newInstance = nativeCreateFromTypeface(native_instance, 0);

        if (newInstance != 0) {
            Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                    "nativeCreateFromTypefaceWithVariation is not supported", null, null);
        }
        return newInstance;
    }

    @LayoutlibDelegate
    /*package*/ static long nativeCreateWeightAlias(long native_instance, int weight) {
        Typeface_Delegate delegate = sManager.getDelegate(native_instance);
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public class RenderNode_Delegate {
    private String mName;

    @LayoutlibDelegate
    /*package*/ static long nCreate(RenderNode thisRenderNode, String name) {
    /*package*/ static long nCreate(String name) {
        RenderNode_Delegate renderNodeDelegate = new RenderNode_Delegate();
        renderNodeDelegate.mName = name;
        return sManager.addNewDelegate(renderNodeDelegate);