1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tools.layoutlib.create; 18 19 /** 20 * Stores data needed for native JNI registration, and possibly the framework bytecode 21 * instrumentation. 22 */ 23 public class NativeConfig { 24 NativeConfig()25 private NativeConfig() {} 26 27 public final static String[] DEFERRED_STATIC_INITIALIZER_CLASSES = new String [] { 28 "android.graphics.ColorSpace", 29 "android.graphics.FontFamily", 30 "android.graphics.Matrix", 31 "android.graphics.Path", 32 // Order is important! Fonts and FontFamily have to be initialized before Typeface 33 "android.graphics.fonts.Font", 34 "android.graphics.fonts.FontFamily$Builder", 35 "android.graphics.Typeface", 36 "android.graphics.text.PositionedGlyphs", 37 "android.graphics.text.LineBreaker", 38 }; 39 40 public static final String[] DELEGATE_METHODS = new String[] { 41 "android.app.ActivityManager#getService", 42 "android.app.Fragment#instantiate", //(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;", 43 "android.app.IUiModeManager$Stub#asInterface", 44 "android.content.res.AssetManager#createSystemAssetsInZygoteLocked", 45 "android.content.res.AssetManager#getAssignedPackageIdentifiers", 46 "android.content.res.AssetManager#nativeCreate", 47 "android.content.res.AssetManager#nativeDestroy", 48 "android.content.res.AssetManager#nativeGetThemeFreeFunction", 49 "android.content.res.AssetManager#nativeThemeCreate", 50 "android.content.res.Resources#getAnimation", 51 "android.content.res.Resources#getAttributeSetSourceResId", 52 "android.content.res.Resources#getBoolean", 53 "android.content.res.Resources#getColor", 54 "android.content.res.Resources#getColorStateList", 55 "android.content.res.Resources#getDimension", 56 "android.content.res.Resources#getDimensionPixelOffset", 57 "android.content.res.Resources#getDimensionPixelSize", 58 "android.content.res.Resources#getDrawable", 59 "android.content.res.Resources#getFloat", 60 "android.content.res.Resources#getFont", 61 "android.content.res.Resources#getIdentifier", 62 "android.content.res.Resources#getIntArray", 63 "android.content.res.Resources#getInteger", 64 "android.content.res.Resources#getLayout", 65 "android.content.res.Resources#getQuantityString", 66 "android.content.res.Resources#getQuantityText", 67 "android.content.res.Resources#getResourceEntryName", 68 "android.content.res.Resources#getResourceName", 69 "android.content.res.Resources#getResourcePackageName", 70 "android.content.res.Resources#getResourceTypeName", 71 "android.content.res.Resources#getString", 72 "android.content.res.Resources#getStringArray", 73 "android.content.res.Resources#getText", 74 "android.content.res.Resources#getTextArray", 75 "android.content.res.Resources#getValue", 76 "android.content.res.Resources#getValueForDensity", 77 "android.content.res.Resources#getXml", 78 "android.content.res.Resources#loadXmlResourceParser", 79 "android.content.res.Resources#obtainAttributes", 80 "android.content.res.Resources#obtainTypedArray", 81 "android.content.res.Resources#openRawResource", 82 "android.content.res.Resources#openRawResourceFd", 83 "android.content.res.Resources$Theme#obtainStyledAttributes", 84 "android.content.res.Resources$Theme#resolveAttribute", 85 "android.content.res.Resources$Theme#resolveAttributes", 86 "android.content.res.TypedArray#getValueAt", 87 "android.content.res.TypedArray#obtain", 88 "android.graphics.Canvas#getClipBounds", 89 "android.graphics.ImageDecoder#decodeBitmapImpl", 90 "android.graphics.Typeface#create", 91 "android.graphics.drawable.AdaptiveIconDrawable#draw", 92 "android.graphics.drawable.AnimatedVectorDrawable#draw", 93 "android.graphics.drawable.AnimatedVectorDrawable$VectorDrawableAnimatorUI#onDraw", 94 "android.graphics.drawable.DrawableInflater#inflateFromClass", 95 "android.graphics.drawable.NinePatchDrawable#getOpacity", 96 "android.graphics.fonts.Font$Builder#createBuffer", 97 "android.graphics.fonts.SystemFonts#getSystemFontConfigInternal", 98 "android.graphics.fonts.SystemFonts#mmap", 99 "android.os.Binder#getNativeBBinderHolder", 100 "android.os.Binder#getNativeFinalizer", 101 "android.os.Handler#sendMessageAtFrontOfQueue", 102 "android.os.Handler#sendMessageAtTime", 103 "android.os.HandlerThread#run", 104 "android.os.SystemProperties#find", 105 "android.permission.PermissionManager#checkPermission", 106 "android.preference.Preference#getView", 107 "android.provider.DeviceConfig#getBoolean", 108 "android.provider.DeviceConfig#getFloat", 109 "android.provider.DeviceConfig#getInt", 110 "android.provider.DeviceConfig#getLong", 111 "android.provider.DeviceConfig#getProperty", 112 "android.provider.DeviceConfig#getString", 113 "android.provider.Settings$Config#getContentResolver", 114 "android.text.format.DateFormat#is24HourFormat", 115 "android.util.Xml#newPullParser", 116 "android.view.Choreographer#getFrameTimeNanos", 117 "android.view.Choreographer#getRefreshRate", 118 "android.view.Choreographer#postCallbackDelayedInternal", 119 "android.view.Choreographer#removeCallbacksInternal", 120 "android.view.Display#getWindowManager", 121 "android.view.Display#updateDisplayInfoLocked", 122 "android.view.DisplayEventReceiver#nativeGetDisplayEventReceiverFinalizer", 123 "android.view.DisplayEventReceiver#nativeInit", 124 "android.view.HandlerActionQueue#postDelayed", 125 "android.view.LayoutInflater#parseInclude", 126 "android.view.LayoutInflater#rInflate", 127 "android.view.MenuInflater#registerMenu", 128 "android.view.PointerIcon#loadResource", 129 "android.view.PointerIcon#registerDisplayListener", 130 "android.view.SurfaceControl#nativeCreateTransaction", 131 "android.view.SurfaceControl#nativeGetNativeTransactionFinalizer", 132 "android.view.VelocityTracker#obtain", 133 "android.view.View#dispatchDetachedFromWindow", 134 "android.view.View#draw", 135 "android.view.View#getWindowToken", 136 "android.view.View#isInEditMode", 137 "android.view.View#layout", 138 "android.view.View#measure", 139 "android.view.ViewRootImpl#performHapticFeedback", 140 "android.view.WindowManagerGlobal#getWindowManagerService", 141 "android.view.accessibility.AccessibilityManager#getInstance", 142 "android.view.accessibility.AccessibilityManager#getWindowTransformationSpec", 143 "android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow", 144 "android.view.inputmethod.InputMethodManager#isInEditMode", 145 "android.view.inputmethod.InputMethodManager#showSoftInput", 146 "android.widget.AbsListView#setupDeviceConfigProperties", 147 "android.widget.Magnifier#show", 148 "android.widget.RemoteViews#getApplicationInfo", 149 "com.android.internal.util.XmlUtils#convertValueToInt", 150 "com.android.internal.view.menu.MenuBuilder#createNewMenuItem", 151 "dalvik.system.VMRuntime#getNotifyNativeInterval", 152 "dalvik.system.VMRuntime#is64Bit", 153 "dalvik.system.VMRuntime#newUnpaddedArray", 154 "libcore.io.MemoryMappedFile#bigEndianIterator", 155 "libcore.io.MemoryMappedFile#close", 156 "libcore.io.MemoryMappedFile#mmapRO", 157 "libcore.util.NativeAllocationRegistry#applyFreeFunction", 158 }; 159 160 public final static String[] DELEGATE_CLASS_NATIVES = new String[] { 161 "android.os.SystemClock", 162 "android.view.Display", 163 "libcore.icu.ICU", 164 }; 165 166 /** 167 * The list of core classes to register with JNI 168 */ 169 public final static String[] CORE_CLASS_NATIVES = new String[] { 170 "android.animation.PropertyValuesHolder", 171 "android.content.res.StringBlock", 172 "android.content.res.XmlBlock", 173 "android.os.SystemProperties", 174 "android.os.Trace", 175 "android.text.AndroidCharacter", 176 "android.util.Log", 177 "android.view.MotionEvent", 178 "com.android.internal.util.VirtualRefBasePtr", 179 "libcore.util.NativeAllocationRegistry_Delegate", 180 }; 181 182 /** 183 * The list of graphics classes to register with JNI 184 */ 185 public final static String[] GRAPHICS_CLASS_NATIVES = new String[] { 186 "android.graphics.Bitmap", 187 "android.graphics.BitmapFactory", 188 "android.graphics.ByteBufferStreamAdaptor", 189 "android.graphics.Camera", 190 "android.graphics.Canvas", 191 "android.graphics.CanvasProperty", 192 "android.graphics.ColorFilter", 193 "android.graphics.ColorSpace", 194 "android.graphics.CreateJavaOutputStreamAdaptor", 195 "android.graphics.DrawFilter", 196 "android.graphics.FontFamily", 197 "android.graphics.Graphics", 198 "android.graphics.ImageDecoder", 199 "android.graphics.Interpolator", 200 "android.graphics.MaskFilter", 201 "android.graphics.Matrix", 202 "android.graphics.NinePatch", 203 "android.graphics.Paint", 204 "android.graphics.Path", 205 "android.graphics.PathEffect", 206 "android.graphics.PathMeasure", 207 "android.graphics.Picture", 208 "android.graphics.RecordingCanvas", 209 "android.graphics.Region", 210 "android.graphics.RenderEffect", 211 "android.graphics.RenderNode", 212 "android.graphics.Shader", 213 "android.graphics.Typeface", 214 "android.graphics.YuvImage", 215 "android.graphics.animation.NativeInterpolatorFactory", 216 "android.graphics.animation.RenderNodeAnimator", 217 "android.graphics.drawable.AnimatedVectorDrawable", 218 "android.graphics.drawable.VectorDrawable", 219 "android.graphics.fonts.Font", 220 "android.graphics.fonts.FontFamily", 221 "android.graphics.text.LineBreaker", 222 "android.graphics.text.MeasuredText", 223 "android.graphics.text.TextRunShaper", 224 "android.util.PathParser", 225 }; 226 } 227