DisplayCutout API: Make constructor public and adjust javadoc

Change-Id: I093cf4f9ea60f00e187aeb4a548f3f5789d87fa1
Fixes: 73953880
Test: make update-api
(cherry picked from commit d61db603fe)
This commit is contained in:
Adrian Roos
2018-03-02 14:31:37 +01:00
parent 999e97f405
commit 9bbd9661c0
2 changed files with 22 additions and 7 deletions

View File

@@ -46575,6 +46575,7 @@ package android.view {
}
public final class DisplayCutout {
ctor public DisplayCutout(android.graphics.Rect, android.graphics.Region);
method public android.graphics.Region getBounds();
method public int getSafeInsetBottom();
method public int getSafeInsetLeft();

View File

@@ -89,7 +89,21 @@ public final class DisplayCutout {
private final Rect mSafeInsets;
private final Region mBounds;
private final Size mFrameSize;
private final Size mFrameSize; // TODO: move frameSize, calculateRelativeTo, etc. into WM.
/**
* Creates a DisplayCutout instance.
*
* @param safeInsets the insets from each edge which avoid the display cutout as returned by
* {@link #getSafeInsetTop()} etc.
* @param bounds the bounds of the display cutout as returned by {@link #getBounds()}.
*/
// TODO(b/73953958): @VisibleForTesting(visibility = PRIVATE)
public DisplayCutout(Rect safeInsets, Region bounds) {
this(safeInsets != null ? new Rect(safeInsets) : ZERO_RECT,
bounds != null ? Region.obtain(bounds) : Region.obtain(),
null /* frameSize */);
}
/**
* Creates a DisplayCutout instance.
@@ -114,28 +128,28 @@ public final class DisplayCutout {
return mSafeInsets.equals(ZERO_RECT);
}
/** Returns the inset from the top which avoids the display cutout. */
/** Returns the inset from the top which avoids the display cutout in pixels. */
public int getSafeInsetTop() {
return mSafeInsets.top;
}
/** Returns the inset from the bottom which avoids the display cutout. */
/** Returns the inset from the bottom which avoids the display cutout in pixels. */
public int getSafeInsetBottom() {
return mSafeInsets.bottom;
}
/** Returns the inset from the left which avoids the display cutout. */
/** Returns the inset from the left which avoids the display cutout in pixels. */
public int getSafeInsetLeft() {
return mSafeInsets.left;
}
/** Returns the inset from the right which avoids the display cutout. */
/** Returns the inset from the right which avoids the display cutout in pixels. */
public int getSafeInsetRight() {
return mSafeInsets.right;
}
/**
* Returns the safe insets in a rect.
* Returns the safe insets in a rect in pixel units.
*
* @return a rect which is set to the safe insets.
* @hide
@@ -148,7 +162,7 @@ public final class DisplayCutout {
* Returns the bounding region of the cutout.
*
* @return the bounding region of the cutout. Coordinates are relative
* to the top-left corner of the content view.
* to the top-left corner of the content view and in pixel units.
*/
public Region getBounds() {
return Region.obtain(mBounds);