Merge "Fix inset hinting when adding window" into lmp-mr1-dev
This commit is contained in:
@@ -675,7 +675,8 @@ public abstract class WallpaperService extends Service {
|
||||
com.android.internal.R.style.Animation_Wallpaper;
|
||||
mInputChannel = new InputChannel();
|
||||
if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
|
||||
Display.DEFAULT_DISPLAY, mContentInsets, mInputChannel) < 0) {
|
||||
Display.DEFAULT_DISPLAY, mContentInsets, mStableInsets,
|
||||
mInputChannel) < 0) {
|
||||
Log.w(TAG, "Failed to add window while updating wallpaper surface.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,15 +36,16 @@ import android.view.Surface;
|
||||
*/
|
||||
interface IWindowSession {
|
||||
int add(IWindow window, int seq, in WindowManager.LayoutParams attrs,
|
||||
in int viewVisibility, out Rect outContentInsets,
|
||||
in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets,
|
||||
out InputChannel outInputChannel);
|
||||
int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
|
||||
in int viewVisibility, in int layerStackId, out Rect outContentInsets,
|
||||
out InputChannel outInputChannel);
|
||||
out Rect outStableInsets, out InputChannel outInputChannel);
|
||||
int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
|
||||
in int viewVisibility, out Rect outContentInsets);
|
||||
in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets);
|
||||
int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
|
||||
in int viewVisibility, in int layerStackId, out Rect outContentInsets);
|
||||
in int viewVisibility, in int layerStackId, out Rect outContentInsets,
|
||||
out Rect outStableInsets);
|
||||
void remove(IWindow window);
|
||||
|
||||
/**
|
||||
|
||||
@@ -496,7 +496,8 @@ public class SurfaceView extends View {
|
||||
mLayout.type = mWindowType;
|
||||
mLayout.gravity = Gravity.START|Gravity.TOP;
|
||||
mSession.addToDisplayWithoutInputChannel(mWindow, mWindow.mSeq, mLayout,
|
||||
mVisible ? VISIBLE : GONE, display.getDisplayId(), mContentInsets);
|
||||
mVisible ? VISIBLE : GONE, display.getDisplayId(), mContentInsets,
|
||||
mStableInsets);
|
||||
}
|
||||
|
||||
boolean realSizeChanged;
|
||||
|
||||
@@ -526,7 +526,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
collectViewAttributes();
|
||||
res = mWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes,
|
||||
getHostVisibility(), mDisplay.getDisplayId(),
|
||||
mAttachInfo.mContentInsets, mInputChannel);
|
||||
mAttachInfo.mContentInsets, mAttachInfo.mStableInsets, mInputChannel);
|
||||
} catch (RemoteException e) {
|
||||
mAdded = false;
|
||||
mView = null;
|
||||
|
||||
@@ -865,12 +865,15 @@ public interface WindowManagerPolicy {
|
||||
* Return the insets for the areas covered by system windows. These values
|
||||
* are computed on the most recent layout, so they are not guaranteed to
|
||||
* be correct.
|
||||
*
|
||||
*
|
||||
* @param attrs The LayoutParams of the window.
|
||||
* @param contentInset The areas covered by system windows, expressed as positive insets
|
||||
*
|
||||
* @param outContentInsets The areas covered by system windows, expressed as positive insets.
|
||||
* @param outStableInsets The areas covered by stable system windows irrespective of their
|
||||
* current visibility. Expressed as positive insets.
|
||||
*
|
||||
*/
|
||||
public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset);
|
||||
public void getInsetHintLw(WindowManager.LayoutParams attrs, Rect outContentInsets,
|
||||
Rect outStableInsets);
|
||||
|
||||
/**
|
||||
* Called when layout of the windows is finished. After this function has
|
||||
|
||||
@@ -3073,7 +3073,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset) {
|
||||
public void getInsetHintLw(WindowManager.LayoutParams attrs, Rect outContentInsets,
|
||||
Rect outStableInsets) {
|
||||
final int fl = PolicyControl.getWindowFlags(null, attrs);
|
||||
final int sysuiVis = PolicyControl.getSystemUiVisibility(null, attrs);
|
||||
final int systemUiVisibility = (sysuiVis | attrs.subtreeSystemUiVisibility);
|
||||
@@ -3091,26 +3092,30 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
if ((systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
|
||||
if ((fl & FLAG_FULLSCREEN) != 0) {
|
||||
contentInset.set(mStableFullscreenLeft, mStableFullscreenTop,
|
||||
outContentInsets.set(mStableFullscreenLeft, mStableFullscreenTop,
|
||||
availRight - mStableFullscreenRight,
|
||||
availBottom - mStableFullscreenBottom);
|
||||
} else {
|
||||
contentInset.set(mStableLeft, mStableTop,
|
||||
outContentInsets.set(mStableLeft, mStableTop,
|
||||
availRight - mStableRight, availBottom - mStableBottom);
|
||||
}
|
||||
} else if ((fl & FLAG_FULLSCREEN) != 0 || (fl & FLAG_LAYOUT_IN_OVERSCAN) != 0) {
|
||||
contentInset.setEmpty();
|
||||
outContentInsets.setEmpty();
|
||||
} else if ((systemUiVisibility & (View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)) == 0) {
|
||||
contentInset.set(mCurLeft, mCurTop,
|
||||
outContentInsets.set(mCurLeft, mCurTop,
|
||||
availRight - mCurRight, availBottom - mCurBottom);
|
||||
} else {
|
||||
contentInset.set(mCurLeft, mCurTop,
|
||||
outContentInsets.set(mCurLeft, mCurTop,
|
||||
availRight - mCurRight, availBottom - mCurBottom);
|
||||
}
|
||||
|
||||
outStableInsets.set(mStableLeft, mStableTop,
|
||||
availRight - mStableRight, availBottom - mStableBottom);
|
||||
return;
|
||||
}
|
||||
contentInset.setEmpty();
|
||||
outContentInsets.setEmpty();
|
||||
outStableInsets.setEmpty();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -155,31 +155,32 @@ final class Session extends IWindowSession.Stub
|
||||
|
||||
@Override
|
||||
public int add(IWindow window, int seq, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, Rect outContentInsets, InputChannel outInputChannel) {
|
||||
int viewVisibility, Rect outContentInsets, Rect outStableInsets,
|
||||
InputChannel outInputChannel) {
|
||||
return addToDisplay(window, seq, attrs, viewVisibility, Display.DEFAULT_DISPLAY,
|
||||
outContentInsets, outInputChannel);
|
||||
outContentInsets, outStableInsets, outInputChannel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToDisplay(IWindow window, int seq, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, int displayId, Rect outContentInsets,
|
||||
int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets,
|
||||
InputChannel outInputChannel) {
|
||||
return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId,
|
||||
outContentInsets, outInputChannel);
|
||||
outContentInsets, outStableInsets, outInputChannel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addWithoutInputChannel(IWindow window, int seq, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, Rect outContentInsets) {
|
||||
int viewVisibility, Rect outContentInsets, Rect outStableInsets) {
|
||||
return addToDisplayWithoutInputChannel(window, seq, attrs, viewVisibility,
|
||||
Display.DEFAULT_DISPLAY, outContentInsets);
|
||||
Display.DEFAULT_DISPLAY, outContentInsets, outStableInsets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToDisplayWithoutInputChannel(IWindow window, int seq, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, int displayId, Rect outContentInsets) {
|
||||
int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets) {
|
||||
return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId,
|
||||
outContentInsets, null);
|
||||
outContentInsets, outStableInsets, null);
|
||||
}
|
||||
|
||||
public void remove(IWindow window) {
|
||||
|
||||
@@ -2266,7 +2266,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
public int addWindow(Session session, IWindow client, int seq,
|
||||
WindowManager.LayoutParams attrs, int viewVisibility, int displayId,
|
||||
Rect outContentInsets, InputChannel outInputChannel) {
|
||||
Rect outContentInsets, Rect outStableInsets, InputChannel outInputChannel) {
|
||||
int[] appOp = new int[1];
|
||||
int res = mPolicy.checkAddPermission(attrs, appOp);
|
||||
if (res != WindowManagerGlobal.ADD_OKAY) {
|
||||
@@ -2504,9 +2504,10 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
winAnimator.mEnteringAnimation = true;
|
||||
|
||||
if (displayContent.isDefaultDisplay) {
|
||||
mPolicy.getContentInsetHintLw(attrs, outContentInsets);
|
||||
mPolicy.getInsetHintLw(win.mAttrs, outContentInsets, outStableInsets);
|
||||
} else {
|
||||
outContentInsets.setEmpty();
|
||||
outStableInsets.setEmpty();
|
||||
}
|
||||
|
||||
if (mInTouchMode) {
|
||||
|
||||
@@ -38,7 +38,7 @@ import android.view.WindowManager.LayoutParams;
|
||||
public final class BridgeWindowSession implements IWindowSession {
|
||||
|
||||
@Override
|
||||
public int add(IWindow arg0, int seq, LayoutParams arg1, int arg2, Rect arg3,
|
||||
public int add(IWindow arg0, int seq, LayoutParams arg1, int arg2, Rect arg3, Rect arg4,
|
||||
InputChannel outInputchannel)
|
||||
throws RemoteException {
|
||||
// pass for now.
|
||||
@@ -47,7 +47,7 @@ public final class BridgeWindowSession implements IWindowSession {
|
||||
|
||||
@Override
|
||||
public int addToDisplay(IWindow arg0, int seq, LayoutParams arg1, int arg2, int displayId,
|
||||
Rect arg3, InputChannel outInputchannel)
|
||||
Rect arg3, Rect arg4, InputChannel outInputchannel)
|
||||
throws RemoteException {
|
||||
// pass for now.
|
||||
return 0;
|
||||
@@ -55,7 +55,7 @@ public final class BridgeWindowSession implements IWindowSession {
|
||||
|
||||
@Override
|
||||
public int addWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2,
|
||||
Rect arg3)
|
||||
Rect arg3, Rect arg4)
|
||||
throws RemoteException {
|
||||
// pass for now.
|
||||
return 0;
|
||||
@@ -63,7 +63,7 @@ public final class BridgeWindowSession implements IWindowSession {
|
||||
|
||||
@Override
|
||||
public int addToDisplayWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2,
|
||||
int displayId, Rect arg3)
|
||||
int displayId, Rect arg3, Rect arg4)
|
||||
throws RemoteException {
|
||||
// pass for now.
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user