Skip to content

Refactor activity caching logic to extend CustomActivityCachingLogic …#540

Merged
saulhdev merged 1 commit intomainfrom
A16
Feb 22, 2026
Merged

Refactor activity caching logic to extend CustomActivityCachingLogic …#540
saulhdev merged 1 commit intomainfrom
A16

Conversation

@saulhdev
Copy link
Member

…and update version code

Copilot AI review requested due to automatic review settings February 22, 2026 00:49
@saulhdev saulhdev merged commit 303d149 into main Feb 22, 2026
3 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make activity icon/label caching logic extendable (to support Neo’s custom app names), wire the custom caching logic into icon loading/updating, adjust first-screen installer broadcast behavior, and bump the app versionCode.

Changes:

  • Introduces CustomActivityCachingLogic to override activity labels based on NeoPrefs.customAppName.
  • Refactors LauncherActivityCachingLogic from a Kotlin object to an open class to allow inheritance.
  • Routes icon cache updates to use CustomActivityCachingLogic and increments versionCode.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/com/android/launcher3/model/LoaderTask.java Updates first-screen broadcast gating and switches icon update caching logic to the custom implementation.
src/com/android/launcher3/icons/IconCache.java Switches multiple icon-cache entry points to use the custom caching logic.
libs_systemui/iconloaderlib/src/com/android/launcher3/icons/cache/LauncherActivityCachingLogic.kt Changes caching logic from singleton object to extendable class (behavioral/ABI change).
build.gradle.kts Bumps versionCode from 1006 to 1007.
Omega/src/com/neoapps/neolauncher/util/CustomActivityCachingLogic.kt Adds Neo-specific caching logic to return custom app labels from preferences.
Comments suppressed due to low confidence (2)

Omega/src/com/neoapps/neolauncher/util/CustomActivityCachingLogic.kt:25

  • Unused import SafeCloseable can be removed to keep the file clean and avoid lint/compiler warnings.
import com.android.launcher3.dagger.LauncherAppSingleton
import com.android.launcher3.icons.cache.LauncherActivityCachingLogic
import com.android.launcher3.util.ComponentKey
import com.android.launcher3.util.SafeCloseable
import com.neoapps.neolauncher.preferences.NeoPrefs

src/com/android/launcher3/icons/IconCache.java:244

  • CustomActivityCachingLogic is instantiated in multiple hot paths (e.g., per icon cache update). Consider reusing a single instance (or injecting a singleton) to avoid repeated allocations and to align with the @LauncherAppSingleton intent.
    public synchronized void updateTitleAndIcon(AppInfo application) {
        CacheEntry entry = cacheLocked(application.componentName,
                application.user, () -> null, new CustomActivityCachingLogic(),
                application.getMatchingLookupFlag());

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 337 to 339
updateHandler.updateIcons(allActivityList,
LauncherActivityCachingLogic.INSTANCE,
new CustomActivityCachingLogic(),
mModel::onPackageIconsUpdated);
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After switching to CustomActivityCachingLogic, this file no longer references LauncherActivityCachingLogic, so the existing import com.android.launcher3.icons.cache.LauncherActivityCachingLogic; becomes unused and will fail Java compilation. Please remove the unused import (or reintroduce a reference if still needed).

Copilot uses AI. Check for mistakes.
Comment on lines 171 to 173
for (LauncherActivityInfo app : apps) {
addIconToDBAndMemCache(app, LauncherActivityCachingLogic.INSTANCE, userSerial);
addIconToDBAndMemCache(app, new CustomActivityCachingLogic(), userSerial);
}
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All usages of LauncherActivityCachingLogic were replaced, so import com.android.launcher3.icons.cache.LauncherActivityCachingLogic; is now unused in this Java file and will fail compilation. Remove the unused import (or keep using the base logic where appropriate).

Copilot uses AI. Check for mistakes.
Comment on lines +258 to 272
if (shouldAttachArchivingExtras) {
List<FirstScreenBroadcastModel> broadcastModels =
mFirstScreenBroadcastHelper.createModelsForFirstScreenBroadcast(
firstScreenItems,
mInstallingPkgsCached,
mBgDataModel.itemsIdMap.stream().filter(WIDGET_FILTER).collect(Collectors.toList()),
shouldAttachArchivingExtras
);
logASplit("Sending first screen broadcast with shouldAttachArchivingExtras="
+ shouldAttachArchivingExtras);
broadcastModels.forEach(bm -> bm.sentBroadcast(mContext));
} else {
logASplit("Sending first screen broadcast");
//mFirstScreenBroadcastHelper.sendBroadcasts(mContext, firstScreenItems);
}
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else-branch no longer sends any first-screen broadcast (the call is commented out), so pending installs won’t be reported unless shouldAttachArchivingExtras is true. Previously the broadcast was still sent with shouldAttachArchivingExtras=false to report pending items only. Consider always creating/sending the FirstScreenBroadcastModels and using shouldAttachArchivingExtras only to control which extras are attached, and remove the dead commented-out call.

Suggested change
if (shouldAttachArchivingExtras) {
List<FirstScreenBroadcastModel> broadcastModels =
mFirstScreenBroadcastHelper.createModelsForFirstScreenBroadcast(
firstScreenItems,
mInstallingPkgsCached,
mBgDataModel.itemsIdMap.stream().filter(WIDGET_FILTER).collect(Collectors.toList()),
shouldAttachArchivingExtras
);
logASplit("Sending first screen broadcast with shouldAttachArchivingExtras="
+ shouldAttachArchivingExtras);
broadcastModels.forEach(bm -> bm.sentBroadcast(mContext));
} else {
logASplit("Sending first screen broadcast");
//mFirstScreenBroadcastHelper.sendBroadcasts(mContext, firstScreenItems);
}
List<FirstScreenBroadcastModel> broadcastModels =
mFirstScreenBroadcastHelper.createModelsForFirstScreenBroadcast(
firstScreenItems,
mInstallingPkgsCached,
mBgDataModel.itemsIdMap.stream()
.filter(WIDGET_FILTER)
.collect(Collectors.toList()),
shouldAttachArchivingExtras
);
if (shouldAttachArchivingExtras) {
logASplit("Sending first screen broadcast with shouldAttachArchivingExtras=true");
} else {
logASplit("Sending first screen broadcast with shouldAttachArchivingExtras=false");
}
broadcastModels.forEach(bm -> bm.sentBroadcast(mContext));

Copilot uses AI. Check for mistakes.
Comment on lines 337 to 339
updateHandler.updateIcons(allActivityList,
LauncherActivityCachingLogic.INSTANCE,
new CustomActivityCachingLogic(),
mModel::onPackageIconsUpdated);
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CustomActivityCachingLogic lives under the omega flavor source set (Omega/src), but LoaderTask.java is in the main source set. This import/usage will break compilation for the aosp variant. Either move the caching-logic implementation into main, or keep main using the base LauncherActivityCachingLogic and override the behavior from the omega source set (e.g., via a flavor-specific subclass/factory/DI binding).

Copilot uses AI. Check for mistakes.
Comment on lines 169 to 173
removeIconsForPkg(packageName, user);
long userSerial = mUserManager.getSerialNumberForUser(user);
for (LauncherActivityInfo app : apps) {
addIconToDBAndMemCache(app, LauncherActivityCachingLogic.INSTANCE, userSerial);
addIconToDBAndMemCache(app, new CustomActivityCachingLogic(), userSerial);
}
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IconCache is in the main source set, but it now depends on com.neoapps.neolauncher.util.CustomActivityCachingLogic which is only present in the omega flavor (Omega/src). This will fail to compile for the aosp variant. Please keep main flavor-agnostic (use the base caching logic there) and apply the Neo-specific logic via omega-only sources or an injected/factory-provided CachingLogic implementation.

Copilot uses AI. Check for mistakes.
Comment on lines +30 to 31
open class LauncherActivityCachingLogic : CachingLogic<LauncherActivityInfo> {

Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refactor changes LauncherActivityCachingLogic from a Kotlin object to a class, which removes the singleton value that existing call sites rely on (e.g., Java .INSTANCE and Kotlin usages that pass LauncherActivityCachingLogic as a CachingLogic). To avoid widespread breakage, consider keeping a singleton object LauncherActivityCachingLogic for the default behavior and introducing a separate open base class for extension (or update all call sites/tests to instantiate/pass a shared instance explicitly).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants