| 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 static final 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 static final 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 static final String TAG_UNSUPPORTED = "unsupported"; |
| 46 |
|
| 47 |
/** |
| 48 |
* Tag for error when something really unexpected happens. |
| 49 |
*/ |
| 50 |
public static final 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 static final 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 static final 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 static final String TAG_RESOURCES_READ = TAG_RESOURCES_PREFIX + "read"; |
| 70 |
|
| 71 |
/** |
| 72 |
* Tag for wrong format in a resource value. |
| 73 |
*/ |
| 74 |
public static final 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 static final String TAG_MATRIX_AFFINE = TAG_MATRIX_PREFIX + "affine"; |
| 80 |
|
| 81 |
/** |
| 82 |
* Tag used when a matrix cannot be inverted. |
| 83 |
*/ |
| 84 |
public static final 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 static final String TAG_MASKFILTER = "maskfilter"; |
| 90 |
|
| 91 |
/** |
| 92 |
* Fidelity Tag used when a draw filter type is used but is not supported. |
| 93 |
*/ |
| 94 |
public static final String TAG_DRAWFILTER = "drawfilter"; |
| 95 |
|
| 96 |
/** |
| 97 |
* Fidelity Tag used when a path effect type is used but is not supported. |
| 98 |
*/ |
| 99 |
public static final String TAG_PATHEFFECT = "patheffect"; |
| 100 |
|
| 101 |
/** |
| 102 |
* Fidelity Tag used when a color filter type is used but is not supported. |
| 103 |
*/ |
| 104 |
public static final String TAG_COLORFILTER = "colorfilter"; |
| 105 |
|
| 106 |
/** |
| 107 |
* Fidelity Tag used when a rasterize type is used but is not supported. |
| 108 |
*/ |
| 109 |
public static final String TAG_RASTERIZER = "rasterizer"; |
| 110 |
|
| 111 |
/** |
| 112 |
* Fidelity Tag used when a shader type is used but is not supported. |
| 113 |
*/ |
| 114 |
public static final String TAG_SHADER = "shader"; |
| 115 |
|
| 116 |
/** |
| 117 |
* Fidelity Tag used when an unrecognized format is found for strftime. |
| 118 |
*/ |
| 119 |
public static final String TAG_STRFTIME = "strftime"; |
| 120 |
|
| 121 |
/** |
| 122 |
* Fidelity Tag used when a xfermode type is used but is not supported. |
| 123 |
*/ |
| 124 |
public static final String TAG_XFERMODE = "xfermode"; |
| 125 |
|
| 126 |
/** |
| 127 |
* Tag for reporting missing assets, or problem loading them. |
| 128 |
*/ |
| 129 |
public static final String TAG_MISSING_ASSET = "missingasset"; |
| 130 |
|
| 131 |
/** |
| 132 |
* Fidelity Tag used when something went wrong in rendering text. |
| 133 |
*/ |
| 134 |
public static final String TAG_TEXT_RENDERING = "textRendering"; |
| 135 |
|
| 136 |
/** |
| 137 |
* Tag for reporting RTL being used with API lower than 17. |
| 138 |
*/ |
| 139 |
public static final String TAG_RTL_NOT_SUPPORTED = "rtl-not-supported"; |
| 140 |
|
| 141 |
/** |
| 142 |
* Tag for reporting RTL being used with android:supportsRtl="false". |
| 143 |
*/ |
| 144 |
public static final String TAG_RTL_NOT_ENABLED = "rtl-not-enabled"; |
| 145 |
|
| 146 |
/** |
| 147 |
* Tag for reporting messages that should not be logged in the render error panel, |
| 148 |
* but silently logged to a more detailed log file. |
| 149 |
*/ |
| 150 |
public static final String TAG_INFO = "info"; |
| 151 |
|
| 152 |
/** |
| 153 |
* Logs a warning. |
| 154 |
* @param tag a tag describing the type of the warning |
| 155 |
* @param message the message of the warning |
| 156 |
* @param data an optional data bundle that the client can use to improve the warning display. |
| 157 |
*/ |
| 158 |
public void warning(String tag, String message, Object data) { |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 162 |
* Logs a fidelity warning. |
| 163 |
* |
| 164 |
* This type of warning indicates that the render will not be |
| 165 |
* the same as the rendering on a device due to limitation of the Java rendering API. |
| 166 |
* |
| 167 |
* @param tag a tag describing the type of the warning |
| 168 |
* @param message the message of the warning |
| 169 |
* @param throwable an optional Throwable that triggered the warning |
| 170 |
* @param data an optional data bundle that the client can use to improve the warning display. |
| 171 |
*/ |
| 172 |
public void fidelityWarning(String tag, String message, Throwable throwable, Object data) { |
| 173 |
} |
| 174 |
|
| 175 |
/** |
| 176 |
* Logs an error. |
| 177 |
* |
| 178 |
* @param tag a tag describing the type of the error |
| 179 |
* @param message the message of the error |
| 180 |
* @param data an optional data bundle that the client can use to improve the error display. |
| 181 |
*/ |
| 182 |
public void error(String tag, String message, Object data) { |
| 183 |
} |
| 184 |
|
| 185 |
/** |
| 186 |
* Logs an error, and the {@link Throwable} that triggered it. |
| 187 |
* |
| 188 |
* @param tag a tag describing the type of the error |
| 189 |
* @param message the message of the error |
| 190 |
* @param throwable the Throwable that triggered the error |
| 191 |
* @param data an optional data bundle that the client can use to improve the error display. |
| 192 |
*/ |
| 193 |
public void error(String tag, String message, Throwable throwable, Object data) { |
| 194 |
} |
| 195 |
} |