in resources/src/main/java/org/robolectric/res/android/ResTable_config.java [2226:2358]
private boolean isMoreSpecificThan(ResTable_config o) {
// The order of the following tests defines the importance of one
// configuration parameter over another. Those tests first are more
// important, trumping any values in those following them.
if (isTruthy(imsi()) || isTruthy(o.imsi())) {
if (mcc != o.mcc) {
if (!isTruthy(mcc)) return false;
if (!isTruthy(o.mcc)) return true;
}
if (mnc != o.mnc) {
if (!isTruthy(mnc)) return false;
if (!isTruthy(o.mnc)) return true;
}
}
if (isTruthy(locale()) || isTruthy(o.locale())) {
int diff = isLocaleMoreSpecificThan(o);
if (diff < 0) {
return false;
}
if (diff > 0) {
return true;
}
}
if (isTruthy(screenLayout) || isTruthy(o.screenLayout)) {
if (((screenLayout^o.screenLayout) & MASK_LAYOUTDIR) != 0) {
if (!isTruthy((screenLayout & MASK_LAYOUTDIR))) return false;
if (!isTruthy((o.screenLayout & MASK_LAYOUTDIR))) return true;
}
}
if (isTruthy(smallestScreenWidthDp) || isTruthy(o.smallestScreenWidthDp)) {
if (smallestScreenWidthDp != o.smallestScreenWidthDp) {
if (!isTruthy(smallestScreenWidthDp)) return false;
if (!isTruthy(o.smallestScreenWidthDp)) return true;
}
}
if (isTruthy(screenSizeDp()) || isTruthy(o.screenSizeDp())) {
if (screenWidthDp != o.screenWidthDp) {
if (!isTruthy(screenWidthDp)) return false;
if (!isTruthy(o.screenWidthDp)) return true;
}
if (screenHeightDp != o.screenHeightDp) {
if (!isTruthy(screenHeightDp)) return false;
if (!isTruthy(o.screenHeightDp)) return true;
}
}
if (isTruthy(screenLayout) || isTruthy(o.screenLayout)) {
if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) {
if (!isTruthy((screenLayout & MASK_SCREENSIZE))) return false;
if (!isTruthy((o.screenLayout & MASK_SCREENSIZE))) return true;
}
if (((screenLayout^o.screenLayout) & MASK_SCREENLONG) != 0) {
if (!isTruthy((screenLayout & MASK_SCREENLONG))) return false;
if (!isTruthy((o.screenLayout & MASK_SCREENLONG))) return true;
}
}
if (isTruthy(screenLayout2) || isTruthy(o.screenLayout2)) {
if (((screenLayout2^o.screenLayout2) & MASK_SCREENROUND) != 0) {
if (!isTruthy((screenLayout2 & MASK_SCREENROUND))) return false;
if (!isTruthy((o.screenLayout2 & MASK_SCREENROUND))) return true;
}
}
if (isTruthy(colorMode) || isTruthy(o.colorMode)) {
if (((colorMode^o.colorMode) & MASK_HDR) != 0) {
if (!isTruthy((colorMode & MASK_HDR))) return false;
if (!isTruthy((o.colorMode & MASK_HDR))) return true;
}
if (((colorMode^o.colorMode) & MASK_WIDE_COLOR_GAMUT) != 0) {
if (!isTruthy((colorMode & MASK_WIDE_COLOR_GAMUT))) return false;
if (!isTruthy((o.colorMode & MASK_WIDE_COLOR_GAMUT))) return true;
}
}
if (orientation != o.orientation) {
if (!isTruthy(orientation)) return false;
if (!isTruthy(o.orientation)) return true;
}
if (isTruthy(uiMode) || isTruthy(o.uiMode)) {
if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0) {
if (!isTruthy((uiMode & MASK_UI_MODE_TYPE))) return false;
if (!isTruthy((o.uiMode & MASK_UI_MODE_TYPE))) return true;
}
if (((uiMode^o.uiMode) & MASK_UI_MODE_NIGHT) != 0) {
if (!isTruthy((uiMode & MASK_UI_MODE_NIGHT))) return false;
if (!isTruthy((o.uiMode & MASK_UI_MODE_NIGHT))) return true;
}
}
// density is never 'more specific'
// as the default just equals 160
if (touchscreen != o.touchscreen) {
if (!isTruthy(touchscreen)) return false;
if (!isTruthy(o.touchscreen)) return true;
}
if (isTruthy(input()) || isTruthy(o.input())) {
if (((inputFlags^o.inputFlags) & MASK_KEYSHIDDEN) != 0) {
if (!isTruthy((inputFlags & MASK_KEYSHIDDEN))) return false;
if (!isTruthy((o.inputFlags & MASK_KEYSHIDDEN))) return true;
}
if (((inputFlags^o.inputFlags) & MASK_NAVHIDDEN) != 0) {
if (!isTruthy((inputFlags & MASK_NAVHIDDEN))) return false;
if (!isTruthy((o.inputFlags & MASK_NAVHIDDEN))) return true;
}
if (keyboard != o.keyboard) {
if (!isTruthy(keyboard)) return false;
if (!isTruthy(o.keyboard)) return true;
}
if (navigation != o.navigation) {
if (!isTruthy(navigation)) return false;
if (!isTruthy(o.navigation)) return true;
}
}
if (isTruthy(screenSize()) || isTruthy(o.screenSize())) {
if (screenWidth != o.screenWidth) {
if (!isTruthy(screenWidth)) return false;
if (!isTruthy(o.screenWidth)) return true;
}
if (screenHeight != o.screenHeight) {
if (!isTruthy(screenHeight)) return false;
if (!isTruthy(o.screenHeight)) return true;
}
}
if (isTruthy(version()) || isTruthy(o.version())) {
if (sdkVersion != o.sdkVersion) {
if (!isTruthy(sdkVersion)) return false;
if (!isTruthy(o.sdkVersion)) return true;
}
if (minorVersion != o.minorVersion) {
if (!isTruthy(minorVersion)) return false;
if (!isTruthy(o.minorVersion)) return true;
}
}
return false;
}