diff options
11 files changed, 171 insertions, 127 deletions
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 3ee9e77..180f022 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml @@ -33,39 +33,29 @@ android:clipToPadding="false" android:clipChildren="false"> - <LinearLayout android:id="@+id/recents_glow" + <com.android.systemui.recent.RecentsHorizontalScrollView android:id="@+id/recents_container" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_gravity="bottom|right" + android:layout_marginRight="@dimen/status_bar_recents_right_glow_margin" + android:divider="@null" + android:stackFromBottom="true" + android:fadingEdge="horizontal" + android:scrollbars="none" + android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:layout_gravity="bottom|left" android:orientation="horizontal" android:clipToPadding="false" - android:clipChildren="false" - > - <com.android.systemui.recent.RecentsHorizontalScrollView android:id="@+id/recents_container" + android:clipChildren="false"> + + <LinearLayout android:id="@+id/recents_linear_layout" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="@dimen/status_bar_recents_right_glow_margin" - android:divider="@null" - android:stackFromBottom="true" - android:fadingEdge="horizontal" - android:scrollbars="none" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" - android:layout_gravity="bottom|left" android:orientation="horizontal" android:clipToPadding="false" android:clipChildren="false"> + </LinearLayout> - <LinearLayout android:id="@+id/recents_linear_layout" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:orientation="horizontal" - android:clipToPadding="false" - android:clipChildren="false"> - </LinearLayout> - - </com.android.systemui.recent.RecentsHorizontalScrollView> - - </LinearLayout> + </com.android.systemui.recent.RecentsHorizontalScrollView> </FrameLayout> 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 d040544..e6a077a 100644 --- a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml @@ -31,39 +31,29 @@ android:layout_height="match_parent" android:layout_alignParentBottom="true"> - <LinearLayout android:id="@+id/recents_glow" + <com.android.systemui.recent.RecentsVerticalScrollView + android:id="@+id/recents_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:orientation="horizontal" - android:clipChildren="false" - android:layout_marginTop="@*android:dimen/status_bar_height"> + android:layout_marginRight="0dp" + android:divider="@null" + android:stackFromBottom="true" + android:fadingEdge="vertical" + android:scrollbars="none" + android:fadingEdgeLength="@*android:dimen/status_bar_height" + android:layout_gravity="bottom|left" + android:clipToPadding="false" + android:clipChildren="false"> - <com.android.systemui.recent.RecentsVerticalScrollView - android:id="@+id/recents_container" + <LinearLayout android:id="@+id/recents_linear_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginRight="0dp" - android:divider="@null" - android:stackFromBottom="true" - android:fadingEdge="vertical" - android:scrollbars="none" - android:fadingEdgeLength="@*android:dimen/status_bar_height" - android:layout_gravity="bottom|left" + android:orientation="vertical" android:clipToPadding="false" android:clipChildren="false"> + </LinearLayout> - <LinearLayout android:id="@+id/recents_linear_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:clipToPadding="false" - android:clipChildren="false"> - </LinearLayout> - - </com.android.systemui.recent.RecentsVerticalScrollView> - - </LinearLayout> + </com.android.systemui.recent.RecentsVerticalScrollView> </FrameLayout> diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_no_recent_apps.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_no_recent_apps.xml new file mode 100644 index 0000000..bc89281 --- /dev/null +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_no_recent_apps.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* apps/common/assets/default/default/skins/StatusBar.xml +** +** Copyright 2011, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="match_parent" + android:layout_width="match_parent" + > + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="20dp" + android:textColor="@android:color/holo_blue_light" + android:text="@string/status_bar_no_recent_apps" + android:gravity="left" + android:layout_gravity="bottom|left" + /> +</FrameLayout> diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml index 18a31f7..cb26db00 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml @@ -23,11 +23,26 @@ android:layout_height="wrap_content" android:layout_width="wrap_content"> - <FrameLayout android:id="@+id/app_thumbnail" - android:layout_width="wrap_content" + <TextView android:id="@+id/app_label" + android:layout_width="@dimen/status_bar_recents_app_label_width" android:layout_height="wrap_content" + android:textSize="@dimen/status_bar_recents_app_label_text_size" + android:fadingEdge="horizontal" + android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:scrollHorizontally="true" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" + android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin" + android:layout_marginTop="32dip" + android:singleLine="true" + android:ellipsize="marquee" + android:textColor="@color/status_bar_recents_app_label_color" + /> + + <FrameLayout android:id="@+id/app_thumbnail" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/app_label" android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin" android:scaleType="center" android:background="@drawable/recents_thumbnail_bg" @@ -37,33 +52,22 @@ android:layout_width="@dimen/status_bar_recents_thumbnail_width" android:layout_height="@dimen/status_bar_recents_thumbnail_height" /> - <ImageView android:id="@+id/app_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/status_bar_recents_app_icon_left_margin" - android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin" - android:maxWidth="@dimen/status_bar_recents_app_icon_max_width" - android:maxHeight="@dimen/status_bar_recents_app_icon_max_height" - android:adjustViewBounds="true" - /> </FrameLayout> - <TextView android:id="@+id/app_label" - android:layout_width="@dimen/status_bar_recents_app_label_width" + + <ImageView android:id="@+id/app_icon" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="@dimen/status_bar_recents_app_label_text_size" - android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" - android:scrollHorizontally="true" - android:layout_alignParentLeft="true" - android:layout_alignParentTop="true" - android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin" - android:layout_marginTop="32dip" - android:singleLine="true" - android:ellipsize="marquee" - android:textColor="@color/status_bar_recents_app_label_color" + android:layout_toRightOf="@id/app_label" + android:layout_marginLeft="@dimen/status_bar_recents_app_icon_left_margin" + android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin" + android:maxWidth="@dimen/status_bar_recents_app_icon_max_width" + android:maxHeight="@dimen/status_bar_recents_app_icon_max_height" + android:scaleType="centerInside" + android:adjustViewBounds="true" /> + <View android:id="@+id/recents_callout_line" android:layout_width="@dimen/status_bar_recents_app_label_width" android:layout_height="1dip" diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel.xml index 5dd101e..111f9a4 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel.xml @@ -36,40 +36,36 @@ android:clipToPadding="false" android:clipChildren="false"> - <LinearLayout android:id="@+id/recents_glow" + <com.android.systemui.recent.RecentsVerticalScrollView android:id="@+id/recents_container" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="-49dip" - android:layout_gravity="bottom" - android:background="@drawable/recents_blue_glow" - android:orientation="horizontal" + android:layout_marginRight="@dimen/status_bar_recents_right_glow_margin" + android:divider="@null" + android:stackFromBottom="true" + android:fadingEdge="vertical" + android:scrollbars="none" + android:fadingEdgeLength="20dip" + android:layout_gravity="bottom|left" android:clipToPadding="false" - android:clipChildren="false" - > - <com.android.systemui.recent.RecentsVerticalScrollView android:id="@+id/recents_container" + android:clipChildren="false"> + + <LinearLayout android:id="@+id/recents_linear_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginRight="@dimen/status_bar_recents_right_glow_margin" - android:divider="@null" - android:stackFromBottom="true" - android:fadingEdge="vertical" - android:scrollbars="none" - android:fadingEdgeLength="20dip" - android:layout_gravity="bottom|left" + android:orientation="vertical" android:clipToPadding="false" android:clipChildren="false"> + </LinearLayout> - <LinearLayout android:id="@+id/recents_linear_layout" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - android:clipToPadding="false" - android:clipChildren="false"> - </LinearLayout> - - </com.android.systemui.recent.RecentsVerticalScrollView> + </com.android.systemui.recent.RecentsVerticalScrollView> - </LinearLayout> + <include layout="@layout/status_bar_no_recent_apps" + android:id="@+id/recents_no_apps" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginLeft="58dip" + android:layout_marginBottom="36dip" + android:visibility="invisible" /> </FrameLayout> @@ -82,4 +78,5 @@ android:contentDescription="@string/status_bar_accessibility_dismiss_recents" /> + </com.android.systemui.recent.RecentsPanelView> diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml index 3e2ec59..24185a4 100644 --- a/packages/SystemUI/res/values-sw600dp/config.xml +++ b/packages/SystemUI/res/values-sw600dp/config.xml @@ -18,8 +18,11 @@ --> <resources> - <!-- Whether we're using the tablet-optimized recents interface (we use this value at runtime for some things) --> <bool name="config_recents_interface_for_tablets">true</bool> + + <!-- Whether recents thumbnails should stretch in both x and y to fill their + ImageView --> + <bool name="config_recents_thumbnail_image_fits_to_xy">true</bool> </resources> diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index fe9245d..f522285 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -31,15 +31,15 @@ <!-- Recent Applications parameters --> <!-- How far the thumbnail for a recent app appears from left edge --> - <dimen name="status_bar_recents_thumbnail_left_margin">121dp</dimen> + <dimen name="status_bar_recents_thumbnail_left_margin">28dp</dimen> <!-- Upper width limit for application icon --> <dimen name="status_bar_recents_app_icon_max_width">64dp</dimen> <!-- Upper height limit for application icon --> <dimen name="status_bar_recents_app_icon_max_height">64dp</dimen> <!-- Size of application icon --> - <dimen name="status_bar_recents_thumbnail_width">245dp</dimen> - <dimen name="status_bar_recents_thumbnail_height">144dp</dimen> + <dimen name="status_bar_recents_thumbnail_width">208dp</dimen> + <dimen name="status_bar_recents_thumbnail_height">130dp</dimen> <!-- Width of recents panel --> <dimen name="status_bar_recents_width">600dp</dimen> @@ -59,8 +59,8 @@ <dimen name="status_bar_recents_right_glow_margin">100dip</dimen> <!-- Where to place the app icon over the thumbnail --> - <dimen name="status_bar_recents_app_icon_left_margin">13dp</dimen> - <dimen name="status_bar_recents_app_icon_top_margin">13dp</dimen> + <dimen name="status_bar_recents_app_icon_left_margin">0dp</dimen> + <dimen name="status_bar_recents_app_icon_top_margin">8dp</dimen> <!-- size at which Notification icons will be drawn in the status bar --> <dimen name="status_bar_icon_drawing_size">24dip</dimen> diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 1fe4ebb..1f22507 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -25,6 +25,10 @@ value at runtime for some things) --> <bool name="config_recents_interface_for_tablets">false</bool> + <!-- Whether recents thumbnails should stretch in both x and y to fill their + ImageView --> + <bool name="config_recents_thumbnail_image_fits_to_xy">false</bool> + <!-- Control whether status bar should distinguish HSPA data icon form UMTS data icon on devices --> <bool name="config_hspa_data_distinguishable">false</bool> diff --git a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java index 886a14d..ad38a11 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java +++ b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java @@ -120,8 +120,13 @@ import android.view.View; createAnimation(appearing); - mContentView.setLayerType(View.LAYER_TYPE_HARDWARE, null); - mContentView.buildLayer(); + // isHardwareAccelerated() checks if we're attached to a window and if that + // window is HW accelerated-- we were sometimes not attached to a window + // and buildLayer was throwing an IllegalStateException + if (mContentView.isHardwareAccelerated()) { + mContentView.setLayerType(View.LAYER_TYPE_HARDWARE, null); + mContentView.buildLayer(); + } mContentAnim.start(); mVisible = appearing; diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index 6b8b65e..8bfd711 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -16,14 +16,13 @@ package com.android.systemui.recent; -import java.util.ArrayList; - import android.animation.Animator; import android.animation.LayoutTransition; import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; +import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.Shader.TileMode; @@ -42,15 +41,15 @@ import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AnimationUtils; import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.HorizontalScrollView; import android.widget.ImageView; +import android.widget.ImageView.ScaleType; import android.widget.PopupMenu; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.ImageView.ScaleType; import com.android.systemui.R; import com.android.systemui.statusbar.StatusBar; @@ -58,6 +57,8 @@ import com.android.systemui.statusbar.phone.PhoneStatusBar; import com.android.systemui.statusbar.tablet.StatusBarPanel; import com.android.systemui.statusbar.tablet.TabletStatusBar; +import java.util.ArrayList; + public class RecentsPanelView extends RelativeLayout implements OnItemClickListener, RecentsCallback, StatusBarPanel, Animator.AnimatorListener, View.OnTouchListener { static final String TAG = "RecentsPanelView"; @@ -65,7 +66,6 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe private Context mContext; private StatusBar mBar; private View mRecentsScrim; - private View mRecentsGlowView; private View mRecentsNoApps; private ViewGroup mRecentsContainer; @@ -79,6 +79,7 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe private boolean mRecentTasksDirty = true; private TaskDescriptionAdapter mListAdapter; private int mThumbnailWidth; + private boolean mFitThumbnailToXY; public void setRecentTasksLoader(RecentTasksLoader loader) { mRecentTasksLoader = loader; @@ -174,9 +175,8 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe // use mRecentsContainer's exact bounds to determine horizontal position final int l = mRecentsContainer.getLeft(); final int r = mRecentsContainer.getRight(); - // use surrounding mRecentsGlowView's position in parent determine vertical bounds - final int t = mRecentsGlowView.getTop(); - final int b = mRecentsGlowView.getBottom(); + final int t = mRecentsContainer.getTop(); + final int b = mRecentsContainer.getBottom(); return x >= l && x < r && y >= t && y < b; } @@ -194,7 +194,7 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe // if there are no apps, either bring up a "No recent apps" message, or just // quit early boolean noApps = (mRecentTaskDescriptions.size() == 0); - if (mRecentsNoApps != null) { // doesn't exist on large devices + if (mRecentsNoApps != null) { mRecentsNoApps.setVisibility(noApps ? View.VISIBLE : View.INVISIBLE); } else { if (noApps) { @@ -325,8 +325,9 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe } public void updateValuesFromResources() { - mThumbnailWidth = - (int) mContext.getResources().getDimension(R.dimen.status_bar_recents_thumbnail_width); + final Resources res = mContext.getResources(); + mThumbnailWidth = Math.round(res.getDimension(R.dimen.status_bar_recents_thumbnail_width)); + mFitThumbnailToXY = res.getBoolean(R.bool.config_recents_thumbnail_image_fits_to_xy); } @Override @@ -351,10 +352,9 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe } - mRecentsGlowView = findViewById(R.id.recents_glow); mRecentsScrim = findViewById(R.id.recents_bg_protect); mRecentsNoApps = findViewById(R.id.recents_no_apps); - mChoreo = new Choreographer(this, mRecentsScrim, mRecentsGlowView, mRecentsNoApps, this); + mChoreo = new Choreographer(this, mRecentsScrim, mRecentsContainer, mRecentsNoApps, this); mRecentsDismissButton = findViewById(R.id.recents_dismiss_button); if (mRecentsDismissButton != null) { mRecentsDismissButton.setOnClickListener(new OnClickListener() { @@ -409,11 +409,15 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe if (h.thumbnailViewImageBitmap == null || h.thumbnailViewImageBitmap.getWidth() != thumbnail.getWidth() || h.thumbnailViewImageBitmap.getHeight() != thumbnail.getHeight()) { - Matrix scaleMatrix = new Matrix(); - float scale = mThumbnailWidth / (float) thumbnail.getWidth(); - scaleMatrix.setScale(scale, scale); - h.thumbnailViewImage.setScaleType(ScaleType.MATRIX); - h.thumbnailViewImage.setImageMatrix(scaleMatrix); + if (mFitThumbnailToXY) { + h.thumbnailViewImage.setScaleType(ScaleType.FIT_XY); + } else { + Matrix scaleMatrix = new Matrix(); + float scale = mThumbnailWidth / (float) thumbnail.getWidth(); + scaleMatrix.setScale(scale, scale); + h.thumbnailViewImage.setScaleType(ScaleType.MATRIX); + h.thumbnailViewImage.setImageMatrix(scaleMatrix); + } } if (show && h.thumbnailView.getVisibility() != View.VISIBLE) { if (anim) { @@ -444,7 +448,7 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe // only fade in the thumbnail if recents is already visible-- we // show it immediately otherwise boolean animateShow = mShowing && - mRecentsGlowView.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD; + mRecentsContainer.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD; updateThumbnail(h, ad.getThumbnail(), true, animateShow); } } @@ -516,7 +520,6 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe final int items = mRecentTaskDescriptions.size(); mRecentsContainer.setVisibility(items > 0 ? View.VISIBLE : View.GONE); - mRecentsGlowView.setVisibility(items > 0 ? View.VISIBLE : View.GONE); // Set description for accessibility int numRecentApps = mRecentTaskDescriptions.size(); diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 50321b3..ebb13d5 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -5090,10 +5090,22 @@ public class WindowManagerService extends IWindowManager.Stub // Constrain thumbnail to smaller of screen width or height. Assumes aspect // of thumbnail is the same as the screen (in landscape) or square. + float targetWidthScale = width / (float) fw; + float targetHeightScale = height / (float) fh; if (dw <= dh) { - scale = width / (float) fw; // portrait + scale = targetWidthScale; + // If aspect of thumbnail is the same as the screen (in landscape), + // select the slightly larger value so we fill the entire bitmap + if (targetHeightScale > scale && (int) (targetHeightScale * fw) == width) { + scale = targetHeightScale; + } } else { - scale = height / (float) fh; // landscape + scale = targetHeightScale; + // If aspect of thumbnail is the same as the screen (in landscape), + // select the slightly larger value so we fill the entire bitmap + if (targetWidthScale > scale && (int) (targetWidthScale * fh) == height) { + scale = targetWidthScale; + } } // The screen shot will contain the entire screen. |