api-impl: misc stubs, additions and fixes

This commit is contained in:
Mis012 2024-12-20 00:11:06 +01:00
parent df5390db5e
commit 58745f23ea
9 changed files with 69 additions and 20 deletions

View file

@ -218,10 +218,10 @@ JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addArc
/*
* Class: android_graphics_Path
* Method: native_addRoundRect
* Signature: (JLandroid/graphics/RectF;FFI)V
* Signature: (JFFFFFFI)V
*/
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JLandroid_graphics_RectF_2FFI
(JNIEnv *, jclass, jlong, jobject, jfloat, jfloat, jint);
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JFFFFFFI
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jint);
/*
* Class: android_graphics_Path

View file

@ -167,6 +167,12 @@ JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rMoveTo(JNIEnv *env, j
sk_path_rmove_to(path, dx, dy);
}
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JFFFFFFI(JNIEnv *env, jclass class, jlong path_ptr, jfloat left, jfloat top, jfloat right, jfloat bottom, jfloat rx, jfloat ry, jint dir)
{
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
sk_path_add_rounded_rect(path, &(sk_rect_t){left, top, right, bottom}, rx, ry, (sk_path_direction_t)dir);
}
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JLandroid_graphics_RectF_2_3FI(JNIEnv *env, jclass class, jlong path_ptr, jobject rect, jfloatArray radii, jint dir)
{
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);

View file

@ -275,6 +275,10 @@ public class Paint {
return new Shader();
}
public PathEffect getPathEffect() {
return new PathEffect();
}
public PathEffect setPathEffect(PathEffect effect) {
return effect;
}

View file

@ -534,6 +534,19 @@ public class Path {
isSimplePath = false;
native_addArc(mNativePath, oval, startAngle, sweepAngle);
}
/**
* Add a closed round-rectangle contour to the path
*
* @param rx The x-radius of the rounded corners on the round-rectangle
* @param ry The y-radius of the rounded corners on the round-rectangle
* @param dir The direction to wind the round-rectangle's contour
*
*/
public void addRoundRect(float left, float top, float right, float bottom, float rx, float ry, Direction dir) {
native_addRoundRect(mNativePath, left, top, right, bottom, rx, ry, dir.nativeInt);
}
/**
* Add a closed round-rectangle contour to the path
*
@ -547,7 +560,7 @@ public class Path {
throw new NullPointerException("need rect parameter");
}
isSimplePath = false;
native_addRoundRect(mNativePath, rect, rx, ry, dir.nativeInt);
addRoundRect(rect.left, rect.top, rect.right, rect.bottom, rx, ry, dir);
}
/**
@ -707,7 +720,7 @@ public class Path {
private static native void native_addCircle(long nPath, float x, float y, float radius, int dir);
private static native void native_addArc(long nPath, RectF oval,
float startAngle, float sweepAngle);
private static native void native_addRoundRect(long nPath, RectF rect,
private static native void native_addRoundRect(long nPath, float left, float top, float right, float bottom,
float rx, float ry, int dir);
private static native void native_addRoundRect(long nPath, RectF r, float[] radii, int dir);
private static native void native_addPath(long nPath, long src, float dx, float dy);

View file

@ -47,7 +47,7 @@ public class Typeface {
}
public static Typeface create(Typeface typeface, int style) {
return typeface;
return typeface != null ? typeface : DEFAULT;
}
public static Typeface createFromFile(String path) {

View file

@ -896,12 +896,16 @@ public class View implements Drawable.Callback {
}
public View(Context context, AttributeSet attrs, int defStyle) {
this(context, attrs, defStyle, 0);
}
public View(Context context, AttributeSet attrs, int defStyle, int defStyleRes) {
this.context = context;
widget = native_constructor(context, attrs);
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View, defStyle, 0);
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View, defStyle, defStyleRes);
this.id = a.getResourceId(com.android.internal.R.styleable.View_id, View.NO_ID);
if (a.hasValue(com.android.internal.R.styleable.View_background)) {
try {
@ -927,7 +931,7 @@ public class View implements Drawable.Callback {
}
int padding = a.getDimensionPixelSize(com.android.internal.R.styleable.View_padding, -1);
int paddingVertical = a.getDimensionPixelSize(com.android.internal.R.styleable.View_paddingVertical, -1);
int paddingHorizontal = a.getDimensionPixelSize(com.android.internal.R.styleable.View_paddingHorizontal, -1);
@ -974,7 +978,7 @@ public class View implements Drawable.Callback {
int textAlignment = a.getInt(com.android.internal.R.styleable.View_textAlignment, 0);
setTextAlignment(textAlignment);
}
a.recycle();
}
onCreateDrawableState(0);
@ -2095,4 +2099,7 @@ public class View implements Drawable.Callback {
public void setPointerIcon(PointerIcon pointerIcon) {}
public IBinder getApplicationWindowToken() {return null;}
public int getVerticalFadingEdgeLength() {return 0;}
public int getVerticalScrollbarWidth() {return 0;}
}

View file

@ -6,7 +6,9 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.GskCanvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Slog;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;
@ -357,8 +359,11 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
public void setClipToPadding(boolean clipToPadding) {}
public View findViewById(int id) {
if (this.id == id)
Slog.v(TAG, "findViewById: looking for id: " + String.format("%x", id) + "(" + getResources().getResourceName(id) + ")" + " | checking: " + this + ",id: " + String.format("%x", this.getId()) + ", id_str: " + this.getIdName());
if (this.id == id) {
Slog.v(TAG, "findViewById: found: "+this+" | id: " + String.format("%x", this.getId()) + ", id_str: " + this.getIdName());
return this;
}
for (View child: children) {
View result = child.findViewById(id);
if (result != null)
@ -409,6 +414,14 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
}
}
public void offsetChildrenTopAndBottom(int offset) {
// FIXME
}
public final void offsetDescendantRectToMyCoords(View descendant, Rect rect) {
// FIXME
}
public static class LayoutParams {
public static final int FILL_PARENT = -1;
public static final int MATCH_PARENT = -1;
@ -525,7 +538,7 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
}
}
}
a.recycle();
}

View file

@ -2,13 +2,15 @@ package android.view.accessibility;
public class AccessibilityNodeInfo {
public static final class AccessibilityAction {
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SHOW_ON_SCREEN = new AccessibilityAction(0, null);
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_TO_POSITION = new AccessibilityAction(0, null);
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_UP = new AccessibilityAction(0, null);
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_LEFT = new AccessibilityAction(0, null);
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_RIGHT = new AccessibilityAction(0, null);
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_DOWN = new AccessibilityAction(0, null);
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CONTEXT_CLICK = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_CONTEXT_CLICK = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_SET_PROGRESS = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_SHOW_ON_SCREEN = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_SCROLL_TO_POSITION = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_SCROLL_UP = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_SCROLL_LEFT = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_SCROLL_RIGHT = new AccessibilityAction(0, null);
public static final AccessibilityAction ACTION_SCROLL_DOWN = new AccessibilityAction(0, null);
public AccessibilityAction(int actionId, CharSequence label) {}

View file

@ -29,7 +29,11 @@ public class ImageView extends View {
}
public ImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this(context, attrs, defStyleAttr, 0);
}
public ImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
haveCustomMeasure = false;
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ImageView, defStyleAttr, 0);
@ -65,7 +69,7 @@ public class ImageView extends View {
}
public void setImageDrawable(Drawable drawable) {
if (colorFilter != null) {
if (drawable != null && colorFilter != null) {
drawable = drawable.mutate();
drawable.setColorFilter(colorFilter);
}