Merge "DO NOT MERGE Notify keyguard of when power button is pressed." into cw-f-dev

This commit is contained in:
Andrew Zeng
2017-04-14 19:40:51 +00:00
committed by Android (Google) Code Review
6 changed files with 42 additions and 3 deletions

View File

@@ -98,4 +98,10 @@ oneway interface IKeyguardService {
* to start the keyguard dismiss sequence. * to start the keyguard dismiss sequence.
*/ */
void onActivityDrawn(); void onActivityDrawn();
/**
* Notifies the Keyguard that the power key was pressed while locked and launched Home rather
* than putting the device to sleep or waking up.
*/
void onShortPowerPressedGoHome();
} }

View File

@@ -202,6 +202,12 @@ public class KeyguardService extends Service {
checkPermission(); checkPermission();
mKeyguardViewMediator.onActivityDrawn(); mKeyguardViewMediator.onActivityDrawn();
} }
@Override
public void onShortPowerPressedGoHome() {
checkPermission();
mKeyguardViewMediator.onShortPowerPressedGoHome();
}
}; };
} }

View File

@@ -1943,6 +1943,10 @@ public class KeyguardViewMediator extends SystemUI {
mHandler.sendEmptyMessage(ON_ACTIVITY_DRAWN); mHandler.sendEmptyMessage(ON_ACTIVITY_DRAWN);
} }
public void onShortPowerPressedGoHome() {
// do nothing
}
public ViewMediatorCallback getViewMediatorCallback() { public ViewMediatorCallback getViewMediatorCallback() {
return mViewMediatorCallback; return mViewMediatorCallback;
} }

View File

@@ -1301,20 +1301,28 @@ public class PhoneWindowManager implements WindowManagerPolicy {
launchHomeFromHotKey(); launchHomeFromHotKey();
break; break;
case SHORT_PRESS_POWER_GO_HOME: case SHORT_PRESS_POWER_GO_HOME:
launchHomeFromHotKey(true /* awakenFromDreams */, false /*respectKeyguard*/); shortPressPowerGoHome();
break; break;
case SHORT_PRESS_POWER_CLOSE_IME_OR_GO_HOME: case SHORT_PRESS_POWER_CLOSE_IME_OR_GO_HOME:
if (mWindowManagerFuncs.isInputMethodWindowVisible()) { if (mWindowManagerFuncs.isInputMethodWindowVisible()) {
mWindowManagerFuncs.hideCurrentInputMethod(); mWindowManagerFuncs.hideCurrentInputMethod();
} else { } else {
launchHomeFromHotKey(true /* awakenFromDreams */, shortPressPowerGoHome();
false /*respectKeyguard*/);
} }
break; break;
} }
} }
} }
private void shortPressPowerGoHome() {
launchHomeFromHotKey(true /* awakenFromDreams */, false /*respectKeyguard*/);
if (isKeyguardShowingAndNotOccluded()) {
// Notify keyguard so it can do any special handling for the power button since the
// device will not power off and only launch home.
mKeyguardDelegate.onShortPowerPressedGoHome();
}
}
private void powerMultiPressAction(long eventTime, boolean interactive, int behavior) { private void powerMultiPressAction(long eventTime, boolean interactive, int behavior) {
switch (behavior) { switch (behavior) {
case MULTI_PRESS_POWER_NOTHING: case MULTI_PRESS_POWER_NOTHING:

View File

@@ -427,6 +427,12 @@ public class KeyguardServiceDelegate {
} }
} }
public void onShortPowerPressedGoHome() {
if (mKeyguardService != null) {
mKeyguardService.onShortPowerPressedGoHome();
}
}
public void dump(String prefix, PrintWriter pw) { public void dump(String prefix, PrintWriter pw) {
pw.println(prefix + TAG); pw.println(prefix + TAG);
prefix += " "; prefix += " ";

View File

@@ -228,6 +228,15 @@ public class KeyguardServiceWrapper implements IKeyguardService {
} }
} }
@Override
public void onShortPowerPressedGoHome() {
try {
mService.onShortPowerPressedGoHome();
} catch (RemoteException e) {
Slog.w(TAG , "Remote Exception", e);
}
}
@Override // Binder interface @Override // Binder interface
public IBinder asBinder() { public IBinder asBinder() {
return mService.asBinder(); return mService.asBinder();