summaryrefslogtreecommitdiffstats
path: root/libs/androidfw/ResourceTypes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/androidfw/ResourceTypes.cpp')
-rw-r--r--libs/androidfw/ResourceTypes.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 2ae7b08..a95db9f 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -1894,6 +1894,8 @@ int ResTable_config::compare(const ResTable_config& o) const {
if (diff != 0) return diff;
diff = (int32_t)(screenLayout - o.screenLayout);
if (diff != 0) return diff;
+ diff = (int32_t)(screenLayout2 - o.screenLayout2);
+ if (diff != 0) return diff;
diff = (int32_t)(uiMode - o.uiMode);
if (diff != 0) return diff;
diff = (int32_t)(smallestScreenWidthDp - o.smallestScreenWidthDp);
@@ -1951,6 +1953,9 @@ int ResTable_config::compareLogical(const ResTable_config& o) const {
if (screenLayout != o.screenLayout) {
return screenLayout < o.screenLayout ? -1 : 1;
}
+ if (screenLayout2 != o.screenLayout2) {
+ return screenLayout2 < o.screenLayout2 ? -1 : 1;
+ }
if (uiMode != o.uiMode) {
return uiMode < o.uiMode ? -1 : 1;
}
@@ -1975,6 +1980,7 @@ int ResTable_config::diff(const ResTable_config& o) const {
if (version != o.version) diffs |= CONFIG_VERSION;
if ((screenLayout & MASK_LAYOUTDIR) != (o.screenLayout & MASK_LAYOUTDIR)) diffs |= CONFIG_LAYOUTDIR;
if ((screenLayout & ~MASK_LAYOUTDIR) != (o.screenLayout & ~MASK_LAYOUTDIR)) diffs |= CONFIG_SCREEN_LAYOUT;
+ if ((screenLayout2 & MASK_SCREENROUND) != (o.screenLayout2 & MASK_SCREENROUND)) diffs |= CONFIG_SCREEN_ROUND;
if (uiMode != o.uiMode) diffs |= CONFIG_UI_MODE;
if (smallestScreenWidthDp != o.smallestScreenWidthDp) diffs |= CONFIG_SMALLEST_SCREEN_SIZE;
if (screenSizeDp != o.screenSizeDp) diffs |= CONFIG_SCREEN_SIZE;
@@ -2080,6 +2086,13 @@ bool ResTable_config::isMoreSpecificThan(const ResTable_config& o) const {
}
}
+ if (screenLayout2 || o.screenLayout2) {
+ if (((screenLayout2^o.screenLayout2) & MASK_SCREENROUND) != 0) {
+ if (!(screenLayout2 & MASK_SCREENROUND)) return false;
+ if (!(o.screenLayout2 & MASK_SCREENROUND)) return true;
+ }
+ }
+
if (orientation != o.orientation) {
if (!orientation) return false;
if (!o.orientation) return true;
@@ -2267,6 +2280,13 @@ bool ResTable_config::isBetterThan(const ResTable_config& o,
}
}
+ if (screenLayout2 || o.screenLayout2) {
+ if (((screenLayout2^o.screenLayout2) & MASK_SCREENROUND) != 0 &&
+ (requested->screenLayout2 & MASK_SCREENROUND)) {
+ return screenLayout2 & MASK_SCREENROUND;
+ }
+ }
+
if ((orientation != o.orientation) && requested->orientation) {
return (orientation);
}
@@ -2480,6 +2500,15 @@ bool ResTable_config::match(const ResTable_config& settings) const {
return false;
}
}
+
+ if (screenConfig2 != 0) {
+ const int screenRound = screenLayout2 & MASK_SCREENROUND;
+ const int setScreenRound = settings.screenLayout2 & MASK_SCREENROUND;
+ if (screenRound != 0 && screenRound != setScreenRound) {
+ return false;
+ }
+ }
+
if (screenSizeDp != 0) {
if (screenWidthDp != 0 && screenWidthDp > settings.screenWidthDp) {
if (kDebugTableSuperNoisy) {
@@ -2770,6 +2799,20 @@ String8 ResTable_config::toString() const {
break;
}
}
+ if ((screenLayout2&MASK_SCREENROUND) != 0) {
+ if (res.size() > 0) res.append("-");
+ switch (screenLayout2&MASK_SCREENROUND) {
+ case SCREENROUND_NO:
+ res.append("notround");
+ break;
+ case SCREENROUND_YES:
+ res.append("round");
+ break;
+ default:
+ res.appendFormat("screenRound=%d", dtohs(screenLayout2&MASK_SCREENROUND));
+ break;
+ }
+ }
if (orientation != ORIENTATION_ANY) {
if (res.size() > 0) res.append("-");
switch (orientation) {