偶发性的camera等应用的菜单键,后退键不起作用的问题

在某些低内存的设备上,会偶尔出现菜单键,后退键不起作用的问题,有很大的可能是因为输入法因为低内存被杀死了导致的,可以用如下方法修正。


--- a/core/java/android/view/ViewRootImpl.java 

+++ b/core/java/android/view/ViewRootImpl.java 
@@ -3647,7 +3647,7 @@ public final class ViewRootImpl implements ViewParent, 
if (result == InputMethodManager.DISPATCH_HANDLED) { 
return FINISH_HANDLED; 
} else if (result == InputMethodManager.DISPATCH_NOT_HANDLED) { 
- return FINISH_NOT_HANDLED; 
+ return FORWARD; 
} else { c
return DEFER; // callback will be invoked later 

-- 

Rease: 
InputMethodManager instance is not null, so imm is not null, but InputMethodManager.mCurMethod will be set to null when disable or kill IME. It's normal behavior, and this is not synchronization issue. Google return FINISH_NOT_HANDLED but then the next input stage doesn't have the chance to handle this event, and at last, after going through all input stages, this event will be dropped. So change FINISH_NOT_HANDLED to 
FORWARD is to make sure this keyevent can have chance to be processed by the next input stage when ime is disable or been killed(ime can easily be killed on low ram device).   
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值