功能:长按遥控的search键后,切换为飞鼠模式。
问题:
1.切换飞鼠模式鼠标没有显示出来(要按其他上下左右按钮才开始显示)
2.切换回按键模式后,鼠标是自动等待一段时间消失,而不是立即消失
隐藏鼠标功能的流程
1.从下面这个博客得到启示
画鼠标流程
鼠标由PointerController.cpp控制。
文件在framework/base/libs/input/PointerController.cpp
鼠标隐藏的方法void PointerController::fade(Transition transition) {
AutoMutex _l(mLock);
// Remove the inactivity timeout, since we are fading now.
removeInactivityTimeoutLocked();
// Start fading.
if (transition == TRANSITION_IMMEDIATE) {
mLocked.pointerFadeDirection = 0;
mLocked.pointerAlpha = 0.0f;
updatePointerLocked();
} else {
mLocked.pointerFadeDirection = -1;
startAnimationLocked();
}
}
本次补丁是framework/base/services/core/java/com/android/server/policy/PhoneWindowManaer.javadiff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
index dac1474..6009abc 100755 (executable)
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -161,6 +161,8 @@ import java.io.PrintWriter;
import java.util.HashSet;
import java.util.List;
+import android.widget.Toast;
+
/**
* WindowManagerPolicy implementation for the Android phone UI. This
* introduces a new method suffix, Lp, for an internal lock of the
@@ -366,11 +368,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
/** If true, hitting shift & menu will broadcast Intent.ACTION_BUG_REPORT */
boolean mEnableShiftMenuBugReports = false;
+ boolean mEscPressd = false;
+
boolean mSafeMode;
WindowState mStatusBar = null;
int mStatusBarHeight;
WindowState mNavigationBar = null;
- boolean mHasNavigationBar = false;
+ boolean mHasNavigationBar = true;
boolean mNavigationBarCanMove = false; // can the navigation bar ever move to the side?
int mNavigationBarPosition = NAV_BAR_BOTTOM;
int[] mNavigationBarHeightForRotationDefault = new int[4];
@@ -1546,6 +1550,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private final ScreenshotRunnable mScreenshotRunnable = new ScreenshotRunnable();
+ Runnable HPHRunable = new Runnable(){
+ public void run(){
+ mEscPressd = true;
+ Log.e(TAG,"linjc:HPHRunable");
+ mstate=SystemProperties.get("sys.KeyMouse.mKeyMouseState");
+ if(mstate.equals("on"))
+ {
+ SystemProperties.set("sys.KeyMouse.mKeyMouseState","off");
+ Toast.makeText(mContext, "Restore the default button mode", Toast.LENGTH_LONG).show();
+ // Toast.makeText(getActivity(), "Restore the default button mode", Toast.LENGTH_LONG).show();
+ }
+ else
+ {
+ SystemProperties.set("sys.KeyMouse.mKeyMouseState","on");
+ Toast.makeText(mContext, "Into Mouse mode,click this key again out of this mode", Toast.LENGTH_LONG).show();
+ // Toast.makeText(getActivity(), "Into Mouse mode,click this key again out of this mode", Toast.LENGTH_LONG).show();
+ }
+ }
+ };
+
@Override
public void showGlobalActions() {
mHandler.removeMe