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) {}
}

Some files were not shown because too many files have changed in this diff Show More