diff options
-rw-r--r-- | src/com/android/launcher3/SettingsActivity.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/PredictiveAppsProvider.java | 6 |
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); |