summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Zacharia <george.zcharia@gmail.com>2021-02-28 07:26:25 +0530
committerGeorge Zacharia <george.zcharia@gmail.com>2023-01-10 22:03:00 +0530
commitc1a97c38f98c500a23527f4a355e6c7be5f6d254 (patch)
treec9f3e0790bd54d7afc53eaef3fbfc312fb5999b2
parent460e94bc49773d6e1a442fe0885e64bf3de98992 (diff)
PredictionService: Kill off the spam
Change-Id: I89bdfa48057adf0bbbef64c1701f35f2e9fd7889
-rw-r--r--src/com/android/apppredictionservice/PredictionService.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/com/android/apppredictionservice/PredictionService.java b/src/com/android/apppredictionservice/PredictionService.java
index b25edeb..b0ef5fa 100644
--- a/src/com/android/apppredictionservice/PredictionService.java
+++ b/src/com/android/apppredictionservice/PredictionService.java
@@ -53,6 +53,7 @@ import java.util.function.Consumer;
public class PredictionService extends AppPredictionService {
private static final String TAG = PredictionService.class.getSimpleName();
+ private static final boolean DEBUG = false;
private final Set<AppPredictionSessionId> activeLauncherSessions = new HashSet<>();
@@ -96,7 +97,7 @@ public class PredictionService extends AppPredictionService {
getDefaultSystemHandlerActivityPackageName(browserIntent),
};
- Log.d(TAG, "AppPredictionService onCreate");
+ if (DEBUG) Log.d(TAG, "AppPredictionService onCreate");
this.sharedPreferences = getSharedPreferences(MY_PREF, Context.MODE_PRIVATE);
this.editor = sharedPreferences.edit();
@@ -145,7 +146,7 @@ public class PredictionService extends AppPredictionService {
@Override
public void onCreatePredictionSession(
AppPredictionContext context, AppPredictionSessionId sessionId) {
- Log.d(TAG, "onCreatePredictionSession");
+ if (DEBUG) Log.d(TAG, "onCreatePredictionSession");
if (context.getUiSurface().equals("home") || context.getUiSurface().equals("overview")) {
activeLauncherSessions.add(sessionId);
@@ -161,7 +162,7 @@ public class PredictionService extends AppPredictionService {
}
boolean found = false;
- Log.d(TAG, "onAppTargetEvent");
+ if (DEBUG) Log.d(TAG, "onAppTargetEvent");
AppTarget target = event.getTarget();
if (target == null || isEmpty(target.getPackageName()) || isEmpty(target.getClassName())) {
@@ -190,7 +191,7 @@ public class PredictionService extends AppPredictionService {
predictionList.remove(predictionList.size() - 1);
predictionList.add(0, event.getTarget());
- Log.d(TAG, "onAppTargetEvent:: update predictions");
+ if (DEBUG) Log.d(TAG, "onAppTargetEvent:: update predictions");
postPredictionUpdateToAllClients();
}
}
@@ -198,7 +199,7 @@ public class PredictionService extends AppPredictionService {
@Override
public void onLaunchLocationShown(
AppPredictionSessionId sessionId, String launchLocation, List<AppTargetId> targetIds) {
- Log.d(TAG, "onLaunchLocationShown");
+ if (DEBUG) Log.d(TAG, "onLaunchLocationShown");
}
@Override
@@ -208,7 +209,7 @@ public class PredictionService extends AppPredictionService {
CancellationSignal cancellationSignal,
Consumer<List<AppTarget>> callback) {
- Log.d(TAG, "onSortAppTargets");
+ if (DEBUG) Log.d(TAG, "onSortAppTargets");
if (!activeLauncherSessions.contains(sessionId)) {
callback.accept(emptyList());
} else {
@@ -219,30 +220,30 @@ public class PredictionService extends AppPredictionService {
@Override
public void onRequestPredictionUpdate(AppPredictionSessionId sessionId) {
- Log.d(TAG, "onRequestPredictionUpdate");
+ if (DEBUG) Log.d(TAG, "onRequestPredictionUpdate");
if (!activeLauncherSessions.contains(sessionId)) {
updatePredictions(sessionId, emptyList());
} else {
postPredictionUpdate(sessionId);
- Log.d(TAG, "update predictions");
+ if (DEBUG) Log.d(TAG, "update predictions");
}
}
@Override
public void onDestroyPredictionSession(AppPredictionSessionId sessionId) {
- Log.d(TAG, "onDestroyPredictionSession");
+ if (DEBUG) Log.d(TAG, "onDestroyPredictionSession");
activeLauncherSessions.remove(sessionId);
}
@Override
public void onStartPredictionUpdates() {
- Log.d(TAG, "onStartPredictionUpdates");
+ if (DEBUG) Log.d(TAG, "onStartPredictionUpdates");
}
@Override
public void onStopPredictionUpdates() {
- Log.d(TAG, "onStopPredictionUpdates");
+ if (DEBUG) Log.d(TAG, "onStopPredictionUpdates");
}
public void setAppSuggestionsEnabled(boolean enabled) {