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