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

Commit 62d1d9ef authored by Tim Kilbourn's avatar Tim Kilbourn Committed by Android (Google) Code Review
Browse files

Merge "Save search context when dispatching onSearchRequested."

parents 90941c0f 6a975b3c
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -3353,6 +3353,7 @@ package android.app {
    method public android.content.SharedPreferences getPreferences(int);
    method public android.content.SharedPreferences getPreferences(int);
    method public android.net.Uri getReferrer();
    method public android.net.Uri getReferrer();
    method public int getRequestedOrientation();
    method public int getRequestedOrientation();
    method public final android.view.SearchEvent getSearchEvent();
    method public int getTaskId();
    method public int getTaskId();
    method public final java.lang.CharSequence getTitle();
    method public final java.lang.CharSequence getTitle();
    method public final int getTitleColor();
    method public final int getTitleColor();
@@ -3435,6 +3436,7 @@ package android.app {
    method public deprecated java.lang.Object onRetainNonConfigurationInstance();
    method public deprecated java.lang.Object onRetainNonConfigurationInstance();
    method protected void onSaveInstanceState(android.os.Bundle);
    method protected void onSaveInstanceState(android.os.Bundle);
    method public void onSaveInstanceState(android.os.Bundle, android.os.PersistableBundle);
    method public void onSaveInstanceState(android.os.Bundle, android.os.PersistableBundle);
    method public boolean onSearchRequested(android.view.SearchEvent);
    method public boolean onSearchRequested();
    method public boolean onSearchRequested();
    method protected void onStart();
    method protected void onStart();
    method protected void onStop();
    method protected void onStop();
@@ -4112,6 +4114,7 @@ package android.app {
    method public android.view.View getCurrentFocus();
    method public android.view.View getCurrentFocus();
    method public android.view.LayoutInflater getLayoutInflater();
    method public android.view.LayoutInflater getLayoutInflater();
    method public final android.app.Activity getOwnerActivity();
    method public final android.app.Activity getOwnerActivity();
    method public final android.view.SearchEvent getSearchEvent();
    method public final int getVolumeControlStream();
    method public final int getVolumeControlStream();
    method public android.view.Window getWindow();
    method public android.view.Window getWindow();
    method public void hide();
    method public void hide();
@@ -4145,6 +4148,7 @@ package android.app {
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public void onRestoreInstanceState(android.os.Bundle);
    method public void onRestoreInstanceState(android.os.Bundle);
    method public android.os.Bundle onSaveInstanceState();
    method public android.os.Bundle onSaveInstanceState();
    method public boolean onSearchRequested(android.view.SearchEvent);
    method public boolean onSearchRequested();
    method public boolean onSearchRequested();
    method protected void onStart();
    method protected void onStart();
    method protected void onStop();
    method protected void onStop();
@@ -28214,6 +28218,7 @@ package android.service.dreams {
    method public boolean onMenuOpened(int, android.view.Menu);
    method public boolean onMenuOpened(int, android.view.Menu);
    method public void onPanelClosed(int, android.view.Menu);
    method public void onPanelClosed(int, android.view.Menu);
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onSearchRequested(android.view.SearchEvent);
    method public boolean onSearchRequested();
    method public boolean onSearchRequested();
    method public void onWakeUp();
    method public void onWakeUp();
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
@@ -34556,6 +34561,10 @@ package android.view {
    method public void onScaleEnd(android.view.ScaleGestureDetector);
    method public void onScaleEnd(android.view.ScaleGestureDetector);
  }
  }
  public class SearchEvent {
    method public android.view.InputDevice getInputDevice();
  }
  public class SoundEffectConstants {
  public class SoundEffectConstants {
    method public static int getContantForFocusDirection(int);
    method public static int getContantForFocusDirection(int);
    field public static final int CLICK = 0; // 0x0
    field public static final int CLICK = 0; // 0x0
@@ -36078,6 +36087,7 @@ package android.view {
    method public abstract void onPanelClosed(int, android.view.Menu);
    method public abstract void onPanelClosed(int, android.view.Menu);
    method public abstract boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public abstract boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public abstract boolean onSearchRequested();
    method public abstract boolean onSearchRequested();
    method public abstract boolean onSearchRequested(android.view.SearchEvent);
    method public abstract void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public abstract void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public abstract void onWindowFocusChanged(boolean);
    method public abstract void onWindowFocusChanged(boolean);
    method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
+10 −0
Original line number Original line Diff line number Diff line
@@ -3435,6 +3435,7 @@ package android.app {
    method public android.content.SharedPreferences getPreferences(int);
    method public android.content.SharedPreferences getPreferences(int);
    method public android.net.Uri getReferrer();
    method public android.net.Uri getReferrer();
    method public int getRequestedOrientation();
    method public int getRequestedOrientation();
    method public final android.view.SearchEvent getSearchEvent();
    method public int getTaskId();
    method public int getTaskId();
    method public final java.lang.CharSequence getTitle();
    method public final java.lang.CharSequence getTitle();
    method public final int getTitleColor();
    method public final int getTitleColor();
@@ -3519,6 +3520,7 @@ package android.app {
    method public deprecated java.lang.Object onRetainNonConfigurationInstance();
    method public deprecated java.lang.Object onRetainNonConfigurationInstance();
    method protected void onSaveInstanceState(android.os.Bundle);
    method protected void onSaveInstanceState(android.os.Bundle);
    method public void onSaveInstanceState(android.os.Bundle, android.os.PersistableBundle);
    method public void onSaveInstanceState(android.os.Bundle, android.os.PersistableBundle);
    method public boolean onSearchRequested(android.view.SearchEvent);
    method public boolean onSearchRequested();
    method public boolean onSearchRequested();
    method protected void onStart();
    method protected void onStart();
    method protected void onStop();
    method protected void onStop();
@@ -4203,6 +4205,7 @@ package android.app {
    method public android.view.View getCurrentFocus();
    method public android.view.View getCurrentFocus();
    method public android.view.LayoutInflater getLayoutInflater();
    method public android.view.LayoutInflater getLayoutInflater();
    method public final android.app.Activity getOwnerActivity();
    method public final android.app.Activity getOwnerActivity();
    method public final android.view.SearchEvent getSearchEvent();
    method public final int getVolumeControlStream();
    method public final int getVolumeControlStream();
    method public android.view.Window getWindow();
    method public android.view.Window getWindow();
    method public void hide();
    method public void hide();
@@ -4236,6 +4239,7 @@ package android.app {
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public void onRestoreInstanceState(android.os.Bundle);
    method public void onRestoreInstanceState(android.os.Bundle);
    method public android.os.Bundle onSaveInstanceState();
    method public android.os.Bundle onSaveInstanceState();
    method public boolean onSearchRequested(android.view.SearchEvent);
    method public boolean onSearchRequested();
    method public boolean onSearchRequested();
    method protected void onStart();
    method protected void onStart();
    method protected void onStop();
    method protected void onStop();
@@ -30214,6 +30218,7 @@ package android.service.dreams {
    method public boolean onMenuOpened(int, android.view.Menu);
    method public boolean onMenuOpened(int, android.view.Menu);
    method public void onPanelClosed(int, android.view.Menu);
    method public void onPanelClosed(int, android.view.Menu);
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onSearchRequested(android.view.SearchEvent);
    method public boolean onSearchRequested();
    method public boolean onSearchRequested();
    method public void onWakeUp();
    method public void onWakeUp();
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
@@ -37178,6 +37183,10 @@ package android.view {
    method public void onScaleEnd(android.view.ScaleGestureDetector);
    method public void onScaleEnd(android.view.ScaleGestureDetector);
  }
  }
  public class SearchEvent {
    method public android.view.InputDevice getInputDevice();
  }
  public class SoundEffectConstants {
  public class SoundEffectConstants {
    method public static int getContantForFocusDirection(int);
    method public static int getContantForFocusDirection(int);
    field public static final int CLICK = 0; // 0x0
    field public static final int CLICK = 0; // 0x0
@@ -38701,6 +38710,7 @@ package android.view {
    method public abstract void onPanelClosed(int, android.view.Menu);
    method public abstract void onPanelClosed(int, android.view.Menu);
    method public abstract boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public abstract boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public abstract boolean onSearchRequested();
    method public abstract boolean onSearchRequested();
    method public abstract boolean onSearchRequested(android.view.SearchEvent);
    method public abstract void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public abstract void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public abstract void onWindowFocusChanged(boolean);
    method public abstract void onWindowFocusChanged(boolean);
    method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
+25 −0
Original line number Original line Diff line number Diff line
@@ -89,6 +89,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.PhoneWindow;
import android.view.PhoneWindow;
import android.view.SearchEvent;
import android.view.View;
import android.view.View;
import android.view.View.OnCreateContextMenuListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup;
import android.view.ViewGroup;
@@ -787,6 +788,8 @@ public class Activity extends ContextThemeWrapper
    private TranslucentConversionListener mTranslucentCallback;
    private TranslucentConversionListener mTranslucentCallback;
    private boolean mChangeCanvasToTranslucent;
    private boolean mChangeCanvasToTranslucent;


    private SearchEvent mSearchEvent;

    private boolean mTitleReady = false;
    private boolean mTitleReady = false;
    private int mActionModeTypeStarting = ActionMode.TYPE_PRIMARY;
    private int mActionModeTypeStarting = ActionMode.TYPE_PRIMARY;


@@ -3547,12 +3550,23 @@ public class Activity extends ContextThemeWrapper
     * implementation changes to simply return false and you must supply your own custom
     * implementation changes to simply return false and you must supply your own custom
     * implementation if you want to support search.</p>
     * implementation if you want to support search.</p>
     *
     *
     * @param searchEvent The {@link SearchEvent} that signaled this search.
     * @return Returns {@code true} if search launched, and {@code false} if the activity does
     * @return Returns {@code true} if search launched, and {@code false} if the activity does
     * not respond to search.  The default implementation always returns {@code true}, except
     * not respond to search.  The default implementation always returns {@code true}, except
     * when in {@link Configuration#UI_MODE_TYPE_TELEVISION} mode where it returns false.
     * when in {@link Configuration#UI_MODE_TYPE_TELEVISION} mode where it returns false.
     *
     *
     * @see android.app.SearchManager
     * @see android.app.SearchManager
     */
     */
    public boolean onSearchRequested(@Nullable SearchEvent searchEvent) {
        mSearchEvent = searchEvent;
        boolean result = onSearchRequested();
        mSearchEvent = null;
        return result;
    }

    /**
     * @see #onSearchRequested(SearchEvent)
     */
    public boolean onSearchRequested() {
    public boolean onSearchRequested() {
        if ((getResources().getConfiguration().uiMode&Configuration.UI_MODE_TYPE_MASK)
        if ((getResources().getConfiguration().uiMode&Configuration.UI_MODE_TYPE_MASK)
                != Configuration.UI_MODE_TYPE_TELEVISION) {
                != Configuration.UI_MODE_TYPE_TELEVISION) {
@@ -3563,6 +3577,17 @@ public class Activity extends ContextThemeWrapper
        }
        }
    }
    }


    /**
     * During the onSearchRequested() callbacks, this function will return the
     * {@link SearchEvent} that triggered the callback, if it exists.
     *
     * @return SearchEvent The SearchEvent that triggered the {@link
     *                    #onSearchRequested} callback.
     */
    public final SearchEvent getSearchEvent() {
        return mSearchEvent;
    }

    /**
    /**
     * This hook is called to launch the search UI.
     * This hook is called to launch the search UI.
     *
     *
+22 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.PhoneWindow;
import android.view.PhoneWindow;
import android.view.SearchEvent;
import android.view.View;
import android.view.View;
import android.view.View.OnCreateContextMenuListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup;
import android.view.ViewGroup;
@@ -123,6 +124,8 @@ public class Dialog implements DialogInterface, Window.Callback,


    private Handler mListenersHandler;
    private Handler mListenersHandler;


    private SearchEvent mSearchEvent;

    private ActionMode mActionMode;
    private ActionMode mActionMode;


    private int mActionModeTypeStarting = ActionMode.TYPE_PRIMARY;
    private int mActionModeTypeStarting = ActionMode.TYPE_PRIMARY;
@@ -992,6 +995,14 @@ public class Dialog implements DialogInterface, Window.Callback,
    public void onContextMenuClosed(Menu menu) {
    public void onContextMenuClosed(Menu menu) {
    }
    }


    /**
     * This hook is called when the user signals the desire to start a search.
     */
    public boolean onSearchRequested(SearchEvent searchEvent) {
        mSearchEvent = searchEvent;
        return onSearchRequested();
    }

    /**
    /**
     * This hook is called when the user signals the desire to start a search.
     * This hook is called when the user signals the desire to start a search.
     */
     */
@@ -1010,6 +1021,17 @@ public class Dialog implements DialogInterface, Window.Callback,
        }
        }
    }
    }


    /**
     * During the onSearchRequested() callbacks, this function will return the
     * {@link SearchEvent} that triggered the callback, if it exists.
     *
     * @return SearchEvent The SearchEvent that triggered the {@link
     *                    #onSearchRequested} callback.
     */
    public final SearchEvent getSearchEvent() {
        return mSearchEvent;
    }

    /**
    /**
     * {@inheritDoc}
     * {@inheritDoc}
     */
     */
+7 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.PhoneWindow;
import android.view.PhoneWindow;
import android.view.SearchEvent;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.view.Window;
import android.view.Window;
@@ -330,6 +331,12 @@ public class DreamService extends Service implements Window.Callback {
    public void onPanelClosed(int featureId, Menu menu) {
    public void onPanelClosed(int featureId, Menu menu) {
    }
    }


    /** {@inheritDoc} */
    @Override
    public boolean onSearchRequested(SearchEvent event) {
        return onSearchRequested();
    }

    /** {@inheritDoc} */
    /** {@inheritDoc} */
    @Override
    @Override
    public boolean onSearchRequested() {
    public boolean onSearchRequested() {
Loading