滑動鎖屏狀態下如何禁止下拉狀態欄?
[SOLUTION]
JB/KK
滑動鎖屏狀態下狀態欄可以下拉是google 4.0 默認的設計。如果要禁止此功能,請修改
請修改KeyguardViewMediator.java的adjustStatusBarLocked()方法,將
if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
// showing secure lockscreen; disable expanding.
flags |= StatusBarManager.DISABLE_EXPAND;
}
修改為:
if (isSecure() || ENABLE_INSECURE_STATUS_BAR_EXPAND) {
// showing secure lockscreen; disable expanding.
flags |= StatusBarManager.DISABLE_EXPAND;
}
L上
L上鎖屏界面狀態欄要禁止下拉請按如下方案修改:
NotificationPanelView.java(alps/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone)中的兩個方法。
(1)
private void setQsExpanded(boolean expanded) {
//begin 添加下面四行
if(mKeyguardShowing)
{
return;
}
//end
boolean changed = mQsExpanded != expanded;
if (changed) {
mQsExpanded = expanded;
updateQsState();
requestPanelHeightUpdate();
mNotificationStackScroller.setInterceptDelegateEnabled(expanded);
mStatusBar.setQsExpanded(expanded);
}
}
(2)
private boolean shouldQuickSettingsIntercept(float x, float y, float yDiff) {
if (!mQsExpansionEnabled) {
return false;
}
//begin 將下面第一行替換成第二行
View header = mKeyguardShowing ? mKeyguardStatusBar : mHeader;
View header = mHeader;
//end
boolean onHeader = x >= header.getLeft() && x <= header.getRight()
&& y >= header.getTop() && y <= header.getBottom();
if (mQsExpanded) {
return onHeader || (mScrollView.isScrolledToBottom() && yDiff < 0) && isInQsArea(x, y);
} else {
return onHeader;
}
}
(3) private boolean onTouchEvent()
{
...
if (!mTwoFingerQsExpand && mQsTracking) {
//begin 添加下面紅色的兩行
if(!mKeyguardShowing){
onQsTouch(event);
if (!mConflictingQsExpansionGesture) {
return true;
}
}
//end
}
...
}
android4.4全屏應用中禁止狀態欄下拉