You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
api-impl: stubs and fixes for Compose Stopwatch and LibreSudoku
This commit is contained in:
@@ -253,3 +253,17 @@ JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1equals(JNIEnv *e
|
|||||||
graphene_matrix_t *matrix2 = (graphene_matrix_t *)_PTR(matrix2_ptr);
|
graphene_matrix_t *matrix2 = (graphene_matrix_t *)_PTR(matrix2_ptr);
|
||||||
return graphene_matrix_equal(matrix1, matrix2);
|
return graphene_matrix_equal(matrix1, matrix2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_android_graphics_Matrix_native_1setValues(JNIEnv *env, jclass class, jlong matrix_ptr, jfloatArray values_ref)
|
||||||
|
{
|
||||||
|
graphene_matrix_t *matrix = (graphene_matrix_t *)_PTR(matrix_ptr);
|
||||||
|
jfloat *values = (*env)->GetFloatArrayElements(env, values_ref, NULL);
|
||||||
|
float values4x4[4][4] = {
|
||||||
|
{values[android_graphics_Matrix_MSCALE_X], values[android_graphics_Matrix_MSKEW_X], 0, values[android_graphics_Matrix_MTRANS_X]},
|
||||||
|
{values[android_graphics_Matrix_MSKEW_Y], values[android_graphics_Matrix_MSCALE_Y], 0, values[android_graphics_Matrix_MTRANS_Y]},
|
||||||
|
{0, 0, 1, 0},
|
||||||
|
{values[android_graphics_Matrix_MPERSP_0], values[android_graphics_Matrix_MPERSP_1], 0, values[android_graphics_Matrix_MPERSP_2]},
|
||||||
|
};
|
||||||
|
graphene_matrix_init_from_float(matrix, *values4x4);
|
||||||
|
(*env)->ReleaseFloatArrayElements(env, values_ref, values, 0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -201,3 +201,10 @@ JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJ(JNIEnv *en
|
|||||||
sk_path_t *src = (sk_path_t *)_PTR(src_ptr);
|
sk_path_t *src = (sk_path_t *)_PTR(src_ptr);
|
||||||
sk_path_add_path(path, src, APPEND_SK_PATH_ADD_MODE);
|
sk_path_add_path(path, src, APPEND_SK_PATH_ADD_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJFF(JNIEnv *env, jclass class, jlong path_ptr, jlong src_ptr, jfloat dx, jfloat dy)
|
||||||
|
{
|
||||||
|
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||||
|
sk_path_t *src = (sk_path_t *)_PTR(src_ptr);
|
||||||
|
sk_path_add_path_offset(path, src, dx, dy, APPEND_SK_PATH_ADD_MODE);
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.Icon;
|
||||||
import android.media.AudioAttributes;
|
import android.media.AudioAttributes;
|
||||||
import android.media.session.MediaSession;
|
import android.media.session.MediaSession;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -67,6 +68,10 @@ public class Notification implements Parcelable {
|
|||||||
notification = new Notification();
|
notification = new Notification();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder(Context context, String tag) {
|
||||||
|
this(context);
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setWhen(long when) {return this;}
|
public Builder setWhen(long when) {return this;}
|
||||||
|
|
||||||
public Builder setSmallIcon(int icon, int level) {
|
public Builder setSmallIcon(int icon, int level) {
|
||||||
@@ -161,6 +166,22 @@ public class Notification implements Parcelable {
|
|||||||
|
|
||||||
public Builder setExtras(Bundle extras) {return this;}
|
public Builder setExtras(Bundle extras) {return this;}
|
||||||
|
|
||||||
|
public Builder setLargeIcon(Icon icon) {return this;}
|
||||||
|
|
||||||
|
public Builder setRemoteInputHistory(CharSequence[] history) {return this;}
|
||||||
|
|
||||||
|
public Builder setBadgeIconType(int iconType) {return this;}
|
||||||
|
|
||||||
|
public Builder setSettingsText(CharSequence settingsText) {return this;}
|
||||||
|
|
||||||
|
public Builder setShortcutId(String shortcutId) {return this;}
|
||||||
|
|
||||||
|
public Builder setTimeoutAfter(long timeout) {return this;}
|
||||||
|
|
||||||
|
public Builder setGroupAlertBehavior(int groupAlertBehavior) {return this;}
|
||||||
|
|
||||||
|
public Builder setSound(Uri sound) {return this;}
|
||||||
|
|
||||||
public Notification build() {
|
public Notification build() {
|
||||||
return notification;
|
return notification;
|
||||||
}
|
}
|
||||||
@@ -186,10 +207,16 @@ public class Notification implements Parcelable {
|
|||||||
action.intent = intent;
|
action.intent = intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder(Icon icon, CharSequence title, PendingIntent intent) {
|
||||||
|
this(0, title, intent);
|
||||||
|
}
|
||||||
|
|
||||||
public Builder addExtras(Bundle extras) {return this;}
|
public Builder addExtras(Bundle extras) {return this;}
|
||||||
|
|
||||||
public Builder addRemoteInput(RemoteInput remoteInput) {return this;}
|
public Builder addRemoteInput(RemoteInput remoteInput) {return this;}
|
||||||
|
|
||||||
|
public Builder setAllowGeneratedReplies(boolean allowGeneratedReplies) {return this;}
|
||||||
|
|
||||||
public Action build() {
|
public Action build() {
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/api-impl/android/app/NotificationChannel.java
Normal file
6
src/api-impl/android/app/NotificationChannel.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package android.app;
|
||||||
|
|
||||||
|
public class NotificationChannel {
|
||||||
|
|
||||||
|
public NotificationChannel(String id, CharSequence name, int importance) {}
|
||||||
|
}
|
||||||
@@ -98,6 +98,8 @@ public class NotificationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createNotificationChannel(NotificationChannel channel) {}
|
||||||
|
|
||||||
protected native long nativeInitBuilder();
|
protected native long nativeInitBuilder();
|
||||||
protected native void nativeAddAction(long builder, String title, int intentType, String action, String className);
|
protected native void nativeAddAction(long builder, String title, int intentType, String action, String className);
|
||||||
protected native void nativeShowNotification(long builder, int id, String title, String text, String iconPath, boolean ongoing, int intentType, String action, String className);
|
protected native void nativeShowNotification(long builder, int id, String title, String text, String iconPath, boolean ongoing, int intentType, String action, String className);
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ public abstract class Service extends Context {
|
|||||||
System.out.println("stopForeground(" + remove + ") called");
|
System.out.println("stopForeground(" + remove + ") called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopForeground(int remove) {
|
||||||
|
System.out.println("stopForeground(" + remove + ") called");
|
||||||
|
}
|
||||||
|
|
||||||
public Application getApplication() {
|
public Application getApplication() {
|
||||||
return this_application;
|
return this_application;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,8 +231,8 @@ public class Context extends Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final <T> T getSystemService(Class<T> serviceClass) {
|
public final Object getSystemService(Class<?> serviceClass) throws InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||||
return null;
|
return serviceClass.getConstructors()[0].newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
|
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
|
||||||
|
|||||||
@@ -489,7 +489,11 @@ public final class Bitmap {
|
|||||||
* This configuration is very flexible and offers the best
|
* This configuration is very flexible and offers the best
|
||||||
* quality. It should be used whenever possible.
|
* quality. It should be used whenever possible.
|
||||||
*/
|
*/
|
||||||
ARGB_8888(5);
|
ARGB_8888(5),
|
||||||
|
|
||||||
|
RGBA_F16(6),
|
||||||
|
|
||||||
|
HARDWARE(7);
|
||||||
|
|
||||||
final int nativeInt;
|
final int nativeInt;
|
||||||
|
|
||||||
@@ -602,9 +606,9 @@ public final class Bitmap {
|
|||||||
*/
|
*/
|
||||||
public Bitmap copy(Config config, boolean isMutable) {
|
public Bitmap copy(Config config, boolean isMutable) {
|
||||||
checkRecycled("Can't copy a recycled bitmap");
|
checkRecycled("Can't copy a recycled bitmap");
|
||||||
Bitmap b = nativeCopy(mNativeBitmap, config.nativeInt, isMutable);
|
Bitmap b = new Bitmap(native_copy(pixbuf));
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
b.setAlphaAndPremultiplied(hasAlpha(), mIsPremultiplied);
|
// b.setAlphaAndPremultiplied(hasAlpha(), mIsPremultiplied);
|
||||||
b.mDensity = mDensity;
|
b.mDensity = mDensity;
|
||||||
}
|
}
|
||||||
return b;
|
return b;
|
||||||
@@ -979,6 +983,10 @@ public final class Bitmap {
|
|||||||
return createBitmap(display, colors, 0, width, width, height, config);
|
return createBitmap(display, colors, 0, width, width, height, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Bitmap createBitmap(DisplayMetrics display, int width, int height, Config config, boolean hasAlpha, ColorSpace colorSpace) {
|
||||||
|
return createBitmap(display, width, height, config, hasAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an optional array of private data, used by the UI system for
|
* Returns an optional array of private data, used by the UI system for
|
||||||
* some bitmaps. Not intended to be called by applications.
|
* some bitmaps. Not intended to be called by applications.
|
||||||
|
|||||||
13
src/api-impl/android/graphics/ColorSpace.java
Normal file
13
src/api-impl/android/graphics/ColorSpace.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package android.graphics;
|
||||||
|
|
||||||
|
public class ColorSpace {
|
||||||
|
|
||||||
|
public static enum Named {
|
||||||
|
SRGB,
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ColorSpace get(Named named) {
|
||||||
|
return new ColorSpace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,4 +7,6 @@ public class Outline {
|
|||||||
public void setEmpty() {}
|
public void setEmpty() {}
|
||||||
|
|
||||||
public void setRoundRect(int left, int top, int right, int bottom, float r) {}
|
public void setRoundRect(int left, int top, int right, int bottom, float r) {}
|
||||||
|
|
||||||
|
public void setRect(int left, int top, int right, int bottom) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -670,6 +670,10 @@ public class Path {
|
|||||||
final long ni() {
|
final long ni() {
|
||||||
return mNativePath;
|
return mNativePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isConvex() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
private static native long init1();
|
private static native long init1();
|
||||||
private static native long init2(long nPath);
|
private static native long init2(long nPath);
|
||||||
private static native void native_reset(long nPath);
|
private static native void native_reset(long nPath);
|
||||||
|
|||||||
@@ -3,4 +3,14 @@ package android.graphics;
|
|||||||
public class PathMeasure {
|
public class PathMeasure {
|
||||||
public PathMeasure(Path path, boolean dummy) {
|
public PathMeasure(Path path, boolean dummy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPath(Path path, boolean forceClosed) {}
|
||||||
|
|
||||||
|
public float getLength() {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSegment(float start, float end, Path dst, boolean forceClosed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/api-impl/android/graphics/drawable/Icon.java
Normal file
8
src/api-impl/android/graphics/drawable/Icon.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package android.graphics.drawable;
|
||||||
|
|
||||||
|
public class Icon {
|
||||||
|
|
||||||
|
public static Icon createWithResource(String packageName, int resourceId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,4 +10,6 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
|
|
||||||
public void setColor(ColorStateList colorStateList) {}
|
public void setColor(ColorStateList colorStateList) {}
|
||||||
|
|
||||||
|
public void setRadius(int radius) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,4 +302,25 @@ public class BaseBundle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value associated with the given key, or null if
|
||||||
|
* no mapping of the desired type exists for the given key or a null
|
||||||
|
* value is explicitly associated with the key.
|
||||||
|
*
|
||||||
|
* @param key a String, or null
|
||||||
|
* @return an int[] value, or null
|
||||||
|
*/
|
||||||
|
public int[] getIntArray(String key) {
|
||||||
|
Object o = mMap.get(key);
|
||||||
|
if (o == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return (int[])o;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
typeWarning(key, o, "int[]", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1042,27 +1042,6 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value associated with the given key, or null if
|
|
||||||
* no mapping of the desired type exists for the given key or a null
|
|
||||||
* value is explicitly associated with the key.
|
|
||||||
*
|
|
||||||
* @param key a String, or null
|
|
||||||
* @return an int[] value, or null
|
|
||||||
*/
|
|
||||||
public int[] getIntArray(String key) {
|
|
||||||
Object o = mMap.get(key);
|
|
||||||
if (o == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return (int[])o;
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
typeWarning(key, o, "int[]", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value associated with the given key, or null if
|
* Returns the value associated with the given key, or null if
|
||||||
* no mapping of the desired type exists for the given key or a null
|
* no mapping of the desired type exists for the given key or a null
|
||||||
|
|||||||
13
src/api-impl/android/os/VibrationEffect.java
Normal file
13
src/api-impl/android/os/VibrationEffect.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package android.os;
|
||||||
|
|
||||||
|
public class VibrationEffect {
|
||||||
|
|
||||||
|
public static VibrationEffect createOneShot(long milliseconds, int amplitude) {
|
||||||
|
return new VibrationEffect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VibrationEffect createWaveform(long[] pattern, int repeat) {
|
||||||
|
return new VibrationEffect();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,6 +21,10 @@ public class Html {
|
|||||||
// TODO when JTidy is in use: s/<br \/>//g
|
// TODO when JTidy is in use: s/<br \/>//g
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Spanned fromHtml(String source, ImageGetter imageGetter, TagHandler tagHandler) {
|
||||||
|
return fromHtml(source, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public static String escapeHtml(CharSequence source) {
|
public static String escapeHtml(CharSequence source) {
|
||||||
StringBuilder out = new StringBuilder(source.length());
|
StringBuilder out = new StringBuilder(source.length());
|
||||||
for (int i = 0; i < source.length(); i++) {
|
for (int i = 0; i < source.length(); i++) {
|
||||||
|
|||||||
@@ -11,14 +11,38 @@ public class StaticLayout extends Layout {
|
|||||||
super(source, paint, outerwidth, align, spacingmult, spacingadd);
|
super(source, paint, outerwidth, align, spacingmult, spacingadd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public static class Builder {
|
||||||
return 200; // arbitrary value for stub method
|
private StaticLayout layout;
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeight() {
|
public static Builder obtain(CharSequence source, int bufstart, int bufend, TextPaint paint, int outerwidth) {
|
||||||
return 50; // arbitrary value for stub method
|
Builder builder = new Builder();
|
||||||
}
|
builder.layout = new StaticLayout(source, bufstart, bufend, paint, outerwidth, null, null, 0, 0, false, null, 0, 0);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
public float getLineLeft(int line) {return 0;}
|
public Builder setTextDirection(TextDirectionHeuristic textDir) {return this;}
|
||||||
|
|
||||||
|
public Builder setAlignment(Alignment align) {return this;}
|
||||||
|
|
||||||
|
public Builder setMaxLines(int maxLines) {return this;}
|
||||||
|
|
||||||
|
public Builder setEllipsize(TextUtils.TruncateAt ellipsize) {return this;}
|
||||||
|
|
||||||
|
public Builder setEllipsizedWidth(int ellipsizedWidth) {return this;}
|
||||||
|
|
||||||
|
public Builder setLineSpacing(float add, float mult) {return this;}
|
||||||
|
|
||||||
|
public Builder setIncludePad(boolean includepad) {return this;}
|
||||||
|
|
||||||
|
public Builder setBreakStrategy(int strategy) {return this;}
|
||||||
|
|
||||||
|
public Builder setHyphenationFrequency(int hyphenationFrequency) {return this;}
|
||||||
|
|
||||||
|
public Builder setIndents(int[] indents, int[] widths) {return this;}
|
||||||
|
|
||||||
|
public Builder setJustificationMode(int mode) {return this;}
|
||||||
|
|
||||||
|
public StaticLayout build() {return layout;}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2727,7 +2727,8 @@ public final class MotionEvent extends InputEvent {
|
|||||||
* Sets this event's action.
|
* Sets this event's action.
|
||||||
*/
|
*/
|
||||||
public final void setAction(int action) {
|
public final void setAction(int action) {
|
||||||
nativeSetAction(mNativePtr, action);
|
// nativeSetAction(mNativePtr, action);
|
||||||
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user