Merge "Allow extras to be added in PredictionAppTracker subclasses." into ub-launcher3-qt-dev

This commit is contained in:
George Hodulik
2019-05-15 21:07:20 +00:00
committed by Android (Google) Code Review
@@ -27,11 +27,13 @@ import android.app.prediction.AppTargetId;
import android.content.ComponentName;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.UserHandle;
import android.util.Log;
import androidx.annotation.Nullable;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
import com.android.launcher3.model.AppLaunchTracker;
@@ -97,6 +99,7 @@ public class PredictionAppTracker extends AppLaunchTracker {
new AppPredictionContext.Builder(mContext)
.setUiSurface(client.id)
.setPredictedTargetCount(count)
.setExtras(getAppPredictionContextExtras(client))
.build());
predictor.registerPredictionUpdates(mContext.getMainExecutor(),
PredictionUiStateManager.INSTANCE.get(mContext).appPredictorCallback(client));
@@ -104,6 +107,15 @@ public class PredictionAppTracker extends AppLaunchTracker {
return predictor;
}
/**
* Override to add custom extras.
*/
@WorkerThread
@Nullable
public Bundle getAppPredictionContextExtras(Client client){
return null;
}
@WorkerThread
private boolean handleMessage(Message msg) {
switch (msg.what) {