Java Code Examples for android.content.Intent#ACTION_ASSIST

The following examples show how to use android.content.Intent#ACTION_ASSIST . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LegacyGlobalActions.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private Action getAssistAction() {
    return new SinglePressAction(com.android.internal.R.drawable.ic_action_assist_focused,
            R.string.global_action_assist) {
        @Override
        public void onPress() {
            Intent intent = new Intent(Intent.ACTION_ASSIST);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            mContext.startActivity(intent);
        }

        @Override
        public boolean showDuringKeyguard() {
            return true;
        }

        @Override
        public boolean showBeforeProvisioning() {
            return true;
        }
    };
}
 
Example 2
Source File: SearchManager.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Gets an intent for launching installed assistant activity, or null if not available.
 * @return The assist intent.
 *
 * @hide
 */
public Intent getAssistIntent(boolean inclContext) {
    try {
        Intent intent = new Intent(Intent.ACTION_ASSIST);
        if (inclContext) {
            IActivityManager am = ActivityManager.getService();
            Bundle extras = am.getAssistContextExtras(ActivityManager.ASSIST_CONTEXT_BASIC);
            if (extras != null) {
                intent.replaceExtras(extras);
            }
        }
        return intent;
    } catch (RemoteException re) {
        throw re.rethrowFromSystemServer();
    }
}
 
Example 3
Source File: IntentSubjectTest.java    From android-test with Apache License 2.0 5 votes vote down vote up
@Test
public void hasNoAction_withAction() {
  Intent intent = new Intent(Intent.ACTION_ASSIST);
  try {
    assertThat(intent).hasNoAction();
  } catch (AssertionError e) {
    Truth.assertThat(e.getMessage()).contains("expected  : null");
    Truth.assertThat(e.getMessage()).contains("but was   : android.intent.action.ASSIST");
  }
}
 
Example 4
Source File: IntentSubjectTest.java    From android-test with Apache License 2.0 5 votes vote down vote up
@Test
public void filtersEquallyTo_equal() {
  Intent intent = new Intent(Intent.ACTION_ASSIST);
  Intent intentWithExtra = new Intent(Intent.ACTION_ASSIST).putExtra("key", "value");

  assertThat(intent).filtersEquallyTo(new Intent(intent));
  assertThat(intent).filtersEquallyTo(intentWithExtra);
}
 
Example 5
Source File: IntentSubjectTest.java    From android-test with Apache License 2.0 4 votes vote down vote up
@Test
public void hasAction() {
  Intent intent = new Intent(Intent.ACTION_ASSIST);
  assertThat(intent).hasAction(Intent.ACTION_ASSIST);
}