Loading core/java/android/view/Display.java +5 −5 Original line number Diff line number Diff line Loading @@ -79,6 +79,11 @@ public class Display */ native public int getHeight(); /** @hide special for when we are faking the screen size. */ native public int getRealWidth(); /** @hide special for when we are faking the screen size. */ native public int getRealHeight(); /** * Returns the rotation of the screen from its "natural" orientation. * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0} Loading Loading @@ -136,11 +141,6 @@ public class Display outMetrics.ydpi = mDpiY; } /** * @hide Helper for our fake display size hack. */ native public static int unmapDisplaySize(int newSize); /* * We use a class initializer to allow the native code to cache some * field offsets. Loading core/jni/android_view_Display.cpp +38 −12 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ struct offsets_t { }; static offsets_t offsets; static int gShortSize = -1; static int gLongSize = -1; static int gOldSize = -1; static int gNewSize = -1; Loading Loading @@ -76,6 +78,10 @@ static jint android_view_Display_getWidth( { 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; } Loading @@ -84,9 +90,27 @@ static jint android_view_Display_getHeight( { 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_getRealWidth( JNIEnv* env, jobject clazz) { DisplayID dpy = env->GetIntField(clazz, offsets.display); return SurfaceComposerClient::getDisplayWidth(dpy); } static jint android_view_Display_getRealHeight( JNIEnv* env, jobject clazz) { DisplayID dpy = env->GetIntField(clazz, offsets.display); return SurfaceComposerClient::getDisplayHeight(dpy); } static jint android_view_Display_getOrientation( JNIEnv* env, jobject clazz) { Loading @@ -100,13 +124,6 @@ static jint android_view_Display_getDisplayCount( return SurfaceComposerClient::getNumberOfDisplays(); } static jint android_view_Display_unmapDisplaySize( JNIEnv* env, jclass clazz, jint newSize) { if (newSize == gNewSize) return gOldSize; return newSize; } // ---------------------------------------------------------------------------- const char* const kClassPathName = "android/view/Display"; Loading @@ -124,10 +141,12 @@ static JNINativeMethod gMethods[] = { (void*)android_view_Display_getWidth }, { "getHeight", "()I", (void*)android_view_Display_getHeight }, { "getRealWidth", "()I", (void*)android_view_Display_getRealWidth }, { "getRealHeight", "()I", (void*)android_view_Display_getRealHeight }, { "getOrientation", "()I", (void*)android_view_Display_getOrientation }, { "unmapDisplaySize", "(I)I", (void*)android_view_Display_unmapDisplaySize } (void*)android_view_Display_getOrientation } }; void nativeClassInit(JNIEnv* env, jclass clazz) Loading @@ -146,7 +165,15 @@ int register_android_view_Display(JNIEnv* env) int len = property_get("persist.demo.screensizehack", buf, ""); if (len > 0) { int temp1, temp2; if (sscanf(buf, "%d=%d", &temp1, &temp2) == 2) { 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; } Loading @@ -157,4 +184,3 @@ int register_android_view_Display(JNIEnv* env) } }; services/java/com/android/server/wm/WindowManagerService.java +1 −2 Original line number Diff line number Diff line Loading @@ -5812,8 +5812,7 @@ public class WindowManagerService extends IWindowManager.Stub mDisplay = wm.getDefaultDisplay(); mInitialDisplayWidth = mDisplay.getWidth(); mInitialDisplayHeight = mDisplay.getHeight(); mInputManager.setDisplaySize(0, Display.unmapDisplaySize(mInitialDisplayWidth), Display.unmapDisplaySize(mInitialDisplayHeight)); mInputManager.setDisplaySize(0, mDisplay.getRealWidth(), mDisplay.getRealHeight()); } try { Loading Loading
core/java/android/view/Display.java +5 −5 Original line number Diff line number Diff line Loading @@ -79,6 +79,11 @@ public class Display */ native public int getHeight(); /** @hide special for when we are faking the screen size. */ native public int getRealWidth(); /** @hide special for when we are faking the screen size. */ native public int getRealHeight(); /** * Returns the rotation of the screen from its "natural" orientation. * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0} Loading Loading @@ -136,11 +141,6 @@ public class Display outMetrics.ydpi = mDpiY; } /** * @hide Helper for our fake display size hack. */ native public static int unmapDisplaySize(int newSize); /* * We use a class initializer to allow the native code to cache some * field offsets. Loading
core/jni/android_view_Display.cpp +38 −12 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ struct offsets_t { }; static offsets_t offsets; static int gShortSize = -1; static int gLongSize = -1; static int gOldSize = -1; static int gNewSize = -1; Loading Loading @@ -76,6 +78,10 @@ static jint android_view_Display_getWidth( { 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; } Loading @@ -84,9 +90,27 @@ static jint android_view_Display_getHeight( { 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_getRealWidth( JNIEnv* env, jobject clazz) { DisplayID dpy = env->GetIntField(clazz, offsets.display); return SurfaceComposerClient::getDisplayWidth(dpy); } static jint android_view_Display_getRealHeight( JNIEnv* env, jobject clazz) { DisplayID dpy = env->GetIntField(clazz, offsets.display); return SurfaceComposerClient::getDisplayHeight(dpy); } static jint android_view_Display_getOrientation( JNIEnv* env, jobject clazz) { Loading @@ -100,13 +124,6 @@ static jint android_view_Display_getDisplayCount( return SurfaceComposerClient::getNumberOfDisplays(); } static jint android_view_Display_unmapDisplaySize( JNIEnv* env, jclass clazz, jint newSize) { if (newSize == gNewSize) return gOldSize; return newSize; } // ---------------------------------------------------------------------------- const char* const kClassPathName = "android/view/Display"; Loading @@ -124,10 +141,12 @@ static JNINativeMethod gMethods[] = { (void*)android_view_Display_getWidth }, { "getHeight", "()I", (void*)android_view_Display_getHeight }, { "getRealWidth", "()I", (void*)android_view_Display_getRealWidth }, { "getRealHeight", "()I", (void*)android_view_Display_getRealHeight }, { "getOrientation", "()I", (void*)android_view_Display_getOrientation }, { "unmapDisplaySize", "(I)I", (void*)android_view_Display_unmapDisplaySize } (void*)android_view_Display_getOrientation } }; void nativeClassInit(JNIEnv* env, jclass clazz) Loading @@ -146,7 +165,15 @@ int register_android_view_Display(JNIEnv* env) int len = property_get("persist.demo.screensizehack", buf, ""); if (len > 0) { int temp1, temp2; if (sscanf(buf, "%d=%d", &temp1, &temp2) == 2) { 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; } Loading @@ -157,4 +184,3 @@ int register_android_view_Display(JNIEnv* env) } };
services/java/com/android/server/wm/WindowManagerService.java +1 −2 Original line number Diff line number Diff line Loading @@ -5812,8 +5812,7 @@ public class WindowManagerService extends IWindowManager.Stub mDisplay = wm.getDefaultDisplay(); mInitialDisplayWidth = mDisplay.getWidth(); mInitialDisplayHeight = mDisplay.getHeight(); mInputManager.setDisplaySize(0, Display.unmapDisplaySize(mInitialDisplayWidth), Display.unmapDisplaySize(mInitialDisplayHeight)); mInputManager.setDisplaySize(0, mDisplay.getRealWidth(), mDisplay.getRealHeight()); } try { Loading