Android禁止状态栏下拉动作禁止弹出通知栏和快捷菜单栏

6410阅读 0评论2018-05-03 UC_JonLee
分类:Android平台

转载时请注明出处和作者联系方式
文章出处:http://blog.chinaunix.net/uid/30230931.html
作者联系方式:JonLee <409775514@qq.com>

针对不同行业应用,Android系统个性化需求五花八门,何以解忧,唯有coding,仅此一记之。
  1. commit a57f4fa72648133be623ef9d452fdbc0095ee143
  2. Author: JonLee <409775514@qq.com>
  3. Date: Thu Apr 19 22:42:34 2018 +0800

  4.     禁止状态栏下拉动作,禁止弹出通知栏和快捷菜单栏

  5. diff --git a/android/device/softwinner/alpaca/alpaca.mk b/android/device/softwinner/alpaca/alpaca.mk
  6. index 8317bb5..8e75f6d 100755
  7. --- a/android/device/softwinner/alpaca/alpaca.mk
  8. +++ b/android/device/softwinner/alpaca/alpaca.mk
  9. @@ -116,7 +116,8 @@ PRODUCT_PROPERTY_OVERRIDES += \
  10.      persist.sys.language=zh \
  11.      persist.sys.country=CN \
  12.          persist.sys.browser_homepage=https://www.baidu.com \
  13. - ro.sf.rotation=90
  14. + ro.sf.rotation=90 \
  15. + persist.sys.disdropstatusbar=false
  16.  
  17.  PRODUCT_PACKAGES += Bluetooth
  18.  
  19. diff --git a/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
  20. index a3e35d1..0eb80a5 100644
  21. --- a/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
  22. +++ b/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
  23. @@ -24,6 +24,7 @@ import android.view.View;
  24.  import android.widget.FrameLayout;
  25.  
  26.  import java.util.ArrayList;
  27. +import android.os.SystemProperties;
  28.  
  29.  public class PanelBar extends FrameLayout {
  30.      public static final boolean DEBUG = false;
  31. @@ -135,6 +136,9 @@ public class PanelBar extends FrameLayout {
  32.  
  33.      // called from PanelView when self-expanding, too
  34.      public void startOpeningPanel(PanelView panel) {
  35. +        if (SystemProperties.getBoolean("persist.sys.disdropstatusbar", false)) {
  36. +         return;
  37. + }
  38.          if (DEBUG) LOG("startOpeningPanel: " + panel);
  39.          mTouchingPanel = panel;
  40.          mPanelHolder.setSelectedPanel(mTouchingPanel);
  41. diff --git a/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
  42. index 4901823..92d3af0 100644
  43. --- a/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
  44. +++ b/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
  45. @@ -32,7 +32,7 @@ import com.android.systemui.ExpandHelper;
  46.  import com.android.systemui.R;
  47.  import com.android.systemui.statusbar.BaseStatusBar;
  48.  import com.android.systemui.statusbar.policy.NotificationRowLayout;
  49. -
  50. +import android.os.SystemProperties;
  51.  
  52.  public class StatusBarWindowView extends FrameLayout
  53.  {
  54. @@ -87,6 +87,9 @@ public class StatusBarWindowView extends FrameLayout
  55.  
  56.      @Override
  57.      public boolean onInterceptTouchEvent(MotionEvent ev) {
  58. +    if (SystemProperties.getBoolean("persist.sys.disdropstatusbar", false)) {
  59. +     return true;
  60. + }
  61.          boolean intercept = false;
  62.          if (mNotificationPanel.isFullyExpanded() && mScrollView.getVisibility() == View.VISIBLE) {
  63.              intercept = mExpandHelper.onInterceptTouchEvent(ev);
  64. @@ -124,7 +127,11 @@ public class StatusBarWindowView extends FrameLayout
  65.          super.onDraw(canvas);
  66.          if (DEBUG) {
  67.              Paint pt = new Paint();
  68. - pt.setColor(0x80FFFF00);
  69. +     if (SystemProperties.getBoolean("persist.sys.disdropstatusbar", false)) {
  70. +        pt.setColor(0x00000000);    
  71. +     } else {
  72. +         pt.setColor(0x80FFFF00);
  73. +     }
  74.              pt.setStrokeWidth(12.0f);
  75.              pt.setStyle(Paint.Style.STROKE);
  76.              canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), pt);
更改之前效果如图:

更改之后效果如图:

上一篇:根据ro.build.id值比对标准SDK版本差异
下一篇:Android原生浏览器默认主页更改