diff options
Diffstat (limited to 'packages/SystemUI/src/com')
4 files changed, 10 insertions, 145 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java index d7a5056..1ae15be 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java @@ -69,9 +69,9 @@ public class SystemUIService extends Service { IWindowManager wm = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); try { - SERVICES[0] = wm.canStatusBarHide() - ? R.string.config_statusBarComponent - : R.string.config_systemBarComponent; + SERVICES[0] = wm.hasSystemNavBar() + ? R.string.config_systemBarComponent + : R.string.config_statusBarComponent; } catch (RemoteException e) { Slog.w(TAG, "Failing checking whether status bar can hide", e); } 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 12c05ed..5ba72c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1766,11 +1766,6 @@ public class PhoneStatusBar extends BaseStatusBar { // 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 @@ -1779,9 +1774,7 @@ public class PhoneStatusBar extends BaseStatusBar { lp.gravity = getStatusBarGravity(); lp.setTitle("StatusBar"); lp.packageName = mContext.getPackageName(); - lp.windowAnimations = R.style.Animation_StatusBar; WindowManagerImpl.getDefault().addView(makeStatusBarView(), lp); - } void addExpandedWindow() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java deleted file mode 100644 index 3e9a9d8..0000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.statusbar.tablet; - -import java.util.ArrayList; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.res.Resources; -import android.util.DisplayMetrics; -import android.util.Slog; -import android.view.Display; -import android.view.WindowManager; -import android.view.WindowManagerImpl; -import android.view.WindowManagerPolicy; - -public class HeightReceiver extends BroadcastReceiver { - private static final String TAG = "StatusBar.HeightReceiver"; - - public interface OnBarHeightChangedListener { - public void onBarHeightChanged(int height); - } - - Context mContext; - ArrayList<OnBarHeightChangedListener> mListeners = new ArrayList<OnBarHeightChangedListener>(); - WindowManager mWindowManager; - int mHeight; - boolean mPlugged; - - public HeightReceiver(Context context) { - mContext = context; - mWindowManager = WindowManagerImpl.getDefault(); - } - - public void addOnBarHeightChangedListener(OnBarHeightChangedListener l) { - mListeners.add(l); - l.onBarHeightChanged(mHeight); - } - - public void removeOnBarHeightChangedListener(OnBarHeightChangedListener l) { - mListeners.remove(l); - } - - @Override - public void onReceive(Context context, Intent intent) { - final boolean plugged - = intent.getBooleanExtra(WindowManagerPolicy.EXTRA_HDMI_PLUGGED_STATE, false); - setPlugged(plugged); - } - - public void registerReceiver() { - final IntentFilter filter = new IntentFilter(); - filter.addAction(WindowManagerPolicy.ACTION_HDMI_PLUGGED); - final Intent val = mContext.registerReceiver(this, filter); - onReceive(mContext, val); - } - - private void setPlugged(boolean plugged) { - mPlugged = plugged; - updateHeight(); - } - - public void updateHeight() { - final Resources res = mContext.getResources(); - - int height = -1; - if (mPlugged) { - final DisplayMetrics metrics = new DisplayMetrics(); - Display display = mWindowManager.getDefaultDisplay(); - display.getRealMetrics(metrics); - - //Slog.i(TAG, "updateHeight: display metrics=" + metrics); - final int shortSide = Math.min(metrics.widthPixels, metrics.heightPixels); - final int externalShortSide = Math.min(display.getRawExternalWidth(), - display.getRawExternalHeight()); - height = shortSide - externalShortSide; - } - - final int minHeight - = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); - if (height < minHeight) { - height = minHeight; - } - Slog.i(TAG, "Resizing status bar plugged=" + mPlugged + " height=" - + height + " old=" + mHeight); - mHeight = height; - - final int N = mListeners.size(); - for (int i=0; i<N; i++) { - mListeners.get(i).onBarHeightChanged(height); - } - } - - public int getHeight() { - 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 7325a37..49b1a14 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -87,7 +87,6 @@ import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.Prefs; public class TabletStatusBar extends BaseStatusBar implements - HeightReceiver.OnBarHeightChangedListener, InputMethodsPanel.OnHardKeyboardEnabledChangeListener, RecentsPanelView.OnRecentsPanelVisibilityChangedListener { public static final boolean DEBUG = false; @@ -162,7 +161,6 @@ public class TabletStatusBar extends BaseStatusBar implements ViewGroup mPile; - HeightReceiver mHeightReceiver; BatteryController mBatteryController; BluetoothController mBluetoothController; LocationController mLocationController; @@ -204,12 +202,11 @@ public class TabletStatusBar extends BaseStatusBar implements private void addStatusBarWindow() { final View sb = makeStatusBarView(); - final int height = getStatusBarHeight(); final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, - height, - WindowManager.LayoutParams.TYPE_STATUS_BAR, + ViewGroup.LayoutParams.MATCH_PARENT, + WindowManager.LayoutParams.TYPE_NAVIGATION_BAR, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, @@ -218,20 +215,14 @@ public class TabletStatusBar extends BaseStatusBar implements // 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.setTitle("SystemBar"); lp.packageName = mContext.getPackageName(); - lp.windowAnimations = R.style.Animation_StatusBar; WindowManagerImpl.getDefault().addView(sb, lp); } @@ -414,7 +405,6 @@ public class TabletStatusBar extends BaseStatusBar implements @Override protected void onConfigurationChanged(Configuration newConfig) { - mHeightReceiver.updateHeight(); // display size may have changed loadDimens(); mNotificationPanelParams.height = getNotificationPanelHeight(); WindowManagerImpl.getDefault().updateViewLayout(mNotificationPanel, @@ -426,7 +416,7 @@ public class TabletStatusBar extends BaseStatusBar implements final Resources res = mContext.getResources(); mNaturalBarHeight = res.getDimensionPixelSize( - com.android.internal.R.dimen.system_bar_height); + com.android.internal.R.dimen.navigation_bar_height); int newIconSize = res.getDimensionPixelSize( com.android.internal.R.dimen.system_bar_icon_size); @@ -478,10 +468,6 @@ public class TabletStatusBar extends BaseStatusBar implements mWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); - // This guy will listen for HDMI plugged broadcasts so we can resize the - // status bar as appropriate. - mHeightReceiver = new HeightReceiver(mContext); - mHeightReceiver.registerReceiver(); loadDimens(); final TabletStatusBarView sb = (TabletStatusBarView)View.inflate( @@ -637,8 +623,6 @@ public class TabletStatusBar extends BaseStatusBar implements // set the initial view visibility setAreThereNotifications(); - mHeightReceiver.addOnBarHeightChangedListener(this); - // receive broadcasts IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); @@ -674,7 +658,9 @@ public class TabletStatusBar extends BaseStatusBar implements } public int getStatusBarHeight() { - return mHeightReceiver.getHeight(); + return mStatusBarView != null ? mStatusBarView.getHeight() + : mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_height); } protected int getStatusBarGravity() { |