android.app.assist.AssistContent Java Examples

The following examples show how to use android.app.assist.AssistContent. 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: ChromeActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    if (getAssistStatusHandler() == null || !getAssistStatusHandler().isAssistSupported()) {
        // No information is provided in incognito mode.
        return;
    }
    Tab tab = getActivityTab();
    if (tab != null && !isInOverviewMode()) {
        outContent.setWebUri(Uri.parse(tab.getUrl()));
    }
}
 
Example #2
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    if (getAssistStatusHandler() == null || !getAssistStatusHandler().isAssistSupported()) {
        // No information is provided in incognito mode.
        return;
    }
    Tab tab = getActivityTab();
    if (tab != null && !isInOverviewMode()) {
        outContent.setWebUri(Uri.parse(tab.getUrl()));
    }
}
 
Example #3
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    if (getAssistStatusHandler() == null || !getAssistStatusHandler().isAssistSupported()) {
        // No information is provided in incognito mode.
        return;
    }
    Tab tab = getActivityTab();
    if (tab != null && !isInOverviewMode()) {
        outContent.setWebUri(Uri.parse(tab.getUrl()));
    }
}
 
Example #4
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void handleAssist(final Bundle data, final AssistStructure structure,
        final AssistContent content, final int index, final int count) {
    // We want to pre-warm the AssistStructure before handing it off to the main
    // thread.  We also want to do this on a separate thread, so that if the app
    // is for some reason slow (due to slow filling in of async children in the
    // structure), we don't block other incoming IPCs (such as the screenshot) to
    // us (since we are a oneway interface, they get serialized).  (Okay?)
    Thread retriever = new Thread("AssistStructure retriever") {
        @Override
        public void run() {
            Throwable failure = null;
            if (structure != null) {
                try {
                    structure.ensureData();
                } catch (Throwable e) {
                    Log.w(TAG, "Failure retrieving AssistStructure", e);
                    failure = e;
                }
            }
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOOII(MSG_HANDLE_ASSIST,
                    data, failure == null ? structure : null, failure, content,
                    index, count));
        }
    };
    retriever.start();
}
 
Example #5
Source File: InstrActivityProxy1.java    From Neptune with Apache License 2.0 5 votes vote down vote up
@Override
public void onProvideAssistContent(AssistContent outContent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        super.onProvideAssistContent(outContent);
        if (getController() != null) {
            getController().getPlugin().onProvideAssistContent(outContent);
        }
    }
}
 
Example #6
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void doOnHandleAssistSecondary(Bundle data, AssistStructure structure, Throwable failure,
        AssistContent content, int index, int count) {
    if (failure != null) {
        onAssistStructureFailure(failure);
    }
    onHandleAssistSecondary(data, structure, content, index, count);
}
 
Example #7
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void doOnHandleAssist(Bundle data, AssistStructure structure, Throwable failure,
        AssistContent content) {
    if (failure != null) {
        onAssistStructureFailure(failure);
    }
    onHandleAssist(data, structure, content);
}
 
Example #8
Source File: BBVoiceInteractionSession.java    From timecat with Apache License 2.0 4 votes vote down vote up
@Override
public void onHandleAssist(Bundle data, AssistStructure structure, AssistContent content) {
    super.onHandleAssist(data, structure, content);
}
 
Example #9
Source File: BBVoiceInteractionSession.java    From timecat with Apache License 2.0 4 votes vote down vote up
@Override
public void onHandleAssistSecondary(Bundle data, AssistStructure structure, AssistContent content, int index, int count) {
    super.onHandleAssistSecondary(data, structure, content, index, count);
}
 
Example #10
Source File: SaiyInteractionSession.java    From Saiy-PS with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void onHandleAssist(Bundle data, AssistStructure structure, AssistContent content) {
}
 
Example #11
Source File: PostActivity.java    From materialup with Apache License 2.0 4 votes vote down vote up
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    outContent.setWebUri(Uri.parse(shot.url));
}
 
Example #12
Source File: DesignerNewsStory.java    From android-proguards with Apache License 2.0 4 votes vote down vote up
@Override @TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    outContent.setWebUri(Uri.parse(story.url));
}
 
Example #13
Source File: DribbbleShot.java    From android-proguards with Apache License 2.0 4 votes vote down vote up
@Override @TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    outContent.setWebUri(Uri.parse(shot.url));
}
 
Example #14
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Called to receive data from other applications that the user was or is interacting with,
 * that are currently on the screen in a multi-window display environment, not including the
 * currently focused activity. This could be
 * a free-form window, a picture-in-picture window, or another window in a split-screen display.
 * <p>
 * This method is very similar to
 * {@link #onHandleAssist} except that it is called
 * for additional non-focused activities along with an index and count that indicates
 * which additional activity the data is for. {@code index} will be between 1 and
 * {@code count}-1 and this method is called once for each additional window, in no particular
 * order. The {@code count} indicates how many windows to expect assist data for, including the
 * top focused activity, which continues to be returned via {@link #onHandleAssist}.
 * <p>
 * To be responsive to assist requests, process assist data as soon as it is received,
 * without waiting for all queued activities to return assist data.
 *
 * @param data Arbitrary data supplied by the app through
 * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData}.
 * May be null if assist data has been disabled by the user or device policy.
 * @param structure If available, the structure definition of all windows currently
 * displayed by the app.  May be null if assist data has been disabled by the user
 * or device policy; will be an empty stub if the application has disabled assist
 * by marking its window as secure.
 * @param content Additional content data supplied by the app through
 * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}.
 * May be null if assist data has been disabled by the user or device policy; will
 * not be automatically filled in with data from the app if the app has marked its
 * window as secure.
 * @param index the index of the additional activity that this data
 *        is for.
 * @param count the total number of additional activities for which the assist data is being
 *        returned, including the focused activity that is returned via
 *        {@link #onHandleAssist}.
 */
public void onHandleAssistSecondary(@Nullable Bundle data, @Nullable AssistStructure structure,
        @Nullable AssistContent content, int index, int count) {
}
 
Example #15
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Called to receive data from the application that the user was currently viewing when
 * an assist session is started.  If the original show request did not specify
 * {@link #SHOW_WITH_ASSIST}, this method will not be called.
 *
 * @param data Arbitrary data supplied by the app through
 * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData}.
 * May be null if assist data has been disabled by the user or device policy.
 * @param structure If available, the structure definition of all windows currently
 * displayed by the app.  May be null if assist data has been disabled by the user
 * or device policy; will be an empty stub if the application has disabled assist
 * by marking its window as secure.
 * @param content Additional content data supplied by the app through
 * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}.
 * May be null if assist data has been disabled by the user or device policy; will
 * not be automatically filled in with data from the app if the app has marked its
 * window as secure.
 */
public void onHandleAssist(@Nullable Bundle data, @Nullable AssistStructure structure,
        @Nullable AssistContent content) {
}
 
Example #16
Source File: BlueprintActivity.java    From CompositeAndroid with Apache License 2.0 2 votes vote down vote up
/**
 * This is called when the user is requesting an assist, to provide references
 * to content related to the current activity.  Before being called, the
 * {@code outContent} Intent is filled with the base Intent of the activity (the Intent
 * returned by {@link #getIntent()}).  The Intent's extras are stripped of any types
 * that are not valid for {@link PersistableBundle} or non-framework Parcelables, and
 * the flags {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION} and
 * {@link Intent#FLAG_GRANT_PERSISTABLE_URI_PERMISSION} are cleared from the Intent.
 *
 * <p>Custom implementation may adjust the content intent to better reflect the top-level
 * context of the activity, and fill in its ClipData with additional content of
 * interest that the user is currently viewing.  For example, an image gallery application
 * that has launched in to an activity allowing the user to swipe through pictures should
 * modify the intent to reference the current image they are looking it; such an
 * application when showing a list of pictures should add a ClipData that has
 * references to all of the pictures currently visible on screen.</p>
 *
 * @param outContent The assist content to return.
 */
@Override
public void onProvideAssistContent(AssistContent outContent) {
    super.onProvideAssistContent(outContent);
}
 
Example #17
Source File: ICompositeActivity.java    From CompositeAndroid with Apache License 2.0 votes vote down vote up
void onProvideAssistContent(AssistContent outContent); 
Example #18
Source File: ICompositeActivity.java    From CompositeAndroid with Apache License 2.0 votes vote down vote up
void super_onProvideAssistContent(AssistContent outContent);