api-impl: copy GradientDrawable from AOSP, some stubs

This commit is contained in:
Mis012
2024-04-23 19:14:41 +02:00
parent 31929d2253
commit 341e39463a
9 changed files with 1523 additions and 5 deletions

View File

@@ -7,6 +7,8 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#undef android_graphics_Canvas_HAS_ALPHA_LAYER_SAVE_FLAG
#define android_graphics_Canvas_HAS_ALPHA_LAYER_SAVE_FLAG 4L
/* /*
* Class: android_graphics_Canvas * Class: android_graphics_Canvas
* Method: native_canvas_from_bitmap * Method: native_canvas_from_bitmap

View File

@@ -7,6 +7,8 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#undef android_graphics_GskCanvas_HAS_ALPHA_LAYER_SAVE_FLAG
#define android_graphics_GskCanvas_HAS_ALPHA_LAYER_SAVE_FLAG 4L
/* /*
* Class: android_graphics_GskCanvas * Class: android_graphics_GskCanvas
* Method: native_drawBitmap * Method: native_drawBitmap

View File

@@ -0,0 +1,5 @@
package android.app.usage;
public class UsageStatsManager {
}

View File

@@ -1,6 +1,8 @@
package android.graphics; package android.graphics;
public class Canvas { public class Canvas {
public static final int HAS_ALPHA_LAYER_SAVE_FLAG = (1 << 2);
public long skia_canvas; public long skia_canvas;
public long widget; public long widget;

View File

@@ -0,0 +1,140 @@
/*
* 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 PixelFormat {
/* these constants need to match those in hardware/hardware.h */
public static final int UNKNOWN = 0;
/**
* System chooses a format that supports translucency (many alpha bits)
*/
public static final int TRANSLUCENT = -3;
/**
* System chooses a format that supports transparency
* (at least 1 alpha bit)
*/
public static final int TRANSPARENT = -2;
/**
* System chooses an opaque format (no alpha bits required)
*/
public static final int OPAQUE = -1;
public static final int RGBA_8888 = 1;
public static final int RGBX_8888 = 2;
public static final int RGB_888 = 3;
public static final int RGB_565 = 4;
@Deprecated
public static final int RGBA_5551 = 6;
@Deprecated
public static final int RGBA_4444 = 7;
@Deprecated
public static final int A_8 = 8;
@Deprecated
public static final int L_8 = 9;
@Deprecated
public static final int LA_88 = 0xA;
@Deprecated
public static final int RGB_332 = 0xB;
/**
* @deprecated use {@link android.graphics.ImageFormat#NV16
* ImageFormat.NV16} instead.
*/
@Deprecated
public static final int YCbCr_422_SP = 0x10;
/**
* @deprecated use {@link android.graphics.ImageFormat#NV21
* ImageFormat.NV21} instead.
*/
@Deprecated
public static final int YCbCr_420_SP = 0x11;
/**
* @deprecated use {@link android.graphics.ImageFormat#YUY2
* ImageFormat.YUY2} instead.
*/
@Deprecated
public static final int YCbCr_422_I = 0x14;
/**
* @deprecated use {@link android.graphics.ImageFormat#JPEG
* ImageFormat.JPEG} instead.
*/
@Deprecated
public static final int JPEG = 0x100;
public static void getPixelFormatInfo(int format, PixelFormat info) {
switch (format) {
case RGBA_8888:
case RGBX_8888:
info.bitsPerPixel = 32;
info.bytesPerPixel = 4;
break;
case RGB_888:
info.bitsPerPixel = 24;
info.bytesPerPixel = 3;
break;
case RGB_565:
case RGBA_5551:
case RGBA_4444:
case LA_88:
info.bitsPerPixel = 16;
info.bytesPerPixel = 2;
break;
case A_8:
case L_8:
case RGB_332:
info.bitsPerPixel = 8;
info.bytesPerPixel = 1;
break;
case YCbCr_422_SP:
case YCbCr_422_I:
info.bitsPerPixel = 16;
info.bytesPerPixel = 1;
break;
case YCbCr_420_SP:
info.bitsPerPixel = 12;
info.bytesPerPixel = 1;
break;
default:
throw new IllegalArgumentException("unkonwon pixel format " + format);
}
}
public static boolean formatHasAlpha(int format) {
switch (format) {
case PixelFormat.A_8:
case PixelFormat.LA_88:
case PixelFormat.RGBA_4444:
case PixelFormat.RGBA_5551:
case PixelFormat.RGBA_8888:
case PixelFormat.TRANSLUCENT:
case PixelFormat.TRANSPARENT:
return true;
}
return false;
}
public int bytesPerPixel;
public int bitsPerPixel;
}

View File

@@ -15,8 +15,10 @@ import android.content.res.Resources;
import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser;
import android.content.res.Resources.Theme; import android.content.res.Resources.Theme;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect; import android.graphics.Rect;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue; import android.util.TypedValue;
@@ -28,6 +30,8 @@ public class Drawable {
public void unscheduleDrawable(Drawable drawable, Runnable runnable); public void unscheduleDrawable(Drawable drawable, Runnable runnable);
} }
static final PorterDuff.Mode DEFAULT_TINT_MODE = PorterDuff.Mode.SRC_IN;
private Rect mBounds = new Rect(); private Rect mBounds = new Rect();
private int[] mStateSet = new int[0]; private int[] mStateSet = new int[0];
public long paintable; public long paintable;
@@ -140,9 +144,24 @@ public class Drawable {
public int getIntrinsicWidth() {return 0;} public int getIntrinsicWidth() {return 0;}
public int getIntrinsicHeight() {return 0;} public int getIntrinsicHeight() {return 0;}
public void setTintList (ColorStateList tint) {} public void setTintList(ColorStateList tint) {}
public void setTint(int tint) {} public void setTint(int tint) {
System.out.println("setTint("+tint+")");
setTintList(ColorStateList.valueOf(tint));
}
PorterDuffColorFilter updateTintFilter(PorterDuffColorFilter tintFilter, ColorStateList tint, PorterDuff.Mode tintMode) {
System.out.println("updateTintFilter("+tintFilter+", "+tint+", "+tintMode+")");
if (tint == null || tintMode == null) {
return null;
}
final int color = tint.getColorForState(getState(), Color.TRANSPARENT);
if (tintFilter == null || tintFilter.getColor() != color || tintFilter.getMode() != tintMode) {
return new PorterDuffColorFilter(color, tintMode);
}
return tintFilter;
}
public boolean isStateful() { public boolean isStateful() {
return false; return false;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
package android.telephony;
public class SubscriptionManager {
}

View File

@@ -48,6 +48,7 @@ hax_jar = jar('hax', [
'android/app/admin/DevicePolicyManager.java', 'android/app/admin/DevicePolicyManager.java',
'android/app/job/JobScheduler.java', 'android/app/job/JobScheduler.java',
'android/app/job/JobService.java', 'android/app/job/JobService.java',
'android/app/usage/UsageStatsManager.java',
'android/appwidget/AppWidgetManager.java', 'android/appwidget/AppWidgetManager.java',
'android/bluetooth/BluetoothManager.java', 'android/bluetooth/BluetoothManager.java',
'android/bluetooth/le/ScanCallback.java', 'android/bluetooth/le/ScanCallback.java',
@@ -175,6 +176,7 @@ hax_jar = jar('hax', [
'android/graphics/Path.java', 'android/graphics/Path.java',
'android/graphics/PathEffect.java', 'android/graphics/PathEffect.java',
'android/graphics/PathMeasure.java', 'android/graphics/PathMeasure.java',
'android/graphics/PixelFormat.java',
'android/graphics/Point.java', 'android/graphics/Point.java',
'android/graphics/PointF.java', 'android/graphics/PointF.java',
'android/graphics/PorterDuff.java', 'android/graphics/PorterDuff.java',
@@ -297,6 +299,7 @@ hax_jar = jar('hax', [
'android/provider/Settings.java', 'android/provider/Settings.java',
'android/telecom/TelecomManager.java', 'android/telecom/TelecomManager.java',
'android/telephony/PhoneStateListener.java', 'android/telephony/PhoneStateListener.java',
'android/telephony/SubscriptionManager.java',
'android/telephony/TelephonyManager.java', 'android/telephony/TelephonyManager.java',
'android/text/ClipboardManager.java', 'android/text/ClipboardManager.java',
'android/text/Editable.java', 'android/text/Editable.java',