mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Send additional Extras in first screen broadcasts, to help with app archiving.
- refactor FirstScreenBroadcast.java into FirstScreenBroadcastHelper.kt - send Extras to include installed/archived items on first screen - send Extras to include installed/archived widgets on all screens. - truncate items to limit Broadcast size Bug: 322314760 Test: unit testing and E2E test of B&R Flag: launcher_broadcast_installed_apps Change-Id: I214149ac0c63f177d3d1ca0b6d0cb11be37f4ae0
This commit is contained in:
committed by
Andrew Cole
parent
62b5e43d85
commit
7cc4302f10
@@ -47,6 +47,7 @@ import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.LongSparseArray;
|
||||
@@ -195,17 +196,32 @@ public class LoaderTask implements Runnable {
|
||||
}
|
||||
|
||||
private void sendFirstScreenActiveInstallsBroadcast() {
|
||||
ArrayList<ItemInfo> firstScreenItems = new ArrayList<>();
|
||||
ArrayList<ItemInfo> allItems = mBgDataModel.getAllWorkspaceItems();
|
||||
|
||||
// Screen set is never empty
|
||||
IntArray allScreens = mBgDataModel.collectWorkspaceScreens();
|
||||
final int firstScreen = allScreens.get(0);
|
||||
IntSet firstScreens = IntSet.wrap(firstScreen);
|
||||
|
||||
ArrayList<ItemInfo> allItems = mBgDataModel.getAllWorkspaceItems();
|
||||
ArrayList<ItemInfo> firstScreenItems = new ArrayList<>();
|
||||
filterCurrentWorkspaceItems(firstScreens, allItems, firstScreenItems,
|
||||
new ArrayList<>() /* otherScreenItems are ignored */);
|
||||
mFirstScreenBroadcast.sendBroadcasts(mApp.getContext(), firstScreenItems);
|
||||
final int launcherBroadcastInstalledApps = Settings.Secure.getInt(
|
||||
mApp.getContext().getContentResolver(),
|
||||
"launcher_broadcast_installed_apps",
|
||||
/* def= */ 0);
|
||||
if (launcherBroadcastInstalledApps == 1) {
|
||||
List<FirstScreenBroadcastModel> broadcastModels =
|
||||
FirstScreenBroadcastHelper.createModelsForFirstScreenBroadcast(
|
||||
mPmHelper,
|
||||
firstScreenItems,
|
||||
mInstallingPkgsCached,
|
||||
mBgDataModel.appWidgets
|
||||
);
|
||||
logASplit("Sending first screen broadcast with additional archiving Extras");
|
||||
FirstScreenBroadcastHelper.sendBroadcastsForModels(mApp.getContext(), broadcastModels);
|
||||
} else {
|
||||
mFirstScreenBroadcast.sendBroadcasts(mApp.getContext(), firstScreenItems);
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
@@ -249,7 +265,7 @@ public class LoaderTask implements Runnable {
|
||||
mModelDelegate.workspaceLoadComplete();
|
||||
// Notify the installer packages of packages with active installs on the first screen.
|
||||
sendFirstScreenActiveInstallsBroadcast();
|
||||
logASplit("sendFirstScreenActiveInstallsBroadcast");
|
||||
logASplit("sendFirstScreenBroadcast");
|
||||
|
||||
// Take a break
|
||||
waitForIdle();
|
||||
|
||||
Reference in New Issue
Block a user