fix: Disable material expressive folder expansion animations
This commit is contained in:
1 parent
0ff9636c38
commit
9b90822395
2258 files changed
+165176
-78078
No files matched your search
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
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;
|
||||
|
||||
@@ -42,6 +41,7 @@ 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,6 +54,7 @@ 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.
|
||||
@@ -83,8 +84,7 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calling {@link #setApps(AppInfo[], int, Map, boolean)} with shouldPreinflate
|
||||
* set to
|
||||
* Calling {@link #setApps(AppInfo[], int, Map, boolean)} with shouldPreinflate set to
|
||||
* {@code true}. This method should be called in launcher (not for taskbar).
|
||||
*/
|
||||
public void setApps(@Nullable AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map) {
|
||||
@@ -92,31 +92,25 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current set of apps and sets mapping for {@link PackageUserKey} to
|
||||
* Uid for
|
||||
* Sets the current set of apps and sets mapping for {@link PackageUserKey} to Uid for
|
||||
* the current set of apps.
|
||||
*
|
||||
* <p>
|
||||
* Note that shouldPreinflate param should be set to {@code false} for taskbar,
|
||||
* because
|
||||
* this method is too late to preinflate all apps, as user will open all apps in
|
||||
* the frame
|
||||
* <p> Note that shouldPreinflate param should be set to {@code false} for taskbar, because
|
||||
* this method is too late to preinflate all apps, as user will open all apps in the frame
|
||||
*
|
||||
* <p>
|
||||
* Param: apps are required to be sorted using the comparator
|
||||
* COMPONENT_KEY_COMPARATOR
|
||||
* <p>Param: apps are required to be sorted using the comparator COMPONENT_KEY_COMPARATOR
|
||||
* in order to enable binary search on the mApps store
|
||||
*/
|
||||
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,
|
||||
// Preinflate all apps RV when apps has changed, which can happen after unlocking screen,
|
||||
// rotating screen, or downloading/upgrading apps.
|
||||
if (shouldPreinflate && ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
|
||||
if (shouldPreinflate) {
|
||||
mAllAppsRecyclerViewPool.preInflateAllAppsViewHolders(mContext);
|
||||
}
|
||||
}
|
||||
@@ -126,28 +120,25 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up for Uid using package name and user handle for the current set of
|
||||
* apps.
|
||||
* Look up for Uid using package name and user handle for the current set of apps.
|
||||
*/
|
||||
public int lookUpForUid(String packageName, UserHandle user) {
|
||||
return mPackageUserKeytoUidMap.getOrDefault(new PackageUserKey(packageName, user), -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.android.launcher3.model.BgDataModel.Callbacks#FLAG_QUIET_MODE_ENABLED
|
||||
* @see com.android.launcher3.model.BgDataModel.Callbacks#FLAG_HAS_SHORTCUT_PERMISSION
|
||||
* @see com.android.launcher3.model.BgDataModel.Callbacks#FLAG_QUIET_MODE_CHANGE_PERMISSION
|
||||
* @see com.android.launcher3.model.BgDataModel.Callbacks#FLAG_WORK_PROFILE_QUIET_MODE_ENABLED
|
||||
* @see
|
||||
* com.android.launcher3.model.BgDataModel.Callbacks#FLAG_PRIVATE_PROFILE_QUIET_MODE_ENABLED
|
||||
* @see com.android.launcher3.model.data.AppsListData#FLAG_QUIET_MODE_ENABLED
|
||||
* @see com.android.launcher3.model.data.AppsListData#FLAG_HAS_SHORTCUT_PERMISSION
|
||||
* @see com.android.launcher3.model.data.AppsListData#FLAG_QUIET_MODE_CHANGE_PERMISSION
|
||||
* @see com.android.launcher3.model.data.AppsListData#FLAG_WORK_PROFILE_QUIET_MODE_ENABLED
|
||||
* @see com.android.launcher3.model.data.AppsListData#FLAG_PRIVATE_PROFILE_QUIET_MODE_ENABLED
|
||||
*/
|
||||
public boolean hasModelFlag(int mask) {
|
||||
return (mModelFlags & mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link AppInfo} if any apps matches with provided
|
||||
* {@link ComponentKey}, otherwise
|
||||
* Returns {@link AppInfo} if any apps matches with provided {@link ComponentKey}, otherwise
|
||||
* null.
|
||||
*
|
||||
* Uses {@link AppInfo#COMPONENT_KEY_COMPARATOR} as a default comparator.
|
||||
@@ -158,8 +149,7 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic version of {@link #getApp(ComponentKey)} that allows comparator to be
|
||||
* specified.
|
||||
* Generic version of {@link #getApp(ComponentKey)} that allows comparator to be specified.
|
||||
*/
|
||||
@Nullable
|
||||
public AppInfo getApp(ComponentKey key, Comparator<AppInfo> comparator) {
|
||||
@@ -171,10 +161,12 @@ 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;
|
||||
@@ -183,6 +175,9 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
|
||||
public void disableDeferUpdatesSilently(int flag) {
|
||||
mDeferUpdatesFlags &= ~flag;
|
||||
Log.d(TAG, "disableDeferUpdatesSilently: " + flag
|
||||
+ " mDeferUpdatesFlags=" + mDeferUpdatesFlags);
|
||||
|
||||
}
|
||||
|
||||
public int getDeferUpdatesFlags() {
|
||||
@@ -191,9 +186,11 @@ 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();
|
||||
}
|
||||
@@ -231,10 +228,8 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
/**
|
||||
* Sets the AppInfo's associated icon's progress bar.
|
||||
*
|
||||
* If this app is installed and supports incremental downloads, the progress bar
|
||||
* will be updated
|
||||
* the app's total download progress. Otherwise, the progress bar will be
|
||||
* updated to the app's
|
||||
* If this app is installed and supports incremental downloads, the progress bar will be updated
|
||||
* the app's total download progress. Otherwise, the progress bar will be updated to the app's
|
||||
* installation progress.
|
||||
*
|
||||
* If this app is fully downloaded, the app icon will be reapplied.
|
||||
@@ -242,11 +237,7 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
public void updateProgressBar(AppInfo app) {
|
||||
updateAllIcons((child) -> {
|
||||
if (child.getTag() == app) {
|
||||
if ((app.runtimeStatusFlags & FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) == 0) {
|
||||
child.applyFromApplicationInfo(app);
|
||||
} else {
|
||||
child.applyProgressLevel();
|
||||
}
|
||||
child.applyFromApplicationInfo(app);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -269,14 +260,19 @@ public class AllAppsStore<T extends Context & ActivityContext> {
|
||||
void onAppsUpdated();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a dumpsys for each app package name and position in the apps list
|
||||
*/
|
||||
/** Generate a dumpsys for each app package name and position in the apps list */
|
||||
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("%s\tPackage index and name: %d/%s", prefix, i,
|
||||
mApps[i].componentName.getPackageName()));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user