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