feat: Add option to clear home screen in settings (#6125)

Signed-off-by: abhixv <abhi.sharma1@hotmail.com>
This commit is contained in:
Abhishek Sharma authored and Pun Butrach committed 2026-01-10 20:51:01 +07:00
1 parent 9898749619
commit 5f3a03f4fb
1577 files changed
+112559 -80244

No files matched your search

@@ -15,12 +15,13 @@
*/
package com.android.launcher3.allapps;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_RV_PREINFLATION;
import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR;
import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK;
import android.content.Context;
import android.os.UserHandle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -41,7 +42,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
@@ -54,7 +54,6 @@ import java.util.function.Predicate;
*/
public class AllAppsStore<T extends Context & ActivityContext> {
private static final String TAG = "AllAppsStore";
// Defer updates flag used to defer all apps updates to the next draw.
public static final int DEFER_UPDATES_NEXT_DRAW = 1 << 0;
// Defer updates flag used to defer all apps updates by a test's request.
@@ -111,14 +110,13 @@ public class AllAppsStore<T extends Context & ActivityContext> {
public void setApps(@Nullable AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map,
boolean shouldPreinflate) {
mApps = apps == null ? EMPTY_ARRAY : apps;
Log.d(TAG, "setApps: apps.length=" + mApps.length);
mModelFlags = flags;
notifyUpdate();
mPackageUserKeytoUidMap = map;
// Preinflate all apps RV when apps has changed, which can happen after
// unlocking screen,
// rotating screen, or downloading/upgrading apps.
if (shouldPreinflate) {
if (shouldPreinflate && ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
mAllAppsRecyclerViewPool.preInflateAllAppsViewHolders(mContext);
}
}
@@ -173,12 +171,10 @@ public class AllAppsStore<T extends Context & ActivityContext> {
public void enableDeferUpdates(int flag) {
mDeferUpdatesFlags |= flag;
Log.d(TAG, "enableDeferUpdates: " + flag + " mDeferUpdatesFlags=" + mDeferUpdatesFlags);
}
public void disableDeferUpdates(int flag) {
mDeferUpdatesFlags &= ~flag;
Log.d(TAG, "disableDeferUpdates: " + flag + " mDeferUpdatesFlags=" + mDeferUpdatesFlags);
if (mDeferUpdatesFlags == 0 && mUpdatePending) {
notifyUpdate();
mUpdatePending = false;
@@ -187,9 +183,6 @@ public class AllAppsStore<T extends Context & ActivityContext> {
public void disableDeferUpdatesSilently(int flag) {
mDeferUpdatesFlags &= ~flag;
Log.d(TAG, "disableDeferUpdatesSilently: " + flag
+ " mDeferUpdatesFlags=" + mDeferUpdatesFlags);
}
public int getDeferUpdatesFlags() {
@@ -198,11 +191,9 @@ public class AllAppsStore<T extends Context & ActivityContext> {
private void notifyUpdate() {
if (mDeferUpdatesFlags != 0) {
Log.d(TAG, "notifyUpdate: deferring update");
mUpdatePending = true;
return;
}
Log.d(TAG, "notifyUpdate: notifying listeners");
for (OnUpdateListener listener : mUpdateListeners) {
listener.onAppsUpdated();
}
@@ -251,7 +242,11 @@ public class AllAppsStore<T extends Context & ActivityContext> {
public void updateProgressBar(AppInfo app) {
updateAllIcons((child) -> {
if (child.getTag() == app) {
child.applyFromApplicationInfo(app);
if ((app.runtimeStatusFlags & FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) == 0) {
child.applyFromApplicationInfo(app);
} else {
child.applyProgressLevel();
}
}
});
}
@@ -280,15 +275,8 @@ public class AllAppsStore<T extends Context & ActivityContext> {
public void dump(String prefix, PrintWriter writer) {
writer.println(prefix + "\tAllAppsStore Apps[] size: " + mApps.length);
for (int i = 0; i < mApps.length; i++) {
writer.println(String.format(Locale.getDefault(),
"%s\tPackage index, name, class, description, bitmap flag: %d/%s:%s, %s, %s+%s",
prefix,
i,
mApps[i].componentName.getPackageName(),
mApps[i].componentName.getClassName(),
mApps[i].contentDescription,
Integer.toBinaryString(mApps[i].bitmap.flags),
Integer.toBinaryString(mApps[i].bitmap.creationFlags)));
writer.println(String.format("%s\tPackage index and name: %d/%s", prefix, i,
mApps[i].componentName.getPackageName()));
}
}
}