Loading core/java/com/android/internal/policy/DecorContext.java +14 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.view.ContextThemeWrapper; import android.view.WindowManager; import android.view.WindowManagerImpl; import java.lang.ref.WeakReference; /** * Context for decor views which can be seeded with pure application context and not depend on the * activity, but still provide some of the facilities that Activity has, Loading @@ -35,9 +37,12 @@ class DecorContext extends ContextThemeWrapper { private WindowManager mWindowManager; private Resources mActivityResources; public DecorContext(Context context, Resources activityResources) { private WeakReference<Context> mActivityContext; public DecorContext(Context context, Context activityContext) { super(context, null); mActivityResources = activityResources; mActivityContext = new WeakReference<>(activityContext); mActivityResources = activityContext.getResources(); } void setPhoneWindow(PhoneWindow phoneWindow) { Loading @@ -60,6 +65,13 @@ class DecorContext extends ContextThemeWrapper { @Override public Resources getResources() { Context activityContext = mActivityContext.get(); // Attempt to update the local cached Resources from the activity context. If the activity // is no longer around, return the old cached values. if (activityContext != null) { mActivityResources = activityContext.getResources(); } return mActivityResources; } Loading core/java/com/android/internal/policy/DecorView.java +7 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import java.util.List; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.app.ActivityManager; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; Loading @@ -55,7 +54,6 @@ import android.graphics.Region; import android.graphics.Shader; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.RemoteException; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; Loading Loading @@ -1843,6 +1841,13 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } @Override public Resources getResources() { // Make sure the Resources object is propogated from the Context since it can be updated in // the Context object. return getContext().getResources(); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading core/java/com/android/internal/policy/PhoneWindow.java +1 −1 Original line number Diff line number Diff line Loading @@ -2299,7 +2299,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (applicationContext == null) { context = getContext(); } else { context = new DecorContext(applicationContext, getContext().getResources()); context = new DecorContext(applicationContext, getContext()); if (mTheme != -1) { context.setTheme(mTheme); } Loading Loading
core/java/com/android/internal/policy/DecorContext.java +14 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.view.ContextThemeWrapper; import android.view.WindowManager; import android.view.WindowManagerImpl; import java.lang.ref.WeakReference; /** * Context for decor views which can be seeded with pure application context and not depend on the * activity, but still provide some of the facilities that Activity has, Loading @@ -35,9 +37,12 @@ class DecorContext extends ContextThemeWrapper { private WindowManager mWindowManager; private Resources mActivityResources; public DecorContext(Context context, Resources activityResources) { private WeakReference<Context> mActivityContext; public DecorContext(Context context, Context activityContext) { super(context, null); mActivityResources = activityResources; mActivityContext = new WeakReference<>(activityContext); mActivityResources = activityContext.getResources(); } void setPhoneWindow(PhoneWindow phoneWindow) { Loading @@ -60,6 +65,13 @@ class DecorContext extends ContextThemeWrapper { @Override public Resources getResources() { Context activityContext = mActivityContext.get(); // Attempt to update the local cached Resources from the activity context. If the activity // is no longer around, return the old cached values. if (activityContext != null) { mActivityResources = activityContext.getResources(); } return mActivityResources; } Loading
core/java/com/android/internal/policy/DecorView.java +7 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import java.util.List; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.app.ActivityManager; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; Loading @@ -55,7 +54,6 @@ import android.graphics.Region; import android.graphics.Shader; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.RemoteException; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; Loading Loading @@ -1843,6 +1841,13 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } @Override public Resources getResources() { // Make sure the Resources object is propogated from the Context since it can be updated in // the Context object. return getContext().getResources(); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading
core/java/com/android/internal/policy/PhoneWindow.java +1 −1 Original line number Diff line number Diff line Loading @@ -2299,7 +2299,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (applicationContext == null) { context = getContext(); } else { context = new DecorContext(applicationContext, getContext().getResources()); context = new DecorContext(applicationContext, getContext()); if (mTheme != -1) { context.setTheme(mTheme); } Loading