diff options
26 files changed, 229 insertions, 62 deletions
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index cea68d2..2f5b4fe 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -822,8 +822,8 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * @see #REQUEST_AVAILABLE_CAPABILITIES_ZSL * @see #REQUEST_AVAILABLE_CAPABILITIES_DNG */ - public static final Key<Integer> REQUEST_AVAILABLE_CAPABILITIES = - new Key<Integer>("android.request.availableCapabilities", int.class); + public static final Key<int[]> REQUEST_AVAILABLE_CAPABILITIES = + new Key<int[]>("android.request.availableCapabilities", int[].class); /** * <p>A list of all keys that the camera device has available diff --git a/core/jni/android/graphics/FontFamily.cpp b/core/jni/android/graphics/FontFamily.cpp index 041790f..3bab8a2 100644 --- a/core/jni/android/graphics/FontFamily.cpp +++ b/core/jni/android/graphics/FontFamily.cpp @@ -31,9 +31,14 @@ namespace android { -static jlong FontFamily_create(JNIEnv* env, jobject clazz) { +static jlong FontFamily_create(JNIEnv* env, jobject clazz, jstring lang, jint variant) { #ifdef USE_MINIKIN - return (jlong)new FontFamily(); + FontLanguage fontLanguage; + if (lang != NULL) { + ScopedUtfChars str(env, lang); + fontLanguage = FontLanguage(str.c_str(), str.size()); + } + return (jlong)new FontFamily(fontLanguage, variant); #else return 0; #endif @@ -67,7 +72,7 @@ static jboolean FontFamily_addFont(JNIEnv* env, jobject clazz, jlong familyPtr, /////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gFontFamilyMethods[] = { - { "nCreateFamily", "()J", (void*)FontFamily_create }, + { "nCreateFamily", "(Ljava/lang/String;I)J", (void*)FontFamily_create }, { "nUnrefFamily", "(J)V", (void*)FontFamily_unref }, { "nAddFont", "(JLjava/lang/String;)Z", (void*)FontFamily_addFont }, }; diff --git a/core/jni/android/graphics/MinikinUtils.cpp b/core/jni/android/graphics/MinikinUtils.cpp index ee04d6f..79381ad 100644 --- a/core/jni/android/graphics/MinikinUtils.cpp +++ b/core/jni/android/graphics/MinikinUtils.cpp @@ -28,11 +28,17 @@ void MinikinUtils::SetLayoutProperties(Layout* layout, SkPaint* paint, int flags layout->setFontCollection(resolvedFace->fFontCollection); FontStyle style = resolvedFace->fStyle; char css[256]; - sprintf(css, "font-size: %d; font-weight: %d; font-style: %s; -minikin-bidi: %d", + int off = snprintf(css, sizeof(css), + "font-size: %d; font-weight: %d; font-style: %s; -minikin-bidi: %d;", (int)paint->getTextSize(), style.getWeight() * 100, style.getItalic() ? "italic" : "normal", flags); + SkString langString = paint->getPaintOptionsAndroid().getLanguage().getTag(); + off += snprintf(css + off, sizeof(css) - off, " lang: %s;", langString.c_str()); + SkPaintOptionsAndroid::FontVariant var = paint->getPaintOptionsAndroid().getFontVariant(); + const char* varstr = var == SkPaintOptionsAndroid::kElegant_Variant ? "elegant" : "compact"; + off += snprintf(css + off, sizeof(css) - off, " -minikin-variant: %s;", varstr); layout->setProperties(css); } diff --git a/graphics/java/android/graphics/FontFamily.java b/graphics/java/android/graphics/FontFamily.java index 210ea86b..6802b9a 100644 --- a/graphics/java/android/graphics/FontFamily.java +++ b/graphics/java/android/graphics/FontFamily.java @@ -30,9 +30,22 @@ public class FontFamily { public long mNativePtr; public FontFamily() { - mNativePtr = nCreateFamily(); + mNativePtr = nCreateFamily(null, 0); if (mNativePtr == 0) { - throw new RuntimeException(); + throw new IllegalStateException("error creating native FontFamily"); + } + } + + public FontFamily(String lang, String variant) { + int varEnum = 0; + if ("compact".equals(variant)) { + varEnum = 1; + } else if ("elegant".equals(variant)) { + varEnum = 2; + } + mNativePtr = nCreateFamily(lang, varEnum); + if (mNativePtr == 0) { + throw new IllegalStateException("error creating native FontFamily"); } } @@ -49,7 +62,7 @@ public class FontFamily { return nAddFont(mNativePtr, path.getAbsolutePath()); } - static native long nCreateFamily(); + static native long nCreateFamily(String lang, int variant); static native void nUnrefFamily(long nativePtr); static native boolean nAddFont(long nativeFamily, String path); } diff --git a/graphics/java/android/graphics/FontListParser.java b/graphics/java/android/graphics/FontListParser.java index f304f4e..a863a06 100644 --- a/graphics/java/android/graphics/FontListParser.java +++ b/graphics/java/android/graphics/FontListParser.java @@ -34,14 +34,18 @@ import java.util.List; public class FontListParser { public static class Family { - public Family(List<String> names, List<String> fontFiles) { + public Family(List<String> names, List<String> fontFiles, String lang, String variant) { this.names = names; this.fontFiles = fontFiles; + this.lang = lang; + this.variant = variant; } public List<String> names; // todo: need attributes for font files public List<String> fontFiles; + public String lang; + public String variant; } /* Parse fallback list (no names) */ @@ -75,6 +79,8 @@ public class FontListParser { throws XmlPullParserException, IOException { List<String> names = null; List<String> fontFiles = new ArrayList<String>(); + String lang = null; + String variant = null; while (parser.next() != XmlPullParser.END_TAG) { if (parser.getEventType() != XmlPullParser.START_TAG) continue; String tag = parser.getName(); @@ -82,6 +88,12 @@ public class FontListParser { while (parser.next() != XmlPullParser.END_TAG) { if (parser.getEventType() != XmlPullParser.START_TAG) continue; if (parser.getName().equals("file")) { + if (lang == null) { + lang = parser.getAttributeValue(null, "lang"); + } + if (variant == null) { + variant = parser.getAttributeValue(null, "variant"); + } String filename = parser.nextText(); String fullFilename = "/system/fonts/" + filename; fontFiles.add(fullFilename); @@ -98,7 +110,7 @@ public class FontListParser { } } } - return new Family(names, fontFiles); + return new Family(names, fontFiles, lang, variant); } private static void skip(XmlPullParser parser) throws XmlPullParserException, IOException { diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index b7613fb..2b07c3f 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -245,7 +245,7 @@ public class Typeface { private static FontFamily makeFamilyFromParsed(FontListParser.Family family) { // TODO: expand to handle attributes like lang and variant - FontFamily fontFamily = new FontFamily(); + FontFamily fontFamily = new FontFamily(family.lang, family.variant); for (String fontFile : family.fontFiles) { fontFamily.addFont(new File(fontFile)); } diff --git a/packages/SystemUI/res/drawable/ic_qs_close.xml b/packages/SystemUI/res/drawable/ic_qs_back.xml index dd43e6c..52039f5 100644 --- a/packages/SystemUI/res/drawable/ic_qs_close.xml +++ b/packages/SystemUI/res/drawable/ic_qs_back.xml @@ -24,5 +24,5 @@ Copyright (C) 2014 The Android Open Source Project <path android:fill="#FFFFFFFF" - android:pathData="M19.0,6.4l-1.3999996,-1.4000001 -5.6000004,5.6000004 -5.6,-5.6000004 -1.4000001,1.4000001 5.6000004,5.6 -5.6000004,5.6000004 1.4000001,1.3999996 5.6,-5.6000004 5.6000004,5.6000004 1.3999996,-1.3999996 -5.6000004,-5.6000004z"/> + android:pathData="M20.0,11.0L7.8,11.0l5.6,-5.6L12.0,4.0l-8.0,8.0l8.0,8.0l1.4,-1.4L7.8,13.0L20.0,13.0L20.0,11.0z"/> </vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_zen_off.xml b/packages/SystemUI/res/drawable/ic_qs_zen_off.xml index 73886ec..88a2c3a 100644 --- a/packages/SystemUI/res/drawable/ic_qs_zen_off.xml +++ b/packages/SystemUI/res/drawable/ic_qs_zen_off.xml @@ -23,8 +23,6 @@ Copyright (C) 2014 The Android Open Source Project android:viewportHeight="24.0"/> <path - android:fill="#00000000" - android:stroke="#CCCCCC" - android:strokeWidth="1.0" - android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z" /> + android:fill="#4DFFFFFF" + android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z"/> </vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_zen_on.xml b/packages/SystemUI/res/drawable/ic_qs_zen_on.xml index 8dff318..0e933cf 100644 --- a/packages/SystemUI/res/drawable/ic_qs_zen_on.xml +++ b/packages/SystemUI/res/drawable/ic_qs_zen_on.xml @@ -24,5 +24,5 @@ Copyright (C) 2014 The Android Open Source Project <path android:fill="#FFFFFFFF" - android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z" /> + android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z"/> </vector> diff --git a/packages/SystemUI/res/drawable/ic_vol_zen_off.xml b/packages/SystemUI/res/drawable/ic_vol_zen_off.xml index ea5ab70..51be1a8 100644 --- a/packages/SystemUI/res/drawable/ic_vol_zen_off.xml +++ b/packages/SystemUI/res/drawable/ic_vol_zen_off.xml @@ -23,8 +23,6 @@ Copyright (C) 2014 The Android Open Source Project android:viewportHeight="24.0"/> <path - android:fill="#00000000" - android:stroke="#CCCCCC" - android:strokeWidth="1.0" - android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z" /> + android:fill="#4DFFFFFF" + android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z"/> </vector> diff --git a/packages/SystemUI/res/drawable/ic_vol_zen_on.xml b/packages/SystemUI/res/drawable/ic_vol_zen_on.xml index 44024f3..c8c217d 100644 --- a/packages/SystemUI/res/drawable/ic_vol_zen_on.xml +++ b/packages/SystemUI/res/drawable/ic_vol_zen_on.xml @@ -24,5 +24,5 @@ Copyright (C) 2014 The Android Open Source Project <path android:fill="#FFFFFFFF" - android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z" /> + android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z"/> </vector> diff --git a/packages/SystemUI/res/drawable/stat_sys_ringer_zen.xml b/packages/SystemUI/res/drawable/stat_sys_ringer_zen.xml index afab88f..8b104d1 100644 --- a/packages/SystemUI/res/drawable/stat_sys_ringer_zen.xml +++ b/packages/SystemUI/res/drawable/stat_sys_ringer_zen.xml @@ -24,5 +24,5 @@ Copyright (C) 2014 The Android Open Source Project <path android:fill="#FFFFFFFF" - android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z" /> + android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM4.0,12.0c0.0,-4.4 3.6,-8.0 8.0,-8.0c1.8,0.0 3.5,0.6 4.9,1.7L5.7,16.9C4.6,15.5 4.0,13.8 4.0,12.0zM12.0,20.0c-1.8,0.0 -3.5,-0.6 -4.9,-1.7L18.3,7.1C19.4,8.5 20.0,10.2 20.0,12.0C20.0,16.4 16.4,20.0 12.0,20.0z"/> </vector> diff --git a/packages/SystemUI/res/layout/qs_detail.xml b/packages/SystemUI/res/layout/qs_detail.xml index e73b431..e1c460c 100644 --- a/packages/SystemUI/res/layout/qs_detail.xml +++ b/packages/SystemUI/res/layout/qs_detail.xml @@ -26,7 +26,7 @@ android:layout_alignParentStart="true" android:contentDescription="@string/accessibility_quick_settings_close" android:padding="@dimen/qs_panel_padding" - android:src="@drawable/ic_qs_close" /> + android:src="@drawable/ic_qs_back" /> <TextView android:id="@android:id/title" diff --git a/packages/SystemUI/res/layout/zen_mode_condition.xml b/packages/SystemUI/res/layout/zen_mode_condition.xml index 8b34400..6d63bb0 100644 --- a/packages/SystemUI/res/layout/zen_mode_condition.xml +++ b/packages/SystemUI/res/layout/zen_mode_condition.xml @@ -16,11 +16,14 @@ --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/zen_mode_condition_detail_button_padding" + android:layout_marginRight="@dimen/zen_mode_condition_detail_button_padding" > <RadioButton android:id="@android:id/checkbox" - android:layout_width="32dp" + android:layout_width="40dp" + android:layout_marginStart="2dp" android:layout_height="@dimen/zen_mode_condition_height" android:layout_alignParentStart="true" android:gravity="center" /> diff --git a/packages/SystemUI/res/layout/zen_mode_panel.xml b/packages/SystemUI/res/layout/zen_mode_panel.xml index 0936cc2..0a8f852 100644 --- a/packages/SystemUI/res/layout/zen_mode_panel.xml +++ b/packages/SystemUI/res/layout/zen_mode_panel.xml @@ -21,9 +21,7 @@ android:layout_height="wrap_content" android:background="@color/system_primary_color" android:orientation="vertical" - android:paddingTop="@dimen/qs_panel_padding" - android:paddingLeft="@dimen/qs_panel_padding" - android:paddingRight="@dimen/qs_panel_padding" > + android:paddingTop="@dimen/qs_panel_padding" > <TextView android:id="@android:id/title" @@ -31,8 +29,10 @@ android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_marginBottom="8dp" + android:layout_marginStart="@dimen/qs_panel_padding" + android:layout_marginEnd="@dimen/qs_panel_padding" android:text="@string/zen_mode_title" - android:textAppearance="@style/TextAppearance.QS.DetailHeader" /> + android:textAppearance="@style/TextAppearance.QS.DetailItemPrimary" /> <LinearLayout android:id="@android:id/content" @@ -46,6 +46,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" + android:layout_marginEnd="4dp" android:layout_gravity="end" android:text="@string/quick_settings_more_settings" android:textAppearance="@style/TextAppearance.QS.DetailButton" /> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index c542b7c..4aacd4a 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -196,6 +196,9 @@ <dimen name="qs_dual_tile_height">109dp</dimen> <dimen name="qs_dual_tile_padding">12dp</dimen> + <!-- How far the hidden header peeks from the top of the screen when QS is in detail mode. --> + <dimen name="qs_header_peek_height">8dp</dimen> + <!-- How far the expanded QS panel peeks from the header in collapsed state. --> <dimen name="qs_peek_height">8dp</dimen> @@ -221,10 +224,13 @@ <dimen name="recents_task_view_rounded_corners_radius">2dp</dimen> <!-- The min translation in the Z index for the last task. --> - <dimen name="recents_task_view_z_min">3dp</dimen> + <dimen name="recents_task_view_z_min">5dp</dimen> <!-- The translation in the Z index for each task above the last task. --> - <dimen name="recents_task_view_z_increment">5dp</dimen> + <dimen name="recents_task_view_z_increment">10dp</dimen> + + <!-- The amount of bottom inset in the shadow outline. --> + <dimen name="recents_task_view_shadow_outline_bottom_inset">5dp</dimen> <!-- The amount to translate when animating the removal of a task. --> <dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 626fc0d..6ce0e48 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -47,8 +47,10 @@ public class QSPanel extends ViewGroup { private int mCellHeight; private int mLargeCellWidth; private int mLargeCellHeight; + private boolean mExpanded; private TileRecord mDetailRecord; + private Callback mCallback; public QSPanel(Context context) { this(context, null); @@ -66,6 +68,10 @@ public class QSPanel extends ViewGroup { updateResources(); } + public void setCallback(Callback callback) { + mCallback = callback; + } + public void updateResources() { final Resources res = mContext.getResources(); final int columns = Math.max(1, res.getInteger(R.integer.quick_settings_num_columns)); @@ -84,12 +90,14 @@ public class QSPanel extends ViewGroup { } public void setExpanded(boolean expanded) { - if (!expanded) { + if (mExpanded == expanded) return; + mExpanded = expanded; + if (!mExpanded) { showDetail(false /*show*/, mDetailRecord); } for (TileRecord r : mRecords) { - r.tile.setListening(expanded); - if (expanded) { + r.tile.setListening(mExpanded); + if (mExpanded) { r.tile.refreshState(); } } @@ -156,6 +164,7 @@ public class QSPanel extends ViewGroup { if (mDetailRecord == null) return; listener = mTeardownDetailWhenDone; } + fireShowingDetail(show); int x = r.tileView.getLeft() + r.tileView.getWidth() / 2; int y = r.tileView.getTop() + r.tileView.getHeight() / 2; mClipper.animateCircularClip(x, y, show, listener); @@ -239,6 +248,12 @@ public class QSPanel extends ViewGroup { return cols; } + private void fireShowingDetail(boolean showingDetail) { + if (mCallback != null) { + mCallback.onShowingDetail(showingDetail); + } + } + private class H extends Handler { private static final int SHOW_DETAIL = 1; private static final int SET_TILE_VISIBILITY = 2; @@ -265,4 +280,8 @@ public class QSPanel extends ViewGroup { mDetailRecord = null; }; }; + + public interface Callback { + void onShowingDetail(boolean showingDetail); + } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java index 2dc97e0..ca9bb94 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java @@ -63,12 +63,15 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta Bundle replyData = msg.getData().getParcelable(KEY_CONFIGURATION_DATA); mSingleCountFirstTaskRect = replyData.getParcelable(KEY_SINGLE_TASK_STACK_RECT); mSingleCountFirstTaskRect.offset(0, (int) statusBarHeight); + mTwoCountFirstTaskRect = replyData.getParcelable(KEY_TWO_TASK_STACK_RECT); + mTwoCountFirstTaskRect.offset(0, (int) statusBarHeight); mMultipleCountFirstTaskRect = replyData.getParcelable(KEY_MULTIPLE_TASK_STACK_RECT); mMultipleCountFirstTaskRect.offset(0, (int) statusBarHeight); if (Console.Enabled) { Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|RecentsMessageHandler|handleMessage]", "singleTaskRect: " + mSingleCountFirstTaskRect + + " twoTaskRect: " + mTwoCountFirstTaskRect + " multipleTaskRect: " + mMultipleCountFirstTaskRect); } @@ -132,6 +135,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta final public static String KEY_WINDOW_RECT = "recents.windowRect"; final public static String KEY_SYSTEM_INSETS = "recents.systemInsets"; final public static String KEY_SINGLE_TASK_STACK_RECT = "recents.singleCountTaskRect"; + final public static String KEY_TWO_TASK_STACK_RECT = "recents.twoCountTaskRect"; final public static String KEY_MULTIPLE_TASK_STACK_RECT = "recents.multipleCountTaskRect"; @@ -157,6 +161,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta boolean mTriggeredFromAltTab; Rect mSingleCountFirstTaskRect = new Rect(); + Rect mTwoCountFirstTaskRect = new Rect(); Rect mMultipleCountFirstTaskRect = new Rect(); long mLastToggleTime; @@ -263,8 +268,10 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta /** Returns whether we have valid task rects to animate to. */ boolean hasValidTaskRects() { return mSingleCountFirstTaskRect != null && mSingleCountFirstTaskRect.width() > 0 && - mSingleCountFirstTaskRect.height() > 0 && mMultipleCountFirstTaskRect != null && - mMultipleCountFirstTaskRect.width() > 0 && mMultipleCountFirstTaskRect.height() > 0; + mSingleCountFirstTaskRect.height() > 0 && mTwoCountFirstTaskRect != null && + mTwoCountFirstTaskRect.width() > 0 && mTwoCountFirstTaskRect.height() > 0 && + mMultipleCountFirstTaskRect != null && mMultipleCountFirstTaskRect.width() > 0 && + mMultipleCountFirstTaskRect.height() > 0; } /** Updates each of the task animation rects. */ @@ -305,8 +312,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta return null; } - /** Returns whether there is are multiple recents tasks */ - boolean hasMultipleRecentsTask(List<ActivityManager.RecentTaskInfo> tasks) { + /** Returns the proper rect to use for the animation, given the number of tasks. */ + Rect getAnimationTaskRect(List<ActivityManager.RecentTaskInfo> tasks) { // NOTE: Currently there's no method to get the number of non-home tasks, so we have to // compute this ourselves SystemServicesProxy ssp = mSystemServicesProxy; @@ -320,7 +327,13 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta continue; } } - return (tasks.size() > 1); + if (tasks.size() <= 1) { + return mSingleCountFirstTaskRect; + } else if (tasks.size() <= 2) { + return mTwoCountFirstTaskRect; + } else { + return mMultipleCountFirstTaskRect; + } } /** Converts from the device rotation to the degree */ @@ -474,9 +487,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta // which can differ depending on the number of items in the list. SystemServicesProxy ssp = mSystemServicesProxy; List<ActivityManager.RecentTaskInfo> recentTasks = - ssp.getRecentTasks(2, UserHandle.CURRENT.getIdentifier()); - Rect taskRect = hasMultipleRecentsTask(recentTasks) ? mMultipleCountFirstTaskRect : - mSingleCountFirstTaskRect; + ssp.getRecentTasks(3, UserHandle.CURRENT.getIdentifier()); + Rect taskRect = getAnimationTaskRect(recentTasks); boolean useThumbnailTransition = !isTopTaskHome && hasValidTaskRects(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java index 57957a8..4db81bf 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java @@ -36,7 +36,7 @@ public class Constants { // Enables the search bar layout public static final boolean EnableSearchLayout = true; // Enables the dynamic shadows behind each task - public static final boolean EnableShadows = false; + public static final boolean EnableShadows = true; // This disables the bitmap and icon caches public static final boolean DisableBackgroundCache = false; // For debugging, this enables us to create mock recents tasks @@ -102,7 +102,7 @@ public class Constants { public static final int FilterStartDelay = 25; // The padding will be applied to the smallest dimension, and then applied to all sides - public static final float StackPaddingPct = 0.1f; + public static final float StackPaddingPct = 0.085f; // The overlap height relative to the task height public static final float StackOverlapPct = 0.65f; // The height of the peek space relative to the stack height @@ -113,4 +113,4 @@ public class Constants { public static final int StackPeekNumCards = 3; } } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java index 6d08281..1ae7a0d 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java @@ -61,6 +61,7 @@ public class RecentsConfiguration { public int taskViewRemoveAnimTranslationXPx; public int taskViewTranslationZMinPx; public int taskViewTranslationZIncrementPx; + public int taskViewShadowOutlineBottomInsetPx; public int taskViewRoundedCornerRadiusPx; public int searchBarSpaceHeightPx; @@ -132,6 +133,8 @@ public class RecentsConfiguration { taskViewTranslationZMinPx = res.getDimensionPixelSize(R.dimen.recents_task_view_z_min); taskViewTranslationZIncrementPx = res.getDimensionPixelSize(R.dimen.recents_task_view_z_increment); + taskViewShadowOutlineBottomInsetPx = + res.getDimensionPixelSize(R.dimen.recents_task_view_shadow_outline_bottom_inset); searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height); taskBarViewDefaultBackgroundColor = diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java index 9acb2bd..0c2c11d 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java @@ -83,20 +83,29 @@ class SystemUIMessageHandler extends Handler { stack.addTask(new Task()); tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() - systemInsets.top - systemInsets.bottom, 0, 0); - tsv.boundScroll(); + tsv.setStackScrollToInitialState(); transform = tsv.getStackTransform(0, tsv.getStackScroll()); transform.rect.offset(taskStackBounds.left, taskStackBounds.top); replyData.putParcelable(AlternateRecentsComponent.KEY_SINGLE_TASK_STACK_RECT, new Rect(transform.rect)); - // Also calculate the target task rect when there are multiple tasks. + // Also calculate the target task rect when there are two tasks. stack.addTask(new Task()); tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() - systemInsets.top - systemInsets.bottom, 0, 0); - tsv.setStackScrollRaw(Integer.MAX_VALUE); - tsv.boundScroll(); + tsv.setStackScrollToInitialState(); transform = tsv.getStackTransform(1, tsv.getStackScroll()); transform.rect.offset(taskStackBounds.left, taskStackBounds.top); + replyData.putParcelable(AlternateRecentsComponent.KEY_TWO_TASK_STACK_RECT, + new Rect(transform.rect)); + + // Also calculate the target task rect when there are two tasks. + stack.addTask(new Task()); + tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() - + systemInsets.top - systemInsets.bottom, 0, 0); + tsv.setStackScrollToInitialState(); + transform = tsv.getStackTransform(2, tsv.getStackScroll()); + transform.rect.offset(taskStackBounds.left, taskStackBounds.top); replyData.putParcelable(AlternateRecentsComponent.KEY_MULTIPLE_TASK_STACK_RECT, new Rect(transform.rect)); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java index 3ee0545..cae6bd7 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java @@ -278,6 +278,7 @@ public class SwipeHelper { if (FADE_OUT_DURING_SWIPE && canAnimViewBeDismissed) { view.setAlpha(getAlphaForOffset(view)); } + mCallback.onSwipeChanged(mCurrView, view.getTranslationX()); } }); anim.addListener(new AnimatorListenerAdapter() { @@ -313,6 +314,7 @@ public class SwipeHelper { if (mCurrView != null) { float delta = getPos(ev) - mInitialTouchPos; setSwipeAmount(delta); + mCallback.onSwipeChanged(mCurrView, delta); } break; case MotionEvent.ACTION_UP: @@ -393,6 +395,8 @@ public class SwipeHelper { void onBeginDrag(View v); + void onSwipeChanged(View v, float delta); + void onChildDismissed(View v); void onSnapBackCompleted(View v); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index b7d7d1d..1fbaf87 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -172,7 +172,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } // Set the alphas - transform.dismissAlpha = Math.max(-1f, Math.min(0f, t)) + 1f; + transform.dismissAlpha = Math.max(-1f, Math.min(0f, t + 1)) + 1f; // Update the rect and visibility transform.rect.set(mTaskRect); @@ -300,6 +300,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal public void setStackScrollRaw(int value) { mStackScroll = value; } + /** Sets the current stack scroll to the initial state when you first enter recents */ + public void setStackScrollToInitialState() { + if (mStack.getTaskCount() > 2) { + int initialScroll = mMaxScroll - mTaskRect.height() / 2; + setStackScroll(initialScroll); + } else { + setStackScroll(mMaxScroll); + } + } /** * Returns the scroll to such that the task transform at that index will have t=0. (If the scroll @@ -700,7 +709,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // If this is the first layout, then scroll to the front of the stack and synchronize the // stack views immediately if (mAwaitingFirstLayout) { - setStackScroll(mMaxScroll); + setStackScrollToInitialState(); requestSynchronizeStackViewsWithModel(); synchronizeStackViewsWithModel(); } @@ -1556,6 +1565,11 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { } @Override + public void onSwipeChanged(View v, float delta) { + // Do nothing + } + + @Override public void onChildDismissed(View v) { TaskView tv = (TaskView) v; mSv.onTaskDismissed(tv); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 813c26a..ffa181d 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -112,7 +112,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On // Update the outline Outline o = new Outline(); - o.setRoundRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), radius); + o.setRoundRect(0, 0, getMeasuredWidth(), getMeasuredHeight() - + config.taskViewShadowOutlineBottomInsetPx, radius); setOutline(o); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 802e5e5..dce5a30 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -34,6 +34,7 @@ import android.view.animation.Interpolator; import android.widget.LinearLayout; import com.android.systemui.R; +import com.android.systemui.qs.QSPanel; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.FlingAnimationUtils; import com.android.systemui.statusbar.GestureRecorder; @@ -51,7 +52,7 @@ public class NotificationPanelView extends PanelView implements PhoneStatusBar mStatusBar; private StatusBarHeaderView mHeader; private View mQsContainer; - private View mQsPanel; + private QSPanel mQsPanel; private View mKeyguardStatusView; private ObservableScrollView mScrollView; private View mStackScrollerContainer; @@ -70,6 +71,7 @@ public class NotificationPanelView extends PanelView implements */ private boolean mIntercepting; private boolean mQsExpanded; + private boolean mQsFullyExpanded; private boolean mKeyguardShowing; private float mInitialHeightOnTouch; private float mInitialTouchX; @@ -81,13 +83,14 @@ public class NotificationPanelView extends PanelView implements private int mQsMaxExpansionHeight; private int mMinStackHeight; private int mQsPeekHeight; + private int mQsHeaderPeekHeight; + private boolean mQsShowingDetail; private float mNotificationTranslation; private int mStackScrollerIntrinsicPadding; private boolean mQsExpansionEnabled = true; private ValueAnimator mQsExpansionAnimator; private FlingAnimationUtils mFlingAnimationUtils; private int mStatusBarMinHeight; - private Interpolator mFastOutSlowInInterpolator; private ObjectAnimator mClockAnimator; private int mClockAnimationTarget = -1; @@ -130,7 +133,8 @@ public class NotificationPanelView extends PanelView implements mKeyguardStatusView = findViewById(R.id.keyguard_status_view); mStackScrollerContainer = findViewById(R.id.notification_container_parent); mQsContainer = findViewById(R.id.quick_settings_container); - mQsPanel = findViewById(R.id.quick_settings_panel); + mQsPanel = (QSPanel) findViewById(R.id.quick_settings_panel); + mQsPanel.setCallback(mQsPanelCallback); mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view); mScrollView.setListener(this); mNotificationStackScroller = (NotificationStackScrollLayout) @@ -154,6 +158,7 @@ public class NotificationPanelView extends PanelView implements mStatusBarMinHeight = getResources().getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); mQsPeekHeight = getResources().getDimensionPixelSize(R.dimen.qs_peek_height); + mQsHeaderPeekHeight = getResources().getDimensionPixelSize(R.dimen.qs_header_peek_height); mClockPositionAlgorithm.loadDimens(getResources()); } @@ -165,7 +170,9 @@ public class NotificationPanelView extends PanelView implements mQsMinExpansionHeight = mHeader.getCollapsedHeight() + mQsPeekHeight; mQsMaxExpansionHeight = mHeader.getExpandedHeight() + mQsContainer.getHeight(); if (mQsExpanded) { - setQsStackScrollerPadding(mQsMaxExpansionHeight); + if (mQsFullyExpanded) { + setQsStackScrollerPadding(mQsMaxExpansionHeight); + } } else { setQsExpansion(mQsMinExpansionHeight); positionClockAndNotifications(); @@ -518,10 +525,39 @@ public class NotificationPanelView extends PanelView implements ? View.INVISIBLE : View.VISIBLE); mScrollView.setTouchEnabled(mQsExpanded); + if (mQsShowingDetail) { + if (mQsFullyExpanded) { + setQsHeaderPeeking(true); + } + } else { + setQsHeaderPeeking(false); + } + } + + private void setQsHeaderPeeking(boolean peeking) { + final boolean stackIsPeeking = mStackScrollerContainer.getTranslationY() != 0; + final boolean headerIsPeeking = mHeader.getTranslationY() != 0; + final int ty = mQsHeaderPeekHeight - mHeader.getExpandedHeight(); + if (peeking) { + if (!headerIsPeeking) { + mHeader.animate().translationY(ty); + } + if (!stackIsPeeking) { + mStackScrollerContainer.animate().translationY(ty); + } + } else { + if (headerIsPeeking) { + mHeader.animate().translationY(0); + } + if (stackIsPeeking) { + mStackScrollerContainer.animate().translationY(0); + } + } } private void setQsExpansion(float height) { height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight); + mQsFullyExpanded = height == mQsMaxExpansionHeight; if (height > mQsMinExpansionHeight && !mQsExpanded) { setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { @@ -614,10 +650,16 @@ public class NotificationPanelView extends PanelView implements if (!mQsExpansionEnabled) { return false; } + final float ty = mHeader.getTranslationY(); boolean onHeader = x >= mHeader.getLeft() && x <= mHeader.getRight() - && y >= mHeader.getTop() && y <= mHeader.getBottom(); + && y >= mHeader.getTop() + ty && y <= mHeader.getBottom() + ty; if (mQsExpanded) { - return onHeader || (mScrollView.isScrolledToBottom() && yDiff < 0); + if (mQsShowingDetail && onHeader) { + // bring back the header, crudely + setQsHeaderPeeking(false); + mQsPanel.setExpanded(false); + } + return !mQsShowingDetail && onHeader || (mScrollView.isScrolledToBottom() && yDiff < 0); } else { return onHeader; } @@ -781,4 +823,12 @@ public class NotificationPanelView extends PanelView implements public View getRightIcon() { return mKeyguardBottomArea.getCameraImageView(); } + + private final QSPanel.Callback mQsPanelCallback = new QSPanel.Callback() { + @Override + public void onShowingDetail(boolean showingDetail) { + mQsShowingDetail = showingDetail; + updateQsState(); + } + }; } diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java index 67f3a3d..fae0e01 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java @@ -31,6 +31,7 @@ import android.media.AudioSystem; import android.media.RingtoneManager; import android.media.ToneGenerator; import android.net.Uri; +import android.os.AsyncTask; import android.os.Handler; import android.os.Message; import android.os.Vibrator; @@ -76,6 +77,7 @@ public class VolumePanel extends Handler { private static final int MAX_VOLUME = 100; private static final int FREE_DELAY = 10000; private static final int TIMEOUT_DELAY = 3000; + private static final int TIMEOUT_DELAY_EXPANDED = 10000; private static final int MSG_VOLUME_CHANGED = 0; private static final int MSG_FREE_RESOURCES = 1; @@ -103,6 +105,7 @@ public class VolumePanel extends Handler { private boolean mRingIsSilent; private boolean mVoiceCapable; private boolean mZenModeCapable; + private int mTimeoutDelay = TIMEOUT_DELAY; // True if we want to play tones on the system stream when the master stream is specified. private final boolean mPlayMasterStreamTones; @@ -513,6 +516,7 @@ public class VolumePanel extends Handler { @Override public void onInteraction() { + resetTimeout(); if (mZenPanelCallback != null) { mZenPanelCallback.onInteraction(); } @@ -521,6 +525,8 @@ public class VolumePanel extends Handler { } mZenPanel.setVisibility(View.VISIBLE); mZenPanelDivider.setVisibility(View.VISIBLE); + mTimeoutDelay = TIMEOUT_DELAY_EXPANDED; + resetTimeout(); } private void collapse() { @@ -529,6 +535,8 @@ public class VolumePanel extends Handler { mZenPanel.setVisibility(View.GONE); } mZenPanelDivider.setVisibility(View.GONE); + mTimeoutDelay = TIMEOUT_DELAY; + resetTimeout(); } public void updateStates() { @@ -1082,7 +1090,7 @@ public class VolumePanel extends Handler { public void resetTimeout() { if (LOGD) Log.d(mTag, "resetTimeout at " + System.currentTimeMillis()); removeMessages(MSG_TIMEOUT); - sendEmptyMessageDelayed(MSG_TIMEOUT, TIMEOUT_DELAY); + sendEmptyMessageDelayed(MSG_TIMEOUT, mTimeoutDelay); } private void forceTimeout() { @@ -1134,7 +1142,12 @@ public class VolumePanel extends Handler { public void onClick(View v) { if (v == mExpandButton && mZenController != null) { final boolean newZen = !mZenController.isZen(); - mZenController.setZen(newZen); + AsyncTask.execute(new Runnable() { + @Override + public void run() { + mZenController.setZen(newZen); + } + }); if (newZen) { expand(); } else { |