Merge "DO NOT MERGE" into ics-scoop

This commit is contained in:
Andrew Flynn
2012-03-12 16:00:36 -07:00
committed by Android (Google) Code Review
16 changed files with 213 additions and 71 deletions

View File

@@ -56,6 +56,11 @@ public class StatusBarManager {
| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;
public static final int NAVIGATION_HINT_BACK_NOP = 1 << 0;
public static final int NAVIGATION_HINT_HOME_NOP = 1 << 1;
public static final int NAVIGATION_HINT_RECENT_NOP = 1 << 2;
public static final int NAVIGATION_HINT_BACK_ALT = 1 << 3;
private Context mContext;
private IStatusBarService mService;
private IBinder mToken = new Binder();

View File

Before

Width:  |  Height:  |  Size: 995 B

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/ic_sysbar_back_ime_pressed" />
<item android:drawable="@drawable/ic_sysbar_back_ime_default" />
</selector>

View File

@@ -32,7 +32,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:paddingBottom="@*android:dimen/status_bar_height"
android:layout_marginBottom="@*android:dimen/status_bar_height"
android:clipToPadding="false"
android:clipChildren="false">
@@ -69,13 +69,12 @@
</FrameLayout>
<View android:id="@+id/recents_dismiss_button"
android:layout_width="80px"
<com.android.systemui.recent.StatusBarTouchProxy
android:id="@+id/status_bar_touch_proxy"
android:layout_width="match_parent"
android:layout_height="@*android:dimen/status_bar_height"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/ic_sysbar_back_ime"
android:contentDescription="@string/status_bar_accessibility_dismiss_recents"
/>

View File

@@ -68,10 +68,11 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
private View mRecentsScrim;
private View mRecentsNoApps;
private ViewGroup mRecentsContainer;
private StatusBarTouchProxy mStatusBarTouchProxy;
private boolean mShowing;
private Choreographer mChoreo;
private View mRecentsDismissButton;
OnRecentsPanelVisibilityChangedListener mVisibilityChangedListener;
private RecentTasksLoader mRecentTasksLoader;
private ArrayList<TaskDescription> mRecentTaskDescriptions;
@@ -81,8 +82,8 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
private int mThumbnailWidth;
private boolean mFitThumbnailToXY;
public void setRecentTasksLoader(RecentTasksLoader loader) {
mRecentTasksLoader = loader;
public static interface OnRecentsPanelVisibilityChangedListener {
public void onRecentsPanelVisibilityChanged(boolean visible);
}
private final class OnLongClickDelegate implements View.OnLongClickListener {
@@ -171,15 +172,18 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
return super.onKeyUp(keyCode, event);
}
public boolean isInContentArea(int x, int y) {
// use mRecentsContainer's exact bounds to determine horizontal position
final int l = mRecentsContainer.getLeft();
final int r = mRecentsContainer.getRight();
final int t = mRecentsContainer.getTop();
final int b = mRecentsContainer.getBottom();
private boolean pointInside(int x, int y, View v) {
final int l = v.getLeft();
final int r = v.getRight();
final int t = v.getTop();
final int b = v.getBottom();
return x >= l && x < r && y >= t && y < b;
}
public boolean isInContentArea(int x, int y) {
return pointInside(x, y, mRecentsContainer) || pointInside(x, y, mStatusBarTouchProxy);
}
public void show(boolean show, boolean animate) {
show(show, animate, null);
}
@@ -278,7 +282,6 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
public void onAnimationStart(Animator animation) {
}
/**
* We need to be aligned at the bottom. LinearLayout can't do this, so instead,
* let LinearLayout do all the hard work, and then shift everything down to the bottom.
@@ -312,6 +315,29 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
public void setBar(StatusBar bar) {
mBar = bar;
}
public void setStatusBarView(View statusBarView) {
if (mStatusBarTouchProxy != null) {
mStatusBarTouchProxy.setStatusBar(statusBarView);
}
}
public void setRecentTasksLoader(RecentTasksLoader loader) {
mRecentTasksLoader = loader;
}
public void setOnVisibilityChangedListener(OnRecentsPanelVisibilityChangedListener l) {
mVisibilityChangedListener = l;
}
public void setVisibility(int visibility) {
if (mVisibilityChangedListener != null) {
mVisibilityChangedListener.onRecentsPanelVisibilityChanged(visibility == VISIBLE);
}
super.setVisibility(visibility);
}
public RecentsPanelView(Context context, AttributeSet attrs) {
@@ -335,6 +361,7 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
super.onFinishInflate();
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
mListAdapter = new TaskDescriptionAdapter(mContext);
if (mRecentsContainer instanceof RecentsHorizontalScrollView){
RecentsHorizontalScrollView scrollView
@@ -355,14 +382,6 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
mRecentsScrim = findViewById(R.id.recents_bg_protect);
mRecentsNoApps = findViewById(R.id.recents_no_apps);
mChoreo = new Choreographer(this, mRecentsScrim, mRecentsContainer, mRecentsNoApps, this);
mRecentsDismissButton = findViewById(R.id.recents_dismiss_button);
if (mRecentsDismissButton != null) {
mRecentsDismissButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
hide(true);
}
});
}
// In order to save space, we make the background texture repeat in the Y direction
if (mRecentsScrim != null && mRecentsScrim.getBackground() instanceof BitmapDrawable) {

View File

@@ -0,0 +1,40 @@
/*
* 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.recent;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
public class StatusBarTouchProxy extends FrameLayout {
private View mStatusBar;
public StatusBarTouchProxy(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setStatusBar(View statusBar) {
mStatusBar = statusBar;
}
public boolean onTouchEvent (MotionEvent event) {
return mStatusBar.dispatchTouchEvent(event);
}
}

View File

@@ -62,6 +62,8 @@ public class CommandQueue extends IStatusBar.Stub {
private static final int MSG_TOGGLE_RECENT_APPS = 11 << MSG_SHIFT;
private static final int MSG_SET_NAVIGATION_ICON_HINTS = 13 << MSG_SHIFT;
private StatusBarIconList mList;
private Callbacks mCallbacks;
private Handler mHandler = new H();
@@ -90,6 +92,7 @@ public class CommandQueue extends IStatusBar.Stub {
public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
public void setHardKeyboardStatus(boolean available, boolean enabled);
public void toggleRecentApps();
public void setNavigationIconHints(int hints);
}
public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -196,6 +199,13 @@ public class CommandQueue extends IStatusBar.Stub {
}
}
public void setNavigationIconHints(int hints) {
synchronized (mList) {
mHandler.removeMessages(MSG_SET_NAVIGATION_ICON_HINTS);
mHandler.obtainMessage(MSG_SET_NAVIGATION_ICON_HINTS, hints, 0, null).sendToTarget();
}
}
private final class H extends Handler {
public void handleMessage(Message msg) {
final int what = msg.what & MSG_MASK;
@@ -265,6 +275,9 @@ public class CommandQueue extends IStatusBar.Stub {
case MSG_TOGGLE_RECENT_APPS:
mCallbacks.toggleRecentApps();
break;
case MSG_SET_NAVIGATION_ICON_HINTS:
mCallbacks.setNavigationIconHints(msg.arg1);
break;
}
}
}

View File

@@ -18,6 +18,8 @@ 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.Rect;
@@ -33,6 +35,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Surface;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import java.io.FileDescriptor;
@@ -63,6 +66,7 @@ public class NavigationBarView extends LinearLayout {
boolean mHidden, mLowProfile, mShowMenu;
int mDisabledFlags = 0;
int mNavigationIconHints = 0;
// workaround for LayoutTransitions leaving the nav buttons in a weird state (bug 5549288)
final static boolean WORKAROUND_INVALID_LAYOUT = true;
@@ -143,6 +147,34 @@ public class NavigationBarView extends LinearLayout {
}
};
public void setNavigationIconHints(int hints) {
setNavigationIconHints(hints, false);
}
public void setNavigationIconHints(int hints, boolean force) {
if (!force && hints == mNavigationIconHints) return;
if (DEBUG) {
android.widget.Toast.makeText(mContext,
"Navigation icon hints = " + hints,
500).show();
}
mNavigationIconHints = hints;
getBackButton().setAlpha(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_NOP)) ? 0.5f : 1.0f);
getHomeButton().setAlpha(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_HOME_NOP)) ? 0.5f : 1.0f);
getRecentsButton().setAlpha(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_RECENT_NOP)) ? 0.5f : 1.0f);
((ImageView)getBackButton()).setImageResource(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT))
? R.drawable.ic_sysbar_back_ime
: R.drawable.ic_sysbar_back);
}
public void setDisabledFlags(int disabledFlags) {
setDisabledFlags(disabledFlags, false);
}

View File

@@ -32,6 +32,7 @@ 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.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -229,6 +230,8 @@ public class PhoneStatusBar extends StatusBar {
DisplayMetrics mDisplayMetrics = new DisplayMetrics();
private int mNavigationIconHints = 0;
private class ExpandedDialog extends Dialog {
ExpandedDialog(Context context) {
super(context, com.android.internal.R.style.Theme_Translucent_NoTitleBar);
@@ -1540,6 +1543,17 @@ public class PhoneStatusBar extends StatusBar {
event.offsetLocation(-deltaX, -deltaY);
}
@Override // CommandQueue
public void setNavigationIconHints(int hints) {
if (hints == mNavigationIconHints) return;
mNavigationIconHints = hints;
if (mNavigationBarView != null) {
mNavigationBarView.setNavigationIconHints(hints);
}
}
@Override // CommandQueue
public void setSystemUiVisibility(int vis) {
final int old = mSystemUiVisibility;
@@ -1590,8 +1604,16 @@ public class PhoneStatusBar extends StatusBar {
if (showMenu) setLightsOn(true);
}
// Not supported
public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { }
@Override
public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
boolean altBack = (backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS)
|| ((vis & InputMethodService.IME_VISIBLE) != 0);
mCommandQueue.setNavigationIconHints(
altBack ? (mNavigationIconHints | StatusBarManager.NAVIGATION_HINT_BACK_ALT)
: (mNavigationIconHints & ~StatusBarManager.NAVIGATION_HINT_BACK_ALT));
}
@Override
public void setHardKeyboardStatus(boolean available, boolean enabled) { }

View File

@@ -88,7 +88,8 @@ import com.android.systemui.statusbar.policy.Prefs;
public class TabletStatusBar extends StatusBar implements
HeightReceiver.OnBarHeightChangedListener,
InputMethodsPanel.OnHardKeyboardEnabledChangeListener {
InputMethodsPanel.OnHardKeyboardEnabledChangeListener,
RecentsPanelView.OnRecentsPanelVisibilityChangedListener {
public static final boolean DEBUG = false;
public static final boolean DEBUG_COMPAT_HELP = false;
public static final String TAG = "TabletStatusBar";
@@ -145,6 +146,7 @@ public class TabletStatusBar extends StatusBar implements
View mHomeButton;
View mMenuButton;
View mRecentButton;
private boolean mAltBackButtonEnabledForIme;
ViewGroup mFeedbackIconArea; // notification icons, IME icon, compat icon
InputMethodButton mInputMethodSwitchButton;
@@ -195,6 +197,8 @@ public class TabletStatusBar extends StatusBar implements
// used to notify status bar for suppressing notification LED
private boolean mPanelSlightlyVisible;
private int mNavigationIconHints = 0;
public Context getContext() { return mContext; }
protected void addPanelWindows() {
@@ -307,12 +311,11 @@ public class TabletStatusBar extends StatusBar implements
mRecentsPanel = (RecentsPanelView) View.inflate(context,
R.layout.status_bar_recent_panel, null);
mRecentsPanel.setVisibility(View.GONE);
mRecentsPanel.setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL,
mRecentsPanel));
mRecentsPanel.setOnVisibilityChangedListener(this);
mRecentsPanel.setRecentTasksLoader(mRecentTasksLoader);
mRecentTasksLoader.setRecentsPanel(mRecentsPanel);
mStatusBarView.setIgnoreChildren(2, mRecentButton, mRecentsPanel);
lp = new WindowManager.LayoutParams(
(int) res.getDimension(R.dimen.status_bar_recents_width),
@@ -331,6 +334,7 @@ public class TabletStatusBar extends StatusBar implements
WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
mRecentsPanel.setBar(this);
mRecentsPanel.setStatusBarView(mStatusBarView);
// Input methods Panel
mInputMethodsPanel = (InputMethodsPanel) View.inflate(context,
@@ -339,7 +343,7 @@ public class TabletStatusBar extends StatusBar implements
mInputMethodsPanel.setOnTouchListener(new TouchOutsideListener(
MSG_CLOSE_INPUT_METHODS_PANEL, mInputMethodsPanel));
mInputMethodsPanel.setImeSwitchButton(mInputMethodSwitchButton);
mStatusBarView.setIgnoreChildren(3, mInputMethodSwitchButton, mInputMethodsPanel);
mStatusBarView.setIgnoreChildren(2, mInputMethodSwitchButton, mInputMethodsPanel);
lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
@@ -362,7 +366,7 @@ public class TabletStatusBar extends StatusBar implements
MSG_CLOSE_COMPAT_MODE_PANEL, mCompatModePanel));
mCompatModePanel.setTrigger(mCompatModeButton);
mCompatModePanel.setVisibility(View.GONE);
mStatusBarView.setIgnoreChildren(4, mCompatModeButton, mCompatModePanel);
mStatusBarView.setIgnoreChildren(3, mCompatModeButton, mCompatModePanel);
lp = new WindowManager.LayoutParams(
250,
ViewGroup.LayoutParams.WRAP_CONTENT,
@@ -448,6 +452,10 @@ public class TabletStatusBar extends StatusBar implements
}
}
public View getStatusBarView() {
return mStatusBarView;
}
protected View makeStatusBarView() {
final Context context = mContext;
@@ -1109,6 +1117,31 @@ public class TabletStatusBar extends StatusBar implements
}
}
@Override // CommandQueue
public void setNavigationIconHints(int hints) {
if (hints == mNavigationIconHints) return;
if (DEBUG) {
android.widget.Toast.makeText(mContext,
"Navigation icon hints = " + hints,
500).show();
}
mNavigationIconHints = hints;
mBackButton.setAlpha(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_NOP)) ? 0.5f : 1.0f);
mHomeButton.setAlpha(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_HOME_NOP)) ? 0.5f : 1.0f);
mRecentButton.setAlpha(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_RECENT_NOP)) ? 0.5f : 1.0f);
mBackButton.setImageResource(
(0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT))
? R.drawable.ic_sysbar_back_ime
: R.drawable.ic_sysbar_back);
}
private void notifyUiVisibilityChanged() {
try {
mWindowManager.statusBarVisibilityChanged(mSystemUiVisibility);
@@ -1212,30 +1245,29 @@ public class TabletStatusBar extends StatusBar implements
(vis & InputMethodService.IME_ACTIVE) != 0);
updateNotificationIcons();
mInputMethodsPanel.setImeToken(token);
int res;
switch (backDisposition) {
case InputMethodService.BACK_DISPOSITION_WILL_NOT_DISMISS:
res = R.drawable.ic_sysbar_back;
break;
case InputMethodService.BACK_DISPOSITION_WILL_DISMISS:
res = R.drawable.ic_sysbar_back_ime;
break;
case InputMethodService.BACK_DISPOSITION_DEFAULT:
default:
if ((vis & InputMethodService.IME_VISIBLE) != 0) {
res = R.drawable.ic_sysbar_back_ime;
} else {
res = R.drawable.ic_sysbar_back;
}
break;
}
mBackButton.setImageResource(res);
boolean altBack = (backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS)
|| ((vis & InputMethodService.IME_VISIBLE) != 0);
mAltBackButtonEnabledForIme = altBack;
mCommandQueue.setNavigationIconHints(
altBack ? (mNavigationIconHints | StatusBarManager.NAVIGATION_HINT_BACK_ALT)
: (mNavigationIconHints & ~StatusBarManager.NAVIGATION_HINT_BACK_ALT));
if (FAKE_SPACE_BAR) {
mFakeSpaceBar.setVisibility(((vis & InputMethodService.IME_VISIBLE) != 0)
? View.VISIBLE : View.GONE);
}
}
@Override
public void onRecentsPanelVisibilityChanged(boolean visible) {
boolean altBack = visible || mAltBackButtonEnabledForIme;
mCommandQueue.setNavigationIconHints(
altBack ? (mNavigationIconHints | StatusBarManager.NAVIGATION_HINT_BACK_ALT)
: (mNavigationIconHints & ~StatusBarManager.NAVIGATION_HINT_BACK_ALT));
}
@Override
public void setHardKeyboardStatus(boolean available, boolean enabled) {
if (DEBUG) {

View File

@@ -46,10 +46,11 @@ public class TabletStatusBarView extends FrameLayout {
if (TabletStatusBar.DEBUG) {
Slog.d(TabletStatusBar.TAG, "TabletStatusBarView intercepting touch event: " + ev);
}
// do not close the recents panel here- the intended behavior is that recents is dismissed
// on touch up when clicking on status bar buttons
// TODO: should we be closing the notification panel and input methods panel?
mHandler.removeMessages(TabletStatusBar.MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.sendEmptyMessage(TabletStatusBar.MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.removeMessages(TabletStatusBar.MSG_CLOSE_RECENTS_PANEL);
mHandler.sendEmptyMessage(TabletStatusBar.MSG_CLOSE_RECENTS_PANEL);
mHandler.removeMessages(TabletStatusBar.MSG_CLOSE_INPUT_METHODS_PANEL);
mHandler.sendEmptyMessage(TabletStatusBar.MSG_CLOSE_INPUT_METHODS_PANEL);
mHandler.removeMessages(TabletStatusBar.MSG_STOP_TICKER);