summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/layout/status_bar_expanded.xml212
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java (renamed from packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java)117
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ExpandedView.java56
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java278
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingView.java73
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java201
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java68
10 files changed, 372 insertions, 647 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index cd4e37c..2764f79 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -18,116 +18,142 @@
*/
-->
-<com.android.systemui.statusbar.phone.ExpandedView
+<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:orientation="vertical"
android:focusable="true"
android:descendantFocusability="afterDescendants"
>
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="52dp"
- android:paddingTop="3dp"
- android:paddingBottom="5dp"
- android:paddingRight="3dp"
- android:background="@drawable/notification_header_bg"
- >
- <com.android.systemui.statusbar.policy.DateView android:id="@+id/date"
- android:textAppearance="@style/TextAppearance.StatusBar.Date"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentLeft="true"
- android:singleLine="true"
- android:gravity="center_vertical|left"
- android:paddingLeft="16dp"
- />
- <!--
- <com.android.systemui.statusbar.phone.CarrierLabel
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginTop="1dp"
- android:layout_marginLeft="5dp"
- android:layout_gravity="center_vertical"
- android:paddingBottom="1dp"
- android:paddingLeft="4dp"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textColor="?android:attr/textColorSecondary"
- />
- -->
-
- <ImageView android:id="@+id/settings_button"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_toRightOf="@id/date"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
- android:src="@drawable/ic_notify_quicksettings"
- android:contentDescription="@string/accessibility_settings_button"
- />
-
- <ImageView android:id="@+id/clear_all_button"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentRight="true"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
- android:src="@drawable/ic_notify_clear"
- android:contentDescription="@string/accessibility_clear_all"
- />
- </RelativeLayout>
-
- <View
- android:layout_width="match_parent"
- android:layout_height="2dp"
- android:background="@drawable/status_bar_hr"
- />
-
- <FrameLayout
- android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
+ android:orientation="vertical"
+ android:id="@+id/notification_panel"
+ android:background="@drawable/notification_tracking_bg"
+ android:paddingTop="@*android:dimen/status_bar_height"
>
- <TextView android:id="@+id/noNotificationsTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Large"
- android:padding="8dp"
- android:layout_gravity="top"
- android:gravity="left"
- android:text="@string/status_bar_no_notifications_title"
- />
- <ScrollView
- android:id="@+id/scroll"
+ <RelativeLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fadingEdge="none"
- android:overScrollMode="ifContentScrolls"
+ android:layout_height="52dp"
+ android:paddingTop="3dp"
+ android:paddingBottom="5dp"
+ android:paddingRight="3dp"
+ android:background="@drawable/notification_header_bg"
>
- <LinearLayout
+ <com.android.systemui.statusbar.policy.DateView android:id="@+id/date"
+ android:textAppearance="@style/TextAppearance.StatusBar.Date"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_alignParentLeft="true"
+ android:singleLine="true"
+ android:gravity="center_vertical|left"
+ android:paddingLeft="16dp"
+ />
+ <!--
+ <com.android.systemui.statusbar.phone.CarrierLabel
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginTop="1dp"
+ android:layout_marginLeft="5dp"
+ android:layout_gravity="center_vertical"
+ android:paddingBottom="1dp"
+ android:paddingLeft="4dp"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorSecondary"
+ />
+ -->
+
+ <ImageView android:id="@+id/settings_button"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_toRightOf="@id/date"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:src="@drawable/ic_notify_quicksettings"
+ android:contentDescription="@string/accessibility_settings_button"
+ />
+
+ <ImageView android:id="@+id/clear_all_button"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_alignParentRight="true"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:src="@drawable/ic_notify_clear"
+ android:contentDescription="@string/accessibility_clear_all"
+ />
+ </RelativeLayout>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="2dp"
+ android:background="@drawable/status_bar_hr"
+ />
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ >
+ <TextView android:id="@+id/noNotificationsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
+ android:textAppearance="@android:style/TextAppearance.Large"
+ android:padding="8dp"
+ android:layout_gravity="top"
+ android:gravity="left"
+ android:text="@string/status_bar_no_notifications_title"
+ />
+
+ <ScrollView
+ android:id="@+id/scroll"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fadingEdge="none"
+ android:overScrollMode="ifContentScrolls"
>
- <com.android.systemui.statusbar.policy.NotificationRowLayout
- android:id="@+id/latestItems"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- systemui:rowHeight="@dimen/notification_height"
- />
-
- </LinearLayout>
- </ScrollView>
+ android:orientation="vertical"
+ >
+ <com.android.systemui.statusbar.policy.NotificationRowLayout
+ android:id="@+id/latestItems"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ systemui:rowHeight="@dimen/notification_height"
+ />
+
+ </LinearLayout>
+ </ScrollView>
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:src="@drawable/title_bar_shadow"
+ android:scaleType="fitXY"
+ />
+
+ </FrameLayout>
- <ImageView
+ <com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:src="@drawable/title_bar_shadow"
- android:scaleType="fitXY"
- />
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ >
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:scaleType="fitXY"
+ android:src="@drawable/status_bar_close_on"
+ />
+
+ </com.android.systemui.statusbar.phone.CloseDragHandle>
+
+ </LinearLayout><!-- end of sliding panel -->
- </FrameLayout>
-</com.android.systemui.statusbar.phone.ExpandedView>
+</FrameLayout><!-- end of window --> \ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 61aaa43..66cb32c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -54,7 +54,7 @@ import android.widget.ScrollView;
import android.widget.TextView;
import com.android.systemui.R;
-import com.android.systemui.statusbar.StatusBar;
+import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.tablet.StatusBarPanel;
import com.android.systemui.statusbar.tablet.TabletStatusBar;
@@ -66,7 +66,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
static final String TAG = "RecentsPanelView";
static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
private Context mContext;
- private StatusBar mBar;
+ private BaseStatusBar mBar;
private View mRecentsScrim;
private View mRecentsNoApps;
private ViewGroup mRecentsContainer;
@@ -379,7 +379,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
return mShowing;
}
- public void setBar(StatusBar bar) {
+ public void setBar(BaseStatusBar bar) {
mBar = bar;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 2be35b7..36d9316 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -16,60 +16,75 @@
package com.android.systemui.statusbar;
-import android.app.ActivityManager;
-import android.app.Service;
+import java.util.ArrayList;
+
import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.graphics.PixelFormat;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.util.Slog;
import android.util.Log;
+import android.util.Slog;
import android.view.Display;
-import android.view.Gravity;
+import android.view.IWindowManager;
import android.view.View;
-import android.view.ViewGroup;
import android.view.WindowManager;
-import android.view.WindowManagerImpl;
-
-import java.util.ArrayList;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
import com.android.internal.statusbar.StatusBarNotification;
-
import com.android.systemui.SystemUI;
+import com.android.systemui.statusbar.CommandQueue;
+
import com.android.systemui.R;
-public abstract class StatusBar extends SystemUI implements CommandQueue.Callbacks {
+public abstract class BaseStatusBar extends SystemUI implements CommandQueue.Callbacks {
static final String TAG = "StatusBar";
- private static final boolean SPEW = false;
+ private static final boolean DEBUG = false;
protected CommandQueue mCommandQueue;
protected IStatusBarService mBarService;
- // Up-call methods
- protected abstract View makeStatusBarView();
- protected abstract int getStatusBarGravity();
- public abstract int getStatusBarHeight();
- public abstract void animateCollapse();
+ // UI-specific methods
+
+ /**
+ * Create all windows necessary for the status bar (including navigation, overlay panels, etc)
+ * and add them to the window manager.
+ */
+ protected abstract void createAndAddWindows();
+
+ protected Display mDisplay;
+ private IWindowManager mWindowManager;
- private DoNotDisturb mDoNotDisturb;
+
+ public IWindowManager getWindowManager() {
+ return mWindowManager;
+ }
+
+ public Display getDisplay() {
+ return mDisplay;
+ }
+
+ public IStatusBarService getStatusBarService() {
+ return mBarService;
+ }
public void start() {
- // First set up our views and stuff.
- View sb = makeStatusBarView();
+ mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
+ .getDefaultDisplay();
+
+ mWindowManager = IWindowManager.Stub.asInterface(
+ ServiceManager.getService(Context.WINDOW_SERVICE));
+
+ mBarService = IStatusBarService.Stub.asInterface(
+ ServiceManager.getService(Context.STATUS_BAR_SERVICE));
// Connect in to the status bar manager service
StatusBarIconList iconList = new StatusBarIconList();
ArrayList<IBinder> notificationKeys = new ArrayList<IBinder>();
ArrayList<StatusBarNotification> notifications = new ArrayList<StatusBarNotification>();
mCommandQueue = new CommandQueue(this, iconList);
- mBarService = IStatusBarService.Stub.asInterface(
- ServiceManager.getService(Context.STATUS_BAR_SERVICE));
+
int[] switches = new int[7];
ArrayList<IBinder> binders = new ArrayList<IBinder>();
try {
@@ -78,6 +93,8 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
} catch (RemoteException ex) {
// If the system process isn't there we're doomed anyway.
}
+
+ createAndAddWindows();
disable(switches[0]);
setSystemUiVisibility(switches[1]);
@@ -108,50 +125,18 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
+ " notifications=" + notifications.size());
}
- // Put up the view
- final int height = getStatusBarHeight();
-
- final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- height,
- WindowManager.LayoutParams.TYPE_STATUS_BAR,
- WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
- // We use a pixel format of RGB565 for the status bar to save memory bandwidth and
- // to ensure that the layer can be handled by HWComposer. On some devices the
- // HWComposer is unable to handle SW-rendered RGBX_8888 layers.
- PixelFormat.RGB_565);
-
- // the status bar should be in an overlay if possible
- final Display defaultDisplay
- = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
- .getDefaultDisplay();
-
- // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies
- // very little screen real-estate and is updated fairly frequently. By using CPU rendering
- // for the status bar, we prevent the GPU from having to wake up just to do these small
- // updates, which should help keep power consumption down.
-
- lp.gravity = getStatusBarGravity();
- lp.setTitle("StatusBar");
- lp.packageName = mContext.getPackageName();
- lp.windowAnimations = R.style.Animation_StatusBar;
- WindowManagerImpl.getDefault().addView(sb, lp);
-
- if (SPEW) {
- Slog.d(TAG, "Added status bar view: gravity=0x" + Integer.toHexString(lp.gravity)
- + " icons=" + iconList.size()
- + " disabled=0x" + Integer.toHexString(switches[0])
- + " lights=" + switches[1]
- + " menu=" + switches[2]
- + " imeButton=" + switches[3]
- );
+ if (DEBUG) {
+ Slog.d(TAG, String.format(
+ "init: icons=%d disabled=0x%08x lights=0x%08x menu=0x%08x imeButton=0x%08x",
+ iconList.size(),
+ switches[0],
+ switches[1],
+ switches[2],
+ switches[3]
+ ));
}
-
- mDoNotDisturb = new DoNotDisturb(mContext);
}
-
+
protected View updateNotificationVetoButton(View row, StatusBarNotification n) {
View vetoButton = row.findViewById(R.id.veto);
if (n.isClearable()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 8228df5..6a9e838 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -119,7 +119,7 @@ public class StatusBarIconView extends AnimatedImageView {
if (!iconEquals) {
Drawable drawable = getIcon(icon);
if (drawable == null) {
- Slog.w(StatusBar.TAG, "No icon for slot " + mSlot);
+ Slog.w(TAG, "No icon for slot " + mSlot);
return false;
}
setImageDrawable(drawable);
@@ -167,7 +167,7 @@ public class StatusBarIconView extends AnimatedImageView {
try {
r = context.getPackageManager().getResourcesForApplication(icon.iconPackage);
} catch (PackageManager.NameNotFoundException ex) {
- Slog.e(StatusBar.TAG, "Icon package not found: " + icon.iconPackage);
+ Slog.e(TAG, "Icon package not found: " + icon.iconPackage);
return null;
}
} else {
@@ -181,7 +181,7 @@ public class StatusBarIconView extends AnimatedImageView {
try {
return r.getDrawable(icon.iconId);
} catch (RuntimeException e) {
- Slog.w(StatusBar.TAG, "Icon not found in "
+ Slog.w(TAG, "Icon not found in "
+ (icon.iconPackage != null ? icon.iconId : "<system>")
+ ": " + Integer.toHexString(icon.iconId));
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ExpandedView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ExpandedView.java
deleted file mode 100644
index 2d3ecae..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ExpandedView.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2008 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.phone;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.util.Slog;
-import android.widget.LinearLayout;
-
-public class ExpandedView extends LinearLayout {
- PhoneStatusBar mService;
- int mPrevHeight = -1;
-
- public ExpandedView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- }
-
- /** We want to shrink down to 0, and ignore the background. */
- @Override
- public int getSuggestedMinimumHeight() {
- return 0;
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- int height = bottom - top;
- if (height != mPrevHeight) {
- if (PhoneStatusBar.DEBUG) {
- Slog.d(PhoneStatusBar.TAG, "ExpandedView height changed old=" + mPrevHeight
- + " new=" + height);
- }
- mPrevHeight = height;
- mService.updateExpandedViewPos(PhoneStatusBar.EXPANDED_LEAVE_ALONE);
- }
- }
-}
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 2e1f120..6930787 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -81,7 +81,7 @@ import com.android.systemui.recent.RecentTasksLoader;
import com.android.systemui.recent.RecentsPanelView;
import com.android.systemui.recent.TaskDescription;
import com.android.systemui.statusbar.NotificationData;
-import com.android.systemui.statusbar.StatusBar;
+import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.SignalClusterView;
import com.android.systemui.statusbar.policy.DateView;
@@ -90,10 +90,10 @@ import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NotificationRowLayout;
-public class PhoneStatusBar extends StatusBar {
+public class PhoneStatusBar extends BaseStatusBar {
static final String TAG = "PhoneStatusBar";
public static final boolean DEBUG = false;
- public static final boolean SPEW = false;
+ public static final boolean SPEW = true;
public static final boolean DUMPTRUCK = true; // extra dumpsys info
// additional instrumentation for testing purposes; intended to be left on during development
@@ -160,8 +160,9 @@ public class PhoneStatusBar extends StatusBar {
// expanded notifications
Dialog mExpandedDialog;
- ExpandedView mExpandedView;
WindowManager.LayoutParams mExpandedParams;
+ View mExpandedWindowView;
+ View mNotificationPanel; // the sliding panel within the notification window
ScrollView mScrollView;
View mExpandedContents;
// top bar
@@ -191,8 +192,6 @@ public class PhoneStatusBar extends StatusBar {
private NavigationBarView mNavigationBarView = null;
// the tracker view
- TrackingView mTrackingView;
- WindowManager.LayoutParams mTrackingParams;
int mTrackingPosition; // the position of the top of the tracking view.
private boolean mPanelSlightlyVisible;
@@ -266,7 +265,7 @@ public class PhoneStatusBar extends StatusBar {
mWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
- super.start(); // calls makeStatusBarView()
+ super.start(); // calls createAndAddWindows()
addNavigationBar();
@@ -289,12 +288,12 @@ public class PhoneStatusBar extends StatusBar {
mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
- ExpandedView expanded = (ExpandedView)View.inflate(context,
+ final View expanded = mExpandedWindowView = View.inflate(context,
R.layout.status_bar_expanded, null);
if (DEBUG) {
expanded.setBackgroundColor(0x6000FF80);
}
- expanded.mService = this;
+ mNotificationPanel = expanded.findViewById(R.id.notification_panel);
mIntruderAlertView = View.inflate(context, R.layout.intruder_alert, null);
mIntruderAlertView.setVisibility(View.GONE);
@@ -327,7 +326,6 @@ public class PhoneStatusBar extends StatusBar {
mTickerView = sb.findViewById(R.id.ticker);
mExpandedDialog = new ExpandedDialog(context);
- mExpandedView = expanded;
mPile = (NotificationRowLayout)expanded.findViewById(R.id.latestItems);
mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle);
@@ -347,9 +345,7 @@ public class PhoneStatusBar extends StatusBar {
TickerView tickerView = (TickerView)sb.findViewById(R.id.tickerText);
tickerView.mTicker = mTicker;
- mTrackingView = (TrackingView)View.inflate(context, R.layout.status_bar_tracking, null);
- mTrackingView.mService = this;
- mCloseView = (CloseDragHandle)mTrackingView.findViewById(R.id.close);
+ mCloseView = (CloseDragHandle)mExpandedWindowView.findViewById(R.id.close);
mCloseView.mService = this;
mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);
@@ -991,6 +987,7 @@ public class PhoneStatusBar extends StatusBar {
}
public void showClock(boolean show) {
+ if (mStatusBarView == null) return;
View clock = mStatusBarView.findViewById(R.id.clock);
if (clock != null) {
clock.setVisibility(show ? View.VISIBLE : View.GONE);
@@ -1128,6 +1125,7 @@ public class PhoneStatusBar extends StatusBar {
if (mExpandedVisible) {
return;
}
+ mExpandedDialog.show(); // XXX HAX
mExpandedVisible = true;
visibilityChanged(true);
@@ -1138,8 +1136,8 @@ public class PhoneStatusBar extends StatusBar {
Slog.d(TAG, "makeExpandedVisible: expanded params = " + mExpandedParams);
}
mExpandedDialog.getWindow().setAttributes(mExpandedParams);
- mExpandedView.requestFocus(View.FOCUS_FORWARD);
- mTrackingView.setVisibility(View.VISIBLE);
+ mExpandedWindowView.requestFocus(View.FOCUS_FORWARD);
+ mExpandedWindowView.setVisibility(View.VISIBLE);
}
public void animateExpand() {
@@ -1223,7 +1221,8 @@ public class PhoneStatusBar extends StatusBar {
mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
mExpandedDialog.getWindow().setAttributes(mExpandedParams);
- mTrackingView.setVisibility(View.GONE);
+ mExpandedDialog.hide(); // XXX HAX
+ mExpandedWindowView.setVisibility(View.GONE);
if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) {
setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in);
@@ -1427,8 +1426,8 @@ public class PhoneStatusBar extends StatusBar {
if (!mExpanded) {
mViewDelta = statusBarSize - y;
} else {
- mTrackingView.getLocationOnScreen(mAbsPos);
- mViewDelta = mAbsPos[1] + mTrackingView.getHeight() - y;
+// mCloseView.getLocationOnScreen(mAbsPos)...?
+// mViewDelta = mAbsPos[1] + mTrackingView.getHeight() - y;
}
if ((!mExpanded && y < hitSize) ||
(mExpanded && y > (mDisplayMetrics.heightPixels-hitSize))) {
@@ -1733,10 +1732,8 @@ public class PhoneStatusBar extends StatusBar {
+ " mViewDelta=" + mViewDelta);
pw.println(" mDisplayMetrics=" + mDisplayMetrics);
pw.println(" mExpandedParams: " + mExpandedParams);
- pw.println(" mExpandedView: " + viewInfo(mExpandedView));
+ pw.println(" mExpandedView: " + viewInfo(mExpandedWindowView));
pw.println(" mExpandedDialog: " + mExpandedDialog);
- pw.println(" mTrackingParams: " + mTrackingParams);
- pw.println(" mTrackingView: " + viewInfo(mTrackingView));
pw.println(" mPile: " + viewInfo(mPile));
pw.println(" mNoNotificationsTitle: " + viewInfo(mNoNotificationsTitle));
pw.println(" mCloseView: " + viewInfo(mCloseView));
@@ -1784,17 +1781,11 @@ public class PhoneStatusBar extends StatusBar {
+ mStatusBarView.getHeight());
mStatusBarView.debug();
- mExpandedView.getLocationOnScreen(mAbsPos);
+ mExpandedWindowView.getLocationOnScreen(mAbsPos);
Slog.d(TAG, "mExpandedView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
- + ") " + mExpandedView.getWidth() + "x"
- + mExpandedView.getHeight());
- mExpandedView.debug();
-
- mTrackingView.getLocationOnScreen(mAbsPos);
- Slog.d(TAG, "mTrackingView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
- + ") " + mTrackingView.getWidth() + "x"
- + mTrackingView.getHeight());
- mTrackingView.debug();
+ + ") " + mExpandedWindowView.getWidth() + "x"
+ + mExpandedWindowView.getHeight());
+ mExpandedWindowView.debug();
}
});
}
@@ -1803,44 +1794,47 @@ public class PhoneStatusBar extends StatusBar {
mNetworkController.dump(fd, pw, args);
}
- void onBarViewAttached() {
- // The status bar has just been attached to the view hierarchy; it's possible that the
- // screen has rotated in-between when we set up the window and now, so let's double-check
- // the display metrics just in case.
- updateDisplaySize();
+ @Override
+ public void createAndAddWindows() {
+ addStatusBarWindow();
+ addExpandedWindow();
+ }
+
+ private void addStatusBarWindow() {
+ // Put up the view
+ final int height = getStatusBarHeight();
- WindowManager.LayoutParams lp;
- int pixelFormat;
- Drawable bg;
+ final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ height,
+ WindowManager.LayoutParams.TYPE_STATUS_BAR,
+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
+ // We use a pixel format of RGB565 for the status bar to save memory bandwidth and
+ // to ensure that the layer can be handled by HWComposer. On some devices the
+ // HWComposer is unable to handle SW-rendered RGBX_8888 layers.
+ PixelFormat.RGB_565);
+
+ // the status bar should be in an overlay if possible
+ final Display defaultDisplay
+ = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
+ .getDefaultDisplay();
- /// ---------- Tracking View --------------
- bg = mTrackingView.getBackground();
- if (bg != null) {
- pixelFormat = bg.getOpacity();
- }
+ // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies
+ // very little screen real-estate and is updated fairly frequently. By using CPU rendering
+ // for the status bar, we prevent the GPU from having to wake up just to do these small
+ // updates, which should help keep power consumption down.
- lp = new WindowManager.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL,
- 0
- | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
- PixelFormat.TRANSLUCENT);
- if (ActivityManager.isHighEndGfx(mDisplay)) {
- lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
- }
-// lp.token = mStatusBarView.getWindowToken();
- lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
- lp.setTitle("TrackingView");
- lp.y = mTrackingPosition;
- mTrackingParams = lp;
+ lp.gravity = getStatusBarGravity();
+ lp.setTitle("StatusBar");
+ lp.packageName = mContext.getPackageName();
+ lp.windowAnimations = R.style.Animation_StatusBar;
+ WindowManagerImpl.getDefault().addView(makeStatusBarView(), lp);
- WindowManagerImpl.getDefault().addView(mTrackingView, lp);
}
-
- void onTrackingViewAttached() {
+
+ void addExpandedWindow() {
WindowManager.LayoutParams lp;
int pixelFormat;
@@ -1849,7 +1843,7 @@ public class PhoneStatusBar extends StatusBar {
lp = mExpandedDialog.getWindow().getAttributes();
lp.x = 0;
- mTrackingPosition = lp.y = mDisplayMetrics.heightPixels; // sufficiently large negative
+ lp.y = 0;
lp.type = WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
lp.flags = 0
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
@@ -1868,11 +1862,11 @@ public class PhoneStatusBar extends StatusBar {
mExpandedDialog.getWindow().setFormat(pixelFormat);
mExpandedDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
- mExpandedDialog.setContentView(mExpandedView,
+ mExpandedDialog.setContentView(mExpandedWindowView,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mExpandedDialog.getWindow().setBackgroundDrawable(null);
- mExpandedDialog.show();
+ //mExpandedDialog.show();
}
void setNotificationIconVisibility(boolean visible, int anim) {
@@ -1885,27 +1879,17 @@ public class PhoneStatusBar extends StatusBar {
}
void updateExpandedInvisiblePosition() {
- if (mTrackingView != null) {
- mTrackingPosition = -mDisplayMetrics.heightPixels;
- if (mTrackingParams != null) {
- mTrackingParams.y = mTrackingPosition;
- WindowManagerImpl.getDefault().updateViewLayout(mTrackingView, mTrackingParams);
- }
- }
- if (mExpandedParams != null) {
- mExpandedParams.y = -mDisplayMetrics.heightPixels;
- mExpandedDialog.getWindow().setAttributes(mExpandedParams);
- }
+ mTrackingPosition = -mDisplayMetrics.heightPixels;
}
void updateExpandedViewPos(int expandedPosition) {
if (SPEW) {
Slog.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition
- + " mTrackingParams.y=" + ((mTrackingParams == null) ? "?" : mTrackingParams.y)
+ //+ " mTrackingParams.y=" + ((mTrackingParams == null) ? "?" : mTrackingParams.y)
+ " mTrackingPosition=" + mTrackingPosition);
}
- int h = mStatusBarView.getHeight();
+ int h = 0;
int disph = mDisplayMetrics.heightPixels;
// If the expanded view is not visible, make sure they're still off screen.
@@ -1931,69 +1915,75 @@ public class PhoneStatusBar extends StatusBar {
}
pos -= disph-h;
}
- mTrackingPosition = mTrackingParams.y = pos;
- mTrackingParams.height = disph-h;
- WindowManagerImpl.getDefault().updateViewLayout(mTrackingView, mTrackingParams);
-
- if (mExpandedParams != null) {
- if (mCloseView.getWindowVisibility() == View.VISIBLE) {
- mCloseView.getLocationInWindow(mPositionTmp);
- final int closePos = mPositionTmp[1];
-
- mExpandedContents.getLocationInWindow(mPositionTmp);
- final int contentsBottom = mPositionTmp[1] + mExpandedContents.getHeight();
-
- mExpandedParams.y = pos + mTrackingView.getHeight()
- - (mTrackingParams.height-closePos) - contentsBottom;
-
- if (SPEW) {
- Slog.d(PhoneStatusBar.TAG,
- "pos=" + pos +
- " trackingHeight=" + mTrackingView.getHeight() +
- " (trackingParams.height - closePos)=" +
- (mTrackingParams.height - closePos) +
- " contentsBottom=" + contentsBottom);
- }
-
- } else {
- // If the tracking view is not yet visible, then we can't have
- // a good value of the close view location. We need to wait for
- // it to be visible to do a layout.
- mExpandedParams.y = -mDisplayMetrics.heightPixels;
- }
- int max = h;
- if (mExpandedParams.y > max) {
- mExpandedParams.y = max;
- }
- int min = mTrackingPosition;
- if (mExpandedParams.y < min) {
- mExpandedParams.y = min;
- }
-
- boolean visible = (mTrackingPosition + mTrackingView.getHeight()) > h;
- if (!visible) {
- // if the contents aren't visible, move the expanded view way off screen
- // because the window itself extends below the content view.
- mExpandedParams.y = -disph;
- }
- mExpandedDialog.getWindow().setAttributes(mExpandedParams);
-
- // As long as this isn't just a repositioning that's not supposed to affect
- // the user's perception of what's showing, call to say that the visibility
- // has changed. (Otherwise, someone else will call to do that).
- if (expandedPosition != EXPANDED_LEAVE_ALONE) {
- if (SPEW) Slog.d(TAG, "updateExpandedViewPos visibilityChanged(" + visible + ")");
- visibilityChanged(visible);
- }
- }
-
- if (SPEW) {
- Slog.d(TAG, "updateExpandedViewPos after expandedPosition=" + expandedPosition
- + " mTrackingParams.y=" + mTrackingParams.y
- + " mTrackingPosition=" + mTrackingPosition
- + " mExpandedParams.y=" + mExpandedParams.y
- + " mExpandedParams.height=" + mExpandedParams.height);
- }
+ mTrackingPosition = pos;
+ // XXX: this is all very WIP
+ mNotificationPanel.setY(pos);
+ // woo, special effects
+ final float frac = 1.0f + (float)pos / mDisplayMetrics.heightPixels;
+ final int color = ((int)(0xCC * frac * frac)) << 24;
+ mExpandedWindowView.setBackgroundColor(color);
+
+// Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color));
+
+// if (mExpandedParams != null) {
+// if (mCloseView.getWindowVisibility() == View.VISIBLE) {
+// mCloseView.getLocationInWindow(mPositionTmp);
+// final int closePos = mPositionTmp[1];
+//
+// mExpandedContents.getLocationInWindow(mPositionTmp);
+// final int contentsBottom = mPositionTmp[1] + mExpandedContents.getHeight();
+//
+// mExpandedParams.y = pos + mTrackingView.getHeight()
+// - (mTrackingParams.height-closePos) - contentsBottom;
+//
+// if (SPEW) {
+// Slog.d(PhoneStatusBar.TAG,
+// "pos=" + pos +
+// " trackingHeight=" + mTrackingView.getHeight() +
+// " (trackingParams.height - closePos)=" +
+// (mTrackingParams.height - closePos) +
+// " contentsBottom=" + contentsBottom);
+// }
+//
+// } else {
+// // If the tracking view is not yet visible, then we can't have
+// // a good value of the close view location. We need to wait for
+// // it to be visible to do a layout.
+// mExpandedParams.y = -mDisplayMetrics.heightPixels;
+// }
+// int max = h;
+// if (mExpandedParams.y > max) {
+// mExpandedParams.y = max;
+// }
+// int min = mTrackingPosition;
+// if (mExpandedParams.y < min) {
+// mExpandedParams.y = min;
+// }
+//
+// boolean visible = (mTrackingPosition + mTrackingView.getHeight()) > h;
+// if (!visible) {
+// // if the contents aren't visible, move the expanded view way off screen
+// // because the window itself extends below the content view.
+// mExpandedParams.y = -disph;
+// }
+// mExpandedDialog.getWindow().setAttributes(mExpandedParams);
+//
+// // As long as this isn't just a repositioning that's not supposed to affect
+// // the user's perception of what's showing, call to say that the visibility
+// // has changed. (Otherwise, someone else will call to do that).
+// if (expandedPosition != EXPANDED_LEAVE_ALONE) {
+// if (SPEW) Slog.d(TAG, "updateExpandedViewPos visibilityChanged(" + visible + ")");
+// visibilityChanged(visible);
+// }
+// }
+//
+// if (SPEW) {
+// Slog.d(TAG, "updateExpandedViewPos after expandedPosition=" + expandedPosition
+// + " mTrackingParams.y=" + mTrackingParams.y
+// + " mTrackingPosition=" + mTrackingPosition
+// + " mExpandedParams.y=" + mExpandedParams.y
+// + " mExpandedParams.height=" + mExpandedParams.height);
+// }
}
int getExpandedHeight(int disph) {
@@ -2001,7 +1991,7 @@ public class PhoneStatusBar extends StatusBar {
Slog.d(TAG, "getExpandedHeight(" + disph + "): sbView="
+ mStatusBarView.getHeight() + " closeView=" + mCloseView.getHeight());
}
- return disph - mStatusBarView.getHeight() - mCloseView.getHeight();
+ return disph; // - mStatusBarView.getHeight();
}
void updateDisplaySize() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 809b742..16071d4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -64,7 +64,7 @@ public class PhoneStatusBarView extends FrameLayout {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
- mService.onBarViewAttached();
+ //mService.onBarViewAttached();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingView.java
deleted file mode 100644
index cc23afc..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrackingView.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2008 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.phone;
-
-import android.content.Context;
-import android.os.Handler;
-import android.util.AttributeSet;
-import android.view.Display;
-import android.view.KeyEvent;
-import android.view.WindowManager;
-import android.widget.LinearLayout;
-
-
-public class TrackingView extends LinearLayout {
- PhoneStatusBar mService;
- boolean mTracking;
- int mStartX, mStartY;
- Handler mHandler = new Handler();
-
- public TrackingView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- }
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
- switch (event.getKeyCode()) {
- case KeyEvent.KEYCODE_BACK:
- if (down) {
- //mService.deactivate();
- }
- return true;
- }
- return super.dispatchKeyEvent(event);
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- mService.onTrackingViewAttached();
- }
-
- @Override
- protected void onWindowVisibilityChanged(int visibility) {
- super.onWindowVisibilityChanged(visibility);
- if (visibility == VISIBLE) {
- mHandler.post(new Runnable() {
- @Override public void run() {
- mService.updateExpandedViewPos(PhoneStatusBar.EXPANDED_LEAVE_ALONE);
- }
- });
- }
- }
-}
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 3649f75..9fd89ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
@@ -31,13 +32,14 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
+import android.widget.LinearLayout;
import com.android.systemui.R;
import com.android.systemui.SwipeHelper;
import java.util.HashMap;
-public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Callback {
+public class NotificationRowLayout extends LinearLayout implements SwipeHelper.Callback {
private static final String TAG = "NotificationRowLayout";
private static final boolean DEBUG = false;
private static final boolean SLOW_ANIMATIONS = DEBUG;
@@ -48,9 +50,6 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call
boolean mAnimateBounds = true;
Rect mTmpRect = new Rect();
- int mNumRows = 0;
- int mRowHeight = 0;
- int mHeight = 0;
HashMap<View, ValueAnimator> mAppearingViews = new HashMap<View, ValueAnimator>();
HashMap<View, ValueAnimator> mDisappearingViews = new HashMap<View, ValueAnimator>();
@@ -68,12 +67,9 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call
public NotificationRowLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NotificationRowLayout,
- defStyle, 0);
- mRowHeight = a.getDimensionPixelSize(R.styleable.NotificationRowLayout_rowHeight, 0);
- a.recycle();
-
- setLayoutTransition(null);
+ setLayoutTransition(new LayoutTransition());
+
+ setOrientation(LinearLayout.VERTICAL);
if (DEBUG) {
setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
@@ -145,7 +141,7 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call
if (slidingChild.getVisibility() == GONE) {
continue;
}
- y += mRowHeight;
+ y += slidingChild.getMeasuredHeight();
if (touchY < y) return slidingChild;
}
return null;
@@ -164,31 +160,6 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call
mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
}
- //**
- @Override
- public void addView(View child, int index, LayoutParams params) {
- super.addView(child, index, params);
-
- final View childF = child;
-
- if (mAnimateBounds) {
- final ObjectAnimator alphaFade = ObjectAnimator.ofFloat(child, "alpha", 0f, 1f);
- alphaFade.setDuration(APPEAR_ANIM_LEN);
- alphaFade.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mAppearingViews.remove(childF);
- requestLayout(); // pick up any final changes in position
- }
- });
-
- alphaFade.start();
-
- mAppearingViews.put(child, alphaFade);
-
- requestLayout(); // start the container animation
- }
- }
/**
* Sets a flag to tell us whether to actually remove views. Removal is delayed by setting this
@@ -209,58 +180,9 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call
}
@Override
- public void removeView(View child) {
- if (!mRemoveViews) {
- // This flag is cleared during an animation that removes all notifications. There
- // should be a call to remove all notifications when the animation is done, at which
- // time the view will be removed.
- return;
- }
- if (mAnimateBounds) {
- if (mAppearingViews.containsKey(child)) {
- mAppearingViews.remove(child);
- }
-
- // Don't fade it out if it already has a low alpha value, but run a non-visual
- // animation which is used by onLayout() to animate shrinking the gap that it left
- // in the list
- ValueAnimator anim;
- float currentAlpha = child.getAlpha();
- if (currentAlpha > .1) {
- anim = ObjectAnimator.ofFloat(child, "alpha", currentAlpha, 0);
- } else {
- if (currentAlpha > 0) {
- // Just make it go away - no need to render it anymore
- child.setAlpha(0);
- }
- anim = ValueAnimator.ofFloat(0, 1);
- }
- anim.setDuration(DISAPPEAR_ANIM_LEN);
- final View childF = child;
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (DEBUG) Slog.d(TAG, "actually removing child: " + childF);
- NotificationRowLayout.super.removeView(childF);
- mDisappearingViews.remove(childF);
- requestLayout(); // pick up any final changes in position
- }
- });
-
- anim.start();
- mDisappearingViews.put(child, anim);
-
- requestLayout(); // start the container animation
- } else {
- super.removeView(child);
- }
- }
- //**
-
- @Override
public void onFinishInflate() {
super.onFinishInflate();
- setWillNotDraw(false);
+ if (DEBUG) setWillNotDraw(false);
}
@Override
@@ -276,111 +198,4 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call
c.restore();
}
}
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- final int count = getChildCount();
-
- // pass 1: count the number of non-GONE views
- int numRows = 0;
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- if (child.getVisibility() == GONE) {
- continue;
- }
- if (mDisappearingViews.containsKey(child)) {
- continue;
- }
- numRows++;
- }
- if (numRows != mNumRows) {
- // uh oh, now you made us go and do work
-
- final int computedHeight = numRows * mRowHeight;
- if (DEBUG) {
- Slog.d(TAG, String.format("rows went from %d to %d, resizing to %dpx",
- mNumRows, numRows, computedHeight));
- }
-
- mNumRows = numRows;
-
- if (mAnimateBounds && isShown()) {
- ObjectAnimator.ofInt(this, "forcedHeight", computedHeight)
- .setDuration(APPEAR_ANIM_LEN)
- .start();
- } else {
- setForcedHeight(computedHeight);
- }
- }
-
- // pass 2: you know, do the measuring
- final int childWidthMS = widthMeasureSpec;
- final int childHeightMS = MeasureSpec.makeMeasureSpec(
- mRowHeight, MeasureSpec.EXACTLY);
-
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- if (child.getVisibility() == GONE) {
- continue;
- }
-
- child.measure(childWidthMS, childHeightMS);
- }
-
- setMeasuredDimension(
- getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec),
- resolveSize(getForcedHeight(), heightMeasureSpec));
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- final int width = right - left;
- final int height = bottom - top;
-
- if (DEBUG) Slog.d(TAG, "onLayout: height=" + height);
-
- final int count = getChildCount();
- int y = 0;
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- if (child.getVisibility() == GONE) {
- continue;
- }
- float progress = 1.0f;
- if (mDisappearingViews.containsKey(child)) {
- progress = 1.0f - mDisappearingViews.get(child).getAnimatedFraction();
- } else if (mAppearingViews.containsKey(child)) {
- progress = 1.0f - mAppearingViews.get(child).getAnimatedFraction();
- }
- if (progress > 1.0f) {
- if (DEBUG) {
- Slog.w(TAG, "progress=" + progress + " > 1!!! " + child);
- }
- progress = 1f;
- }
- final int thisRowHeight = (int)(progress * mRowHeight);
- if (DEBUG) {
- Slog.d(TAG, String.format(
- "laying out child #%d: (0, %d, %d, %d) h=%d",
- i, y, width, y + thisRowHeight, thisRowHeight));
- }
- child.layout(0, y, width, y + thisRowHeight);
- y += thisRowHeight;
- }
- if (DEBUG) {
- Slog.d(TAG, "onLayout: final y=" + y);
- }
- }
-
- public void setForcedHeight(int h) {
- if (DEBUG) Slog.d(TAG, "forcedHeight: " + h);
- if (h != mHeight) {
- mHeight = h;
- requestLayout();
- }
- }
-
- public int getForcedHeight() {
- return mHeight;
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 6e56cd4..791f3b8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -75,9 +75,10 @@ import com.android.internal.statusbar.StatusBarNotification;
import com.android.systemui.R;
import com.android.systemui.recent.RecentTasksLoader;
import com.android.systemui.recent.RecentsPanelView;
+import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.SignalClusterView;
-import com.android.systemui.statusbar.StatusBar;
+import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
@@ -86,7 +87,7 @@ import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.Prefs;
-public class TabletStatusBar extends StatusBar implements
+public class TabletStatusBar extends BaseStatusBar implements
HeightReceiver.OnBarHeightChangedListener,
InputMethodsPanel.OnHardKeyboardEnabledChangeListener,
RecentsPanelView.OnRecentsPanelVisibilityChangedListener {
@@ -199,6 +200,44 @@ public class TabletStatusBar extends StatusBar implements
public Context getContext() { return mContext; }
+ @Override
+ protected void createAndAddWindows() {
+ addStatusBarWindow();
+ addPanelWindows();
+ }
+
+ private void addStatusBarWindow() {
+ final int height = getStatusBarHeight();
+
+ final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ height,
+ WindowManager.LayoutParams.TYPE_STATUS_BAR,
+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
+ // We use a pixel format of RGB565 for the status bar to save memory bandwidth and
+ // to ensure that the layer can be handled by HWComposer. On some devices the
+ // HWComposer is unable to handle SW-rendered RGBX_8888 layers.
+ PixelFormat.RGB_565);
+
+ // the status bar should be in an overlay if possible
+ final Display defaultDisplay
+ = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
+ .getDefaultDisplay();
+
+ // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies
+ // very little screen real-estate and is updated fairly frequently. By using CPU rendering
+ // for the status bar, we prevent the GPU from having to wake up just to do these small
+ // updates, which should help keep power consumption down.
+
+ lp.gravity = getStatusBarGravity();
+ lp.setTitle("StatusBar");
+ lp.packageName = mContext.getPackageName();
+ lp.windowAnimations = R.style.Animation_StatusBar;
+ WindowManagerImpl.getDefault().addView(makeStatusBarView(), lp);
+ }
+
protected void addPanelWindows() {
final Context context = mContext;
final Resources res = mContext.getResources();
@@ -379,6 +418,14 @@ public class TabletStatusBar extends StatusBar implements
lp.windowAnimations = android.R.style.Animation_Dialog;
WindowManagerImpl.getDefault().addView(mCompatModePanel, lp);
+
+ mRecentButton.setOnTouchListener(mRecentsPanel);
+
+ mPile = (ViewGroup)mNotificationPanel.findViewById(R.id.content);
+ mPile.removeAllViews();
+
+ ScrollView scroller = (ScrollView)mPile.getParent();
+ scroller.setFillViewport(true);
}
private int getNotificationPanelHeight() {
@@ -599,16 +646,6 @@ public class TabletStatusBar extends StatusBar implements
// set the initial view visibility
setAreThereNotifications();
- // Add the windows
- addPanelWindows();
- mRecentButton.setOnTouchListener(mRecentsPanel);
-
- mPile = (ViewGroup)mNotificationPanel.findViewById(R.id.content);
- mPile.removeAllViews();
-
- ScrollView scroller = (ScrollView)mPile.getParent();
- scroller.setFillViewport(true);
-
mHeightReceiver.addOnBarHeightChangedListener(this);
// receive broadcasts
@@ -1796,9 +1833,9 @@ public class TabletStatusBar extends StatusBar implements
Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false);
workAroundBadLayerDrawableOpacity(row);
- View vetoButton = updateNotificationVetoButton(row, entry.notification);
- vetoButton.setContentDescription(mContext.getString(
- R.string.accessibility_remove_notification));
+// View vetoButton = updateNotificationVetoButton(row, entry.notification);
+// vetoButton.setContentDescription(mContext.getString(
+// R.string.accessibility_remove_notification));
// the large icon
ImageView largeIcon = (ImageView)row.findViewById(R.id.large_icon);
@@ -1942,6 +1979,7 @@ public class TabletStatusBar extends StatusBar implements
pw.println("mNetworkController:");
mNetworkController.dump(fd, pw, args);
}
+
}