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