Preload recents on phones with hard nav keys
Also refactor recents code across Phone/Tablet
Change-Id: Id557c5cb0f7d9378f81c40b20511a5d98bf4078e
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 564b07b..ebed522 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -456,6 +456,9 @@
mPreloadTasksRunnable = new Runnable() {
public void run() {
+ // If we set our visibility to INVISIBLE here, we avoid an extra call to
+ // onLayout later when we become visible (because onLayout is always called
+ // when going from GONE)
if (!mShowing) {
setVisibility(INVISIBLE);
refreshRecentTasksList();
@@ -562,9 +565,6 @@
if (!mShowing) {
int action = ev.getAction() & MotionEvent.ACTION_MASK;
if (action == MotionEvent.ACTION_DOWN) {
- // If we set our visibility to INVISIBLE here, we avoid an extra call to
- // onLayout later when we become visible (because onLayout is always called
- // when going from GONE)
post(mPreloadTasksRunnable);
} else if (action == MotionEvent.ACTION_CANCEL) {
setVisibility(GONE);
@@ -583,9 +583,15 @@
return false;
}
+ public void preloadRecentTasksList() {
+ if (!mShowing) {
+ mPreloadTasksRunnable.run();
+ }
+ }
+
public void clearRecentTasksList() {
// Clear memory used by screenshots
- if (mRecentTaskDescriptions != null) {
+ if (!mShowing && mRecentTaskDescriptions != null) {
mRecentTasksLoader.cancelLoadingThumbnailsAndIcons();
mRecentTaskDescriptions.clear();
mListAdapter.notifyDataSetInvalidated();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 3a06127..832d539 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -19,31 +19,53 @@
import java.util.ArrayList;
import android.content.Context;
+import android.os.Handler;
import android.os.IBinder;
+import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import android.util.Slog;
import android.view.Display;
import android.view.IWindowManager;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
+import android.view.WindowManagerImpl;
+import android.widget.LinearLayout;
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.recent.RecentsPanelView;
+import com.android.systemui.recent.RecentTasksLoader;
+import com.android.systemui.recent.TaskDescription;
import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.tablet.StatusBarPanel;
import com.android.systemui.R;
-public abstract class BaseStatusBar extends SystemUI implements CommandQueue.Callbacks {
+public abstract class BaseStatusBar extends SystemUI implements
+ CommandQueue.Callbacks, RecentsPanelView.OnRecentsPanelVisibilityChangedListener {
static final String TAG = "StatusBar";
private static final boolean DEBUG = false;
+ protected static final int MSG_OPEN_RECENTS_PANEL = 1020;
+ protected static final int MSG_CLOSE_RECENTS_PANEL = 1021;
+ protected static final int MSG_PRELOAD_RECENT_APPS = 1022;
+ protected static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 1023;
+
protected CommandQueue mCommandQueue;
protected IStatusBarService mBarService;
+ protected H mHandler = createHandler();
+
+ // Recent apps
+ protected RecentsPanelView mRecentsPanel;
+ protected RecentTasksLoader mRecentTasksLoader;
// UI-specific methods
@@ -162,4 +184,121 @@
public void dismissIntruder() {
// pass
}
+
+ @Override
+ public void toggleRecentApps() {
+ int msg = (mRecentsPanel.getVisibility() == View.VISIBLE)
+ ? MSG_CLOSE_RECENTS_PANEL : MSG_OPEN_RECENTS_PANEL;
+ mHandler.removeMessages(msg);
+ mHandler.sendEmptyMessage(msg);
+ }
+
+ @Override
+ public void preloadRecentApps() {
+ int msg = MSG_PRELOAD_RECENT_APPS;
+ mHandler.removeMessages(msg);
+ mHandler.sendEmptyMessage(msg);
+ }
+
+ @Override
+ public void cancelPreloadRecentApps() {
+ int msg = MSG_CANCEL_PRELOAD_RECENT_APPS;
+ mHandler.removeMessages(msg);
+ mHandler.sendEmptyMessage(msg);
+ }
+
+ @Override
+ public void onRecentsPanelVisibilityChanged(boolean visible) {
+ }
+
+ protected abstract WindowManager.LayoutParams getRecentsLayoutParams(
+ LayoutParams layoutParams);
+
+ protected void updateRecentsPanel() {
+ // Recents Panel
+ boolean visible = false;
+ ArrayList<TaskDescription> recentTasksList = null;
+ boolean firstScreenful = false;
+ if (mRecentsPanel != null) {
+ visible = mRecentsPanel.isShowing();
+ WindowManagerImpl.getDefault().removeView(mRecentsPanel);
+ if (visible) {
+ recentTasksList = mRecentsPanel.getRecentTasksList();
+ firstScreenful = mRecentsPanel.getFirstScreenful();
+ }
+ }
+
+ // Provide RecentsPanelView with a temporary parent to allow layout params to work.
+ LinearLayout tmpRoot = new LinearLayout(mContext);
+ mRecentsPanel = (RecentsPanelView) LayoutInflater.from(mContext).inflate(
+ R.layout.status_bar_recent_panel, tmpRoot, false);
+ mRecentsPanel.setRecentTasksLoader(mRecentTasksLoader);
+ mRecentTasksLoader.setRecentsPanel(mRecentsPanel);
+ mRecentsPanel.setOnTouchListener(
+ new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL, mRecentsPanel));
+ mRecentsPanel.setVisibility(View.GONE);
+
+
+ WindowManager.LayoutParams lp = getRecentsLayoutParams(mRecentsPanel.getLayoutParams());
+
+ WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
+ mRecentsPanel.setBar(this);
+ if (visible) {
+ mRecentsPanel.show(true, false, recentTasksList, firstScreenful);
+ }
+
+ }
+
+ H createHandler() {
+ return new H();
+ }
+
+ protected class H extends Handler {
+ public void handleMessage(Message m) {
+ switch (m.what) {
+ case MSG_OPEN_RECENTS_PANEL:
+ if (DEBUG) Slog.d(TAG, "opening recents panel");
+ if (mRecentsPanel != null) {
+ mRecentsPanel.show(true, true);
+ }
+ break;
+ case MSG_CLOSE_RECENTS_PANEL:
+ if (DEBUG) Slog.d(TAG, "closing recents panel");
+ if (mRecentsPanel != null && mRecentsPanel.isShowing()) {
+ mRecentsPanel.show(false, true);
+ }
+ break;
+ case MSG_PRELOAD_RECENT_APPS:
+ if (DEBUG) Slog.d(TAG, "preloading recents");
+ mRecentsPanel.preloadRecentTasksList();
+ break;
+ case MSG_CANCEL_PRELOAD_RECENT_APPS:
+ if (DEBUG) Slog.d(TAG, "cancel preloading recents");
+ mRecentsPanel.clearRecentTasksList();
+ break;
+ }
+ }
+ }
+
+ public class TouchOutsideListener implements View.OnTouchListener {
+ private int mMsg;
+ private StatusBarPanel mPanel;
+
+ public TouchOutsideListener(int msg, StatusBarPanel panel) {
+ mMsg = msg;
+ mPanel = panel;
+ }
+
+ public boolean onTouch(View v, MotionEvent ev) {
+ final int action = ev.getAction();
+ if (action == MotionEvent.ACTION_OUTSIDE
+ || (action == MotionEvent.ACTION_DOWN
+ && !mPanel.isInContentArea((int)ev.getX(), (int)ev.getY()))) {
+ mHandler.removeMessages(mMsg);
+ mHandler.sendEmptyMessage(mMsg);
+ return true;
+ }
+ return false;
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index f8dfa8f..37ab58a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -61,8 +61,10 @@
private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT;
private static final int MSG_TOGGLE_RECENT_APPS = 11 << MSG_SHIFT;
+ private static final int MSG_PRELOAD_RECENT_APPS = 12 << MSG_SHIFT;
+ private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 13 << MSG_SHIFT;
- private static final int MSG_SET_NAVIGATION_ICON_HINTS = 13 << MSG_SHIFT;
+ private static final int MSG_SET_NAVIGATION_ICON_HINTS = 14 << MSG_SHIFT;
private StatusBarIconList mList;
private Callbacks mCallbacks;
@@ -92,6 +94,8 @@
public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
public void setHardKeyboardStatus(boolean available, boolean enabled);
public void toggleRecentApps();
+ public void preloadRecentApps();
+ public void cancelPreloadRecentApps();
public void setNavigationIconHints(int hints);
}
@@ -199,6 +203,20 @@
}
}
+ public void preloadRecentApps() {
+ synchronized (mList) {
+ mHandler.removeMessages(MSG_PRELOAD_RECENT_APPS);
+ mHandler.obtainMessage(MSG_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
+ }
+ }
+
+ public void cancelPreloadRecentApps() {
+ synchronized (mList) {
+ mHandler.removeMessages(MSG_CANCEL_PRELOAD_RECENT_APPS);
+ mHandler.obtainMessage(MSG_CANCEL_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
+ }
+ }
+
public void setNavigationIconHints(int hints) {
synchronized (mList) {
mHandler.removeMessages(MSG_SET_NAVIGATION_ICON_HINTS);
@@ -275,6 +293,12 @@
case MSG_TOGGLE_RECENT_APPS:
mCallbacks.toggleRecentApps();
break;
+ case MSG_PRELOAD_RECENT_APPS:
+ mCallbacks.preloadRecentApps();
+ break;
+ case MSG_CANCEL_PRELOAD_RECENT_APPS:
+ mCallbacks.cancelPreloadRecentApps();
+ break;
case MSG_SET_NAVIGATION_ICON_HINTS:
mCallbacks.setNavigationIconHints(msg.arg1);
break;
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 85e0a8a..f009d13 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -30,24 +30,22 @@
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
import android.content.res.Configuration;
-import android.inputmethodservice.InputMethodService;
+import android.content.res.Resources;
import android.graphics.PixelFormat;
import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
+import android.inputmethodservice.InputMethodService;
import android.os.Build;
import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.Handler;
import android.os.Message;
+import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.DisplayMetrics;
-import android.util.Slog;
import android.util.Log;
+import android.util.Slog;
import android.view.Display;
import android.view.Gravity;
import android.view.IWindowManager;
@@ -76,19 +74,16 @@
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarNotification;
-
import com.android.systemui.R;
import com.android.systemui.SwipeHelper;
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.BaseStatusBar;
-import com.android.systemui.statusbar.StatusBarIconView;
+import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.SignalClusterView;
-import com.android.systemui.statusbar.policy.DateView;
+import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.IntruderAlertView;
+import com.android.systemui.statusbar.policy.DateView;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NotificationRowLayout;
@@ -116,8 +111,7 @@
private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
private static final int MSG_SHOW_INTRUDER = 1002;
private static final int MSG_HIDE_INTRUDER = 1003;
- private static final int MSG_OPEN_RECENTS_PANEL = 1020;
- private static final int MSG_CLOSE_RECENTS_PANEL = 1021;
+ // 1020-1030 reserved for BaseStatusBar
// will likely move to a resource or other tunable param at some point
private static final int INTRUDER_ALERT_DECAY_MS = 0; // disabled, was 10000;
@@ -152,7 +146,6 @@
PhoneStatusBarView mStatusBarView;
int mPixelFormat;
- H mHandler = new H();
Object mQueueLock = new Object();
// icons
@@ -202,10 +195,6 @@
private View mTickerView;
private boolean mTicking;
- // Recent apps
- private RecentsPanelView mRecentsPanel;
- private RecentTasksLoader mRecentTasksLoader;
-
// Tracking finger for opening/closing.
int mEdgeBorder; // corresponds to R.dimen.status_bar_edge_ignore
boolean mTracking;
@@ -382,6 +371,7 @@
return sb;
}
+ @Override
protected WindowManager.LayoutParams getRecentsLayoutParams(LayoutParams layoutParams) {
boolean opaque = false;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
@@ -406,42 +396,13 @@
return lp;
}
+ @Override
protected void updateRecentsPanel() {
- // Recents Panel
- boolean visible = false;
- ArrayList<TaskDescription> recentTasksList = null;
- boolean firstScreenful = false;
- if (mRecentsPanel != null) {
- visible = mRecentsPanel.isShowing();
- WindowManagerImpl.getDefault().removeView(mRecentsPanel);
- if (visible) {
- recentTasksList = mRecentsPanel.getRecentTasksList();
- firstScreenful = mRecentsPanel.getFirstScreenful();
- }
- }
-
- // Provide RecentsPanelView with a temporary parent to allow layout params to work.
- LinearLayout tmpRoot = new LinearLayout(mContext);
- mRecentsPanel = (RecentsPanelView) LayoutInflater.from(mContext).inflate(
- R.layout.status_bar_recent_panel, tmpRoot, false);
- mRecentsPanel.setRecentTasksLoader(mRecentTasksLoader);
- mRecentTasksLoader.setRecentsPanel(mRecentsPanel);
- mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL,
- mRecentsPanel));
- mRecentsPanel.setVisibility(View.GONE);
-
+ super.updateRecentsPanel();
// Make .03 alpha the minimum so you always see the item a bit-- slightly below
// .03, the item disappears entirely (as if alpha = 0) and that discontinuity looks
// a bit jarring
mRecentsPanel.setMinSwipeAlpha(0.03f);
- WindowManager.LayoutParams lp = getRecentsLayoutParams(mRecentsPanel.getLayoutParams());
-
- WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
- mRecentsPanel.setBar(this);
- if (visible) {
- mRecentsPanel.show(true, false, recentTasksList, firstScreenful);
- }
-
}
protected int getStatusBarGravity() {
@@ -1087,11 +1048,17 @@
}
}
+ @Override
+ BaseStatusBar.H createHandler() {
+ return new PhoneStatusBar.H();
+ }
+
/**
* All changes to the status bar and notifications funnel through here and are batched.
*/
- private class H extends Handler {
+ private class H extends BaseStatusBar.H {
public void handleMessage(Message m) {
+ super.handleMessage(m);
switch (m.what) {
case MSG_ANIMATE:
doAnimation();
@@ -1112,18 +1079,6 @@
setIntruderAlertVisibility(false);
mCurrentlyIntrudingNotification = null;
break;
- case MSG_OPEN_RECENTS_PANEL:
- if (DEBUG) Slog.d(TAG, "opening recents panel");
- if (mRecentsPanel != null) {
- mRecentsPanel.show(true, true);
- }
- break;
- case MSG_CLOSE_RECENTS_PANEL:
- if (DEBUG) Slog.d(TAG, "closing recents panel");
- if (mRecentsPanel != null && mRecentsPanel.isShowing()) {
- mRecentsPanel.show(false, true);
- }
- break;
}
}
}
@@ -2052,13 +2007,6 @@
}
}
- public void toggleRecentApps() {
- int msg = (mRecentsPanel.getVisibility() == View.VISIBLE)
- ? MSG_CLOSE_RECENTS_PANEL : MSG_OPEN_RECENTS_PANEL;
- mHandler.removeMessages(msg);
- mHandler.sendEmptyMessage(msg);
- }
-
/**
* The LEDs are turned o)ff when the notification panel is shown, even just a little bit.
* This was added last-minute and is inconsistent with the way the rest of the notifications
@@ -2346,27 +2294,5 @@
vibrate();
}
};
-
- public class TouchOutsideListener implements View.OnTouchListener {
- private int mMsg;
- private RecentsPanelView mPanel;
-
- public TouchOutsideListener(int msg, RecentsPanelView panel) {
- mMsg = msg;
- mPanel = panel;
- }
-
- public boolean onTouch(View v, MotionEvent ev) {
- final int action = ev.getAction();
- if (action == MotionEvent.ACTION_OUTSIDE
- || (action == MotionEvent.ACTION_DOWN
- && !mPanel.isInContentArea((int)ev.getX(), (int)ev.getY()))) {
- mHandler.removeMessages(mMsg);
- mHandler.sendEmptyMessage(mMsg);
- return true;
- }
- return false;
- }
- }
}
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 87eb9cc..cabfa07 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -36,21 +36,19 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.inputmethodservice.InputMethodService;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
+import android.inputmethodservice.InputMethodService;
import android.os.Build;
-import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.text.TextUtils;
import android.util.Slog;
-import android.view.accessibility.AccessibilityEvent;
import android.view.Display;
import android.view.Gravity;
import android.view.IWindowManager;
@@ -62,8 +60,10 @@
import android.view.View;
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;
import android.widget.RemoteViews;
@@ -78,7 +78,6 @@
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.SignalClusterView;
-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;
@@ -100,8 +99,7 @@
public static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
public static final int MSG_OPEN_NOTIFICATION_PEEK = 1002;
public static final int MSG_CLOSE_NOTIFICATION_PEEK = 1003;
- public static final int MSG_OPEN_RECENTS_PANEL = 1020;
- public static final int MSG_CLOSE_RECENTS_PANEL = 1021;
+ // 1020-1029 reserved for BaseStatusBar
public static final int MSG_SHOW_CHROME = 1030;
public static final int MSG_HIDE_CHROME = 1031;
public static final int MSG_OPEN_INPUT_METHODS_PANEL = 1040;
@@ -127,8 +125,6 @@
int mMenuNavIconWidth = -1;
private int mMaxNotificationIcons = 5;
- H mHandler = new H();
-
IWindowManager mWindowManager;
// tracking all current notifications
@@ -189,8 +185,6 @@
// for disabling the status bar
int mDisabled = 0;
- private RecentsPanelView mRecentsPanel;
- private RecentTasksLoader mRecentTasksLoader;
private InputMethodsPanel mInputMethodsPanel;
private CompatModePanel mCompatModePanel;
@@ -348,33 +342,7 @@
// Recents Panel
mRecentTasksLoader = new RecentTasksLoader(context);
- mRecentsPanel = (RecentsPanelView) View.inflate(context,
- R.layout.status_bar_recent_panel, null);
- mRecentsPanel.setVisibility(View.GONE);
- mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL,
- mRecentsPanel));
- mRecentsPanel.setOnVisibilityChangedListener(this);
- mRecentsPanel.setRecentTasksLoader(mRecentTasksLoader);
- mRecentTasksLoader.setRecentsPanel(mRecentsPanel);
-
- lp = new WindowManager.LayoutParams(
- (int) res.getDimension(R.dimen.status_bar_recents_width),
- ViewGroup.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
- | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
- PixelFormat.TRANSLUCENT);
- lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
- lp.setTitle("RecentsPanel");
- lp.windowAnimations = R.style.Animation_RecentPanel;
- lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
- | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
-
- WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
- mRecentsPanel.setBar(this);
- mRecentsPanel.setStatusBarView(mStatusBarView);
+ updateRecentsPanel();
// Input methods Panel
mInputMethodsPanel = (InputMethodsPanel) View.inflate(context,
@@ -680,6 +648,31 @@
return sb;
}
+ @Override
+ protected WindowManager.LayoutParams getRecentsLayoutParams(LayoutParams layoutParams) {
+ WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
+ (int) mContext.getResources().getDimension(R.dimen.status_bar_recents_width),
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
+ | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
+ PixelFormat.TRANSLUCENT);
+ lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
+ lp.setTitle("RecentsPanel");
+ lp.windowAnimations = com.android.internal.R.style.Animation_RecentApplications;
+ lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
+ | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
+
+ return lp;
+ }
+
+ protected void updateRecentsPanel() {
+ super.updateRecentsPanel();
+ mRecentsPanel.setStatusBarView(mStatusBarView);
+ }
+
public int getStatusBarHeight() {
return mHeightReceiver.getHeight();
}
@@ -702,8 +695,14 @@
}
}
- private class H extends Handler {
+ @Override
+ BaseStatusBar.H createHandler() {
+ return new TabletStatusBar.H();
+ }
+
+ private class H extends BaseStatusBar.H {
public void handleMessage(Message m) {
+ super.handleMessage(m);
switch (m.what) {
case MSG_OPEN_NOTIFICATION_PEEK:
if (DEBUG) Slog.d(TAG, "opening notification peek window; arg=" + m.arg1);
@@ -798,18 +797,6 @@
mNotificationArea.setVisibility(View.VISIBLE);
}
break;
- case MSG_OPEN_RECENTS_PANEL:
- if (DEBUG) Slog.d(TAG, "opening recents panel");
- if (mRecentsPanel != null) {
- mRecentsPanel.show(true, true);
- }
- break;
- case MSG_CLOSE_RECENTS_PANEL:
- if (DEBUG) Slog.d(TAG, "closing recents panel");
- if (mRecentsPanel != null && mRecentsPanel.isShowing()) {
- mRecentsPanel.show(false, true);
- }
- break;
case MSG_OPEN_INPUT_METHODS_PANEL:
if (DEBUG) Slog.d(TAG, "opening input methods panel");
if (mInputMethodsPanel != null) mInputMethodsPanel.openPanel();
@@ -1942,13 +1929,6 @@
visibilityChanged(false);
}
- public void toggleRecentApps() {
- int msg = (mRecentsPanel.getVisibility() == View.VISIBLE)
- ? MSG_CLOSE_RECENTS_PANEL : MSG_OPEN_RECENTS_PANEL;
- mHandler.removeMessages(msg);
- mHandler.sendEmptyMessage(msg);
- }
-
private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
@@ -1974,28 +1954,6 @@
}
};
- public class TouchOutsideListener implements View.OnTouchListener {
- private int mMsg;
- private StatusBarPanel mPanel;
-
- public TouchOutsideListener(int msg, StatusBarPanel panel) {
- mMsg = msg;
- mPanel = panel;
- }
-
- public boolean onTouch(View v, MotionEvent ev) {
- final int action = ev.getAction();
- if (action == MotionEvent.ACTION_OUTSIDE
- || (action == MotionEvent.ACTION_DOWN
- && !mPanel.isInContentArea((int)ev.getX(), (int)ev.getY()))) {
- mHandler.removeMessages(mMsg);
- mHandler.sendEmptyMessage(mMsg);
- return true;
- }
- return false;
- }
- }
-
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.print("mDisabled=0x");
pw.println(Integer.toHexString(mDisabled));