Loading core/java/android/view/Display.java +22 −6 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ import android.util.Slog; */ */ public class Display { public class Display { static final String TAG = "Display"; static final String TAG = "Display"; static final boolean DEBUG_COMPAT = false; static final boolean DEBUG_DISPLAY_SIZE = false; /** /** * The default Display id. * The default Display id. Loading Loading @@ -117,7 +117,8 @@ public class Display { outSize.x = getRawWidth(); outSize.x = getRawWidth(); outSize.y = getRawHeight(); outSize.y = getRawHeight(); } } if (DEBUG_COMPAT && doCompat) Slog.v(TAG, "Returning display size: " + outSize); if (DEBUG_DISPLAY_SIZE && doCompat) Slog.v( TAG, "Returning display size: " + outSize); } catch (RemoteException e) { } catch (RemoteException e) { Slog.w("Display", "Unable to get display size", e); Slog.w("Display", "Unable to get display size", e); } } Loading Loading @@ -203,6 +204,8 @@ public class Display { outSize.x = getRawWidth(); outSize.x = getRawWidth(); outSize.y = getRawHeight(); outSize.y = getRawHeight(); } } if (DEBUG_DISPLAY_SIZE) Slog.v( TAG, "Returning real display size: " + outSize); } catch (RemoteException e) { } catch (RemoteException e) { Slog.w("Display", "Unable to get real display size", e); Slog.w("Display", "Unable to get real display size", e); } } Loading @@ -215,7 +218,13 @@ public class Display { * </p> * </p> * @hide * @hide */ */ native public int getRawWidth(); public int getRawWidth() { int w = getRawWidthNative(); if (DEBUG_DISPLAY_SIZE) Slog.v( TAG, "Returning raw display width: " + w); return w; } private native int getRawWidthNative(); /** /** * Gets the raw height of the display, in pixels. * Gets the raw height of the display, in pixels. Loading @@ -224,7 +233,13 @@ public class Display { * </p> * </p> * @hide * @hide */ */ native public int getRawHeight(); public int getRawHeight() { int h = getRawHeightNative(); if (DEBUG_DISPLAY_SIZE) Slog.v( TAG, "Returning raw display height: " + h); return h; } private native int getRawHeightNative(); /** /** * Returns the rotation of the screen from its "natural" orientation. * Returns the rotation of the screen from its "natural" orientation. Loading Loading @@ -293,8 +308,9 @@ public class Display { ci.applyToDisplayMetrics(outMetrics); ci.applyToDisplayMetrics(outMetrics); } } if (DEBUG_COMPAT) Slog.v(TAG, "Returning DisplayMetrics: " + outMetrics.widthPixels if (DEBUG_DISPLAY_SIZE) Slog.v(TAG, "Returning DisplayMetrics: " + "x" + outMetrics.heightPixels + " " + outMetrics.density); + outMetrics.widthPixels + "x" + outMetrics.heightPixels + " " + outMetrics.density); } } /** /** Loading core/jni/android_view_Display.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -63,14 +63,14 @@ static void android_view_Display_init( env->SetFloatField(clazz, offsets.ydpi, info.ydpi); env->SetFloatField(clazz, offsets.ydpi, info.ydpi); } } static jint android_view_Display_getRawWidth( static jint android_view_Display_getRawWidthNative( JNIEnv* env, jobject clazz) JNIEnv* env, jobject clazz) { { DisplayID dpy = env->GetIntField(clazz, offsets.display); DisplayID dpy = env->GetIntField(clazz, offsets.display); return SurfaceComposerClient::getDisplayWidth(dpy); return SurfaceComposerClient::getDisplayWidth(dpy); } } static jint android_view_Display_getRawHeight( static jint android_view_Display_getRawHeightNative( JNIEnv* env, jobject clazz) JNIEnv* env, jobject clazz) { { DisplayID dpy = env->GetIntField(clazz, offsets.display); DisplayID dpy = env->GetIntField(clazz, offsets.display); Loading Loading @@ -103,10 +103,10 @@ static JNINativeMethod gMethods[] = { (void*)android_view_Display_getDisplayCount }, (void*)android_view_Display_getDisplayCount }, { "init", "(I)V", { "init", "(I)V", (void*)android_view_Display_init }, (void*)android_view_Display_init }, { "getRawWidth", "()I", { "getRawWidthNative", "()I", (void*)android_view_Display_getRawWidth }, (void*)android_view_Display_getRawWidthNative }, { "getRawHeight", "()I", { "getRawHeightNative", "()I", (void*)android_view_Display_getRawHeight }, (void*)android_view_Display_getRawHeightNative }, { "getOrientation", "()I", { "getOrientation", "()I", (void*)android_view_Display_getOrientation } (void*)android_view_Display_getOrientation } }; }; Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +2 −19 Original line number Original line Diff line number Diff line Loading @@ -1724,6 +1724,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { displayWidth, displayHeight); displayWidth, displayHeight); if (mNavigationBar.isVisibleLw()) { if (mNavigationBar.isVisibleLw()) { mDockBottom = mTmpNavigationFrame.top; mDockBottom = mTmpNavigationFrame.top; mRestrictedScreenHeight = mDockBottom - mDockTop; } } } else { } else { // Landscape screen; nav bar goes to the right. // Landscape screen; nav bar goes to the right. Loading @@ -1731,6 +1732,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { displayWidth, displayHeight); displayWidth, displayHeight); if (mNavigationBar.isVisibleLw()) { if (mNavigationBar.isVisibleLw()) { mDockRight = mTmpNavigationFrame.left; mDockRight = mTmpNavigationFrame.left; mRestrictedScreenWidth = mDockRight - mDockLeft; } } } } mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, Loading @@ -1748,25 +1750,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { mStatusBar.computeFrameLw(pf, df, vf, vf); mStatusBar.computeFrameLw(pf, df, vf, vf); // now, let's consider the navigation bar; if it exists, it must be removed from the // available screen real estate (like an un-hideable status bar) if (navr != null) { if (navr.top == 0) { // Navigation bar is vertical if (mRestrictedScreenLeft == navr.left) { mRestrictedScreenLeft = navr.right; mRestrictedScreenWidth -= (navr.right - navr.left); } else if ((mRestrictedScreenLeft+mRestrictedScreenWidth) == navr.right) { mRestrictedScreenWidth -= (navr.right - navr.left); } } else { // Navigation bar horizontal, at bottom if ((mRestrictedScreenHeight+mRestrictedScreenTop) == navr.bottom) { mRestrictedScreenHeight -= (navr.bottom-navr.top); } } } if (mStatusBar.isVisibleLw()) { if (mStatusBar.isVisibleLw()) { // If the status bar is hidden, we don't want to cause // If the status bar is hidden, we don't want to cause // windows behind it to scroll. // windows behind it to scroll. Loading Loading
core/java/android/view/Display.java +22 −6 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ import android.util.Slog; */ */ public class Display { public class Display { static final String TAG = "Display"; static final String TAG = "Display"; static final boolean DEBUG_COMPAT = false; static final boolean DEBUG_DISPLAY_SIZE = false; /** /** * The default Display id. * The default Display id. Loading Loading @@ -117,7 +117,8 @@ public class Display { outSize.x = getRawWidth(); outSize.x = getRawWidth(); outSize.y = getRawHeight(); outSize.y = getRawHeight(); } } if (DEBUG_COMPAT && doCompat) Slog.v(TAG, "Returning display size: " + outSize); if (DEBUG_DISPLAY_SIZE && doCompat) Slog.v( TAG, "Returning display size: " + outSize); } catch (RemoteException e) { } catch (RemoteException e) { Slog.w("Display", "Unable to get display size", e); Slog.w("Display", "Unable to get display size", e); } } Loading Loading @@ -203,6 +204,8 @@ public class Display { outSize.x = getRawWidth(); outSize.x = getRawWidth(); outSize.y = getRawHeight(); outSize.y = getRawHeight(); } } if (DEBUG_DISPLAY_SIZE) Slog.v( TAG, "Returning real display size: " + outSize); } catch (RemoteException e) { } catch (RemoteException e) { Slog.w("Display", "Unable to get real display size", e); Slog.w("Display", "Unable to get real display size", e); } } Loading @@ -215,7 +218,13 @@ public class Display { * </p> * </p> * @hide * @hide */ */ native public int getRawWidth(); public int getRawWidth() { int w = getRawWidthNative(); if (DEBUG_DISPLAY_SIZE) Slog.v( TAG, "Returning raw display width: " + w); return w; } private native int getRawWidthNative(); /** /** * Gets the raw height of the display, in pixels. * Gets the raw height of the display, in pixels. Loading @@ -224,7 +233,13 @@ public class Display { * </p> * </p> * @hide * @hide */ */ native public int getRawHeight(); public int getRawHeight() { int h = getRawHeightNative(); if (DEBUG_DISPLAY_SIZE) Slog.v( TAG, "Returning raw display height: " + h); return h; } private native int getRawHeightNative(); /** /** * Returns the rotation of the screen from its "natural" orientation. * Returns the rotation of the screen from its "natural" orientation. Loading Loading @@ -293,8 +308,9 @@ public class Display { ci.applyToDisplayMetrics(outMetrics); ci.applyToDisplayMetrics(outMetrics); } } if (DEBUG_COMPAT) Slog.v(TAG, "Returning DisplayMetrics: " + outMetrics.widthPixels if (DEBUG_DISPLAY_SIZE) Slog.v(TAG, "Returning DisplayMetrics: " + "x" + outMetrics.heightPixels + " " + outMetrics.density); + outMetrics.widthPixels + "x" + outMetrics.heightPixels + " " + outMetrics.density); } } /** /** Loading
core/jni/android_view_Display.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -63,14 +63,14 @@ static void android_view_Display_init( env->SetFloatField(clazz, offsets.ydpi, info.ydpi); env->SetFloatField(clazz, offsets.ydpi, info.ydpi); } } static jint android_view_Display_getRawWidth( static jint android_view_Display_getRawWidthNative( JNIEnv* env, jobject clazz) JNIEnv* env, jobject clazz) { { DisplayID dpy = env->GetIntField(clazz, offsets.display); DisplayID dpy = env->GetIntField(clazz, offsets.display); return SurfaceComposerClient::getDisplayWidth(dpy); return SurfaceComposerClient::getDisplayWidth(dpy); } } static jint android_view_Display_getRawHeight( static jint android_view_Display_getRawHeightNative( JNIEnv* env, jobject clazz) JNIEnv* env, jobject clazz) { { DisplayID dpy = env->GetIntField(clazz, offsets.display); DisplayID dpy = env->GetIntField(clazz, offsets.display); Loading Loading @@ -103,10 +103,10 @@ static JNINativeMethod gMethods[] = { (void*)android_view_Display_getDisplayCount }, (void*)android_view_Display_getDisplayCount }, { "init", "(I)V", { "init", "(I)V", (void*)android_view_Display_init }, (void*)android_view_Display_init }, { "getRawWidth", "()I", { "getRawWidthNative", "()I", (void*)android_view_Display_getRawWidth }, (void*)android_view_Display_getRawWidthNative }, { "getRawHeight", "()I", { "getRawHeightNative", "()I", (void*)android_view_Display_getRawHeight }, (void*)android_view_Display_getRawHeightNative }, { "getOrientation", "()I", { "getOrientation", "()I", (void*)android_view_Display_getOrientation } (void*)android_view_Display_getOrientation } }; }; Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +2 −19 Original line number Original line Diff line number Diff line Loading @@ -1724,6 +1724,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { displayWidth, displayHeight); displayWidth, displayHeight); if (mNavigationBar.isVisibleLw()) { if (mNavigationBar.isVisibleLw()) { mDockBottom = mTmpNavigationFrame.top; mDockBottom = mTmpNavigationFrame.top; mRestrictedScreenHeight = mDockBottom - mDockTop; } } } else { } else { // Landscape screen; nav bar goes to the right. // Landscape screen; nav bar goes to the right. Loading @@ -1731,6 +1732,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { displayWidth, displayHeight); displayWidth, displayHeight); if (mNavigationBar.isVisibleLw()) { if (mNavigationBar.isVisibleLw()) { mDockRight = mTmpNavigationFrame.left; mDockRight = mTmpNavigationFrame.left; mRestrictedScreenWidth = mDockRight - mDockLeft; } } } } mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, Loading @@ -1748,25 +1750,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { mStatusBar.computeFrameLw(pf, df, vf, vf); mStatusBar.computeFrameLw(pf, df, vf, vf); // now, let's consider the navigation bar; if it exists, it must be removed from the // available screen real estate (like an un-hideable status bar) if (navr != null) { if (navr.top == 0) { // Navigation bar is vertical if (mRestrictedScreenLeft == navr.left) { mRestrictedScreenLeft = navr.right; mRestrictedScreenWidth -= (navr.right - navr.left); } else if ((mRestrictedScreenLeft+mRestrictedScreenWidth) == navr.right) { mRestrictedScreenWidth -= (navr.right - navr.left); } } else { // Navigation bar horizontal, at bottom if ((mRestrictedScreenHeight+mRestrictedScreenTop) == navr.bottom) { mRestrictedScreenHeight -= (navr.bottom-navr.top); } } } if (mStatusBar.isVisibleLw()) { if (mStatusBar.isVisibleLw()) { // If the status bar is hidden, we don't want to cause // If the status bar is hidden, we don't want to cause // windows behind it to scroll. // windows behind it to scroll. Loading