当前位置: 首页 > 工具软件 > Swipe Bar > 使用案例 >

android禁用状态栏5.1,Android5.1禁止状态栏下拉(SystemUI StatusBar)

邓崇凛
2023-12-01

5.1状态栏要禁止下拉请按如下方案修改:

PanelBar.Java(alps\frameworks\base\packages\SystemUI\src\com\Android\systemui\statusbar\phone)中的两个方法。

public void startOpeningPanel(PanelView panel) {

//begin 添加下面三行

if(XXX){

return;

}

//endif (DEBUG) LOG("startOpeningPanel: " + panel);

mTouchingPanel = panel;

mPanelHolder.setSelectedPanel(mTouchingPanel);

for (PanelView pv : mPanels) {

if (pv != panel) {

pv.collapse(false /* delayed */);

}

}

}

5.1如果 单独禁止锁屏界面状态栏要禁止下拉请按如下方案修改:

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 (!mQsExpandImmediate && mQsTracking) {

//begin  添加下面红色的两行

if(!mKeyguardShowing){

onQsTouch(event);

if (!mConflictingQsExpansionGesture) {

return true;

}

}

//end

}

...

}

滑动锁屏状态下如何禁止下拉状态栏?

[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全屏应用中禁止状态栏下拉

http://blog.csdn.net/yuxiangyunei/article/details/44309611

 类似资料: