android4.4 SystemUI的分析及滑动navigation的显示和隐藏

整理了一下先前对android4.4中Systemui代码的一些分析:

一、通知栏的时间和日期显示布局在status_bar_expanded_header.xml中,可在该xml下添加快捷显示

二、通知栏的头布局在status_bar_expanded.xml中,在PhoneStatusBar.java中进行布局加载

三、QuickSettings.java通知栏快捷设置在该类中加载,布局为quick_settings.xml
      QuickSettingsBasicTile添加快捷图标的icon和text
      mtk_quick_settings_tile_basic.xml右边下拉栏的图标icon,text显示布局
      QuickSettingsConnectionModel.java设置一些图标的显示

四、滑动显示和隐藏底部的导航栏navigation

可参考文章点击打开链接

1、在IStatusBar.aidl和IStatusBarService.aidl中定义aidl接口

目录:

\alps\frameworks\base\core\java\com\android\internal\statusbar\IStatusBar.aidl
\alps\frameworks\base\core\java\com\android\internal\statusbar\IStatusBarService.aidl
添加方法:
 /**showNavigationBar add by jon*/
    void showNavigationBar();
2、在StatusBarManagerService.java和PhoneWindowManager.java中定义showNavigationBar()方法

目录:

1)、\alps\frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindowManager.java
添加方法:
                   @Override
                    public void onSwipeFromBottom() {
                        if (mNavigationBar != null && mNavigationBarOnBottom) {
                            requestTransientBars(mNavigationBar);
                        }else
						{//add by jon
							showNavigationBar();
						}
                    }

......

 private void showNavigationBar()//add by jon
	 {
		 mHandler.post(new Runnable()
		 {
			 @Override
				 public void run()
			 {
				 try
			     {
					 IStatusBarService statusbar=getStatusBarService();
					 if(null!=statusbar)
					 {
						 statusbar.showNavigationBar();

					 }
				 }catch(RemoteException  e)
				 {
					 mStatusBarService =null;
				 }
			 }

		 });

	 }


2)、\alps\frameworks\base\services\java\com\android\server\StatusBarManagerService.java
添加方法:

 @Override
    public void showNavigationBar()//add by jon
	{
		enforceStatusBar();

        synchronized(mLock)
		{
			mHandler.post(new Runnable()
			{
				public void run()
				{
					if(null!=mBar)
					{
						try
						{
							mBar.showNavigationBar();
						}
						catch (RemoteException ex)
						{
						}

					}//if


				}
			});
		}
        

	}

3、CommandQueue.java   (extends IStatusBar.Stub)

添加:

 private static final int MSG_SHOW_NAVIGATIONBAR = 21 << MSG_SHIFT;//add by jon
 ......
 public void showNavigationBar();//add by jon
 ......
 public void showNavigationBar()//add by jon
    {
    	synchronized(mList)
    	{
    		mHandler.removeMessages(MSG_SHOW_NAVIGATIONBAR);
    		mHandler.sendEmptyMessage(MSG_SHOW_NAVIGATIONBAR);
    	}
    	
    }

4、PhoneStatusBar.java


@Override
	// CommandQueue
	public void showNavigationBar() {//add by jon
		if (null != mNavigationBarView) {
			return;
		} else {
			 final Context contex=mContext;
			
			 int layoutId = R.layout.navigation_bar;
			 if(RecentsActivity.FLOAT_WINDOW_SUPPORT){
			 layoutId = R.layout.navigation_bar_float_window;
			 }
			 /// @}
			 mNavigationBarView =
			 (NavigationBarView) View.inflate(contex,layoutId, null);
			
			 mNavigationBarView.setDisabledFlags(mDisabled);
			 mNavigationBarView.setBar(this);
			 mNavigationBarView.setOnTouchListener(new
			 View.OnTouchListener() {
			 @Override
			 public boolean onTouch(View v, MotionEvent event) {
			 checkUserAutohide(v, event);
			 return false;
			 }});
			addNavigationBar();
		}

	}

 
 

你可能感兴趣的:(android4.4 SystemUI的分析及滑动navigation的显示和隐藏)