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

Commit b8144a9c authored by Bjorn Bringert's avatar Bjorn Bringert
Browse files

Don't start global search from system dialogs

Also, set FLAG_ACTIVITY_NEW_TASK to allow launching
global search from non-activity contexts.

Fixes http://b/issue?id=2460991

Change-Id: I833d5b851f0127fb69165fbfc7d1ee190b320401
parent bef118c2
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -822,13 +822,15 @@ public class Dialog implements DialogInterface, Window.Callback,
        final SearchManager searchManager = (SearchManager) mContext
                .getSystemService(Context.SEARCH_SERVICE);

        // associate search with owner activity if possible (otherwise it will default to
        // global search).
        // associate search with owner activity
        final ComponentName appName = getAssociatedActivity();
        final boolean globalSearch = (appName == null);
        searchManager.startSearch(null, false, appName, null, globalSearch);
        if (appName != null) {
            searchManager.startSearch(null, false, appName, null, false);
            dismiss();
            return true;
        } else {
            return false;
        }
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -1639,6 +1639,7 @@ public class SearchManager
            return;
        }
        Intent intent = new Intent(INTENT_ACTION_GLOBAL_SEARCH);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setComponent(globalSearchActivity);
        // TODO: Always pass name of calling package as an extra?
        if (appSearchData != null) {