mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
fix: Allow building on SystemUI
This commit is contained in:
@@ -19,7 +19,6 @@ import android.graphics.Paint
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.forEach
|
||||
import com.android.app.tracing.traceSection
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
@@ -34,30 +33,22 @@ class DisableSubpixelTextTransitionListener(private val rootView: ViewGroup?) :
|
||||
|
||||
override fun onTransitionStarted() {
|
||||
isTransitionInProgress = true
|
||||
traceSection("subpixelFlagSetForTextView") {
|
||||
traceSection("subpixelFlagTraverseHierarchy") {
|
||||
getAllChildTextView(rootView, childrenTextViews)
|
||||
}
|
||||
traceSection("subpixelFlagDisableForTextView") {
|
||||
childrenTextViews.forEach { child ->
|
||||
val childTextView = child.get() ?: return@forEach
|
||||
childTextView.paintFlags = childTextView.paintFlags or Paint.SUBPIXEL_TEXT_FLAG
|
||||
}
|
||||
}
|
||||
getAllChildTextView(rootView, childrenTextViews)
|
||||
childrenTextViews.forEach { child ->
|
||||
val childTextView = child.get() ?: return@forEach
|
||||
childTextView.paintFlags = childTextView.paintFlags or Paint.SUBPIXEL_TEXT_FLAG
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTransitionFinished() {
|
||||
if (!isTransitionInProgress) return
|
||||
isTransitionInProgress = false
|
||||
traceSection("subpixelFlagEnableForTextView") {
|
||||
childrenTextViews.forEach { child ->
|
||||
val childTextView = child.get() ?: return@forEach
|
||||
childTextView.paintFlags =
|
||||
childTextView.paintFlags and Paint.SUBPIXEL_TEXT_FLAG.inv()
|
||||
}
|
||||
childrenTextViews.clear()
|
||||
childrenTextViews.forEach { child ->
|
||||
val childTextView = child.get() ?: return@forEach
|
||||
childTextView.paintFlags =
|
||||
childTextView.paintFlags and Paint.SUBPIXEL_TEXT_FLAG.inv()
|
||||
}
|
||||
childrenTextViews.clear()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,13 +28,13 @@ class UncaughtExceptionPreHandlerManager @Inject constructor() {
|
||||
* Verifies that the global handler is set in Thread. If not, sets is up.
|
||||
*/
|
||||
private fun checkGlobalHandlerSetup() {
|
||||
val currentHandler = Thread.getUncaughtExceptionPreHandler()
|
||||
val currentHandler = Thread.getDefaultUncaughtExceptionHandler()
|
||||
if (currentHandler != globalUncaughtExceptionPreHandler) {
|
||||
if (currentHandler is GlobalUncaughtExceptionHandler) {
|
||||
throw IllegalStateException("Two UncaughtExceptionPreHandlerManagers created")
|
||||
}
|
||||
currentHandler?.let { addHandler(it) }
|
||||
Thread.setUncaughtExceptionPreHandler(globalUncaughtExceptionPreHandler)
|
||||
Thread.setDefaultUncaughtExceptionHandler(globalUncaughtExceptionPreHandler)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +68,4 @@ class UncaughtExceptionPreHandlerManager @Inject constructor() {
|
||||
handleUncaughtException(thread, throwable)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.os.Looper
|
||||
import android.os.Process
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
//import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.dagger.qualifiers.Main
|
||||
import com.android.systemui.dagger.qualifiers.UiBackground
|
||||
import com.android.systemui.unfold.config.ResourceUnfoldTransitionConfig
|
||||
@@ -98,7 +98,8 @@ abstract class SystemUnfoldSharedModule {
|
||||
@Singleton
|
||||
fun unfoldTrackingContext(
|
||||
@UnfoldSingleThreadBg singleThreadBgExecutor: Executor,
|
||||
@Application applicationScope: CoroutineScope,
|
||||
// @Application
|
||||
applicationScope: CoroutineScope,
|
||||
): CoroutineScope {
|
||||
// tracking depends on being executed on a single thread so when changing it, ensure all
|
||||
// consumers are not accessing shared state
|
||||
|
||||
Reference in New Issue
Block a user