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

Commit e835b984 authored by Nicholas Ambur's avatar Nicholas Ambur
Browse files

fix SoundTrigger overwriting session identity

SoundTrigger tracks client UID for every session. This CL fixes an issue
with client UID being saved twice causing the incorrect client UID to be
saved.

Bug: 171342256
Test: boot and verify hotword is functional
Change-Id: I68bba238293ed5a74f5a3677f21e5122cc444f82
parent 15b8613a
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -47,12 +47,7 @@ public interface SoundTriggerInternal {
    int STATUS_ERROR = SoundTrigger.STATUS_ERROR;
    int STATUS_OK = SoundTrigger.STATUS_OK;

    Session attachAsOriginator(@NonNull Identity originatorIdentity,
            @NonNull IBinder client);

    Session attachAsMiddleman(@NonNull Identity middlemanIdentity,
            @NonNull Identity originatorIdentity,
            @NonNull IBinder client);
    Session attach(@NonNull IBinder client);

    /**
     * Dumps service-wide information.
+2 −16
Original line number Diff line number Diff line
@@ -1545,23 +1545,9 @@ public class SoundTriggerService extends SystemService {
        }

        @Override
        public Session attachAsOriginator(@NonNull Identity originatorIdentity,
                @NonNull IBinder client) {
            try (SafeCloseable ignored = PermissionUtil.establishIdentityDirect(
                    originatorIdentity)) {
        public Session attach(@NonNull IBinder client) {
            return new SessionImpl(newSoundTriggerHelper(), client);
        }
        }

        @Override
        public Session attachAsMiddleman(@NonNull Identity middlemanIdentity,
                @NonNull Identity originatorIdentity,
                @NonNull IBinder client) {
            try (SafeCloseable ignored = PermissionUtil.establishIdentityIndirect(mContext,
                    SOUNDTRIGGER_DELEGATE_IDENTITY, middlemanIdentity, originatorIdentity)) {
                return new SessionImpl(newSoundTriggerHelper(), client);
            }
        }

        @Override
        public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+1 −2
Original line number Diff line number Diff line
@@ -262,8 +262,7 @@ public class VoiceInteractionManagerService extends SystemService {
            try (SafeCloseable ignored = PermissionUtil.establishIdentityDirect(
                    originatorIdentity)) {
                SoundTriggerSession session = new SoundTriggerSession(
                        mSoundTriggerInternal.attachAsOriginator(IdentityContext.getNonNull(),
                                client));
                        mSoundTriggerInternal.attach(client));
                synchronized (mSessions) {
                    mSessions.add(new WeakReference<>(session));
                }