• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.content.res.AssetManager#createSystemAssetsInZygoteLocked",
44             "android.content.res.AssetManager#getAssignedPackageIdentifiers",
45             "android.content.res.AssetManager#nativeCreate",
46             "android.content.res.AssetManager#nativeDestroy",
47             "android.content.res.AssetManager#nativeGetThemeFreeFunction",
48             "android.content.res.AssetManager#nativeThemeCreate",
49             "android.content.res.Resources#getAnimation",
50             "android.content.res.Resources#getAttributeSetSourceResId",
51             "android.content.res.Resources#getBoolean",
52             "android.content.res.Resources#getColor",
53             "android.content.res.Resources#getColorStateList",
54             "android.content.res.Resources#getDimension",
55             "android.content.res.Resources#getDimensionPixelOffset",
56             "android.content.res.Resources#getDimensionPixelSize",
57             "android.content.res.Resources#getDrawable",
58             "android.content.res.Resources#getFloat",
59             "android.content.res.Resources#getFont",
60             "android.content.res.Resources#getIdentifier",
61             "android.content.res.Resources#getIntArray",
62             "android.content.res.Resources#getInteger",
63             "android.content.res.Resources#getLayout",
64             "android.content.res.Resources#getQuantityString",
65             "android.content.res.Resources#getQuantityText",
66             "android.content.res.Resources#getResourceEntryName",
67             "android.content.res.Resources#getResourceName",
68             "android.content.res.Resources#getResourcePackageName",
69             "android.content.res.Resources#getResourceTypeName",
70             "android.content.res.Resources#getString",
71             "android.content.res.Resources#getStringArray",
72             "android.content.res.Resources#getText",
73             "android.content.res.Resources#getTextArray",
74             "android.content.res.Resources#getValue",
75             "android.content.res.Resources#getValueForDensity",
76             "android.content.res.Resources#getXml",
77             "android.content.res.Resources#loadXmlResourceParser",
78             "android.content.res.Resources#obtainAttributes",
79             "android.content.res.Resources#obtainTypedArray",
80             "android.content.res.Resources#openRawResource",
81             "android.content.res.Resources#openRawResourceFd",
82             "android.content.res.Resources$Theme#obtainStyledAttributes",
83             "android.content.res.Resources$Theme#resolveAttribute",
84             "android.content.res.Resources$Theme#resolveAttributes",
85             "android.content.res.TypedArray#getValueAt",
86             "android.content.res.TypedArray#obtain",
87             "android.graphics.Canvas#getClipBounds",
88             "android.graphics.ImageDecoder#decodeBitmapImpl",
89             "android.graphics.Typeface#create",
90             "android.graphics.drawable.AdaptiveIconDrawable#draw",
91             "android.graphics.drawable.AnimatedVectorDrawable#draw",
92             "android.graphics.drawable.AnimatedVectorDrawable$VectorDrawableAnimatorUI#onDraw",
93             "android.graphics.drawable.DrawableInflater#inflateFromClass",
94             "android.graphics.drawable.NinePatchDrawable#getOpacity",
95             "android.graphics.fonts.Font$Builder#createBuffer",
96             "android.graphics.fonts.SystemFonts#getSystemFontConfigInternal",
97             "android.graphics.fonts.SystemFonts#mmap",
98             "android.os.Binder#getNativeBBinderHolder",
99             "android.os.Binder#getNativeFinalizer",
100             "android.os.Handler#sendMessageAtFrontOfQueue",
101             "android.os.Handler#sendMessageAtTime",
102             "android.os.HandlerThread#run",
103             "android.os.SystemProperties#find",
104             "android.permission.PermissionManager#checkPermission",
105             "android.preference.Preference#getView",
106             "android.provider.DeviceConfig#getBoolean",
107             "android.provider.DeviceConfig#getFloat",
108             "android.provider.DeviceConfig#getInt",
109             "android.provider.DeviceConfig#getLong",
110             "android.provider.DeviceConfig#getProperty",
111             "android.provider.DeviceConfig#getString",
112             "android.text.format.DateFormat#is24HourFormat",
113             "android.util.Xml#newPullParser",
114             "android.view.Choreographer#getFrameTimeNanos",
115             "android.view.Choreographer#getRefreshRate",
116             "android.view.Choreographer#postCallbackDelayedInternal",
117             "android.view.Choreographer#removeCallbacksInternal",
118             "android.view.Display#getWindowManager",
119             "android.view.Display#updateDisplayInfoLocked",
120             "android.view.DisplayEventReceiver#nativeGetDisplayEventReceiverFinalizer",
121             "android.view.DisplayEventReceiver#nativeInit",
122             "android.view.HandlerActionQueue#postDelayed",
123             "android.view.LayoutInflater#initPrecompiledViews",
124             "android.view.LayoutInflater#parseInclude",
125             "android.view.LayoutInflater#rInflate",
126             "android.view.MenuInflater#registerMenu",
127             "android.view.PointerIcon#loadResource",
128             "android.view.PointerIcon#registerDisplayListener",
129             "android.view.SurfaceControl#nativeCreateTransaction",
130             "android.view.SurfaceControl#nativeGetNativeTransactionFinalizer",
131             "android.view.VelocityTracker#obtain",
132             "android.view.View#dispatchDetachedFromWindow",
133             "android.view.View#draw",
134             "android.view.View#getWindowToken",
135             "android.view.View#isInEditMode",
136             "android.view.View#layout",
137             "android.view.View#measure",
138             "android.view.ViewRootImpl#performHapticFeedback",
139             "android.view.WindowManagerGlobal#getWindowManagerService",
140             "android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow",
141             "android.view.inputmethod.InputMethodManager#isInEditMode",
142             "android.view.inputmethod.InputMethodManager#showSoftInput",
143             "android.widget.AbsListView#setupDeviceConfigProperties",
144             "android.widget.Magnifier#show",
145             "android.widget.RemoteViews#getApplicationInfo",
146             "com.android.internal.util.XmlUtils#convertValueToInt",
147             "com.android.internal.view.menu.MenuBuilder#createNewMenuItem",
148             "dalvik.system.VMRuntime#getNotifyNativeInterval",
149             "dalvik.system.VMRuntime#newUnpaddedArray",
150             "libcore.io.MemoryMappedFile#bigEndianIterator",
151             "libcore.io.MemoryMappedFile#close",
152             "libcore.io.MemoryMappedFile#mmapRO",
153             "libcore.util.NativeAllocationRegistry#applyFreeFunction",
154     };
155 
156     public final static String[] DELEGATE_CLASS_NATIVES = new String[] {
157             "android.os.SystemClock",
158             "android.view.Display",
159             "libcore.icu.ICU",
160     };
161 
162     /**
163      * The list of core classes to register with JNI
164      */
165     public final static String[] CORE_CLASS_NATIVES = new String[] {
166             "android.animation.PropertyValuesHolder",
167             "android.content.res.StringBlock",
168             "android.content.res.XmlBlock",
169             "android.os.SystemProperties",
170             "android.os.Trace",
171             "android.text.AndroidCharacter",
172             "android.util.Log",
173             "android.view.MotionEvent",
174             "com.android.internal.util.VirtualRefBasePtr",
175             "libcore.util.NativeAllocationRegistry_Delegate",
176     };
177 
178     /**
179      * The list of graphics classes to register with JNI
180      */
181     public final static String[] GRAPHICS_CLASS_NATIVES = new String[] {
182             "android.graphics.Bitmap",
183             "android.graphics.BitmapFactory",
184             "android.graphics.ByteBufferStreamAdaptor",
185             "android.graphics.Camera",
186             "android.graphics.Canvas",
187             "android.graphics.CanvasProperty",
188             "android.graphics.ColorFilter",
189             "android.graphics.ColorSpace",
190             "android.graphics.CreateJavaOutputStreamAdaptor",
191             "android.graphics.DrawFilter",
192             "android.graphics.FontFamily",
193             "android.graphics.Graphics",
194             "android.graphics.ImageDecoder",
195             "android.graphics.Interpolator",
196             "android.graphics.MaskFilter",
197             "android.graphics.Matrix",
198             "android.graphics.NinePatch",
199             "android.graphics.Paint",
200             "android.graphics.Path",
201             "android.graphics.PathEffect",
202             "android.graphics.PathMeasure",
203             "android.graphics.Picture",
204             "android.graphics.RecordingCanvas",
205             "android.graphics.Region",
206             "android.graphics.RenderEffect",
207             "android.graphics.RenderNode",
208             "android.graphics.Shader",
209             "android.graphics.Typeface",
210             "android.graphics.YuvImage",
211             "android.graphics.animation.NativeInterpolatorFactory",
212             "android.graphics.animation.RenderNodeAnimator",
213             "android.graphics.drawable.AnimatedVectorDrawable",
214             "android.graphics.drawable.VectorDrawable",
215             "android.graphics.fonts.Font",
216             "android.graphics.fonts.FontFamily",
217             "android.graphics.text.LineBreaker",
218             "android.graphics.text.MeasuredText",
219             "android.graphics.text.TextRunShaper",
220             "android.util.PathParser",
221     };
222 }
223