diff options
30 files changed, 332 insertions, 198 deletions
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java index 0941d71..2bec1c1 100644 --- a/core/java/android/os/FileUtils.java +++ b/core/java/android/os/FileUtils.java @@ -16,6 +16,7 @@ package android.os; +import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -91,7 +92,7 @@ public class FileUtils { } return result; } - + /** * Copy data from a source stream to destFile. * Return true if succeed, return false if failed. @@ -143,12 +144,16 @@ public class FileUtils { */ public static String readTextFile(File file, int max, String ellipsis) throws IOException { InputStream input = new FileInputStream(file); + // wrapping a BufferedInputStream around it because when reading /proc with unbuffered + // input stream, bytes read not equal to buffer size is not necessarily the correct + // indication for EOF; but it is true for BufferedInputStream due to its implementation. + BufferedInputStream bis = new BufferedInputStream(input); try { long size = file.length(); if (max > 0 || (size > 0 && max == 0)) { // "head" mode: read the first N bytes if (size > 0 && (max == 0 || size < max)) max = (int) size; byte[] data = new byte[max + 1]; - int length = input.read(data); + int length = bis.read(data); if (length <= 0) return ""; if (length <= max) return new String(data, 0, length); if (ellipsis == null) return new String(data, 0, max); @@ -161,7 +166,7 @@ public class FileUtils { if (last != null) rolled = true; byte[] tmp = last; last = data; data = tmp; if (data == null) data = new byte[-max]; - len = input.read(data); + len = bis.read(data); } while (len == data.length); if (last == null && len <= 0) return ""; @@ -178,12 +183,13 @@ public class FileUtils { int len; byte[] data = new byte[1024]; do { - len = input.read(data); + len = bis.read(data); if (len > 0) contents.write(data, 0, len); } while (len == data.length); return contents.toString(); } } finally { + bis.close(); input.close(); } } diff --git a/core/java/com/android/internal/widget/RotarySelector.java b/core/java/com/android/internal/widget/RotarySelector.java index a2a38dc..4e405f4 100644 --- a/core/java/com/android/internal/widget/RotarySelector.java +++ b/core/java/com/android/internal/widget/RotarySelector.java @@ -25,7 +25,9 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.drawable.Drawable; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; @@ -667,11 +669,16 @@ public class RotarySelector extends View { * Triggers haptic feedback. */ private synchronized void vibrate(long duration) { - if (mVibrator == null) { - mVibrator = (android.os.Vibrator) - getContext().getSystemService(Context.VIBRATOR_SERVICE); + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (hapticEnabled) { + if (mVibrator == null) { + mVibrator = (android.os.Vibrator) getContext() + .getSystemService(Context.VIBRATOR_SERVICE); + } + mVibrator.vibrate(duration); } - mVibrator.vibrate(duration); } /** diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java index f535a08..aebc4f6 100644 --- a/core/java/com/android/internal/widget/SlidingTab.java +++ b/core/java/com/android/internal/widget/SlidingTab.java @@ -21,7 +21,9 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; @@ -811,11 +813,16 @@ public class SlidingTab extends ViewGroup { * Triggers haptic feedback. */ private synchronized void vibrate(long duration) { - if (mVibrator == null) { - mVibrator = (android.os.Vibrator) - getContext().getSystemService(Context.VIBRATOR_SERVICE); + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (hapticEnabled) { + if (mVibrator == null) { + mVibrator = (android.os.Vibrator) getContext() + .getSystemService(Context.VIBRATOR_SERVICE); + } + mVibrator.vibrate(duration); } - mVibrator.vibrate(duration); } /** diff --git a/core/java/com/android/internal/widget/WaveView.java b/core/java/com/android/internal/widget/WaveView.java index 2d89234..d33d50c 100644 --- a/core/java/com/android/internal/widget/WaveView.java +++ b/core/java/com/android/internal/widget/WaveView.java @@ -25,7 +25,9 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; @@ -573,11 +575,16 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen * Triggers haptic feedback. */ private synchronized void vibrate(long duration) { - if (mVibrator == null) { - mVibrator = (android.os.Vibrator) - getContext().getSystemService(Context.VIBRATOR_SERVICE); + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (hapticEnabled) { + if (mVibrator == null) { + mVibrator = (android.os.Vibrator) getContext() + .getSystemService(Context.VIBRATOR_SERVICE); + } + mVibrator.vibrate(duration); } - mVibrator.vibrate(duration); } /** diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java index f507a79..0f49776 100644 --- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java +++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java @@ -31,7 +31,9 @@ import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; @@ -543,7 +545,10 @@ public class GlowPadView extends View { } private void vibrate() { - if (mVibrator != null) { + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (mVibrator != null && hapticEnabled) { mVibrator.vibrate(mVibrationDuration); } } diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java index 7990b4c..e22d1e8 100644 --- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java +++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java @@ -32,7 +32,9 @@ import android.graphics.Canvas; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.os.UserHandle; import android.os.Vibrator; +import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; @@ -593,7 +595,10 @@ public class MultiWaveView extends View { } private void vibrate() { - if (mVibrator != null) { + final boolean hapticEnabled = Settings.System.getIntForUser( + mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, + UserHandle.USER_CURRENT) != 0; + if (mVibrator != null && hapticEnabled) { mVibrator.vibrate(mVibrationDuration); } } diff --git a/core/res/res/layout/keyguard_emergency_carrier_area.xml b/core/res/res/layout/keyguard_emergency_carrier_area.xml index c16955c..f9a593f 100644 --- a/core/res/res/layout/keyguard_emergency_carrier_area.xml +++ b/core/res/res/layout/keyguard_emergency_carrier_area.xml @@ -23,7 +23,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:gravity="center_horizontal" + android:gravity="center" android:layout_gravity="center_horizontal" android:layout_alignParentBottom="true"> diff --git a/core/res/res/layout/keyguard_selector_view.xml b/core/res/res/layout/keyguard_selector_view.xml index 4838c2a..daaf35b 100644 --- a/core/res/res/layout/keyguard_selector_view.xml +++ b/core/res/res/layout/keyguard_selector_view.xml @@ -41,10 +41,8 @@ <include layout="@layout/keyguard_emergency_carrier_area" android:id="@+id/keyguard_selector_fade_container" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:layout_gravity="bottom|center_horizontal" - android:gravity="center_horizontal" /> + android:layout_height="48dp" + android:layout_gravity="bottom|center_horizontal" /> </FrameLayout> </com.android.internal.policy.impl.keyguard.KeyguardSelectorView> diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index e812ccb..46c4398 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -191,28 +191,21 @@ <li><a href="<?cs var:toroot ?>guide/topics/ui/menus.html"> <span class="en">Menus</span></span> </a></li> - <li><a href="<?cs var:toroot ?>guide/topics/ui/dialogs.html"> - <span class="en">Dialogs</span> - </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html"> <span class="en">Action Bar</span> </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/settings.html"> <span class="en">Settings</span> </a></li> - <li class="nav-section"> - <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html"> - <span class="en">Notifications</span> - </a></div> - <ul> - <li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/toasts.html"> - <span class="en">Toast Notifications</span> - </a></li> - <li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/notifications.html"> - <span class="en">Status Notifications</span> - </a></li> - </ul> - </li> + <li><a href="<?cs var:toroot ?>guide/topics/ui/dialogs.html"> + <span class="en">Dialogs</span> + </a></li> + <li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/notifications.html"> + <span class="en">Notifications</span> + </a></li> + <li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/toasts.html"> + <span class="en">Toasts</span> + </a></li> <li class="nav-section"> <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/search/index.html"> <span class="en">Search</span> diff --git a/docs/html/guide/topics/ui/notifiers/notifications.jd b/docs/html/guide/topics/ui/notifiers/notifications.jd index fbff532..2de6260 100644 --- a/docs/html/guide/topics/ui/notifiers/notifications.jd +++ b/docs/html/guide/topics/ui/notifiers/notifications.jd @@ -4,26 +4,43 @@ page.title=Notifications <div id="qv-wrapper"> <div id="qv"> <h2>In this document</h2> +<ol> + <li><a href="#NotificationUI">Notification Display Elements</a> <ol> - <li> - <a href="#NotificationUI">Notification Display Elements</a> - </li> - <li> - <a href="#CreateNotification">Creating a Notification</a> - </li> - <li> - <a href="#Managing">Managing Notifications</a> - </li> - <li> - <a href="#NotificationResponse">Preserving Navigation when Starting an Activity</a> - </li> - <li> - <a href="#Progress">Displaying Progress in a Notification</a> - </li> - <li> - <a href="#CustomNotification">Custom Notification Layouts</a> - </li> + <li><a href="#NormalNotify">Normal view</a></li> + <li><a href="#BigNotify">Big view</a></li> + </ol> + </li> + <li><a href="#CreateNotification">Creating a Notification</a> + <ol> + <li><a href="#Required">Required notification contents</a></li> + <li><a href="#Optional">Optional notification contents and settings</a></li> + <li><a href="#Actions">Notification actions</a></li> + <li><a href="#SimpleNotification">Creating a simple notification</a></li> + <li><a href="#ApplyStyle">Applying a big view style to a notification</a></li> + </ol> + </li> + <li><a href="#Managing">Managing Notifications</a> + <ol> + <li><a href="#Updating">Updating notifications</a></li> + <li><a href="#Removing">Removing notifications</a></li> + </ol> + </li> + <li><a href="#NotificationResponse">Preserving Navigation when Starting an Activity</a> + <ol> + <li><a href="#DirectEntry">Setting up a regular activity PendingIntent</a></li> + <li><a href="#ExtendedNotification">Setting up a special activity PendingIntent</a></li> + </ol> + </li> + <li><a href="#Progress">Displaying Progress in a Notification</a> + <ol> + <li><a href="#FixedProgress">Displaying a fixed-duration progress indicator</a></li> + <li><a href="#ActivityIndicator">Displaying a continuing activity indicator</a></li> </ol> + </li> + <li><a href="#CustomNotification">Custom Notification Layouts</a></li> +</ol> + <h2>Key classes</h2> <ol> <li>{@link android.app.NotificationManager}</li> @@ -54,13 +71,12 @@ page.title=Notifications <img id="figure1" src="{@docRoot}images/ui/notifications/iconic_notification.png" - height="32" - alt="" /> + height="120" alt="" /> <p class="img-caption"> <strong>Figure 1.</strong> Notifications in the notification area. </p> <img id="figure2" src="{@docRoot}images/ui/notifications/normal_notification.png" - height="240" alt="" /> + height="293" alt="" /> <p class="img-caption"> <strong>Figure 2.</strong> Notifications in the notification drawer. </p> @@ -98,7 +114,7 @@ page.title=Notifications <img src="{@docRoot}images/ui/notifications/normal_notification_callouts.png" alt="" - height="204" + height="153" id="figure3" /> <p class="img-caption"> <strong>Figure 3.</strong> Notification in normal view. diff --git a/docs/html/guide/topics/ui/notifiers/toasts.jd b/docs/html/guide/topics/ui/notifiers/toasts.jd index 1a1fb1f..92c146a 100644 --- a/docs/html/guide/topics/ui/notifiers/toasts.jd +++ b/docs/html/guide/topics/ui/notifiers/toasts.jd @@ -1,17 +1,8 @@ -page.title=Toast Notifications -parent.title=Notifications -parent.link=index.html +page.title=Toasts @jd:body <div id="qv-wrapper"> - <div id="qv"> - <h2>Quickview</h2> - <ol> - <li>A toast is a message that appears on the surface of the screen for a moment, but it -does not take focus (or pause the current activity), so it cannot accept user input</li> - <li>You can customize the toast layout to include images</li> - </ol> - + <div id="qv"> <h2>In this document</h2> <ol> <li><a href="#Basics">The Basics</a></li> @@ -26,22 +17,17 @@ does not take focus (or pause the current activity), so it cannot accept user in </div> </div> -<p>A toast notification is a message that pops up on the surface of the window. -It only fills the amount of space required for the message and the user's current -activity remains visible and interactive. The notification automatically fades in and -out, and does not accept interaction events.</p> +<p>A toast provides simple feedback about an operation in a small popup. +It only fills the amount of space required for the message and the current +activity remains visible and interactive. +For example, navigating away from an email before you send it triggers a +"Draft saved" toast to let you know that you can continue editing later. +Toasts automatically disappear after a timeout.</p> -<p>The screenshot below shows an example toast notification from the Alarm application. -Once an alarm is turned on, a toast is displayed to assure you that the -alarm was set.</p> <img src="{@docRoot}images/toast.png" alt="" /> -<p>A toast can be created and displayed from an {@link android.app.Activity} or -{@link android.app.Service}. If you create a toast notification from a Service, it -appears in front of the Activity currently in focus.</p> - -<p>If user response to the notification is required, consider using a -<a href="notifications.html">Status Bar Notification</a>.</p> +<p>If user response to a status message is required, consider instead using a +<a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notification</a>.</p> <h2 id="Basics">The Basics</h2> @@ -90,8 +76,6 @@ To nudge it down, increase the value of the last parameter. <h2 id="CustomToastView">Creating a Custom Toast View</h2> -<img src="{@docRoot}images/custom_toast.png" alt="" style="float:right" /> - <p>If a simple text message isn't enough, you can create a customized layout for your toast notification. To create a custom layout, define a View layout, in XML or in your application code, and pass the root {@link android.view.View} object @@ -105,17 +89,17 @@ with the following XML (saved as <em>toast_layout.xml</em>):</p> android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:padding="10dp" + android:padding="8dp" android:background="#DAAA" > - <ImageView android:id="@+id/image" + <ImageView android:src="@drawable/droid" android:layout_width="wrap_content" - android:layout_height="fill_parent" - android:layout_marginRight="10dp" + android:layout_height="wrap_content" + android:layout_marginRight="8dp" /> <TextView android:id="@+id/text" android:layout_width="wrap_content" - android:layout_height="fill_parent" + android:layout_height="wrap_content" android:textColor="#FFF" /> </LinearLayout> @@ -126,13 +110,11 @@ ID to inflate the layout from the XML, as shown here:</p> <pre> LayoutInflater inflater = getLayoutInflater(); -View layout = inflater.inflate(R.layout.toast_layout, +View layout = inflater.inflate(R.layout.custom_toast, (ViewGroup) findViewById(R.id.toast_layout_root)); -ImageView image = (ImageView) layout.findViewById(R.id.image); -image.setImageResource(R.drawable.android); TextView text = (TextView) layout.findViewById(R.id.text); -text.setText("Hello! This is a custom toast!"); +text.setText("This is a custom toast"); Toast toast = new Toast(getApplicationContext()); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); diff --git a/docs/html/images/toast.png b/docs/html/images/toast.png Binary files differindex 223048a..b4c709a 100644 --- a/docs/html/images/toast.png +++ b/docs/html/images/toast.png diff --git a/docs/html/images/ui/notifications/iconic_notification.png b/docs/html/images/ui/notifications/iconic_notification.png Binary files differindex 4cabfdb..e72fe4e 100644 --- a/docs/html/images/ui/notifications/iconic_notification.png +++ b/docs/html/images/ui/notifications/iconic_notification.png diff --git a/docs/html/images/ui/notifications/normal_notification.png b/docs/html/images/ui/notifications/normal_notification.png Binary files differindex 3cf0231..9bea5fb 100644 --- a/docs/html/images/ui/notifications/normal_notification.png +++ b/docs/html/images/ui/notifications/normal_notification.png diff --git a/docs/html/images/ui/notifications/normal_notification_callouts.png b/docs/html/images/ui/notifications/normal_notification_callouts.png Binary files differindex db57daf..6880e90 100644 --- a/docs/html/images/ui/notifications/normal_notification_callouts.png +++ b/docs/html/images/ui/notifications/normal_notification_callouts.png diff --git a/packages/SystemUI/res/anim/recent_app_enter.xml b/packages/SystemUI/res/anim/recent_app_enter.xml deleted file mode 100644 index 4947eee..0000000 --- a/packages/SystemUI/res/anim/recent_app_enter.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2009, 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. -*/ ---> - -<!-- Special window zoom animation: this is the element that enters the screen, - it starts at 200% and scales down. Goes with zoom_exit.xml. --> -<set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/decelerate_interpolator"> - <scale android:fromXScale="0.25" android:toXScale="1.0" - android:fromYScale="0.25" android:toYScale="1.0" - android:pivotX="0%p" android:pivotY="0%p" - android:duration="500" /> - <alpha android:fromAlpha="0.0" android:toAlpha="1.0" - android:duration="500"/> -</set> diff --git a/packages/SystemUI/res/anim/recent_app_leave.xml b/packages/SystemUI/res/anim/recent_app_leave.xml deleted file mode 100644 index 3d83988..0000000 --- a/packages/SystemUI/res/anim/recent_app_leave.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2009, 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. -*/ ---> - -<!-- Special window zoom animation: this is the element that enters the screen, - it starts at 200% and scales down. Goes with zoom_exit.xml. --> -<set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/decelerate_interpolator"> - <scale android:fromXScale="1.0" android:toXScale="0.25" - android:fromYScale="1.0" android:toYScale="0.25" - android:pivotX="0%p" android:pivotY="0%p" - android:duration="500" /> - <alpha android:fromAlpha="1.0" android:toAlpha="0.0" - android:duration="500"/> -</set> diff --git a/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml b/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml new file mode 100644 index 0000000..73ae9f2 --- /dev/null +++ b/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2012, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:detachWallpaper="true" + android:shareInterpolator="false" + android:zAdjustment="normal"> + <!--scale android:fromXScale="2.0" android:toXScale="1.0" + android:fromYScale="2.0" android:toYScale="1.0" + android:interpolator="@android:interpolator/decelerate_cubic" + android:fillEnabled="true" + android:fillBefore="true" android:fillAfter="true" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="250" /--> + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:fillEnabled="true" + android:fillBefore="true" android:fillAfter="true" + android:interpolator="@android:interpolator/decelerate_cubic" + android:duration="250"/> +</set> diff --git a/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml b/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml new file mode 100644 index 0000000..becc9d0 --- /dev/null +++ b/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2012, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:zAdjustment="normal"> + <alpha android:fromAlpha="1.0" android:toAlpha="0.0" + android:fillEnabled="true" + android:fillBefore="true" android:fillAfter="true" + android:interpolator="@android:interpolator/decelerate_cubic" + android:duration="250"/> +</set> diff --git a/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml b/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml new file mode 100644 index 0000000..efa9019 --- /dev/null +++ b/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2012, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:zAdjustment="normal"> + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:interpolator="@android:interpolator/decelerate_cubic" + android:duration="250"/> +</set> diff --git a/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml b/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml new file mode 100644 index 0000000..e95e667 --- /dev/null +++ b/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2012, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:zAdjustment="normal"> + <!--scale android:fromXScale="1.0" android:toXScale="2.0" + android:fromYScale="1.0" android:toYScale="2.0" + android:interpolator="@android:interpolator/decelerate_cubic" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="250" /--> + <alpha android:fromAlpha="1.0" android:toAlpha="0.0" + android:interpolator="@android:interpolator/decelerate_cubic" + android:duration="250"/> +</set> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 4bf6c10..4de0891 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -52,7 +52,7 @@ <dimen name="status_bar_recents_item_padding">0dip</dimen> <!-- When recents first appears, how far the icon and label of the primary activity travel --> - <dimen name="status_bar_recents_app_icon_translate_distance">100dp</dimen> + <dimen name="status_bar_recents_app_icon_translate_distance">35dip</dimen> <!-- Where to place the app icon over the thumbnail --> <dimen name="status_bar_recents_app_icon_left_margin">0dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java index f71f554..bc61ab0 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java @@ -184,8 +184,8 @@ public class SearchPanelView extends FrameLayout implements private void vibrate() { Context context = getContext(); - if (Settings.System.getInt(context.getContentResolver(), - Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0) { + if (Settings.System.getIntForUser(context.getContentResolver(), + Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, UserHandle.USER_CURRENT) != 0) { Resources res = context.getResources(); Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(res.getInteger(R.integer.config_search_panel_view_vibration_duration)); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java index 79069b8..ef9f36e 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java @@ -18,6 +18,7 @@ package com.android.systemui.recent; import android.app.Activity; import android.app.ActivityManager; +import android.app.WallpaperManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -26,6 +27,7 @@ import android.os.Bundle; import android.os.UserHandle; import android.view.MotionEvent; import android.view.View; +import android.view.WindowManager; import com.android.systemui.R; import com.android.systemui.SystemUIApplication; @@ -42,6 +44,7 @@ public class RecentsActivity extends Activity { private IntentFilter mIntentFilter; private boolean mShowing; private boolean mForeground; + private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -79,6 +82,9 @@ public class RecentsActivity extends Activity { @Override public void onPause() { + overridePendingTransition( + R.anim.recents_return_to_launcher_enter, + R.anim.recents_return_to_launcher_exit); mForeground = false; super.onPause(); } @@ -92,8 +98,23 @@ public class RecentsActivity extends Activity { super.onStop(); } + private void updateWallpaperVisibility(boolean visible) { + int wpflags = visible ? WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER : 0; + int curflags = getWindow().getAttributes().flags + & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; + if (wpflags != curflags) { + getWindow().setFlags(wpflags, WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER); + } + } + @Override public void onStart() { + // Hide wallpaper if it's not a static image + if (WallpaperManager.getInstance(this).getWallpaperInfo() != null) { + updateWallpaperVisibility(false); + } else { + updateWallpaperVisibility(true); + } mShowing = true; if (mRecentsPanel != null) { mRecentsPanel.refreshViews(); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index 8607508..57d2ed3 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -520,7 +520,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener public void onWindowAnimationStart() { if (mItemToAnimateInWhenWindowAnimationIsFinished != null) { - final int startDelay = 100; + final int startDelay = 150; final int duration = 250; final ViewHolder holder = mItemToAnimateInWhenWindowAnimationIsFinished; final TimeInterpolator cubic = new DecelerateInterpolator(1.5f); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 3e929d6..577b1f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -485,7 +485,11 @@ public abstract class BaseStatusBar extends SystemUI implements | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); if (firstTask == null) { - mContext.startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT)); + ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, + R.anim.recents_launch_from_launcher_enter, + R.anim.recents_launch_from_launcher_exit); + mContext.startActivityAsUser(intent, opts.toBundle(), new UserHandle( + UserHandle.USER_CURRENT)); } else { Bitmap first = firstTask.getThumbnail(); final Resources res = mContext.getResources(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java index 8c390c8..faf20e2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java @@ -754,6 +754,7 @@ class QuickSettings { mBrightnessDialog.setCanceledOnTouchOutside(true); mBrightnessController = new BrightnessController(mContext, + (ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon), (ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider)); mBrightnessController.addStateChangedCallback(mModel); mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java index 0009503..e18b28a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java @@ -28,6 +28,7 @@ import android.provider.Settings.SettingNotFoundException; import android.util.Slog; import android.view.IWindowManager; import android.widget.CompoundButton; +import android.widget.ImageView; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; @@ -40,6 +41,7 @@ public class BrightnessController implements ToggleSlider.Listener { private final int mMaximumBacklight; private final Context mContext; + private final ImageView mIcon; private final ToggleSlider mControl; private final boolean mAutomaticAvailable; private final IPowerManager mPower; @@ -52,8 +54,9 @@ public class BrightnessController implements ToggleSlider.Listener { public void onBrightnessLevelChanged(); } - public BrightnessController(Context context, ToggleSlider control) { + public BrightnessController(Context context, ImageView icon, ToggleSlider control) { mContext = context; + mIcon = icon; mControl = control; mUserTracker = new CurrentUserTracker(mContext); @@ -84,8 +87,10 @@ public class BrightnessController implements ToggleSlider.Listener { automatic = 0; } control.setChecked(automatic != 0); + updateIcon(automatic != 0); } else { control.setChecked(false); + updateIcon(false /*automatic*/); //control.hideToggle(); } @@ -105,6 +110,7 @@ public class BrightnessController implements ToggleSlider.Listener { public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) { setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); + updateIcon(automatic); if (!automatic) { final int val = value + mMinimumBacklight; setBrightness(val); @@ -136,4 +142,12 @@ public class BrightnessController implements ToggleSlider.Listener { } catch (RemoteException ex) { } } + + private void updateIcon(boolean automatic) { + if (mIcon != null) { + mIcon.setImageResource(automatic ? + com.android.systemui.R.drawable.ic_qs_brightness_auto_on : + com.android.systemui.R.drawable.ic_qs_brightness_auto_off); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java index 194f1f6..f71842e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java @@ -78,6 +78,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { }); mBrightness = new BrightnessController(context, + (ImageView)findViewById(R.id.brightness_icon), (ToggleSlider)findViewById(R.id.brightness)); mDoNotDisturb = new DoNotDisturbController(context, (CompoundButton)findViewById(R.id.do_not_disturb_checkbox)); diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index daed0a2..7132e1e 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -3930,48 +3930,54 @@ public final class ActivityManagerService extends ActivityManagerNative removeDyingProviderLocked(null, providers.get(i), true); } - if (mIntentSenderRecords.size() > 0) { - Iterator<WeakReference<PendingIntentRecord>> it - = mIntentSenderRecords.values().iterator(); - while (it.hasNext()) { - WeakReference<PendingIntentRecord> wpir = it.next(); - if (wpir == null) { - it.remove(); - continue; - } - PendingIntentRecord pir = wpir.get(); - if (pir == null) { - it.remove(); - continue; - } - if (name == null) { - // Stopping user, remove all objects for the user. - if (pir.key.userId != userId) { - // Not the same user, skip it. + if (name == null) { + // Remove pending intents. For now we only do this when force + // stopping users, because we have some problems when doing this + // for packages -- app widgets are not currently cleaned up for + // such packages, so they can be left with bad pending intents. + if (mIntentSenderRecords.size() > 0) { + Iterator<WeakReference<PendingIntentRecord>> it + = mIntentSenderRecords.values().iterator(); + while (it.hasNext()) { + WeakReference<PendingIntentRecord> wpir = it.next(); + if (wpir == null) { + it.remove(); continue; } - } else { - if (UserHandle.getAppId(pir.uid) != appId) { - // Different app id, skip it. + PendingIntentRecord pir = wpir.get(); + if (pir == null) { + it.remove(); continue; } - if (userId != UserHandle.USER_ALL && pir.key.userId != userId) { - // Different user, skip it. - continue; + if (name == null) { + // Stopping user, remove all objects for the user. + if (pir.key.userId != userId) { + // Not the same user, skip it. + continue; + } + } else { + if (UserHandle.getAppId(pir.uid) != appId) { + // Different app id, skip it. + continue; + } + if (userId != UserHandle.USER_ALL && pir.key.userId != userId) { + // Different user, skip it. + continue; + } + if (!pir.key.packageName.equals(name)) { + // Different package, skip it. + continue; + } } - if (!pir.key.packageName.equals(name)) { - // Different package, skip it. - continue; + if (!doit) { + return true; + } + didSomething = true; + it.remove(); + pir.canceled = true; + if (pir.key.activity != null) { + pir.key.activity.pendingResults.remove(pir.ref); } - } - if (!doit) { - return true; - } - didSomething = true; - it.remove(); - pir.canceled = true; - if (pir.key.activity != null) { - pir.key.activity.pendingResults.remove(pir.ref); } } } |