misc stubbing for ctr2

This commit is contained in:
Mis012 2023-01-14 14:32:37 +01:00
parent f8beaa4a7d
commit 27f3d288dd
16 changed files with 184 additions and 0 deletions

View file

@ -0,0 +1,4 @@
package com.google.android.youtube.player.j;
public class a {
}

View file

@ -0,0 +1,15 @@
package com.google.android.youtube.player;
import android.content.Context;
import android.widget.ImageView;
public final class j extends ImageView { // YouTubeThumbnailView
public j(Context c) {
super(c);
}
public interface a {} // OnInitializedListener
public final void a(String developer_key, a zyoutube) {} // YouTubeThumbnailView.initialize
}

View file

@ -0,0 +1,5 @@
package android.app;
public class AlarmManager {
public void cancel(PendingIntent operation) {}
}

View file

@ -0,0 +1,5 @@
package android.app;
public class NotificationManager {
public void cancelAll() {}
}

View file

@ -0,0 +1,3 @@
package android.content;
public interface ComponentCallbacks {}

View file

@ -0,0 +1,3 @@
package android.content;
public interface ComponentCallbacks2 extends ComponentCallbacks {}

View file

@ -32,6 +32,8 @@ import android.hardware.usb.UsbManager;
import android.os.Vibrator;
import android.hardware.display.DisplayManager;
import android.media.MediaRouter;
import android.app.NotificationManager;
import android.app.AlarmManager;
import java.io.File;
import java.io.FileInputStream;
@ -125,6 +127,10 @@ public class Context extends Object {
return new DisplayManager();
case "media_router":
return new MediaRouter();
case "notification":
return new NotificationManager();
case "alarm":
return new AlarmManager();
default:
System.out.println("!!!!!!! getSystemService: case >"+name+"< is not implemented yet");
return null;
@ -261,6 +267,8 @@ public class Context extends Object {
return -1; // PackageManager.PERMISSION_DENIED
}
public void registerComponentCallbacks(ComponentCallbacks callbacks) {}
// these may not look like typical stubs, but they definitely are stubs
public final TypedArray obtainStyledAttributes (AttributeSet set, int[] attrs) { return new TypedArray(r, new int[1000], new int[1000], 0); }
public final TypedArray obtainStyledAttributes (AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes) { return new TypedArray(r, new int[1000], new int[1000], 0); }

View file

@ -14,6 +14,9 @@ public class Intent {
public Intent (Context packageContext, Class<?> cls) {}
public Intent (String action, Uri uri, Context packageContext, Class<?> cls) {}
public Intent setFlags(int flags) {
return this; //??
}
public Intent setPackage(String packageName) {
return this; //??
}

View file

@ -365,6 +365,8 @@ public class Canvas {
native_drawLine(cairo_context, widget, startX, startY, stopX, stopY, paint.getColor());
}
public void setBitmap(Bitmap bitmap) {}
private static native void native_drawLine(long cairo_context, long widget, float startX, float startY, float stopX, float stopY, int paint_color); // TODO: pass all the other relevant parameters extracted from paint
private static native void native_drawBitmap(long cairo_context, long widget, long pixbuf, float src_x, float src_y, float dest_x, float dest_y, Paint paint); // TODO: make use of "paint"?
private static native void native_rotate(long cairo_context, long widget, float angle);

View file

@ -0,0 +1,7 @@
package android.graphics;
public class Color {
public static int argb(int alpha, int red, int green, int blue) {
return (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
}
}

View file

@ -124,4 +124,48 @@ public class Paint {
public /*native*/ float getFontMetrics(FontMetrics metrics) {return 0;}
public /*native*/ int getFontMetricsInt(FontMetricsInt fmi) {return 0;}
public void setShadowLayer(float radius, float dx, float dy, int color) {}
public Xfermode setXfermode(Xfermode xfermode) {return xfermode;}
public enum Cap {
/**
* The stroke ends with the path, and does not project beyond it.
*/
BUTT (0),
/**
* The stroke projects out as a semicircle, with the center at the
* end of the path.
*/
ROUND (1),
/**
* The stroke projects out as a square, with the center at the end
* of the path.
*/
SQUARE (2);
private Cap(int nativeInt) {}
}
public enum Join {
/**
* The outer edges of a join meet at a sharp angle
*/
MITER (0),
/**
* The outer edges of a join meet in a circular arc.
*/
ROUND (1),
/**
* The outer edges of a join meet with a straight line
*/
BEVEL (2);
private Join(int nativeInt) {}
}
public void setStrokeCap(Cap cap) {}
public void setStrokeJoin(Join join) {}
}

View file

@ -0,0 +1,63 @@
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.graphics;
public class PorterDuff {
// these value must match their native equivalents. See SkPorterDuff.h
public enum Mode {
/** [0, 0] */
CLEAR (0),
/** [Sa, Sc] */
SRC (1),
/** [Da, Dc] */
DST (2),
/** [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] */
SRC_OVER (3),
/** [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc] */
DST_OVER (4),
/** [Sa * Da, Sc * Da] */
SRC_IN (5),
/** [Sa * Da, Sa * Dc] */
DST_IN (6),
/** [Sa * (1 - Da), Sc * (1 - Da)] */
SRC_OUT (7),
/** [Da * (1 - Sa), Dc * (1 - Sa)] */
DST_OUT (8),
/** [Da, Sc * Da + (1 - Sa) * Dc] */
SRC_ATOP (9),
/** [Sa, Sa * Dc + Sc * (1 - Da)] */
DST_ATOP (10),
/** [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] */
XOR (11),
/** [Sa + Da - Sa*Da,
Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)] */
DARKEN (12),
/** [Sa + Da - Sa*Da,
Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)] */
LIGHTEN (13),
/** [Sa * Da, Sc * Dc] */
MULTIPLY (14),
/** [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] */
SCREEN (15),
/** Saturate(S + D) */
ADD (16),
OVERLAY (17);
Mode(int nativeInt) {}
}
}

View file

@ -0,0 +1,5 @@
package android.graphics;
public class PorterDuffXfermode extends Xfermode {
public PorterDuffXfermode(PorterDuff.Mode mode) {}
}

View file

@ -0,0 +1,5 @@
package android.graphics;
public class Xfermode {
}

View file

@ -4,4 +4,8 @@ public class TelephonyManager {
public String getNetworkOperatorName() {
return "none"; // FIXME: can we return null here?
}
public int getPhoneType() {
return 0; // PHONE_TYPE_NONE
}
}

View file

@ -7,12 +7,14 @@ hax_jar = jar('hax', [
'android/annotation/Widget.java',
'android/app/Activity.java',
'android/app/ActivityManager.java',
'android/app/AlarmManager.java',
'android/app/AlertDialog.java',
'android/app/Application.java',
'android/app/Dialog.java',
'android/app/IntentService.java',
'android/app/KeyguardManager.java',
'android/app/NativeActivity.java',
'android/app/NotificationManager.java',
'android/app/PendingIntent.java',
'android/app/ProgressDialog.java',
'android/app/Service.java',
@ -20,6 +22,8 @@ hax_jar = jar('hax', [
'android/content/ActivityNotFoundException.java',
'android/content/BroadcastReceiver.java',
'android/content/ClipboardManager.java',
'android/content/ComponentCallbacks.java',
'android/content/ComponentCallbacks2.java',
'android/content/ComponentName.java',
'android/content/ContentResolver.java',
'android/content/ContentValues.java',
@ -75,13 +79,17 @@ hax_jar = jar('hax', [
'android/graphics/BitmapFactory.java',
'android/graphics/Bitmap.java',
'android/graphics/Canvas.java',
'android/graphics/Color.java',
'android/graphics/Matrix.java',
'android/graphics/Paint.java',
'android/graphics/Path.java',
'android/graphics/PorterDuff.java',
'android/graphics/PorterDuffXfermode.java',
'android/graphics/RectF.java',
'android/graphics/Rect.java',
'android/graphics/Region.java',
'android/graphics/Typeface.java',
'android/graphics/Xfermode.java',
'android/hardware/display/DisplayManager.java',
'android/hardware/SensorEventListener.java',
'android/hardware/Sensor.java',