Class ResTable_config

java.lang.Object
org.robolectric.res.android.ResTable_config

public class ResTable_config extends Object
Describes a particular resource configuration.

Transliterated from: * https://android.googlesource.com/platform/frameworks/base/+/android-9.0.0_r12/libs/androidfw/ResourceTypes.cpp * https://android.googlesource.com/platform/frameworks/base/+/android-9.0.0_r12/libs/androidfw/include/ResourceTypes.h (struct ResTable_config)

Changes from 8.0.0_r4 partially applied.

  • Field Details

    • RESTABLE_MAX_LOCALE_LEN

      public static final int RESTABLE_MAX_LOCALE_LEN
      See Also:
    • SIZEOF

      public static final int SIZEOF
      See Also:
    • SHIFT_LAYOUTDIR

      public static final int SHIFT_LAYOUTDIR
      See Also:
    • LAYOUTDIR_ANY

      public static final int LAYOUTDIR_ANY
      See Also:
    • LAYOUTDIR_LTR

      public static final int LAYOUTDIR_LTR
      See Also:
    • LAYOUTDIR_RTL

      public static final int LAYOUTDIR_RTL
      See Also:
    • SCREENWIDTH_ANY

      public static final int SCREENWIDTH_ANY
      See Also:
    • SCREENSIZE_ANY

      public static final int SCREENSIZE_ANY
      See Also:
    • SCREENSIZE_SMALL

      public static final int SCREENSIZE_SMALL
      See Also:
    • SCREENSIZE_NORMAL

      public static final int SCREENSIZE_NORMAL
      See Also:
    • SCREENSIZE_LARGE

      public static final int SCREENSIZE_LARGE
      See Also:
    • SCREENSIZE_XLARGE

      public static final int SCREENSIZE_XLARGE
      See Also:
    • MASK_UI_MODE_TYPE

      public static final int MASK_UI_MODE_TYPE
      See Also:
    • UI_MODE_TYPE_ANY

      public static final int UI_MODE_TYPE_ANY
      See Also:
    • UI_MODE_TYPE_NORMAL

      public static final int UI_MODE_TYPE_NORMAL
      See Also:
    • MASK_UI_MODE_NIGHT

      public static final int MASK_UI_MODE_NIGHT
      See Also:
    • SHIFT_UI_MODE_NIGHT

      public static final int SHIFT_UI_MODE_NIGHT
      See Also:
    • UI_MODE_NIGHT_ANY

      public static final int UI_MODE_NIGHT_ANY
      See Also:
    • DENSITY_DEFAULT

      public static final int DENSITY_DEFAULT
      See Also:
    • DENSITY_LOW

      public static final int DENSITY_LOW
      See Also:
    • DENSITY_MEDIUM

      public static final int DENSITY_MEDIUM
      See Also:
    • DENSITY_TV

      public static final int DENSITY_TV
      See Also:
    • DENSITY_HIGH

      public static final int DENSITY_HIGH
      See Also:
    • DENSITY_XHIGH

      public static final int DENSITY_XHIGH
      See Also:
    • DENSITY_XXHIGH

      public static final int DENSITY_XXHIGH
      See Also:
    • DENSITY_XXXHIGH

      public static final int DENSITY_XXXHIGH
      See Also:
    • DENSITY_ANY

      public static final int DENSITY_ANY
      See Also:
    • DENSITY_NONE

      public static final int DENSITY_NONE
      See Also:
    • TOUCHSCREEN_ANY

      public static final int TOUCHSCREEN_ANY
      See Also:
    • MASK_KEYSHIDDEN

      public static final int MASK_KEYSHIDDEN
      See Also:
    • KEYSHIDDEN_ANY

      public static final byte KEYSHIDDEN_ANY
      See Also:
    • KEYSHIDDEN_NO

      public static final byte KEYSHIDDEN_NO
      See Also:
    • KEYSHIDDEN_YES

      public static final byte KEYSHIDDEN_YES
      See Also:
    • KEYSHIDDEN_SOFT

      public static final byte KEYSHIDDEN_SOFT
      See Also:
    • KEYBOARD_ANY

      public static final int KEYBOARD_ANY
      See Also:
    • MASK_NAVHIDDEN

      public static final int MASK_NAVHIDDEN
      See Also:
    • SHIFT_NAVHIDDEN

      public static final int SHIFT_NAVHIDDEN
      See Also:
    • SCREENHEIGHT_ANY

      public static final int SCREENHEIGHT_ANY
      See Also:
    • SDKVERSION_ANY

      public static final int SDKVERSION_ANY
      See Also:
    • MINORVERSION_ANY

      public static final int MINORVERSION_ANY
      See Also:
    • WIDE_COLOR_GAMUT_ANY

      public static final int WIDE_COLOR_GAMUT_ANY
      See Also:
    • WIDE_COLOR_GAMUT_NO

      public static final int WIDE_COLOR_GAMUT_NO
      See Also:
    • WIDE_COLOR_GAMUT_YES

      public static final int WIDE_COLOR_GAMUT_YES
      See Also:
    • MASK_WIDE_COLOR_GAMUT

      public static final int MASK_WIDE_COLOR_GAMUT
      See Also:
    • HDR_ANY

      public static final int HDR_ANY
      See Also:
    • HDR_NO

      public static final int HDR_NO
      See Also:
    • HDR_YES

      public static final int HDR_YES
      See Also:
    • MASK_HDR

      public static final int MASK_HDR
      See Also:
    • DENSITY_DPI_UNDEFINED

      public static final int DENSITY_DPI_UNDEFINED
      See Also:
    • DENSITY_DPI_MDPI

      public static final int DENSITY_DPI_MDPI
      See Also:
    • DENSITY_DPI_ANY

      public static final int DENSITY_DPI_ANY
      See Also:
    • DENSITY_DPI_NONE

      public static final int DENSITY_DPI_NONE
      See Also:
    • ORIENTATION_ANY

      public static final int ORIENTATION_ANY
      See Also:
    • ORIENTATION_PORT

      public static final int ORIENTATION_PORT
      See Also:
    • ORIENTATION_LAND

      public static final int ORIENTATION_LAND
      See Also:
    • ORIENTATION_SQUARE

      public static final int ORIENTATION_SQUARE
      See Also:
    • MASK_SCREENLONG

      public static final int MASK_SCREENLONG
      See Also:
    • SHIFT_SCREENLONG

      public static final int SHIFT_SCREENLONG
      See Also:
    • SCREENLONG_ANY

      public static final int SCREENLONG_ANY
      See Also:
    • SCREENLONG_NO

      public static final int SCREENLONG_NO
      See Also:
    • SCREENLONG_YES

      public static final int SCREENLONG_YES
      See Also:
    • SCREENROUND_ANY

      public static final int SCREENROUND_ANY
      See Also:
    • SCREENROUND_NO

      public static final int SCREENROUND_NO
      See Also:
    • SCREENROUND_YES

      public static final int SCREENROUND_YES
      See Also:
    • TOUCHSCREEN_FINGER

      public static final int TOUCHSCREEN_FINGER
      See Also:
    • UI_MODE_NIGHT_NO

      public static final int UI_MODE_NIGHT_NO
      See Also:
    • mcc

      public int mcc
    • mnc

      public int mnc
    • language

      public final byte[] language
      Returns a packed 2-byte language code.
    • country

      public final byte[] country
      Returns a packed 2-byte country code.
    • orientation

      public int orientation
    • touchscreen

      public int touchscreen
    • density

      public int density
    • keyboard

      public int keyboard
    • inputFlags

      public int inputFlags
    • screenWidth

      public int screenWidth
    • screenHeight

      public int screenHeight
    • sdkVersion

      public int sdkVersion
    • minorVersion

      public int minorVersion
    • screenLayout

      public int screenLayout
    • uiMode

      public int uiMode
    • smallestScreenWidthDp

      public int smallestScreenWidthDp
    • screenWidthDp

      public int screenWidthDp
    • screenHeightDp

      public int screenHeightDp
    • localeScript

      public final byte[] localeScript
      The ISO-15924 short name for the script corresponding to this configuration.
    • localeVariant

      public final byte[] localeVariant
      A single BCP-47 variant subtag.
    • screenLayout2

      public byte screenLayout2
      An extension to screenLayout. Contains round/notround qualifier.
    • colorMode

      public byte colorMode
    • screenConfigPad2

      public short screenConfigPad2
    • unknown

      public byte[] unknown
      Any remaining bytes in this resource configuration that are unaccounted for.
    • MASK_LAYOUTDIR

      public static final int MASK_LAYOUTDIR
      See Also:
  • Constructor Details

    • ResTable_config

      public ResTable_config(ResTable_config other)
    • ResTable_config

      public ResTable_config(int size, int mcc, int mnc, byte[] language, byte[] country, int orientation, int touchscreen, int density, int keyboard, int navigation, int inputFlags, int screenWidth, int screenHeight, int sdkVersion, int minorVersion, int screenLayout, int uiMode, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, byte[] localeScript, byte[] localeVariant, byte screenLayout2, byte colorMode, short screenConfigPad2, byte[] unknown)
    • ResTable_config

      public ResTable_config()
  • Method Details

    • languageString

      @Nonnull public final String languageString()
      Returns language as an unpacked string representation.
    • localeScriptString

      public final String localeScriptString()
      Returns the localeScript as a string.
    • localeVariantString

      public final String localeVariantString()
      Returns the localeVariant as a string.
    • colorModeWideColorGamut

      public final int colorModeWideColorGamut()
      Returns the wide color gamut section of colorMode.
    • colorModeHdr

      public final int colorModeHdr()
      Returns the HDR section of colorMode.
    • regionString

      @Nonnull public final String regionString()
      Returns country as an unpacked string representation.
    • scriptString

      public final String scriptString()
    • keyboardHidden

      public final int keyboardHidden()
    • keyboardHidden

      public final void keyboardHidden(int value)
    • withSdkVersion

      public final ResTable_config withSdkVersion(int sdkVersion)
      Returns a copy of this resource configuration with a different sdkVersion, or this configuration if the sdkVersion is the same.
      Parameters:
      sdkVersion - The SDK version of the returned configuration.
      Returns:
      A copy of this configuration with the only difference being #sdkVersion.
    • screenLayoutDirection

      public final int screenLayoutDirection()
    • screenLayoutDirection

      public final void screenLayoutDirection(int value)
    • screenLayoutSize

      public final int screenLayoutSize()
    • screenLayoutSize

      public final void screenLayoutSize(int value)
    • screenLayoutLong

      public final int screenLayoutLong()
    • screenLayoutLong

      public final void screenLayoutLong(int value)
    • screenLayoutRound

      public final int screenLayoutRound()
    • screenLayoutRound

      public final void screenLayoutRound(int value)
    • uiModeType

      public final int uiModeType()
    • uiModeType

      public final void uiModeType(int value)
    • uiModeNight

      public final int uiModeNight()
    • uiModeNight

      public final void uiModeNight(int value)
    • packLanguage

      public void packLanguage(String language)
    • packRegion

      public void packRegion(String region)
    • isDefault

      public final boolean isDefault()
      Returns true if this is the default "any" configuration.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • toStringParts

      public final Map<ResTable_config.Type,String> toStringParts()
      Returns a map of the configuration parts for toString().

      If a configuration part is not defined for this ResTable_config, its value will be the empty string.

    • isBetterThan

      public boolean isBetterThan(ResTable_config o, ResTable_config requested)
    • match

      public boolean match(ResTable_config settings)
    • setBcp47Locale

      public void setBcp47Locale(String in)