Merge "Fix issue #3291173: Problem report for NewsRoom - RSS News Reader" into honeycomb
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 055984f..3c45080 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -4268,7 +4268,7 @@
         
         mWindow = PolicyManager.makeNewWindow(this);
         mWindow.setCallback(this);
-        mWindow.getLayoutInflater().setFactory2(this);
+        mWindow.getLayoutInflater().setPrivateFactory(this);
         if (info.softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) {
             mWindow.setSoftInputMode(info.softInputMode);
         }
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index d24af52..a17ed9d 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -68,6 +68,7 @@
     private boolean mFactorySet;
     private Factory mFactory;
     private Factory2 mFactory2;
+    private Factory2 mPrivateFactory;
     private Filter mFilter;
 
     private final Object[] mConstructorArgs = new Object[2];
@@ -193,6 +194,7 @@
         mContext = newContext;
         mFactory = original.mFactory;
         mFactory2 = original.mFactory2;
+        mPrivateFactory = original.mPrivateFactory;
         mFilter = original.mFilter;
     }
     
@@ -300,6 +302,13 @@
     }
 
     /**
+     * @hide for use by framework
+     */
+    public void setPrivateFactory(Factory2 factory) {
+        mPrivateFactory = factory;
+    }
+
+    /**
      * @return The {@link Filter} currently used by this LayoutInflater to restrict the set of Views
      * that are allowed to be inflated.
      */
@@ -651,6 +660,10 @@
             else if (mFactory != null) view = mFactory.onCreateView(name, mContext, attrs);
             else view = null;
 
+            if (view == null && mPrivateFactory != null) {
+                view = mPrivateFactory.onCreateView(parent, name, mContext, attrs);
+            }
+            
             if (view == null) {
                 if (-1 == name.indexOf('.')) {
                     view = onCreateView(parent, name, attrs);
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index fcc8e693..faaa28d7 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -11315,13 +11315,13 @@
 
         mInputMonitor.thawInputDispatchingLw();
 
+        boolean configChanged;
+        
         // While the display is frozen we don't re-compute the orientation
         // to avoid inconsistent states.  However, something interesting
         // could have actually changed during that time so re-evaluate it
         // now to catch that.
-        if (updateOrientationFromAppTokensLocked(false)) {
-            mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
-        }
+        configChanged = updateOrientationFromAppTokensLocked(false);
 
         // A little kludge: a lot could have happened while the
         // display was frozen, so now that we are coming back we
@@ -11336,11 +11336,12 @@
         
         if (updateRotation) {
             if (DEBUG_ORIENTATION) Slog.d(TAG, "Performing post-rotate rotation");
-            boolean changed = setRotationUncheckedLocked(
+            configChanged |= setRotationUncheckedLocked(
                     WindowManagerPolicy.USE_LAST_ROTATION, 0, false);
-            if (changed) {
-                sendNewConfiguration();
-            }
+        }
+        
+        if (configChanged) {
+            mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
         }
     }