diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-03-30 16:20:26 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-04-06 11:00:37 -0700 |
commit | 3fc982f41fda1f254bfbc35490d81cd82a0ed90a (patch) | |
tree | 6f9ba92dc2c9001a156f298c37dcdef9c9552600 /libs | |
parent | fb84ce0df6b2db84981e4efa4530397a85240d4a (diff) | |
download | frameworks_base-3fc982f41fda1f254bfbc35490d81cd82a0ed90a.zip frameworks_base-3fc982f41fda1f254bfbc35490d81cd82a0ed90a.tar.gz frameworks_base-3fc982f41fda1f254bfbc35490d81cd82a0ed90a.tar.bz2 |
Add new resource configurations for screen width/height in "dp".
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: I22f8afa136b4f274423978c570fa7c9855040496
Diffstat (limited to 'libs')
-rw-r--r-- | libs/utils/ResourceTypes.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp index 7197ad7..ac9cdf9 100644 --- a/libs/utils/ResourceTypes.cpp +++ b/libs/utils/ResourceTypes.cpp @@ -2424,7 +2424,7 @@ void ResTable::setParameters(const ResTable_config* params) { mLock.lock(); TABLE_GETENTRY(LOGI("Setting parameters: 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", params->mcc, params->mnc, params->language[0] ? params->language[0] : '-', params->language[1] ? params->language[1] : '-', @@ -2437,7 +2437,9 @@ void ResTable::setParameters(const ResTable_config* params) params->inputFlags, params->navigation, params->screenWidth, - params->screenHeight)); + params->screenHeight, + params->screenWidthDp, + params->screenHeightDp)); mParams = *params; for (size_t i=0; i<mPackageGroups.size(); i++) { TABLE_NOISY(LOGI("CLEARING BAGS FOR GROUP %d!", i)); @@ -3758,8 +3760,10 @@ ssize_t ResTable::getEntry( ResTable_config thisConfig; thisConfig.copyFromDtoH(thisType->config); - TABLE_GETENTRY(LOGI("Match entry 0x%x in type 0x%x (sz 0x%x): imsi:%d/%d=%d/%d lang:%c%c=%c%c cnt:%c%c=%c%c " - "orien:%d=%d touch:%d=%d density:%d=%d key:%d=%d inp:%d=%d nav:%d=%d w:%d=%d h:%d=%d\n", + TABLE_GETENTRY(LOGI("Match entry 0x%x in type 0x%x (sz 0x%x): imsi:%d/%d=%d/%d " + "lang:%c%c=%c%c cnt:%c%c=%c%c orien:%d=%d touch:%d=%d " + "density:%d=%d key:%d=%d inp:%d=%d nav:%d=%d w:%d=%d h:%d=%d " + "wdp:%d=%d hdp:%d=%d\n", entryIndex, typeIndex+1, dtohl(thisType->config.size), thisConfig.mcc, thisConfig.mnc, config ? config->mcc : 0, config ? config->mnc : 0, @@ -3786,7 +3790,11 @@ ssize_t ResTable::getEntry( thisConfig.screenWidth, config ? config->screenWidth : 0, thisConfig.screenHeight, - config ? config->screenHeight : 0)); + config ? config->screenHeight : 0, + thisConfig.screenWidthDp, + config ? config->screenWidthDp : 0, + thisConfig.screenHeightDp, + config ? config->screenHeightDp : 0)); // Check to make sure this one is valid for the current parameters. if (config && !thisConfig.match(*config)) { @@ -4067,7 +4075,8 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, ResTable_config thisConfig; thisConfig.copyFromDtoH(type->config); LOGI("Adding config to type %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 w:%d h:%d " + "wdp:%d hdp:%d\n", type->id, thisConfig.mcc, thisConfig.mnc, thisConfig.language[0] ? thisConfig.language[0] : '-', @@ -4081,7 +4090,9 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, thisConfig.inputFlags, thisConfig.navigation, thisConfig.screenWidth, - thisConfig.screenHeight)); + thisConfig.screenHeight, + thisConfig.screenWidthDp, + thisConfig.screenHeightDp)); t->configs.add(type); } else { status_t err = validate_chunk(chunk, sizeof(ResChunk_header), @@ -4444,6 +4455,12 @@ void ResTable::print(bool inclValues) const if (type->config.screenHeight != 0) { printf(" h=%d", dtohs(type->config.screenHeight)); } + if (type->config.screenWidthDp != 0) { + printf(" wdp=%d", dtohs(type->config.screenWidthDp)); + } + if (type->config.screenHeightDp != 0) { + printf(" hdp=%d", dtohs(type->config.screenHeightDp)); + } if (type->config.sdkVersion != 0) { printf(" sdk=%d", dtohs(type->config.sdkVersion)); } |