Fix how we hide and show the nav bar.
The PhoneWindowManager is now responsible for hiding and showing the nav bar. For hiding, it just moves it off the screen (easy way to get a nice slide animation on and off). At the same time, we use a new WM facility to put up a fake input window to capture all touch events. When a touch event is received, we force the system UI to clear the navigation hiding bit so it will be shown again. This removes a bunch of code from the system UI for hiding and showing the nav bar. Also removes the code calling from userActivity() to the system UI, which was bad. (Also no longer using userActivity() fixes bugs around re-showing the nav bar due to key presses and other wrong things.) Change-Id: I8c3174873b5bcaa36a92322a51e8f7993e88e551
This commit is contained in:
@@ -60,8 +60,7 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
private static final int MSG_SHOW_IME_BUTTON = 9 << MSG_SHIFT;
|
||||
private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT;
|
||||
|
||||
private static final int MSG_USER_ACTIVITY = 11 << MSG_SHIFT;
|
||||
private static final int MSG_TOGGLE_RECENT_APPS = 12 << MSG_SHIFT;
|
||||
private static final int MSG_TOGGLE_RECENT_APPS = 11 << MSG_SHIFT;
|
||||
|
||||
private StatusBarIconList mList;
|
||||
private Callbacks mCallbacks;
|
||||
@@ -90,7 +89,6 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
public void topAppWindowChanged(boolean visible);
|
||||
public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
|
||||
public void setHardKeyboardStatus(boolean available, boolean enabled);
|
||||
public void userActivity();
|
||||
public void toggleRecentApps();
|
||||
}
|
||||
|
||||
@@ -191,13 +189,6 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
public void userActivity() {
|
||||
synchronized (mList) {
|
||||
mHandler.removeMessages(MSG_USER_ACTIVITY);
|
||||
mHandler.obtainMessage(MSG_USER_ACTIVITY, 0, 0, null).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleRecentApps() {
|
||||
synchronized (mList) {
|
||||
mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS);
|
||||
@@ -271,9 +262,6 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
case MSG_SET_HARD_KEYBOARD_STATUS:
|
||||
mCallbacks.setHardKeyboardStatus(msg.arg1 != 0, msg.arg2 != 0);
|
||||
break;
|
||||
case MSG_USER_ACTIVITY:
|
||||
mCallbacks.userActivity();
|
||||
break;
|
||||
case MSG_TOGGLE_RECENT_APPS:
|
||||
mCallbacks.toggleRecentApps();
|
||||
break;
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.ServiceManager;
|
||||
@@ -27,14 +25,12 @@ import android.util.AttributeSet;
|
||||
import android.util.Slog;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
|
||||
@@ -54,7 +50,6 @@ public class NavigationBarView extends LinearLayout {
|
||||
final Display mDisplay;
|
||||
View mCurrentView = null;
|
||||
View[] mRotatedViews = new View[4];
|
||||
AnimatorSet mLastAnimator = null;
|
||||
|
||||
int mBarSize;
|
||||
boolean mVertical;
|
||||
@@ -204,43 +199,6 @@ public class NavigationBarView extends LinearLayout {
|
||||
|
||||
// bring up the lights no matter what
|
||||
setLowProfile(false);
|
||||
|
||||
if (!ANIMATE_HIDE_TRANSITION) {
|
||||
setVisibility(hide ? View.GONE : View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
|
||||
float oldAlpha = mCurrentView.getAlpha();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "animating alpha: " + oldAlpha + " -> "
|
||||
+ (!hide ? 1f : 0f));
|
||||
}
|
||||
|
||||
if (mLastAnimator != null && mLastAnimator.isRunning()) mLastAnimator.cancel();
|
||||
|
||||
if (!hide) {
|
||||
setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
// play us off, animatorset
|
||||
mLastAnimator = new AnimatorSet();
|
||||
mLastAnimator.playTogether(
|
||||
ObjectAnimator.ofFloat(mCurrentView, "alpha", hide ? 0f : 1f),
|
||||
ObjectAnimator.ofFloat(mCurrentView,
|
||||
mVertical ? "translationX" : "translationY",
|
||||
hide ? mBarSize : 0)
|
||||
);
|
||||
mLastAnimator.setDuration(!hide ? 250 : 1000);
|
||||
mLastAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator _a) {
|
||||
mLastAnimator = null;
|
||||
if (hide) {
|
||||
setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mLastAnimator.start();
|
||||
}
|
||||
|
||||
public void onFinishInflate() {
|
||||
|
||||
@@ -31,12 +31,8 @@ import android.content.IntentFilter;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Handler;
|
||||
@@ -471,6 +467,7 @@ public class PhoneStatusBar extends StatusBar {
|
||||
0
|
||||
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
|
||||
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
|
||||
| WindowManager.LayoutParams.FLAG_SLIPPERY,
|
||||
PixelFormat.OPAQUE);
|
||||
@@ -2028,19 +2025,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
}
|
||||
}
|
||||
|
||||
// The user is not allowed to get stuck without navigation UI. Upon the slightest user
|
||||
// interaction we bring the navigation back.
|
||||
public void userActivity() {
|
||||
if (0 != (mSystemUiVisibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)) {
|
||||
try {
|
||||
mBarService.setSystemUiVisibility(
|
||||
mSystemUiVisibility & ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
} catch (RemoteException ex) {
|
||||
// weep softly
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleRecentApps() {
|
||||
int msg = (mRecentsPanel.getVisibility() == View.GONE)
|
||||
? MSG_OPEN_RECENTS_PANEL : MSG_CLOSE_RECENTS_PANEL;
|
||||
|
||||
@@ -1822,9 +1822,6 @@ public class TabletStatusBar extends StatusBar implements
|
||||
visibilityChanged(false);
|
||||
}
|
||||
|
||||
public void userActivity() {
|
||||
}
|
||||
|
||||
public void toggleRecentApps() {
|
||||
int msg = (mRecentsPanel.getVisibility() == View.GONE)
|
||||
? MSG_OPEN_RECENTS_PANEL : MSG_CLOSE_RECENTS_PANEL;
|
||||
|
||||
Reference in New Issue
Block a user