Do not launch assistant via long press when device is locked.

Bug: 30194057
Change-Id: I6cd8046fd34308abbbbd1e3f3219d70af40b55c5
This commit is contained in:
Nancy Zheng
2016-09-29 09:15:56 -07:00
parent d8c12daf14
commit 0d85ee2e78

View File

@@ -1373,8 +1373,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
case LONG_PRESS_BACK_NOTHING:
break;
case LONG_PRESS_BACK_GO_TO_VOICE_ASSIST:
Intent intent = new Intent(Intent.ACTION_VOICE_ASSIST);
startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF);
final boolean keyguardActive = mKeyguardDelegate == null
? false
: mKeyguardDelegate.isShowing();
if (!keyguardActive) {
Intent intent = new Intent(Intent.ACTION_VOICE_ASSIST);
startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF);
}
break;
}
}