Search in sources :

Example 16 with AssistUtils

use of com.android.internal.app.AssistUtils in project android_frameworks_base by DirtyUnicorns.

the class ActivityManagerService method showAssistFromActivity.

@Override
public boolean showAssistFromActivity(IBinder token, Bundle args) {
    long ident = Binder.clearCallingIdentity();
    try {
        synchronized (this) {
            ActivityRecord caller = ActivityRecord.forTokenLocked(token);
            ActivityRecord top = getFocusedStack().topActivity();
            if (top != caller) {
                Slog.w(TAG, "showAssistFromActivity failed: caller " + caller + " is not current top " + top);
                return false;
            }
            if (!top.nowVisible) {
                Slog.w(TAG, "showAssistFromActivity failed: caller " + caller + " is not visible");
                return false;
            }
        }
        AssistUtils utils = new AssistUtils(mContext);
        return utils.showSessionForActiveService(args, VoiceInteractionSession.SHOW_SOURCE_APPLICATION, null, token);
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
Also used : AssistUtils(com.android.internal.app.AssistUtils)

Example 17 with AssistUtils

use of com.android.internal.app.AssistUtils in project android_packages_apps_Settings by LineageOS.

the class DefaultAssistPreferenceControllerTest method getSettingIntent_doNotShowSetting_shouldNotTryToGetSettingIntent.

@Test
public void getSettingIntent_doNotShowSetting_shouldNotTryToGetSettingIntent() {
    final AssistUtils assistUtils = mock(AssistUtils.class);
    final DefaultAssistPreferenceController controller = new DefaultAssistPreferenceController(mContext, TEST_KEY, false);
    ReflectionHelpers.setField(controller, "mAssistUtils", assistUtils);
    controller.getSettingIntent(null);
    verifyZeroInteractions(assistUtils);
}
Also used : AssistUtils(com.android.internal.app.AssistUtils) Test(org.junit.Test)

Example 18 with AssistUtils

use of com.android.internal.app.AssistUtils in project platform_frameworks_base by android.

the class ActivityManagerService method showAssistFromActivity.

@Override
public boolean showAssistFromActivity(IBinder token, Bundle args) {
    long ident = Binder.clearCallingIdentity();
    try {
        synchronized (this) {
            ActivityRecord caller = ActivityRecord.forTokenLocked(token);
            ActivityRecord top = getFocusedStack().topActivity();
            if (top != caller) {
                Slog.w(TAG, "showAssistFromActivity failed: caller " + caller + " is not current top " + top);
                return false;
            }
            if (!top.nowVisible) {
                Slog.w(TAG, "showAssistFromActivity failed: caller " + caller + " is not visible");
                return false;
            }
        }
        AssistUtils utils = new AssistUtils(mContext);
        return utils.showSessionForActiveService(args, VoiceInteractionSession.SHOW_SOURCE_APPLICATION, null, token);
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
Also used : AssistUtils(com.android.internal.app.AssistUtils)

Example 19 with AssistUtils

use of com.android.internal.app.AssistUtils in project android_packages_apps_Settings by omnirom.

the class DefaultAssistPicker method onAttach.

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    mAssistUtils = new AssistUtils(context);
}
Also used : AssistUtils(com.android.internal.app.AssistUtils)

Example 20 with AssistUtils

use of com.android.internal.app.AssistUtils in project android_packages_apps_Settings by omnirom.

the class DefaultVoiceInputPicker method onAttach.

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    mAssistUtils = new AssistUtils(context);
    mHelper = new VoiceInputHelper(context);
    mHelper.buildUi();
    final ComponentName assist = getCurrentAssist();
    if (isCurrentAssistVoiceService(assist, getCurrentService(mHelper))) {
        mAssistRestrict = assist.flattenToShortString();
    }
}
Also used : AssistUtils(com.android.internal.app.AssistUtils) ComponentName(android.content.ComponentName)

Aggregations

AssistUtils (com.android.internal.app.AssistUtils)27 ComponentName (android.content.ComponentName)12 Test (org.junit.Test)7 PackageInfo (android.content.pm.PackageInfo)5 Icon (android.graphics.drawable.Icon)5 RemoteException (android.os.RemoteException)5 KeyboardShortcutGroup (android.view.KeyboardShortcutGroup)5 KeyboardShortcutInfo (android.view.KeyboardShortcutInfo)5 ArrayList (java.util.ArrayList)5