Fix 4689527: Update Recents

Fixed layout in landscape mode where recents only filled half the screen
because "match_parent" in the layout was being ignored. The fix is to
have a temporary ViewGroup as the parent to ensure the layout parameters
are valid.

Changed to solid 70% opaque background on phone.

Removed "dismiss" chevron from phone layout.

Removes glow on phones.

Change-Id: Id5319eeba4fdd8c9ef5792168b35162cc1bbfe38
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
index 4a80489..efdd9ac 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
@@ -22,11 +22,11 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/recents_root"
     android:layout_height="match_parent"
-    android:layout_width="wrap_content">
+    android:layout_width="match_parent">
 
     <FrameLayout
         android:id="@+id/recents_bg_protect"
-        android:background="@drawable/recents_bg_protect_tile"
+        android:background="@drawable/status_bar_recents_background"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_alignParentBottom="true"
@@ -38,7 +38,6 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="bottom|right"
-            android:background="@drawable/recents_blue_glow"
             android:orientation="horizontal"
             android:clipToPadding="false"
             android:clipChildren="false"
@@ -78,6 +77,7 @@
         android:layout_alignParentBottom="true"
         android:layout_alignParentLeft="true"
         android:background="@drawable/ic_sysbar_back_ime"
+        android:visibility="gone"
     />
 
 </com.android.systemui.recent.RecentsPanelView>
diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
index 9391f9d..386182d 100644
--- a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
@@ -26,7 +26,7 @@
 
     <FrameLayout
         android:id="@+id/recents_bg_protect"
-        android:background="@drawable/recents_bg_protect_tile"
+        android:background="@drawable/status_bar_recents_background"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_alignParentBottom="true"
@@ -39,7 +39,6 @@
             android:layout_height="wrap_content"
             android:layout_marginBottom="0dp"
             android:layout_gravity="bottom"
-            android:background="@drawable/recents_blue_glow"
             android:orientation="horizontal"
             android:clipToPadding="false"
             android:clipChildren="false"
@@ -79,6 +78,7 @@
         android:layout_alignParentBottom="true"
         android:layout_alignParentLeft="true"
         android:background="@drawable/ic_sysbar_back_ime"
+        android:visibility="gone"
     />
 
 </com.android.systemui.recent.RecentsPanelView>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 9341693..fd5fe7a 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -21,4 +21,5 @@
     <drawable name="notification_item_background_color">#ff000000</drawable>
     <drawable name="ticker_background_color">#ff1d1d1d</drawable>
     <drawable name="status_bar_background">#000000</drawable>
+    <drawable name="status_bar_recents_background">#b3000000</drawable>
 </resources>
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
index 49a65d8..37a9913 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
@@ -18,7 +18,9 @@
 
 import android.animation.Animator;
 import android.animation.AnimatorSet;
+import android.animation.AnimatorSet.Builder;
 import android.animation.ObjectAnimator;
+import android.graphics.drawable.Drawable;
 import android.util.Log;
 import android.util.Slog;
 import android.view.View;
@@ -78,14 +80,14 @@
                 ? new android.view.animation.AccelerateInterpolator(1.0f)
                 : new android.view.animation.DecelerateInterpolator(1.0f));
 
-        Animator bgAnim = ObjectAnimator.ofInt(mScrimView.getBackground(),
-                "alpha", appearing ? 0 : 255, appearing ? 255 : 0);
-
         mContentAnim = new AnimatorSet();
-        mContentAnim
-                .play(bgAnim)
-                .with(glowAnim)
-                .with(posAnim);
+        final Builder builder = mContentAnim.play(glowAnim).with(posAnim);
+        Drawable background = mScrimView.getBackground();
+        if (background != null) {
+            Animator bgAnim = ObjectAnimator.ofInt(background,
+                "alpha", appearing ? 0 : 255, appearing ? 255 : 0);
+            builder.with(bgAnim);
+        }
         mContentAnim.setDuration(appearing ? OPEN_DURATION : CLOSE_DURATION);
         mContentAnim.addListener(this);
         if (mListener != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 4c7b0dd..5eacad7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -53,6 +53,7 @@
 import android.view.VelocityTracker;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
 import android.view.Window;
 import android.view.WindowManager;
 import android.view.WindowManagerImpl;
@@ -318,11 +319,11 @@
         return sb;
     }
 
-    protected WindowManager.LayoutParams getRecentsLayoutParams() {
+    protected WindowManager.LayoutParams getRecentsLayoutParams(LayoutParams layoutParams) {
         boolean translucent = false;
         WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
-                ViewGroup.LayoutParams.WRAP_CONTENT,
-                ViewGroup.LayoutParams.WRAP_CONTENT,
+                layoutParams.width,
+                layoutParams.height,
                 WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
                 WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                 | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
@@ -344,13 +345,16 @@
             visible = mRecentsPanel.getVisibility() == View.VISIBLE;
             WindowManagerImpl.getDefault().removeView(mRecentsPanel);
         }
-        mRecentsPanel = (RecentsPanelView) View.inflate(mContext,
-                R.layout.status_bar_recent_panel, null);
+
+        // Provide RecentsPanelView with a temporary parent to allow layout params to work.
+        LinearLayout tmpRoot = new LinearLayout(mContext);
+        mRecentsPanel = (RecentsPanelView) LayoutInflater.from(mContext).inflate(
+                R.layout.status_bar_recent_panel, tmpRoot, false);
 
         mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL,
                 mRecentsPanel));
         mRecentsPanel.setVisibility(View.GONE);
-        WindowManager.LayoutParams lp = getRecentsLayoutParams();
+        WindowManager.LayoutParams lp = getRecentsLayoutParams(mRecentsPanel.getLayoutParams());
 
         WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
         mRecentsPanel.setBar(this);