Bug系列------------第一次开机结束无法使用home以及app_switch
home追踪:
void launchHomeFromHotKey() {
(TAG, "matt-launchHomeFromHotKey-()");
launchHomeFromHotKey(true /* awakenFromDreams */, true /*respectKeyguard*/);
}
之后
void launchHomeFromHotKey(final boolean awakenFromDreams, final boolean respectKeyguard) {
(TAG, "matt-respectKeyguard:="+respectKeyguard);
if (respectKeyguard) {
if (isKeyguardShowingAndNotOccluded()) {
(TAG, "matt-launchHomeFromHotKey return");
// don't launch home if keyguard showing
return;
}
(TAG, "matt-mHideLockScreen:="+mHideLockScreen);
(TAG, "():="+());
if (mHideLockScreen && ()) { //这边的()在正常刚开机情况下是不会进去的,也就是说()=false
// when in keyguard restricted mode, must first verify unlock
// before launching home
(TAG, "matt-launchHomeFromHotKey1");
(new OnKeyguardExitResult() {
@Override
public void onKeyguardExitResult(boolean success) {
(TAG, "matt-launchHomeFromHotKey1:="+success);
if (success) {
try {
().stopAppSwitches();
} catch (RemoteException e) {
}
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
startDockOrHome(true /*fromHomeKey*/, awakenFromDreams);
}
}
});
return;
}
}
(TAG, "-run to step2");
// no keyguard stuff to worry about, just launch home!
try {
().stopAppSwitches();
} catch (RemoteException e) {
}
(TAG, "-run to step3");
if (mRecentsVisible) {
// Hide Recents and notify it to launch Home
if (awakenFromDreams) {
awakenDreams();
}
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
hideRecentApps(false, true);
} else {
(TAG, "-run to step4");
// Otherwise, just launch Home
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
startDockOrHome(true /*fromHomeKey*/, awakenFromDreams);
}
}
private final Runnable mClearHideNavigationFlag = new Runnable() {
@Override
public void run() {
synchronized (()) {
// Clear flags.
mForceClearedSystemUiFlags &=
~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
();
}
};
之后
public boolean isInputRestricted() {
(TAG, "-isInputRestricted:::"+);
(TAG, "()::"+());
if (mKeyguardService != null) {
(TAG, "-isInputRestricted+1");
= ();
}
return ;
}
之后
public boolean isInputRestricted() {
return ();
}
之后
public boolean isInputRestricted() {
return mInputRestricted;
}
之后
private volatile boolean mInputRestricted = true; //初始值是true
public void onInputRestrictedStateChanged(boolean inputRestricted) {
(TAG, "-onInputRestrictedStateChanged-inputRestricted:"+inputRestricted); //解锁后这边写了false
mInputRestricted = inputRestricted; //这里唯一改了这个值 ,正常的或许在开机过程中在这里改了,异常的也许没改
}
解锁后相应的log
01-01 07:03:32.969 1585 3092 D WindowManager: matt-inKeyguardRestrictedKeyInputMode-return ::true
01-01 07:03:33.052 1585 3092 D WindowManager: matt-inKeyguardRestrictedKeyInputMode-return ::true
01-01 07:03:41.776 1585 1585 D WindowManager: matt-inKeyguardRestrictedKeyInputMode-return ::true
01-01 07:03:54.429 1585 3329 E KeyguardStateMonitor: matt-onInputRestrictedStateChanged-inputRestricted::false
01-01 07:03:54.430 1585 1585 D WindowManager: matt-inKeyguardRestrictedKeyInputMode-return ::false
01-01 07:03:54.475 1585 3962 D WindowManager: matt-inKeyguardRestrictedKeyInputMode-return ::false
01-01 07:03:54.877 1585 3974 D WindowManager: matt-inKeyguardRestrictedKeyInputMode-return ::false
01-01 07:03:54.939 1585 3961 D WindowManager: matt-inKeyguardRestrictedKeyInputMode-return ::false
app_swich追踪
(keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
// +++ Willie_Huang, disable virtual key if cover is closed.
if (mHasTranscoverFeature && mLidState == LID_CLOSED) {
return -1;
}
// ---
//Begin: John_Ho@
if (down && repeatCount == 0) {
if (!keyguardOn) { //正常启动这个keyguardOn=false
preloadRecentApps();
}
// BEIGN: Jeffrey_Chiang@
if (()) {
(mScreenUnpinningRunnable, ());
}
mSwitchKeyHandled = false;
if (mFuncWhenLongPressAppSwitch != .LONG_PRESSED_FUNC_RECENTLIST) {
(mRecentLongPressRunnable, getScreenshotChordLongPressDelay());
}
} else if (!down) {
//Begin: Jeffrey_Chiang@
cancelPendingScreenUnpinningAction();
//End: Jeffrey_Chiang@
if (!mSwitchKeyHandled) {
(mRecentLongPressRunnable);
if (!keyguardOn) { //正常启动这个keyguardOn=false
toggleRecentApps();
}
} else {
cancelPreloadRecentApps();
}
}
//End: John_Ho@
return -1;
之后
boolean keyguardOn() {
return isKeyguardShowingAndNotOccluded() || inKeyguardRestrictedKeyInputMode();
}
之后
public boolean inKeyguardRestrictedKeyInputMode() {
if (mKeyguardDelegate == null) return false;
return ();
}
之后
public boolean isInputRestricted() {
if (mKeyguardService != null) {
= ();
}
return ;
}
之后
public boolean isInputRestricted() {
return ();
}
之后
public boolean isInputRestricted() {
return mInputRestricted;
}
也就是最好都是在这个地方初值有问题
之后
public void onInputRestrictedStateChanged(boolean inputRestricted) {
(TAG, "matt-onInputRestrictedStateChanged-inputRestricted::"+inputRestricted);
mInputRestricted = inputRestricted;
}还是在这改
全部在 里
private void updateInputRestrictedLocked() {
boolean inputRestricted = isInputRestricted();//只有这里被赋值
if (mInputRestricted != inputRestricted) {
mInputRestricted = inputRestricted; //只有这里被赋值
int size = ();
for (int i = size - 1; i >= 0; i--) {
try {
(i).onInputRestrictedStateChanged(inputRestricted);
} catch (RemoteException e) {
(TAG, "Failed to call onDeviceProvisioned", e);
if (e instanceof DeadObjectException) {
(i);
}
}
}
}
}
和
public void addStateMonitorCallback(IKeyguardStateCallback callback) {
synchronized (this) {
(callback);
try {
(());
(mShowing);
(mInputRestricted);
} catch (RemoteException e) {
(TAG, "Failed to call onShowingStateChanged or onSimSecureStateChanged or onInputRestrictedStateChanged", e);
}
}
}
之后到
public boolean isInputRestricted() {
return mShowing || mNeedToReshowWhenReenabled;
}
关于mShowing:
private void setShowingLocked(boolean showing) {
if (showing != mShowing) {
mShowing = showing;
int size = ();
for (int i = size - 1; i >= 0; i--) {
try {
(i).onShowingStateChanged(showing);
} catch (RemoteException e) {
(TAG, "Failed to call onShowingStateChanged", e);
if (e instanceof DeadObjectException) {
(i);
}
}
}
updateInputRestrictedLocked();
();
}
}
其实上面调用onShowingStateChanged的是android自带的systemui,而我们用的是自己改过的systemui,所以结果就是我们的systemui在处理初值时没有跟上codebase,所以初值错误。android自带的是正确的。在system/app目录下把AsusSystemUi文件夹删除后,系统开机就会用system/pri_app/里的SystemUI,这个时候没有问题