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

Commit 1aca18d8 authored by George Hodulik's avatar George Hodulik
Browse files

Allow extras to be added in PredictionAppTracker subclasses.

Bug: 132584688
Change-Id: I727009dab24a82968673d4df6d3a5daa11c34281
parent 901c1765
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -27,11 +27,13 @@ import android.app.prediction.AppTargetId;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.os.Build;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
import android.os.UserHandle;
import android.os.UserHandle;
import android.util.Log;
import android.util.Log;


import androidx.annotation.Nullable;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.model.AppLaunchTracker;
@@ -97,6 +99,7 @@ public class PredictionAppTracker extends AppLaunchTracker {
                new AppPredictionContext.Builder(mContext)
                new AppPredictionContext.Builder(mContext)
                        .setUiSurface(client.id)
                        .setUiSurface(client.id)
                        .setPredictedTargetCount(count)
                        .setPredictedTargetCount(count)
                        .setExtras(getAppPredictionContextExtras(client))
                        .build());
                        .build());
        predictor.registerPredictionUpdates(mContext.getMainExecutor(),
        predictor.registerPredictionUpdates(mContext.getMainExecutor(),
                PredictionUiStateManager.INSTANCE.get(mContext).appPredictorCallback(client));
                PredictionUiStateManager.INSTANCE.get(mContext).appPredictorCallback(client));
@@ -104,6 +107,15 @@ public class PredictionAppTracker extends AppLaunchTracker {
        return predictor;
        return predictor;
    }
    }


    /**
     * Override to add custom extras.
     */
    @WorkerThread
    @Nullable
    public Bundle getAppPredictionContextExtras(Client client){
        return null;
    }

    @WorkerThread
    @WorkerThread
    private boolean handleMessage(Message msg) {
    private boolean handleMessage(Message msg) {
        switch (msg.what) {
        switch (msg.what) {