am 20df6234
: Merge "Add callback to voice interaction session for lockscreen shown" into mnc-dev
* commit '20df62345910ad390a3bb321990987757db0831d': Add callback to voice interaction session for lockscreen shown
This commit is contained in:
@ -28825,6 +28825,7 @@ package android.service.voice {
|
|||||||
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
|
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
|
||||||
method public void onHandleScreenshot(android.graphics.Bitmap);
|
method public void onHandleScreenshot(android.graphics.Bitmap);
|
||||||
method public void onHide();
|
method public void onHide();
|
||||||
|
method public void onLockscreenShown();
|
||||||
method public boolean onKeyDown(int, android.view.KeyEvent);
|
method public boolean onKeyDown(int, android.view.KeyEvent);
|
||||||
method public boolean onKeyLongPress(int, android.view.KeyEvent);
|
method public boolean onKeyLongPress(int, android.view.KeyEvent);
|
||||||
method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
|
method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
|
||||||
|
@ -30977,6 +30977,7 @@ package android.service.voice {
|
|||||||
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
|
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
|
||||||
method public void onHandleScreenshot(android.graphics.Bitmap);
|
method public void onHandleScreenshot(android.graphics.Bitmap);
|
||||||
method public void onHide();
|
method public void onHide();
|
||||||
|
method public void onLockscreenShown();
|
||||||
method public boolean onKeyDown(int, android.view.KeyEvent);
|
method public boolean onKeyDown(int, android.view.KeyEvent);
|
||||||
method public boolean onKeyLongPress(int, android.view.KeyEvent);
|
method public boolean onKeyLongPress(int, android.view.KeyEvent);
|
||||||
method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
|
method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
|
||||||
|
@ -35,5 +35,6 @@ oneway interface IVoiceInteractionSession {
|
|||||||
void taskStarted(in Intent intent, int taskId);
|
void taskStarted(in Intent intent, int taskId);
|
||||||
void taskFinished(in Intent intent, int taskId);
|
void taskFinished(in Intent intent, int taskId);
|
||||||
void closeSystemDialogs();
|
void closeSystemDialogs();
|
||||||
|
void onLockscreenShown();
|
||||||
void destroy();
|
void destroy();
|
||||||
}
|
}
|
||||||
|
@ -264,6 +264,11 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_CLOSE_SYSTEM_DIALOGS));
|
mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_CLOSE_SYSTEM_DIALOGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLockscreenShown() {
|
||||||
|
mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_ON_LOCKSCREEN_SHOWN));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_DESTROY));
|
mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_DESTROY));
|
||||||
@ -674,6 +679,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
static final int MSG_HANDLE_SCREENSHOT = 105;
|
static final int MSG_HANDLE_SCREENSHOT = 105;
|
||||||
static final int MSG_SHOW = 106;
|
static final int MSG_SHOW = 106;
|
||||||
static final int MSG_HIDE = 107;
|
static final int MSG_HIDE = 107;
|
||||||
|
static final int MSG_ON_LOCKSCREEN_SHOWN = 108;
|
||||||
|
|
||||||
class MyCallbacks implements HandlerCaller.Callback, SoftInputWindow.Callback {
|
class MyCallbacks implements HandlerCaller.Callback, SoftInputWindow.Callback {
|
||||||
@Override
|
@Override
|
||||||
@ -752,6 +758,10 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
if (DEBUG) Log.d(TAG, "doHide");
|
if (DEBUG) Log.d(TAG, "doHide");
|
||||||
doHide();
|
doHide();
|
||||||
break;
|
break;
|
||||||
|
case MSG_ON_LOCKSCREEN_SHOWN:
|
||||||
|
if (DEBUG) Log.d(TAG, "onLockscreenShown");
|
||||||
|
onLockscreenShown();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
args.recycle();
|
args.recycle();
|
||||||
@ -1296,6 +1306,13 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the lockscreen was shown.
|
||||||
|
*/
|
||||||
|
public void onLockscreenShown() {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,16 @@ public class AssistUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onLockscreenShown() {
|
||||||
|
try {
|
||||||
|
if (mVoiceInteractionManagerService != null) {
|
||||||
|
mVoiceInteractionManagerService.onLockscreenShown();
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.w(TAG, "Failed to call onLockscreenShown", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ComponentName getAssistComponentForUser(int userId) {
|
public ComponentName getAssistComponentForUser(int userId) {
|
||||||
final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
|
final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
|
||||||
Settings.Secure.ASSISTANT, userId);
|
Settings.Secure.ASSISTANT, userId);
|
||||||
|
@ -131,4 +131,9 @@ interface IVoiceInteractionManagerService {
|
|||||||
* from the lockscreen.
|
* from the lockscreen.
|
||||||
*/
|
*/
|
||||||
boolean activeServiceSupportsLaunchFromKeyguard();
|
boolean activeServiceSupportsLaunchFromKeyguard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the lockscreen got shown.
|
||||||
|
*/
|
||||||
|
void onLockscreenShown();
|
||||||
}
|
}
|
||||||
|
@ -304,4 +304,8 @@ public class AssistManager {
|
|||||||
public void onUserSwitched(int newUserId) {
|
public void onUserSwitched(int newUserId) {
|
||||||
updateAssistInfo();
|
updateAssistInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onLockscreenShown() {
|
||||||
|
mAssistUtils.onLockscreenShown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3311,6 +3311,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
mDraggedDownRow.notifyHeightChanged(false /* needsAnimation */);
|
mDraggedDownRow.notifyHeightChanged(false /* needsAnimation */);
|
||||||
mDraggedDownRow = null;
|
mDraggedDownRow = null;
|
||||||
}
|
}
|
||||||
|
mAssistManager.onLockscreenShown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLaunchTransitionFadingEnded() {
|
private void onLaunchTransitionFadingEnded() {
|
||||||
|
@ -893,6 +893,28 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLockscreenShown() {
|
||||||
|
enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
|
||||||
|
synchronized (this) {
|
||||||
|
if (mImpl == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final long caller = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
if (mImpl.mActiveSession != null && mImpl.mActiveSession.mSession != null) {
|
||||||
|
try {
|
||||||
|
mImpl.mActiveSession.mSession.onLockscreenShown();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.w(TAG, "Failed to call onLockscreenShown", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(caller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
if (mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP)
|
if (mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP)
|
||||||
|
@ -24,6 +24,7 @@ import android.graphics.Color;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.service.voice.VoiceInteractionSession;
|
import android.service.voice.VoiceInteractionSession;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewAnimationUtils;
|
import android.view.ViewAnimationUtils;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
@ -69,6 +70,7 @@ public class AssistInteractionSession extends VoiceInteractionSession {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
// Simulate slowness of Assist app
|
// Simulate slowness of Assist app
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
@ -105,6 +107,12 @@ public class AssistInteractionSession extends VoiceInteractionSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLockscreenShown() {
|
||||||
|
super.onLockscreenShown();
|
||||||
|
Log.i("Assistant", "Lockscreen was shown");
|
||||||
|
}
|
||||||
|
|
||||||
private void playAssistAnimation() {
|
private void playAssistAnimation() {
|
||||||
Interpolator linearOutSlowIn = AnimationUtils.loadInterpolator(mBackground.getContext(),
|
Interpolator linearOutSlowIn = AnimationUtils.loadInterpolator(mBackground.getContext(),
|
||||||
android.R.interpolator.linear_out_slow_in);
|
android.R.interpolator.linear_out_slow_in);
|
||||||
|
Reference in New Issue
Block a user