From 7ca46ba2ee185cf9a199172b94bf37163d06f2d7 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Wed, 14 Aug 2019 09:40:04 -0700 Subject: [PATCH] Fixed PredictionAppTracker as service might not be available on device. Fixes: 139416391 Bug: 135218095 Test: echo 'in TreeHugger we trust' Change-Id: Iea89b3d379792327657e01869c9494975e7b0306 (cherry picked from commit 214a45ee02674712542dabdb7d8c70ace21f4501) --- .../android/launcher3/appprediction/PredictionAppTracker.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java index 8f1282dedc..24fc61bef9 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java @@ -95,6 +95,10 @@ public class PredictionAppTracker extends AppLaunchTracker { private AppPredictor createPredictor(Client client, int count) { AppPredictionManager apm = mContext.getSystemService(AppPredictionManager.class); + if (apm == null) { + return null; + } + AppPredictor predictor = apm.createAppPredictionSession( new AppPredictionContext.Builder(mContext) .setUiSurface(client.id)