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

Commit d9925235 authored by Annie Chin's avatar Annie Chin Committed by android-build-merger
Browse files

Merge \"Add callbacks to VoiceInteractionManagerService\" into nyc-mr1-dev

am: d58f07f5

Change-Id: I6a9c537b71084696915e744102a6a12f532942d5
parents 4675ed8c d58f07f5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -308,6 +308,7 @@ LOCAL_SRC_FILES += \
	core/java/com/android/internal/app/IEphemeralResolver.aidl \
	core/java/com/android/internal/app/ISoundTriggerService.aidl \
	core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl \
	core/java/com/android/internal/app/IVoiceInteractionSessionListener.aidl \
	core/java/com/android/internal/app/IVoiceInteractionSessionShowCallback.aidl \
	core/java/com/android/internal/app/IVoiceInteractor.aidl \
	core/java/com/android/internal/app/IVoiceInteractorCallback.aidl \
+10 −0
Original line number Diff line number Diff line
@@ -132,6 +132,16 @@ public class AssistUtils {
        }
    }

    public void registerVoiceInteractionSessionListener(IVoiceInteractionSessionListener listener) {
        try {
            if (mVoiceInteractionManagerService != null) {
                mVoiceInteractionManagerService.registerVoiceInteractionSessionListener(listener);
            }
        } catch (RemoteException e) {
            Log.w(TAG, "Failed to register voice interaction listener", e);
        }
    }

    public ComponentName getAssistComponentForUser(int userId) {
        final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
                Settings.Secure.ASSISTANT, userId);
+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.os.Bundle;

import com.android.internal.app.IVoiceInteractionSessionShowCallback;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.app.IVoiceInteractionSessionListener;
import android.hardware.soundtrigger.IRecognitionStatusCallback;
import android.hardware.soundtrigger.SoundTrigger;
import android.service.voice.IVoiceInteractionService;
@@ -136,4 +137,9 @@ interface IVoiceInteractionManagerService {
     * Called when the lockscreen got shown.
     */
    void onLockscreenShown();

    /**
     * Register a voice interaction listener.
     */
    void registerVoiceInteractionSessionListener(IVoiceInteractionSessionListener listener);
}
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

 package com.android.internal.app;

 oneway interface IVoiceInteractionSessionListener {
    /**
     * Called when a voice session is shown.
     */
    void onVoiceSessionShown();

    /**
     * Called when a voice session is hidden.
     */
    void onVoiceSessionHidden();
 }
 No newline at end of file
+20 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import android.graphics.PixelFormat;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
import android.provider.Settings;
@@ -28,9 +29,9 @@ import android.view.WindowManager;
import android.widget.ImageView;

import com.android.internal.app.AssistUtils;
import com.android.internal.app.IVoiceInteractionSessionListener;
import com.android.internal.app.IVoiceInteractionSessionShowCallback;
import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.CommandQueue;

@@ -52,7 +53,7 @@ public class AssistManager {

    private AssistOrbContainer mView;
    private final BaseStatusBar mBar;
    private final AssistUtils mAssistUtils;
    protected final AssistUtils mAssistUtils;

    private IVoiceInteractionSessionShowCallback mShowCallback =
            new IVoiceInteractionSessionShowCallback.Stub() {
@@ -82,6 +83,23 @@ public class AssistManager {
        mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
        mAssistUtils = new AssistUtils(context);
        mAssistDisclosure = new AssistDisclosure(context, new Handler());

        registerVoiceInteractionSessionListener();
    }

    protected void registerVoiceInteractionSessionListener() {
        mAssistUtils.registerVoiceInteractionSessionListener(
                new IVoiceInteractionSessionListener.Stub() {
            @Override
            public void onVoiceSessionShown() throws RemoteException {
                Log.v(TAG, "Voice open");
            }

            @Override
            public void onVoiceSessionHidden() throws RemoteException {
                Log.v(TAG, "Voice closed");
            }
        });
    }

    public void onConfigurationChanged() {
Loading