Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09c9ff42 authored by Anton Potapov's avatar Anton Potapov Committed by Automerger Merge Worker
Browse files

Merge "Add system ui background handlers dispatch and delivery logging...

Merge "Add system ui background handlers dispatch and delivery logging thresholds" into udc-dev am: 02557142

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23201203



Change-Id: I00f7b765e15a5d603612ebe97bd7a183b6a17225
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b1764868 02557142
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -166,21 +166,19 @@ open class UserTrackerImpl internal constructor(
            }
            }


            override fun onUserSwitching(newUserId: Int, reply: IRemoteCallback?) {
            override fun onUserSwitching(newUserId: Int, reply: IRemoteCallback?) {
                backgroundHandler.run {
                handleUserSwitching(newUserId)
                handleUserSwitching(newUserId)
                reply?.sendResult(null)
                reply?.sendResult(null)
            }
            }
            }


            override fun onUserSwitchComplete(newUserId: Int) {
            override fun onUserSwitchComplete(newUserId: Int) {
                backgroundHandler.run {
                handleUserSwitchComplete(newUserId)
                handleUserSwitchComplete(newUserId)
            }
            }
            }
        }, TAG)
        }, TAG)
    }
    }


    @WorkerThread
    protected open fun handleBeforeUserSwitching(newUserId: Int) {
    protected open fun handleBeforeUserSwitching(newUserId: Int) {
        Assert.isNotMainThread()
        setUserIdInternal(newUserId)
        setUserIdInternal(newUserId)
    }
    }


+19 −3
Original line number Original line Diff line number Diff line
@@ -29,18 +29,28 @@ import com.android.systemui.dagger.qualifiers.BroadcastRunning;
import com.android.systemui.dagger.qualifiers.LongRunning;
import com.android.systemui.dagger.qualifiers.LongRunning;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.Main;


import dagger.Module;
import dagger.Provides;

import java.util.concurrent.Executor;
import java.util.concurrent.Executor;


import javax.inject.Named;
import javax.inject.Named;


import dagger.Module;
import dagger.Provides;

/**
/**
 * Dagger Module for classes found within the concurrent package.
 * Dagger Module for classes found within the concurrent package.
 */
 */
@Module
@Module
public abstract class SysUIConcurrencyModule {
public abstract class SysUIConcurrencyModule {

    // Slow BG executor can potentially affect UI if UI is waiting for an updated state from this
    // thread
    private static final Long BG_SLOW_DISPATCH_THRESHOLD = 1000L;
    private static final Long BG_SLOW_DELIVERY_THRESHOLD = 1000L;
    private static final Long LONG_SLOW_DISPATCH_THRESHOLD = 2500L;
    private static final Long LONG_SLOW_DELIVERY_THRESHOLD = 2500L;
    private static final Long BROADCAST_SLOW_DISPATCH_THRESHOLD = 1000L;
    private static final Long BROADCAST_SLOW_DELIVERY_THRESHOLD = 1000L;

    /** Background Looper */
    /** Background Looper */
    @Provides
    @Provides
    @SysUISingleton
    @SysUISingleton
@@ -49,6 +59,8 @@ public abstract class SysUIConcurrencyModule {
        HandlerThread thread = new HandlerThread("SysUiBg",
        HandlerThread thread = new HandlerThread("SysUiBg",
                Process.THREAD_PRIORITY_BACKGROUND);
                Process.THREAD_PRIORITY_BACKGROUND);
        thread.start();
        thread.start();
        thread.getLooper().setSlowLogThresholdMs(BG_SLOW_DISPATCH_THRESHOLD,
                BG_SLOW_DELIVERY_THRESHOLD);
        return thread.getLooper();
        return thread.getLooper();
    }
    }


@@ -60,6 +72,8 @@ public abstract class SysUIConcurrencyModule {
        HandlerThread thread = new HandlerThread("BroadcastRunning",
        HandlerThread thread = new HandlerThread("BroadcastRunning",
                Process.THREAD_PRIORITY_BACKGROUND);
                Process.THREAD_PRIORITY_BACKGROUND);
        thread.start();
        thread.start();
        thread.getLooper().setSlowLogThresholdMs(BROADCAST_SLOW_DISPATCH_THRESHOLD,
                BROADCAST_SLOW_DELIVERY_THRESHOLD);
        return thread.getLooper();
        return thread.getLooper();
    }
    }


@@ -71,6 +85,8 @@ public abstract class SysUIConcurrencyModule {
        HandlerThread thread = new HandlerThread("SysUiLng",
        HandlerThread thread = new HandlerThread("SysUiLng",
                Process.THREAD_PRIORITY_BACKGROUND);
                Process.THREAD_PRIORITY_BACKGROUND);
        thread.start();
        thread.start();
        thread.getLooper().setSlowLogThresholdMs(LONG_SLOW_DISPATCH_THRESHOLD,
                LONG_SLOW_DELIVERY_THRESHOLD);
        return thread.getLooper();
        return thread.getLooper();
    }
    }