Merge "Remove requestEmptyQueryResultUpdate"
This commit is contained in:
committed by
Android (Google) Code Review
commit
10e2930c58
@@ -2276,7 +2276,6 @@ package android.app.search {
|
||||
method public void notifyEvent(@NonNull android.app.search.Query, @NonNull android.app.search.SearchTargetEvent);
|
||||
method @Nullable public void query(@NonNull android.app.search.Query, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.List<android.app.search.SearchTarget>>);
|
||||
method public void registerEmptyQueryResultUpdateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.app.search.SearchSession.Callback);
|
||||
method public void requestEmptyQueryResultUpdate();
|
||||
method public void unregisterEmptyQueryResultUpdateCallback(@NonNull android.app.search.SearchSession.Callback);
|
||||
}
|
||||
|
||||
@@ -12684,7 +12683,6 @@ package android.service.search {
|
||||
method @MainThread public abstract void onDestroy(@NonNull android.app.search.SearchSessionId);
|
||||
method @MainThread public abstract void onNotifyEvent(@NonNull android.app.search.SearchSessionId, @NonNull android.app.search.Query, @NonNull android.app.search.SearchTargetEvent);
|
||||
method @MainThread public abstract void onQuery(@NonNull android.app.search.SearchSessionId, @NonNull android.app.search.Query, @NonNull java.util.function.Consumer<java.util.List<android.app.search.SearchTarget>>);
|
||||
method @MainThread public void onRequestEmptyQueryResultUpdate(@NonNull android.app.search.SearchSessionId);
|
||||
method public void onSearchSessionCreated(@NonNull android.app.search.SearchContext, @NonNull android.app.search.SearchSessionId);
|
||||
method @MainThread public void onStartUpdateEmptyQueryResult();
|
||||
method @MainThread public void onStopUpdateEmptyQueryResult();
|
||||
|
||||
@@ -38,8 +38,6 @@ interface ISearchUiManager {
|
||||
|
||||
void registerEmptyQueryResultUpdateCallback(in SearchSessionId sessionId, in ISearchCallback callback);
|
||||
|
||||
void requestEmptyQueryResultUpdate(in SearchSessionId sessionId);
|
||||
|
||||
void unregisterEmptyQueryResultUpdateCallback(in SearchSessionId sessionId, in ISearchCallback callback);
|
||||
|
||||
void destroySearchSession(in SearchSessionId sessionId);
|
||||
|
||||
@@ -224,32 +224,6 @@ public final class SearchSession implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests the search ui service to dispatch a new set of search targets to the pre-registered
|
||||
* callback for zero state. Zero state means when user entered search ui but not issued any
|
||||
* query yet. This method can be used for client to sync up with server data if they think data
|
||||
* might be out of sync, for example, after restart.
|
||||
* Pre-register a callback with
|
||||
* {@link SearchSession#registerEmptyQueryResultUpdateCallback(Executor, Callback)}
|
||||
* is required before calling this method. Otherwise this is no-op.
|
||||
*
|
||||
* @see {@link SearchSession#registerEmptyQueryResultUpdateCallback(Executor, Callback)}
|
||||
* @see {@link SearchSession.Callback#onTargetsAvailable(List)}.
|
||||
*/
|
||||
public void requestEmptyQueryResultUpdate() {
|
||||
if (mIsClosed.get()) {
|
||||
throw new IllegalStateException("This client has already been destroyed.");
|
||||
}
|
||||
|
||||
try {
|
||||
mInterface.requestEmptyQueryResultUpdate(mSessionId);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed to request empty query result update", e);
|
||||
e.rethrowAsRuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Destroys the client and unregisters the callback. Any method on this class after this call
|
||||
* will throw {@link IllegalStateException}.
|
||||
|
||||
@@ -39,8 +39,6 @@ oneway interface ISearchUiService {
|
||||
|
||||
void onRegisterEmptyQueryResultUpdateCallback (in SearchSessionId sessionId, in ISearchCallback callback);
|
||||
|
||||
void onRequestEmptyQueryResultUpdate(in SearchSessionId sessionId);
|
||||
|
||||
void onUnregisterEmptyQueryResultUpdateCallback(in SearchSessionId sessionId, in ISearchCallback callback);
|
||||
|
||||
void onDestroy(in SearchSessionId sessionId);
|
||||
|
||||
@@ -111,12 +111,6 @@ public abstract class SearchUiService extends Service {
|
||||
SearchUiService.this, sessionId, callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestEmptyQueryResultUpdate(SearchSessionId sessionId) {
|
||||
mHandler.sendMessage(obtainMessage(SearchUiService::doRequestEmptyQueryResultUpdate,
|
||||
SearchUiService.this, sessionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnregisterEmptyQueryResultUpdateCallback(SearchSessionId sessionId,
|
||||
ISearchCallback callback) {
|
||||
@@ -220,24 +214,6 @@ public abstract class SearchUiService extends Service {
|
||||
@MainThread
|
||||
public void onStartUpdateEmptyQueryResult() {}
|
||||
|
||||
private void doRequestEmptyQueryResultUpdate(@NonNull SearchSessionId sessionId) {
|
||||
// Just an optimization, if there are no callbacks, then don't bother notifying the service
|
||||
final ArrayList<CallbackWrapper> callbacks = mSessionEmptyQueryResultCallbacks.get(
|
||||
sessionId);
|
||||
if (callbacks != null && !callbacks.isEmpty()) {
|
||||
onRequestEmptyQueryResultUpdate(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by a client to request empty query search target result for zero state. This method
|
||||
* is only called if there are one or more empty query result update callbacks registered.
|
||||
*
|
||||
* @see #updateEmptyQueryResult(SearchSessionId, List)
|
||||
*/
|
||||
@MainThread
|
||||
public void onRequestEmptyQueryResultUpdate(@NonNull SearchSessionId sessionId) {}
|
||||
|
||||
private void doUnregisterEmptyQueryResultUpdateCallback(@NonNull SearchSessionId sessionId,
|
||||
@NonNull ISearchCallback callback) {
|
||||
final ArrayList<CallbackWrapper> callbacks = mSessionEmptyQueryResultCallbacks.get(
|
||||
|
||||
@@ -139,12 +139,6 @@ public class SearchUiManagerService extends
|
||||
callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestEmptyQueryResultUpdate(@NonNull SearchSessionId sessionId) {
|
||||
runForUserLocked("requestEmptyQueryResultUpdate", sessionId,
|
||||
(service) -> service.requestEmptyQueryResultUpdateLocked(sessionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroySearchSession(@NonNull SearchSessionId sessionId) {
|
||||
runForUserLocked("destroySearchSession", sessionId,
|
||||
|
||||
@@ -180,16 +180,6 @@ public class SearchUiPerUserService extends
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests a new set of search targets for empty query result used for zero state.
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
public void requestEmptyQueryResultUpdateLocked(@NonNull SearchSessionId sessionId) {
|
||||
final SearchSessionInfo sessionInfo = mSessionInfos.get(sessionId);
|
||||
if (sessionInfo == null) return;
|
||||
resolveService(sessionId, s->s.onRequestEmptyQueryResultUpdate(sessionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the service of the end of an existing search session.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user