Loading packages/SystemUI/res/layout/status_bar.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ <com.android.systemui.statusbar.phone.PhoneStatusBarView <com.android.systemui.statusbar.phone.PhoneStatusBarView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:id="@+id/status_bar" android:background="@drawable/status_bar_background" android:background="@drawable/status_bar_background" android:orientation="vertical" android:orientation="vertical" android:focusable="true" android:focusable="true" Loading packages/SystemUI/res/layout/super_status_bar.xml 0 → 100644 +39 −0 Original line number Original line Diff line number Diff line <?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. */ --> <!-- This is the combined status bar / notification panel window. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true" > <include layout="@layout/status_bar_expanded" android:layout_width="match_parent" android:layout_height="match_parent" /> <include layout="@layout/status_bar" android:layout_width="match_parent" android:layout_height="@*android:dimen/status_bar_height" /> </FrameLayout> packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +97 −142 Original line number Original line Diff line number Diff line Loading @@ -142,7 +142,9 @@ public class PhoneStatusBar extends BaseStatusBar { IWindowManager mWindowManager; IWindowManager mWindowManager; View mStatusBarWindow; PhoneStatusBarView mStatusBarView; PhoneStatusBarView mStatusBarView; int mPixelFormat; int mPixelFormat; Object mQueueLock = new Object(); Object mQueueLock = new Object(); Loading @@ -153,9 +155,6 @@ public class PhoneStatusBar extends BaseStatusBar { LinearLayout mStatusIcons; LinearLayout mStatusIcons; // expanded notifications // expanded notifications Dialog mExpandedDialog; WindowManager.LayoutParams mExpandedParams; View mExpandedWindowView; View mNotificationPanel; // the sliding/resizing panel within the notification window View mNotificationPanel; // the sliding/resizing panel within the notification window ScrollView mScrollView; ScrollView mScrollView; View mExpandedContents; View mExpandedContents; Loading Loading @@ -274,12 +273,13 @@ public class PhoneStatusBar extends BaseStatusBar { mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size); mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size); final View expanded = mExpandedWindowView = View.inflate(context, mStatusBarWindow = View.inflate(context, R.layout.status_bar_expanded, null); R.layout.super_status_bar, null); if (DEBUG) { if (DEBUG) { expanded.setBackgroundColor(0x6000FF80); mStatusBarWindow.setBackgroundColor(0x6000FF80); } } mNotificationPanel = expanded.findViewById(R.id.notification_panel); mStatusBarView = (PhoneStatusBarView) mStatusBarWindow.findViewById(R.id.status_bar); mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel); if (ENABLE_INTRUDERS) { if (ENABLE_INTRUDERS) { mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null); mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null); Loading @@ -287,10 +287,7 @@ public class PhoneStatusBar extends BaseStatusBar { mIntruderAlertView.setBar(this); mIntruderAlertView.setBar(this); } } PhoneStatusBarView sb = (PhoneStatusBarView)View.inflate(context, mStatusBarView.mService = this; R.layout.status_bar, null); sb.mService = this; mStatusBarView = sb; try { try { boolean showNav = mWindowManager.hasNavigationBar(); boolean showNav = mWindowManager.hasNavigationBar(); Loading @@ -308,34 +305,33 @@ public class PhoneStatusBar extends BaseStatusBar { // figure out which pixel-format to use for the status bar. // figure out which pixel-format to use for the status bar. mPixelFormat = PixelFormat.OPAQUE; mPixelFormat = PixelFormat.OPAQUE; mStatusIcons = (LinearLayout)sb.findViewById(R.id.statusIcons); mStatusIcons = (LinearLayout)mStatusBarView.findViewById(R.id.statusIcons); mNotificationIcons = (IconMerger)sb.findViewById(R.id.notificationIcons); mNotificationIcons = (IconMerger)mStatusBarView.findViewById(R.id.notificationIcons); mMoreIcon = sb.findViewById(R.id.moreIcon); mMoreIcon = mStatusBarView.findViewById(R.id.moreIcon); mNotificationIcons.setOverflowIndicator(mMoreIcon); mNotificationIcons.setOverflowIndicator(mMoreIcon); mIcons = (LinearLayout)sb.findViewById(R.id.icons); mIcons = (LinearLayout)mStatusBarView.findViewById(R.id.icons); mTickerView = sb.findViewById(R.id.ticker); mTickerView = mStatusBarView.findViewById(R.id.ticker); mExpandedDialog = new ExpandedDialog(context); mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems); mPile = (NotificationRowLayout)expanded.findViewById(R.id.latestItems); mPile.setLongPressListener(getNotificationLongClicker()); mPile.setLongPressListener(getNotificationLongClicker()); mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mClearButton = expanded.findViewById(R.id.clear_all_button); mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setAlpha(0f); mClearButton.setAlpha(0f); mClearButton.setEnabled(false); mClearButton.setEnabled(false); mDateView = (DateView)expanded.findViewById(R.id.date); mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date); mSettingsButton = expanded.findViewById(R.id.settings_button); mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button); mSettingsButton.setOnClickListener(mSettingsButtonListener); mSettingsButton.setOnClickListener(mSettingsButtonListener); mScrollView = (ScrollView)expanded.findViewById(R.id.scroll); mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll); mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns mTicker = new MyTicker(context, sb); mTicker = new MyTicker(context, mStatusBarView); TickerView tickerView = (TickerView)sb.findViewById(R.id.tickerText); TickerView tickerView = (TickerView)mStatusBarView.findViewById(R.id.tickerText); tickerView.mTicker = mTicker; tickerView.mTicker = mTicker; mCloseView = (CloseDragHandle)mExpandedWindowView.findViewById(R.id.close); mCloseView = (CloseDragHandle)mStatusBarWindow.findViewById(R.id.close); mCloseView.mService = this; mCloseView.mService = this; mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore); mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore); Loading @@ -346,10 +342,10 @@ public class PhoneStatusBar extends BaseStatusBar { // Other icons // Other icons mLocationController = new LocationController(mContext); // will post a notification mLocationController = new LocationController(mContext); // will post a notification mBatteryController = new BatteryController(mContext); mBatteryController = new BatteryController(mContext); mBatteryController.addIconView((ImageView)sb.findViewById(R.id.battery)); mBatteryController.addIconView((ImageView)mStatusBarView.findViewById(R.id.battery)); mNetworkController = new NetworkController(mContext); mNetworkController = new NetworkController(mContext); final SignalClusterView signalCluster = final SignalClusterView signalCluster = (SignalClusterView)sb.findViewById(R.id.signal_cluster); (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster); mNetworkController.addSignalCluster(signalCluster); mNetworkController.addSignalCluster(signalCluster); signalCluster.setNetworkController(mNetworkController); signalCluster.setNetworkController(mNetworkController); // final ImageView wimaxRSSI = // final ImageView wimaxRSSI = Loading @@ -368,7 +364,7 @@ public class PhoneStatusBar extends BaseStatusBar { filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_SCREEN_OFF); context.registerReceiver(mBroadcastReceiver, filter); context.registerReceiver(mBroadcastReceiver, filter); return sb; return mStatusBarView; } } @Override @Override Loading Loading @@ -462,8 +458,12 @@ public class PhoneStatusBar extends BaseStatusBar { } } public int getStatusBarHeight() { public int getStatusBarHeight() { if (mNaturalBarHeight < 0) { final Resources res = mContext.getResources(); final Resources res = mContext.getResources(); return res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); mNaturalBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); } return mNaturalBarHeight; } } private View.OnClickListener mRecentsClickListener = new View.OnClickListener() { private View.OnClickListener mRecentsClickListener = new View.OnClickListener() { Loading Loading @@ -1097,19 +1097,19 @@ public class PhoneStatusBar extends BaseStatusBar { if (mExpandedVisible) { if (mExpandedVisible) { return; return; } } mExpandedDialog.show(); // XXX HAX mExpandedVisible = true; mExpandedVisible = true; visibilityChanged(true); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; // Expand the window to encompass the full screen in anticipation of the drag. if (DEBUG) { // This is only possible to do atomically because the status bar is at the top of the screen! Slog.d(TAG, "makeExpandedVisible: expanded params = " + mExpandedParams); WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams(); } lp.height = mDisplayMetrics.heightPixels; mExpandedDialog.getWindow().setAttributes(mExpandedParams); final WindowManager wm = WindowManagerImpl.getDefault(); mExpandedWindowView.requestFocus(View.FOCUS_FORWARD); wm.updateViewLayout(mStatusBarWindow, lp); mExpandedWindowView.setVisibility(View.VISIBLE); visibilityChanged(true); } } public void animateExpand() { public void animateExpand() { Loading Loading @@ -1190,11 +1190,13 @@ public class PhoneStatusBar extends BaseStatusBar { } } mExpandedVisible = false; mExpandedVisible = false; visibilityChanged(false); visibilityChanged(false); mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; //mNotificationPanel.setVisibility(View.GONE); mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; mExpandedDialog.getWindow().setAttributes(mExpandedParams); // Shrink the window to the size of the status bar only mExpandedDialog.hide(); // XXX HAX WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams(); mExpandedWindowView.setVisibility(View.GONE); lp.height = getStatusBarHeight(); final WindowManager wm = WindowManagerImpl.getDefault(); wm.updateViewLayout(mStatusBarWindow, lp); if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) { if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) { setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in); setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in); Loading Loading @@ -1222,7 +1224,7 @@ public class PhoneStatusBar extends BaseStatusBar { updateExpandedViewPos(EXPANDED_FULL_OPEN); updateExpandedViewPos(EXPANDED_FULL_OPEN); performExpand(); performExpand(); } } else if (mAnimY < mStatusBarView.getHeight()) { else if (mAnimY < getStatusBarHeight()) { if (SPEW) Slog.d(TAG, "Animation completed to collapsed state."); if (SPEW) Slog.d(TAG, "Animation completed to collapsed state."); mAnimating = false; mAnimating = false; updateExpandedViewPos(0); updateExpandedViewPos(0); Loading Loading @@ -1257,7 +1259,7 @@ public class PhoneStatusBar extends BaseStatusBar { } } void doRevealAnimation() { void doRevealAnimation() { final int h = mCloseView.getHeight() + mStatusBarView.getHeight(); final int h = mCloseView.getHeight() + getStatusBarHeight(); if (mAnimatingReveal && mAnimating && mAnimY < h) { if (mAnimatingReveal && mAnimating && mAnimY < h) { incrementAnim(); incrementAnim(); if (mAnimY >= h) { if (mAnimY >= h) { Loading @@ -1277,17 +1279,13 @@ public class PhoneStatusBar extends BaseStatusBar { Slog.d(TAG, "panel: beginning to track the user's touch, y=" + y + " opening=" + opening); Slog.d(TAG, "panel: beginning to track the user's touch, y=" + y + " opening=" + opening); } } // there are some race conditions that cause this to be inaccurate; let's recalculate it any // time we're about to drag the panel updateExpandedSize(); mTracking = true; mTracking = true; mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null); mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null); mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker = VelocityTracker.obtain(); if (opening) { if (opening) { mAnimAccel = mExpandAccelPx; mAnimAccel = mExpandAccelPx; mAnimVel = mFlingExpandMinVelocityPx; mAnimVel = mFlingExpandMinVelocityPx; mAnimY = mStatusBarView.getHeight(); mAnimY = getStatusBarHeight(); updateExpandedViewPos((int)mAnimY); updateExpandedViewPos((int)mAnimY); mAnimating = true; mAnimating = true; mAnimatingReveal = true; mAnimatingReveal = true; Loading Loading @@ -1393,7 +1391,7 @@ public class PhoneStatusBar extends BaseStatusBar { } } final int action = event.getAction(); final int action = event.getAction(); final int statusBarSize = mStatusBarView.getHeight(); final int statusBarSize = getStatusBarHeight(); final int hitSize = statusBarSize*2; final int hitSize = statusBarSize*2; final int y = (int)event.getRawY(); final int y = (int)event.getRawY(); if (action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN) { Loading Loading @@ -1664,7 +1662,7 @@ public class PhoneStatusBar extends BaseStatusBar { // until status bar window is attached to the window manager, // until status bar window is attached to the window manager, // because... well, what's the point otherwise? And trying to // because... well, what's the point otherwise? And trying to // run a ticker without being attached will crash! // run a ticker without being attached will crash! if (n.notification.tickerText != null && mStatusBarView.getWindowToken() != null) { if (n.notification.tickerText != null && mStatusBarWindow.getWindowToken() != null) { if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) { | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) { mTicker.addEntry(n); mTicker.addEntry(n); Loading Loading @@ -1757,9 +1755,6 @@ public class PhoneStatusBar extends BaseStatusBar { pw.println(" mAnimatingReveal=" + mAnimatingReveal pw.println(" mAnimatingReveal=" + mAnimatingReveal + " mViewDelta=" + mViewDelta); + " mViewDelta=" + mViewDelta); pw.println(" mDisplayMetrics=" + mDisplayMetrics); pw.println(" mDisplayMetrics=" + mDisplayMetrics); pw.println(" mExpandedParams: " + mExpandedParams); pw.println(" mExpandedView: " + viewInfo(mExpandedWindowView)); pw.println(" mExpandedDialog: " + mExpandedDialog); pw.println(" mPile: " + viewInfo(mPile)); pw.println(" mPile: " + viewInfo(mPile)); pw.println(" mCloseView: " + viewInfo(mCloseView)); pw.println(" mCloseView: " + viewInfo(mCloseView)); pw.println(" mTickerView: " + viewInfo(mTickerView)); pw.println(" mTickerView: " + viewInfo(mTickerView)); Loading Loading @@ -1803,14 +1798,8 @@ public class PhoneStatusBar extends BaseStatusBar { mStatusBarView.getLocationOnScreen(mAbsPos); mStatusBarView.getLocationOnScreen(mAbsPos); Slog.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] Slog.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] + ") " + mStatusBarView.getWidth() + "x" + ") " + mStatusBarView.getWidth() + "x" + mStatusBarView.getHeight()); + getStatusBarHeight()); mStatusBarView.debug(); mStatusBarView.debug(); mExpandedWindowView.getLocationOnScreen(mAbsPos); Slog.d(TAG, "mExpandedView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] + ") " + mExpandedWindowView.getWidth() + "x" + mExpandedWindowView.getHeight()); mExpandedWindowView.debug(); } } }); }); } } Loading @@ -1829,6 +1818,9 @@ public class PhoneStatusBar extends BaseStatusBar { // Put up the view // Put up the view final int height = getStatusBarHeight(); final int height = getStatusBarHeight(); // Now that the status bar window encompasses the sliding panel and its // translucent backdrop, the entire thing is made TRANSLUCENT and is // hardware-accelerated. final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, height, height, Loading @@ -1836,56 +1828,18 @@ public class PhoneStatusBar extends BaseStatusBar { WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, // We use a pixel format of RGB565 for the status bar to save memory bandwidth and PixelFormat.TRANSLUCENT); // 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); // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies if (ActivityManager.isHighEndGfx(mDisplay)) { // very little screen real-estate and is updated fairly frequently. By using CPU rendering lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; // 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.gravity = getStatusBarGravity(); lp.setTitle("StatusBar"); lp.setTitle("StatusBar"); lp.packageName = mContext.getPackageName(); lp.packageName = mContext.getPackageName(); mStatusBarView = makeStatusBarView(); WindowManagerImpl.getDefault().addView(mStatusBarView, lp); } void addExpandedWindow() { WindowManager.LayoutParams lp; int pixelFormat; /// ---------- Expanded View -------------- pixelFormat = PixelFormat.TRANSLUCENT; lp = mExpandedDialog.getWindow().getAttributes(); lp.x = 0; lp.y = 0; lp.type = WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; lp.flags = 0 | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_DITHER | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; if (ActivityManager.isHighEndGfx(mDisplay)) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } lp.format = pixelFormat; lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL; lp.setTitle("StatusBarExpanded"); mExpandedParams = lp; updateExpandedSize(); mExpandedDialog.getWindow().setFormat(pixelFormat); mExpandedDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); makeStatusBarView(); mExpandedDialog.setContentView(mExpandedWindowView, WindowManagerImpl.getDefault().addView(mStatusBarWindow, lp); new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mExpandedDialog.getWindow().setBackgroundDrawable(null); //mExpandedDialog.show(); } } void setNotificationIconVisibility(boolean visible, int anim) { void setNotificationIconVisibility(boolean visible, int anim) { Loading Loading @@ -1935,20 +1889,25 @@ public class PhoneStatusBar extends BaseStatusBar { } } // catch orientation changes and other peculiar cases // catch orientation changes and other peculiar cases if (panelh > disph || (panelh < disph && !mTracking && !mAnimating)) if (panelh > disph || (panelh < disph && !mTracking && !mAnimating)) { panelh = disph; panelh = disph; } else if (panelh < 0) { panelh = 0; } mTrackingPosition = panelh; mTrackingPosition = panelh; // XXX: this is all very WIP //mNotificationPanel.setY(panelh); final View cropView = mNotificationPanel; final View cropView = mNotificationPanel; ViewGroup.LayoutParams lp = cropView.getLayoutParams(); ViewGroup.LayoutParams lp = cropView.getLayoutParams(); lp.height = panelh; lp.height = panelh; if (SPEW) { Slog.v(TAG, "updated cropView height=" + panelh); } cropView.setLayoutParams(lp); cropView.setLayoutParams(lp); // woo, special effects // woo, special effects final float frac = (float)panelh / disph; final float frac = (float)panelh / disph; final int color = ((int)(0xB0 * frac * frac)) << 24; final int color = ((int)(0xB0 * Math.pow(frac, 0.5))) << 24; mExpandedWindowView.setBackgroundColor(color); mStatusBarWindow.setBackgroundColor(color); // Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color)); // Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color)); Loading Loading @@ -2013,40 +1972,36 @@ public class PhoneStatusBar extends BaseStatusBar { // } // } } } int getExpandedHeight(int disph) { int getExpandedHeight() { if (DEBUG) { return mDisplayMetrics.heightPixels; Slog.d(TAG, "getExpandedHeight(" + disph + "): sbView=" + mStatusBarView.getHeight() + " closeView=" + mCloseView.getHeight()); } return disph; // - mStatusBarView.getHeight(); } } void updateDisplaySize() { void updateDisplaySize() { mDisplay.getMetrics(mDisplayMetrics); mDisplay.getMetrics(mDisplayMetrics); if (DEBUG) { // if (DEBUG) { Slog.d(TAG, "updateDisplaySize: " + mDisplayMetrics); // Slog.d(TAG, "updateDisplaySize: " + mDisplayMetrics); } // } updateExpandedSize(); // updateExpandedSize(); } } void updateExpandedSize() { // void updateExpandedSize() { if (DEBUG) { // if (DEBUG) { Slog.d(TAG, "updateExpandedSize()"); // Slog.d(TAG, "updateExpandedSize()"); } // } if (mExpandedDialog != null && mExpandedParams != null && mDisplayMetrics != null) { // if (mStatusBarWindow != null && mDisplayMetrics != null) { mExpandedParams.width = mDisplayMetrics.widthPixels; // mExpandedParams.width = mDisplayMetrics.widthPixels; mExpandedParams.height = getExpandedHeight(mDisplayMetrics.heightPixels); // mExpandedParams.height = getExpandedHeight(); if (!mExpandedVisible) { // if (!mExpandedVisible) { updateExpandedInvisiblePosition(); // updateExpandedInvisiblePosition(); } else { // } else { mExpandedDialog.getWindow().setAttributes(mExpandedParams); // mExpandedDialog.getWindow().setAttributes(mExpandedParams); } // } if (DEBUG) { // if (DEBUG) { Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " + // Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " + (mExpandedVisible ? "VISIBLE":"INVISIBLE")); // (mExpandedVisible ? "VISIBLE":"INVISIBLE")); } // } } // } } // } void performDisableActions(int net) { void performDisableActions(int net) { int old = mDisabled; int old = mDisabled; Loading Loading
packages/SystemUI/res/layout/status_bar.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ <com.android.systemui.statusbar.phone.PhoneStatusBarView <com.android.systemui.statusbar.phone.PhoneStatusBarView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:id="@+id/status_bar" android:background="@drawable/status_bar_background" android:background="@drawable/status_bar_background" android:orientation="vertical" android:orientation="vertical" android:focusable="true" android:focusable="true" Loading
packages/SystemUI/res/layout/super_status_bar.xml 0 → 100644 +39 −0 Original line number Original line Diff line number Diff line <?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. */ --> <!-- This is the combined status bar / notification panel window. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true" > <include layout="@layout/status_bar_expanded" android:layout_width="match_parent" android:layout_height="match_parent" /> <include layout="@layout/status_bar" android:layout_width="match_parent" android:layout_height="@*android:dimen/status_bar_height" /> </FrameLayout>
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +97 −142 Original line number Original line Diff line number Diff line Loading @@ -142,7 +142,9 @@ public class PhoneStatusBar extends BaseStatusBar { IWindowManager mWindowManager; IWindowManager mWindowManager; View mStatusBarWindow; PhoneStatusBarView mStatusBarView; PhoneStatusBarView mStatusBarView; int mPixelFormat; int mPixelFormat; Object mQueueLock = new Object(); Object mQueueLock = new Object(); Loading @@ -153,9 +155,6 @@ public class PhoneStatusBar extends BaseStatusBar { LinearLayout mStatusIcons; LinearLayout mStatusIcons; // expanded notifications // expanded notifications Dialog mExpandedDialog; WindowManager.LayoutParams mExpandedParams; View mExpandedWindowView; View mNotificationPanel; // the sliding/resizing panel within the notification window View mNotificationPanel; // the sliding/resizing panel within the notification window ScrollView mScrollView; ScrollView mScrollView; View mExpandedContents; View mExpandedContents; Loading Loading @@ -274,12 +273,13 @@ public class PhoneStatusBar extends BaseStatusBar { mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size); mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size); final View expanded = mExpandedWindowView = View.inflate(context, mStatusBarWindow = View.inflate(context, R.layout.status_bar_expanded, null); R.layout.super_status_bar, null); if (DEBUG) { if (DEBUG) { expanded.setBackgroundColor(0x6000FF80); mStatusBarWindow.setBackgroundColor(0x6000FF80); } } mNotificationPanel = expanded.findViewById(R.id.notification_panel); mStatusBarView = (PhoneStatusBarView) mStatusBarWindow.findViewById(R.id.status_bar); mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel); if (ENABLE_INTRUDERS) { if (ENABLE_INTRUDERS) { mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null); mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null); Loading @@ -287,10 +287,7 @@ public class PhoneStatusBar extends BaseStatusBar { mIntruderAlertView.setBar(this); mIntruderAlertView.setBar(this); } } PhoneStatusBarView sb = (PhoneStatusBarView)View.inflate(context, mStatusBarView.mService = this; R.layout.status_bar, null); sb.mService = this; mStatusBarView = sb; try { try { boolean showNav = mWindowManager.hasNavigationBar(); boolean showNav = mWindowManager.hasNavigationBar(); Loading @@ -308,34 +305,33 @@ public class PhoneStatusBar extends BaseStatusBar { // figure out which pixel-format to use for the status bar. // figure out which pixel-format to use for the status bar. mPixelFormat = PixelFormat.OPAQUE; mPixelFormat = PixelFormat.OPAQUE; mStatusIcons = (LinearLayout)sb.findViewById(R.id.statusIcons); mStatusIcons = (LinearLayout)mStatusBarView.findViewById(R.id.statusIcons); mNotificationIcons = (IconMerger)sb.findViewById(R.id.notificationIcons); mNotificationIcons = (IconMerger)mStatusBarView.findViewById(R.id.notificationIcons); mMoreIcon = sb.findViewById(R.id.moreIcon); mMoreIcon = mStatusBarView.findViewById(R.id.moreIcon); mNotificationIcons.setOverflowIndicator(mMoreIcon); mNotificationIcons.setOverflowIndicator(mMoreIcon); mIcons = (LinearLayout)sb.findViewById(R.id.icons); mIcons = (LinearLayout)mStatusBarView.findViewById(R.id.icons); mTickerView = sb.findViewById(R.id.ticker); mTickerView = mStatusBarView.findViewById(R.id.ticker); mExpandedDialog = new ExpandedDialog(context); mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems); mPile = (NotificationRowLayout)expanded.findViewById(R.id.latestItems); mPile.setLongPressListener(getNotificationLongClicker()); mPile.setLongPressListener(getNotificationLongClicker()); mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mClearButton = expanded.findViewById(R.id.clear_all_button); mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setAlpha(0f); mClearButton.setAlpha(0f); mClearButton.setEnabled(false); mClearButton.setEnabled(false); mDateView = (DateView)expanded.findViewById(R.id.date); mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date); mSettingsButton = expanded.findViewById(R.id.settings_button); mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button); mSettingsButton.setOnClickListener(mSettingsButtonListener); mSettingsButton.setOnClickListener(mSettingsButtonListener); mScrollView = (ScrollView)expanded.findViewById(R.id.scroll); mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll); mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns mTicker = new MyTicker(context, sb); mTicker = new MyTicker(context, mStatusBarView); TickerView tickerView = (TickerView)sb.findViewById(R.id.tickerText); TickerView tickerView = (TickerView)mStatusBarView.findViewById(R.id.tickerText); tickerView.mTicker = mTicker; tickerView.mTicker = mTicker; mCloseView = (CloseDragHandle)mExpandedWindowView.findViewById(R.id.close); mCloseView = (CloseDragHandle)mStatusBarWindow.findViewById(R.id.close); mCloseView.mService = this; mCloseView.mService = this; mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore); mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore); Loading @@ -346,10 +342,10 @@ public class PhoneStatusBar extends BaseStatusBar { // Other icons // Other icons mLocationController = new LocationController(mContext); // will post a notification mLocationController = new LocationController(mContext); // will post a notification mBatteryController = new BatteryController(mContext); mBatteryController = new BatteryController(mContext); mBatteryController.addIconView((ImageView)sb.findViewById(R.id.battery)); mBatteryController.addIconView((ImageView)mStatusBarView.findViewById(R.id.battery)); mNetworkController = new NetworkController(mContext); mNetworkController = new NetworkController(mContext); final SignalClusterView signalCluster = final SignalClusterView signalCluster = (SignalClusterView)sb.findViewById(R.id.signal_cluster); (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster); mNetworkController.addSignalCluster(signalCluster); mNetworkController.addSignalCluster(signalCluster); signalCluster.setNetworkController(mNetworkController); signalCluster.setNetworkController(mNetworkController); // final ImageView wimaxRSSI = // final ImageView wimaxRSSI = Loading @@ -368,7 +364,7 @@ public class PhoneStatusBar extends BaseStatusBar { filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_SCREEN_OFF); context.registerReceiver(mBroadcastReceiver, filter); context.registerReceiver(mBroadcastReceiver, filter); return sb; return mStatusBarView; } } @Override @Override Loading Loading @@ -462,8 +458,12 @@ public class PhoneStatusBar extends BaseStatusBar { } } public int getStatusBarHeight() { public int getStatusBarHeight() { if (mNaturalBarHeight < 0) { final Resources res = mContext.getResources(); final Resources res = mContext.getResources(); return res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); mNaturalBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); } return mNaturalBarHeight; } } private View.OnClickListener mRecentsClickListener = new View.OnClickListener() { private View.OnClickListener mRecentsClickListener = new View.OnClickListener() { Loading Loading @@ -1097,19 +1097,19 @@ public class PhoneStatusBar extends BaseStatusBar { if (mExpandedVisible) { if (mExpandedVisible) { return; return; } } mExpandedDialog.show(); // XXX HAX mExpandedVisible = true; mExpandedVisible = true; visibilityChanged(true); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; // Expand the window to encompass the full screen in anticipation of the drag. if (DEBUG) { // This is only possible to do atomically because the status bar is at the top of the screen! Slog.d(TAG, "makeExpandedVisible: expanded params = " + mExpandedParams); WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams(); } lp.height = mDisplayMetrics.heightPixels; mExpandedDialog.getWindow().setAttributes(mExpandedParams); final WindowManager wm = WindowManagerImpl.getDefault(); mExpandedWindowView.requestFocus(View.FOCUS_FORWARD); wm.updateViewLayout(mStatusBarWindow, lp); mExpandedWindowView.setVisibility(View.VISIBLE); visibilityChanged(true); } } public void animateExpand() { public void animateExpand() { Loading Loading @@ -1190,11 +1190,13 @@ public class PhoneStatusBar extends BaseStatusBar { } } mExpandedVisible = false; mExpandedVisible = false; visibilityChanged(false); visibilityChanged(false); mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; //mNotificationPanel.setVisibility(View.GONE); mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; mExpandedDialog.getWindow().setAttributes(mExpandedParams); // Shrink the window to the size of the status bar only mExpandedDialog.hide(); // XXX HAX WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams(); mExpandedWindowView.setVisibility(View.GONE); lp.height = getStatusBarHeight(); final WindowManager wm = WindowManagerImpl.getDefault(); wm.updateViewLayout(mStatusBarWindow, lp); if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) { if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) { setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in); setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in); Loading Loading @@ -1222,7 +1224,7 @@ public class PhoneStatusBar extends BaseStatusBar { updateExpandedViewPos(EXPANDED_FULL_OPEN); updateExpandedViewPos(EXPANDED_FULL_OPEN); performExpand(); performExpand(); } } else if (mAnimY < mStatusBarView.getHeight()) { else if (mAnimY < getStatusBarHeight()) { if (SPEW) Slog.d(TAG, "Animation completed to collapsed state."); if (SPEW) Slog.d(TAG, "Animation completed to collapsed state."); mAnimating = false; mAnimating = false; updateExpandedViewPos(0); updateExpandedViewPos(0); Loading Loading @@ -1257,7 +1259,7 @@ public class PhoneStatusBar extends BaseStatusBar { } } void doRevealAnimation() { void doRevealAnimation() { final int h = mCloseView.getHeight() + mStatusBarView.getHeight(); final int h = mCloseView.getHeight() + getStatusBarHeight(); if (mAnimatingReveal && mAnimating && mAnimY < h) { if (mAnimatingReveal && mAnimating && mAnimY < h) { incrementAnim(); incrementAnim(); if (mAnimY >= h) { if (mAnimY >= h) { Loading @@ -1277,17 +1279,13 @@ public class PhoneStatusBar extends BaseStatusBar { Slog.d(TAG, "panel: beginning to track the user's touch, y=" + y + " opening=" + opening); Slog.d(TAG, "panel: beginning to track the user's touch, y=" + y + " opening=" + opening); } } // there are some race conditions that cause this to be inaccurate; let's recalculate it any // time we're about to drag the panel updateExpandedSize(); mTracking = true; mTracking = true; mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null); mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null); mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker = VelocityTracker.obtain(); if (opening) { if (opening) { mAnimAccel = mExpandAccelPx; mAnimAccel = mExpandAccelPx; mAnimVel = mFlingExpandMinVelocityPx; mAnimVel = mFlingExpandMinVelocityPx; mAnimY = mStatusBarView.getHeight(); mAnimY = getStatusBarHeight(); updateExpandedViewPos((int)mAnimY); updateExpandedViewPos((int)mAnimY); mAnimating = true; mAnimating = true; mAnimatingReveal = true; mAnimatingReveal = true; Loading Loading @@ -1393,7 +1391,7 @@ public class PhoneStatusBar extends BaseStatusBar { } } final int action = event.getAction(); final int action = event.getAction(); final int statusBarSize = mStatusBarView.getHeight(); final int statusBarSize = getStatusBarHeight(); final int hitSize = statusBarSize*2; final int hitSize = statusBarSize*2; final int y = (int)event.getRawY(); final int y = (int)event.getRawY(); if (action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN) { Loading Loading @@ -1664,7 +1662,7 @@ public class PhoneStatusBar extends BaseStatusBar { // until status bar window is attached to the window manager, // until status bar window is attached to the window manager, // because... well, what's the point otherwise? And trying to // because... well, what's the point otherwise? And trying to // run a ticker without being attached will crash! // run a ticker without being attached will crash! if (n.notification.tickerText != null && mStatusBarView.getWindowToken() != null) { if (n.notification.tickerText != null && mStatusBarWindow.getWindowToken() != null) { if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) { | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) { mTicker.addEntry(n); mTicker.addEntry(n); Loading Loading @@ -1757,9 +1755,6 @@ public class PhoneStatusBar extends BaseStatusBar { pw.println(" mAnimatingReveal=" + mAnimatingReveal pw.println(" mAnimatingReveal=" + mAnimatingReveal + " mViewDelta=" + mViewDelta); + " mViewDelta=" + mViewDelta); pw.println(" mDisplayMetrics=" + mDisplayMetrics); pw.println(" mDisplayMetrics=" + mDisplayMetrics); pw.println(" mExpandedParams: " + mExpandedParams); pw.println(" mExpandedView: " + viewInfo(mExpandedWindowView)); pw.println(" mExpandedDialog: " + mExpandedDialog); pw.println(" mPile: " + viewInfo(mPile)); pw.println(" mPile: " + viewInfo(mPile)); pw.println(" mCloseView: " + viewInfo(mCloseView)); pw.println(" mCloseView: " + viewInfo(mCloseView)); pw.println(" mTickerView: " + viewInfo(mTickerView)); pw.println(" mTickerView: " + viewInfo(mTickerView)); Loading Loading @@ -1803,14 +1798,8 @@ public class PhoneStatusBar extends BaseStatusBar { mStatusBarView.getLocationOnScreen(mAbsPos); mStatusBarView.getLocationOnScreen(mAbsPos); Slog.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] Slog.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] + ") " + mStatusBarView.getWidth() + "x" + ") " + mStatusBarView.getWidth() + "x" + mStatusBarView.getHeight()); + getStatusBarHeight()); mStatusBarView.debug(); mStatusBarView.debug(); mExpandedWindowView.getLocationOnScreen(mAbsPos); Slog.d(TAG, "mExpandedView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] + ") " + mExpandedWindowView.getWidth() + "x" + mExpandedWindowView.getHeight()); mExpandedWindowView.debug(); } } }); }); } } Loading @@ -1829,6 +1818,9 @@ public class PhoneStatusBar extends BaseStatusBar { // Put up the view // Put up the view final int height = getStatusBarHeight(); final int height = getStatusBarHeight(); // Now that the status bar window encompasses the sliding panel and its // translucent backdrop, the entire thing is made TRANSLUCENT and is // hardware-accelerated. final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, height, height, Loading @@ -1836,56 +1828,18 @@ public class PhoneStatusBar extends BaseStatusBar { WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, // We use a pixel format of RGB565 for the status bar to save memory bandwidth and PixelFormat.TRANSLUCENT); // 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); // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies if (ActivityManager.isHighEndGfx(mDisplay)) { // very little screen real-estate and is updated fairly frequently. By using CPU rendering lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; // 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.gravity = getStatusBarGravity(); lp.setTitle("StatusBar"); lp.setTitle("StatusBar"); lp.packageName = mContext.getPackageName(); lp.packageName = mContext.getPackageName(); mStatusBarView = makeStatusBarView(); WindowManagerImpl.getDefault().addView(mStatusBarView, lp); } void addExpandedWindow() { WindowManager.LayoutParams lp; int pixelFormat; /// ---------- Expanded View -------------- pixelFormat = PixelFormat.TRANSLUCENT; lp = mExpandedDialog.getWindow().getAttributes(); lp.x = 0; lp.y = 0; lp.type = WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; lp.flags = 0 | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_DITHER | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; if (ActivityManager.isHighEndGfx(mDisplay)) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } lp.format = pixelFormat; lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL; lp.setTitle("StatusBarExpanded"); mExpandedParams = lp; updateExpandedSize(); mExpandedDialog.getWindow().setFormat(pixelFormat); mExpandedDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); makeStatusBarView(); mExpandedDialog.setContentView(mExpandedWindowView, WindowManagerImpl.getDefault().addView(mStatusBarWindow, lp); new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mExpandedDialog.getWindow().setBackgroundDrawable(null); //mExpandedDialog.show(); } } void setNotificationIconVisibility(boolean visible, int anim) { void setNotificationIconVisibility(boolean visible, int anim) { Loading Loading @@ -1935,20 +1889,25 @@ public class PhoneStatusBar extends BaseStatusBar { } } // catch orientation changes and other peculiar cases // catch orientation changes and other peculiar cases if (panelh > disph || (panelh < disph && !mTracking && !mAnimating)) if (panelh > disph || (panelh < disph && !mTracking && !mAnimating)) { panelh = disph; panelh = disph; } else if (panelh < 0) { panelh = 0; } mTrackingPosition = panelh; mTrackingPosition = panelh; // XXX: this is all very WIP //mNotificationPanel.setY(panelh); final View cropView = mNotificationPanel; final View cropView = mNotificationPanel; ViewGroup.LayoutParams lp = cropView.getLayoutParams(); ViewGroup.LayoutParams lp = cropView.getLayoutParams(); lp.height = panelh; lp.height = panelh; if (SPEW) { Slog.v(TAG, "updated cropView height=" + panelh); } cropView.setLayoutParams(lp); cropView.setLayoutParams(lp); // woo, special effects // woo, special effects final float frac = (float)panelh / disph; final float frac = (float)panelh / disph; final int color = ((int)(0xB0 * frac * frac)) << 24; final int color = ((int)(0xB0 * Math.pow(frac, 0.5))) << 24; mExpandedWindowView.setBackgroundColor(color); mStatusBarWindow.setBackgroundColor(color); // Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color)); // Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color)); Loading Loading @@ -2013,40 +1972,36 @@ public class PhoneStatusBar extends BaseStatusBar { // } // } } } int getExpandedHeight(int disph) { int getExpandedHeight() { if (DEBUG) { return mDisplayMetrics.heightPixels; Slog.d(TAG, "getExpandedHeight(" + disph + "): sbView=" + mStatusBarView.getHeight() + " closeView=" + mCloseView.getHeight()); } return disph; // - mStatusBarView.getHeight(); } } void updateDisplaySize() { void updateDisplaySize() { mDisplay.getMetrics(mDisplayMetrics); mDisplay.getMetrics(mDisplayMetrics); if (DEBUG) { // if (DEBUG) { Slog.d(TAG, "updateDisplaySize: " + mDisplayMetrics); // Slog.d(TAG, "updateDisplaySize: " + mDisplayMetrics); } // } updateExpandedSize(); // updateExpandedSize(); } } void updateExpandedSize() { // void updateExpandedSize() { if (DEBUG) { // if (DEBUG) { Slog.d(TAG, "updateExpandedSize()"); // Slog.d(TAG, "updateExpandedSize()"); } // } if (mExpandedDialog != null && mExpandedParams != null && mDisplayMetrics != null) { // if (mStatusBarWindow != null && mDisplayMetrics != null) { mExpandedParams.width = mDisplayMetrics.widthPixels; // mExpandedParams.width = mDisplayMetrics.widthPixels; mExpandedParams.height = getExpandedHeight(mDisplayMetrics.heightPixels); // mExpandedParams.height = getExpandedHeight(); if (!mExpandedVisible) { // if (!mExpandedVisible) { updateExpandedInvisiblePosition(); // updateExpandedInvisiblePosition(); } else { // } else { mExpandedDialog.getWindow().setAttributes(mExpandedParams); // mExpandedDialog.getWindow().setAttributes(mExpandedParams); } // } if (DEBUG) { // if (DEBUG) { Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " + // Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " + (mExpandedVisible ? "VISIBLE":"INVISIBLE")); // (mExpandedVisible ? "VISIBLE":"INVISIBLE")); } // } } // } } // } void performDisableActions(int net) { void performDisableActions(int net) { int old = mDisabled; int old = mDisabled; Loading