Loading api/current.xml +132 −4 Original line number Diff line number Diff line Loading @@ -84678,6 +84678,8 @@ deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="Point" type="android.graphics.Point" static="false" Loading Loading @@ -84708,6 +84710,17 @@ <parameter name="src" type="android.graphics.Point"> </parameter> </constructor> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="equals" return="boolean" abstract="false" Loading Loading @@ -84749,6 +84762,19 @@ <parameter name="dy" type="int"> </parameter> </method> <method name="readFromParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="in" type="android.os.Parcel"> </parameter> </method> <method name="set" return="void" abstract="false" Loading @@ -84764,6 +84790,31 @@ <parameter name="y" type="int"> </parameter> </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="out" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="x" type="int" transient="false" Loading Loading @@ -84793,6 +84844,8 @@ deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="PointF" type="android.graphics.PointF" static="false" Loading Loading @@ -84823,6 +84876,17 @@ <parameter name="p" type="android.graphics.Point"> </parameter> </constructor> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="equals" return="boolean" abstract="false" Loading Loading @@ -84890,6 +84954,19 @@ <parameter name="dy" type="float"> </parameter> </method> <method name="readFromParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="in" type="android.os.Parcel"> </parameter> </method> <method name="set" return="void" abstract="false" Loading Loading @@ -84918,6 +84995,31 @@ <parameter name="p" type="android.graphics.PointF"> </parameter> </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="out" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="x" type="float" transient="false" Loading Loading @@ -209935,11 +210037,11 @@ <method name="getHeight" return="int" abstract="false" native="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading Loading @@ -209978,6 +210080,19 @@ visibility="public" > </method> <method name="getRectSize" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="outSize" type="android.graphics.Rect"> </parameter> </method> <method name="getRefreshRate" return="float" abstract="false" Loading @@ -210000,14 +210115,27 @@ visibility="public" > </method> <method name="getSize" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="outSize" type="android.graphics.Point"> </parameter> </method> <method name="getWidth" return="int" abstract="false" native="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> core/java/android/app/Activity.java +0 −12 Original line number Diff line number Diff line Loading @@ -819,18 +819,6 @@ public class Activity extends ContextThemeWrapper return mWindow != null ? mWindow.getCurrentFocus() : null; } @Override public int getWallpaperDesiredMinimumWidth() { int width = super.getWallpaperDesiredMinimumWidth(); return width <= 0 ? getWindowManager().getDefaultDisplay().getWidth() : width; } @Override public int getWallpaperDesiredMinimumHeight() { int height = super.getWallpaperDesiredMinimumHeight(); return height <= 0 ? getWindowManager().getDefaultDisplay().getHeight() : height; } /** * Called when the activity is starting. This is where most initialization * should go: calling {@link #setContentView(int)} to inflate the Loading core/java/android/app/backup/WallpaperBackupHelper.java +5 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.app.backup; import android.app.WallpaperManager; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Point; import android.os.ParcelFileDescriptor; import android.util.Slog; import android.view.Display; Loading Loading @@ -70,8 +71,10 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu if (mDesiredMinWidth <= 0 || mDesiredMinHeight <= 0) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display d = wm.getDefaultDisplay(); mDesiredMinWidth = d.getWidth(); mDesiredMinHeight = d.getHeight(); Point size = new Point(); d.getSize(size); mDesiredMinWidth = size.x; mDesiredMinHeight = size.y; } if (DEBUG) { Loading core/java/android/view/Display.java +100 −18 Original line number Diff line number Diff line Loading @@ -16,10 +16,15 @@ package android.view; import android.graphics.Point; import android.graphics.Rect; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.util.DisplayMetrics; import android.util.Slog; public class Display { public class Display { /** * Specify the default Display */ Loading @@ -35,10 +40,10 @@ public class Display Display(int display) { // initalize the statics when this class is first instansiated. This is // done here instead of in the static block because Zygote synchronized (mStaticInit) { if (!mInitialized) { synchronized (sStaticInit) { if (!sInitialized) { nativeClassInit(); mInitialized = true; sInitialized = true; } } mDisplay = display; Loading @@ -60,30 +65,93 @@ public class Display native static int getDisplayCount(); /** * Returns the raw width of the display, in pixels. Note that this * Returns the raw size of the display, in pixels. Note that this * should <em>not</em> generally be used for computing layouts, since * a device will typically have screen decoration (such as a status bar) * along the edges of the display that reduce the amount of application * space available from the raw size returned here. This value is * adjusted for you based on the current rotation of the display. */ native public int getWidth(); public void getSize(Point outSize) { try { IWindowManager wm = getWindowManager(); if (wm != null) { wm.getDisplaySize(outSize); } else { // This is just for boot-strapping, initializing the // system process before the window manager is up. outSize.y = getRealHeight(); } } catch (RemoteException e) { Slog.w("Display", "Unable to get display size", e); } } /** * Returns the raw height of the display, in pixels. Note that this * should <em>not</em> generally be used for computing layouts, since * a device will typically have screen decoration (such as a status bar) * along the edges of the display that reduce the amount of application * space available from the raw size returned here. This value is * adjusted for you based on the current rotation of the display. * This is just easier for some parts of the framework. */ public void getRectSize(Rect outSize) { synchronized (mTmpPoint) { getSize(mTmpPoint); outSize.set(0, 0, mTmpPoint.x, mTmpPoint.y); } } /** * Return the maximum screen size dimension that will happen. This is * mostly for wallpapers. * @hide */ native public int getHeight(); public int getMaximumSizeDimension() { try { IWindowManager wm = getWindowManager(); return wm.getMaximumSizeDimension(); } catch (RemoteException e) { Slog.w("Display", "Unable to get display maximum size dimension", e); return 0; } } /** @hide special for when we are faking the screen size. */ /** * @deprecated Use {@link #getSize(Point)} instead. */ @Deprecated public int getWidth() { synchronized (mTmpPoint) { long now = SystemClock.uptimeMillis(); if (now > (mLastGetTime+20)) { getSize(mTmpPoint); mLastGetTime = now; } return mTmpPoint.x; } } /** * @deprecated Use {@link #getSize(Point)} instead. */ @Deprecated public int getHeight() { synchronized (mTmpPoint) { long now = SystemClock.uptimeMillis(); if (now > (mLastGetTime+20)) { getSize(mTmpPoint); mLastGetTime = now; } return mTmpPoint.y; } } /** @hide Returns the actual screen size, not including any decor. */ native public int getRealWidth(); /** @hide special for when we are faking the screen size. */ /** @hide Returns the actual screen size, not including any decor. */ native public int getRealHeight(); /** @hide special for when we are faking the screen size. */ native public int getRawWidth(); /** @hide special for when we are faking the screen size. */ native public int getRawHeight(); /** * Returns the rotation of the screen from its "natural" orientation. * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0} Loading Loading @@ -144,6 +212,16 @@ public class Display outMetrics.realHeightPixels = outMetrics.heightPixels; } static IWindowManager getWindowManager() { synchronized (sStaticInit) { if (sWindowManager == null) { sWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService("window")); } return sWindowManager; } } /* * We use a class initializer to allow the native code to cache some * field offsets. Loading @@ -160,8 +238,12 @@ public class Display private float mDpiX; private float mDpiY; private static final Object mStaticInit = new Object(); private static boolean mInitialized = false; private final Point mTmpPoint = new Point(); private float mLastGetTime; private static final Object sStaticInit = new Object(); private static boolean sInitialized = false; private static IWindowManager sWindowManager; /** * Returns a display object which uses the metric's width/height instead. Loading core/java/android/view/IWindowManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.view.IInputMethodClient; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Point; import android.view.IApplicationToken; import android.view.IOnKeyguardExitResult; import android.view.IRotationWatcher; Loading Loading @@ -52,6 +53,9 @@ interface IWindowManager in IInputContext inputContext); boolean inputMethodClientHasFocus(IInputMethodClient client); void getDisplaySize(out Point size); int getMaximumSizeDimension(); // These can only be called when injecting events to your own window, // or by holding the INJECT_EVENTS permission. These methods may block // until pending input events are finished being dispatched even when 'sync' is false. Loading Loading
api/current.xml +132 −4 Original line number Diff line number Diff line Loading @@ -84678,6 +84678,8 @@ deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="Point" type="android.graphics.Point" static="false" Loading Loading @@ -84708,6 +84710,17 @@ <parameter name="src" type="android.graphics.Point"> </parameter> </constructor> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="equals" return="boolean" abstract="false" Loading Loading @@ -84749,6 +84762,19 @@ <parameter name="dy" type="int"> </parameter> </method> <method name="readFromParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="in" type="android.os.Parcel"> </parameter> </method> <method name="set" return="void" abstract="false" Loading @@ -84764,6 +84790,31 @@ <parameter name="y" type="int"> </parameter> </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="out" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="x" type="int" transient="false" Loading Loading @@ -84793,6 +84844,8 @@ deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="PointF" type="android.graphics.PointF" static="false" Loading Loading @@ -84823,6 +84876,17 @@ <parameter name="p" type="android.graphics.Point"> </parameter> </constructor> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="equals" return="boolean" abstract="false" Loading Loading @@ -84890,6 +84954,19 @@ <parameter name="dy" type="float"> </parameter> </method> <method name="readFromParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="in" type="android.os.Parcel"> </parameter> </method> <method name="set" return="void" abstract="false" Loading Loading @@ -84918,6 +84995,31 @@ <parameter name="p" type="android.graphics.PointF"> </parameter> </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="out" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="x" type="float" transient="false" Loading Loading @@ -209935,11 +210037,11 @@ <method name="getHeight" return="int" abstract="false" native="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading Loading @@ -209978,6 +210080,19 @@ visibility="public" > </method> <method name="getRectSize" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="outSize" type="android.graphics.Rect"> </parameter> </method> <method name="getRefreshRate" return="float" abstract="false" Loading @@ -210000,14 +210115,27 @@ visibility="public" > </method> <method name="getSize" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="outSize" type="android.graphics.Point"> </parameter> </method> <method name="getWidth" return="int" abstract="false" native="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method>
core/java/android/app/Activity.java +0 −12 Original line number Diff line number Diff line Loading @@ -819,18 +819,6 @@ public class Activity extends ContextThemeWrapper return mWindow != null ? mWindow.getCurrentFocus() : null; } @Override public int getWallpaperDesiredMinimumWidth() { int width = super.getWallpaperDesiredMinimumWidth(); return width <= 0 ? getWindowManager().getDefaultDisplay().getWidth() : width; } @Override public int getWallpaperDesiredMinimumHeight() { int height = super.getWallpaperDesiredMinimumHeight(); return height <= 0 ? getWindowManager().getDefaultDisplay().getHeight() : height; } /** * Called when the activity is starting. This is where most initialization * should go: calling {@link #setContentView(int)} to inflate the Loading
core/java/android/app/backup/WallpaperBackupHelper.java +5 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.app.backup; import android.app.WallpaperManager; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Point; import android.os.ParcelFileDescriptor; import android.util.Slog; import android.view.Display; Loading Loading @@ -70,8 +71,10 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu if (mDesiredMinWidth <= 0 || mDesiredMinHeight <= 0) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display d = wm.getDefaultDisplay(); mDesiredMinWidth = d.getWidth(); mDesiredMinHeight = d.getHeight(); Point size = new Point(); d.getSize(size); mDesiredMinWidth = size.x; mDesiredMinHeight = size.y; } if (DEBUG) { Loading
core/java/android/view/Display.java +100 −18 Original line number Diff line number Diff line Loading @@ -16,10 +16,15 @@ package android.view; import android.graphics.Point; import android.graphics.Rect; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.util.DisplayMetrics; import android.util.Slog; public class Display { public class Display { /** * Specify the default Display */ Loading @@ -35,10 +40,10 @@ public class Display Display(int display) { // initalize the statics when this class is first instansiated. This is // done here instead of in the static block because Zygote synchronized (mStaticInit) { if (!mInitialized) { synchronized (sStaticInit) { if (!sInitialized) { nativeClassInit(); mInitialized = true; sInitialized = true; } } mDisplay = display; Loading @@ -60,30 +65,93 @@ public class Display native static int getDisplayCount(); /** * Returns the raw width of the display, in pixels. Note that this * Returns the raw size of the display, in pixels. Note that this * should <em>not</em> generally be used for computing layouts, since * a device will typically have screen decoration (such as a status bar) * along the edges of the display that reduce the amount of application * space available from the raw size returned here. This value is * adjusted for you based on the current rotation of the display. */ native public int getWidth(); public void getSize(Point outSize) { try { IWindowManager wm = getWindowManager(); if (wm != null) { wm.getDisplaySize(outSize); } else { // This is just for boot-strapping, initializing the // system process before the window manager is up. outSize.y = getRealHeight(); } } catch (RemoteException e) { Slog.w("Display", "Unable to get display size", e); } } /** * Returns the raw height of the display, in pixels. Note that this * should <em>not</em> generally be used for computing layouts, since * a device will typically have screen decoration (such as a status bar) * along the edges of the display that reduce the amount of application * space available from the raw size returned here. This value is * adjusted for you based on the current rotation of the display. * This is just easier for some parts of the framework. */ public void getRectSize(Rect outSize) { synchronized (mTmpPoint) { getSize(mTmpPoint); outSize.set(0, 0, mTmpPoint.x, mTmpPoint.y); } } /** * Return the maximum screen size dimension that will happen. This is * mostly for wallpapers. * @hide */ native public int getHeight(); public int getMaximumSizeDimension() { try { IWindowManager wm = getWindowManager(); return wm.getMaximumSizeDimension(); } catch (RemoteException e) { Slog.w("Display", "Unable to get display maximum size dimension", e); return 0; } } /** @hide special for when we are faking the screen size. */ /** * @deprecated Use {@link #getSize(Point)} instead. */ @Deprecated public int getWidth() { synchronized (mTmpPoint) { long now = SystemClock.uptimeMillis(); if (now > (mLastGetTime+20)) { getSize(mTmpPoint); mLastGetTime = now; } return mTmpPoint.x; } } /** * @deprecated Use {@link #getSize(Point)} instead. */ @Deprecated public int getHeight() { synchronized (mTmpPoint) { long now = SystemClock.uptimeMillis(); if (now > (mLastGetTime+20)) { getSize(mTmpPoint); mLastGetTime = now; } return mTmpPoint.y; } } /** @hide Returns the actual screen size, not including any decor. */ native public int getRealWidth(); /** @hide special for when we are faking the screen size. */ /** @hide Returns the actual screen size, not including any decor. */ native public int getRealHeight(); /** @hide special for when we are faking the screen size. */ native public int getRawWidth(); /** @hide special for when we are faking the screen size. */ native public int getRawHeight(); /** * Returns the rotation of the screen from its "natural" orientation. * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0} Loading Loading @@ -144,6 +212,16 @@ public class Display outMetrics.realHeightPixels = outMetrics.heightPixels; } static IWindowManager getWindowManager() { synchronized (sStaticInit) { if (sWindowManager == null) { sWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService("window")); } return sWindowManager; } } /* * We use a class initializer to allow the native code to cache some * field offsets. Loading @@ -160,8 +238,12 @@ public class Display private float mDpiX; private float mDpiY; private static final Object mStaticInit = new Object(); private static boolean mInitialized = false; private final Point mTmpPoint = new Point(); private float mLastGetTime; private static final Object sStaticInit = new Object(); private static boolean sInitialized = false; private static IWindowManager sWindowManager; /** * Returns a display object which uses the metric's width/height instead. Loading
core/java/android/view/IWindowManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.view.IInputMethodClient; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Point; import android.view.IApplicationToken; import android.view.IOnKeyguardExitResult; import android.view.IRotationWatcher; Loading Loading @@ -52,6 +53,9 @@ interface IWindowManager in IInputContext inputContext); boolean inputMethodClientHasFocus(IInputMethodClient client); void getDisplaySize(out Point size); int getMaximumSizeDimension(); // These can only be called when injecting events to your own window, // or by holding the INJECT_EVENTS permission. These methods may block // until pending input events are finished being dispatched even when 'sync' is false. Loading