• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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.ide.common.rendering.api;
18 
19 /**
20  * Log class for actions executed through {@link Bridge} and {@link RenderSession}.
21  */
22 public class LayoutLog {
23     /**
24      * Prefix for resource warnings/errors. This is not meant to be used as-is by the Layout
25      * Library, but is there to help test against a wider type of warning/error.
26      * <p/>
27      * {@code tag.startsWith(LayoutLog.TAG_RESOURCE_PREFIX} will test if the tag is any type
28      * of resource warning/error
29      */
30     public final static String TAG_RESOURCES_PREFIX = "resources.";
31 
32     /**
33      * Prefix for matrix warnings/errors. This is not meant to be used as-is by the Layout
34      * Library, but is there to help test against a wider type of warning/error.
35      * <p/>
36      * {@code tag.startsWith(LayoutLog.TAG_MATRIX_PREFIX} will test if the tag is any type
37      * of matrix warning/error
38      */
39     public final static String TAG_MATRIX_PREFIX = "matrix.";
40 
41     /**
42      * Tag for unsupported feature that can have a big impact on the rendering. For instance, aild
43      * access.
44      */
45     public final static String TAG_UNSUPPORTED = "unsupported";
46 
47     /**
48      * Tag for error when something really unexpected happens.
49      */
50     public final static String TAG_BROKEN = "broken";
51 
52     /**
53      * Tag for resource resolution failure.
54      * In this case the warning/error data object will be a ResourceValue containing the type
55      * and name of the resource that failed to resolve
56      */
57     public final static String TAG_RESOURCES_RESOLVE = TAG_RESOURCES_PREFIX + "resolve";
58 
59     /**
60      * Tag for resource resolution failure, specifically for theme attributes.
61      * In this case the warning/error data object will be a ResourceValue containing the type
62      * and name of the resource that failed to resolve
63      */
64     public final static String TAG_RESOURCES_RESOLVE_THEME_ATTR = TAG_RESOURCES_RESOLVE + ".theme";
65 
66     /**
67      * Tag for failure when reading the content of a resource file.
68      */
69     public final static String TAG_RESOURCES_READ = TAG_RESOURCES_PREFIX + "read";
70 
71     /**
72      * Tag for wrong format in a resource value.
73      */
74     public final static String TAG_RESOURCES_FORMAT = TAG_RESOURCES_PREFIX + "format";
75 
76     /**
77      * Fidelity Tag used when a non affine transformation matrix is used in a Java API.
78      */
79     public final static String TAG_MATRIX_AFFINE = TAG_MATRIX_PREFIX + "affine";
80 
81     /**
82      * Tag used when a matrix cannot be inverted.
83      */
84     public final static String TAG_MATRIX_INVERSE = TAG_MATRIX_PREFIX + "inverse";
85 
86     /**
87      * Fidelity Tag used when a mask filter type is used but is not supported.
88      */
89     public final static String TAG_MASKFILTER = "maskfilter";
90 
91     /**
92      * Fidelity Tag used when a draw filter type is used but is not supported.
93      */
94     public final static String TAG_DRAWFILTER = "drawfilter";
95 
96     /**
97      * Fidelity Tag used when a path effect type is used but is not supported.
98      */
99     public final static String TAG_PATHEFFECT = "patheffect";
100 
101     /**
102      * Fidelity Tag used when a color filter type is used but is not supported.
103      */
104     public final static String TAG_COLORFILTER = "colorfilter";
105 
106     /**
107      * Fidelity Tag used when a rasterize type is used but is not supported.
108      */
109     public final static String TAG_RASTERIZER = "rasterizer";
110 
111     /**
112      * Fidelity Tag used when a shader type is used but is not supported.
113      */
114     public final static String TAG_SHADER = "shader";
115 
116     /**
117      * Fidelity Tag used when a xfermode type is used but is not supported.
118      */
119     public final static String TAG_XFERMODE = "xfermode";
120 
121     /**
122      * Logs a warning.
123      * @param tag a tag describing the type of the warning
124      * @param message the message of the warning
125      * @param data an optional data bundle that the client can use to improve the warning display.
126      */
warning(String tag, String message, Object data)127     public void warning(String tag, String message, Object data) {
128     }
129 
130     /**
131      * Logs a fidelity warning.
132      *
133      * This type of warning indicates that the render will not be
134      * the same as the rendering on a device due to limitation of the Java rendering API.
135      *
136      * @param tag a tag describing the type of the warning
137      * @param message the message of the warning
138      * @param throwable an optional Throwable that triggered the warning
139      * @param data an optional data bundle that the client can use to improve the warning display.
140      */
fidelityWarning(String tag, String message, Throwable throwable, Object data)141     public void fidelityWarning(String tag, String message, Throwable throwable, Object data) {
142     }
143 
144     /**
145      * Logs an error.
146      *
147      * @param tag a tag describing the type of the error
148      * @param message the message of the error
149      * @param data an optional data bundle that the client can use to improve the error display.
150      */
error(String tag, String message, Object data)151     public void error(String tag, String message, Object data) {
152     }
153 
154     /**
155      * Logs an error, and the {@link Throwable} that triggered it.
156      *
157      * @param tag a tag describing the type of the error
158      * @param message the message of the error
159      * @param throwable the Throwable that triggered the error
160      * @param data an optional data bundle that the client can use to improve the error display.
161      */
error(String tag, String message, Throwable throwable, Object data)162     public void error(String tag, String message, Throwable throwable, Object data) {
163     }
164 }
165