Fix bugs with A16/A15 devices

Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
Pun Butrach
2025-08-31 17:57:56 +07:00
parent b67168f737
commit bfb2be39eb
9 changed files with 49 additions and 29 deletions
@@ -2,12 +2,8 @@ package app.lawnchair.allapps
import android.content.Context
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.viewModels
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import app.lawnchair.data.folder.model.FolderOrderUtils
import app.lawnchair.data.folder.model.FolderViewModel
import app.lawnchair.flowerpot.Flowerpot
import app.lawnchair.launcher
import app.lawnchair.preferences.PreferenceManager
@@ -39,7 +35,8 @@ class LawnchairAlphabeticalAppsList<T>(
private val prefs2 = PreferenceManager2.getInstance(context)
private val prefs = PreferenceManager.getInstance(context)
private val viewModel: FolderViewModel by (context as ComponentActivity).viewModels()
// Lawnchair-TODO-Featureset: observeFolder vM
//private val viewModel: FolderViewModel by (context as ComponentActivity).viewModels()
private var folderList = mutableListOf<FolderInfo>()
private val filteredList = mutableListOf<AppInfo>()
@@ -60,12 +57,12 @@ class LawnchairAlphabeticalAppsList<T>(
}
private fun observeFolders() {
viewModel.foldersLiveData.observe(context as LifecycleOwner) { folders ->
folderList = folders
.sortedBy { folderOrder.indexOf(it.id) }
.toMutableList()
updateAdapterItems()
}
// viewModel.foldersLiveData.observe(context as LifecycleOwner) { folders ->
// folderList = folders
// .sortedBy { folderOrder.indexOf(it.id) }
// .toMutableList()
// updateAdapterItems()
// }
}
override fun updateItemFilter(itemFilter: Predicate<ItemInfo>?) {
@@ -37,6 +37,7 @@ import static com.android.launcher3.LauncherState.NO_OFFSET;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.Utilities.ATLEAST_BAKLAVA;
import static com.android.launcher3.Utilities.ATLEAST_T;
import static com.android.launcher3.Utilities.isRtl;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
@@ -1048,12 +1049,14 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
public void setResumed() {
DesktopVisibilityController desktopVisibilityController =
DesktopVisibilityController.INSTANCE.get(this);
if (!ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY.isTrue()
if (ATLEAST_BAKLAVA) {
if (!ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY.isTrue()
&& desktopVisibilityController.isInDesktopModeAndNotInOverview(getDisplayId())
&& !desktopVisibilityController.isRecentsGestureInProgress()) {
// Return early to skip setting activity to appear as resumed
// TODO: b/333533253 - Remove after flag rollout
return;
// Return early to skip setting activity to appear as resumed
// TODO: b/333533253 - Remove after flag rollout
return;
}
}
super.setResumed();
}
@@ -186,7 +186,7 @@ open class SystemApiWrapper @Inject constructor(@ApplicationContext context: Con
override fun supportsMultiInstance(lai: LauncherActivityInfo): Boolean {
return try {
super.supportsMultiInstance(lai) || lai.supportsMultiInstance()
} catch (e: Exception) {
} catch (t: Throwable) {
false
}
}
@@ -195,7 +195,7 @@ public final class OverviewComponentObserver {
if (!mIsHomeDisabled && (defaultHome == null || mIsDefaultHome)) {
// User default home is same as our home app. Use Overview integrated in Launcher.
if (enableLauncherOverviewInWindow.isTrue()) {
if (enableLauncherOverviewInWindow) {
mDefaultDisplayContainerInterface =
mRecentsDisplayModel.getFallbackWindowInterface(DEFAULT_DISPLAY);
} else {
@@ -209,7 +209,7 @@ public final class OverviewComponentObserver {
unregisterOtherHomeAppUpdateReceiver();
} else {
// The default home app is a different launcher. Use the fallback Overview instead.
if (enableFallbackOverviewInWindow.isTrue()) {
if (enableFallbackOverviewInWindow) {
mDefaultDisplayContainerInterface =
mRecentsDisplayModel.getFallbackWindowInterface(DEFAULT_DISPLAY);
} else {
@@ -302,7 +302,7 @@ public final class OverviewComponentObserver {
}
public boolean isHomeAndOverviewSameActivity() {
return isHomeAndOverviewSame() && !enableLauncherOverviewInWindow.isTrue();
return isHomeAndOverviewSame() && !enableLauncherOverviewInWindow;
}
/**
@@ -333,7 +333,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
0 // Bottom left
};
if (Flags.allAppsBlur()) {
int resId = ColorTokens.ExpressiveAllApps.resolveColor(getContext());
// Lawnchair-TODO-Colour: ExpressiveAllApps
// int resId = ColorTokens.ExpressiveAllApps.resolveColor(getContext());
int resId = Utilities.isDarkTheme(getContext())
? android.R.color.system_accent1_800 : android.R.color.system_accent1_100;
int layerAbove = ColorUtils.setAlphaComponent(getResources().getColor(resId, null),
(int) (0.4f * 255));
int layerBelow = ColorUtils.setAlphaComponent(Color.WHITE, (int) (0.1f * 255));
@@ -19,6 +19,7 @@ package com.android.launcher3.popup;
import static android.multiuser.Flags.enableMovingContentIntoPrivateSpace;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
import static com.android.launcher3.Utilities.ATLEAST_BAKLAVA;
import static com.android.launcher3.Utilities.squaredHypot;
import static com.android.launcher3.Utilities.squaredTouchSlop;
import static com.android.launcher3.allapps.AlphabeticalAppsList.PRIVATE_SPACE_PACKAGE;
@@ -215,8 +216,15 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
container = (PopupContainerWithArrow) launcher.getLayoutInflater().inflate(
R.layout.popup_container, launcher.getDragLayer(), false);
container.configureForLauncher(launcher, item);
boolean shouldHideSystemShortcuts = enableMovingContentIntoPrivateSpace()
boolean shouldHideSystemShortcuts;
if (ATLEAST_BAKLAVA) {
shouldHideSystemShortcuts = enableMovingContentIntoPrivateSpace()
&& Objects.equals(item.getTargetPackage(), PRIVATE_SPACE_PACKAGE);
} else {
shouldHideSystemShortcuts = false;
}
container.populateAndShowRows(icon, deepShortcutCount,
shouldHideSystemShortcuts ? Collections.emptyList() : systemShortcuts);
launcher.refreshAndBindWidgetsForPackageUser(PackageUserKey.fromItemInfo(item));
@@ -18,6 +18,7 @@ package com.android.launcher3.workprofile;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.widget.Button;
import android.widget.LinearLayout;
@@ -63,8 +64,9 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
for (int i = 0; i < getChildCount(); i++) {
Button tab = (Button) getChildAt(i);
tab.setAllCaps(false);
RippleDrawable background = (RippleDrawable) tab.getBackground();
background.setDrawableByLayerId(android.R.id.mask, DrawableTokens.AllAppsTabsMaskDrawable.resolve(getContext()));
// Lawnchair-TODO: StateListDrawable
// RippleDrawable background = (RippleDrawable) tab.getBackground();
// background.setDrawableByLayerId(android.R.id.mask, DrawableTokens.AllAppsTabsMaskDrawable.resolve(getContext()));
tab.setBackground(DrawableTokens.AllAppsTabsBackground.resolve(getContext()));
tab.setTextColor(ColorStateListTokens.AllAppsTabText.resolve(getContext()));
fontManager.setCustomFont(tab, R.id.font_body_medium);
@@ -16,6 +16,7 @@
package com.android.systemui.animation.back
import android.os.Build
import android.util.TimeUtils
import android.view.Choreographer
import android.view.MotionEvent
@@ -86,15 +87,17 @@ abstract class FlingOnBackAnimationCallback(
onBackInvokedCompat()
}
reset()
if (predictiveBackTimestampApi()) {
downTime = backEvent.frameTimeMillis
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
if (predictiveBackTimestampApi()) {
downTime = backEvent.frameTimeMillis
}
}
onBackStartedCompat(backEvent)
}
final override fun onBackProgressed(backEvent: BackEvent) {
val interpolatedProgress = progressInterpolator.getInterpolation(backEvent.progress)
if (predictiveBackTimestampApi()) {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) && predictiveBackTimestampApi()) {
downTime?.let { downTime ->
velocityTracker.addMovement(
MotionEvent.obtain(
@@ -128,7 +131,7 @@ abstract class FlingOnBackAnimationCallback(
}
final override fun onBackInvoked() {
if (predictiveBackTimestampApi() && lastBackEvent != null) {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) && predictiveBackTimestampApi() && lastBackEvent != null) {
velocityTracker.computeCurrentVelocity(1000)
backInvokedFlingAnim =
FlingAnimation(FloatValueHolder())
@@ -327,8 +327,12 @@ public class DesktopModeStatus {
* necessarily enabling desktop mode
*/
public static boolean overridesShowAppHandle(@NonNull Context context) {
return (Flags.showAppHandleLargeScreens() || enableBubbleToFullscreen())
&& deviceHasLargeScreen(context);
try {
return (Flags.showAppHandleLargeScreens() || enableBubbleToFullscreen())
&& deviceHasLargeScreen(context);
} catch (Throwable t) {
return false;
}
}
/**