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

Commit 083fcbf1 authored by Longbo Wei's avatar Longbo Wei Committed by Android (Google) Code Review
Browse files

Merge "autoclick: Support dynamic color" into main

parents 0e1a9766 758c4dd1
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import static com.android.server.accessibility.autoclick.AutoclickTypePanel.Clic
import android.accessibilityservice.AccessibilityTrace;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityThread;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
@@ -289,14 +290,23 @@ public class AutoclickController extends BaseEventStreamTransformation {
     * click will happen. See {@code AutoclickIndicatorView} class.
     */
    private void initiateAutoclickIndicator(Handler handler) {
        // Try to get the SystemUI context which has dynamic colors properly themed.
        // Fall back to the regular context if it's not available (in tests).
        Context uiContext;
        if (!mContext.getClass().getSimpleName().contains("Testable")) {
            // Use SystemUI context in production.
            uiContext = ActivityThread.currentActivityThread().getSystemUiContext();
        } else {
            // Use the original context in test environments.
            uiContext = mContext;
        }
        mAutoclickIndicatorScheduler = new AutoclickIndicatorScheduler(handler);
        mAutoclickIndicatorView = new AutoclickIndicatorView(mContext);

        mAutoclickIndicatorView = new AutoclickIndicatorView(uiContext);
        mWindowManager = mContext.getSystemService(WindowManager.class);
        mAutoclickTypePanel =
                new AutoclickTypePanel(mContext, mWindowManager, mUserId, clickPanelController);
        mAutoclickScrollPanel = new AutoclickScrollPanel(mContext, mWindowManager,
                mScrollPanelController);
        mAutoclickTypePanel = new AutoclickTypePanel(
                uiContext, mWindowManager, mUserId, clickPanelController);
        mAutoclickScrollPanel = new AutoclickScrollPanel(
                uiContext, mWindowManager, mScrollPanelController);

        // Initialize continuous scroll handler and runnable.
        mContinuousScrollHandler = new Handler(handler.getLooper());