Fix calls to Rect.intersect(Rect) in package com.android.server.wm

This CL checks for the return value for Rect.intersect(Rect) for whether
there is actually an intersection before taking the calling rect as the
intersection. In addtion, this CL handles the cases where there is no
intersection (Rect.intersect(Rect) returns false).

bug: 7368679
Change-Id: I7d5ef7059ac432170470a108c0d6dece230ec0b3
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 193d812..62a8420 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -534,7 +534,9 @@
             }
             // Make sure the containing frame is within the content frame so we don't layout
             // resized window under screen decorations.
-            mContainingFrame.intersect(cf);
+            if (!mContainingFrame.intersect(cf)) {
+                mContainingFrame.set(cf);
+            }
             mDisplayFrame.set(mContainingFrame);
         } else {
             mContainingFrame.set(pf);