Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
Don't count app launches for hidden apps in suggestions algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
amirzaidi committed Mar 25, 2018
1 parent 562f1d1 commit 3e20c9d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.view.View;
import android.view.ViewParent;

import com.android.launcher3.AppFilter;
import com.android.launcher3.AppInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AllAppsContainerView;
Expand All @@ -32,6 +33,7 @@ public class CustomAppPredictor extends UserEventDispatcher implements SharedPre
private static final String PREDICTION_PREFIX = "pref_prediction_count_";
private static final Set<String> EMPTY_SET = new HashSet<>();
private final Context mContext;
private final AppFilter mAppFilter;
private final SharedPreferences mPrefs;
private final PackageManager mPackageManager;

Expand Down Expand Up @@ -70,6 +72,7 @@ public class CustomAppPredictor extends UserEventDispatcher implements SharedPre

public CustomAppPredictor(Context context) {
mContext = context;
mAppFilter = AppFilter.newInstance(mContext);
mPrefs = Utilities.getPrefs(context);
mPrefs.registerOnSharedPreferenceChangeListener(this);
mPackageManager = context.getPackageManager();
Expand Down Expand Up @@ -120,7 +123,7 @@ public void logAppLaunch(View v, Intent intent, UserHandle user) {
super.logAppLaunch(v, intent, user);
if (isPredictorEnabled() && recursiveIsDrawer(v)) {
ComponentName componentInfo = intent.getComponent();
if (componentInfo != null) {
if (componentInfo != null && mAppFilter.shouldShowApp(componentInfo, user)) {
clearNonExistentPackages();

Set<String> predictionSet = getStringSetCopy();
Expand Down

0 comments on commit 3e20c9d

Please sign in to comment.