summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey <joey@lineageos.org>2018-06-12 11:08:16 +0200
committerJoey <joey@lineageos.org>2018-06-12 11:08:16 +0200
commitaa8b6a1fca0c4ce41a8ca21e8f11fea5a5e79891 (patch)
tree60dd701663e276503eb03163218f26824ce62125
parent16e9b5ff76c72c4df858c18d3aecaad244944c42 (diff)
downloadandroid_packages_apps_Trebuchet-aa8b6a1fca0c4ce41a8ca21e8f11fea5a5e79891.tar.gz
android_packages_apps_Trebuchet-aa8b6a1fca0c4ce41a8ca21e8f11fea5a5e79891.tar.bz2
android_packages_apps_Trebuchet-aa8b6a1fca0c4ce41a8ca21e8f11fea5a5e79891.zip
Trebuchet: don't log apps for predictive suggestions when disabled
Change-Id: I5d9b8174431cfbfa8c0227c31a9ec288433d6d4c Signed-off-by: Joey <joey@lineageos.org>
-rw-r--r--src/com/android/launcher3/SettingsActivity.java1
-rw-r--r--src/com/android/launcher3/Utilities.java5
-rw-r--r--src/com/android/launcher3/allapps/PredictiveAppsProvider.java6
3 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/launcher3/SettingsActivity.java b/src/com/android/launcher3/SettingsActivity.java
index 647ad7dd3..e538df99b 100644
--- a/src/com/android/launcher3/SettingsActivity.java
+++ b/src/com/android/launcher3/SettingsActivity.java
@@ -62,6 +62,7 @@ public class SettingsActivity extends Activity {
private static final String KEY_SHOW_DRAWER_LABELS = "pref_drawer_show_labels";
static final String KEY_FEED_INTEGRATION = "pref_feed_integration";
+ static final String KEY_PREDICTIVE_APPS = "pref_predictive_apps";
public static final String KEY_WORKSPACE_EDIT = "pref_workspace_edit";
public static final String KEY_FORCE_ADAPTIVE_ICONS = "pref_icon_force_adaptive";
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index b6c623ad6..d6aaae445 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -747,4 +747,9 @@ public final class Utilities {
SharedPreferences prefs = getPrefs(context.getApplicationContext());
return prefs.getBoolean(SettingsActivity.KEY_FORCE_ADAPTIVE_ICONS, false);
}
+
+ public static boolean arePredictiveAppsEnabled(Context context) {
+ SharedPreferences prefs = getPrefs(context.getApplicationContext());
+ return prefs.getBoolean(SettingsActivity.KEY_PREDICTIVE_APPS, false);
+ }
}
diff --git a/src/com/android/launcher3/allapps/PredictiveAppsProvider.java b/src/com/android/launcher3/allapps/PredictiveAppsProvider.java
index 42ad51ade..1535cc0b2 100644
--- a/src/com/android/launcher3/allapps/PredictiveAppsProvider.java
+++ b/src/com/android/launcher3/allapps/PredictiveAppsProvider.java
@@ -7,6 +7,7 @@ import android.os.UserHandle;
import android.util.Log;
import com.android.launcher3.AppInfo;
+import com.android.launcher3.Utilities;
import com.android.launcher3.discovery.suggestions.SuggestionCandidate;
import com.android.launcher3.discovery.suggestions.SuggestionsDatabaseHelper;
import com.android.launcher3.util.ComponentKey;
@@ -34,6 +35,11 @@ public class PredictiveAppsProvider {
return;
}
+ if (!Utilities.arePredictiveAppsEnabled(mContext)) {
+ // Don't log when predictive apps are disabled
+ return;
+ }
+
SuggestionCandidate candidate = mHelper.getCandidate(component.getPackageName(),
component.getClassName());
mHelper.increaseCounter(mContext, candidate);