Merge "Stop using raw display size except in window manager."
This commit is contained in:
@@ -416,14 +416,8 @@ public class Display {
|
||||
outMetrics.ydpi = outMetrics.noncompatYdpi = mDpiY;
|
||||
}
|
||||
|
||||
static IWindowManager getWindowManager() {
|
||||
synchronized (sStaticInit) {
|
||||
if (sWindowManager == null) {
|
||||
sWindowManager = IWindowManager.Stub.asInterface(
|
||||
ServiceManager.getService("window"));
|
||||
}
|
||||
return sWindowManager;
|
||||
}
|
||||
private static IWindowManager getWindowManager() {
|
||||
return WindowManagerImpl.getWindowManagerService();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -449,6 +443,5 @@ public class Display {
|
||||
|
||||
private static final Object sStaticInit = new Object();
|
||||
private static boolean sInitialized = false;
|
||||
private static IWindowManager sWindowManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.app.AppGlobals;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Point;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -277,15 +278,17 @@ public class ViewConfiguration {
|
||||
mDoubleTapSlop = (int) (sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
|
||||
mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
|
||||
|
||||
final Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
|
||||
// Size of the screen in bytes, in ARGB_8888 format
|
||||
mMaximumDrawingCacheSize = 4 * display.getRawWidth() * display.getRawHeight();
|
||||
final Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
|
||||
final Point size = new Point();
|
||||
display.getRealSize(size);
|
||||
mMaximumDrawingCacheSize = 4 * size.x * size.y;
|
||||
|
||||
mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
|
||||
mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
|
||||
|
||||
if (!sHasPermanentMenuKeySet) {
|
||||
IWindowManager wm = Display.getWindowManager();
|
||||
IWindowManager wm = WindowManagerImpl.getWindowManagerService();
|
||||
try {
|
||||
sHasPermanentMenuKey = !wm.hasSystemNavBar() && !wm.hasNavigationBar();
|
||||
sHasPermanentMenuKeySet = true;
|
||||
|
||||
@@ -331,7 +331,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
if (!mInitialized) {
|
||||
try {
|
||||
InputMethodManager imm = InputMethodManager.getInstance(mainLooper);
|
||||
IWindowManager windowManager = Display.getWindowManager();
|
||||
IWindowManager windowManager = WindowManagerImpl.getWindowManagerService();
|
||||
sWindowSession = windowManager.openSession(
|
||||
imm.getClient(), imm.getInputContext());
|
||||
float animatorScale = windowManager.getAnimationScale(2);
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.content.ComponentCallbacks2;
|
||||
import android.content.res.Configuration;
|
||||
import android.opengl.ManagedEGLContext;
|
||||
import android.os.IBinder;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.AndroidRuntimeException;
|
||||
import android.util.Log;
|
||||
@@ -111,6 +112,7 @@ public class WindowManagerImpl implements WindowManager {
|
||||
public static final int ADD_PERMISSION_DENIED = -8;
|
||||
|
||||
private static WindowManagerImpl sDefaultWindowManager;
|
||||
private static IWindowManager sWindowManagerService;
|
||||
|
||||
private final WindowManagerState mState;
|
||||
private final Window mParentWindow;
|
||||
@@ -135,6 +137,16 @@ public class WindowManagerImpl implements WindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static IWindowManager getWindowManagerService() {
|
||||
synchronized (WindowManagerImpl.class) {
|
||||
if (sWindowManagerService == null) {
|
||||
sWindowManagerService = IWindowManager.Stub.asInterface(
|
||||
ServiceManager.getService("window"));
|
||||
}
|
||||
return sWindowManagerService;
|
||||
}
|
||||
}
|
||||
|
||||
public WindowManagerImpl makeLocal(Window parentWindow) {
|
||||
return new WindowManagerImpl(mState, parentWindow, parentWindow.getCompatibilityInfo());
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.animation.ObjectAnimator;
|
||||
import android.app.StatusBarManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -431,13 +432,14 @@ public class NavigationBarView extends LinearLayout {
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
pw.println("NavigationBarView {");
|
||||
final Rect r = new Rect();
|
||||
final Point size = new Point();
|
||||
mDisplay.getRealSize(size);
|
||||
|
||||
pw.println(String.format(" this: " + PhoneStatusBar.viewInfo(this)
|
||||
+ " " + visibilityToString(getVisibility())));
|
||||
|
||||
getWindowVisibleDisplayFrame(r);
|
||||
final boolean offscreen = r.right > mDisplay.getRawWidth()
|
||||
|| r.bottom > mDisplay.getRawHeight();
|
||||
final boolean offscreen = r.right > size.x || r.bottom > size.y;
|
||||
pw.println(" window: "
|
||||
+ r.toShortString()
|
||||
+ " " + visibilityToString(getWindowVisibility())
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.content.pm.ServiceInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.Point;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
@@ -49,6 +50,7 @@ import android.util.Pair;
|
||||
import android.util.Slog;
|
||||
import android.util.TypedValue;
|
||||
import android.util.Xml;
|
||||
import android.view.Display;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
@@ -188,11 +190,12 @@ class AppWidgetServiceImpl {
|
||||
|
||||
void computeMaximumWidgetBitmapMemory() {
|
||||
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
int height = wm.getDefaultDisplay().getRawHeight();
|
||||
int width = wm.getDefaultDisplay().getRawWidth();
|
||||
Display display = wm.getDefaultDisplay();
|
||||
Point size = new Point();
|
||||
display.getRealSize(size);
|
||||
// Cap memory usage at 1.5 times the size of the display
|
||||
// 1.5 * 4 bytes/pixel * w * h ==> 6 * w * h
|
||||
mMaxWidgetBitmapMemory = 6 * width * height;
|
||||
mMaxWidgetBitmapMemory = 6 * size.x * size.y;
|
||||
}
|
||||
|
||||
public void systemReady(boolean safeMode) {
|
||||
|
||||
Reference in New Issue
Block a user