Patches for crashes in Android Q, R and S (#3728)

* Initial Patches for to support Q,R and S

- TODO create Widget Factory Holder

* Remove tracing

* Fixed Resources$NotFoundException

Lawnchair (Debug) bug report 15-Nov-2023 2:32:03 pm
version: 13 Dev (#2291) (13)
commit: c5bed50
build.brand: samsung
build.device: m30s
build.display: RP1A.200720.012.M307FXXS4CWC2
build.fingerprint: samsung/m30sdd/m30s:11/RP1A.200720.012/M307FXXS4CWC2:user/release-keys
build.hardware: exynos9611
build.id: RP1A.200720.012
build.manufacturer: samsung
build.model: SM-M307F
build.product: m30sdd
build.type: user
version.codename: REL
version.incremental: M307FXXS4CWC2
version.release: 11
version.sdk_int: 30
display.density_dpi: 420
isRecentsEnabled: false

error: Uncaught exception

android.view.InflateException: Binary XML file line #27 in app.lawnchair.debug:layout/task_desktop: Resource ID #0x106002f
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x106002f
	at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:255)
	at android.content.res.Resources.getColor(Resources.java:1169)
	at com.android.quickstep.views.DesktopTaskView.onFinishInflate(DesktopTaskView.java:124)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1134)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
	at com.android.launcher3.util.ViewPool.inflateNewView(ViewPool.java:106)
	at com.android.launcher3.util.ViewPool.lambda$initPool$1(ViewPool.java:69)
	at com.android.launcher3.util.ViewPool.$r8$lambda$wSRnQcMZiOmM7xwf4gm88rNehhg(ViewPool.java:0)
	at com.android.launcher3.util.ViewPool$$ExternalSyntheticLambda1.run(R8$$SyntheticClass:0)
	at java.lang.Thread.run(Thread.java:923)

* Fix java.lang.NoClassDefFoundError OnBackInvokedCallback$Stub

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/window/IOnBackInvokedCallback$Stub;
                                                                                                    	at com.android.launcher3.QuickstepTransitionManager.<init>(QuickstepTransitionManager.java:265)
                                                                                                    	at com.android.launcher3.uioverrides.QuickstepLauncher.buildAppTransitionManager(QuickstepLauncher.java:302)
                                                                                                    	at com.android.launcher3.uioverrides.QuickstepLauncher.setupViews(QuickstepLauncher.java:236)
                                                                                                    	at app.lawnchair.LawnchairLauncher.setupViews(LawnchairLauncher.kt:244)
                                                                                                    	at com.android.launcher3.Launcher.onCreate(Launcher.java:518)
                                                                                                    	at com.android.launcher3.uioverrides.QuickstepLauncher.onCreate(QuickstepLauncher.java:527)
                                                                                                    	at app.lawnchair.LawnchairLauncher.onCreate(LawnchairLauncher.kt:186)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:8057)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:8037)
                                                                                                    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3688)
                                                                                                    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864)
                                                                                                    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                    	at android.os.Looper.loop(Looper.java:288)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7870)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
                                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.window.IOnBackInvokedCallback$Stub" on path: DexPathList[[zip file "/data/app/~~xd_Rtvu8nzsZdmkjP4cE7A==/app.lawnchair.debug-LCjip_oNAIceiLCO_DoA3g==/base.apk"],nativeLibraryDirectories=[/data/app/~~xd_Rtvu8nzsZdmkjP4cE7A==/app.lawnchair.debug-LCjip_oNAIceiLCO_DoA3g==/lib/arm64, /data/app/~~xd_Rtvu8nzsZdmkjP4cE7A==/app.lawnchair.debug-LCjip_oNAIceiLCO_DoA3g==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64, /system/product/lib64]]
                                                                                                    	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
                                                                                                    	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                                                    	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                                                    	at com.android.launcher3.QuickstepTransitionManager.<init>(QuickstepTransitionManager.java:265) 
                                                                                                    	at com.android.launcher3.uioverrides.QuickstepLauncher.buildAppTransitionManager(QuickstepLauncher.java:302) 
                                                                                                    	at com.android.launcher3.uioverrides.QuickstepLauncher.setupViews(QuickstepLauncher.java:236) 
                                                                                                    	at app.lawnchair.LawnchairLauncher.setupViews(LawnchairLauncher.kt:244) 
                                                                                                    	at com.android.launcher3.Launcher.onCreate(Launcher.java:518) 
                                                                                                    	at com.android.launcher3.uioverrides.QuickstepLauncher.onCreate(QuickstepLauncher.java:527) 
                                                                                                    	at app.lawnchair.LawnchairLauncher.onCreate(LawnchairLauncher.kt:186) 
                                                                                                    	at android.app.Activity.performCreate(Activity.java:8057) 
                                                                                                    	at android.app.Activity.performCreate(Activity.java:8037) 
                                                                                                    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341) 
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3688) 
                                                                                                    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864) 
                                                                                                    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253) 
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:201) 
                                                                                                    	at android.os.Looper.loop(Looper.java:288) 
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7870) 
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

* Clean up and add our own window manager proxy

- Add our own LawnchairWindowManagerProxy based on SystemWindowManagerProxy to reduce conflict when merging aosp

* Keep androidx.core.app.CoreComponentFactory

java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path: DexPathList[[],nativeLibraryDirectories=[/data/app/app.lawnchair.debug-

* Fix crash on LauncherPreviewRenderer on A10

FATAL EXCEPTION: main
                                                                                                    Process: app.lawnchair.debug, PID: 8873
                                                                                                    java.lang.NoSuchMethodError: No interface method getCurrentWindowMetrics()Landroid/view/WindowMetrics; in class Landroid/view/WindowManager; or its super classes (declaration of 'android.view.WindowManager' appears in /system/framework/framework.jar!classes3.dex)
                                                                                                    	at com.android.launcher3.graphics.LauncherPreviewRenderer.<init>(LauncherPreviewRenderer.java:246)
                                                                                                    	at app.lawnchair.views.LauncherPreviewView.renderView(LauncherPreviewView.kt:138)
                                                                                                    	at app.lawnchair.views.LauncherPreviewView.loadModelData$lambda$3$lambda$2(LauncherPreviewView.kt:109)
                                                                                                    	at app.lawnchair.views.LauncherPreviewView.$r8$lambda$cYc0chie-2LAfMVJGiDN9mdIeDA(Unknown Source:0)
                                                                                                    	at app.lawnchair.views.LauncherPreviewView$$ExternalSyntheticLambda1.run(Unknown Source:6)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:883)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                                    	at android.os.Looper.loop(Looper.java:214)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7356)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

* Add our own LawnchairWidgetHolder

* Reformat

* improved readability

* Pass spotless

* Fix Resources$NotFoundException

Lawnchair (Debug) bug report 19 Nov 2023 12:06:33 pm
version: 13 Dev (#2327) (13)
commit: 9683178
build.brand: Teclast
build.device: T40Pro_2022_EEA
build.display: V1.02_20230826
build.fingerprint: Teclast/T40Pro_2022_EEA/T40Pro_2022_EEA:12/SP1A.210812.016/221010:user/release-keys
build.hardware: ums9230_1h10
build.id: SP1A.210812.016
build.manufacturer: Teclast
build.model: T40 Pro_EEA
build.product: T40Pro_2022_EEA
build.type: user
version.codename: REL
version.incremental: 221010
version.release: 12
version.sdk_int: 31
display.density_dpi: 280
isRecentsEnabled: false

error: Uncaught exception

java.lang.RuntimeException: Unable to start activity ComponentInfo{app.lawnchair.debug/app.lawnchair.LawnchairLauncher}: android.content.res.Resources$NotFoundException: Resource ID #0x7f0700b8 type #0x5 is not valid
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3683)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3840)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:105)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:136)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7941)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:553)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f0700b8 type #0x5 is not valid
at android.content.res.Resources.getFloat(Resources.java:1224)
at com.android.launcher3.DeviceProfile.(DeviceProfile.java:397)
at com.android.launcher3.DeviceProfile$Builder.build(DeviceProfile.java:1938)
at com.android.launcher3.InvariantDeviceProfile.initGrid(InvariantDeviceProfile.java:441)
at com.android.launcher3.InvariantDeviceProfile.initGrid(InvariantDeviceProfile.java:339)
at com.android.launcher3.InvariantDeviceProfile.initGrid(InvariantDeviceProfile.java:353)
at com.android.launcher3.InvariantDeviceProfile.(InvariantDeviceProfile.java:213)
at com.android.launcher3.InvariantDeviceProfile.$r8$lambda$DNcXzmawjoq65q3wgQi9M48DryY(Unknown Source:2)
at com.android.launcher3.InvariantDeviceProfile$$ExternalSyntheticLambda4.get(Unknown Source:0)
at com.android.launcher3.util.MainThreadInitializedObject.lambda$get$0(MainThreadInitializedObject.java:60)
at com.android.launcher3.util.MainThreadInitializedObject.$r8$lambda$xtvr3aByNYHC2nsBQ97HC1SKg4A(Unknown Source:0)
at com.android.launcher3.util.MainThreadInitializedObject$$ExternalSyntheticLambda0.get(Unknown Source:4)
at com.android.launcher3.util.TraceHelper.allowIpcs(TraceHelper.java:84)
at com.android.launcher3.util.MainThreadInitializedObject.get(MainThreadInitializedObject.java:59)
at com.android.launcher3.LauncherAppState.(LauncherAppState.java:166)
at com.android.launcher3.LauncherAppState.(LauncherAppState.java:109)
at com.android.launcher3.LauncherAppState$$ExternalSyntheticLambda12.get(Unknown Source:2)
at com.android.launcher3.util.MainThreadInitializedObject.lambda$get$0(MainThreadInitializedObject.java:60)
at com.android.launcher3.util.MainThreadInitializedObject.$r8$lambda$xtvr3aByNYHC2nsBQ97HC1SKg4A(Unknown Source:0)
at com.android.launcher3.util.MainThreadInitializedObject$$ExternalSyntheticLambda0.get(Unknown Source:4)
at com.android.launcher3.util.TraceHelper.allowIpcs(TraceHelper.java:84)
at com.android.launcher3.util.MainThreadInitializedObject.get(MainThreadInitializedObject.java:59)
at com.android.launcher3.LauncherAppState.getInstance(LauncherAppState.java:97)
at com.android.launcher3.Launcher.onCreate(Launcher.java:492)
at com.android.launcher3.uioverrides.QuickstepLauncher.onCreate(QuickstepLauncher.java:527)
at app.lawnchair.LawnchairLauncher.onCreate(LawnchairLauncher.kt:205)
at android.app.Activity.performCreate(Activity.java:8060)
at android.app.Activity.performCreate(Activity.java:8040)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3653)
... 12 more

* Keep InputMethodService.canImeRenderGesturalNavButtons

---------

Co-authored-by: Goooler <wangzongler@gmail.com>
This commit is contained in:
John Andrew Camu
2023-11-20 14:46:36 +08:00
committed by GitHub
parent d1fa0c3022
commit e994660cb0
19 changed files with 205 additions and 51 deletions
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="system_accent1_100">@android:color/transparent</color>
<color name="accent_primary_device_default">@android:color/transparent</color>
</resources>
+4
View File
@@ -39,6 +39,8 @@
<string name="task_overlay_factory_class" translatable="false">app.lawnchair.overview.TaskOverlayFactoryImpl</string>
<string name="wallpaper_picker_package" translatable="false">com.android.wallpaper</string>
<string name="wallpaper_picker_package_alt" translatable="false">com.google.android.apps.wallpaper</string>
<string name="widget_holder_factory_class" translatable="false">app.lawnchair.factory.LawnchairWidgetHolder$LawnchairHolderFactory</string>
<string name="window_manager_proxy_class" translatable="false">app.lawnchair.util.LawnchairWindowManagerProxy</string>
<bool name="config_header_protection_supported">true</bool>
@@ -116,4 +118,6 @@
<item name="config_default_drawer_cell_height_factor" type="dimen" format="float">1.0</item>
<item name="config_default_search_max_result_count" type="dimen" format="integer">5</item>
<!-- The max scale for the wallpaper when it's zoomed in -->
<item name="config_wallpaperMaxScale" format="float" type="dimen">1.10</item>
</resources>
@@ -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
@@ -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()
@@ -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)
}
}
}
}
@@ -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<CachedDisplayInfo, Array<WindowBounds>> {
if (LawnchairApp.isAtleastT) {
val result = ArrayMap<CachedDisplayInfo, Array<WindowBounds>>()
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)
}
}
+1
View File
@@ -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.** {
@@ -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);
}
}
}
}
@@ -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
@@ -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,
@@ -291,8 +291,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
@Override
public void dispatchDeviceProfileChanged() {
super.dispatchDeviceProfileChanged();
Trace.instantForTrack(TRACE_TAG_APP, "TaskbarActivityContext#DeviceProfileChanged",
getDeviceProfile().toSmallString());
}
/**
@@ -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");
@@ -462,8 +462,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
@Override
public void dispatchDeviceProfileChanged() {
super.dispatchDeviceProfileChanged();
Trace.instantForTrack(TRACE_TAG_APP, "RecentsActivity#DeviceProfileChanged",
getDeviceProfile().toSmallString());
}
private AnimatorListenerAdapter resetStateListener() {
@@ -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<Runnable> mOnDestroyActions = new ArrayList<>();
@@ -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()
@@ -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();
}
@@ -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 =
@@ -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);
}
}
@@ -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")
}
}