Fixed issue with losing window name when copying WindowManager.LayoutParams

It is possible for the WindowManager.LayoutParams set from a view/window on
the client side not to have the LayoutParams.mTitle set. This is normally
not an issue as we later set it to the package name before passing the
LayoutParams to window manager. However, we rely on the full window name
in order to identify unique windows during CTS hostside tests. We now
retain the current LayoutParams.mTitle if the LayoutParams we are copying
form didn't set one.

Bug: 26982752
Change-Id: Icc3c5937391ed1646c3777921c6f61c27ebec05d
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 0c5a5fc..18dfdfd 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1724,7 +1724,7 @@
         }
 
         public final CharSequence getTitle() {
-            return mTitle;
+            return mTitle != null ? mTitle : "";
         }
 
         /** @hide */
@@ -1950,7 +1950,8 @@
                 // already have one.
                 packageName = o.packageName;
             }
-            if (!mTitle.equals(o.mTitle)) {
+            if (o.mTitle != null) {
+                // NOTE: mTitle only copied if the originator set one.
                 mTitle = o.mTitle;
                 changes |= TITLE_CHANGED;
             }
@@ -2194,7 +2195,7 @@
             }
         }
 
-        private CharSequence mTitle = "";
+        private CharSequence mTitle = null;
 
         /** @hide */
         @Override