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

Commit 6376c407 authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

Layoutlib: Update delegates for L

Update delegate method signatures for L.

Change-Id: Ie607293bcae60b2d3a61d1cad3ac5f04bda2a238
parent 4a644e39
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -757,7 +757,8 @@ public final class Canvas_Delegate {

    @LayoutlibDelegate
    /*package*/ static void native_drawRoundRect(long nativeCanvas,
            final RectF rect, final float rx, final float ry, long paint) {
            final float left, final float top, final float right, final float bottom,
            final float rx, final float ry, long paint) {

        draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                new GcSnapshot.Drawable() {
@@ -769,16 +770,16 @@ public final class Canvas_Delegate {
                        if (style == Paint.Style.FILL.nativeInt ||
                                style == Paint.Style.FILL_AND_STROKE.nativeInt) {
                            graphics.fillRoundRect(
                                    (int)rect.left, (int)rect.top,
                                    (int)rect.width(), (int)rect.height(),
                                    (int)left, (int)top,
                                    (int)(right - left), (int)(bottom - top),
                                    (int)rx, (int)ry);
                        }

                        if (style == Paint.Style.STROKE.nativeInt ||
                                style == Paint.Style.FILL_AND_STROKE.nativeInt) {
                            graphics.drawRoundRect(
                                    (int)rect.left, (int)rect.top,
                                    (int)rect.width(), (int)rect.height(),
                                    (int)left, (int)top,
                                    (int)(right - left), (int)(bottom - top),
                                    (int)rx, (int)ry);
                        }
                    }
+9 −1
Original line number Diff line number Diff line
@@ -420,13 +420,21 @@ public class Paint_Delegate {
    }

    @LayoutlibDelegate
    /*package*/ static void nSetShadowLayer(Paint thisPaint, float radius, float dx, float dy,
    /*package*/ static void native_setShadowLayer(long paint, float radius, float dx, float dy,
            int color) {
        // FIXME
        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                "Paint.setShadowLayer is not supported.", null, null /*data*/);
    }

    @LayoutlibDelegate
    /*package*/ static boolean native_hasShadowLayer(long paint) {
        // FIXME
        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                "Paint.hasShadowLayer is not supported.", null, null /*data*/);
        return false;
    }

    @LayoutlibDelegate
    /*package*/ static boolean isElegantTextHeight(Paint thisPaint) {
        return false;
+3 −12
Original line number Diff line number Diff line
@@ -317,16 +317,6 @@ public final class Path_Delegate {
        pathDelegate.close();
    }

    @LayoutlibDelegate
    /*package*/ static void native_addRect(long nPath, RectF rect, int dir) {
        Path_Delegate pathDelegate = sManager.getDelegate(nPath);
        if (pathDelegate == null) {
            return;
        }

        pathDelegate.addRect(rect.left, rect.top, rect.right, rect.bottom, dir);
    }

    @LayoutlibDelegate
    /*package*/ static void native_addRect(long nPath,
            float left, float top, float right, float bottom, int dir) {
@@ -339,14 +329,15 @@ public final class Path_Delegate {
    }

    @LayoutlibDelegate
    /*package*/ static void native_addOval(long nPath, RectF oval, int dir) {
    /*package*/ static void native_addOval(long nPath, float left, float top, float right,
            float bottom, int dir) {
        Path_Delegate pathDelegate = sManager.getDelegate(nPath);
        if (pathDelegate == null) {
            return;
        }

        pathDelegate.mPath.append(new Ellipse2D.Float(
                oval.left, oval.top, oval.width(), oval.height()), false);
                left, top, right - left, bottom - top), false);
    }

    @LayoutlibDelegate
+13 −10
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -23,26 +23,29 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import java.util.Map;

/**
 * Delegate implementing the native methods of android.os.Build
 * Delegate implementing the native methods of android.os.SystemProperties
 *
 * Through the layoutlib_create tool, the original native methods of Build have been replaced
 * by calls to methods of the same name in this delegate class.
 * Through the layoutlib_create tool, the original native methods of SystemProperties have been
 * replaced by calls to methods of the same name in this delegate class.
 *
 * Because it's a stateless class to start with, there's no need to keep a {@link DelegateManager}
 * around to map int to instance of the delegate.
 *
 */
public class Build_Delegate {
public class SystemProperties_Delegate {

    @LayoutlibDelegate
    /*package*/ static String getString(String property) {
    /*package*/ static String native_get(String key) {
        return native_get(key, "");
    }

    @LayoutlibDelegate
    /*package*/ static String native_get(String key, String def) {
        Map<String, String> properties = Bridge.getPlatformProperties();
        String value = properties.get(property);
        String value = properties.get(key);
        if (value != null) {
            return value;
        }

        return Build.UNKNOWN;
        return def;
    }

}
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ public final class CreateInfo implements ICreateInfo {
        "android.graphics.BitmapFactory#finishDecode",
        "android.os.Handler#sendMessageAtTime",
        "android.os.HandlerThread#run",
        "android.os.Build#getString",
        "android.text.format.DateFormat#is24HourFormat",
        "android.view.Choreographer#getRefreshRate",
        "android.view.Display#updateDisplayInfoLocked",
@@ -148,6 +147,7 @@ public final class CreateInfo implements ICreateInfo {
        "com.android.internal.view.menu.MenuBuilder#createNewMenuItem",
        "com.android.internal.util.XmlUtils#convertValueToInt",
        "com.android.internal.textservice.ITextServicesManager$Stub#asInterface",
        "android.os.SystemProperties#native_get",
    };

    /**