Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 17 | #include "SdkConstants.h" |
| 18 | |
| 19 | #include <algorithm> |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 20 | #include <string> |
| 21 | #include <unordered_map> |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 22 | #include <vector> |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 23 | |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 24 | using android::StringPiece; |
| 25 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 26 | namespace aapt { |
| 27 | |
Adam Lesinski | d0f116b | 2016-07-08 15:00:32 -0700 | [diff] [blame] | 28 | static const char* sDevelopmentSdkCodeName = "O"; |
Adam Lesinski | fb6312f | 2016-06-28 14:40:32 -0700 | [diff] [blame] | 29 | static int sDevelopmentSdkLevel = 26; |
| 30 | |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 31 | static const std::vector<std::pair<uint16_t, size_t>> sAttrIdMap = { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 32 | {0x021c, 1}, |
| 33 | {0x021d, 2}, |
| 34 | {0x0269, SDK_CUPCAKE}, |
| 35 | {0x028d, SDK_DONUT}, |
| 36 | {0x02ad, SDK_ECLAIR}, |
| 37 | {0x02b3, SDK_ECLAIR_0_1}, |
| 38 | {0x02b5, SDK_ECLAIR_MR1}, |
| 39 | {0x02bd, SDK_FROYO}, |
| 40 | {0x02cb, SDK_GINGERBREAD}, |
| 41 | {0x0361, SDK_HONEYCOMB}, |
| 42 | {0x0363, SDK_HONEYCOMB_MR1}, |
| 43 | {0x0366, SDK_HONEYCOMB_MR2}, |
| 44 | {0x03a6, SDK_ICE_CREAM_SANDWICH}, |
| 45 | {0x03ae, SDK_JELLY_BEAN}, |
| 46 | {0x03cc, SDK_JELLY_BEAN_MR1}, |
| 47 | {0x03da, SDK_JELLY_BEAN_MR2}, |
| 48 | {0x03f1, SDK_KITKAT}, |
| 49 | {0x03f6, SDK_KITKAT_WATCH}, |
| 50 | {0x04ce, SDK_LOLLIPOP}, |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 53 | static bool less_entry_id(const std::pair<uint16_t, size_t>& p, |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 54 | uint16_t entryId) { |
| 55 | return p.first < entryId; |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 56 | } |
| 57 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 58 | size_t FindAttributeSdkLevel(const ResourceId& id) { |
| 59 | if (id.package_id() != 0x01 && id.type_id() != 0x01) { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 60 | return 0; |
| 61 | } |
| 62 | auto iter = std::lower_bound(sAttrIdMap.begin(), sAttrIdMap.end(), |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 63 | id.entry_id(), less_entry_id); |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 64 | if (iter == sAttrIdMap.end()) { |
| 65 | return SDK_LOLLIPOP_MR1; |
| 66 | } |
| 67 | return iter->second; |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 68 | } |
| 69 | |
Adam Lesinski | d0f116b | 2016-07-08 15:00:32 -0700 | [diff] [blame] | 70 | static const std::unordered_map<std::string, size_t> sAttrMap = { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 71 | {"marqueeRepeatLimit", 2}, |
| 72 | {"windowNoDisplay", 3}, |
| 73 | {"backgroundDimEnabled", 3}, |
| 74 | {"inputType", 3}, |
| 75 | {"isDefault", 3}, |
| 76 | {"windowDisablePreview", 3}, |
| 77 | {"privateImeOptions", 3}, |
| 78 | {"editorExtras", 3}, |
| 79 | {"settingsActivity", 3}, |
| 80 | {"fastScrollEnabled", 3}, |
| 81 | {"reqTouchScreen", 3}, |
| 82 | {"reqKeyboardType", 3}, |
| 83 | {"reqHardKeyboard", 3}, |
| 84 | {"reqNavigation", 3}, |
| 85 | {"windowSoftInputMode", 3}, |
| 86 | {"imeFullscreenBackground", 3}, |
| 87 | {"noHistory", 3}, |
| 88 | {"headerDividersEnabled", 3}, |
| 89 | {"footerDividersEnabled", 3}, |
| 90 | {"candidatesTextStyleSpans", 3}, |
| 91 | {"smoothScrollbar", 3}, |
| 92 | {"reqFiveWayNav", 3}, |
| 93 | {"keyBackground", 3}, |
| 94 | {"keyTextSize", 3}, |
| 95 | {"labelTextSize", 3}, |
| 96 | {"keyTextColor", 3}, |
| 97 | {"keyPreviewLayout", 3}, |
| 98 | {"keyPreviewOffset", 3}, |
| 99 | {"keyPreviewHeight", 3}, |
| 100 | {"verticalCorrection", 3}, |
| 101 | {"popupLayout", 3}, |
| 102 | {"state_long_pressable", 3}, |
| 103 | {"keyWidth", 3}, |
| 104 | {"keyHeight", 3}, |
| 105 | {"horizontalGap", 3}, |
| 106 | {"verticalGap", 3}, |
| 107 | {"rowEdgeFlags", 3}, |
| 108 | {"codes", 3}, |
| 109 | {"popupKeyboard", 3}, |
| 110 | {"popupCharacters", 3}, |
| 111 | {"keyEdgeFlags", 3}, |
| 112 | {"isModifier", 3}, |
| 113 | {"isSticky", 3}, |
| 114 | {"isRepeatable", 3}, |
| 115 | {"iconPreview", 3}, |
| 116 | {"keyOutputText", 3}, |
| 117 | {"keyLabel", 3}, |
| 118 | {"keyIcon", 3}, |
| 119 | {"keyboardMode", 3}, |
| 120 | {"isScrollContainer", 3}, |
| 121 | {"fillEnabled", 3}, |
| 122 | {"updatePeriodMillis", 3}, |
| 123 | {"initialLayout", 3}, |
| 124 | {"voiceSearchMode", 3}, |
| 125 | {"voiceLanguageModel", 3}, |
| 126 | {"voicePromptText", 3}, |
| 127 | {"voiceLanguage", 3}, |
| 128 | {"voiceMaxResults", 3}, |
| 129 | {"bottomOffset", 3}, |
| 130 | {"topOffset", 3}, |
| 131 | {"allowSingleTap", 3}, |
| 132 | {"handle", 3}, |
| 133 | {"content", 3}, |
| 134 | {"animateOnClick", 3}, |
| 135 | {"configure", 3}, |
| 136 | {"hapticFeedbackEnabled", 3}, |
| 137 | {"innerRadius", 3}, |
| 138 | {"thickness", 3}, |
| 139 | {"sharedUserLabel", 3}, |
| 140 | {"dropDownWidth", 3}, |
| 141 | {"dropDownAnchor", 3}, |
| 142 | {"imeOptions", 3}, |
| 143 | {"imeActionLabel", 3}, |
| 144 | {"imeActionId", 3}, |
| 145 | {"imeExtractEnterAnimation", 3}, |
| 146 | {"imeExtractExitAnimation", 3}, |
| 147 | {"tension", 4}, |
| 148 | {"extraTension", 4}, |
| 149 | {"anyDensity", 4}, |
| 150 | {"searchSuggestThreshold", 4}, |
| 151 | {"includeInGlobalSearch", 4}, |
| 152 | {"onClick", 4}, |
| 153 | {"targetSdkVersion", 4}, |
| 154 | {"maxSdkVersion", 4}, |
| 155 | {"testOnly", 4}, |
| 156 | {"contentDescription", 4}, |
| 157 | {"gestureStrokeWidth", 4}, |
| 158 | {"gestureColor", 4}, |
| 159 | {"uncertainGestureColor", 4}, |
| 160 | {"fadeOffset", 4}, |
| 161 | {"fadeDuration", 4}, |
| 162 | {"gestureStrokeType", 4}, |
| 163 | {"gestureStrokeLengthThreshold", 4}, |
| 164 | {"gestureStrokeSquarenessThreshold", 4}, |
| 165 | {"gestureStrokeAngleThreshold", 4}, |
| 166 | {"eventsInterceptionEnabled", 4}, |
| 167 | {"fadeEnabled", 4}, |
| 168 | {"backupAgent", 4}, |
| 169 | {"allowBackup", 4}, |
| 170 | {"glEsVersion", 4}, |
| 171 | {"queryAfterZeroResults", 4}, |
| 172 | {"dropDownHeight", 4}, |
| 173 | {"smallScreens", 4}, |
| 174 | {"normalScreens", 4}, |
| 175 | {"largeScreens", 4}, |
| 176 | {"progressBarStyleInverse", 4}, |
| 177 | {"progressBarStyleSmallInverse", 4}, |
| 178 | {"progressBarStyleLargeInverse", 4}, |
| 179 | {"searchSettingsDescription", 4}, |
| 180 | {"textColorPrimaryInverseDisableOnly", 4}, |
| 181 | {"autoUrlDetect", 4}, |
| 182 | {"resizeable", 4}, |
| 183 | {"required", 5}, |
| 184 | {"accountType", 5}, |
| 185 | {"contentAuthority", 5}, |
| 186 | {"userVisible", 5}, |
| 187 | {"windowShowWallpaper", 5}, |
| 188 | {"wallpaperOpenEnterAnimation", 5}, |
| 189 | {"wallpaperOpenExitAnimation", 5}, |
| 190 | {"wallpaperCloseEnterAnimation", 5}, |
| 191 | {"wallpaperCloseExitAnimation", 5}, |
| 192 | {"wallpaperIntraOpenEnterAnimation", 5}, |
| 193 | {"wallpaperIntraOpenExitAnimation", 5}, |
| 194 | {"wallpaperIntraCloseEnterAnimation", 5}, |
| 195 | {"wallpaperIntraCloseExitAnimation", 5}, |
| 196 | {"supportsUploading", 5}, |
| 197 | {"killAfterRestore", 5}, |
| 198 | {"restoreNeedsApplication", 5}, |
| 199 | {"smallIcon", 5}, |
| 200 | {"accountPreferences", 5}, |
| 201 | {"textAppearanceSearchResultSubtitle", 5}, |
| 202 | {"textAppearanceSearchResultTitle", 5}, |
| 203 | {"summaryColumn", 5}, |
| 204 | {"detailColumn", 5}, |
| 205 | {"detailSocialSummary", 5}, |
| 206 | {"thumbnail", 5}, |
| 207 | {"detachWallpaper", 5}, |
| 208 | {"finishOnCloseSystemDialogs", 5}, |
| 209 | {"scrollbarFadeDuration", 5}, |
| 210 | {"scrollbarDefaultDelayBeforeFade", 5}, |
| 211 | {"fadeScrollbars", 5}, |
| 212 | {"colorBackgroundCacheHint", 5}, |
| 213 | {"dropDownHorizontalOffset", 5}, |
| 214 | {"dropDownVerticalOffset", 5}, |
| 215 | {"quickContactBadgeStyleWindowSmall", 6}, |
| 216 | {"quickContactBadgeStyleWindowMedium", 6}, |
| 217 | {"quickContactBadgeStyleWindowLarge", 6}, |
| 218 | {"quickContactBadgeStyleSmallWindowSmall", 6}, |
| 219 | {"quickContactBadgeStyleSmallWindowMedium", 6}, |
| 220 | {"quickContactBadgeStyleSmallWindowLarge", 6}, |
| 221 | {"author", 7}, |
| 222 | {"autoStart", 7}, |
| 223 | {"expandableListViewWhiteStyle", 8}, |
| 224 | {"installLocation", 8}, |
| 225 | {"vmSafeMode", 8}, |
| 226 | {"webTextViewStyle", 8}, |
| 227 | {"restoreAnyVersion", 8}, |
| 228 | {"tabStripLeft", 8}, |
| 229 | {"tabStripRight", 8}, |
| 230 | {"tabStripEnabled", 8}, |
| 231 | {"logo", 9}, |
| 232 | {"xlargeScreens", 9}, |
| 233 | {"immersive", 9}, |
| 234 | {"overScrollMode", 9}, |
| 235 | {"overScrollHeader", 9}, |
| 236 | {"overScrollFooter", 9}, |
| 237 | {"filterTouchesWhenObscured", 9}, |
| 238 | {"textSelectHandleLeft", 9}, |
| 239 | {"textSelectHandleRight", 9}, |
| 240 | {"textSelectHandle", 9}, |
| 241 | {"textSelectHandleWindowStyle", 9}, |
| 242 | {"popupAnimationStyle", 9}, |
| 243 | {"screenSize", 9}, |
| 244 | {"screenDensity", 9}, |
| 245 | {"allContactsName", 11}, |
| 246 | {"windowActionBar", 11}, |
| 247 | {"actionBarStyle", 11}, |
| 248 | {"navigationMode", 11}, |
| 249 | {"displayOptions", 11}, |
| 250 | {"subtitle", 11}, |
| 251 | {"customNavigationLayout", 11}, |
| 252 | {"hardwareAccelerated", 11}, |
| 253 | {"measureWithLargestChild", 11}, |
| 254 | {"animateFirstView", 11}, |
| 255 | {"dropDownSpinnerStyle", 11}, |
| 256 | {"actionDropDownStyle", 11}, |
| 257 | {"actionButtonStyle", 11}, |
| 258 | {"showAsAction", 11}, |
| 259 | {"previewImage", 11}, |
| 260 | {"actionModeBackground", 11}, |
| 261 | {"actionModeCloseDrawable", 11}, |
| 262 | {"windowActionModeOverlay", 11}, |
| 263 | {"valueFrom", 11}, |
| 264 | {"valueTo", 11}, |
| 265 | {"valueType", 11}, |
| 266 | {"propertyName", 11}, |
| 267 | {"ordering", 11}, |
| 268 | {"fragment", 11}, |
| 269 | {"windowActionBarOverlay", 11}, |
| 270 | {"fragmentOpenEnterAnimation", 11}, |
| 271 | {"fragmentOpenExitAnimation", 11}, |
| 272 | {"fragmentCloseEnterAnimation", 11}, |
| 273 | {"fragmentCloseExitAnimation", 11}, |
| 274 | {"fragmentFadeEnterAnimation", 11}, |
| 275 | {"fragmentFadeExitAnimation", 11}, |
| 276 | {"actionBarSize", 11}, |
| 277 | {"imeSubtypeLocale", 11}, |
| 278 | {"imeSubtypeMode", 11}, |
| 279 | {"imeSubtypeExtraValue", 11}, |
| 280 | {"splitMotionEvents", 11}, |
| 281 | {"listChoiceBackgroundIndicator", 11}, |
| 282 | {"spinnerMode", 11}, |
| 283 | {"animateLayoutChanges", 11}, |
| 284 | {"actionBarTabStyle", 11}, |
| 285 | {"actionBarTabBarStyle", 11}, |
| 286 | {"actionBarTabTextStyle", 11}, |
| 287 | {"actionOverflowButtonStyle", 11}, |
| 288 | {"actionModeCloseButtonStyle", 11}, |
| 289 | {"titleTextStyle", 11}, |
| 290 | {"subtitleTextStyle", 11}, |
| 291 | {"iconifiedByDefault", 11}, |
| 292 | {"actionLayout", 11}, |
| 293 | {"actionViewClass", 11}, |
| 294 | {"activatedBackgroundIndicator", 11}, |
| 295 | {"state_activated", 11}, |
| 296 | {"listPopupWindowStyle", 11}, |
| 297 | {"popupMenuStyle", 11}, |
| 298 | {"textAppearanceLargePopupMen", 11}, |
| 299 | {"textAppearanceSmallPopupMen", 11}, |
| 300 | {"breadCrumbTitle", 11}, |
| 301 | {"breadCrumbShortTitle", 11}, |
| 302 | {"listDividerAlertDialog", 11}, |
| 303 | {"textColorAlertDialogListItem", 11}, |
| 304 | {"loopViews", 11}, |
| 305 | {"dialogTheme", 11}, |
| 306 | {"alertDialogTheme", 11}, |
| 307 | {"dividerVertical", 11}, |
| 308 | {"homeAsUpIndicator", 11}, |
| 309 | {"enterFadeDuration", 11}, |
| 310 | {"exitFadeDuration", 11}, |
| 311 | {"selectableItemBackground", 11}, |
| 312 | {"autoAdvanceViewId", 11}, |
| 313 | {"useIntrinsicSizeAsMinimum", 11}, |
| 314 | {"actionModeCutDrawable", 11}, |
| 315 | {"actionModeCopyDrawable", 11}, |
| 316 | {"actionModePasteDrawable", 11}, |
| 317 | {"textEditPasteWindowLayout", 11}, |
| 318 | {"textEditNoPasteWindowLayout", 11}, |
| 319 | {"textIsSelectable", 11}, |
| 320 | {"windowEnableSplitTouch", 11}, |
| 321 | {"indeterminateProgressStyle", 11}, |
| 322 | {"progressBarPadding", 11}, |
| 323 | {"animationResolution", 11}, |
| 324 | {"state_accelerated", 11}, |
| 325 | {"baseline", 11}, |
| 326 | {"homeLayout", 11}, |
| 327 | {"opacity", 11}, |
| 328 | {"alpha", 11}, |
| 329 | {"transformPivotX", 11}, |
| 330 | {"transformPivotY", 11}, |
| 331 | {"translationX", 11}, |
| 332 | {"translationY", 11}, |
| 333 | {"scaleX", 11}, |
| 334 | {"scaleY", 11}, |
| 335 | {"rotation", 11}, |
| 336 | {"rotationX", 11}, |
| 337 | {"rotationY", 11}, |
| 338 | {"showDividers", 11}, |
| 339 | {"dividerPadding", 11}, |
| 340 | {"borderlessButtonStyle", 11}, |
| 341 | {"dividerHorizontal", 11}, |
| 342 | {"itemPadding", 11}, |
| 343 | {"buttonBarStyle", 11}, |
| 344 | {"buttonBarButtonStyle", 11}, |
| 345 | {"segmentedButtonStyle", 11}, |
| 346 | {"staticWallpaperPreview", 11}, |
| 347 | {"allowParallelSyncs", 11}, |
| 348 | {"isAlwaysSyncable", 11}, |
| 349 | {"verticalScrollbarPosition", 11}, |
| 350 | {"fastScrollAlwaysVisible", 11}, |
| 351 | {"fastScrollThumbDrawable", 11}, |
| 352 | {"fastScrollPreviewBackgroundLeft", 11}, |
| 353 | {"fastScrollPreviewBackgroundRight", 11}, |
| 354 | {"fastScrollTrackDrawable", 11}, |
| 355 | {"fastScrollOverlayPosition", 11}, |
| 356 | {"customTokens", 11}, |
| 357 | {"nextFocusForward", 11}, |
| 358 | {"firstDayOfWeek", 11}, |
| 359 | {"showWeekNumber", 11}, |
| 360 | {"minDate", 11}, |
| 361 | {"maxDate", 11}, |
| 362 | {"shownWeekCount", 11}, |
| 363 | {"selectedWeekBackgroundColor", 11}, |
| 364 | {"focusedMonthDateColor", 11}, |
| 365 | {"unfocusedMonthDateColor", 11}, |
| 366 | {"weekNumberColor", 11}, |
| 367 | {"weekSeparatorLineColor", 11}, |
| 368 | {"selectedDateVerticalBar", 11}, |
| 369 | {"weekDayTextAppearance", 11}, |
| 370 | {"dateTextAppearance", 11}, |
| 371 | {"solidColor", 11}, |
| 372 | {"spinnersShown", 11}, |
| 373 | {"calendarViewShown", 11}, |
| 374 | {"state_multiline", 11}, |
| 375 | {"detailsElementBackground", 11}, |
| 376 | {"textColorHighlightInverse", 11}, |
| 377 | {"textColorLinkInverse", 11}, |
| 378 | {"editTextColor", 11}, |
| 379 | {"editTextBackground", 11}, |
| 380 | {"horizontalScrollViewStyle", 11}, |
| 381 | {"layerType", 11}, |
| 382 | {"alertDialogIcon", 11}, |
| 383 | {"windowMinWidthMajor", 11}, |
| 384 | {"windowMinWidthMinor", 11}, |
| 385 | {"queryHint", 11}, |
| 386 | {"fastScrollTextColor", 11}, |
| 387 | {"largeHeap", 11}, |
| 388 | {"windowCloseOnTouchOutside", 11}, |
| 389 | {"datePickerStyle", 11}, |
| 390 | {"calendarViewStyle", 11}, |
| 391 | {"textEditSidePasteWindowLayout", 11}, |
| 392 | {"textEditSideNoPasteWindowLayout", 11}, |
| 393 | {"actionMenuTextAppearance", 11}, |
| 394 | {"actionMenuTextColor", 11}, |
| 395 | {"textCursorDrawable", 12}, |
| 396 | {"resizeMode", 12}, |
| 397 | {"requiresSmallestWidthDp", 12}, |
| 398 | {"compatibleWidthLimitDp", 12}, |
| 399 | {"largestWidthLimitDp", 12}, |
| 400 | {"state_hovered", 13}, |
| 401 | {"state_drag_can_accept", 13}, |
| 402 | {"state_drag_hovered", 13}, |
| 403 | {"stopWithTask", 13}, |
| 404 | {"switchTextOn", 13}, |
| 405 | {"switchTextOff", 13}, |
| 406 | {"switchPreferenceStyle", 13}, |
| 407 | {"switchTextAppearance", 13}, |
| 408 | {"track", 13}, |
| 409 | {"switchMinWidth", 13}, |
| 410 | {"switchPadding", 13}, |
| 411 | {"thumbTextPadding", 13}, |
| 412 | {"textSuggestionsWindowStyle", 13}, |
| 413 | {"textEditSuggestionItemLayout", 13}, |
| 414 | {"rowCount", 13}, |
| 415 | {"rowOrderPreserved", 13}, |
| 416 | {"columnCount", 13}, |
| 417 | {"columnOrderPreserved", 13}, |
| 418 | {"useDefaultMargins", 13}, |
| 419 | {"alignmentMode", 13}, |
| 420 | {"layout_row", 13}, |
| 421 | {"layout_rowSpan", 13}, |
| 422 | {"layout_columnSpan", 13}, |
| 423 | {"actionModeSelectAllDrawable", 13}, |
| 424 | {"isAuxiliary", 13}, |
| 425 | {"accessibilityEventTypes", 13}, |
| 426 | {"packageNames", 13}, |
| 427 | {"accessibilityFeedbackType", 13}, |
| 428 | {"notificationTimeout", 13}, |
| 429 | {"accessibilityFlags", 13}, |
| 430 | {"canRetrieveWindowContent", 13}, |
| 431 | {"listPreferredItemHeightLarge", 13}, |
| 432 | {"listPreferredItemHeightSmall", 13}, |
| 433 | {"actionBarSplitStyle", 13}, |
| 434 | {"actionProviderClass", 13}, |
| 435 | {"backgroundStacked", 13}, |
| 436 | {"backgroundSplit", 13}, |
| 437 | {"textAllCaps", 13}, |
| 438 | {"colorPressedHighlight", 13}, |
| 439 | {"colorLongPressedHighlight", 13}, |
| 440 | {"colorFocusedHighlight", 13}, |
| 441 | {"colorActivatedHighlight", 13}, |
| 442 | {"colorMultiSelectHighlight", 13}, |
| 443 | {"drawableStart", 13}, |
| 444 | {"drawableEnd", 13}, |
| 445 | {"actionModeStyle", 13}, |
| 446 | {"minResizeWidth", 13}, |
| 447 | {"minResizeHeight", 13}, |
| 448 | {"actionBarWidgetTheme", 13}, |
| 449 | {"uiOptions", 13}, |
| 450 | {"subtypeLocale", 13}, |
| 451 | {"subtypeExtraValue", 13}, |
| 452 | {"actionBarDivider", 13}, |
| 453 | {"actionBarItemBackground", 13}, |
| 454 | {"actionModeSplitBackground", 13}, |
| 455 | {"textAppearanceListItem", 13}, |
| 456 | {"textAppearanceListItemSmall", 13}, |
| 457 | {"targetDescriptions", 13}, |
| 458 | {"directionDescriptions", 13}, |
| 459 | {"overridesImplicitlyEnabledSubtype", 13}, |
| 460 | {"listPreferredItemPaddingLeft", 13}, |
| 461 | {"listPreferredItemPaddingRight", 13}, |
| 462 | {"requiresFadingEdge", 13}, |
| 463 | {"publicKey", 13}, |
| 464 | {"parentActivityName", 16}, |
| 465 | {"isolatedProcess", 16}, |
| 466 | {"importantForAccessibility", 16}, |
| 467 | {"keyboardLayout", 16}, |
| 468 | {"fontFamily", 16}, |
| 469 | {"mediaRouteButtonStyle", 16}, |
| 470 | {"mediaRouteTypes", 16}, |
| 471 | {"supportsRtl", 17}, |
| 472 | {"textDirection", 17}, |
| 473 | {"textAlignment", 17}, |
| 474 | {"layoutDirection", 17}, |
| 475 | {"paddingStart", 17}, |
| 476 | {"paddingEnd", 17}, |
| 477 | {"layout_marginStart", 17}, |
| 478 | {"layout_marginEnd", 17}, |
| 479 | {"layout_toStartOf", 17}, |
| 480 | {"layout_toEndOf", 17}, |
| 481 | {"layout_alignStart", 17}, |
| 482 | {"layout_alignEnd", 17}, |
| 483 | {"layout_alignParentStart", 17}, |
| 484 | {"layout_alignParentEnd", 17}, |
| 485 | {"listPreferredItemPaddingStart", 17}, |
| 486 | {"listPreferredItemPaddingEnd", 17}, |
| 487 | {"singleUser", 17}, |
| 488 | {"presentationTheme", 17}, |
| 489 | {"subtypeId", 17}, |
| 490 | {"initialKeyguardLayout", 17}, |
| 491 | {"widgetCategory", 17}, |
| 492 | {"permissionGroupFlags", 17}, |
| 493 | {"labelFor", 17}, |
| 494 | {"permissionFlags", 17}, |
| 495 | {"checkedTextViewStyle", 17}, |
| 496 | {"showOnLockScreen", 17}, |
| 497 | {"format12Hour", 17}, |
| 498 | {"format24Hour", 17}, |
| 499 | {"timeZone", 17}, |
| 500 | {"mipMap", 18}, |
| 501 | {"mirrorForRtl", 18}, |
| 502 | {"windowOverscan", 18}, |
| 503 | {"requiredForAllUsers", 18}, |
| 504 | {"indicatorStart", 18}, |
| 505 | {"indicatorEnd", 18}, |
| 506 | {"childIndicatorStart", 18}, |
| 507 | {"childIndicatorEnd", 18}, |
| 508 | {"restrictedAccountType", 18}, |
| 509 | {"requiredAccountType", 18}, |
| 510 | {"canRequestTouchExplorationMode", 18}, |
| 511 | {"canRequestEnhancedWebAccessibility", 18}, |
| 512 | {"canRequestFilterKeyEvents", 18}, |
| 513 | {"layoutMode", 18}, |
| 514 | {"keySet", 19}, |
| 515 | {"targetId", 19}, |
| 516 | {"fromScene", 19}, |
| 517 | {"toScene", 19}, |
| 518 | {"transition", 19}, |
| 519 | {"transitionOrdering", 19}, |
| 520 | {"fadingMode", 19}, |
| 521 | {"startDelay", 19}, |
| 522 | {"ssp", 19}, |
| 523 | {"sspPrefix", 19}, |
| 524 | {"sspPattern", 19}, |
| 525 | {"addPrintersActivity", 19}, |
| 526 | {"vendor", 19}, |
| 527 | {"category", 19}, |
| 528 | {"isAsciiCapable", 19}, |
| 529 | {"autoMirrored", 19}, |
| 530 | {"supportsSwitchingToNextInputMethod", 19}, |
| 531 | {"requireDeviceUnlock", 19}, |
| 532 | {"apduServiceBanner", 19}, |
| 533 | {"accessibilityLiveRegion", 19}, |
| 534 | {"windowTranslucentStatus", 19}, |
| 535 | {"windowTranslucentNavigation", 19}, |
| 536 | {"advancedPrintOptionsActivity", 19}, |
| 537 | {"banner", 20}, |
| 538 | {"windowSwipeToDismiss", 20}, |
| 539 | {"isGame", 20}, |
| 540 | {"allowEmbedded", 20}, |
| 541 | {"setupActivity", 20}, |
| 542 | {"fastScrollStyle", 21}, |
| 543 | {"windowContentTransitions", 21}, |
| 544 | {"windowContentTransitionManager", 21}, |
| 545 | {"translationZ", 21}, |
| 546 | {"tintMode", 21}, |
| 547 | {"controlX1", 21}, |
| 548 | {"controlY1", 21}, |
| 549 | {"controlX2", 21}, |
| 550 | {"controlY2", 21}, |
| 551 | {"transitionName", 21}, |
| 552 | {"transitionGroup", 21}, |
| 553 | {"viewportWidth", 21}, |
| 554 | {"viewportHeight", 21}, |
| 555 | {"fillColor", 21}, |
| 556 | {"pathData", 21}, |
| 557 | {"strokeColor", 21}, |
| 558 | {"strokeWidth", 21}, |
| 559 | {"trimPathStart", 21}, |
| 560 | {"trimPathEnd", 21}, |
| 561 | {"trimPathOffset", 21}, |
| 562 | {"strokeLineCap", 21}, |
| 563 | {"strokeLineJoin", 21}, |
| 564 | {"strokeMiterLimit", 21}, |
| 565 | {"colorControlNormal", 21}, |
| 566 | {"colorControlActivated", 21}, |
| 567 | {"colorButtonNormal", 21}, |
| 568 | {"colorControlHighlight", 21}, |
| 569 | {"persistableMode", 21}, |
| 570 | {"titleTextAppearance", 21}, |
| 571 | {"subtitleTextAppearance", 21}, |
| 572 | {"slideEdge", 21}, |
| 573 | {"actionBarTheme", 21}, |
| 574 | {"textAppearanceListItemSecondary", 21}, |
| 575 | {"colorPrimary", 21}, |
| 576 | {"colorPrimaryDark", 21}, |
| 577 | {"colorAccent", 21}, |
| 578 | {"nestedScrollingEnabled", 21}, |
| 579 | {"windowEnterTransition", 21}, |
| 580 | {"windowExitTransition", 21}, |
| 581 | {"windowSharedElementEnterTransition", 21}, |
| 582 | {"windowSharedElementExitTransition", 21}, |
| 583 | {"windowAllowReturnTransitionOverlap", 21}, |
| 584 | {"windowAllowEnterTransitionOverlap", 21}, |
| 585 | {"sessionService", 21}, |
| 586 | {"stackViewStyle", 21}, |
| 587 | {"switchStyle", 21}, |
| 588 | {"elevation", 21}, |
| 589 | {"excludeId", 21}, |
| 590 | {"excludeClass", 21}, |
| 591 | {"hideOnContentScroll", 21}, |
| 592 | {"actionOverflowMenuStyle", 21}, |
| 593 | {"documentLaunchMode", 21}, |
| 594 | {"maxRecents", 21}, |
| 595 | {"autoRemoveFromRecents", 21}, |
| 596 | {"stateListAnimator", 21}, |
| 597 | {"toId", 21}, |
| 598 | {"fromId", 21}, |
| 599 | {"reversible", 21}, |
| 600 | {"splitTrack", 21}, |
| 601 | {"targetName", 21}, |
| 602 | {"excludeName", 21}, |
| 603 | {"matchOrder", 21}, |
| 604 | {"windowDrawsSystemBarBackgrounds", 21}, |
| 605 | {"statusBarColor", 21}, |
| 606 | {"navigationBarColor", 21}, |
| 607 | {"contentInsetStart", 21}, |
| 608 | {"contentInsetEnd", 21}, |
| 609 | {"contentInsetLeft", 21}, |
| 610 | {"contentInsetRight", 21}, |
| 611 | {"paddingMode", 21}, |
| 612 | {"layout_rowWeight", 21}, |
| 613 | {"layout_columnWeight", 21}, |
| 614 | {"translateX", 21}, |
| 615 | {"translateY", 21}, |
| 616 | {"selectableItemBackgroundBorderless", 21}, |
| 617 | {"elegantTextHeight", 21}, |
| 618 | {"searchKeyphraseId", 21}, |
| 619 | {"searchKeyphrase", 21}, |
| 620 | {"searchKeyphraseSupportedLocales", 21}, |
| 621 | {"windowTransitionBackgroundFadeDuration", 21}, |
| 622 | {"overlapAnchor", 21}, |
| 623 | {"progressTint", 21}, |
| 624 | {"progressTintMode", 21}, |
| 625 | {"progressBackgroundTint", 21}, |
| 626 | {"progressBackgroundTintMode", 21}, |
| 627 | {"secondaryProgressTint", 21}, |
| 628 | {"secondaryProgressTintMode", 21}, |
| 629 | {"indeterminateTint", 21}, |
| 630 | {"indeterminateTintMode", 21}, |
| 631 | {"backgroundTint", 21}, |
| 632 | {"backgroundTintMode", 21}, |
| 633 | {"foregroundTint", 21}, |
| 634 | {"foregroundTintMode", 21}, |
| 635 | {"buttonTint", 21}, |
| 636 | {"buttonTintMode", 21}, |
| 637 | {"thumbTint", 21}, |
| 638 | {"thumbTintMode", 21}, |
| 639 | {"fullBackupOnly", 21}, |
| 640 | {"propertyXName", 21}, |
| 641 | {"propertyYName", 21}, |
| 642 | {"relinquishTaskIdentity", 21}, |
| 643 | {"tileModeX", 21}, |
| 644 | {"tileModeY", 21}, |
| 645 | {"actionModeShareDrawable", 21}, |
| 646 | {"actionModeFindDrawable", 21}, |
| 647 | {"actionModeWebSearchDrawable", 21}, |
| 648 | {"transitionVisibilityMode", 21}, |
| 649 | {"minimumHorizontalAngle", 21}, |
| 650 | {"minimumVerticalAngle", 21}, |
| 651 | {"maximumAngle", 21}, |
| 652 | {"searchViewStyle", 21}, |
| 653 | {"closeIcon", 21}, |
| 654 | {"goIcon", 21}, |
| 655 | {"searchIcon", 21}, |
| 656 | {"voiceIcon", 21}, |
| 657 | {"commitIcon", 21}, |
| 658 | {"suggestionRowLayout", 21}, |
| 659 | {"queryBackground", 21}, |
| 660 | {"submitBackground", 21}, |
| 661 | {"buttonBarPositiveButtonStyle", 21}, |
| 662 | {"buttonBarNeutralButtonStyle", 21}, |
| 663 | {"buttonBarNegativeButtonStyle", 21}, |
| 664 | {"popupElevation", 21}, |
| 665 | {"actionBarPopupTheme", 21}, |
| 666 | {"multiArch", 21}, |
| 667 | {"touchscreenBlocksFocus", 21}, |
| 668 | {"windowElevation", 21}, |
| 669 | {"launchTaskBehindTargetAnimation", 21}, |
| 670 | {"launchTaskBehindSourceAnimation", 21}, |
| 671 | {"restrictionType", 21}, |
| 672 | {"dayOfWeekBackground", 21}, |
| 673 | {"dayOfWeekTextAppearance", 21}, |
| 674 | {"headerMonthTextAppearance", 21}, |
| 675 | {"headerDayOfMonthTextAppearance", 21}, |
| 676 | {"headerYearTextAppearance", 21}, |
| 677 | {"yearListItemTextAppearance", 21}, |
| 678 | {"yearListSelectorColor", 21}, |
| 679 | {"calendarTextColor", 21}, |
| 680 | {"recognitionService", 21}, |
| 681 | {"timePickerStyle", 21}, |
| 682 | {"timePickerDialogTheme", 21}, |
| 683 | {"headerTimeTextAppearance", 21}, |
| 684 | {"headerAmPmTextAppearance", 21}, |
| 685 | {"numbersTextColor", 21}, |
| 686 | {"numbersBackgroundColor", 21}, |
| 687 | {"numbersSelectorColor", 21}, |
| 688 | {"amPmTextColor", 21}, |
| 689 | {"amPmBackgroundColor", 21}, |
| 690 | {"searchKeyphraseRecognitionFlags", 21}, |
| 691 | {"checkMarkTint", 21}, |
| 692 | {"checkMarkTintMode", 21}, |
| 693 | {"popupTheme", 21}, |
| 694 | {"toolbarStyle", 21}, |
| 695 | {"windowClipToOutline", 21}, |
| 696 | {"datePickerDialogTheme", 21}, |
| 697 | {"showText", 21}, |
| 698 | {"windowReturnTransition", 21}, |
| 699 | {"windowReenterTransition", 21}, |
| 700 | {"windowSharedElementReturnTransition", 21}, |
| 701 | {"windowSharedElementReenterTransition", 21}, |
| 702 | {"resumeWhilePausing", 21}, |
| 703 | {"datePickerMode", 21}, |
| 704 | {"timePickerMode", 21}, |
| 705 | {"inset", 21}, |
| 706 | {"letterSpacing", 21}, |
| 707 | {"fontFeatureSettings", 21}, |
| 708 | {"outlineProvider", 21}, |
| 709 | {"contentAgeHint", 21}, |
| 710 | {"country", 21}, |
| 711 | {"windowSharedElementsUseOverlay", 21}, |
| 712 | {"reparent", 21}, |
| 713 | {"reparentWithOverlay", 21}, |
| 714 | {"ambientShadowAlpha", 21}, |
| 715 | {"spotShadowAlpha", 21}, |
| 716 | {"navigationIcon", 21}, |
| 717 | {"navigationContentDescription", 21}, |
| 718 | {"fragmentExitTransition", 21}, |
| 719 | {"fragmentEnterTransition", 21}, |
| 720 | {"fragmentSharedElementEnterTransition", 21}, |
| 721 | {"fragmentReturnTransition", 21}, |
| 722 | {"fragmentSharedElementReturnTransition", 21}, |
| 723 | {"fragmentReenterTransition", 21}, |
| 724 | {"fragmentAllowEnterTransitionOverlap", 21}, |
| 725 | {"fragmentAllowReturnTransitionOverlap", 21}, |
| 726 | {"patternPathData", 21}, |
| 727 | {"strokeAlpha", 21}, |
| 728 | {"fillAlpha", 21}, |
| 729 | {"windowActivityTransitions", 21}, |
| 730 | {"colorEdgeEffect", 21}}; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 731 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 732 | size_t FindAttributeSdkLevel(const ResourceName& name) { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 733 | if (name.package != "android" && name.type != ResourceType::kAttr) { |
| 734 | return 0; |
| 735 | } |
Adam Lesinski | 75f3a55 | 2015-06-03 14:54:23 -0700 | [diff] [blame] | 736 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 737 | auto iter = sAttrMap.find(name.entry); |
| 738 | if (iter != sAttrMap.end()) { |
| 739 | return iter->second; |
| 740 | } |
| 741 | return SDK_LOLLIPOP_MR1; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 742 | } |
| 743 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 744 | std::pair<StringPiece, int> GetDevelopmentSdkCodeNameAndVersion() { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 745 | return std::make_pair(StringPiece(sDevelopmentSdkCodeName), |
| 746 | sDevelopmentSdkLevel); |
Adam Lesinski | fb6312f | 2016-06-28 14:40:32 -0700 | [diff] [blame] | 747 | } |
| 748 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 749 | } // namespace aapt |