Always add PhoneWindow when creating DecorView.
Because DecorView is now a static inner class, we need to remember to always add the PhoneWindow on which it depends. PhoneWindow.generateDecor will do that now to prevent further mistakes. Also remove PhoneWindow.setFeatureFromAttrs which is not used anywhere and seems to be an artifact from the past. Bug: 25086413 Change-Id: I0d8e5df717d7046e85ffc58f7ec4e94ce15a7d80
This commit is contained in:
@@ -2404,7 +2404,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
|
||||
private PhoneWindow mWindow;
|
||||
|
||||
public DecorView(Context context, int featureId) {
|
||||
private DecorView(Context context, int featureId, PhoneWindow window) {
|
||||
super(context);
|
||||
mFeatureId = featureId;
|
||||
|
||||
@@ -2415,6 +2415,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
|
||||
mBarEnterExitDuration = context.getResources().getInteger(
|
||||
R.integer.dock_enter_exit_duration);
|
||||
|
||||
setWindow(window);
|
||||
}
|
||||
|
||||
public void setBackgroundFallback(int resId) {
|
||||
@@ -3868,22 +3870,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
context.setTheme(mTheme);
|
||||
}
|
||||
}
|
||||
return new DecorView(context, featureId);
|
||||
}
|
||||
|
||||
protected void setFeatureFromAttrs(int featureId, TypedArray attrs,
|
||||
int drawableAttr, int alphaAttr) {
|
||||
Drawable d = attrs.getDrawable(drawableAttr);
|
||||
if (d != null) {
|
||||
requestFeature(featureId);
|
||||
setFeatureDefaultDrawable(featureId, d);
|
||||
}
|
||||
if ((getFeatures() & (1 << featureId)) != 0) {
|
||||
int alpha = attrs.getInt(alphaAttr, -1);
|
||||
if (alpha >= 0) {
|
||||
setFeatureDrawableAlpha(featureId, alpha);
|
||||
}
|
||||
}
|
||||
return new DecorView(context, featureId, this);
|
||||
}
|
||||
|
||||
protected ViewGroup generateLayout(DecorView decor) {
|
||||
@@ -4268,7 +4255,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
mForceDecorInstall = false;
|
||||
if (mDecor == null) {
|
||||
mDecor = generateDecor(-1);
|
||||
mDecor.setWindow(this);
|
||||
mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
|
||||
mDecor.setIsRootNamespace(true);
|
||||
if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {
|
||||
|
||||
Reference in New Issue
Block a user