Merge "Just get VoiceInteractionManagerService once in Activity.java" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2023-01-17 03:51:23 +00:00
committed by Android (Google) Code Review

View File

@@ -997,6 +997,8 @@ public class Activity extends ContextThemeWrapper
private ComponentCallbacksController mCallbacksController; private ComponentCallbacksController mCallbacksController;
@Nullable private IVoiceInteractionManagerService mVoiceInteractionManagerService;
private final WindowControllerCallback mWindowControllerCallback = private final WindowControllerCallback mWindowControllerCallback =
new WindowControllerCallback() { new WindowControllerCallback() {
/** /**
@@ -1606,18 +1608,17 @@ public class Activity extends ContextThemeWrapper
private void notifyVoiceInteractionManagerServiceActivityEvent( private void notifyVoiceInteractionManagerServiceActivityEvent(
@VoiceInteractionSession.VoiceInteractionActivityEventType int type) { @VoiceInteractionSession.VoiceInteractionActivityEventType int type) {
if (mVoiceInteractionManagerService == null) {
final IVoiceInteractionManagerService service = mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface(
IVoiceInteractionManagerService.Stub.asInterface( ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE));
ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); if (mVoiceInteractionManagerService == null) {
if (service == null) { Log.w(TAG, "notifyVoiceInteractionManagerServiceActivityEvent: Can not get "
Log.w(TAG, "notifyVoiceInteractionManagerServiceActivityEvent: Can not get " + "VoiceInteractionManagerService");
+ "VoiceInteractionManagerService"); return;
return; }
} }
try { try {
service.notifyActivityEventChanged(mToken, type); mVoiceInteractionManagerService.notifyActivityEventChanged(mToken, type);
} catch (RemoteException e) { } catch (RemoteException e) {
// Empty // Empty
} }