api-impl: misc additions for Oeffi

This commit is contained in:
Julian Winkler 2024-11-22 18:02:54 +01:00 committed by Mis012
parent 7626992241
commit f53ad02e6f
32 changed files with 265 additions and 15 deletions

View file

@ -233,3 +233,16 @@ JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1preTranslate(JNI
graphene_matrix_multiply(&translation, matrix, matrix);
return true;
}
JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1preRotate__JFFF(JNIEnv *env, jclass class, jlong matrix_ptr, jfloat degrees, jfloat px, jfloat py)
{
graphene_matrix_t *matrix = (graphene_matrix_t *)_PTR(matrix_ptr);
graphene_matrix_t rotation;
graphene_vec3_t rotation_axis;
graphene_vec3_init(&rotation_axis, 0, 0, 1);
graphene_matrix_init_rotate(&rotation, degrees, &rotation_axis);
graphene_matrix_translate(&rotation, &GRAPHENE_POINT3D_INIT(-px, -py, 0));
graphene_matrix_multiply(&rotation, matrix, matrix);
graphene_matrix_translate(matrix, &GRAPHENE_POINT3D_INIT(px, py, 0));
return true;
}

View file

@ -5,7 +5,7 @@ import android.content.Context;
public class AnimatorInflater {
public static Animator loadAnimator(Context context, int resId) {
return new ObjectAnimator();
return new AnimatorSet();
}
public static StateListAnimator loadStateListAnimator(Context context, int resId) {

View file

@ -2,4 +2,7 @@ package android.animation;
public class LayoutTransition {
public void enableTransitionType(int transitionType) {}
public void setStartDelay(int transitionType, long startDelay) {}
}

View file

@ -378,6 +378,10 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
dialog.show();
}
public boolean showDialog(int id, Bundle args) {
return false;
}
public void removeDialog(int id) {
Dialog dialog = dialogs.remove(id);
if (dialog != null)
@ -388,9 +392,9 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (window != null) {
if (window != null && window.native_window != 0) {
nativeFinish(getWindow().native_window);
window = null;
window.native_window = 0;
}
}
});
@ -575,4 +579,5 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
public Uri getReferrer() { return null; }
public void setDefaultKeyMode(int flag) {}
public void registerForContextMenu(View view) {}
public boolean isInMultiWindowMode() { return true; }
}

View file

@ -78,4 +78,6 @@ public class ActivityManager {
throws SecurityException {
return new ArrayList<>();
}
public int getLargeMemoryClass() {return getMemoryClass();}
}

View file

@ -35,6 +35,10 @@ public class AlertDialog extends Dialog implements DialogInterface {
dialog = new AlertDialog(context);
}
public Builder(Context context, int themeResId) {
dialog = new AlertDialog(context, themeResId);
}
public AlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) {
return setPositiveButton(dialog.getContext().getText(textId), listener);
}
@ -92,6 +96,10 @@ public class AlertDialog extends Dialog implements DialogInterface {
return this;
}
public AlertDialog.Builder setItems(int itemsId, final DialogInterface.OnClickListener listener) {
return setItems(dialog.getContext().getResources().getTextArray(itemsId), listener);
}
public Builder setOnCancelListener(OnCancelListener onCancelListener) {
return this;
}

View file

@ -13,4 +13,8 @@ public class ProgressDialog extends AlertDialog {
}
public void setIndeterminate(boolean indeterminate) {}
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, OnCancelListener cancelListener) {
return new ProgressDialog(context);
}
}

View file

@ -31,13 +31,15 @@ public abstract class ContentProvider {
public boolean onCreate() {return false;}
public Context getContext() {
return new Context();
return Context.this_application;
}
public abstract Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder);
public abstract Uri insert(Uri uri, ContentValues values);
public abstract int update(Uri uri, ContentValues values, String selection, String[] selectionArgs);
public abstract int delete(Uri uri, String selection, String[] selectionArgs);
public abstract String getType(Uri uri);

View file

@ -69,4 +69,12 @@ public class ContentResolver {
else
return null;
}
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
if (provider != null)
return provider.update(uri, values, selection, selectionArgs);
else
return 0;
}
}

View file

@ -17,6 +17,11 @@ public class SearchRecentSuggestionsProvider extends ContentProvider {
throw new UnsupportedOperationException("Unimplemented method 'insert'");
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("Unimplemented method 'update'");
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("Unimplemented method 'delete'");

View file

@ -402,11 +402,19 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
* @return The value of the field as a <code>long</code>.
*/
public long getLong(int row, int column) {
Long field = (Long)rows.get(row - startPos)[column];
if (field == null) {
return 0L;
}
return field.longValue();
long result = 0L;
Object object = rows.get(row - startPos)[column];
if (object instanceof Long)
result = (Long)object;
else if (object instanceof String)
result = Long.parseLong((String) object);
else if (object instanceof Double)
result = ((Double) object).longValue();
else if (object == null)
result = 0L;
else
throw new SQLiteException("Unexpected object type for getLong: " + object.getClass().getName());
return result;
}
/**

View file

@ -84,4 +84,8 @@ public class DrawableContainer extends Drawable {
state.drawables[curIndex].setBounds(left, top, right, bottom);
}
public void setEnterFadeDuration(int duration) {}
public void setExitFadeDuration(int duration) {}
}

View file

@ -2,7 +2,9 @@ package android.location;
import android.os.Bundle;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class LocationManager {
@ -36,4 +38,8 @@ public class LocationManager {
public void removeUpdates(LocationListener listener) {
}
public List<String> getAllProviders() {
return Collections.emptyList();
}
}

View file

@ -10,6 +10,8 @@ public class NetworkInfo {
UNKNOWN
}
public enum DetailedState {}
private State state = State.DISCONNECTED;
public NetworkInfo(boolean available) {
@ -51,4 +53,16 @@ public class NetworkInfo {
public boolean isAvailable () {
return false;
}
public DetailedState getDetailedState() {
return null;
}
public String getExtraInfo() {
return null;
}
public String getReason() {
return null;
}
}

View file

@ -147,6 +147,8 @@ public class Build {
* @hide
*/
public static final int RESOURCES_SDK_INT = SDK_INT + ("REL".equals(CODENAME) ? 0 : 1);
public static final String SECURITY_PATCH = getString("ro.build.version.security_patch");
}
/**

View file

@ -0,0 +1,6 @@
package android.preference;
import android.app.ListActivity;
public class PreferenceActivity extends ListActivity {
}

View file

@ -0,0 +1,10 @@
package android.provider;
import android.net.Uri;
public class CalendarContract {
public static final class Events {
public static final Uri CONTENT_URI = Uri.parse("content://com.android.calendar/events");
}
}

View file

@ -9,4 +9,11 @@ public class DateUtils {
public static CharSequence getRelativeTimeSpanString(Context context, long millis, boolean withPreposition) {
return new Date(millis).toString();
}
public static boolean isToday(long millis) {
Date d1 = new Date(millis);
Date d2 = new Date();
return d1.getYear() == d2.getYear() && d1.getMonth() == d2.getMonth() && d1.getDate() == d2.getDate();
}
}

View file

@ -59,4 +59,12 @@ public interface MenuItem {
public MenuItem setAlphabeticShortcut(char alphaChar);
public MenuItem setShortcut(char numeric, char alpha);
public int getOrder();
public boolean isEnabled();
public CharSequence getTitleCondensed();
public CharSequence getTitle();
}

View file

@ -942,6 +942,11 @@ public class View implements Drawable.Callback {
}
native_setPadding(widget, paddingLeft, paddingTop, paddingRight, paddingBottom);
if (a.hasValue(com.android.internal.R.styleable.View_tag)) {
tag = a.getText(com.android.internal.R.styleable.View_tag);
}
a.recycle();
}
onCreateDrawableState(0);
}
@ -1436,7 +1441,7 @@ public class View implements Drawable.Callback {
public void requestLayout() {
layoutRequested = true;
if (parent != null) {
if (parent != null && !parent.isLayoutRequested()) {
parent.requestLayout();
}
native_requestLayout(widget);
@ -1949,4 +1954,6 @@ public class View implements Drawable.Callback {
public void setImportantForAutofill(int flag) {}
public void setDefaultFocusHighlightEnabled(boolean enabled) {}
public void setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled) {}
}

View file

@ -12,6 +12,7 @@ import java.util.Objects;
public class ViewGroup extends View implements ViewParent, ViewManager {
public ArrayList<View> children;
private OnHierarchyChangeListener onHierarchyChangeListener;
private LayoutTransition transition;
public ViewGroup(Context context) {
this(context, null);
@ -191,7 +192,9 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
return true;
}
public LayoutTransition getLayoutTransition() { return null; }
public LayoutTransition getLayoutTransition() {
return transition;
}
public static int getChildMeasureSpec(int spec, int padding, int childDimension) {
int specMode = MeasureSpec.getMode(spec);
@ -378,6 +381,10 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
return null;
}
public void setLayoutTransition(LayoutTransition transition) {
this.transition = transition;
}
public static class LayoutParams {
public static final int FILL_PARENT = -1;
public static final int MATCH_PARENT = -1;

View file

@ -1,5 +1,8 @@
package android.view.animation;
import android.os.Handler;
import android.os.Looper;
public class Animation {
public interface AnimationListener {
@ -20,8 +23,15 @@ public class Animation {
public void setStartOffset(long offset) {}
public void setAnimationListener(AnimationListener l) {
l.onAnimationEnd(this); // FIXME
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
l.onAnimationEnd(Animation.this); // FIXME
}
});
}
public void setRepeatCount(int count) {}
public void reset() {}
}

View file

@ -0,0 +1,12 @@
package android.webkit;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class ViewAnimator extends ViewGroup {
public ViewAnimator(Context context, AttributeSet attrs) {
super(context, attrs);
}
}

View file

@ -17,6 +17,11 @@ public abstract class AbsSpinner extends AdapterView {
haveCustomMeasure = false;
}
public AbsSpinner(Context context, AttributeSet attributeSet, int defStyle) {
super(context, attributeSet, defStyle);
haveCustomMeasure = false;
}
@Override
protected native long native_constructor(Context context, AttributeSet attrs);
protected native void native_setAdapter(long widget, SpinnerAdapter adapter);

View file

@ -0,0 +1,21 @@
package android.widget;
import android.content.Context;
import android.util.AttributeSet;
public class Gallery extends AbsSpinner {
public Gallery(Context context) {
super(context);
}
public Gallery(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public Gallery(Context context, AttributeSet attributeSet, int defStyleAttr) {
super(context, attributeSet, defStyleAttr);
}
public void setHorizontalFadingEdgeEnabled(boolean enabled) {}
}

View file

@ -515,6 +515,30 @@ public class PopupMenu {
@Override
public MenuItem setShortcut(char numeric, char alpha) { return this; }
@Override
public int getOrder() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getOrder'");
}
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isEnabled'");
}
@Override
public CharSequence getTitleCondensed() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTitleCondensed'");
}
@Override
public CharSequence getTitle() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTitle'");
}
}
}

View file

@ -307,4 +307,12 @@ public class TextView extends View {
public void setLines(int lines) {}
public void setMinLines(int lines) {}
public void setSelectAllOnFocus(boolean selectAllOnFocus) {}
public int getCompoundDrawablePadding() {return 0;}
public int getPaintFlags() {return 0;}
public void setPaintFlags(int flags) {}
}

View file

@ -0,0 +1,14 @@
package android.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class ViewAnimator extends ViewGroup {
public ViewAnimator(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setDisplayedChild(int index) {}
}

View file

@ -0,0 +1,14 @@
package android.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
public class ZoomButton extends View {
public ZoomButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setZoomSpeed(long speed) {}
}

View file

@ -0,0 +1,6 @@
package android.widget;
public class ZoomButtonsController {
public interface OnZoomListener {}
}

View file

@ -59,11 +59,11 @@ public class DumpHeapProvider extends ContentProvider {
return 0;
}
/* @Override
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return 0;
}
*/
}
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
synchronized (sLock) {

View file

@ -318,9 +318,11 @@ hax_jar = jar('hax', [
'android/os/UserManager.java',
'android/os/Vibrator.java',
'android/os/storage/StorageManager.java',
'android/preference/PreferenceActivity.java',
'android/preference/PreferenceManager.java',
'android/print/PrintManager.java',
'android/provider/BaseColumns.java',
'android/provider/CalendarContract.java',
'android/provider/ContactsContract.java',
'android/provider/Settings.java',
'android/telecom/TelecomManager.java',
@ -486,6 +488,7 @@ hax_jar = jar('hax', [
'android/webkit/DownloadListener.java',
'android/webkit/MimeTypeMap.java',
'android/webkit/URLUtil.java',
'android/webkit/ViewAnimator.java',
'android/webkit/WebChromeClient.java',
'android/webkit/WebSettings.java',
'android/webkit/WebView.java',
@ -512,6 +515,7 @@ hax_jar = jar('hax', [
'android/widget/Filterable.java',
'android/widget/FilterQueryProvider.java',
'android/widget/FrameLayout.java',
'android/widget/Gallery.java',
'android/widget/HeaderViewListAdapter.java',
'android/widget/HorizontalScrollView.java',
'android/widget/ImageButton.java',
@ -543,6 +547,9 @@ hax_jar = jar('hax', [
'android/widget/TextView.java',
'android/widget/Toast.java',
'android/widget/Toolbar.java',
'android/widget/ViewAnimator.java',
'android/widget/ZoomButton.java',
'android/widget/ZoomButtonsController.java',
'com/android/internal/Manifest.java',
'com/android/internal/R.java',
'com/android/internal/util/ArrayUtils.java',