summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2015-04-24 16:46:13 -0700
committerSelim Cinek <cinek@google.com>2015-05-05 14:52:52 -0700
commite70d6535237d2e6f03adcd0bdc11e45ea714dc97 (patch)
tree342b22ff5e17567563e008f2b684bfcd3ba3f932 /core/java
parent08e474ca24c024be29ed8a593cbd2748abde44ce (diff)
downloadframeworks_base-e70d6535237d2e6f03adcd0bdc11e45ea714dc97.zip
frameworks_base-e70d6535237d2e6f03adcd0bdc11e45ea714dc97.tar.gz
frameworks_base-e70d6535237d2e6f03adcd0bdc11e45ea714dc97.tar.bz2
The voice assist may now be launched above the lockscreen
A possibility was introduced to launch voice assist over the lockscreen using the left keyguard affordance. Change-Id: Ic4618d24256b65441a50d77d0ef59b0ec99b6ead
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/service/voice/IVoiceInteractionService.aidl1
-rw-r--r--core/java/android/service/voice/VoiceInteractionService.java21
-rw-r--r--core/java/android/service/voice/VoiceInteractionServiceInfo.java8
-rw-r--r--core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl12
4 files changed, 42 insertions, 0 deletions
diff --git a/core/java/android/service/voice/IVoiceInteractionService.aidl b/core/java/android/service/voice/IVoiceInteractionService.aidl
index e8265a2..e3d68a6 100644
--- a/core/java/android/service/voice/IVoiceInteractionService.aidl
+++ b/core/java/android/service/voice/IVoiceInteractionService.aidl
@@ -23,4 +23,5 @@ oneway interface IVoiceInteractionService {
void ready();
void soundModelsChanged();
void shutdown();
+ void launchVoiceAssistFromKeyguard();
}
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java
index fee0c75..8c89ddb 100644
--- a/core/java/android/service/voice/VoiceInteractionService.java
+++ b/core/java/android/service/voice/VoiceInteractionService.java
@@ -98,6 +98,10 @@ public class VoiceInteractionService extends Service {
@Override public void soundModelsChanged() {
mHandler.sendEmptyMessage(MSG_SOUND_MODELS_CHANGED);
}
+ @Override
+ public void launchVoiceAssistFromKeyguard() throws RemoteException {
+ mHandler.sendEmptyMessage(MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD);
+ }
};
MyHandler mHandler;
@@ -113,6 +117,7 @@ public class VoiceInteractionService extends Service {
static final int MSG_READY = 1;
static final int MSG_SHUTDOWN = 2;
static final int MSG_SOUND_MODELS_CHANGED = 3;
+ static final int MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD = 4;
class MyHandler extends Handler {
@Override
@@ -127,6 +132,9 @@ public class VoiceInteractionService extends Service {
case MSG_SOUND_MODELS_CHANGED:
onSoundModelsChangedInternal();
break;
+ case MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD:
+ onLaunchVoiceAssistFromKeyguard();
+ break;
default:
super.handleMessage(msg);
}
@@ -134,6 +142,19 @@ public class VoiceInteractionService extends Service {
}
/**
+ * Called when a user has activated an affordance to launch voice assist from the Keyguard.
+ *
+ * <p>This method will only be called if the VoiceInteractionService has set
+ * {@link android.R.attr#supportsLaunchVoiceAssistFromKeyguard} and the Keyguard is showing.</p>
+ *
+ * <p>A valid implementation must start a new activity that should use {@link
+ * android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} to display
+ * on top of the lock screen.</p>
+ */
+ public void onLaunchVoiceAssistFromKeyguard() {
+ }
+
+ /**
* Check whether the given service component is the currently active
* VoiceInteractionService.
*/
diff --git a/core/java/android/service/voice/VoiceInteractionServiceInfo.java b/core/java/android/service/voice/VoiceInteractionServiceInfo.java
index 997d586..463eb5b 100644
--- a/core/java/android/service/voice/VoiceInteractionServiceInfo.java
+++ b/core/java/android/service/voice/VoiceInteractionServiceInfo.java
@@ -44,6 +44,7 @@ public class VoiceInteractionServiceInfo {
private String mRecognitionService;
private String mSettingsActivity;
private boolean mSupportsAssist;
+ private boolean mSupportsLaunchFromKeyguard;
public VoiceInteractionServiceInfo(PackageManager pm, ComponentName comp)
throws PackageManager.NameNotFoundException {
@@ -98,6 +99,9 @@ public class VoiceInteractionServiceInfo {
mSupportsAssist = array.getBoolean(
com.android.internal.R.styleable.VoiceInteractionService_supportsAssist,
false);
+ mSupportsLaunchFromKeyguard = array.getBoolean(com.android.internal.
+ R.styleable.VoiceInteractionService_supportsLaunchVoiceAssistFromKeyguard,
+ false);
array.recycle();
if (mSessionService == null) {
mParseError = "No sessionService specified";
@@ -148,4 +152,8 @@ public class VoiceInteractionServiceInfo {
public boolean getSupportsAssist() {
return mSupportsAssist;
}
+
+ public boolean getSupportsLaunchFromKeyguard() {
+ return mSupportsLaunchFromKeyguard;
+ }
}
diff --git a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
index 4c6db24..644adb6 100644
--- a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
+++ b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
@@ -97,6 +97,12 @@ interface IVoiceInteractionManagerService {
void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback);
/**
+ * Notifies the active service that a launch was requested from the Keyguard. This will only
+ * be called if {@link #activeServiceSupportsLaunchFromKeyguard()} returns true.
+ */
+ void launchVoiceAssistFromKeyguard();
+
+ /**
* Indicates whether there is a voice session running (but not necessarily showing).
*/
boolean isSessionRunning();
@@ -106,4 +112,10 @@ interface IVoiceInteractionManagerService {
* assist gesture.
*/
boolean activeServiceSupportsAssist();
+
+ /**
+ * Indicates whether the currently active voice interaction service is capable of being launched
+ * from the lockscreen.
+ */
+ boolean activeServiceSupportsLaunchFromKeyguard();
}