mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Merge "Adding more diags for WellbeingModel" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
db6b24a001
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user