API stubs and fixes for composeUI

This commit is contained in:
Julian Winkler
2024-11-27 14:59:37 +01:00
committed by Mis012
parent 447784b6d6
commit e9cf5e7002
35 changed files with 559 additions and 24 deletions

View File

@@ -478,6 +478,8 @@ public class Context extends Object {
public void registerComponentCallbacks(ComponentCallbacks callbacks) {}
public void unregisterComponentCallbacks(ComponentCallbacks callbacks) {}
public boolean bindService(final Intent intent, final ServiceConnection serviceConnection, int dummy3) {
if (intent.getComponent() == null) {
Slog.w(TAG, "Context.bindService: intent.getComponent() is null");

View File

@@ -16,6 +16,12 @@
package android.content.pm;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.content.ComponentName;
@@ -23,6 +29,8 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.pm.PackageParser.Service;
import android.content.pm.PackageParser.ServiceIntentInfo;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
@@ -32,11 +40,6 @@ import android.os.UserHandle;
import android.util.AndroidException;
import android.util.DisplayMetrics;
import android.util.Slog;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
class IPackageInstallObserver {}
class VerificationParams {}
@@ -2321,7 +2324,17 @@ public class PackageManager {
*/
public List<ResolveInfo> queryIntentServices(Intent intent,
int flags) {
return new ArrayList<ResolveInfo>();
List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
for (Service s: Context.pkg.services) {
for (ServiceIntentInfo intentinfo: s.intents) {
if (s.getComponentName().equals(intent.getComponent()) || intentinfo.matchAction(intent.getAction())) {
ResolveInfo ri = new ResolveInfo();
ri.serviceInfo = s.info;
list.add(ri);
}
}
}
return list;
}
/**

View File

@@ -3031,7 +3031,20 @@ public class PackageParser {
continue;
}
if (parser.getName().equals("meta-data")) {
if (parser.getName().equals("intent-filter")) {
ServiceIntentInfo intent = new ServiceIntentInfo(s);
if (!parseIntent(res, parser, attrs, true /*allowGlobs*/, true /*allowAutoVerify*/,
intent, outError)) {
return null;
}
if (intent.countActions() == 0) {
Slog.w(TAG, "No actions in intent filter at "
+ mArchiveSourcePath + " "
+ parser.getPositionDescription());
} else {
s.intents.add(intent);
}
} else if (parser.getName().equals("meta-data")) {
if ((s.metaData = parseMetaData(res, parser, attrs, s.metaData,
outError)) == null) {
return null;

View File

@@ -2,6 +2,7 @@ package android.content.pm;
public class ResolveInfo {
public ActivityInfo activityInfo = new ActivityInfo();
public ServiceInfo serviceInfo = new ServiceInfo();
public static class DisplayNameComparator {

View File

@@ -470,6 +470,27 @@ public class Canvas {
return false;
}
public boolean clipRect(float left, float top, float right, float bottom) {
return false;
}
public boolean isHardwareAccelerated() {
return false;
}
public boolean clipRect(float left, float top, float right, float bottom, Region.Op op) {
return false;
}
public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean includeCenter, Paint paint) {}
public void drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, Paint paint) {}
public boolean getClipBounds(Rect outRect) {
outRect.set(0, 0, 100, 100);
return false;
}
private static native long native_canvas_from_bitmap(long pixbuf);
private static native void native_save(long skia_canvas, long widget);

View File

@@ -0,0 +1,10 @@
package android.graphics;
public class Outline {
public void setAlpha(float alpha) {}
public void setEmpty() {}
public void setRoundRect(int left, int top, int right, int bottom, float r) {}
}

View File

@@ -284,6 +284,12 @@ public class Paint {
public void set(Paint paint) {}
public boolean isFilterBitmap() { return false; }
public Cap getStrokeCap() { return Cap.BUTT; }
public Join getStrokeJoin() { return Join.MITER; }
private native long native_constructor();
private native void native_set_antialias(long skia_paint, boolean aa);
private native void native_set_color(long skia_paint, int color);

View File

@@ -59,4 +59,8 @@ public class Typeface {
public int getStyle() {
return 0;
}
public static Typeface defaultFromStyle(int style) {
return create((String)null, style);
}
}

View File

@@ -299,6 +299,8 @@ public class Drawable {
return false;
}
public void setHotspot(float x, float y) {}
protected static native long native_paintable_from_path(String path);
protected native long native_constructor();
protected native void native_invalidate(long paintable);

View File

@@ -8,4 +8,6 @@ public class RippleDrawable extends LayerDrawable {
super(drawable == null ? new Drawable[] {} : new Drawable[] {drawable});
}
public void setColor(ColorStateList colorStateList) {}
}

View File

@@ -16,6 +16,14 @@ public class AudioAttributes {
return this;
}
public Builder setFlags(int flags) {
return this;
}
public Builder setLegacyStreamType(int legacy_stream_type) {
return this;
}
public AudioAttributes build() {
return new AudioAttributes();
}

View File

@@ -10,4 +10,8 @@ public class MediaController {
public MediaMetadata getMetadata() {
return new MediaMetadata();
}
public CharSequence getQueueTitle() {
return null;
}
}

View File

@@ -4,6 +4,7 @@ import java.util.List;
import android.app.PendingIntent;
import android.content.Context;
import android.media.AudioAttributes;
import android.media.MediaDescription;
import android.media.MediaMetadata;
import android.os.Handler;
@@ -54,7 +55,7 @@ public class MediaSession {
if (item.id == state.activeQueueItemId) {
title = item.description.title.toString();
subTitle = item.description.subtitle.toString();
artUrl = item.description.iconUri.toString();
artUrl = item.description.iconUri == null ? null : item.description.iconUri.toString();
break;
}
}
@@ -69,6 +70,8 @@ public class MediaSession {
public void release() {}
public void setPlaybackToLocal(AudioAttributes audioAttributes) {}
protected native void nativeSetState(int state, long actions, long position, long updateTime, String title, String subTitle, String artUrl);
protected native void nativeSetCallback(Callback callback);
}

View File

@@ -1,6 +1,6 @@
package android.os;
public class Binder extends IBinder {
public class Binder implements IBinder {
public void attachInterface(IInterface owner, String descriptor) {}
@@ -9,4 +9,10 @@ public class Binder extends IBinder {
public static long clearCallingIdentity() { return 0; }
public static void restoreCallingIdentity(long identityToken) {}
@Override
public IInterface queryLocalInterface(String descriptor) { return null; }
@Override
public boolean transact(int code, Parcel data, Parcel reply, int flags) { return false; }
}

View File

@@ -1,6 +1,10 @@
package android.os;
public class IBinder {
public interface IBinder {
public interface DeathRecipient {}
public IInterface queryLocalInterface(String descriptor);
public boolean transact(int code, Parcel data, Parcel reply, int flags);
}

View File

@@ -43,4 +43,16 @@ public class Parcel {
public void writeParcelable(Parcelable p, int flags) {
System.out.println("Parcel.writeParcelable(" + p + ", " + flags + ")");
}
public void writeInterfaceToken(String s) {
System.out.println("Parcel.writeInterfaceToken(" + s + ")");
}
public void writeStrongInterface(IInterface i) {
System.out.println("Parcel.writeStrongInterface(" + i + ")");
}
public int dataSize() {
return 0;
}
}

View File

@@ -6,4 +6,8 @@ public interface Parcelable {
}
public static interface ClassLoaderCreator<T> extends Creator<T> {}
public default void writeToParcel(Parcel dest, int flags) {
System.out.println("Parcelable.writeToParcel(" + this + ", " + dest + ", " + flags + ")");
}
}

View File

@@ -65,6 +65,7 @@ public class Settings {
}
public static final class Global {
public static final Uri CONTENT_URI = Uri.parse("content://settings/global");
public static int getInt(ContentResolver cr, String key, int def) {
switch (key) {
@@ -89,6 +90,10 @@ public class Settings {
return "STRING_FROM_SETTINGS_GLOBAL_WITH_KEY_" + key;
}
}
public static Uri getUriFor(String name) {
return Uri.withAppendedPath(CONTENT_URI, name);
}
}
public static class SettingNotFoundException extends AndroidException {}

View File

@@ -0,0 +1,10 @@
package android.text;
public class BoringLayout extends Layout {
public static class Metrics {};
public static Metrics isBoring(CharSequence source, TextPaint paint, Metrics metrics) {
return metrics;
}
}

View File

@@ -29,4 +29,34 @@ public class Layout {
public void draw(Canvas canvas) {}
public int getParagraphDirection(int line) {return 0;}
public static float getDesiredWidth(CharSequence source, int start, int end, TextPaint paint) {
return 10;
}
public int getLineEnd(int line) {return 100;}
public int getLineStart(int line) {return 0;}
public int getLineAscent(int line) {return 0;}
public int getLineDescent(int line) {return 0;}
public int getTopPadding() {return 0;}
public int getBottomPadding() {return 0;}
public float getLineLeft(int line) {return 0;}
public int getLineBottom(int line) {return 0;}
public int getLineBaseline(int line) {return 0;}
public boolean isRtlCharAt(int offset) {return false;}
public float getSecondaryHorizontal(int line) {return 0;}
public int getLineForVertical(int y) {return 0;}
public int getOffsetForHorizontal(int line, float x) {return 0;}
}

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