Skip to content

Commit 2a7a6ca

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Implement new window cropping." into jb-dev
2 parents 0d607fb + 85afd1b commit 2a7a6ca

File tree

14 files changed

+138
-137
lines changed

14 files changed

+138
-137
lines changed

core/java/android/service/wallpaper/WallpaperService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public class Engine {
154154
int mCurWindowPrivateFlags = mWindowPrivateFlags;
155155
final Rect mVisibleInsets = new Rect();
156156
final Rect mWinFrame = new Rect();
157-
final Rect mSystemInsets = new Rect();
158157
final Rect mContentInsets = new Rect();
159158
final Configuration mConfiguration = new Configuration();
160159

@@ -254,7 +253,7 @@ public void onInputEvent(InputEvent event) {
254253

255254
final BaseIWindow mWindow = new BaseIWindow() {
256255
@Override
257-
public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
256+
public void resized(int w, int h, Rect contentInsets,
258257
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
259258
Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED,
260259
reportDraw ? 1 : 0);
@@ -621,7 +620,7 @@ void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNee
621620

622621
final int relayoutResult = mSession.relayout(
623622
mWindow, mWindow.mSeq, mLayout, mWidth, mHeight,
624-
View.VISIBLE, 0, mWinFrame, mSystemInsets, mContentInsets,
623+
View.VISIBLE, 0, mWinFrame, mContentInsets,
625624
mVisibleInsets, mConfiguration, mSurfaceHolder.mSurface);
626625

627626
if (DEBUG) Log.v(TAG, "New surface: " + mSurfaceHolder.mSurface

core/java/android/view/IWindow.aidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ oneway interface IWindow {
4545
*/
4646
void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor);
4747

48-
void resized(int w, int h, in Rect systemInsets, in Rect contentInsets,
48+
void resized(int w, int h, in Rect contentInsets,
4949
in Rect visibleInsets, boolean reportDraw, in Configuration newConfig);
5050
void dispatchAppVisibility(boolean visible);
5151
void dispatchGetNewSurface();

core/java/android/view/IWindowSession.aidl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ interface IWindowSession {
5858
* {@link WindowManagerImpl#RELAYOUT_DEFER_SURFACE_DESTROY}.
5959
* @param outFrame Rect in which is placed the new position/size on
6060
* screen.
61-
* @param outSystemInsets Rect in which is placed the offsets from
62-
* <var>outFrame</var> over which any core system UI elements are
63-
* currently covering the window. This is not generally used for
64-
* layout, but just to know where the window is obscured.
6561
* @param outContentInsets Rect in which is placed the offsets from
6662
* <var>outFrame</var> in which the content of the window should be
6763
* placed. This can be used to modify the window layout to ensure its
@@ -83,7 +79,7 @@ interface IWindowSession {
8379
*/
8480
int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
8581
int requestedWidth, int requestedHeight, int viewVisibility,
86-
int flags, out Rect outFrame, out Rect outSystemInsets,
82+
int flags, out Rect outFrame,
8783
out Rect outContentInsets, out Rect outVisibleInsets,
8884
out Configuration outConfig, out Surface outSurface);
8985

core/java/android/view/SurfaceView.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public class SurfaceView extends View {
9898
MyWindow mWindow;
9999
final Rect mVisibleInsets = new Rect();
100100
final Rect mWinFrame = new Rect();
101-
final Rect mSystemInsets = new Rect();
102101
final Rect mContentInsets = new Rect();
103102
final Configuration mConfiguration = new Configuration();
104103

@@ -472,7 +471,7 @@ private void updateWindow(boolean force, boolean redrawNeeded) {
472471
mWindow, mWindow.mSeq, mLayout, mWidth, mHeight,
473472
visible ? VISIBLE : GONE,
474473
WindowManagerImpl.RELAYOUT_DEFER_SURFACE_DESTROY,
475-
mWinFrame, mSystemInsets, mContentInsets,
474+
mWinFrame, mContentInsets,
476475
mVisibleInsets, mConfiguration, mNewSurface);
477476
if ((relayoutResult&WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0) {
478477
mReportDrawNeeded = true;
@@ -606,7 +605,7 @@ public MyWindow(SurfaceView surfaceView) {
606605
mSurfaceView = new WeakReference<SurfaceView>(surfaceView);
607606
}
608607

609-
public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
608+
public void resized(int w, int h, Rect contentInsets,
610609
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
611610
SurfaceView surfaceView = mSurfaceView.get();
612611
if (surfaceView != null) {

core/java/android/view/View.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17189,12 +17189,6 @@ public void setPooled(boolean isPooled) {
1718917189
*/
1719017190
boolean mUse32BitDrawingCache;
1719117191

17192-
/**
17193-
* Describes the parts of the window that are currently completely
17194-
* obscured by system UI elements.
17195-
*/
17196-
final Rect mSystemInsets = new Rect();
17197-
1719817192
/**
1719917193
* For windows that are full-screen but using insets to layout inside
1720017194
* of the screen decorations, these are the current insets for the

core/java/android/view/ViewRootImpl.java

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ public final class ViewRootImpl implements ViewParent,
262262

263263
final Rect mPendingVisibleInsets = new Rect();
264264
final Rect mPendingContentInsets = new Rect();
265-
final Rect mPendingSystemInsets = new Rect();
266265
final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
267266
= new ViewTreeObserver.InternalInsetsInfo();
268267

@@ -272,7 +271,6 @@ public final class ViewRootImpl implements ViewParent,
272271
final Configuration mPendingConfiguration = new Configuration();
273272

274273
class ResizedInfo {
275-
Rect systemInsets;
276274
Rect contentInsets;
277275
Rect visibleInsets;
278276
Configuration newConfig;
@@ -568,7 +566,6 @@ public void setView(View view, WindowManager.LayoutParams attrs, View panelParen
568566
if (mTranslator != null) {
569567
mTranslator.translateRectInScreenToAppWindow(mAttachInfo.mContentInsets);
570568
}
571-
mPendingSystemInsets.set(0, 0, 0, 0);
572569
mPendingContentInsets.set(mAttachInfo.mContentInsets);
573570
mPendingVisibleInsets.set(0, 0, 0, 0);
574571
if (DEBUG_LAYOUT) Log.v(TAG, "Added window " + mWindow);
@@ -1235,7 +1232,6 @@ private void performTraversals() {
12351232
getRunQueue().executeActions(attachInfo.mHandler);
12361233

12371234
boolean insetsChanged = false;
1238-
boolean activeRectChanged = false;
12391235

12401236
boolean layoutRequested = mLayoutRequested && !mStopped;
12411237
if (layoutRequested) {
@@ -1247,12 +1243,7 @@ private void performTraversals() {
12471243
// to opposite of the added touch mode.
12481244
mAttachInfo.mInTouchMode = !mAddedTouchMode;
12491245
ensureTouchModeLocally(mAddedTouchMode);
1250-
activeRectChanged = true;
12511246
} else {
1252-
if (!mPendingSystemInsets.equals(mAttachInfo.mSystemInsets)) {
1253-
mAttachInfo.mSystemInsets.set(mPendingSystemInsets);
1254-
activeRectChanged = true;
1255-
}
12561247
if (!mPendingContentInsets.equals(mAttachInfo.mContentInsets)) {
12571248
insetsChanged = true;
12581249
}
@@ -1406,10 +1397,6 @@ private void performTraversals() {
14061397
mPendingConfiguration.seq = 0;
14071398
}
14081399

1409-
if (!mPendingSystemInsets.equals(mAttachInfo.mSystemInsets)) {
1410-
activeRectChanged = true;
1411-
mAttachInfo.mSystemInsets.set(mPendingSystemInsets);
1412-
}
14131400
contentInsetsChanged = !mPendingContentInsets.equals(
14141401
mAttachInfo.mContentInsets);
14151402
visibleInsetsChanged = !mPendingVisibleInsets.equals(
@@ -1512,7 +1499,6 @@ private void performTraversals() {
15121499
// before actually drawing them, so it can display then
15131500
// all at once.
15141501
newSurface = true;
1515-
activeRectChanged = true;
15161502
mFullRedrawNeeded = true;
15171503
mPreviousTransparentRegion.setEmpty();
15181504

@@ -1578,7 +1564,6 @@ private void performTraversals() {
15781564
// window size we asked for. We should avoid this by getting a maximum size from
15791565
// the window session beforehand.
15801566
if (mWidth != frame.width() || mHeight != frame.height()) {
1581-
activeRectChanged = true;
15821567
mWidth = frame.width();
15831568
mHeight = frame.height();
15841569
}
@@ -2814,7 +2799,6 @@ public void handleMessage(Message msg) {
28142799
ResizedInfo ri = (ResizedInfo)msg.obj;
28152800

28162801
if (mWinFrame.width() == msg.arg1 && mWinFrame.height() == msg.arg2
2817-
&& mPendingSystemInsets.equals(ri.systemInsets)
28182802
&& mPendingContentInsets.equals(ri.contentInsets)
28192803
&& mPendingVisibleInsets.equals(ri.visibleInsets)
28202804
&& ((ResizedInfo)msg.obj).newConfig == null) {
@@ -2831,7 +2815,6 @@ public void handleMessage(Message msg) {
28312815
mWinFrame.right = msg.arg1;
28322816
mWinFrame.top = 0;
28332817
mWinFrame.bottom = msg.arg2;
2834-
mPendingSystemInsets.set(((ResizedInfo)msg.obj).systemInsets);
28352818
mPendingContentInsets.set(((ResizedInfo)msg.obj).contentInsets);
28362819
mPendingVisibleInsets.set(((ResizedInfo)msg.obj).visibleInsets);
28372820
if (msg.what == MSG_RESIZED_REPORT) {
@@ -3866,7 +3849,7 @@ private int relayoutWindow(WindowManager.LayoutParams params, int viewVisibility
38663849
(int) (mView.getMeasuredWidth() * appScale + 0.5f),
38673850
(int) (mView.getMeasuredHeight() * appScale + 0.5f),
38683851
viewVisibility, insetsPending ? WindowManagerImpl.RELAYOUT_INSETS_PENDING : 0,
3869-
mWinFrame, mPendingSystemInsets, mPendingContentInsets, mPendingVisibleInsets,
3852+
mWinFrame, mPendingContentInsets, mPendingVisibleInsets,
38703853
mPendingConfiguration, mSurface);
38713854
//Log.d(TAG, "<<<<<< BACK FROM relayout");
38723855
if (restore) {
@@ -4062,11 +4045,10 @@ public void dispatchFinishInputConnection(InputConnection connection) {
40624045
mHandler.sendMessage(msg);
40634046
}
40644047

4065-
public void dispatchResized(int w, int h, Rect systemInsets, Rect contentInsets,
4048+
public void dispatchResized(int w, int h, Rect contentInsets,
40664049
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
40674050
if (DEBUG_LAYOUT) Log.v(TAG, "Resizing " + this + ": w=" + w
4068-
+ " h=" + h + " systemInsets=" + systemInsets.toShortString()
4069-
+ " contentInsets=" + contentInsets.toShortString()
4051+
+ " h=" + h + " contentInsets=" + contentInsets.toShortString()
40704052
+ " visibleInsets=" + visibleInsets.toShortString()
40714053
+ " reportDraw=" + reportDraw);
40724054
Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT :MSG_RESIZED);
@@ -4079,7 +4061,6 @@ public void dispatchResized(int w, int h, Rect systemInsets, Rect contentInsets,
40794061
msg.arg1 = w;
40804062
msg.arg2 = h;
40814063
ResizedInfo ri = new ResizedInfo();
4082-
ri.systemInsets = new Rect(systemInsets);
40834064
ri.contentInsets = new Rect(contentInsets);
40844065
ri.visibleInsets = new Rect(visibleInsets);
40854066
ri.newConfig = newConfig;
@@ -4735,11 +4716,11 @@ static class W extends IWindow.Stub {
47354716
mViewAncestor = new WeakReference<ViewRootImpl>(viewAncestor);
47364717
}
47374718

4738-
public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
4719+
public void resized(int w, int h, Rect contentInsets,
47394720
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
47404721
final ViewRootImpl viewAncestor = mViewAncestor.get();
47414722
if (viewAncestor != null) {
4742-
viewAncestor.dispatchResized(w, h, systemInsets, contentInsets,
4723+
viewAncestor.dispatchResized(w, h, contentInsets,
47434724
visibleInsets, reportDraw, newConfig);
47444725
}
47454726
}

core/java/android/view/WindowManagerPolicy.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,6 @@ public interface WindowState {
145145
* @param displayFrame The frame of the overall display in which this
146146
* window can appear, used for constraining the overall dimensions
147147
* of the window.
148-
* @param systemFrame The frame within the display that any system
149-
* elements are currently covering. These indicate which parts of
150-
* the window should be considered completely obscured by the screen
151-
* decorations.
152148
* @param contentFrame The frame within the display in which we would
153149
* like active content to appear. This will cause windows behind to
154150
* be resized to match the given content frame.
@@ -160,7 +156,7 @@ public interface WindowState {
160156
* are visible.
161157
*/
162158
public void computeFrameLw(Rect parentFrame, Rect displayFrame,
163-
Rect systemFrame, Rect contentFrame, Rect visibleFrame);
159+
Rect contentFrame, Rect visibleFrame);
164160

165161
/**
166162
* Retrieve the current frame of the window that has been assigned by
@@ -187,14 +183,6 @@ public void computeFrameLw(Rect parentFrame, Rect displayFrame,
187183
*/
188184
public Rect getDisplayFrameLw();
189185

190-
/**
191-
* Retrieve the frame of the system elements that last covered the window.
192-
* Must be called with the window manager lock held.
193-
*
194-
* @return Rect The rectangle holding the system frame.
195-
*/
196-
public Rect getSystemFrameLw();
197-
198186
/**
199187
* Retrieve the frame of the content area that this window was last
200188
* laid out in. This is the area in which the content of the window
@@ -772,6 +760,21 @@ public int prepareAddWindowLw(WindowState win,
772760
*/
773761
public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotation);
774762

763+
/**
764+
* Return the rectangle of the screen currently covered by system decorations.
765+
* This will be called immediately after {@link #layoutWindowLw}. It can
766+
* fill in the rectangle to indicate any part of the screen that it knows
767+
* for sure is covered by system decor such as the status bar. The rectangle
768+
* is initially set to the actual size of the screen, indicating nothing is
769+
* covered.
770+
*
771+
* @param systemRect The rectangle of the screen that is not covered by
772+
* system decoration.
773+
* @return Returns the layer above which the system rectangle should
774+
* not be applied.
775+
*/
776+
public int getSystemDecorRectLw(Rect systemRect);
777+
775778
/**
776779
* Called for each window attached to the window manager as layout is
777780
* proceeding. The implementation of this function must take care of
@@ -797,7 +800,7 @@ public void layoutWindowLw(WindowState win,
797800
*
798801
*/
799802
public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset);
800-
803+
801804
/**
802805
* Called when layout of the windows is finished. After this function has
803806
* returned, all windows given to layoutWindow() <em>must</em> have had a

core/java/com/android/internal/view/BaseIWindow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setSession(IWindowSession session) {
3333
mSession = session;
3434
}
3535

36-
public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
36+
public void resized(int w, int h, Rect contentInsets,
3737
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
3838
if (reportDraw) {
3939
try {

0 commit comments

Comments
 (0)