Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f1b8f6c authored by Hai Zhang's avatar Hai Zhang
Browse files

Reset assistant role after package force stop.

Bug: 124450140
Test: manual
Change-Id: I6a29fe27f9b5f95c32d6171d0cca1fa700c07e4d
parent c33c55b2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1389,6 +1389,16 @@ public class VoiceInteractionManagerService extends SystemService {
                        resetCurAssistant(userHandle);
                        initForUser(userHandle);
                        switchImplementationIfNeededLocked(true);

                        Context context = getContext();
                        context.getSystemService(RoleManager.class).clearRoleHoldersAsUser(
                                RoleManager.ROLE_ASSISTANT, 0, UserHandle.of(userHandle),
                                context.getMainExecutor(), successful -> {
                                    if (!successful) {
                                        Slog.e(TAG,
                                                "Failed to clear default assistant for force stop");
                                    }
                                });
                    }
                } else if (hitRec && doit) {
                    // We are just force-stopping the current recognizer, which is not