Loading core/java/com/android/internal/policy/PhoneWindow.java +19 −7 Original line number Original line Diff line number Diff line Loading @@ -274,6 +274,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private int mDecorCaptionShade = DECOR_CAPTION_SHADE_AUTO; private int mDecorCaptionShade = DECOR_CAPTION_SHADE_AUTO; private boolean mUseDecorContext = false; static class WindowManagerHolder { static class WindowManagerHolder { static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface( static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService("window")); ServiceManager.getService("window")); Loading @@ -286,8 +288,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { mLayoutInflater = LayoutInflater.from(context); mLayoutInflater = LayoutInflater.from(context); } } /** * Constructor for main window of an activity. */ public PhoneWindow(Context context, Window preservedWindow) { public PhoneWindow(Context context, Window preservedWindow) { this(context); this(context); // Only main activity windows use decor context, all the other windows depend on whatever // context that was given to them. mUseDecorContext = true; if (preservedWindow != null) { if (preservedWindow != null) { mDecor = (DecorView) preservedWindow.getDecorView(); mDecor = (DecorView) preservedWindow.getDecorView(); mElevation = preservedWindow.getElevation(); mElevation = preservedWindow.getElevation(); Loading Loading @@ -2259,8 +2267,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // System process doesn't have application context and in that case we need to directly use // System process doesn't have application context and in that case we need to directly use // the context we have. Otherwise we want the application context, so we don't cling to the // the context we have. Otherwise we want the application context, so we don't cling to the // activity. // activity. Context applicationContext = getContext().getApplicationContext(); Context context; Context context; if (mUseDecorContext) { Context applicationContext = getContext().getApplicationContext(); if (applicationContext == null) { if (applicationContext == null) { context = getContext(); context = getContext(); } else { } else { Loading @@ -2269,6 +2278,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { context.setTheme(mTheme); context.setTheme(mTheme); } } } } } else { context = getContext(); } return new DecorView(context, featureId, this); return new DecorView(context, featureId, this); } } Loading Loading
core/java/com/android/internal/policy/PhoneWindow.java +19 −7 Original line number Original line Diff line number Diff line Loading @@ -274,6 +274,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private int mDecorCaptionShade = DECOR_CAPTION_SHADE_AUTO; private int mDecorCaptionShade = DECOR_CAPTION_SHADE_AUTO; private boolean mUseDecorContext = false; static class WindowManagerHolder { static class WindowManagerHolder { static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface( static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService("window")); ServiceManager.getService("window")); Loading @@ -286,8 +288,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { mLayoutInflater = LayoutInflater.from(context); mLayoutInflater = LayoutInflater.from(context); } } /** * Constructor for main window of an activity. */ public PhoneWindow(Context context, Window preservedWindow) { public PhoneWindow(Context context, Window preservedWindow) { this(context); this(context); // Only main activity windows use decor context, all the other windows depend on whatever // context that was given to them. mUseDecorContext = true; if (preservedWindow != null) { if (preservedWindow != null) { mDecor = (DecorView) preservedWindow.getDecorView(); mDecor = (DecorView) preservedWindow.getDecorView(); mElevation = preservedWindow.getElevation(); mElevation = preservedWindow.getElevation(); Loading Loading @@ -2259,8 +2267,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // System process doesn't have application context and in that case we need to directly use // System process doesn't have application context and in that case we need to directly use // the context we have. Otherwise we want the application context, so we don't cling to the // the context we have. Otherwise we want the application context, so we don't cling to the // activity. // activity. Context applicationContext = getContext().getApplicationContext(); Context context; Context context; if (mUseDecorContext) { Context applicationContext = getContext().getApplicationContext(); if (applicationContext == null) { if (applicationContext == null) { context = getContext(); context = getContext(); } else { } else { Loading @@ -2269,6 +2278,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { context.setTheme(mTheme); context.setTheme(mTheme); } } } } } else { context = getContext(); } return new DecorView(context, featureId, this); return new DecorView(context, featureId, this); } } Loading