改动文件如下
froyo/frameworks/base/api/current.xml
line 167996 修改如下
<method name="getHeight"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getHeightWithPanel"
return="int"
abstract="false"
native="true"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
line 168075 修改如下
<method name="getWidth"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getWidthWithPanel"
return="int"
abstract="false"
native="true"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
froyo\frameworks\base\core\java\android\view\Display.java
line 69
把native public int getWidth(); 改成 如下方法
public int getWidth() {
if(getWidthWithPanel() > getHeightWithPanel()){
return getWidthWithPanel() - 40;
}else{
return getWidthWithPanel();
}
}
并且加入此方法:
native public int getWidthWithPanel();
line 87
把native public int getHeight();改成如下方法
public int getHeight() {
if(getWidthWithPanel() > getHeightWithPanel()){
return getHeightWithPanel();
}else{
return getHeightWithPanel() - 40;
}
}
并加入
native public int getHeightWithPanel();
froyo\frameworks\base\core\java\android\view\IWindowManager.aidl
line 55 加入
boolean injectKeyEvent2(in KeyEvent ev, boolean sync);
froyo\frameworks\base\core\jni\android_view_Display.cpp
line 108:
把 { "getWidth", "()I", 改成 { "getWidthWithPanel", "()I",
line 110:
把{ "getHeight", "()I", 改成 { "getHeightWithPanel", "()I",
froyo\frameworks\base\services\java\com\android\server\InputDevice.java
line 838:
把
final int dispW = display.getWidth()-1;
final int dispH = display.getHeight()-1;
改成
final int dispW = display.getWidthWithPanel()-1;
final int dispH = display.getHeightWithPanel()-1;
froyo\frameworks\base\services\java\com\android\server\KeyInputQueue.java
line 51 加入 :import android.util.Log;
line 1382 加入 方法:
public void addLocked2(KeyEvent ev) {
Log.i(TAG, "addLocked2");
synchronized (mFirst) {
final int N = mDevices.size();
for (int i=0; i<N; i++) {
InputDevice d = mDevices.valueAt(i);
if( (d != null) && ((d.classes&RawInputEvent.CLASS_KEYBOARD) != 0) ) {
addLocked(d, System.nanoTime(), 0, RawInputEvent.CLASS_KEYBOARD, ev);
Log.i(TAG, "addLocked2 .........");
break;
}
}
}
}
froyo\frameworks\base\services\java\com\android\server\WindowManagerService.java
line 5528 :加入
public boolean injectKeyEvent2(KeyEvent ev, boolean sync) {
mQueue.addLocked2(ev);
return true;
}
froyo\frameworks\base\services\java\com\android\server\status\StatusBarService.java
line 70:加入
import android.graphics.Color;
import android.widget.ImageView;
import android.os.ServiceManager;
import android.util.Log;
import android.view.IWindowManager;
import android.view.KeyCharacterMap;
import android.view.View.OnTouchListener;
line 98 :修改
把public class StatusBarService extends IStatusBar.Stub改成
public class StatusBarService extends IStatusBar.Stub implements OnTouchListener
line 244 加入:ImageView iv1, iv2, iv3, iv4;
line 364 加入:
LinearLayout mSystemMenuBarView = (LinearLayout)View.inflate(mContext,
com.android.internal.R.layout.control_panel, null);
mSystemMenuBarView.setBackgroundColor(Color.BLACK);
mSystemMenuBarView.setOrientation(LinearLayout.VERTICAL);
iv1 = (ImageView) mSystemMenuBarView.findViewById(R.id.panel1);
iv2 = (ImageView) mSystemMenuBarView.findViewById(R.id.panel2);
iv3 = (ImageView) mSystemMenuBarView.findViewById(R.id.panel3);
iv4 = (ImageView) mSystemMenuBarView.findViewById(R.id.panel4);
iv1.setOnTouchListener(this);
iv2.setOnTouchListener(this);
iv3.setOnTouchListener(this);
iv4.setOnTouchListener(this);
WindowManager.LayoutParams lp1 = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + 20,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|//note by unic: this line of code make the activity content being in the front.
WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING,
PixelFormat.TRANSLUCENT);
// lp1.gravity = Gravity.RIGHT | Gravity.FILL_VERTICAL;
lp1.setTitle("systemMenuBar");
WindowManagerImpl.getDefault().addView(mSystemMenuBarView, lp1);
line 1880加入:
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mDisplay.getWidth() > mDisplay.getHeight()) {
switch (v.getId()) {
case R.id.panel1:
iv1.setImageResource(R.drawable.panel_back_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_BACK, KeyEvent.ACTION_DOWN)).start();
break;
case R.id.panel2:
iv2.setImageResource(R.drawable.panel_search_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_SEARCH, KeyEvent.ACTION_DOWN)).start();
break;
case R.id.panel3:
iv3.setImageResource(R.drawable.panel_menu_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_MENU, KeyEvent.ACTION_DOWN)).start();
break;
case R.id.panel4:
iv4.setImageResource(R.drawable.panel_home_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_HOME, KeyEvent.ACTION_DOWN)).start();
break;
}
}else{
switch (v.getId()) {
case R.id.panel1:
iv1.setImageResource(R.drawable.panel_home_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_HOME, KeyEvent.ACTION_DOWN)).start();
break;
case R.id.panel2:
iv2.setImageResource(R.drawable.panel_menu_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_MENU, KeyEvent.ACTION_DOWN)).start();
break;
case R.id.panel3:
iv3.setImageResource(R.drawable.panel_search_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_SEARCH, KeyEvent.ACTION_DOWN)).start();
break;
case R.id.panel4:
iv4.setImageResource(R.drawable.panel_back_pressed);
new Thread(new RunKey(KeyEvent.KEYCODE_BACK, KeyEvent.ACTION_DOWN)).start();
break;
}
}
}
if (event.getAction() == MotionEvent.ACTION_UP) {
if (mDisplay.getWidth() > mDisplay.getHeight()) {
switch (v.getId()) {
case R.id.panel1:
iv1.setImageResource(R.drawable.panel_back);
new Thread(new RunKey(KeyEvent.KEYCODE_BACK, KeyEvent.ACTION_UP)).start();
break;
case R.id.panel2:
iv2.setImageResource(R.drawable.panel_search);
new Thread(new RunKey(KeyEvent.KEYCODE_SEARCH, KeyEvent.ACTION_UP)).start();
break;
case R.id.panel3:
iv3.setImageResource(R.drawable.panel_menu);
new Thread(new RunKey(KeyEvent.KEYCODE_MENU, KeyEvent.ACTION_UP)).start();
break;
case R.id.panel4:
iv4.setImageResource(R.drawable.panel_home);
new Thread(new RunKey(KeyEvent.KEYCODE_HOME, KeyEvent.ACTION_UP)).start();
break;
}
}else {
switch (v.getId()) {
case R.id.panel1:
iv1.setImageResource(R.drawable.panel_home);
new Thread(new RunKey(KeyEvent.KEYCODE_HOME, KeyEvent.ACTION_UP)).start();
break;
case R.id.panel2:
iv2.setImageResource(R.drawable.panel_menu);
new Thread(new RunKey(KeyEvent.KEYCODE_MENU, KeyEvent.ACTION_UP)).start();
break;
case R.id.panel3:
iv3.setImageResource(R.drawable.panel_search);
new Thread(new RunKey(KeyEvent.KEYCODE_SEARCH, KeyEvent.ACTION_UP)).start();
break;
case R.id.panel4:
iv4.setImageResource(R.drawable.panel_back);
new Thread(new RunKey(KeyEvent.KEYCODE_BACK, KeyEvent.ACTION_UP)).start();
break;
}
}
}
return true;
}
private class RunKey implements Runnable{
int code;
int type;
public void run() {
long now = SystemClock.uptimeMillis();
try {
KeyEvent down = new KeyEvent(now, now, type, code, 0);
(IWindowManager.Stub
.asInterface(ServiceManager.getService("window")))
.injectKeyEvent2(down, true);
} catch (RemoteException e) {
Log.i("Input", "DeadOjbectException");
}
}
public RunKey (int keycode, int actionType){
this.code = keycode;
this.type = actionType;
}
}
froyo\frameworks\policies\base\phone\com\android\internal\policy\impl\PhoneWindowManager.java
line 194 : 加入 WindowState mSystemMenuBar = null;
line 766 :在 方法 public int windowTypeToLayerLw(int type) 中加入
case TYPE_STATUS_BAR + 20:
return STATUS_BAR_LAYER + 20;
line 960 :在方法 public int prepareAddWindowLw(WindowState win, WindowManager.LayoutParams attrs)
中加入
case TYPE_STATUS_BAR + 20:
if (mSystemMenuBar != null) {
return WindowManagerImpl.ADD_MULTIPLE_SINGLETON;
}
mSystemMenuBar = win;
break;
line 992 : 在方法 public void removeWindowLw(WindowState win)中 加入
else if (mSystemMenuBar == win) {
mSystemMenuBar = null;
}
line 1251 在方法 public void beginLayoutLw(int displayWidth, int displayHeight 中加入
final Rect pf = mTmpParentFrame;
final Rect df = mTmpDisplayFrame;
final Rect vf = mTmpVisibleFrame;
pf.left = df.left = vf.left = 0;
pf.top = df.top = vf.top = 0;
pf.right = df.right = vf.right = displayWidth;
pf.bottom = df.bottom = vf.bottom = displayHeight;
并且 把
if (mStatusBar != null) {
final Rect pf = mTmpParentFrame;
final Rect df = mTmpDisplayFrame;
final Rect vf = mTmpVisibleFrame;
pf.left = df.left = vf.left = 0;
pf.top = df.top = vf.top = 0;
pf.right = df.right = vf.right = displayWidth;
pf.bottom = df.bottom = vf.bottom = displayHeight;
mStatusBar.computeFrameLw(pf, df, vf, vf);
改成
if (mStatusBar != null) {
mStatusBar.computeFrameLw(pf, df, vf, vf);
并在 line 1270 加入(加到方法beginLayoutLw中)
if (displayWidth > displayHeight) {
pf.left = df.left = vf.left = displayWidth;
pf.right = df.right = vf.right = displayWidth + 40;
} else {
pf.top = df.top = vf.top = displayHeight;
pf.bottom = df.bottom = vf.bottom = displayHeight + 40;
}
if (mSystemMenuBar != null) {
mSystemMenuBar.computeFrameLw(pf, df, vf, vf);
}
line 1348 在方法 public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs,
WindowState attached) 中 加入 (line 1355)
if (win == mSystemMenuBar) {
return;
}
分享到:
相关推荐
<Annotation type="notes">My virtual machine notes</Annotation> <OperatingSystemSection ovf:required="false" xmlns:ovf=...
249<br>4-2 移动装置的Java Virtual Machine - KVM(K Virtual Machine) 250<br>4-2-1 KVM 的由来 250<br>4-2-2 KVM 移植技术 256<br>4-2-3 KVM 验证 262<br>4-2-4 小结 266<br>4-3 移动设备上的开发套件-MIDP 267...
看好在下:<br>第一章 CGI <br>第二章 ACTIVEX<br>第三章:异常处理<br>第四章 多线程/多进程<br>……<br>……<br>1.1 如何编写CGI程序<br><br>CGI的工作原理介绍:CGI(Common Gateway Interface)是一个WEB服务器...
思科CNNA中文读书笔记 <br>有以下内容<br>第一章:Internetworking <br>第二章:Internet Protocols<br>第三章:IP Subnetting and Variable Length Subnet Masks(VLSM)<br>第四章:Introduction to the Cisco IOS...
第一章:Internetworking <br>第二章:Internet Protocols<br>第三章:IP Subnetting and Variable Length Subnet Masks(VLSM)<br>第四章:Introduction to the Cisco IOS<br>第五章:IP路由<br>第六章:Enhanced ...
<br>14.abstract 可以和 virtual 一起使用吗?可以和 override 一起使用吗?<br>15.接口可以包含哪些成员?<br>16.类和结构的区别?<br>17.接口的多继承会带来哪些问题?<br>18.抽象类和接口的区别?<br>19.别名指示...
第一章:Internetworking <br>第二章:Internet Protocols<br>第三章:IP Subnetting and Variable Length Subnet Masks(VLSM)<br>第四章:Introduction to the Cisco IOS<br>第五章:IP路由<br>第六章:Enhanced ...
<br><br>4.A byte can be of what size<br>1)-128 to 127<br>2)(-2 power 8)-1 to 2 power 8<br>3)-255 to 256<br>4)depends on the particular implementation of the java virtual machine<br><br>5.哪些是Java...
<br>一级(100元/天)<br>二级(70元/天)<br>三级(40元/天)<br>房间级别<br>**************8<br><br>头文件中<br>// Generated message map functions<br>//{{AFX_MSG(CMAINTAINDLG)<br>afx_msg void OnNext();...
<br><br><br><br><br><br>三、使用压缩包的测试程序,按钮二能提供的效果如下图:<br><br><br>图一 Word报表效果屏幕截图<br><br><br><br>四、说明:<br>开发环境为:vc6 + sp6 + xp_sdk<br>Word版本:2003企业版<br...
<br>}<br><br>class TestCompImpl :TestComp<br>{<br> public virtual void DoSomething()<br> {<br> …<br>}<br>}<br><br>class TestCompCreator : BOS.Creator_<TestComp><br>{<br> public virtual TestComp Do...
<br> } <br>第二种unsigned int TestAsOne1(char log) <br> { <br> int i; <br> unsigned int num=0, val; <br> for(i=0; i<8; i++) <br> { <br> val = (~log) >> i; //反码? <br> val &= 0x00; //与0相与<br> if...
<br><br> <br><br> 由于是基于MAC地址决定所属VLAN的,因此可以理解为这是一种在OSI的第二层设定访问链接的办法。<br><br> 但是,基于MAC地址的VLAN,在设定时必须调查所连接的所有计算机的MAC地址并加以登录。...
<br/><br/>一、写一个脚本 <br/><br/>创建一个简单的脚本 <br/><br/> Section Main <br/> msgbox "hello" <br/> End Section<br/><br/><br/>二、如何运行脚本<br/><br/> 调用方法非常简单,如下所示:<br/><br/> ...
<ul><li><a class="selected">1</a></li> <li><a href="search-cat-4-page-2.html" class="unselected">2</a></li> <li><a href="search-cat-4-page-3.html" class="unselected">3</a></li> <li><a href="search-cat...
public abstract class TableGateway<T> : ViewGateway<T> where T: TableGateway<T>, new() { // Methods static TableGateway(); protected TableGateway(); public int AddNew(); public static int AddNew...
public abstract class TableGateway<T> : ViewGateway<T> where T: TableGateway<T>, new() { // Methods static TableGateway(); protected TableGateway(); public int AddNew(); public static int AddNew...
public static List<T> Inherit<Tbase, T>(IList<Tbase> baseEntities, TransformAction<Tbase, T> method); public static void ShadowCopy(IList targetEntities, IList sourceEntities); public static void ...
virtual void post_order(void visit(BTreeNode<T>* p)) const { post_order(root, visit); }; // 非递归中序遍历 virtual void in_order1(void visit(BTreeNode<T>* p)) const; }; ``` - **构造函数**: - 第...