高通平台隐藏和显示导航栏代码

这篇博客主要探讨了在高通平台如何通过修改特定的Java代码来控制导航栏的显示和隐藏,涉及的文件包括StatusBar.java、PhoneWindowManager.java以及OperateNavigationPreferenceController.java。内容适用于不同版本系统,但API会有所差异。
摘要由CSDN通过智能技术生成
  1. frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
    boolean mBarIsAdd = true;
    //public static final String ENABLE_NABAR_SWITCH = "persist.enable.nabar.switch";

    public void addBarInside(){
   
        Log.e(TAG, "StatusBar:addBar"+mBarIsAdd);
         if (!mBarIsAdd){
   
                Log.d(TAG,"add Bar");

                //Settings.Secure.putInt(mContext.getContentResolver(), ENABLE_NABAR_SWITCH, 1);
                Settings.System.putInt(mContext.getContentResolver(), Settings.System.HIDE_NAVIGATION, 1);

                try {
   
                    boolean showNav = mWindowManagerService.hasNavigationBar();
                    if (DEBUG) Log.v(TAG, "hasNavigationBar=" + showNav);
                    if (showNav) {
   
                        createNavigationBar();
                    }
                } catch (RemoteException ex) {
   
                    // no window manager? good luck with that
                }

                mBarIsAdd = true;
        }

    }
    private void removeBar(){
   
        if (mBarIsAdd){
   
                Log.d(TAG,"remove Bar");

            if (mNavigationBarView != null){
   
               mWindowManager.removeViewImmediate(mNavigationBarView);
            };

            if (mNavigationBarView != null){
   
                  mNavigationBarView = null;
            }

            mBarIsAdd = false;

            Settings.System.putInt(mContext.getContentResolver(), Settings.System.HIDE_NAVIGATION, 0);
        }
    }
  1. frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
     boolean mNavigationBarCanMove = false; // can the navigation bar ever move to the side?
+    boolean mHideStatusBar = false; //add by raindi 20200430
     @NavigationBarPosition
     int mNavigationBarPosition = NAV_BAR_BOTTOM;
     int[] mNavigationBarHeightForRotationDefault = new in
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值