diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-08-19 20:30:52 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-08-19 22:42:08 -0700 |
commit | 98365d7663cbd82979a5700faf0050220b01084d (patch) | |
tree | 8a4ff3e0a8afd814ed29609b26aa1c6ade2367f6 /packages/SystemUI/src | |
parent | 848c2dc93b6795e171f3dd6f64ea0be65e2762ca (diff) | |
download | frameworks_base-98365d7663cbd82979a5700faf0050220b01084d.zip frameworks_base-98365d7663cbd82979a5700faf0050220b01084d.tar.gz frameworks_base-98365d7663cbd82979a5700faf0050220b01084d.tar.bz2 |
Refactor for multi-display support.
Split WindowManagerImpl into two parts, the WindowManager
interface implementation remains where it is but the global
communications with the window manager are now handled by
the WindowManagerGlobal class. This change greatly simplifies
the challenge of having separate WindowManager instances
for each Context.
Removed WindowManagerImpl.getDefault(). This represents the
bulk of this change. Most of the usages of this method were
either to perform global functions (now handled by WindowManagerGlobal)
or to obtain the default display (now handled by DisplayManager).
Explicitly associate each new window with a display and make
the Display object available to the View hierarchy.
Add stubs for some new display manager API features.
Start to split apart the concepts of display id and layer stack.
since they operate at different layers of abstraction.
While it's true that each logical display uniquely corresponds to a
surface flinger layer stack, it is not necessarily the case that
they must use the same ids. Added Display.getLayerStack()
and started using it in places where it was relatively easy to do.
Change-Id: I29ed909114dec86807c4d3a5059c3fa0358bea61
Diffstat (limited to 'packages/SystemUI/src')
11 files changed, 58 insertions, 92 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java index a72074e..2512c02 100644 --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java @@ -74,10 +74,7 @@ public class ImageWallpaper extends WallpaperService { //noinspection PointlessBooleanExpression,ConstantConditions if (FIXED_SIZED_SURFACE && USE_OPENGL) { if (!isEmulator()) { - WindowManager windowManager = - (WindowManager) getSystemService(Context.WINDOW_SERVICE); - Display display = windowManager.getDefaultDisplay(); - mIsHwAccelerated = ActivityManager.isHighEndGfx(display); + mIsHwAccelerated = ActivityManager.isHighEndGfx(); } } } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java index 0a57499..1bde949 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java @@ -31,6 +31,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.Slog; import android.view.IWindowManager; +import android.view.WindowManagerGlobal; public class SystemUIService extends Service { static final String TAG = "SystemUIService"; @@ -67,8 +68,7 @@ public class SystemUIService extends Service { @Override public void onCreate() { // Pick status bar or system bar. - IWindowManager wm = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); + IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); try { SERVICES[0] = wm.hasSystemNavBar() ? R.string.config_systemBarComponent diff --git a/packages/SystemUI/src/com/android/systemui/UniverseBackground.java b/packages/SystemUI/src/com/android/systemui/UniverseBackground.java index 4852a3e..7628754 100644 --- a/packages/SystemUI/src/com/android/systemui/UniverseBackground.java +++ b/packages/SystemUI/src/com/android/systemui/UniverseBackground.java @@ -33,6 +33,7 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewRootImpl; import android.view.WindowManager; +import android.view.WindowManagerGlobal; import android.view.animation.Transformation; import android.widget.FrameLayout; @@ -96,7 +97,7 @@ public class UniverseBackground extends FrameLayout { public UniverseBackground(Context context) { super(context); setBackgroundColor(0xff000000); - mSession = ViewRootImpl.getWindowSession(context.getMainLooper()); + mSession = WindowManagerGlobal.getWindowSession(context.getMainLooper()); mContent = View.inflate(context, R.layout.universe, null); addView(mContent); mContent.findViewById(R.id.close).setOnClickListener(new View.OnClickListener() { @@ -155,7 +156,7 @@ public class UniverseBackground extends FrameLayout { } } - public WindowManager.LayoutParams getLayoutParams(Display display) { + public WindowManager.LayoutParams getLayoutParams() { WindowManager.LayoutParams lp = new WindowManager.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_UNIVERSE_BACKGROUND, @@ -165,7 +166,7 @@ public class UniverseBackground extends FrameLayout { | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, PixelFormat.OPAQUE); // this will allow the window to run in an overlay on devices that support this - if (ActivityManager.isHighEndGfx(display)) { + if (ActivityManager.isHighEndGfx()) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } lp.setTitle("UniverseBackground"); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index d5a76bc..b407078 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -49,6 +49,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; +import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AnimationUtils; import android.widget.AdapterView; @@ -488,9 +489,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener mChoreo = new Choreographer(this, mRecentsScrim, mRecentsContainer, mRecentsNoApps, this); if (mRecentsScrim != null) { - Display d = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay(); - mHighEndGfx = ActivityManager.isHighEndGfx(d); + mHighEndGfx = ActivityManager.isHighEndGfx(); if (!mHighEndGfx) { mRecentsScrim.setBackground(null); } else if (mRecentsScrim.getBackground() instanceof BitmapDrawable) { @@ -733,8 +732,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener if (mTransitionBg == null) { mTransitionBg = (View) findViewById(R.id.recents_transition_background); - IWindowManager wm = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); + IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); try { if (!wm.hasSystemNavBar()) { FrameLayout.LayoutParams lp = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 646f98a..e9e043e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -61,9 +61,9 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManagerGlobal; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; -import android.view.WindowManagerImpl; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupMenu; @@ -127,17 +127,11 @@ public abstract class BaseStatusBar extends SystemUI implements */ protected abstract void createAndAddWindows(); + protected WindowManager mWindowManager; + protected IWindowManager mWindowManagerService; protected Display mDisplay; - private IWindowManager mWindowManager; - private boolean mDeviceProvisioned = false; - - public IWindowManager getWindowManager() { - return mWindowManager; - } - public Display getDisplay() { - return mDisplay; - } + private boolean mDeviceProvisioned = false; public IStatusBarService getStatusBarService() { return mBarService; @@ -189,17 +183,15 @@ public abstract class BaseStatusBar extends SystemUI implements }; public void start() { - mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay(); + mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); + mWindowManagerService = WindowManagerGlobal.getWindowManagerService(); + mDisplay = mWindowManager.getDefaultDisplay(); mProvisioningObserver.onChange(false); // set up mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.DEVICE_PROVISIONED), true, mProvisioningObserver); - mWindowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); - mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); @@ -436,7 +428,7 @@ public abstract class BaseStatusBar extends SystemUI implements boolean firstScreenful = false; if (mRecentsPanel != null) { visible = mRecentsPanel.isShowing(); - WindowManagerImpl.getDefault().removeView(mRecentsPanel); + mWindowManager.removeView(mRecentsPanel); if (visible) { recentTasksList = mRecentsPanel.getRecentTasksList(); firstScreenful = mRecentsPanel.getFirstScreenful(); @@ -456,7 +448,7 @@ public abstract class BaseStatusBar extends SystemUI implements WindowManager.LayoutParams lp = getRecentsLayoutParams(mRecentsPanel.getLayoutParams()); - WindowManagerImpl.getDefault().addView(mRecentsPanel, lp); + mWindowManager.addView(mRecentsPanel, lp); mRecentsPanel.setBar(this); if (visible) { mRecentsPanel.show(true, false, recentTasksList, firstScreenful); @@ -469,7 +461,7 @@ public abstract class BaseStatusBar extends SystemUI implements boolean visible = false; if (mSearchPanelView != null) { visible = mSearchPanelView.isShowing(); - WindowManagerImpl.getDefault().removeView(mSearchPanelView); + mWindowManager.removeView(mSearchPanelView); } // Provide SearchPanel with a temporary parent to allow layout params to work. @@ -482,7 +474,7 @@ public abstract class BaseStatusBar extends SystemUI implements WindowManager.LayoutParams lp = getSearchLayoutParams(mSearchPanelView.getLayoutParams()); - WindowManagerImpl.getDefault().addView(mSearchPanelView, lp); + mWindowManager.addView(mSearchPanelView, lp); mSearchPanelView.setBar(this); if (visible) { mSearchPanelView.show(true, false); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 63c9b79..33973b6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -18,13 +18,11 @@ package com.android.systemui.statusbar.phone; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; import android.app.StatusBarManager; import android.content.Context; import android.content.res.Resources; import android.graphics.Point; import android.graphics.Rect; -import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Message; @@ -34,19 +32,14 @@ import android.util.Slog; import android.view.animation.AccelerateInterpolator; import android.view.Display; import android.view.MotionEvent; -import android.view.VelocityTracker; import android.view.View; -import android.view.ViewGroup; import android.view.Surface; -import android.view.Window; import android.view.WindowManager; -import android.view.WindowManagerImpl; import android.widget.ImageView; import android.widget.LinearLayout; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.lang.StringBuilder; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.R; @@ -244,7 +237,8 @@ public class NavigationBarView extends LinearLayout { } else { return; } - WindowManagerImpl.getDefault().updateViewLayout(this, lp); + WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE); + wm.updateViewLayout(this, lp); } } 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 49e4760..2886441 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -60,9 +60,9 @@ import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManagerGlobal; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; -import android.view.WindowManagerImpl; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.AnimationUtils; @@ -150,7 +150,6 @@ public class PhoneStatusBar extends BaseStatusBar { int mIconHPadding = -1; Display mDisplay; - IWindowManager mWindowManager; IDreamManager mDreamManager; StatusBarWindowView mStatusBarWindow; @@ -261,9 +260,6 @@ public class PhoneStatusBar extends BaseStatusBar { mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); - mWindowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); - mDreamManager = IDreamManager.Stub.asInterface( ServiceManager.checkService("dreams")); @@ -332,7 +328,7 @@ public class PhoneStatusBar extends BaseStatusBar { mSettingsPanel = (PanelView) mStatusBarWindow.findViewById(R.id.settings_panel); mSettingsPanel.setOnTouchListener(clickStopper); - if (!ActivityManager.isHighEndGfx(mDisplay)) { + if (!ActivityManager.isHighEndGfx()) { mStatusBarWindow.setBackground(null); mNotificationPanel.setBackground(new FastColorDrawable(context.getResources().getColor( R.color.notification_panel_solid_background))); @@ -352,7 +348,7 @@ public class PhoneStatusBar extends BaseStatusBar { updateShowSearchHoldoff(); try { - boolean showNav = mWindowManager.hasNavigationBar(); + boolean showNav = mWindowManagerService.hasNavigationBar(); if (DEBUG) Slog.v(TAG, "hasNavigationBar=" + showNav); if (showNav) { mNavigationBarView = @@ -474,7 +470,7 @@ public class PhoneStatusBar extends BaseStatusBar { | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, (opaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT)); - if (ActivityManager.isHighEndGfx(mDisplay)) { + if (ActivityManager.isHighEndGfx()) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } else { lp.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND; @@ -499,7 +495,7 @@ public class PhoneStatusBar extends BaseStatusBar { | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, (opaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT)); - if (ActivityManager.isHighEndGfx(mDisplay)) { + if (ActivityManager.isHighEndGfx()) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } lp.gravity = Gravity.BOTTOM | Gravity.LEFT; @@ -535,7 +531,7 @@ public class PhoneStatusBar extends BaseStatusBar { WindowManager.LayoutParams lp = (android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams(); lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; - WindowManagerImpl.getDefault().updateViewLayout(mNavigationBarView, lp); + mWindowManager.updateViewLayout(mNavigationBarView, lp); } @Override @@ -544,7 +540,7 @@ public class PhoneStatusBar extends BaseStatusBar { WindowManager.LayoutParams lp = (android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams(); lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; - WindowManagerImpl.getDefault().updateViewLayout(mNavigationBarView, lp); + mWindowManager.updateViewLayout(mNavigationBarView, lp); } protected int getStatusBarGravity() { @@ -620,8 +616,7 @@ public class PhoneStatusBar extends BaseStatusBar { prepareNavigationBarView(); - WindowManagerImpl.getDefault().addView( - mNavigationBarView, getNavigationBarLayoutParams()); + mWindowManager.addView(mNavigationBarView, getNavigationBarLayoutParams()); } private void repositionNavigationBar() { @@ -629,8 +624,7 @@ public class PhoneStatusBar extends BaseStatusBar { prepareNavigationBarView(); - WindowManagerImpl.getDefault().updateViewLayout( - mNavigationBarView, getNavigationBarLayoutParams()); + mWindowManager.updateViewLayout(mNavigationBarView, getNavigationBarLayoutParams()); } private WindowManager.LayoutParams getNavigationBarLayoutParams() { @@ -644,7 +638,7 @@ public class PhoneStatusBar extends BaseStatusBar { | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, PixelFormat.OPAQUE); // this will allow the navbar to run in an overlay on devices that support this - if (ActivityManager.isHighEndGfx(mDisplay)) { + if (ActivityManager.isHighEndGfx()) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } @@ -671,7 +665,7 @@ public class PhoneStatusBar extends BaseStatusBar { lp.packageName = mContext.getPackageName(); lp.windowAnimations = R.style.Animation_StatusBar_IntruderAlert; - WindowManagerImpl.getDefault().addView(mIntruderAlertView, lp); + mWindowManager.addView(mIntruderAlertView, lp); } public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) { @@ -1157,8 +1151,7 @@ public class PhoneStatusBar extends BaseStatusBar { lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; lp.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; lp.height = ViewGroup.LayoutParams.MATCH_PARENT; - final WindowManager wm = WindowManagerImpl.getDefault(); - wm.updateViewLayout(mStatusBarWindow, lp); + mWindowManager.updateViewLayout(mStatusBarWindow, lp); // Updating the window layout will force an expensive traversal/redraw. // Kick off the reveal animation after this is complete to avoid animation latency. @@ -1231,8 +1224,7 @@ public class PhoneStatusBar extends BaseStatusBar { lp.height = getStatusBarHeight(); lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; lp.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; - final WindowManager wm = WindowManagerImpl.getDefault(); - wm.updateViewLayout(mStatusBarWindow, lp); + mWindowManager.updateViewLayout(mStatusBarWindow, lp); if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) { setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in); @@ -1409,7 +1401,7 @@ public class PhoneStatusBar extends BaseStatusBar { private void notifyUiVisibilityChanged() { try { - mWindowManager.statusBarVisibilityChanged(mSystemUiVisibility); + mWindowManagerService.statusBarVisibilityChanged(mSystemUiVisibility); } catch (RemoteException ex) { } } @@ -1615,7 +1607,7 @@ public class PhoneStatusBar extends BaseStatusBar { lp.packageName = mContext.getPackageName(); makeStatusBarView(); - WindowManagerImpl.getDefault().addView(mStatusBarWindow, lp); + mWindowManager.addView(mStatusBarWindow, lp); } void setNotificationIconVisibility(boolean visible, int anim) { 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 2a96d6d..6d47493 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -140,7 +140,7 @@ public class PhoneStatusBarView extends PanelBar { super.panelExpansionChanged(pv, frac); if (mFadingPanel == pv - && mScrimColor != 0 && ActivityManager.isHighEndGfx(mBar.mDisplay)) { + && mScrimColor != 0 && ActivityManager.isHighEndGfx()) { // woo, special effects final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2.2f)))); // attenuate background color alpha by k diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java index ddb43b8..2924cc9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java @@ -34,7 +34,6 @@ import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; -import android.view.WindowManagerImpl; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; 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 cbd8831..84697e0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -53,7 +53,6 @@ import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; -import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; import android.widget.LinearLayout; @@ -124,8 +123,6 @@ public class TabletStatusBar extends BaseStatusBar implements int mMenuNavIconWidth = -1; private int mMaxNotificationIcons = 5; - IWindowManager mWindowManager; - TabletStatusBarView mStatusBarView; View mNotificationArea; View mNotificationTrigger; @@ -241,7 +238,7 @@ public class TabletStatusBar extends BaseStatusBar implements lp.gravity = getStatusBarGravity(); lp.setTitle("SystemBar"); lp.packageName = mContext.getPackageName(); - WindowManagerImpl.getDefault().addView(sb, lp); + mWindowManager.addView(sb, lp); } protected void addPanelWindows() { @@ -306,7 +303,7 @@ public class TabletStatusBar extends BaseStatusBar implements lp.windowAnimations = com.android.internal.R.style.Animation; // == no animation // lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade - WindowManagerImpl.getDefault().addView(mNotificationPanel, lp); + mWindowManager.addView(mNotificationPanel, lp); // Recents Panel mRecentTasksLoader = new RecentTasksLoader(context); @@ -338,7 +335,7 @@ public class TabletStatusBar extends BaseStatusBar implements lp.setTitle("InputMethodsPanel"); lp.windowAnimations = R.style.Animation_RecentPanel; - WindowManagerImpl.getDefault().addView(mInputMethodsPanel, lp); + mWindowManager.addView(mInputMethodsPanel, lp); // Compatibility mode selector panel mCompatModePanel = (CompatModePanel) View.inflate(context, @@ -361,7 +358,7 @@ public class TabletStatusBar extends BaseStatusBar implements lp.setTitle("CompatModePanel"); lp.windowAnimations = android.R.style.Animation_Dialog; - WindowManagerImpl.getDefault().addView(mCompatModePanel, lp); + mWindowManager.addView(mCompatModePanel, lp); mRecentButton.setOnTouchListener(mRecentsPanel); @@ -380,7 +377,7 @@ public class TabletStatusBar extends BaseStatusBar implements private int getNotificationPanelHeight() { final Resources res = mContext.getResources(); - final Display d = WindowManagerImpl.getDefault().getDefaultDisplay(); + final Display d = mWindowManager.getDefaultDisplay(); final Point size = new Point(); d.getRealSize(size); return Math.max(res.getDimensionPixelSize(R.dimen.notification_panel_min_height), size.y); @@ -395,8 +392,7 @@ public class TabletStatusBar extends BaseStatusBar implements protected void onConfigurationChanged(Configuration newConfig) { loadDimens(); mNotificationPanelParams.height = getNotificationPanelHeight(); - WindowManagerImpl.getDefault().updateViewLayout(mNotificationPanel, - mNotificationPanelParams); + mWindowManager.updateViewLayout(mNotificationPanel, mNotificationPanelParams); mRecentsPanel.updateValuesFromResources(); mShowSearchHoldoff = mContext.getResources().getInteger( R.integer.config_show_search_delay); @@ -456,9 +452,6 @@ public class TabletStatusBar extends BaseStatusBar implements protected View makeStatusBarView() { final Context context = mContext; - mWindowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); - loadDimens(); final TabletStatusBarView sb = (TabletStatusBarView)View.inflate( @@ -470,7 +463,7 @@ public class TabletStatusBar extends BaseStatusBar implements try { // Sanity-check that someone hasn't set up the config wrong and asked for a navigation // bar on a tablet that has only the system bar - if (mWindowManager.hasNavigationBar()) { + if (mWindowManagerService.hasNavigationBar()) { Slog.e(TAG, "Tablet device cannot show navigation bar and system bar"); } } catch (RemoteException ex) { @@ -648,7 +641,7 @@ public class TabletStatusBar extends BaseStatusBar implements | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, (opaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT)); - if (ActivityManager.isHighEndGfx(mDisplay)) { + if (ActivityManager.isHighEndGfx()) { lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } else { lp.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND; @@ -681,7 +674,7 @@ public class TabletStatusBar extends BaseStatusBar implements WindowManager.LayoutParams lp = (android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams(); lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; - WindowManagerImpl.getDefault().updateViewLayout(mStatusBarView, lp); + mWindowManager.updateViewLayout(mStatusBarView, lp); } @Override @@ -690,7 +683,7 @@ public class TabletStatusBar extends BaseStatusBar implements WindowManager.LayoutParams lp = (android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams(); lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; - WindowManagerImpl.getDefault().updateViewLayout(mStatusBarView, lp); + mWindowManager.updateViewLayout(mStatusBarView, lp); } public int getStatusBarHeight() { @@ -712,8 +705,7 @@ public class TabletStatusBar extends BaseStatusBar implements } if (lp.height != height) { lp.height = height; - final WindowManager wm = WindowManagerImpl.getDefault(); - wm.updateViewLayout(mStatusBarView, lp); + mWindowManager.updateViewLayout(mStatusBarView, lp); } } @@ -1068,7 +1060,7 @@ public class TabletStatusBar extends BaseStatusBar implements private void notifyUiVisibilityChanged() { try { - mWindowManager.statusBarVisibilityChanged(mSystemUiVisibility); + mWindowManagerService.statusBarVisibilityChanged(mSystemUiVisibility); } catch (RemoteException ex) { } } @@ -1160,12 +1152,12 @@ public class TabletStatusBar extends BaseStatusBar implements | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING; lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade - WindowManagerImpl.getDefault().addView(mCompatibilityHelpDialog, lp); + mWindowManager.addView(mCompatibilityHelpDialog, lp); } private void hideCompatibilityHelp() { if (mCompatibilityHelpDialog != null) { - WindowManagerImpl.getDefault().removeView(mCompatibilityHelpDialog); + mWindowManager.removeView(mCompatibilityHelpDialog); mCompatibilityHelpDialog = null; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java index d4ebe6d..932b035 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java @@ -35,7 +35,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; -import android.view.WindowManagerImpl; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.FrameLayout; @@ -62,7 +61,8 @@ public class TabletTicker private static final int ADVANCE_DELAY = 5000; // 5 seconds - private Context mContext; + private final Context mContext; + private final WindowManager mWindowManager; private ViewGroup mWindow; private IBinder mCurrentKey; @@ -83,6 +83,7 @@ public class TabletTicker public TabletTicker(TabletStatusBar bar) { mBar = bar; mContext = bar.getContext(); + mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); final Resources res = mContext.getResources(); mLargeIconHeight = res.getDimensionPixelSize( android.R.dimen.notification_large_icon_height); @@ -178,7 +179,7 @@ public class TabletTicker if (mCurrentView != null) { if (mWindow == null) { mWindow = makeWindow(); - WindowManagerImpl.getDefault().addView(mWindow, mWindow.getLayoutParams()); + mWindowManager.addView(mWindow, mWindow.getLayoutParams()); } mWindow.addView(mCurrentView); @@ -242,7 +243,7 @@ public class TabletTicker public void endTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) { if (mWindowShouldClose) { - WindowManagerImpl.getDefault().removeView(mWindow); + mWindowManager.removeView(mWindow); mWindow = null; mWindowShouldClose = false; mBar.doneTicking(); |