Minor improvements on voice interaction workflows.

Bug: 131411751
Fixes: 132783948

Test: atest CtsVoiceInteractionTestCases CtsAssistTestCases

Change-Id: I28c8577caa35a783863f4313487c6e9b9abc8ff2
This commit is contained in:
Felipe Leme
2019-05-14 15:19:52 -07:00
parent 8092cdaeda
commit ada5184574
2 changed files with 9 additions and 2 deletions

View File

@@ -123,7 +123,6 @@ import android.provider.Settings;
import android.renderscript.RenderScriptCacheDir;
import android.security.NetworkSecurityPolicy;
import android.security.net.config.NetworkSecurityConfigProvider;
import android.service.voice.VoiceInteractionSession;
import android.system.ErrnoException;
import android.system.OsConstants;
import android.system.StructStat;
@@ -3555,11 +3554,13 @@ public final class ActivityThread extends ClientTransactionHandler {
@NonNull RemoteCallback callback) {
final ActivityClientRecord r = mActivities.get(activityToken);
if (r == null) {
Log.w(TAG, "requestDirectActions(): no activity for " + activityToken);
callback.sendResult(null);
return;
}
final int lifecycleState = r.getLifecycleState();
if (lifecycleState < ON_START || lifecycleState >= ON_STOP) {
Log.w(TAG, "requestDirectActions(" + r + "): wrong lifecycle: " + lifecycleState);
callback.sendResult(null);
return;
}

View File

@@ -1452,7 +1452,13 @@ public class AudioService extends IAudioService.Stub
Settings.Secure.ASSISTANT, UserHandle.USER_CURRENT);
}
if (!TextUtils.isEmpty(assistantName)) {
packageName = ComponentName.unflattenFromString(assistantName).getPackageName();
ComponentName componentName = ComponentName.unflattenFromString(assistantName);
if (componentName == null) {
Slog.w(TAG, "Invalid service name for "
+ Settings.Secure.VOICE_INTERACTION_SERVICE + ": " + assistantName);
return;
}
packageName = componentName.getPackageName();
}
}
if (!TextUtils.isEmpty(packageName)) {