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

Commit c153975b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9576141 from 44aecef2 to udc-release

Change-Id: I9880ed1d87a9ab8b45e95db0e0db9693ac93ce9a
parents 9a0ada33 44aecef2
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.app.search;

import android.app.search.Query;
import android.os.Bundle;

/**
 * Utility class used to define implicit contract between aiai and launcher regarding
 * what constant string key should be used to pass sub session information inside
 * the {@link Query} object.
 *
 * This decorated query object is passed to aiai using two method calls:
 * <ul>
 *     <ol>android.app.search.SearchSession.query()</ol>
 *     <ol>android.app.search.SearchSession.notifyEvent()</ol>
 * </ul>
 */
public class QueryExtras {

    // Can be either 1 (ALLAPPS) or 2 (QSB)
    public static final String EXTRAS_KEY_ENTRY = "entry";

    // This value overrides the timeout that is defined inside {@link SearchContext#getTimeout}
    public static final String EXTRAS_KEY_TIMEOUT_OVERRIDE = "timeout";
}
+16 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.app.search;

import android.app.search.SearchAction;
+48 −3
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.app.search;

import static com.android.app.search.LayoutType.TALL_CARD_WITH_IMAGE_NO_ICON;

import android.app.blob.BlobHandle;
import android.app.search.SearchTarget;
import android.os.Bundle;
import android.text.TextUtils;

import androidx.annotation.Nullable;
@@ -38,17 +56,20 @@ public class SearchTargetExtras {
    // Indicates the search result app location column
    public static final String BUNDLE_EXTRA_RESULT_APP_GRIDX = "app_gridx";

    // Used for thumbnail loading. Contains handle to retrieve Blobstore asset.
    public static final String BUNDLE_EXTRA_BLOBSTORE_HANDLE = "blobstore_handle_key";

    public static final int GROUPING = 1 << 1;

    @Nullable
    public static String getDecoratorId(@Nullable SearchTarget target) {
        return (target == null || target.getExtras() == null) ? null :
        return isTargetOrExtrasNull(target) ? null :
                target.getExtras().getString(BUNDLE_EXTRA_GROUP_ID);
    }

    public static int getDecoratorType(@Nullable SearchTarget target) {
        int type = 0;
        if (target == null || target.getExtras() == null) {
        if (isTargetOrExtrasNull(target)) {
            return type;
        }
        if (!TextUtils.isEmpty(target.getExtras().getString(BUNDLE_EXTRA_GROUP_ID))) {
@@ -57,6 +78,19 @@ public class SearchTargetExtras {
        return type;
    }

    /** Whether or not the SearchTarget's Extras contains a blobstore image. */
    public static boolean isSearchTargetBlobstoreAsset(@Nullable SearchTarget target) {
        if (isTargetOrExtrasNull(target)) {
            return false;
        }
        return target.getExtras().getParcelable(
                BUNDLE_EXTRA_BLOBSTORE_HANDLE) instanceof BlobHandle;
    }

    private static boolean isTargetOrExtrasNull(@Nullable SearchTarget target) {
        return target == null || target.getExtras() == null;
    }

    /** Web data related extras and helper methods */
    public static final String BUNDLE_EXTRA_PROXY_WEB_ITEM = "proxy_web_item";
    public static final String BUNDLE_EXTRA_ENTITY = "is_entity";
@@ -71,6 +105,17 @@ public class SearchTargetExtras {
    public static final String BUNDLE_EXTRA_TALL_CARD_IMAGE_DESCRIPTION =
            "tall_card_image_description";
    public static final String BUNDLE_EXTRA_BITMAP_URL = "bitmap_url";
    /**
     *  Flag to control whether thumbnail(s) should fill the thumbnail container's width or not.
     *  When this flag is true, when there are less than the maximum number of thumbnails in the
     *  container, the thumbnails will stretch to fill the container's width.
     *  When this flag is false, thumbnails will always be cropped to a square ratio even if
     *  there aren't enough thumbnails to fill the container.
     *
     *  Only relevant in {@link LayoutType.THUMBNAIL_CONTAINER} and {@link LayoutType.THUMBNAIL}.
     */
    public static final String BUNDLE_EXTRA_SHOULD_FILL_CONTAINER_WIDTH =
            "should_fill_container_width";
    public static final String BUNDLE_EXTRA_SUGGESTION_ACTION_TEXT = "suggestion_action_text";
    public static final String BUNDLE_EXTRA_SUGGESTION_ACTION_RPC = "suggestion_action_rpc";
    public static final String BUNDLE_EXTRA_SUPPORT_QUERY_BUILDER = "support_query_builder";
+16 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.app.search;

import static com.android.app.search.LayoutType.EMPTY_DIVIDER;
+16 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.app.search;

import static com.android.app.search.LayoutType.EMPTY_DIVIDER;