summaryrefslogtreecommitdiffstats
path: root/tools/aapt/ResourceTable.cpp
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-05-12 18:07:47 -0700
committerDianne Hackborn <hackbod@google.com>2011-05-12 18:39:51 -0700
commitebff8f92f13513ce37bd74759eb1db63f2220590 (patch)
tree909da02ab7ff47483e227f032828dbdbe7f959af /tools/aapt/ResourceTable.cpp
parenta8138732a01b92f0a40f72050b74a3bd4cf6d215 (diff)
downloadframeworks_base-ebff8f92f13513ce37bd74759eb1db63f2220590.zip
frameworks_base-ebff8f92f13513ce37bd74759eb1db63f2220590.tar.gz
frameworks_base-ebff8f92f13513ce37bd74759eb1db63f2220590.tar.bz2
DO NOT MERGE. Integrate add new screen width/height in "dp" configs.
You can now specify resource configuration variants "wNNNdp" and "hNNNdp". These are the minimum screen width/height in "dp" units. This allows you to do things like have your app adjust its layout based only on the about of horizontal space available. This introduces a new configuration change flag for screen size. Note that this configuration change happens each time the orientation changes. Applications often say they handle the orientation change to avoid being restarted at a screen rotation, and this will now cause them to be restarted. To address this, we assume the app can handle this new config change if its target SDK version is < ICS. Change-Id: I4acb73d82677b74092c1da9e4046a4951921f9f4
Diffstat (limited to 'tools/aapt/ResourceTable.cpp')
-rw-r--r--tools/aapt/ResourceTable.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 5339566..3dcc093 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2607,6 +2607,15 @@ ResourceFilter::match(const ResTable_config& config) const
if (!match(AXIS_SCREENSIZE, config.screenSize)) {
return false;
}
+ if (!match(AXIS_SCREENWIDTHDP, config.screenWidthDp)) {
+ return false;
+ }
+ if (!match(AXIS_SCREENHEIGHTDP, config.screenHeightDp)) {
+ return false;
+ }
+ if (!match(AXIS_SCREENLAYOUTSIZE, config.screenLayout&ResTable_config::MASK_SCREENSIZE)) {
+ return false;
+ }
if (!match(AXIS_VERSION, config.version)) {
return false;
}
@@ -2800,7 +2809,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
ConfigDescription config = t->getUniqueConfigs().itemAt(ci);
NOISY(printf("Writing config %d config: imsi:%d/%d lang:%c%c cnt:%c%c "
- "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d\n",
+ "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d %ddp x %ddp\n",
ti+1,
config.mcc, config.mnc,
config.language[0] ? config.language[0] : '-',
@@ -2815,7 +2824,9 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
config.inputFlags,
config.navigation,
config.screenWidth,
- config.screenHeight));
+ config.screenHeight,
+ config.screenWidthDp,
+ config.screenHeightDp));
if (filterable && !filter.match(config)) {
continue;
@@ -2838,7 +2849,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
tHeader->entriesStart = htodl(typeSize);
tHeader->config = config;
NOISY(printf("Writing type %d config: imsi:%d/%d lang:%c%c cnt:%c%c "
- "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d\n",
+ "orien:%d ui:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d %ddp x %ddp\n",
ti+1,
tHeader->config.mcc, tHeader->config.mnc,
tHeader->config.language[0] ? tHeader->config.language[0] : '-',
@@ -2853,7 +2864,9 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
tHeader->config.inputFlags,
tHeader->config.navigation,
tHeader->config.screenWidth,
- tHeader->config.screenHeight));
+ tHeader->config.screenHeight,
+ tHeader->config.screenWidthDp,
+ tHeader->config.screenHeightDp));
tHeader->config.swapHtoD();
// Build the entries inside of this type.
@@ -3435,7 +3448,7 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
if (e == NULL) {
if (config != NULL) {
NOISY(printf("New entry at %s:%d: imsi:%d/%d lang:%c%c cnt:%c%c "
- "orien:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d\n",
+ "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d %ddp x %ddp\n",
sourcePos.file.string(), sourcePos.line,
config->mcc, config->mnc,
config->language[0] ? config->language[0] : '-',
@@ -3449,7 +3462,9 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
config->inputFlags,
config->navigation,
config->screenWidth,
- config->screenHeight));
+ config->screenHeight,
+ config->screenWidthDp,
+ config->screenHeightDp));
} else {
NOISY(printf("New entry at %s:%d: NULL config\n",
sourcePos.file.string(), sourcePos.line));