diff options
Diffstat (limited to 'packages/SystemUI')
38 files changed, 511 insertions, 278 deletions
diff --git a/packages/SystemUI/res/anim/search_launch_enter.xml b/packages/SystemUI/res/anim/search_launch_enter.xml index 055ea5d..f3333b7 100644 --- a/packages/SystemUI/res/anim/search_launch_enter.xml +++ b/packages/SystemUI/res/anim/search_launch_enter.xml @@ -22,10 +22,10 @@ <alpha android:fromAlpha="0" android:toAlpha="1.0" android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" - android:interpolator="@android:interpolator/decelerate_quad" + android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300"/> - <translate android:fromYDelta="200" android:toYDelta="0" + <translate android:fromYDelta="100%" android:toYDelta="0" android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300" /> diff --git a/packages/SystemUI/res/drawable-hdpi/notification_header_bg.9.png b/packages/SystemUI/res/drawable-hdpi/notification_header_bg.9.png Binary files differnew file mode 100644 index 0000000..7444889 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/notification_header_bg.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-hdpi/notification_panel_bg.9.png Binary files differindex 8a0a30f..ff0bd4c 100644 --- a/packages/SystemUI/res/drawable-hdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-hdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/notification_header_bg.9.png b/packages/SystemUI/res/drawable-mdpi/notification_header_bg.9.png Binary files differnew file mode 100644 index 0000000..5002f97 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/notification_header_bg.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-mdpi/notification_panel_bg.9.png Binary files differindex 25f15e6..2bbb2c6 100644 --- a/packages/SystemUI/res/drawable-mdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-mdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/notification_panel_bg.9.png Binary files differindex 2ff93d3..e7caeda 100644 --- a/packages/SystemUI/res/drawable-sw600dp-hdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-sw600dp-mdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/notification_panel_bg.9.png Binary files differindex 430f913..ae07083 100644 --- a/packages/SystemUI/res/drawable-sw600dp-mdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-sw600dp-xhdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-xhdpi/notification_panel_bg.9.png Binary files differindex 807241a..8423ef9 100644 --- a/packages/SystemUI/res/drawable-sw600dp-xhdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-sw600dp-xhdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-sw600dp/status_bar_recents_background.xml b/packages/SystemUI/res/drawable-sw600dp/status_bar_recents_background.xml new file mode 100644 index 0000000..363efeb --- /dev/null +++ b/packages/SystemUI/res/drawable-sw600dp/status_bar_recents_background.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * 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. + */ +--> +<color xmlns:android="http://schemas.android.com/apk/res/android" + android:color="#e6000000" +/> diff --git a/packages/SystemUI/res/drawable-sw720dp-hdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw720dp-hdpi/notification_panel_bg.9.png Binary files differindex 2ff93d3..0c20ba2 100644 --- a/packages/SystemUI/res/drawable-sw720dp-hdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-sw720dp-hdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-sw720dp-mdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw720dp-mdpi/notification_panel_bg.9.png Binary files differindex 430f913..56cd238 100644 --- a/packages/SystemUI/res/drawable-sw720dp-mdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-sw720dp-mdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-sw720dp-xhdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw720dp-xhdpi/notification_panel_bg.9.png Binary files differindex 807241a..3f05767 100644 --- a/packages/SystemUI/res/drawable-sw720dp-xhdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-sw720dp-xhdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/notification_header_bg.9.png b/packages/SystemUI/res/drawable-xhdpi/notification_header_bg.9.png Binary files differnew file mode 100644 index 0000000..15008d2 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/notification_header_bg.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-xhdpi/notification_panel_bg.9.png Binary files differindex 60e7418..932e0ef 100644 --- a/packages/SystemUI/res/drawable-xhdpi/notification_panel_bg.9.png +++ b/packages/SystemUI/res/drawable-xhdpi/notification_panel_bg.9.png diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_expanded_header.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_expanded_header.xml deleted file mode 100644 index 9b834d2..0000000 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_expanded_header.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?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. ---> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="@dimen/notification_panel_header_padding_top" - android:background="@drawable/notification_header_bg" - android:orientation="horizontal" - android:gravity="center_vertical" - android:baselineAligned="false" - > - <com.android.systemui.statusbar.policy.Clock - android:id="@+id/clock" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="8dp" - android:singleLine="true" - android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" - /> - - <com.android.systemui.statusbar.policy.DateView android:id="@+id/date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" - /> - - <com.android.systemui.statusbar.RotationToggle android:id="@+id/rotation_lock_button" - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_margin="8dp" - android:button="@drawable/ic_notify_rotation" - android:contentDescription="@string/accessibility_rotation_lock_off" - /> - - <ImageView android:id="@+id/settings_button" - android:layout_width="48dp" - android:layout_height="48dp" - android:scaleType="center" - android:src="@drawable/ic_notify_quicksettings" - android:contentDescription="@string/accessibility_settings_button" - /> - - <Space - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_weight="1" - /> - - <ImageView android:id="@+id/clear_all_button" - android:layout_width="48dp" - android:layout_height="48dp" - android:scaleType="center" - android:src="@drawable/ic_notify_clear" - android:contentDescription="@string/accessibility_clear_all" - /> -</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml index f93dd33..c478334 100644 --- a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml +++ b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml @@ -33,9 +33,8 @@ <include layout="@layout/status_bar_expanded" android:layout_width="@dimen/notification_panel_width" - android:layout_height="match_parent" + android:layout_height="0dp" android:layout_gravity="center_horizontal|top" - android:visibility="invisible" /> </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 406ed25..47e5b71 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -29,6 +29,17 @@ android:layout_marginLeft="@dimen/notification_panel_margin_left" > + <TextView + android:id="@+id/carrier_label" + android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network" + android:layout_height="@dimen/carrier_label_height" + android:layout_width="match_parent" + android:layout_gravity="bottom" + android:layout_marginBottom="@dimen/close_handle_height" + android:gravity="center" + android:visibility="invisible" + /> + <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" @@ -37,7 +48,7 @@ <include layout="@layout/status_bar_expanded_header" android:layout_width="match_parent" - android:layout_height="48dp" + android:layout_height="@dimen/notification_panel_header_height" /> <ScrollView diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml index 893d422..7f598b6 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml @@ -20,7 +20,6 @@ xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="@dimen/notification_panel_header_padding_top" android:background="@drawable/notification_header_bg" android:orientation="horizontal" android:gravity="center_vertical" @@ -43,6 +42,15 @@ android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" /> + <com.android.systemui.statusbar.RotationToggle android:id="@+id/rotation_lock_button" + android:layout_width="32dp" + android:layout_height="32dp" + android:layout_margin="8dp" + android:button="@drawable/ic_notify_rotation" + android:contentDescription="@string/accessibility_rotation_lock_off" + android:clickable="true" + /> + <ImageView android:id="@+id/settings_button" android:layout_width="48dp" android:layout_height="48dp" diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml index b85686f..5bf1a58 100644 --- a/packages/SystemUI/res/layout/super_status_bar.xml +++ b/packages/SystemUI/res/layout/super_status_bar.xml @@ -24,6 +24,7 @@ android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true" + android:background="@android:color/transparent" > <include layout="@layout/status_bar" @@ -33,8 +34,7 @@ <include layout="@layout/status_bar_expanded" android:layout_width="match_parent" - android:layout_height="match_parent" - android:visibility="invisible" + android:layout_height="0dp" /> </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/SystemUI/res/layout/system_bar_settings_view.xml b/packages/SystemUI/res/layout/system_bar_settings_view.xml index 677988d..e1b2a54 100644 --- a/packages/SystemUI/res/layout/system_bar_settings_view.xml +++ b/packages/SystemUI/res/layout/system_bar_settings_view.xml @@ -89,7 +89,9 @@ android:layout_marginRight="5dp" /> </LinearLayout> - <View style="@style/StatusBarPanelSettingsPanelSeparator" /> + <View + android:id="@+id/rotate_separator" + style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Brightness --> <LinearLayout style="@style/StatusBarPanelSettingsRow" > diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index ac2779f..9bbfc91 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -24,7 +24,6 @@ <drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable> <color name="status_bar_recents_app_label_color">#ffffffff</color> <drawable name="status_bar_notification_row_background_color">#ff090909</drawable> - <drawable name="notification_header_bg">#FF000000</drawable> <color name="notification_list_shadow_top">#80000000</color> <drawable name="recents_callout_line">#99ffffff</drawable> <drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 0b362d1..3ed63ed 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -133,7 +133,7 @@ <dimen name="notification_panel_header_height">48dp</dimen> <!-- Extra space above the panel --> - <dimen name="notification_panel_padding_top">4dp</dimen> + <dimen name="notification_panel_padding_top">0dp</dimen> <!-- Extra space above the clock in the panel --> <dimen name="notification_panel_header_padding_top">0dp</dimen> @@ -145,4 +145,7 @@ <!-- Gravity for the notification panel --> <!-- 0x37 = fill_horizontal|top --> <integer name="notification_panel_layout_gravity">0x37</integer> + + <!-- Height of the carrier/wifi name label --> + <dimen name="carrier_label_height">24dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index a23fe12..1d5bf3c 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -63,6 +63,10 @@ <item name="android:textAllCaps">true</item> </style> + <style name="TextAppearance.StatusBar.Expanded.Network" parent="@style/TextAppearance.StatusBar.Expanded.Date"> + <item name="android:textColor">#999999</item> + </style> + <style name="Animation" /> <style name="Animation.ShirtPocketPanel"> diff --git a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java b/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java index 1db2a7f..73249b4 100644 --- a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java +++ b/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java @@ -58,8 +58,8 @@ public class DreamsDockLauncher extends Activity { @Override public void onReceive(Context context, Intent intent) { final boolean activateOnDock = 0 != Settings.Secure.getInt( - context.getContentResolver(), - Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, 1); + context.getContentResolver(), + Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, 0); if (!activateOnDock) return; diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java index af88a06..8b8a814 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java @@ -46,10 +46,12 @@ import com.android.systemui.statusbar.tablet.StatusBarPanel; import com.android.systemui.statusbar.tablet.TabletStatusBar; public class SearchPanelView extends FrameLayout implements - StatusBarPanel { - private static final int SEARCH_PANEL_HOLD_DURATION = 500; + StatusBarPanel, ActivityOptions.OnAnimationStartedListener { + private static final int SEARCH_PANEL_HOLD_DURATION = 0; static final String TAG = "SearchPanelView"; static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false; + private static final String ASSIST_ICON_METADATA_NAME = + "com.android.systemui.action_assist_icon"; private final Context mContext; private BaseStatusBar mBar; private StatusBarTouchProxy mStatusBarTouchProxy; @@ -113,18 +115,18 @@ public class SearchPanelView extends FrameLayout implements if (intent == null) return; try { ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, - R.anim.search_launch_enter, R.anim.search_launch_exit); + R.anim.search_launch_enter, R.anim.search_launch_exit, + getHandler(), this); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent, opts.toBundle()); } catch (ActivityNotFoundException e) { Slog.w(TAG, "Activity not found for " + intent.getAction()); + onAnimationStarted(); } } - final MultiWaveView.OnTriggerListener mMultiWaveViewListener - = new MultiWaveView.OnTriggerListener() { - - private boolean mWaitingForLaunch; + class MultiWaveTriggerListener implements MultiWaveView.OnTriggerListener { + boolean mWaitingForLaunch; public void onGrabbed(View v, int handle) { } @@ -145,19 +147,24 @@ public class SearchPanelView extends FrameLayout implements mWaitingForLaunch = true; startAssistActivity(); vibrate(); - postDelayed(new Runnable() { - public void run() { - mWaitingForLaunch = false; - mBar.hideSearchPanel(); - } - }, SEARCH_PANEL_HOLD_DURATION); break; } } public void onFinishFinalAnimation() { } - }; + } + final MultiWaveTriggerListener mMultiWaveViewListener = new MultiWaveTriggerListener(); + + @Override + public void onAnimationStarted() { + postDelayed(new Runnable() { + public void run() { + mMultiWaveViewListener.mWaitingForLaunch = false; + mBar.hideSearchPanel(); + } + }, SEARCH_PANEL_HOLD_DURATION); + } @Override protected void onFinishInflate() { @@ -168,6 +175,21 @@ public class SearchPanelView extends FrameLayout implements // TODO: fetch views mMultiWaveView = (MultiWaveView) findViewById(R.id.multi_wave_view); mMultiWaveView.setOnTriggerListener(mMultiWaveViewListener); + SearchManager searchManager = getSearchManager(); + if (searchManager != null) { + ComponentName component = searchManager.getGlobalSearchActivity(); + if (component != null) { + if (!mMultiWaveView.replaceTargetDrawablesIfPresent(component, + ASSIST_ICON_METADATA_NAME, + com.android.internal.R.drawable.ic_lockscreen_search)) { + Slog.w(TAG, "Couldn't grab icon from component " + component); + } + } else { + Slog.w(TAG, "No search icon specified in component " + component); + } + } else { + Slog.w(TAG, "No SearchManager"); + } } private boolean pointInside(int x, int y, View v) { diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index 1302c1f..f85007e 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -41,7 +41,8 @@ import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter; -import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; public class RecentsHorizontalScrollView extends HorizontalScrollView implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView { @@ -53,7 +54,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView protected int mLastScrollPosition; private SwipeHelper mSwipeHelper; private RecentsScrollViewPerformanceHelper mPerformanceHelper; - private ArrayList<View> mRecycledViews; + private HashSet<View> mRecycledViews; private int mNumItemsInOneScreenful; public RecentsHorizontalScrollView(Context context, AttributeSet attrs) { @@ -62,7 +63,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop(); mSwipeHelper = new SwipeHelper(SwipeHelper.Y, this, densityScale, pagingTouchSlop); mPerformanceHelper = RecentsScrollViewPerformanceHelper.create(context, attrs, this, false); - mRecycledViews = new ArrayList<View>(); + mRecycledViews = new HashSet<View>(); } public void setMinSwipeAlpha(float minAlpha) { @@ -73,26 +74,28 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView return mLinearLayout.getWidth() - getWidth(); } + private void addToRecycledViews(View v) { + if (mRecycledViews.size() < mNumItemsInOneScreenful) { + mRecycledViews.add(v); + } + } + private void update() { for (int i = 0; i < mLinearLayout.getChildCount(); i++) { View v = mLinearLayout.getChildAt(i); - mRecycledViews.add(v); + addToRecycledViews(v); mAdapter.recycleView(v); } LayoutTransition transitioner = getLayoutTransition(); setLayoutTransition(null); mLinearLayout.removeAllViews(); - for (int i = 0; i < mRecycledViews.size(); i++) { - View child = mRecycledViews.get(i); - if (child.getParent() != null) { - throw new RuntimeException("Recycled child has a parent"); - } - } + Iterator<View> recycledViews = mRecycledViews.iterator(); for (int i = 0; i < mAdapter.getCount(); i++) { View old = null; - if (mRecycledViews.size() != 0) { - old = mRecycledViews.remove(mRecycledViews.size() - 1); + if (recycledViews.hasNext()) { + old = recycledViews.next(); + recycledViews.remove(); old.setVisibility(VISIBLE); } @@ -187,11 +190,8 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView } public void onChildDismissed(View v) { - mRecycledViews.add(v); + addToRecycledViews(v); mLinearLayout.removeView(v); - if (v.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } mCallback.handleSwipe(v); // Restore the alpha/translation parameters to what they were before swiping // (for when these items are recycled) @@ -362,16 +362,10 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView child.measure(childWidthMeasureSpec, childheightMeasureSpec); mNumItemsInOneScreenful = (int) FloatMath.ceil(dm.widthPixels / (float) child.getMeasuredWidth()); - mRecycledViews.add(child); - if (child.getParent() != null) { - throw new RuntimeException("First recycled child has parent"); - } + addToRecycledViews(child); for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) { - mRecycledViews.add(mAdapter.createView(mLinearLayout)); - if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } + addToRecycledViews(mAdapter.createView(mLinearLayout)); } } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index 587bfe8..34cd397 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -174,6 +174,13 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = createView(parent); + if (convertView.getParent() != null) { + throw new RuntimeException("Recycled child has parent"); + } + } else { + if (convertView.getParent() != null) { + throw new RuntimeException("Recycled child has parent"); + } } ViewHolder holder = (ViewHolder) convertView.getTag(); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java index 6bd1826..9bc54cb 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java @@ -78,9 +78,10 @@ public class RecentsScrollViewPerformanceHelper { public void addViewCallback(View newLinearLayoutChild) { if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) { - final View view = newLinearLayoutChild; - view.setDrawingCacheEnabled(true); - view.buildDrawingCache(); + final RecentsPanelView.ViewHolder holder = + (RecentsPanelView.ViewHolder) newLinearLayoutChild.getTag(); + holder.labelView.setDrawingCacheEnabled(true); + holder.labelView.buildDrawingCache(); } } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index f682203..d387515 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -41,7 +41,8 @@ import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter; -import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView { @@ -53,7 +54,7 @@ public class RecentsVerticalScrollView extends ScrollView protected int mLastScrollPosition; private SwipeHelper mSwipeHelper; private RecentsScrollViewPerformanceHelper mPerformanceHelper; - private ArrayList<View> mRecycledViews; + private HashSet<View> mRecycledViews; private int mNumItemsInOneScreenful; public RecentsVerticalScrollView(Context context, AttributeSet attrs) { @@ -63,7 +64,7 @@ public class RecentsVerticalScrollView extends ScrollView mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop); mPerformanceHelper = RecentsScrollViewPerformanceHelper.create(context, attrs, this, true); - mRecycledViews = new ArrayList<View>(); + mRecycledViews = new HashSet<View>(); } public void setMinSwipeAlpha(float minAlpha) { @@ -74,36 +75,41 @@ public class RecentsVerticalScrollView extends ScrollView return mLinearLayout.getHeight() - getHeight(); } + private void addToRecycledViews(View v) { + if (mRecycledViews.contains(v)) { + throw new RuntimeException("Child was already recycled"); + } + if (mRecycledViews.size() < mNumItemsInOneScreenful) { + mRecycledViews.add(v); + } + } + private void update() { for (int i = 0; i < mLinearLayout.getChildCount(); i++) { View v = mLinearLayout.getChildAt(i); - mRecycledViews.add(v); + addToRecycledViews(v); mAdapter.recycleView(v); } LayoutTransition transitioner = getLayoutTransition(); setLayoutTransition(null); mLinearLayout.removeAllViews(); - for (int i = 0; i < mRecycledViews.size(); i++) { - View child = mRecycledViews.get(i); - if (child.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } - } + // Once we can clear the data associated with individual item views, // we can get rid of the removeAllViews() and the code below will // recycle them. + Iterator<View> recycledViews = mRecycledViews.iterator(); for (int i = 0; i < mAdapter.getCount(); i++) { View old = null; - if (mRecycledViews.size() != 0) { - old = mRecycledViews.remove(mRecycledViews.size() - 1); + if (recycledViews.hasNext()) { + old = recycledViews.next(); + recycledViews.remove(); old.setVisibility(VISIBLE); + if (old.getParent() != null) { + throw new RuntimeException("Recycled child has parent (i: " + i + ", recycled i: " + mRecycledViews.size()); + } } - final View view = mAdapter.getView(i, old, mLinearLayout); - if (view.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } if (mPerformanceHelper != null) { mPerformanceHelper.addViewCallback(view); @@ -142,9 +148,6 @@ public class RecentsVerticalScrollView extends ScrollView thumbnailView.setClickable(true); thumbnailView.setOnClickListener(launchAppListener); thumbnailView.setOnLongClickListener(longClickListener); - if (view.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } // We don't want to dismiss recents if a user clicks on the app title // (we also don't want to launch the app either, though, because the @@ -154,9 +157,6 @@ public class RecentsVerticalScrollView extends ScrollView appTitle.setOnTouchListener(noOpListener); final View calloutLine = view.findViewById(R.id.recents_callout_line); calloutLine.setOnTouchListener(noOpListener); - if (view.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } mLinearLayout.addView(view); } @@ -203,11 +203,8 @@ public class RecentsVerticalScrollView extends ScrollView } public void onChildDismissed(View v) { - mRecycledViews.add(v); + addToRecycledViews(v); mLinearLayout.removeView(v); - if (v.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } mCallback.handleSwipe(v); // Restore the alpha/translation parameters to what they were before swiping // (for when these items are recycled) @@ -380,16 +377,10 @@ public class RecentsVerticalScrollView extends ScrollView child.measure(childWidthMeasureSpec, childheightMeasureSpec); mNumItemsInOneScreenful = (int) FloatMath.ceil(dm.heightPixels / (float) child.getMeasuredHeight()); - mRecycledViews.add(child); - if (child.getParent() != null) { - throw new RuntimeException("First recycled child has parent"); - } + addToRecycledViews(child); for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) { - mRecycledViews.add(mAdapter.createView(mLinearLayout)); - if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } + addToRecycledViews(mAdapter.createView(mLinearLayout)); } } diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 8795154..c09e4c4 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -188,10 +188,16 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("image/png"); sharingIntent.putExtra(Intent.EXTRA_STREAM, uri); - sharingIntent.setFlags(Intent.FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS); + + Intent chooserIntent = Intent.createChooser(sharingIntent, null); + chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS + | Intent.FLAG_ACTIVITY_CLEAR_TASK + | Intent.FLAG_ACTIVITY_NEW_TASK); + mNotificationBuilder.addAction(R.drawable.ic_menu_share, r.getString(com.android.internal.R.string.share), - PendingIntent.getActivity(context, 0, sharingIntent, 0)); + PendingIntent.getActivity(context, 0, chooserIntent, + PendingIntent.FLAG_CANCEL_CURRENT)); OutputStream out = resolver.openOutputStream(uri); image.compress(Bitmap.CompressFormat.PNG, 100, out); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index f088e0e..cf2690b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -26,6 +26,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager.NameNotFoundException; +import android.database.ContentObserver; import android.graphics.Rect; import android.net.Uri; import android.os.Build; @@ -123,7 +124,7 @@ public abstract class BaseStatusBar extends SystemUI implements protected Display mDisplay; private IWindowManager mWindowManager; - + private boolean mDeviceProvisioned = false; public IWindowManager getWindowManager() { return mWindowManager; @@ -137,10 +138,31 @@ public abstract class BaseStatusBar extends SystemUI implements return mBarService; } + protected boolean isDeviceProvisioned() { + return mDeviceProvisioned; + } + + private ContentObserver mProvisioningObserver = new ContentObserver(new Handler()) { + @Override + public void onChange(boolean selfChange) { + final boolean provisioned = 0 != Settings.Secure.getInt( + mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0); + if (provisioned != mDeviceProvisioned) { + mDeviceProvisioned = provisioned; + updateNotificationIcons(); + } + } + }; + public void start() { mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); + mProvisioningObserver.onChange(false); // set up + mContext.getContentResolver().registerContentObserver( + Settings.Secure.getUriFor(Settings.Secure.DEVICE_PROVISIONED), true, + mProvisioningObserver); + mWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); @@ -754,7 +776,7 @@ public abstract class BaseStatusBar extends SystemUI implements protected abstract boolean shouldDisableNavbarGestures(); protected boolean isTopNotification(ViewGroup parent, NotificationData.Entry entry) { - return parent.indexOfChild(entry.row) == 0; + return parent != null && parent.indexOfChild(entry.row) == 0; } public void updateNotification(IBinder key, StatusBarNotification notification) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/RotationToggle.java b/packages/SystemUI/src/com/android/systemui/statusbar/RotationToggle.java index c5a7354..5dd45a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/RotationToggle.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/RotationToggle.java @@ -6,25 +6,39 @@ import android.widget.CompoundButton; import com.android.systemui.statusbar.policy.AutoRotateController; -public class RotationToggle extends CompoundButton { - AutoRotateController mRotater; +public class RotationToggle extends CompoundButton + implements AutoRotateController.RotationLockCallbacks { + private AutoRotateController mRotater; public RotationToggle(Context context) { super(context); - mRotater = new AutoRotateController(context, this); - setClickable(true); } public RotationToggle(Context context, AttributeSet attrs) { super(context, attrs); - mRotater = new AutoRotateController(context, this); - setClickable(true); } public RotationToggle(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - mRotater = new AutoRotateController(context, this); - setClickable(true); } + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + mRotater = new AutoRotateController(getContext(), this, this); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + if (mRotater != null) { + mRotater.release(); + mRotater = null; + } + } + + @Override + public void setRotationLockControlVisibility(boolean show) { + setVisibility(show ? VISIBLE : GONE); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 3a50560..87e95da 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.phone; import android.animation.Animator; +import android.animation.Animator.AnimatorListener; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; @@ -39,6 +40,7 @@ import android.graphics.PixelFormat; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.graphics.drawable.NinePatchDrawable; import android.inputmethodservice.InputMethodService; import android.os.IBinder; import android.os.Message; @@ -64,6 +66,7 @@ import android.view.WindowManagerImpl; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; @@ -84,6 +87,7 @@ import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.DateView; import com.android.systemui.statusbar.policy.IntruderAlertView; import com.android.systemui.statusbar.policy.LocationController; +import com.android.systemui.statusbar.policy.OnSizeChangedListener; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.NotificationRowLayout; @@ -103,7 +107,8 @@ public class PhoneStatusBar extends BaseStatusBar { public static final String ACTION_STATUSBAR_START = "com.android.internal.policy.statusbar.START"; - private static final boolean DIM_BEHIND_EXPANDED_PANEL = false; + private static final boolean DIM_BEHIND_EXPANDED_PANEL = true; + private static final boolean SHOW_CARRIER_LABEL = true; private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000; private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001; @@ -161,12 +166,18 @@ public class PhoneStatusBar extends BaseStatusBar { View mExpandedContents; int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx; int mNotificationPanelGravity; + int mNotificationPanelMinHeight; // top bar View mClearButton; View mSettingsButton; RotationToggle mRotationButton; + // carrier/wifi label + private TextView mCarrierLabel; + private boolean mCarrierLabelVisible = false; + private int mCarrierLabelHeight; + // drag bar CloseDragHandle mCloseView; private int mCloseViewHeight; @@ -208,6 +219,8 @@ public class PhoneStatusBar extends BaseStatusBar { long mAnimLastTimeNanos; boolean mAnimatingReveal = false; int mViewDelta; + float mFlingVelocity; + int mFlingY; int[] mAbsPos = new int[2]; Runnable mPostCollapseCleanup = null; @@ -226,13 +239,38 @@ public class PhoneStatusBar extends BaseStatusBar { private final Animator.AnimatorListener mMakeIconsInvisible = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - mIcons.setVisibility(View.INVISIBLE); + // double-check to avoid races + if (mIcons.getAlpha() == 0) { + Slog.d(TAG, "makeIconsInvisible"); + mIcons.setVisibility(View.INVISIBLE); + } } }; - private final Animator.AnimatorListener mMakeIconsVisible = new AnimatorListenerAdapter() { + + private final Runnable mStartRevealAnimation = new Runnable() { @Override - public void onAnimationEnd(Animator animation) { - mIcons.setVisibility(View.VISIBLE); + public void run() { + mAnimAccel = mExpandAccelPx; + mAnimVel = mFlingExpandMinVelocityPx; + mAnimY = getStatusBarHeight(); + updateExpandedViewPos((int)mAnimY); + + mAnimating = true; + mAnimatingReveal = true; + resetLastAnimTime(); + mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, + mAnimationCallback, null); + mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, + mRevealAnimationCallback, null); + mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, + mRevealAnimationCallback, null); + } + }; + + private final Runnable mPerformFling = new Runnable() { + @Override + public void run() { + performFling(mFlingY + mViewDelta, mFlingVelocity, false); } }; @@ -321,7 +359,6 @@ public class PhoneStatusBar extends BaseStatusBar { mNotificationPanel.setBackground(new FastColorDrawable(context.getResources().getColor( R.color.notification_panel_solid_background))); } - if (ENABLE_INTRUDERS) { mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null); mIntruderAlertView.setVisibility(View.GONE); @@ -356,6 +393,14 @@ public class PhoneStatusBar extends BaseStatusBar { mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems); mPile.setLongPressListener(getNotificationLongClicker()); + if (SHOW_CARRIER_LABEL) { + mPile.setOnSizeChangedListener(new OnSizeChangedListener() { + @Override + public void onSizeChanged(View view, int w, int h, int oldw, int oldh) { + updateCarrierLabelVisibility(); + } + }); + } mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); @@ -367,6 +412,9 @@ public class PhoneStatusBar extends BaseStatusBar { mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button); mSettingsButton.setOnClickListener(mSettingsButtonListener); mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button); + + mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label); + mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE); mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll); mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns @@ -392,8 +440,17 @@ public class PhoneStatusBar extends BaseStatusBar { mNetworkController = new NetworkController(mContext); final SignalClusterView signalCluster = (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster); + mNetworkController.addSignalCluster(signalCluster); signalCluster.setNetworkController(mNetworkController); + + // for wifi-only devices, we show SSID; otherwise, we show PLMN + if (mNetworkController.hasMobileDataFeature()) { + mNetworkController.addMobileLabelView(mCarrierLabel); + } else { + mNetworkController.addWifiLabelView(mCarrierLabel); + } + // final ImageView wimaxRSSI = // (ImageView)sb.findViewById(R.id.wimax_signal); // if (wimaxRSSI != null) { @@ -428,7 +485,7 @@ public class PhoneStatusBar extends BaseStatusBar { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } else { lp.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND; - lp.dimAmount = 0.7f; + lp.dimAmount = 0.75f; } lp.gravity = Gravity.BOTTOM | Gravity.LEFT; lp.setTitle("RecentsPanel"); @@ -451,9 +508,6 @@ public class PhoneStatusBar extends BaseStatusBar { (opaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT)); if (ActivityManager.isHighEndGfx(mDisplay)) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; - } else { - lp.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND; - lp.dimAmount = 0.7f; } lp.gravity = Gravity.BOTTOM | Gravity.LEFT; lp.setTitle("SearchPanel"); @@ -484,14 +538,7 @@ public class PhoneStatusBar extends BaseStatusBar { @Override public void showSearchPanel() { - // XXX This is a bit of a hack. Since navbar is no longer slippery, we use the - // gesture to dismiss the expanded statusbar. - if (mExpanded) { - animateCollapse(); - return; - } else { - super.showSearchPanel(); - } + super.showSearchPanel(); WindowManager.LayoutParams lp = (android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams(); lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; @@ -752,13 +799,19 @@ public class PhoneStatusBar extends BaseStatusBar { } private void loadNotificationShade() { + if (mPile == null) return; + int N = mNotificationData.size(); ArrayList<View> toShow = new ArrayList<View>(); + final boolean provisioned = isDeviceProvisioned(); + // If the device hasn't been through Setup, we only show system notifications for (int i=0; i<N; i++) { - View row = mNotificationData.get(N-i-1).row; - toShow.add(row); + Entry ent = mNotificationData.get(N-i-1); + if (provisioned || "android".equals(ent.notification.pkg)) { + toShow.add(ent.row); + } } ArrayList<View> toRemove = new ArrayList<View>(); @@ -779,6 +832,8 @@ public class PhoneStatusBar extends BaseStatusBar { mPile.addView(v, i); } } + + mSettingsButton.setEnabled(isDeviceProvisioned()); } private void reloadAllNotificationIcons() { @@ -789,6 +844,8 @@ public class PhoneStatusBar extends BaseStatusBar { @Override protected void updateNotificationIcons() { + if (mNotificationIcons == null) return; + loadNotificationShade(); final LinearLayout.LayoutParams params @@ -802,9 +859,12 @@ public class PhoneStatusBar extends BaseStatusBar { ArrayList<View> toShow = new ArrayList<View>(); + final boolean provisioned = isDeviceProvisioned(); + // If the device hasn't been through Setup, we only show system notifications for (int i=0; i<N; i++) { Entry ent = mNotificationData.get(N-i-1); - if (ent.notification.score >= HIDE_ICONS_BELOW_SCORE) { + if ((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE) + || "android".equals(ent.notification.pkg)) { toShow.add(ent.icon); } } @@ -829,6 +889,45 @@ public class PhoneStatusBar extends BaseStatusBar { } } + protected void updateCarrierLabelVisibility() { + if (!SHOW_CARRIER_LABEL) return; + // The idea here is to only show the carrier label when there is enough room to see it, + // i.e. when there aren't enough notifications to fill the panel. + if (DEBUG) { + Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d", + mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight)); + } + + final boolean makeVisible = + mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight); + + if (mCarrierLabelVisible != makeVisible) { + mCarrierLabelVisible = makeVisible; + if (DEBUG) { + Slog.d(TAG, "making carrier label " + (makeVisible?"visible":"invisible")); + } + mCarrierLabel.animate().cancel(); + if (makeVisible) { + mCarrierLabel.setVisibility(View.VISIBLE); + } + mCarrierLabel.animate() + .alpha(makeVisible ? 1f : 0f) + //.setStartDelay(makeVisible ? 500 : 0) + //.setDuration(makeVisible ? 750 : 100) + .setDuration(150) + .setListener(makeVisible ? null : new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (!mCarrierLabelVisible) { // race + mCarrierLabel.setVisibility(View.INVISIBLE); + mCarrierLabel.setAlpha(0f); + } + } + }) + .start(); + } + } + @Override protected void setAreThereNotifications() { final boolean any = mNotificationData.size() > 0; @@ -886,6 +985,8 @@ public class PhoneStatusBar extends BaseStatusBar { }) .start(); } + + updateCarrierLabelVisibility(); } public void showClock(boolean show) { @@ -935,11 +1036,26 @@ public class PhoneStatusBar extends BaseStatusBar { if ((diff & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) { mIcons.animate().cancel(); if ((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) { - mIcons.animate().alpha(0f).setStartDelay(100).setDuration(200). - setListener(mMakeIconsInvisible).start(); + if (mTicking) { + mTicker.halt(); + } + mIcons.animate() + .alpha(0f) + .translationY(mNaturalBarHeight*0.5f) + //.setStartDelay(100) + .setDuration(175) + .setInterpolator(new DecelerateInterpolator(1.5f)) + .setListener(mMakeIconsInvisible) + .start(); } else { - mIcons.animate().alpha(1f).setStartDelay(0).setDuration(300). - setListener(mMakeIconsVisible).start(); + mIcons.setVisibility(View.VISIBLE); + mIcons.animate() + .alpha(1f) + .translationY(0) + .setStartDelay(0) + .setInterpolator(new DecelerateInterpolator(1.5f)) + .setDuration(175) + .start(); } } @@ -1036,14 +1152,16 @@ public class PhoneStatusBar extends BaseStatusBar { } }; - private void makeExpandedVisible() { + private void makeExpandedVisible(boolean revealAfterDraw) { if (SPEW) Slog.d(TAG, "Make expanded visible: expanded visible=" + mExpandedVisible); if (mExpandedVisible) { return; } mExpandedVisible = true; - mNotificationPanel.setVisibility(View.VISIBLE); + makeSlippery(mNavigationBarView, true); + + updateCarrierLabelVisibility(); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); @@ -1056,9 +1174,28 @@ public class PhoneStatusBar extends BaseStatusBar { final WindowManager wm = WindowManagerImpl.getDefault(); wm.updateViewLayout(mStatusBarWindow, lp); + // Updating the window layout will force an expensive traversal/redraw. + // Kick off the reveal animation after this is complete to avoid animation latency. + if (revealAfterDraw) { + mHandler.post(mStartRevealAnimation); + } + visibilityChanged(true); } + private static void makeSlippery(View view, boolean slippery) { + if (view == null) { + return; + } + WindowManager.LayoutParams lp = (WindowManager.LayoutParams) view.getLayoutParams(); + if (slippery) { + lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY; + } else { + lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY; + } + WindowManagerImpl.getDefault().updateViewLayout(view, lp); + } + public void animateExpand() { if (SPEW) Slog.d(TAG, "Animate expand: expanded=" + mExpanded); if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) { @@ -1128,7 +1265,7 @@ public class PhoneStatusBar extends BaseStatusBar { } mExpanded = true; - makeExpandedVisible(); + makeExpandedVisible(false); updateExpandedViewPos(EXPANDED_FULL_OPEN); if (false) postStartTracing(); @@ -1143,7 +1280,7 @@ public class PhoneStatusBar extends BaseStatusBar { } mExpandedVisible = false; visibilityChanged(false); - mNotificationPanel.setVisibility(View.INVISIBLE); + makeSlippery(mNavigationBarView, false); // Shrink the window to the size of the status bar only WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams(); @@ -1223,6 +1360,8 @@ public class PhoneStatusBar extends BaseStatusBar { } void stopTracking() { + if (!mTracking) + return; mTracking = false; mPile.setLayerType(View.LAYER_TYPE_NONE, null); mVelocityTracker.recycle(); @@ -1247,7 +1386,7 @@ public class PhoneStatusBar extends BaseStatusBar { if (SPEW) { Slog.d(TAG, "doRevealAnimation: dt=" + (frameTimeNanos - mAnimLastTimeNanos)); } - final int h = getCloseViewHeight() + getStatusBarHeight(); + final int h = mNotificationPanelMinHeight; if (mAnimatingReveal && mAnimating && mAnimY < h) { incrementAnim(frameTimeNanos); if (mAnimY >= h) { @@ -1272,20 +1411,7 @@ public class PhoneStatusBar extends BaseStatusBar { mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null); mVelocityTracker = VelocityTracker.obtain(); if (opening) { - mAnimAccel = mExpandAccelPx; - mAnimVel = mFlingExpandMinVelocityPx; - mAnimY = getStatusBarHeight(); - updateExpandedViewPos((int)mAnimY); - mAnimating = true; - mAnimatingReveal = true; - resetLastAnimTime(); - mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, - mAnimationCallback, null); - mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, - mRevealAnimationCallback, null); - mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, - mRevealAnimationCallback, null); - makeExpandedVisible(); + makeExpandedVisible(true); } else { // it's open, close it? if (mAnimating) { @@ -1299,7 +1425,7 @@ public class PhoneStatusBar extends BaseStatusBar { void performFling(int y, float vel, boolean always) { if (CHATTY) { - Slog.d(TAG, "panel: will fling, y=" + y + " vel=" + vel); + Slog.d(TAG, "panel: will fling, y=" + y + " vel=" + vel + " mExpanded=" + mExpanded); } mAnimatingReveal = false; @@ -1368,7 +1494,7 @@ public class PhoneStatusBar extends BaseStatusBar { boolean interceptTouchEvent(MotionEvent event) { if (SPEW) { Slog.d(TAG, "Touch: rawY=" + event.getRawY() + " event=" + event + " mDisabled=" - + mDisabled); + + mDisabled + " mTracking=" + mTracking); } else if (CHATTY) { if (event.getAction() != MotionEvent.ACTION_MOVE) { Slog.d(TAG, String.format( @@ -1413,9 +1539,8 @@ public class PhoneStatusBar extends BaseStatusBar { } } else if (mTracking) { trackMovement(event); - final int minY = statusBarSize + getCloseViewHeight(); if (action == MotionEvent.ACTION_MOVE) { - if (mAnimatingReveal && (y + mViewDelta) < minY) { + if (mAnimatingReveal && (y + mViewDelta) < mNotificationPanelMinHeight) { // nothing } else { mAnimatingReveal = false; @@ -1449,7 +1574,15 @@ public class PhoneStatusBar extends BaseStatusBar { vel)); } - performFling(y + mViewDelta, vel, false); + if (mTrackingPosition == mNotificationPanelMinHeight) { + // start the fling from the tracking position, ignore y and view delta + mFlingY = mTrackingPosition; + mViewDelta = 0; + } else { + mFlingY = y; + } + mFlingVelocity = vel; + mHandler.post(mPerformFling); } } @@ -1652,6 +1785,9 @@ public class PhoneStatusBar extends BaseStatusBar { // no ticking in lights-out mode if (!areLightsOn()) return; + // no ticking in Setup + if (!isDeviceProvisioned()) return; + // Show the ticker if one is requested. Also don't do this // until status bar window is attached to the window manager, // because... well, what's the point otherwise? And trying to @@ -1849,7 +1985,6 @@ public class PhoneStatusBar extends BaseStatusBar { + " mTrackingPosition=" + mTrackingPosition + " gravity=" + mNotificationPanelGravity); } - int panelh = 0; final int disph = getExpandedViewMaxHeight(); @@ -1883,6 +2018,8 @@ public class PhoneStatusBar extends BaseStatusBar { panelh = 0; } + if (panelh == mTrackingPosition) return; + mTrackingPosition = panelh; FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams(); @@ -1894,13 +2031,17 @@ public class PhoneStatusBar extends BaseStatusBar { } mNotificationPanel.setLayoutParams(lp); + final int barh = getCloseViewHeight() + getStatusBarHeight(); + final float frac = saturate((float)(panelh - barh) / (disph - barh)); + if (DIM_BEHIND_EXPANDED_PANEL && ActivityManager.isHighEndGfx(mDisplay)) { // woo, special effects - final int barh = getCloseViewHeight() + getStatusBarHeight(); - final float frac = saturate((float)(panelh - barh) / (disph - barh)); - final int color = ((int)(0xB0 * Math.sin(frac * 1.57f))) << 24; + final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2.2f)))); + final int color = ((int)(0xB0 * k)) << 24; mStatusBarWindow.setBackgroundColor(color); } + + updateCarrierLabelVisibility(); } void updateDisplaySize() { @@ -2020,6 +2161,9 @@ public class PhoneStatusBar extends BaseStatusBar { private View.OnClickListener mSettingsButtonListener = new View.OnClickListener() { public void onClick(View v) { + // We take this as a good indicator that Setup is running and we shouldn't + // allow you to go somewhere else + if (!isDeviceProvisioned()) return; try { // Dismiss the lock screen when Settings starts. ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity(); @@ -2132,10 +2276,28 @@ public class PhoneStatusBar extends BaseStatusBar { if (mNotificationPanelGravity <= 0) { mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP; } + final int notificationPanelDecorationHeight = + res.getDimensionPixelSize(R.dimen.notification_panel_padding_top) + + res.getDimensionPixelSize(R.dimen.notification_panel_header_height) + + getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg)).bottom; + mNotificationPanelMinHeight = + notificationPanelDecorationHeight + + res.getDimensionPixelSize(R.dimen.close_handle_underlap); + + mCarrierLabelHeight = res.getDimensionPixelSize(R.dimen.carrier_label_height); if (false) Slog.v(TAG, "updateResources"); } + private static Rect getNinePatchPadding(Drawable d) { + Rect padding = new Rect(); + if (d instanceof NinePatchDrawable) { + NinePatchDrawable ninePatch = (NinePatchDrawable) d; + ninePatch.getPadding(padding); + } + return padding; + } + // // tracing // diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java index 3d63781..109395c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java @@ -16,80 +16,60 @@ package com.android.systemui.statusbar.policy; -import android.content.ContentResolver; +import com.android.internal.view.RotationPolicy; + import android.content.Context; -import android.database.ContentObserver; -import android.os.AsyncTask; -import android.os.Handler; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.provider.Settings; -import android.util.Log; -import android.view.IWindowManager; import android.widget.CompoundButton; -public class AutoRotateController implements CompoundButton.OnCheckedChangeListener { - private static final String TAG = "StatusBar.AutoRotateController"; - +public final class AutoRotateController implements CompoundButton.OnCheckedChangeListener { private final Context mContext; private final CompoundButton mCheckbox; + private final RotationLockCallbacks mCallbacks; private boolean mAutoRotation; - private ContentObserver mAccelerometerRotationObserver = new ContentObserver(new Handler()) { + private final RotationPolicy.RotationPolicyListener mRotationPolicyListener = + new RotationPolicy.RotationPolicyListener() { @Override - public void onChange(boolean selfChange) { - updateCheckbox(); + public void onChange() { + updateState(); } }; - public AutoRotateController(Context context, CompoundButton checkbox) { + public AutoRotateController(Context context, CompoundButton checkbox, + RotationLockCallbacks callbacks) { mContext = context; mCheckbox = checkbox; - updateCheckbox(); + mCallbacks = callbacks; + mCheckbox.setOnCheckedChangeListener(this); - mContext.getContentResolver().registerContentObserver( - Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION), true, - mAccelerometerRotationObserver); + RotationPolicy.registerRotationPolicyListener(context, mRotationPolicyListener); + updateState(); } public void onCheckedChanged(CompoundButton view, boolean checked) { if (checked != mAutoRotation) { - setAutoRotation(checked); + mAutoRotation = checked; + RotationPolicy.setRotationLock(mContext, !checked); } } public void release() { - mContext.getContentResolver().unregisterContentObserver(mAccelerometerRotationObserver); + RotationPolicy.unregisterRotationPolicyListener(mContext, + mRotationPolicyListener); } - private void updateCheckbox() { - mAutoRotation = getAutoRotation(); + private void updateState() { + mAutoRotation = !RotationPolicy.isRotationLocked(mContext); mCheckbox.setChecked(mAutoRotation); - } - private boolean getAutoRotation() { - ContentResolver cr = mContext.getContentResolver(); - return 0 != Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); + boolean visible = RotationPolicy.isRotationLockToggleVisible(mContext); + mCallbacks.setRotationLockControlVisibility(visible); + mCheckbox.setEnabled(visible); } - private void setAutoRotation(final boolean autorotate) { - mAutoRotation = autorotate; - AsyncTask.execute(new Runnable() { - public void run() { - try { - IWindowManager wm = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); - if (autorotate) { - wm.thawRotation(); - } else { - wm.freezeRotation(-1); - } - } catch (RemoteException exc) { - Log.w(TAG, "Unable to save auto-rotate setting"); - } - } - }); + public interface RotationLockCallbacks { + void setRotationLockControlVisibility(boolean show); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index 584a69e4..b8f6054 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -127,6 +127,7 @@ public class NetworkController extends BroadcastReceiver { private static final int INET_CONDITION_THRESHOLD = 50; private boolean mAirplaneMode = false; + private boolean mLastAirplaneMode = true; // our ui Context mContext; @@ -236,6 +237,10 @@ public class NetworkController extends BroadcastReceiver { mBatteryStats = BatteryStatsService.getService(); } + public boolean hasMobileDataFeature() { + return mHasMobileDataFeature; + } + public void addPhoneSignalIconView(ImageView v) { mPhoneSignalIconViews.add(v); } @@ -1048,6 +1053,9 @@ public class NetworkController extends BroadcastReceiver { + Integer.toHexString(combinedSignalIconId) + "/" + getResourceName(combinedSignalIconId) + " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId) + + " mobileLabel=" + mobileLabel + + " wifiLabel=" + wifiLabel + + " combinedLabel=" + combinedLabel + " mAirplaneMode=" + mAirplaneMode + " mDataActivity=" + mDataActivity + " mPhoneSignalIconId=0x" + Integer.toHexString(mPhoneSignalIconId) @@ -1062,7 +1070,8 @@ public class NetworkController extends BroadcastReceiver { || mLastDataDirectionOverlayIconId != combinedActivityIconId || mLastWifiIconId != mWifiIconId || mLastWimaxIconId != mWimaxIconId - || mLastDataTypeIconId != mDataTypeIconId) + || mLastDataTypeIconId != mDataTypeIconId + || mLastAirplaneMode != mAirplaneMode) { // NB: the mLast*s will be updated later for (SignalCluster cluster : mSignalClusters) { @@ -1070,6 +1079,10 @@ public class NetworkController extends BroadcastReceiver { } } + if (mLastAirplaneMode != mAirplaneMode) { + mLastAirplaneMode = mAirplaneMode; + } + // the phone icon on phones if (mLastPhoneSignalIconId != mPhoneSignalIconId) { mLastPhoneSignalIconId = mPhoneSignalIconId; @@ -1188,11 +1201,11 @@ public class NetworkController extends BroadcastReceiver { N = mWifiLabelViews.size(); for (int i=0; i<N; i++) { TextView v = mWifiLabelViews.get(i); + v.setText(wifiLabel); if ("".equals(wifiLabel)) { v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); - v.setText(wifiLabel); } } @@ -1200,11 +1213,11 @@ public class NetworkController extends BroadcastReceiver { N = mMobileLabelViews.size(); for (int i=0; i<N; i++) { TextView v = mMobileLabelViews.get(i); + v.setText(mobileLabel); if ("".equals(mobileLabel)) { v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); - v.setText(mobileLabel); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java index 0284644..42db8cf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java @@ -44,7 +44,7 @@ import java.util.HashMap; public class NotificationRowLayout extends LinearLayout - implements SwipeHelper.Callback, ExpandHelper.Callback + implements SwipeHelper.Callback, ExpandHelper.Callback { private static final String TAG = "NotificationRowLayout"; private static final boolean DEBUG = false; @@ -61,6 +61,8 @@ public class NotificationRowLayout HashMap<View, ValueAnimator> mDisappearingViews = new HashMap<View, ValueAnimator>(); private SwipeHelper mSwipeHelper; + + private OnSizeChangedListener mOnSizeChangedListener; // Flag set during notification removal animation to avoid causing too much work until // animation is done @@ -101,6 +103,10 @@ public class NotificationRowLayout mSwipeHelper.setLongPressListener(listener); } + public void setOnSizeChangedListener(OnSizeChangedListener l) { + mOnSizeChangedListener = l; + } + @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); @@ -247,4 +253,11 @@ public class NotificationRowLayout c.restore(); } } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + if (mOnSizeChangedListener != null) { + mOnSizeChangedListener.onSizeChanged(this, w, h, oldw, oldh); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/OnSizeChangedListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/OnSizeChangedListener.java new file mode 100644 index 0000000..0377123 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/OnSizeChangedListener.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 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. + */ + +package com.android.systemui.statusbar.policy; + +import android.view.View; + +public interface OnSizeChangedListener { + void onSizeChanged(View view, int w, int h, int oldw, int oldh); +} 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 46ea940..537ff66 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java @@ -43,6 +43,8 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { AutoRotateController mRotate; BrightnessController mBrightness; DoNotDisturbController mDoNotDisturb; + View mRotationLockContainer; + View mRotationLockSeparator; public SettingsView(Context context, AttributeSet attrs) { this(context, attrs, 0); @@ -61,8 +63,19 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { mAirplane = new AirplaneModeController(context, (CompoundButton)findViewById(R.id.airplane_checkbox)); findViewById(R.id.network).setOnClickListener(this); + + mRotationLockContainer = findViewById(R.id.rotate); + mRotationLockSeparator = findViewById(R.id.rotate_separator); mRotate = new AutoRotateController(context, - (CompoundButton)findViewById(R.id.rotate_checkbox)); + (CompoundButton)findViewById(R.id.rotate_checkbox), + new AutoRotateController.RotationLockCallbacks() { + @Override + public void setRotationLockControlVisibility(boolean show) { + mRotationLockContainer.setVisibility(show ? View.VISIBLE : View.GONE); + mRotationLockSeparator.setVisibility(show ? View.VISIBLE : View.GONE); + } + }); + mBrightness = new BrightnessController(context, (ToggleSlider)findViewById(R.id.brightness)); mDoNotDisturb = new DoNotDisturbController(context, |