插拔USB鍵盤和無線USB鼠標屏幕會黑一下,偶爾會死機,U盤插拔沒有這個現象,
黑屏一般是由於config 改變導致橫豎屏切換形成的
frameworks/base/services/core/java/com/android/server/input/InputManagerService.java
+++ b/device/common_jmgo/overlay/frameworks/base/services/core/java/com/android/server/input/InputManagerService.java
@@ -1382,7 +1382,8 @@ public class InputManagerService extends IInputManager.Stub
// Native callback.
private void notifyConfigurationChanged(long whenNanos) {
- mWindowManagerCallbacks.notifyConfigurationChanged();
+ //solve screen off when input device connect
+ //mWindowManagerCallbacks.notifyConfigurationChanged();
}
01-01 22:55:21.204 1773 2217 I ActivityManager: Config changes=30 {1.0 ?mcc?mnc zh_CN ldltr sw540dp w960dp h540dp 320dpi lrg long land television -touch qwerty/v/v dpad/v s.6}
01-01 22:55:21.238 2811 2811 I TvService: onConfigurationChanged()
01-01 22:55:21.252 1232 1232 D SurfaceFlinger: [capture screen]:maxLayerZ = -1
01-01 22:55:21.252 1232 1232 D hwcomposer: [capture screen]:startCapture ctx->captureScreenAddr = 7f9f8ca000,capture width = 1920,height = 1080
01-01 22:55:21.252 1232 1232 D hwcomposer: [capture screen]:Start_Capture
import android.util.Slog;
Slog.d(TAG, "",new RuntimeException("here").fillInStackTrace());
lsusb
hciconfig
Input消息的處理流程:
處理流程從NativeRreImeInputStage -> ViewPreImeStage -> ImeStage -> EarlyPostImeStage -> NativePostImeStage -> ViewPostImeInputStage -> SyntheticInputStage。
01-01 20:06:23.805 4400 4400 V ViewRootImpl: ViewPreImeInputStage processKeyEvent
01-01 20:06:23.805 4400 4400 V ViewRootImpl: EarlyPostImeInputStage processKeyEvent
01-01 20:06:23.856 4400 4400 V ViewRootImpl: ViewPostImeInputStage processKeyEvent
01-01 20:04:15.752 4367 4367 V ViewRootImpl: NativePostImeInputStage sendInputEvent
01-01 20:04:15.803 4367 4367 V ViewRootImpl: NativePostImeInputStage handled=true
01-01 20:04:29.523 4367 4367 V ViewRootImpl: NativePostImeInputStage handled=false
NativePostImeInputStage:
mInputQueue.sendInputEvent(q.mEvent, q, false, this);
onFinishedInputEvent
AInputQueue_finishEvent//app內部消耗掉了
NativePreImeInputStage、ViewPreImeInputStage、ImeInputStage三個類用來實現輸入法的按鍵派發和處理,如果事件不傳遞到輸入法服務中,這三個類可以跳過