From bc68a59c024bdb745dac8e2ec7408a9f30595f1a Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Mon, 25 Jul 2011 12:58:12 -0700 Subject: Report the external display size to the input reader. The input reader needs this information so that it knows how to interpolate touches on an external touch screen. Changed Display so that it asks the WindowManager what the real display size is (as opposed to the raw display size). This means it now takes into the forced display size set by adb shell am display-size. Replaced all calls to getRealWidth() / getRealHeight() / getRealMetrics() in the WindowManager and replaced them with direct usages of the mCurDisplayWidth / mCurDisplayHeight so that the WM doesn't end up making a reentrant Binder call into itself. Fixed the table status bar HeightReceiver so that it updates the height on all configuration changes since it is possible that the display size changed independently of an external HDMI display being plugged / unplugged. Improved the Display class documentation to make the distinctions betweeen the various sizes clearer. Change-Id: I3f75de559d3ebffed532ab46c4ae52c5e7f1da2b --- core/jni/android_view_Display.cpp | 51 --------------------------------------- 1 file changed, 51 deletions(-) (limited to 'core/jni') diff --git a/core/jni/android_view_Display.cpp b/core/jni/android_view_Display.cpp index 97f9fc3..5e668b9 100644 --- a/core/jni/android_view_Display.cpp +++ b/core/jni/android_view_Display.cpp @@ -45,11 +45,6 @@ struct offsets_t { }; static offsets_t offsets; -static int gShortSize = -1; -static int gLongSize = -1; -static int gOldSize = -1; -static int gNewSize = -1; - // ---------------------------------------------------------------------------- static void android_view_Display_init( @@ -68,30 +63,6 @@ static void android_view_Display_init( env->SetFloatField(clazz, offsets.ydpi, info.ydpi); } -static jint android_view_Display_getWidth( - JNIEnv* env, jobject clazz) -{ - DisplayID dpy = env->GetIntField(clazz, offsets.display); - jint w = SurfaceComposerClient::getDisplayWidth(dpy); - if (gShortSize > 0) { - jint h = SurfaceComposerClient::getDisplayHeight(dpy); - return w < h ? gShortSize : gLongSize; - } - return w == gOldSize ? gNewSize : w; -} - -static jint android_view_Display_getHeight( - JNIEnv* env, jobject clazz) -{ - DisplayID dpy = env->GetIntField(clazz, offsets.display); - int h = SurfaceComposerClient::getDisplayHeight(dpy); - if (gShortSize > 0) { - jint w = SurfaceComposerClient::getDisplayWidth(dpy); - return h < w ? gShortSize : gLongSize; - } - return h == gOldSize ? gNewSize : h; -} - static jint android_view_Display_getRawWidth( JNIEnv* env, jobject clazz) { @@ -132,10 +103,6 @@ static JNINativeMethod gMethods[] = { (void*)android_view_Display_getDisplayCount }, { "init", "(I)V", (void*)android_view_Display_init }, - { "getRealWidth", "()I", - (void*)android_view_Display_getWidth }, - { "getRealHeight", "()I", - (void*)android_view_Display_getHeight }, { "getRawWidth", "()I", (void*)android_view_Display_getRawWidth }, { "getRawHeight", "()I", @@ -156,24 +123,6 @@ void nativeClassInit(JNIEnv* env, jclass clazz) int register_android_view_Display(JNIEnv* env) { - char buf[PROPERTY_VALUE_MAX]; - int len = property_get("persist.demo.screensizehack", buf, ""); - if (len > 0) { - int temp1, temp2; - if (sscanf(buf, "%dx%d", &temp1, &temp2) == 2) { - if (temp1 < temp2) { - gShortSize = temp1; - gLongSize = temp2; - } else { - gShortSize = temp2; - gLongSize = temp1; - } - } else if (sscanf(buf, "%d=%d", &temp1, &temp2) == 2) { - gOldSize = temp1; - gNewSize = temp2; - } - } - return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods)); } -- cgit v1.1