diff --git a/lawnchair/res/values-v30/colors.xml b/lawnchair/res/values-v30/colors.xml
new file mode 100644
index 0000000000..52aee4639d
--- /dev/null
+++ b/lawnchair/res/values-v30/colors.xml
@@ -0,0 +1,5 @@
+
+
+ @android:color/transparent
+ @android:color/transparent
+
diff --git a/lawnchair/res/values/config.xml b/lawnchair/res/values/config.xml
index 2ad7a32678..a459cb0e71 100644
--- a/lawnchair/res/values/config.xml
+++ b/lawnchair/res/values/config.xml
@@ -39,6 +39,8 @@
app.lawnchair.overview.TaskOverlayFactoryImpl
com.android.wallpaper
com.google.android.apps.wallpaper
+ app.lawnchair.factory.LawnchairWidgetHolder$LawnchairHolderFactory
+ app.lawnchair.util.LawnchairWindowManagerProxy
true
@@ -116,4 +118,6 @@
- 1.0
- 5
+
+ - 1.10
diff --git a/lawnchair/src/app/lawnchair/LawnchairApp.kt b/lawnchair/src/app/lawnchair/LawnchairApp.kt
index 65d944bb25..95ce8c7b9f 100644
--- a/lawnchair/src/app/lawnchair/LawnchairApp.kt
+++ b/lawnchair/src/app/lawnchair/LawnchairApp.kt
@@ -46,6 +46,7 @@ import com.android.launcher3.BuildConfig
import com.android.launcher3.InvariantDeviceProfile
import com.android.launcher3.Launcher
import com.android.launcher3.R
+import com.android.launcher3.Utilities
import com.android.quickstep.RecentsActivity
import com.android.systemui.shared.system.QuickStepContract
import java.io.File
@@ -54,6 +55,7 @@ class LawnchairApp : Application() {
private val compatible = Build.VERSION.SDK_INT in BuildConfig.QUICKSTEP_MIN_SDK..BuildConfig.QUICKSTEP_MAX_SDK
private val isRecentsComponent: Boolean by lazy { checkRecentsComponent() }
private val recentsEnabled: Boolean get() = compatible && isRecentsComponent
+ private val isAtleastT = Utilities.ATLEAST_T
internal var accessibilityService: LawnchairAccessibilityService? = null
val isVibrateOnIconAnimation: Boolean by lazy { getSystemUiBoolean("config_vibrateOnIconAnimation", false) }
@@ -201,6 +203,9 @@ class LawnchairApp : Application() {
@JvmStatic
val isRecentsEnabled: Boolean get() = instance.recentsEnabled
+ @JvmStatic
+ val isAtleastT: Boolean get() = instance.isAtleastT
+
fun Launcher.showQuickstepWarningIfNecessary() {
val launcher = this
if (!lawnchairApp.isRecentsComponent || isRecentsEnabled) return
diff --git a/lawnchair/src/app/lawnchair/LawnchairLauncher.kt b/lawnchair/src/app/lawnchair/LawnchairLauncher.kt
index 0acf337a2d..6ea6c2b553 100644
--- a/lawnchair/src/app/lawnchair/LawnchairLauncher.kt
+++ b/lawnchair/src/app/lawnchair/LawnchairLauncher.kt
@@ -46,6 +46,7 @@ import androidx.savedstate.SavedStateRegistryController
import androidx.savedstate.SavedStateRegistryOwner
import androidx.savedstate.setViewTreeSavedStateRegistryOwner
import app.lawnchair.LawnchairApp.Companion.showQuickstepWarningIfNecessary
+import app.lawnchair.factory.LawnchairWidgetHolder
import app.lawnchair.gestures.GestureController
import app.lawnchair.gestures.VerticalSwipeTouchController
import app.lawnchair.gestures.config.GestureHandlerConfig
@@ -72,6 +73,7 @@ import com.android.launcher3.uioverrides.states.OverviewState
import com.android.launcher3.util.SystemUiController.UI_STATE_BASE_WINDOW
import com.android.launcher3.util.Themes
import com.android.launcher3.util.TouchController
+import com.android.launcher3.widget.LauncherWidgetHolder
import com.android.launcher3.widget.RoundedCornerEnforcement
import com.android.systemui.plugins.shared.LauncherOverlayManager
import com.android.systemui.shared.system.QuickStepContract
@@ -299,12 +301,22 @@ class LawnchairLauncher :
gestureController.onHomePressed()
}
-// fun shouldBackButtonBeHidden(toState: LauncherState): Boolean {
-// if (toState == LauncherState.NORMAL && hasBackGesture) {
-// return false
-// }
-// return super.shouldBackButtonBeHidden(toState)
-// }
+ override fun registerBackDispatcher() {
+ if (LawnchairApp.isAtleastT) {
+ super.registerBackDispatcher()
+ }
+ }
+
+ override fun createAppWidgetHolder(): LauncherWidgetHolder {
+ val factory = LauncherWidgetHolder.HolderFactory.newFactory(this) as LawnchairWidgetHolder.LawnchairHolderFactory
+ return factory.newInstance(
+ this,
+ ) { appWidgetId: Int ->
+ workspace.removeWidget(
+ appWidgetId,
+ )
+ }
+ }
override fun onStart() {
super.onStart()
diff --git a/lawnchair/src/app/lawnchair/factory/LawnchairWidgetHolder.kt b/lawnchair/src/app/lawnchair/factory/LawnchairWidgetHolder.kt
new file mode 100644
index 0000000000..8fef8f13c4
--- /dev/null
+++ b/lawnchair/src/app/lawnchair/factory/LawnchairWidgetHolder.kt
@@ -0,0 +1,54 @@
+package app.lawnchair.factory
+
+import android.appwidget.AppWidgetHost
+import android.content.Context
+import android.widget.RemoteViews
+import com.android.internal.annotations.Keep
+import com.android.launcher3.config.FeatureFlags
+import com.android.launcher3.widget.LauncherWidgetHolder
+import java.util.function.IntConsumer
+
+class LawnchairWidgetHolder(context: Context, intConsumer: IntConsumer?) : LauncherWidgetHolder(context, intConsumer) {
+
+ @Keep
+ class LawnchairHolderFactory
+ @Suppress("unused")
+ constructor(context: Context?) :
+ HolderFactory() {
+ override fun newInstance(
+ context: Context,
+ appWidgetRemovedCallback: IntConsumer?,
+ ): LauncherWidgetHolder {
+ return newInstance(context, appWidgetRemovedCallback, null)
+ }
+
+ /**
+ * @param context The context of the caller
+ * @param appWidgetRemovedCallback The callback that is called when widgets are removed
+ * @param interactionHandler The interaction handler when the widgets are clicked
+ * @return A new [LauncherWidgetHolder] instance
+ */
+ fun newInstance(
+ context: Context,
+ appWidgetRemovedCallback: IntConsumer?,
+ interactionHandler: RemoteViews.InteractionHandler?,
+ ): LauncherWidgetHolder {
+ return if (!FeatureFlags.ENABLE_WIDGET_HOST_IN_BACKGROUND.get()) {
+ object : LauncherWidgetHolder(context, appWidgetRemovedCallback) {
+ override fun createHost(
+ context: Context,
+ appWidgetRemovedCallback: IntConsumer?,
+ ): AppWidgetHost {
+ val host = super.createHost(context, appWidgetRemovedCallback)
+ if (interactionHandler != null) {
+ host.setInteractionHandler(interactionHandler)
+ }
+ return host
+ }
+ }
+ } else {
+ LawnchairWidgetHolder(context, appWidgetRemovedCallback)
+ }
+ }
+ }
+}
diff --git a/lawnchair/src/app/lawnchair/util/LawnchairWindowManagerProxy.kt b/lawnchair/src/app/lawnchair/util/LawnchairWindowManagerProxy.kt
new file mode 100644
index 0000000000..126e683162
--- /dev/null
+++ b/lawnchair/src/app/lawnchair/util/LawnchairWindowManagerProxy.kt
@@ -0,0 +1,47 @@
+package app.lawnchair.util
+
+import android.content.Context
+import android.util.ArrayMap
+import android.view.Display.DEFAULT_DISPLAY
+import android.view.Surface
+import android.view.WindowManager
+import androidx.annotation.Keep
+import app.lawnchair.LawnchairApp
+import com.android.internal.policy.SystemBarUtils
+import com.android.launcher3.util.WindowBounds
+import com.android.launcher3.util.window.CachedDisplayInfo
+import com.android.launcher3.util.window.WindowManagerProxy
+
+@Keep
+class LawnchairWindowManagerProxy(context: Context) : WindowManagerProxy(true) {
+
+ override fun getRotation(displayInfoContext: Context): Int {
+ if (LawnchairApp.isAtleastT) {
+ return displayInfoContext.resources.configuration.windowConfiguration.rotation
+ }
+ return super.getRotation(displayInfoContext)
+ }
+
+ override fun getStatusBarHeight(context: Context, isPortrait: Boolean, statusBarInset: Int): Int {
+ if (LawnchairApp.isAtleastT) {
+ return SystemBarUtils.getStatusBarHeight(context)
+ }
+ return super.getStatusBarHeight(context, isPortrait, statusBarInset)
+ }
+
+ override fun estimateInternalDisplayBounds(displayInfoContext: Context): ArrayMap> {
+ if (LawnchairApp.isAtleastT) {
+ val result = ArrayMap>()
+ val windowManager = displayInfoContext.getSystemService(WindowManager::class.java)
+ val possibleMaximumWindowMetrics =
+ windowManager.getPossibleMaximumWindowMetrics(DEFAULT_DISPLAY)
+ for (windowMetrics in possibleMaximumWindowMetrics) {
+ val info = getDisplayInfo(windowMetrics, Surface.ROTATION_0)
+ val bounds = estimateWindowBounds(displayInfoContext, info)
+ result[info] = bounds
+ }
+ return result
+ }
+ return super.estimateInternalDisplayBounds(displayInfoContext)
+ }
+}
diff --git a/proguard.pro b/proguard.pro
index eb535b851a..5cad2c2143 100644
--- a/proguard.pro
+++ b/proguard.pro
@@ -150,6 +150,7 @@
-keep class com.android.launcher3.Utilities { *; }
-keep class app.lawnchair.LawnchairLauncher { *; }
-keep class com.google.protobuf.Timestamp { *; }
+-keep class androidx.core.app.CoreComponentFactory { *; }
-keepattributes InnerClasses
-keep class app.lawnchair.compatlib.** {
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 0868e0a73f..16ff7331b8 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -261,8 +261,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mDragLayer = mLauncher.getDragLayer();
mHandler = new Handler(Looper.getMainLooper());
mDeviceProfile = mLauncher.getDeviceProfile();
- mBackAnimationController = new LauncherBackAnimationController(mLauncher, this);
-
+ mBackAnimationController = LawnchairApp.isAtleastT() ? new LauncherBackAnimationController(mLauncher, this) : null;
Resources res = mLauncher.getResources();
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
mMaxShadowRadius = res.getDimensionPixelSize(R.dimen.max_shadow_radius);
@@ -2068,13 +2067,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
private static class MyDepthController extends DepthController {
MyDepthController(Launcher l) {
super(l);
- setCrossWindowBlursEnabled(
- CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
+ if(LawnchairApp.isAtleastT()){
+ setCrossWindowBlursEnabled(
+ CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
+ }
}
@Override
public void setSurface(SurfaceControl surface) {
- super.setSurface(surface);
+ if(LawnchairApp.isAtleastT()){
+ super.setSurface(surface);
+ }
}
}
}
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index c3f7eda1c3..dc8c4de694 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -74,8 +74,11 @@ public class DepthController extends BaseDepthController implements StateHandler
mOnAttachListener = new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View view) {
- CrossWindowBlurListeners.getInstance().addListener(mLauncher.getMainExecutor(),
- mCrossWindowBlurListener);
+ if(app.lawnchair.LawnchairApp.isAtleastT()){
+ CrossWindowBlurListeners.getInstance().addListener(mLauncher.getMainExecutor(),
+ mCrossWindowBlurListener);
+ }
+
mLauncher.getScrimView().addOpaquenessListener(mOpaquenessListener);
// To handle the case where window token is invalid during last setDepth call.
@@ -84,7 +87,9 @@ public class DepthController extends BaseDepthController implements StateHandler
@Override
public void onViewDetachedFromWindow(View view) {
- CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener);
+ if(app.lawnchair.LawnchairApp.isAtleastT()){
+ CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener);
+ }
mLauncher.getScrimView().removeOpaquenessListener(mOpaquenessListener);
}
};
@@ -134,8 +139,10 @@ public class DepthController extends BaseDepthController implements StateHandler
@Override
public void applyDepthAndBlur() {
- ensureDependencies();
- super.applyDepthAndBlur();
+ if(app.lawnchair.LawnchairApp.isAtleastT()){
+ ensureDependencies();
+ super.applyDepthAndBlur();
+ }
}
@Override
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index a713ff53a7..5273b5756e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -224,8 +224,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
TaskbarManager.isPhoneMode(deviceProfile));
mNavButtonsView.getLayoutParams().height = p.y;
- mIsImeRenderingNavButtons =
- InputMethodService.canImeRenderGesturalNavButtons() && mContext.imeDrawsImeNavBar();
+ mIsImeRenderingNavButtons = app.lawnchair.LawnchairApp.isAtleastT() ? InputMethodService.canImeRenderGesturalNavButtons() && mContext.imeDrawsImeNavBar() : mContext.imeDrawsImeNavBar();
if (!mIsImeRenderingNavButtons) {
// IME switcher
View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH,
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index b5aafe29f0..eb0889dff4 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -291,8 +291,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
@Override
public void dispatchDeviceProfileChanged() {
super.dispatchDeviceProfileChanged();
- Trace.instantForTrack(TRACE_TAG_APP, "TaskbarActivityContext#DeviceProfileChanged",
- getDeviceProfile().toSmallString());
}
/**
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 143f1a9ecb..8efad00c5d 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -71,6 +71,7 @@ import android.hardware.SensorManager;
import android.hardware.devicestate.DeviceStateManager;
import android.hardware.display.DisplayManager;
import android.media.permission.SafeCloseable;
+import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.IBinder;
@@ -949,21 +950,25 @@ public class QuickstepLauncher extends Launcher {
mAppTransitionManager.hasControlRemoteAppTransitionPermission()
? mAppTransitionManager.getActivityLaunchOptions(v)
: super.getActivityLaunchOptions(v, item);
- if (mLastTouchUpTime > 0) {
+ if (mLastTouchUpTime > 0 && app.lawnchair.LawnchairApp.isAtleastT()) {
activityOptions.options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_LAUNCHER,
mLastTouchUpTime);
}
if (item != null && (item.animationType == DEFAULT_NO_ICON
- || item.animationType == VIEW_BACKGROUND)) {
+ || item.animationType == VIEW_BACKGROUND) && app.lawnchair.LawnchairApp.isAtleastT()) {
activityOptions.options.setSplashScreenStyle(
SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR);
} else {
- activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
+ if (app.lawnchair.LawnchairApp.isAtleastT()) {
+ activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
+ }
}
activityOptions.options.setLaunchDisplayId(
(v != null && v.getDisplay() != null) ? v.getDisplay().getDisplayId()
: Display.DEFAULT_DISPLAY);
- addLaunchCookie(item, activityOptions.options);
+ if(app.lawnchair.LawnchairApp.isAtleastT()){
+ addLaunchCookie(item, activityOptions.options);
+ }
return activityOptions;
}
@Override
@@ -1098,8 +1103,6 @@ public class QuickstepLauncher extends Launcher {
@Override
public void dispatchDeviceProfileChanged() {
super.dispatchDeviceProfileChanged();
- Trace.instantForTrack(TRACE_TAG_APP, "QuickstepLauncher#DeviceProfileChanged",
- getDeviceProfile().toSmallString());
SystemUiProxy.INSTANCE.get(this).setLauncherAppIconSize(mDeviceProfile.iconSizePx);
if (mTaskbarManager != null) {
mTaskbarManager.debugWhyTaskbarNotDestroyed("QuickstepLauncher#onDeviceProfileChanged");
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index 09674f2bcd..70c5ee05ba 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -462,8 +462,6 @@ public final class RecentsActivity extends StatefulActivity {
@Override
public void dispatchDeviceProfileChanged() {
super.dispatchDeviceProfileChanged();
- Trace.instantForTrack(TRACE_TAG_APP, "RecentsActivity#DeviceProfileChanged",
- getDeviceProfile().toSmallString());
}
private AnimatorListenerAdapter resetStateListener() {
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index cc74047b75..2edeb88ca6 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -95,8 +95,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener {
private final RotationTouchHelper mRotationTouchHelper;
private final TaskStackChangeListener mPipListener;
// Cache for better performance since it doesn't change at runtime.
- private final boolean mCanImeRenderGesturalNavButtons =
- InputMethodService.canImeRenderGesturalNavButtons();
+ private final boolean mCanImeRenderGesturalNavButtons = LawnchairApp.isAtleastT() ? InputMethodService.canImeRenderGesturalNavButtons() : isImeRenderingNavButtons();
private final ArrayList mOnDestroyActions = new ArrayList<>();
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index dde5d55de4..23f43ee223 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -244,7 +244,9 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
if (!homeIsOnTop) {
options.setTransientLaunch();
}
- options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
+ if(app.lawnchair.LawnchairApp.isAtleastT()){
+ options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
+ }
UI_HELPER_EXECUTOR.execute(() -> mCtx.startActivity(intent, options.toBundle()));
} else {
UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
diff --git a/quickstep/src/com/android/quickstep/util/BaseDepthController.java b/quickstep/src/com/android/quickstep/util/BaseDepthController.java
index cecf58d105..c93e4e048e 100644
--- a/quickstep/src/com/android/quickstep/util/BaseDepthController.java
+++ b/quickstep/src/com/android/quickstep/util/BaseDepthController.java
@@ -163,7 +163,7 @@ public class BaseDepthController {
* Sets the specified app target surface to apply the blur to.
*/
protected void setSurface(SurfaceControl surface) {
- if (mSurface != surface) {
+ if (mSurface != surface && app.lawnchair.LawnchairApp.isAtleastT()) {
mSurface = surface;
applyDepthAndBlur();
}
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index b5af3c028e..41c8a9d1bf 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -242,13 +242,19 @@ public class LauncherPreviewRenderer extends ContextWrapper
mDpOrig = mDp;
}
- WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class)
- .getCurrentWindowMetrics().getWindowInsets();
- mInsets = new Rect(
- currentWindowInsets.getSystemWindowInsetLeft(),
- currentWindowInsets.getSystemWindowInsetTop(),
- currentWindowInsets.getSystemWindowInsetRight(),
- mDp.isTaskbarPresent ? 0 : currentWindowInsets.getSystemWindowInsetBottom());
+ if (Utilities.ATLEAST_R) {
+ WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class)
+ .getCurrentWindowMetrics().getWindowInsets();
+ mInsets = new Rect(
+ currentWindowInsets.getSystemWindowInsetLeft(),
+ currentWindowInsets.getSystemWindowInsetTop(),
+ currentWindowInsets.getSystemWindowInsetRight(),
+ currentWindowInsets.getSystemWindowInsetBottom());
+ } else {
+ mInsets = new Rect();
+ mInsets.left = mInsets.right = (mDp.widthPx - mDp.availableWidthPx) / 2;
+ mInsets.top = mInsets.bottom = (mDp.heightPx - mDp.availableHeightPx) / 2;
+ }
mDp.updateInsets(mInsets);
BaseIconFactory iconFactory =
diff --git a/systemUIShared/src/com/android/systemui/shared/system/BlurUtils.java b/systemUIShared/src/com/android/systemui/shared/system/BlurUtils.java
index 61b0e4d902..5cda38dad4 100644
--- a/systemUIShared/src/com/android/systemui/shared/system/BlurUtils.java
+++ b/systemUIShared/src/com/android/systemui/shared/system/BlurUtils.java
@@ -16,9 +16,8 @@
package com.android.systemui.shared.system;
-import static android.view.CrossWindowBlurListeners.CROSS_WINDOW_BLUR_SUPPORTED;
-
import android.app.ActivityManager;
+import android.os.Build;
import android.os.SystemProperties;
public abstract class BlurUtils {
@@ -29,7 +28,7 @@ public abstract class BlurUtils {
* @return {@code true} when supported.
*/
public static boolean supportsBlursOnWindows() {
- return CROSS_WINDOW_BLUR_SUPPORTED && ActivityManager.isHighEndGfx()
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && ActivityManager.isHighEndGfx()
&& !SystemProperties.getBoolean("persist.sysui.disableBlur", false);
}
}
diff --git a/systemUnFold/src/com/android/systemui/unfold/config/ResourceUnfoldTransitionConfig.kt b/systemUnFold/src/com/android/systemui/unfold/config/ResourceUnfoldTransitionConfig.kt
index c51372975a..08221ea650 100644
--- a/systemUnFold/src/com/android/systemui/unfold/config/ResourceUnfoldTransitionConfig.kt
+++ b/systemUnFold/src/com/android/systemui/unfold/config/ResourceUnfoldTransitionConfig.kt
@@ -21,21 +21,33 @@ import javax.inject.Singleton
@Singleton
class ResourceUnfoldTransitionConfig @Inject constructor() : UnfoldTransitionConfig {
+ private fun getBooleanResource(resourceName: String): Boolean {
+ val id = Resources.getSystem().getIdentifier(resourceName, "bool", "android")
+ return if (id != 0) {
+ Resources.getSystem().getBoolean(id)
+ } else {
+ false
+ }
+ }
+
+ private fun getIntResource(resourceName: String): Int {
+ val id = Resources.getSystem().getIdentifier(resourceName, "integer", "android")
+ return if (id != 0) {
+ Resources.getSystem().getInteger(id)
+ } else {
+ 0
+ }
+ }
+
override val isEnabled: Boolean by lazy {
- val id = Resources.getSystem()
- .getIdentifier("config_unfoldTransitionEnabled", "bool", "android")
- Resources.getSystem().getBoolean(id)
+ getBooleanResource("config_unfoldTransitionEnabled")
}
override val isHingeAngleEnabled: Boolean by lazy {
- val id = Resources.getSystem()
- .getIdentifier("config_unfoldTransitionHingeAngle", "bool", "android")
- Resources.getSystem().getBoolean(id)
+ getBooleanResource("config_unfoldTransitionHingeAngle")
}
override val halfFoldedTimeoutMillis: Int by lazy {
- val id = Resources.getSystem()
- .getIdentifier("config_unfoldTransitionHalfFoldedTimeout", "integer", "android")
- Resources.getSystem().getInteger(id)
+ getIntResource("config_unfoldTransitionHalfFoldedTimeout")
}
}