`
ping8080
  • 浏览: 59000 次
  • 性别: Icon_minigender_1
  • 来自: 湖南
文章分类
社区版块
存档分类
最新评论

virtual<二>

 
阅读更多

改动文件如下

 

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;
        }

 

 

 

 

 

分享到:
评论

相关推荐

    VMware Workstation Pro 14导入ova报错问题解决方法(Invalid target disk adapter type pvscsi)

    &lt;Annotation type="notes"&gt;My virtual machine notes&lt;/Annotation&gt; &lt;OperatingSystemSection ovf:required="false" xmlns:ovf=...

    《嵌入式系统开发圣经(第二版)》电子版

    249&lt;br&gt;4-2 移动装置的Java Virtual Machine - KVM(K Virtual Machine) 250&lt;br&gt;4-2-1 KVM 的由来 250&lt;br&gt;4-2-2 KVM 移植技术 256&lt;br&gt;4-2-3 KVM 验证 262&lt;br&gt;4-2-4 小结 266&lt;br&gt;4-3 移动设备上的开发套件-MIDP 267...

    VC MFC专题讲座 chm

    看好在下:&lt;br&gt;第一章 CGI &lt;br&gt;第二章 ACTIVEX&lt;br&gt;第三章:异常处理&lt;br&gt;第四章 多线程/多进程&lt;br&gt;……&lt;br&gt;……&lt;br&gt;1.1 如何编写CGI程序&lt;br&gt;&lt;br&gt;CGI的工作原理介绍:CGI(Common Gateway Interface)是一个WEB服务器...

    CNNA笔记

    思科CNNA中文读书笔记 &lt;br&gt;有以下内容&lt;br&gt;第一章:Internetworking &lt;br&gt;第二章:Internet Protocols&lt;br&gt;第三章:IP Subnetting and Variable Length Subnet Masks(VLSM)&lt;br&gt;第四章:Introduction to the Cisco IOS...

    ccna笔记

    第一章:Internetworking &lt;br&gt;第二章:Internet Protocols&lt;br&gt;第三章:IP Subnetting and Variable Length Subnet Masks(VLSM)&lt;br&gt;第四章:Introduction to the Cisco IOS&lt;br&gt;第五章:IP路由&lt;br&gt;第六章:Enhanced ...

    C#基础概念二十五问

    &lt;br&gt;14.abstract 可以和 virtual 一起使用吗?可以和 override 一起使用吗?&lt;br&gt;15.接口可以包含哪些成员?&lt;br&gt;16.类和结构的区别?&lt;br&gt;17.接口的多继承会带来哪些问题?&lt;br&gt;18.抽象类和接口的区别?&lt;br&gt;19.别名指示...

    CCNA中文读书笔记

    第一章:Internetworking &lt;br&gt;第二章:Internet Protocols&lt;br&gt;第三章:IP Subnetting and Variable Length Subnet Masks(VLSM)&lt;br&gt;第四章:Introduction to the Cisco IOS&lt;br&gt;第五章:IP路由&lt;br&gt;第六章:Enhanced ...

    Java测试题1答案

    &lt;br&gt;&lt;br&gt;4.A byte can be of what size&lt;br&gt;1)-128 to 127&lt;br&gt;2)(-2 power 8)-1 to 2 power 8&lt;br&gt;3)-255 to 256&lt;br&gt;4)depends on the particular implementation of the java virtual machine&lt;br&gt;&lt;br&gt;5.哪些是Java...

    VC++客房管理系统源码

    &lt;br&gt;一级(100元/天)&lt;br&gt;二级(70元/天)&lt;br&gt;三级(40元/天)&lt;br&gt;房间级别&lt;br&gt;**************8&lt;br&gt;&lt;br&gt;头文件中&lt;br&gt;// Generated message map functions&lt;br&gt;//{{AFX_MSG(CMAINTAINDLG)&lt;br&gt;afx_msg void OnNext();...

    VC6使用word2003生成报表的示例

    &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;三、使用压缩包的测试程序,按钮二能提供的效果如下图:&lt;br&gt;&lt;br&gt;&lt;br&gt;图一 Word报表效果屏幕截图&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;四、说明:&lt;br&gt;开发环境为:vc6 + sp6 + xp_sdk&lt;br&gt;Word版本:2003企业版&lt;br...

    BOS组件系统

    &lt;br&gt;}&lt;br&gt;&lt;br&gt;class TestCompImpl :TestComp&lt;br&gt;{&lt;br&gt; public virtual void DoSomething()&lt;br&gt; {&lt;br&gt; …&lt;br&gt;}&lt;br&gt;}&lt;br&gt;&lt;br&gt;class TestCompCreator : BOS.Creator_&lt;TestComp&gt;&lt;br&gt;{&lt;br&gt; public virtual TestComp Do...

    C/C++面试题目及解答.doc

    &lt;br&gt; } &lt;br&gt;第二种unsigned int TestAsOne1(char log) &lt;br&gt; { &lt;br&gt; int i; &lt;br&gt; unsigned int num=0, val; &lt;br&gt; for(i=0; i&lt;8; i++) &lt;br&gt; { &lt;br&gt; val = (~log) &gt;&gt; i; //反码? &lt;br&gt; val &= 0x00; //与0相与&lt;br&gt; if...

    vlan学习笔记

    &lt;br&gt;&lt;br&gt; &lt;br&gt;&lt;br&gt; 由于是基于MAC地址决定所属VLAN的,因此可以理解为这是一种在OSI的第二层设定访问链接的办法。&lt;br&gt;&lt;br&gt; 但是,基于MAC地址的VLAN,在设定时必须调查所连接的所有计算机的MAC地址并加以登录。...

    AtScript 源码下载

    &lt;br/&gt;&lt;br/&gt;一、写一个脚本 &lt;br/&gt;&lt;br/&gt;创建一个简单的脚本 &lt;br/&gt;&lt;br/&gt; Section Main &lt;br/&gt; msgbox "hello" &lt;br/&gt; End Section&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;二、如何运行脚本&lt;br/&gt;&lt;br/&gt; 调用方法非常简单,如下所示:&lt;br/&gt;&lt;br/&gt; ...

    Javashop开发规范V2.2

    &lt;ul&gt;&lt;li&gt;&lt;a class="selected"&gt;1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="search-cat-4-page-2.html" class="unselected"&gt;2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="search-cat-4-page-3.html" class="unselected"&gt;3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="search-cat...

    ORM及代码生成器C#源码(最新版V4.5.8.5、非常适于ASP.NET MVC)

    public abstract class TableGateway&lt;T&gt; : ViewGateway&lt;T&gt; where T: TableGateway&lt;T&gt;, new() { // Methods static TableGateway(); protected TableGateway(); public int AddNew(); public static int AddNew...

    ORM及代码生成器和插件C#源码(DBFrameworkV4.5.3)

    public abstract class TableGateway&lt;T&gt; : ViewGateway&lt;T&gt; where T: TableGateway&lt;T&gt;, new() { // Methods static TableGateway(); protected TableGateway(); public int AddNew(); public static int AddNew...

    ORM及代码生成器C#源码(2012最新版Kenly.DBFramework4.6.5.5)

    public static List&lt;T&gt; Inherit&lt;Tbase, T&gt;(IList&lt;Tbase&gt; baseEntities, TransformAction&lt;Tbase, T&gt; method); public static void ShadowCopy(IList targetEntities, IList sourceEntities); public static void ...

    c++二叉树的建立与非递归遍历

    virtual void post_order(void visit(BTreeNode&lt;T&gt;* p)) const { post_order(root, visit); }; // 非递归中序遍历 virtual void in_order1(void visit(BTreeNode&lt;T&gt;* p)) const; }; ``` - **构造函数**: - 第...

Global site tag (gtag.js) - Google Analytics