14a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet/*
24a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * Copyright (C) 2010 The Android Open Source Project
34a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet *
44a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * Licensed under the Apache License, Version 2.0 (the "License");
54a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * you may not use this file except in compliance with the License.
64a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * You may obtain a copy of the License at
74a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet *
84a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet *      http://www.apache.org/licenses/LICENSE-2.0
94a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet *
104a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * Unless required by applicable law or agreed to in writing, software
114a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * distributed under the License is distributed on an "AS IS" BASIS,
124a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * See the License for the specific language governing permissions and
144a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet * limitations under the License.
154a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet */
164a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet
1795b17a5e62eeeb7b38ef668508df43a1ee9e0880Xavier Ducrohetpackage com.android.ide.common.rendering.api;
184a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet
19e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet/**
20e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet * Log class for actions executed through {@link Bridge} and {@link RenderSession}.
21e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet */
224a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohetpublic class LayoutLog {
23e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
24e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Prefix for resource warnings/errors. This is not meant to be used as-is by the Layout
25e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Library, but is there to help test against a wider type of warning/error.
26e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * <p/>
27e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * {@code tag.startsWith(LayoutLog.TAG_RESOURCE_PREFIX} will test if the tag is any type
28e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * of resource warning/error
29e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
30ff9bd89aa4c7811ea641044edf2f63ca3e9b7dbfXavier Ducrohet    public final static String TAG_RESOURCES_PREFIX = "resources.";
31e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
32e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
33e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Prefix for matrix warnings/errors. This is not meant to be used as-is by the Layout
34e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Library, but is there to help test against a wider type of warning/error.
35e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * <p/>
36e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * {@code tag.startsWith(LayoutLog.TAG_MATRIX_PREFIX} will test if the tag is any type
37e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * of matrix warning/error
38e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
39ff9bd89aa4c7811ea641044edf2f63ca3e9b7dbfXavier Ducrohet    public final static String TAG_MATRIX_PREFIX = "matrix.";
404a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet
41e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
42e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Tag for unsupported feature that can have a big impact on the rendering. For instance, aild
43e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * access.
44e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
450885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_UNSUPPORTED = "unsupported";
46e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
47e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
48e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Tag for error when something really unexpected happens.
49e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
500885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_BROKEN = "broken";
51e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
52e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
53e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Tag for resource resolution failure.
54e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * In this case the warning/error data object will be a ResourceValue containing the type
55e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * and name of the resource that failed to resolve
56e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
57ff9bd89aa4c7811ea641044edf2f63ca3e9b7dbfXavier Ducrohet    public final static String TAG_RESOURCES_RESOLVE = TAG_RESOURCES_PREFIX + "resolve";
58e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
59e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
608c224181ef61400338120015d1228513104a19e3Tor Norbye     * Tag for resource resolution failure, specifically for theme attributes.
618c224181ef61400338120015d1228513104a19e3Tor Norbye     * In this case the warning/error data object will be a ResourceValue containing the type
628c224181ef61400338120015d1228513104a19e3Tor Norbye     * and name of the resource that failed to resolve
638c224181ef61400338120015d1228513104a19e3Tor Norbye     */
648c224181ef61400338120015d1228513104a19e3Tor Norbye    public final static String TAG_RESOURCES_RESOLVE_THEME_ATTR = TAG_RESOURCES_RESOLVE + ".theme";
658c224181ef61400338120015d1228513104a19e3Tor Norbye
668c224181ef61400338120015d1228513104a19e3Tor Norbye    /**
67e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Tag for failure when reading the content of a resource file.
68e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
69ff9bd89aa4c7811ea641044edf2f63ca3e9b7dbfXavier Ducrohet    public final static String TAG_RESOURCES_READ = TAG_RESOURCES_PREFIX + "read";
70e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
71e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
72e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Tag for wrong format in a resource value.
73e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
74ff9bd89aa4c7811ea641044edf2f63ca3e9b7dbfXavier Ducrohet    public final static String TAG_RESOURCES_FORMAT = TAG_RESOURCES_PREFIX + "format";
75e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
76e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
77e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a non affine transformation matrix is used in a Java API.
78e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
79ff9bd89aa4c7811ea641044edf2f63ca3e9b7dbfXavier Ducrohet    public final static String TAG_MATRIX_AFFINE = TAG_MATRIX_PREFIX + "affine";
80e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
81e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
82e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Tag used when a matrix cannot be inverted.
83e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
84ff9bd89aa4c7811ea641044edf2f63ca3e9b7dbfXavier Ducrohet    public final static String TAG_MATRIX_INVERSE = TAG_MATRIX_PREFIX + "inverse";
85e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
86e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
87e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a mask filter type is used but is not supported.
88e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
890885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_MASKFILTER = "maskfilter";
90e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
91e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
92e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a draw filter type is used but is not supported.
93e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
940885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_DRAWFILTER = "drawfilter";
95e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
96e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
97e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a path effect type is used but is not supported.
98e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
990885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_PATHEFFECT = "patheffect";
100e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
101e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
102e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a color filter type is used but is not supported.
103e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
1040885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_COLORFILTER = "colorfilter";
105e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
106e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
107e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a rasterize type is used but is not supported.
108e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
1090885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_RASTERIZER = "rasterizer";
110e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet
111e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
112e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a shader type is used but is not supported.
113e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
1140885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet    public final static String TAG_SHADER = "shader";
1150885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet
116e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
117e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Fidelity Tag used when a xfermode type is used but is not supported.
118e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
119e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    public final static String TAG_XFERMODE = "xfermode";
1200885ec5d54e6105a0c9e66ecf3874862da341ddfXavier Ducrohet
121e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
122e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Logs a warning.
123e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param tag a tag describing the type of the warning
124e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param message the message of the warning
125e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param data an optional data bundle that the client can use to improve the warning display.
126e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
127e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    public void warning(String tag, String message, Object data) {
1284a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet    }
1294a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet
130e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
131e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Logs a fidelity warning.
132e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     *
133e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * This type of warning indicates that the render will not be
134e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * the same as the rendering on a device due to limitation of the Java rendering API.
135e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     *
136e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param tag a tag describing the type of the warning
137e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param message the message of the warning
138e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param throwable an optional Throwable that triggered the warning
139e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param data an optional data bundle that the client can use to improve the warning display.
140e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
141e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    public void fidelityWarning(String tag, String message, Throwable throwable, Object data) {
1424a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet    }
1434a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet
144e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    /**
145e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Logs an error.
146e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     *
147e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param tag a tag describing the type of the error
148e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param message the message of the error
149e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param data an optional data bundle that the client can use to improve the error display.
150e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     */
151e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    public void error(String tag, String message, Object data) {
1524a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet    }
1534a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet
1544a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet    /**
155e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * Logs an error, and the {@link Throwable} that triggered it.
156e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     *
157e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param tag a tag describing the type of the error
158e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param message the message of the error
159e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param throwable the Throwable that triggered the error
160e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet     * @param data an optional data bundle that the client can use to improve the error display.
1614a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet     */
162e27048c0ad370285d016b4c647157461e108bcb5Xavier Ducrohet    public void error(String tag, String message, Throwable throwable, Object data) {
1634a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet    }
1644a5b20681dd98b35614fd2dd02c2e3afcaa1b321Xavier Ducrohet}
165