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

Commit c6472363 authored by Manali Bhutiyani's avatar Manali Bhutiyani
Browse files

[displayModeDirector] Ignore UDFPS vote when configured to do so

This change introduces a new value in config.xml to allow ignoring the
udfps vote.

It also makes changes to Udfps controller code to ignore refresh rate,
and set LHBM unconditionally, when configured to do so.

Bug: 250979028
Test: manually check that fix works
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/display

Change-Id: Id4c5e12b5e55d704f8d456891b12186f27634fee
parent 60348db3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2890,6 +2890,9 @@
         mirror the content of the default display. -->
    <bool name="config_localDisplaysMirrorContent">true</bool>

    <!-- When true, udfps vote is ignored. This feature is disabled by default. -->
    <bool name="config_ignoreUdfpsVote">false</bool>

    <!-- Controls if local secondary displays should be private or not. Value specified in the array
         represents physical port address of each display and display in this list will be marked
         as private. {@see android.view.Display#FLAG_PRIVATE} -->
+1 −0
Original line number Diff line number Diff line
@@ -414,6 +414,7 @@
  <java-symbol type="bool" name="config_guestUserAutoCreated" />
  <java-symbol type="bool" name="config_guestUserAllowEphemeralStateChange" />
  <java-symbol type="bool" name="config_localDisplaysMirrorContent" />
  <java-symbol type="bool" name="config_ignoreUdfpsVote" />
  <java-symbol type="array" name="config_localPrivateDisplayPorts" />
  <java-symbol type="integer" name="config_defaultDisplayDefaultColorMode" />
  <java-symbol type="bool" name="config_enableAppWidgetService" />
+21 −11
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import android.view.accessibility.AccessibilityManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.InstanceId;
import com.android.internal.util.LatencyTracker;
@@ -171,6 +172,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
    @NonNull private final SecureSettings mSecureSettings;
    @NonNull private final UdfpsUtils mUdfpsUtils;
    @NonNull private final InputManager mInputManager;
    private final boolean mIgnoreRefreshRate;

    // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
    // sensors, this, in addition to a lot of the code here, will be updated.
@@ -816,6 +818,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        mExecution = execution;
        mVibrator = vibrator;
        mInflater = inflater;
        mIgnoreRefreshRate = mContext.getResources()
                    .getBoolean(R.bool.config_ignoreUdfpsVote);
        // The fingerprint manager is queried for UDFPS before this class is constructed, so the
        // fingerprint manager should never be null.
        mFingerprintManager = checkNotNull(fingerprintManager);
@@ -1069,6 +1073,18 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        return mOnFingerDown;
    }

    private void dispatchOnUiReady(long requestId) {
        if (mAlternateTouchProvider != null) {
            mBiometricExecutor.execute(() -> {
                mAlternateTouchProvider.onUiReady();
                mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
            });
        } else {
            mFingerprintManager.onUiReady(requestId, mSensorProps.sensorId);
            mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
        }
    }

    private void onFingerDown(
            long requestId,
            int x,
@@ -1146,17 +1162,11 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        Trace.endAsyncSection("UdfpsController.e2e.onPointerDown", 0);
        final UdfpsView view = mOverlay.getOverlayView();
        if (view != null && isOptical()) {
            view.configureDisplay(() -> {
                if (mAlternateTouchProvider != null) {
                    mBiometricExecutor.execute(() -> {
                        mAlternateTouchProvider.onUiReady();
                        mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
                    });
            if (mIgnoreRefreshRate) {
                dispatchOnUiReady(requestId);
            } else {
                    mFingerprintManager.onUiReady(requestId, mSensorProps.sensorId);
                    mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
                view.configureDisplay(() -> dispatchOnUiReady(requestId));
            }
            });
        }

        for (Callback cb : mCallbacks) {
+9 −1
Original line number Diff line number Diff line
@@ -2643,7 +2643,15 @@ public class DisplayModeDirector {
        public void observe() {
            StatusBarManagerInternal statusBar =
                    LocalServices.getService(StatusBarManagerInternal.class);
            if (statusBar != null) {
            if (statusBar == null) {
                return;
            }

            // Allow UDFPS vote by registering callback, only
            // if the device is configured to not ignore UDFPS vote.
            boolean ignoreUdfpsVote = mContext.getResources()
                        .getBoolean(R.bool.config_ignoreUdfpsVote);
            if (!ignoreUdfpsVote) {
                statusBar.setUdfpsRefreshRateCallback(this);
            }
        }