From 6fad078a31398bbf55b7618375a532dc99d9ebd3 Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 24 May 2021 16:42:07 -0700 Subject: [PATCH] Adding more diags for WellbeingModel Test: presubmit Bug: 189139513 Change-Id: Ic52ef42d2cd0a3f19f55aee048911526dd8c732f --- .../android/launcher3/model/WellbeingModel.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/model/WellbeingModel.java b/quickstep/src/com/android/launcher3/model/WellbeingModel.java index 995c4b04d4..154b78b1b9 100644 --- a/quickstep/src/com/android/launcher3/model/WellbeingModel.java +++ b/quickstep/src/com/android/launcher3/model/WellbeingModel.java @@ -319,12 +319,17 @@ public final class WellbeingModel extends BgObjectWithLooper { @WorkerThread private void updateActionsWithRetry(int retryCount, @Nullable String packageName) { + if (DEBUG || mIsInTest) { + Log.i(TAG, + "updateActionsWithRetry(); retryCount: " + retryCount + ", package: " + + packageName); + } String[] packageNames = TextUtils.isEmpty(packageName) - ? mContext.getSystemService(LauncherApps.class) + ? mContext.getSystemService(LauncherApps.class) .getActivityList(null, Process.myUserHandle()).stream() .map(li -> li.getApplicationInfo().packageName).distinct() .toArray(String[]::new) - : new String[] { packageName }; + : new String[]{packageName}; mWorkerHandler.removeCallbacksAndMessages(packageName); if (updateActions(packageNames)) { @@ -335,12 +340,16 @@ public final class WellbeingModel extends BgObjectWithLooper { return; } mWorkerHandler.postDelayed( - () -> updateActionsWithRetry(retryCount + 1, packageName), + () -> { + if (DEBUG || mIsInTest) Log.i(TAG, "Retrying; attempt " + (retryCount + 1)); + updateActionsWithRetry(retryCount + 1, packageName); + }, packageName, RETRY_TIMES_MS[retryCount]); } @WorkerThread private void updateAllPackages() { + if (DEBUG || mIsInTest) Log.i(TAG, "updateAllPackages"); updateActionsWithRetry(0, null); }