* commit '58bbc5f7889946a5cbd58f5af41c1127edef1a0e': Optimize keyguard/IME interactions
This commit is contained in:
@@ -122,6 +122,7 @@ public class KeyguardViewManager {
|
|||||||
class ViewManagerHost extends FrameLayout {
|
class ViewManagerHost extends FrameLayout {
|
||||||
public ViewManagerHost(Context context) {
|
public ViewManagerHost(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
setFitsSystemWindows(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -164,7 +165,8 @@ public class KeyguardViewManager {
|
|||||||
|
|
||||||
mKeyguardHost = new ViewManagerHost(mContext);
|
mKeyguardHost = new ViewManagerHost(mContext);
|
||||||
|
|
||||||
int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
|
int flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||||
|
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
|
||||||
| WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
| WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||||
|
|
||||||
if (!mNeedsInput) {
|
if (!mNeedsInput) {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.graphics.Paint;
|
|||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.util.FloatProperty;
|
import android.util.FloatProperty;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Property;
|
import android.util.Property;
|
||||||
@@ -64,6 +65,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
|
|||||||
private Drawable mFrameDrawable;
|
private Drawable mFrameDrawable;
|
||||||
private boolean mEdgeCaptured;
|
private boolean mEdgeCaptured;
|
||||||
|
|
||||||
|
private DisplayMetrics mDisplayMetrics;
|
||||||
|
|
||||||
// Initialized during measurement from child layoutparams
|
// Initialized during measurement from child layoutparams
|
||||||
private View mExpandChallengeView;
|
private View mExpandChallengeView;
|
||||||
private KeyguardSecurityContainer mChallengeView;
|
private KeyguardSecurityContainer mChallengeView;
|
||||||
@@ -264,7 +267,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
|
|||||||
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||||
mTouchSlopSquare = mTouchSlop * mTouchSlop;
|
mTouchSlopSquare = mTouchSlop * mTouchSlop;
|
||||||
|
|
||||||
final float density = res.getDisplayMetrics().density;
|
mDisplayMetrics = res.getDisplayMetrics();
|
||||||
|
final float density = mDisplayMetrics.density;
|
||||||
|
|
||||||
// top half of the lock icon, plus another 25% to be sure
|
// top half of the lock icon, plus another 25% to be sure
|
||||||
mDragHandleClosedAbove = (int) (DRAG_HANDLE_CLOSED_ABOVE * density + 0.5f);
|
mDragHandleClosedAbove = (int) (DRAG_HANDLE_CLOSED_ABOVE * density + 0.5f);
|
||||||
@@ -887,10 +891,28 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Don't measure the challenge view twice!
|
// Don't measure the challenge view twice!
|
||||||
if (child != mChallengeView) {
|
if (child == mChallengeView) continue;
|
||||||
measureChildWithMargins(child, widthSpec, 0, heightSpec, 0);
|
|
||||||
|
// Measure children. Widget frame measures special, so that we can ignore
|
||||||
|
// insets for the IME.
|
||||||
|
int parentWidthSpec = widthSpec, parentHeightSpec = heightSpec;
|
||||||
|
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||||
|
if (lp.childType == LayoutParams.CHILD_TYPE_WIDGETS) {
|
||||||
|
final View root = getRootView();
|
||||||
|
if (root != null) {
|
||||||
|
// This calculation is super dodgy and relies on several assumptions.
|
||||||
|
// Specifically that the root of the window will be padded in for insets
|
||||||
|
// and that the window is LAYOUT_IN_SCREEN.
|
||||||
|
final int windowWidth = mDisplayMetrics.widthPixels;
|
||||||
|
final int windowHeight = mDisplayMetrics.heightPixels - root.getPaddingTop();
|
||||||
|
parentWidthSpec = MeasureSpec.makeMeasureSpec(
|
||||||
|
windowWidth, MeasureSpec.EXACTLY);
|
||||||
|
parentHeightSpec = MeasureSpec.makeMeasureSpec(
|
||||||
|
windowHeight, MeasureSpec.EXACTLY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
measureChildWithMargins(child, parentWidthSpec, 0, parentHeightSpec, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user