diff --git a/GITHUB_CHANGELOG.md b/GITHUB_CHANGELOG.md index dcde058963..1036dfba65 100644 --- a/GITHUB_CHANGELOG.md +++ b/GITHUB_CHANGELOG.md @@ -116,10 +116,11 @@ Compatibility list: | 🏗️ Crash | 🥞 Fully supported | |-------------|--------------------| +| Android 8.0 | Android 11 | | Android 8.1 | Android 12.0 | | Android 9 | Android 12.1 | | Android 10 | Android 13 | -| Android 11 | Android 14 | +| | Android 14 | | | Android 15 | | | Android 16 | @@ -158,6 +159,7 @@ Compatibility list: * [Lawnchair] Correctly display warning in experimental features (race conditions) * [Project] Support for Android Studio 2025.2.3 Canary 5 (Bump to AGP 9.0.0-beta05) * [Lawnchair] Offer a toggle to disable/enable suggestions instead of linking it to ASI if the device is not Google Pixel +* [Launcher] Android 11 support ### 🥞 Development 3 Release 2 diff --git a/lawnchair/src/app/lawnchair/util/LawnchairWindowManagerProxy.kt b/lawnchair/src/app/lawnchair/util/LawnchairWindowManagerProxy.kt index d6b9965da2..40636b94c9 100644 --- a/lawnchair/src/app/lawnchair/util/LawnchairWindowManagerProxy.kt +++ b/lawnchair/src/app/lawnchair/util/LawnchairWindowManagerProxy.kt @@ -3,6 +3,7 @@ package app.lawnchair.util import android.content.Context import android.content.res.Resources import android.graphics.Insets +import android.graphics.Point import android.graphics.Rect import android.hardware.display.DisplayManager import android.util.ArrayMap diff --git a/quickstep/src/com/android/launcher3/dagger/PerDisplayModule.kt b/quickstep/src/com/android/launcher3/dagger/PerDisplayModule.kt index 256d9272e7..08bc77f193 100644 --- a/quickstep/src/com/android/launcher3/dagger/PerDisplayModule.kt +++ b/quickstep/src/com/android/launcher3/dagger/PerDisplayModule.kt @@ -33,6 +33,7 @@ import com.android.app.displaylib.PerDisplayInstanceRepositoryImpl import com.android.app.displaylib.PerDisplayRepository import com.android.app.displaylib.SingleInstanceRepositoryImpl import com.android.app.displaylib.createDisplayLibComponent +import com.android.launcher3.Utilities import com.android.launcher3.util.coroutines.DispatcherProvider import com.android.quickstep.FallbackWindowInterface import com.android.quickstep.RecentsAnimationDeviceState @@ -189,22 +190,30 @@ object PerDisplayRepositoriesModule { "DisplayContextRepo", { displayId -> displayRepository.getDisplay(displayId)?.let { - context.createWindowContext( - it, - TYPE_APPLICATION_OVERLAY, - /* options=*/ null, - ) + if (Utilities.ATLEAST_S) { + context.createWindowContext( + it, + TYPE_APPLICATION_OVERLAY, + /* options=*/ null, + ) + } else { + context.createDisplayContext(it) + } } }, ) } else { SingleInstanceRepositoryImpl( "DisplayContextRepo", - context.createWindowContext( - displayRepository.getDisplay(DEFAULT_DISPLAY)!!, - TYPE_APPLICATION_OVERLAY, - /* options=*/ null, - ), + if (Utilities.ATLEAST_S) { + context.createWindowContext( + displayRepository.getDisplay(DEFAULT_DISPLAY)!!, + TYPE_APPLICATION_OVERLAY, + /* options=*/ null, + ) + } else { + context.createDisplayContext(displayRepository.getDisplay(DEFAULT_DISPLAY)!!) + } ) } } diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index dea771bc83..0f7b914990 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -107,12 +107,14 @@ public class DepthController extends BaseDepthController implements StateHandler mOnAttachListener = new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View view) { - try { - UI_HELPER_EXECUTOR.execute(() -> - CrossWindowBlurListeners.getInstance().addListener( - mLauncher.getMainExecutor(), mCrossWindowBlurListener)); - } catch (Throwable t) { - // LC-Ignored + if (Utilities.ATLEAST_S) { + try { + UI_HELPER_EXECUTOR.execute(() -> + CrossWindowBlurListeners.getInstance().addListener( + mLauncher.getMainExecutor(), mCrossWindowBlurListener)); + } catch (Throwable t) { + // LC-Ignored + } } mLauncher.getScrimView().addOpaquenessListener(mOpaquenessListener); @@ -144,12 +146,14 @@ public class DepthController extends BaseDepthController implements StateHandler } private void removeSecondaryListeners() { - try { - UI_HELPER_EXECUTOR.execute(() -> - CrossWindowBlurListeners.getInstance() - .removeListener(mCrossWindowBlurListener)); - } catch (Throwable t) { - // LC-Ignored + if (Utilities.ATLEAST_S) { + try { + UI_HELPER_EXECUTOR.execute(() -> + CrossWindowBlurListeners.getInstance() + .removeListener(mCrossWindowBlurListener)); + } catch (Throwable t) { + // LC-Ignored + } } if (mOpaquenessListener != null) { mLauncher.getScrimView().removeOpaquenessListener(mOpaquenessListener); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 6ce310e1e1..8b88473108 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -764,7 +764,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, } addMultiWindowModeChangedListener(mDepthController); initUnfoldTransitionProgressProvider(); - mViewCapture = ViewCaptureFactory.getInstance(this).startCapture(getWindow()); + // LC-Note: Make it NoOp for Android 8.0/8.1/9/10/11 support + mViewCapture = null; // getWindow().addPrivateFlags(PRIVATE_FLAG_OPTIMIZE_MEASURE); QuickstepOnboardingPrefs.setup(this); // View.setTraceLayoutSteps(TRACE_LAYOUTS); diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.kt b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.kt index e1d35fdffe..6c867d05c8 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.kt +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.kt @@ -328,6 +328,8 @@ class StatsLogCompatManager private constructor(context: Context) : StatsLogMana val features = mFeatures ?: getFeatures(atomInfo) + if (!Utilities.ATLEAST_R) return + SysUiStatsLog.write( SysUiStatsLog.LAUNCHER_EVENT, SysUiStatsLog.LAUNCHER_UICHANGED__ACTION__DEFAULT_ACTION, /* deprecated */ @@ -430,6 +432,8 @@ class StatsLogCompatManager private constructor(context: Context) : StatsLogMana Log.d(LATENCY_TAG, "InstanceId=$mInstanceId $name=${mLatencyInMillis}ms") } + if (!Utilities.ATLEAST_R) return + SysUiStatsLog.write( SysUiStatsLog.LAUNCHER_LATENCY, event.id, // event_id @@ -492,6 +496,8 @@ class StatsLogCompatManager private constructor(context: Context) : StatsLogMana ) } + if (!Utilities.ATLEAST_R) return + SysUiStatsLog.write( SysUiStatsLog.LAUNCHER_IMPRESSION_EVENT_V2, event.id, // event_id @@ -548,6 +554,9 @@ class StatsLogCompatManager private constructor(context: Context) : StatsLogMana if (Utilities.isRunningInTestHarness()) { return } + + if (!Utilities.ATLEAST_R) return + SysUiStatsLog.write( SysUiStatsLog.LAUNCHER_SNAPSHOT, LAUNCHER_WORKSPACE_SNAPSHOT.id, /* event_id */ diff --git a/quickstep/src/com/android/quickstep/util/BaseDepthController.java b/quickstep/src/com/android/quickstep/util/BaseDepthController.java index 56c45d02c6..8f95e01266 100644 --- a/quickstep/src/com/android/quickstep/util/BaseDepthController.java +++ b/quickstep/src/com/android/quickstep/util/BaseDepthController.java @@ -202,6 +202,7 @@ public class BaseDepthController { float depth = mDepth; IBinder windowToken = mLauncher.getRootView().getWindowToken(); if (windowToken != null) { + if (!Utilities.ATLEAST_R) return; if (enableScalingRevealHomeAnimation()) { mWallpaperManager.setWallpaperZoomOut(windowToken, depth); } else { diff --git a/quickstep/src/com/android/quickstep/util/ContextualSearchStateManager.java b/quickstep/src/com/android/quickstep/util/ContextualSearchStateManager.java index 136c496dce..81bb281600 100644 --- a/quickstep/src/com/android/quickstep/util/ContextualSearchStateManager.java +++ b/quickstep/src/com/android/quickstep/util/ContextualSearchStateManager.java @@ -44,6 +44,7 @@ import androidx.annotation.CallSuper; import androidx.annotation.VisibleForTesting; import com.android.launcher3.R; +import com.android.launcher3.Utilities; import com.android.launcher3.dagger.ApplicationContext; import com.android.launcher3.dagger.LauncherAppComponent; import com.android.launcher3.dagger.LauncherAppSingleton; @@ -107,7 +108,9 @@ public class ContextualSearchStateManager { || !context.getPackageManager().hasSystemFeature(FEATURE_CONTEXTUAL_SEARCH)) { // If we had previously registered a SystemAction which is no longer valid, we need to // unregister it here. - unregisterSearchScreenSystemAction(); + if (Utilities.ATLEAST_R) { + unregisterSearchScreenSystemAction(); + } // Don't listen for stuff we aren't gonna use. return; } diff --git a/quickstep/src/com/android/quickstep/util/FontUtils.kt b/quickstep/src/com/android/quickstep/util/FontUtils.kt index 35a0fc7e1b..f003d35269 100644 --- a/quickstep/src/com/android/quickstep/util/FontUtils.kt +++ b/quickstep/src/com/android/quickstep/util/FontUtils.kt @@ -19,6 +19,7 @@ package com.android.quickstep.util import android.content.res.Configuration import android.content.res.Resources import android.graphics.Typeface +import android.os.Build import com.android.wm.shell.shared.TypefaceUtils object FontUtils { @@ -31,7 +32,12 @@ object FontUtils { Typeface.create(baseTypeface, getFontWeight(resources), /* italic= */ false) fun getFontWeight(resources: Resources): Int { - val fontWeightAdjustment: Int = resources.configuration.fontWeightAdjustment + val fontWeightAdjustment: Int = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + resources.configuration.fontWeightAdjustment + } else { + // LC-Note: Android 11 don't have font weight adjustment, assume 400 Normal + 400 + } return if (fontWeightAdjustment != Configuration.FONT_WEIGHT_ADJUSTMENT_UNDEFINED) { Typeface.Builder.NORMAL_WEIGHT + fontWeightAdjustment } else { diff --git a/quickstep/src_protolog/com/android/quickstep/util/QuickstepProtoLogGroup.java b/quickstep/src_protolog/com/android/quickstep/util/QuickstepProtoLogGroup.java index 7696a70a07..834fdde626 100644 --- a/quickstep/src_protolog/com/android/quickstep/util/QuickstepProtoLogGroup.java +++ b/quickstep/src_protolog/com/android/quickstep/util/QuickstepProtoLogGroup.java @@ -23,6 +23,7 @@ import androidx.annotation.NonNull; import com.android.internal.protolog.ProtoLog; import com.android.internal.protolog.common.IProtoLogGroup; +import com.android.launcher3.Utilities; import java.util.UUID; /** Enums used to interface with the ProtoLog API. */ @@ -40,6 +41,7 @@ public enum QuickstepProtoLogGroup implements IProtoLogGroup { private final @NonNull String mTag; public static boolean isProtoLogInitialized() { + if (!Utilities.ATLEAST_R) return false; if (!Variables.sIsInitialized) { Log.w(Constants.TAG, "Attempting to log to ProtoLog before initializing it.", diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 86f68e407b..9c3ce35b38 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -1474,10 +1474,12 @@ public abstract class PagedView extends ViewGrou // Detect if user tries to swipe to -1 page but gets disallowed by checking if there was // left-over values in mEdgeGlowLeft (or mEdgeGlowRight in RLT). - final int layoutDir = getLayoutDirection(); - if ((mEdgeGlowLeft.getDistance() > 0 && layoutDir == LAYOUT_DIRECTION_LTR) - || (mEdgeGlowRight.getDistance() > 0 && layoutDir == LAYOUT_DIRECTION_RTL)) { - onDisallowSwipeToMinusOnePage(); + if (Utilities.ATLEAST_S) { + final int layoutDir = getLayoutDirection(); + if ((mEdgeGlowLeft.getDistance() > 0 && layoutDir == LAYOUT_DIRECTION_LTR) + || (mEdgeGlowRight.getDistance() > 0 && layoutDir == LAYOUT_DIRECTION_RTL)) { + onDisallowSwipeToMinusOnePage(); + } } mEdgeGlowLeft.onRelease(ev); diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index fb434bb290..1b5d741c1a 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -776,7 +776,11 @@ public final class Utilities { if (activityInfo == null) { return null; } - mainIcon = appState.getIconCache().getFullResIcon(activityInfo.getActivityInfo()); + if (Utilities.ATLEAST_S) { + mainIcon = appState.getIconCache().getFullResIcon(activityInfo.getActivityInfo()); + } else { + mainIcon = appState.getIconCache().getFullResIcon(activityInfo.getComponentName().getPackageName()); + } } else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { List siList = ShortcutKey.fromItemInfo(info) .buildRequest(context) diff --git a/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java index 4099d043d1..035a6f2c69 100644 --- a/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java +++ b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java @@ -234,7 +234,7 @@ public class LauncherAppWidgetInfo extends ItemInfo { if (providerInfo.isConfigurationOptional()) { widgetFeatures |= FEATURE_OPTIONAL_CONFIGURATION; } - if (providerInfo.previewLayout != Resources.ID_NULL) { + if (ATLEAST_S && (providerInfo.previewLayout != Resources.ID_NULL)) { widgetFeatures |= FEATURE_PREVIEW_LAYOUT; } if (ATLEAST_S && (providerInfo.targetCellWidth > 0 || providerInfo.targetCellHeight > 0)) { diff --git a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java index 235a46c800..da0f942877 100644 --- a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java +++ b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java @@ -40,6 +40,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; +import com.android.launcher3.Utilities; import com.android.launcher3.icons.cache.BaseIconCache; import com.android.launcher3.icons.cache.CachedObject; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -149,7 +150,11 @@ public abstract class ShortcutConfigActivityInfo implements CachedObject { @Override public Drawable getFullResIcon(BaseIconCache cache) { - return cache.getFullResIcon(mInfo.getActivityInfo()); + if (Utilities.ATLEAST_S) { + return cache.getFullResIcon(mInfo.getActivityInfo()); + } else { + return cache.getFullResIcon(mInfo.getComponentName().getPackageName()); + } } @Override diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java index 98c59d505d..e4853c516b 100644 --- a/src/com/android/launcher3/util/DisplayController.java +++ b/src/com/android/launcher3/util/DisplayController.java @@ -16,6 +16,8 @@ package com.android.launcher3.util; import static android.content.pm.PackageManager.FEATURE_SENSOR_HINGE_ANGLE; +import static android.content.res.Configuration.UI_MODE_NIGHT_MASK; +import static android.content.res.Configuration.UI_MODE_NIGHT_YES; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; @@ -577,8 +579,12 @@ public class DisplayController implements DesktopVisibilityListener { mStableDensityScaleFactor = (float) defaultDensityDpi / DisplayMetrics.DENSITY_DEFAULT; mScreenSizeDp = new PortraitSize(config.screenHeightDp, config.screenWidthDp); navigationMode = wmProxy.getNavigationMode(displayInfoContext); - mIsNightModeActive = config.isNightModeActive(); - + if (Utilities.ATLEAST_R) { + mIsNightModeActive = config.isNightModeActive(); + } else { + mIsNightModeActive = (config.uiMode & UI_MODE_NIGHT_MASK) == UI_MODE_NIGHT_YES; + } + // LC: Hacky stuff but it work! mIsFoldable = Utilities.ATLEAST_R && displayInfoContext.getPackageManager() .hasSystemFeature(FEATURE_SENSOR_HINGE_ANGLE); diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java index 1e2607fc9a..a0a6bbe7c7 100644 --- a/src/com/android/launcher3/util/PackageManagerHelper.java +++ b/src/com/android/launcher3/util/PackageManagerHelper.java @@ -45,6 +45,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.PendingAddItemInfo; import com.android.launcher3.R; +import com.android.launcher3.Utilities; import com.android.launcher3.dagger.ApplicationContext; import com.android.launcher3.dagger.LauncherAppSingleton; import com.android.launcher3.dagger.LauncherBaseAppComponent; @@ -221,7 +222,11 @@ public class PackageManagerHelper { /** Returns the incremental download progress for the given shortcut's app. */ public static int getLoadingProgress(LauncherActivityInfo info) { - return (int) (100 * info.getLoadingProgress()); + if (Utilities.ATLEAST_S) { + return (int) (100 * info.getLoadingProgress()); + } else { + return 100; + } } /** diff --git a/src/com/android/launcher3/util/window/WindowManagerProxy.java b/src/com/android/launcher3/util/window/WindowManagerProxy.java index 36dcd9e77d..d5ccf328cd 100644 --- a/src/com/android/launcher3/util/window/WindowManagerProxy.java +++ b/src/com/android/launcher3/util/window/WindowManagerProxy.java @@ -31,6 +31,7 @@ import static com.android.launcher3.util.RotationUtils.deltaRotation; import static com.android.launcher3.util.RotationUtils.rotateRect; import static com.android.launcher3.util.RotationUtils.rotateSize; +import android.annotation.TargetApi; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; @@ -38,6 +39,7 @@ import android.graphics.Insets; import android.graphics.Point; import android.graphics.Rect; import android.hardware.display.DisplayManager; +import android.os.Build; import android.util.ArrayMap; import android.util.Log; import android.view.Display; @@ -431,9 +433,16 @@ public class WindowManagerProxy { */ public CachedDisplayInfo getDisplayInfo(Context displayInfoContext) { int rotation = getRotation(displayInfoContext); - WindowMetrics windowMetrics = displayInfoContext.getSystemService(WindowManager.class) - .getMaximumWindowMetrics(); - return getDisplayInfo(windowMetrics, rotation); + if (Utilities.ATLEAST_S) { + WindowMetrics windowMetrics = displayInfoContext.getSystemService(WindowManager.class) + .getMaximumWindowMetrics(); + return getDisplayInfo(windowMetrics, rotation); + } else { + Point size = new Point(); + Display display = getDisplay(displayInfoContext); + display.getRealSize(size); + return new CachedDisplayInfo(size, rotation); + } } /** diff --git a/src/com/android/launcher3/views/SpringRelativeLayout.java b/src/com/android/launcher3/views/SpringRelativeLayout.java index a13152ec76..893eb7ed9f 100644 --- a/src/com/android/launcher3/views/SpringRelativeLayout.java +++ b/src/com/android/launcher3/views/SpringRelativeLayout.java @@ -24,6 +24,7 @@ import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView.EdgeEffectFactory; +import com.android.launcher3.Utilities; /** * View group to allow rendering overscroll effect in a child at the parent level @@ -44,8 +45,13 @@ public class SpringRelativeLayout extends RelativeLayout { public SpringRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - mEdgeGlowTop = new EdgeEffect(context, attrs); - mEdgeGlowBottom = new EdgeEffect(context, attrs); + if (Utilities.ATLEAST_S) { + mEdgeGlowTop = new EdgeEffect(context, attrs); + mEdgeGlowBottom = new EdgeEffect(context, attrs); + } else { + mEdgeGlowTop = new EdgeEffect(context); + mEdgeGlowBottom = new EdgeEffect(context); + } setWillNotDraw(false); } @@ -162,4 +168,4 @@ public class SpringRelativeLayout extends RelativeLayout { return mParent.isFinished(); } } -} \ No newline at end of file +} diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java b/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java index 23ac46c0ad..369d69156b 100644 --- a/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java +++ b/src/com/android/launcher3/widget/LauncherAppWidgetProviderInfo.java @@ -130,13 +130,15 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo impleme getSpanY(widgetPadding, minResizeHeight, dp.cellLayoutBorderSpacePx.y, cellSize.y)); - if (maxResizeWidth > 0) { - maxSpanX = Math.min(maxSpanX, getSpanX(widgetPadding, maxResizeWidth, + if (Utilities.ATLEAST_S) { + if (maxResizeWidth > 0) { + maxSpanX = Math.min(maxSpanX, getSpanX(widgetPadding, maxResizeWidth, dp.cellLayoutBorderSpacePx.x, cellSize.x)); - } - if (maxResizeHeight > 0) { - maxSpanY = Math.min(maxSpanY, getSpanY(widgetPadding, maxResizeHeight, + } + if (maxResizeHeight > 0) { + maxSpanY = Math.min(maxSpanY, getSpanY(widgetPadding, maxResizeHeight, dp.cellLayoutBorderSpacePx.y, cellSize.y)); + } } spanX = Math.max(spanX, @@ -147,16 +149,18 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo impleme cellSize.y)); } - // Ensures maxSpan >= minSpan - maxSpanX = Math.max(maxSpanX, minSpanX); - maxSpanY = Math.max(maxSpanY, minSpanY); + if (Utilities.ATLEAST_S) { + // Ensures maxSpan >= minSpan + maxSpanX = Math.max(maxSpanX, minSpanX); + maxSpanY = Math.max(maxSpanY, minSpanY); - // Use targetCellWidth/Height if it is within the min/max ranges. - // Otherwise, use the span of minWidth/Height. - if (targetCellWidth >= minSpanX && targetCellWidth <= maxSpanX - && targetCellHeight >= minSpanY && targetCellHeight <= maxSpanY) { - spanX = targetCellWidth; - spanY = targetCellHeight; + // Use targetCellWidth/Height if it is within the min/max ranges. + // Otherwise, use the span of minWidth/Height. + if (targetCellWidth >= minSpanX && targetCellWidth <= maxSpanX + && targetCellHeight >= minSpanY && targetCellHeight <= maxSpanY) { + spanX = targetCellWidth; + spanY = targetCellHeight; + } } // If minSpanX/Y > spanX/Y, ignore the minSpanX/Y to match the behavior described in @@ -221,11 +225,11 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo impleme } public boolean isReconfigurable() { - return configure != null && (getWidgetFeatures() & WIDGET_FEATURE_RECONFIGURABLE) != 0; + return Utilities.ATLEAST_P && configure != null && (getWidgetFeatures() & WIDGET_FEATURE_RECONFIGURABLE) != 0; } public boolean isConfigurationOptional() { - return isReconfigurable() + return Utilities.ATLEAST_S && isReconfigurable() && (getWidgetFeatures() & WIDGET_FEATURE_CONFIGURATION_OPTIONAL) != 0; } @@ -241,12 +245,23 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo impleme @Override public Drawable getFullResIcon(BaseIconCache cache) { - return cache.getFullResIcon(getActivityInfo()); + if (Utilities.ATLEAST_S) { + return cache.getFullResIcon(getActivityInfo()); + } else { + return cache.getFullResIcon(provider.getPackageName()); + } } @Nullable @Override public ApplicationInfo getApplicationInfo() { - return getActivityInfo().applicationInfo; + if (Utilities.ATLEAST_S) { + return getActivityInfo().applicationInfo; + } + try { + return mPM.getApplicationInfo(provider.getPackageName(), 0); + } catch (PackageManager.NameNotFoundException e) { + return null; + } } } diff --git a/systemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/systemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java index ee6dd8e7e4..74d463c876 100644 --- a/systemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +++ b/systemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java @@ -44,6 +44,7 @@ import android.util.Log; import android.view.Display; import android.window.TaskSnapshot; +import app.lawnchair.compat.LawnchairQuickstepCompat; import com.android.internal.app.IVoiceInteractionManagerService; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -63,7 +64,8 @@ public class ActivityManagerWrapper { // Should match the value in AssistManager private static final String INVOCATION_TIME_MS_KEY = "invocation_time_ms"; - private final ActivityTaskManager mAtm = ActivityTaskManager.getInstance(); + // pE-TODO(CompatTier2): Try not to do this? Just use ActivityTaskManager.getInstance() + private final ActivityTaskManager mAtm = LawnchairQuickstepCompat.ATLEAST_S ? ActivityTaskManager.getInstance() : null; private ActivityManagerWrapper() { } public static ActivityManagerWrapper getInstance() { diff --git a/systemUI/shared/src/com/android/systemui/shared/system/BlurUtils.java b/systemUI/shared/src/com/android/systemui/shared/system/BlurUtils.java index 61b0e4d902..1475033283 100644 --- a/systemUI/shared/src/com/android/systemui/shared/system/BlurUtils.java +++ b/systemUI/shared/src/com/android/systemui/shared/system/BlurUtils.java @@ -20,6 +20,7 @@ import static android.view.CrossWindowBlurListeners.CROSS_WINDOW_BLUR_SUPPORTED; import android.app.ActivityManager; import android.os.SystemProperties; +import app.lawnchair.compat.LawnchairQuickstepCompat; public abstract class BlurUtils { @@ -29,7 +30,7 @@ public abstract class BlurUtils { * @return {@code true} when supported. */ public static boolean supportsBlursOnWindows() { - return CROSS_WINDOW_BLUR_SUPPORTED && ActivityManager.isHighEndGfx() + return LawnchairQuickstepCompat.ATLEAST_S && CROSS_WINDOW_BLUR_SUPPORTED && ActivityManager.isHighEndGfx() && !SystemProperties.getBoolean("persist.sysui.disableBlur", false); } }