diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-05-14 14:25:36 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-05-15 15:10:58 -0700 |
commit | 2738c96d998dedfae5b4670d588d0cd299c4ca0f (patch) | |
tree | 76b8571676d42a9c0b3bfa00f1937eebf2c05698 /core/jni/android_util_AssetManager.cpp | |
parent | 038959e851603500eb39b52fef33cbe75dbd73e3 (diff) | |
download | frameworks_base-2738c96d998dedfae5b4670d588d0cd299c4ca0f.zip frameworks_base-2738c96d998dedfae5b4670d588d0cd299c4ca0f.tar.gz frameworks_base-2738c96d998dedfae5b4670d588d0cd299c4ca0f.tar.bz2 |
Add -round and -notround qualifier to android runtime/aapt
The round qualifier denotes a device with a screen shape that
is round. The qualifier shows up after the 'long/notlong' qualifier
and before the orientation 'port/land/square' qualifiers.
Change-Id: I3044258b2703a9165694b79725bade770fa6cea1
Diffstat (limited to 'core/jni/android_util_AssetManager.cpp')
-rw-r--r-- | core/jni/android_util_AssetManager.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp index 74a9e4e..dca04f5 100644 --- a/core/jni/android_util_AssetManager.cpp +++ b/core/jni/android_util_AssetManager.cpp @@ -615,6 +615,10 @@ static void android_content_AssetManager_setConfiguration(JNIEnv* env, jobject c const char* locale8 = locale != NULL ? env->GetStringUTFChars(locale, NULL) : NULL; + // Constants duplicated from Java class android.content.res.Configuration. + static const jint kScreenLayoutRoundMask = 0x300; + static const jint kScreenLayoutRoundShift = 8; + config.mcc = (uint16_t)mcc; config.mnc = (uint16_t)mnc; config.orientation = (uint8_t)orientation; @@ -632,6 +636,13 @@ static void android_content_AssetManager_setConfiguration(JNIEnv* env, jobject c config.uiMode = (uint8_t)uiMode; config.sdkVersion = (uint16_t)sdkVersion; config.minorVersion = 0; + + // In Java, we use a 32bit integer for screenLayout, while we only use an 8bit integer + // in C++. We must extract the round qualifier out of the Java screenLayout and put it + // into screenLayout2. + config.screenLayout2 = + (uint8_t)((screenLayout & kScreenLayoutRoundMask) >> kScreenLayoutRoundShift); + am->setConfiguration(config, locale8); if (locale != NULL) env->ReleaseStringUTFChars(locale, locale8); |