/frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.java1000行附近 if(code==KeyEvent.KEYCODE_HOME){ // If a system window has focus, then it doesn‘t make sense // right now to interact with applications. WindowManager.LayoutParams attrs= win!=null? win.getAttrs():null; if(attrs!=null){ finalint type= attrs.type; if(type== WindowManager.LayoutParams.TYPE_KEYGUARD || type== WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG){ // the "app" is keyguard, so give it the key returnfalse; } finalint typeCount= WINDOW_TYPES_WHERE_HOME_DOESNT_WORK.length; for(int i=0; i<typeCount; i++){ if(type== WINDOW_TYPES_WHERE_HOME_DOESNT_WORK[i]){ // don‘t do anything, but also don‘t pass it to the app returntrue; } } } }