整理了一下先前對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();
}
}