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

Commit c64ec17e authored by Yeabkal Wubshit's avatar Yeabkal Wubshit
Browse files

Inline android.os.vibrator.use_vibrator_haptic_feedback

The flag has been enabled since ap2a, so we're removing the flag and all
code that was flagged away by this flag.

Bug: 295458007
Test: manual
Flag: EXEMPT flag removal
Change-Id: I313b07abbd152535d419afd4e408a7fa33c3275f
parent f9ff45f8
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
package: "android.os.vibrator"
container: "system"

flag {
    namespace: "haptics"
    name: "use_vibrator_haptic_feedback"
    description: "Enables performHapticFeedback to directly use the vibrator service instead of going through the window session"
    bug: "295459081"
}

flag {
    namespace: "haptics"
    name: "haptic_feedback_vibration_oem_customization_enabled"
+0 −9
Original line number Diff line number Diff line
@@ -140,15 +140,6 @@ interface IWindowSession {
    oneway void finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction,
            int seqId);

    @UnsupportedAppUsage
    boolean performHapticFeedback(int effectId, int flags, int privFlags);

    /**
     * Called by attached views to perform predefined haptic feedback without requiring VIBRATE
     * permission.
     */
    oneway void performHapticFeedbackAsync(int effectId, int flags, int privFlags);

    /**
     * Initiate the drag operation itself
     *
+2 −25
Original line number Diff line number Diff line
@@ -142,7 +142,6 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.Trace;
import android.os.Vibrator;
import android.os.vibrator.Flags;
import android.service.credentials.CredentialProviderService;
import android.sysprop.DisplayProperties;
import android.text.InputType;
@@ -5712,9 +5711,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private PointerIcon mMousePointerIcon;
    /** Vibrator for haptic feedback. */
    private Vibrator mVibrator;
    /**
     * @hide
     */
@@ -28672,14 +28668,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
        int privFlags = computeHapticFeedbackPrivateFlags();
        if (Flags.useVibratorHapticFeedback()) {
            if (!mAttachInfo.canPerformHapticFeedback()) {
                return false;
            }
            getSystemVibrator().performHapticFeedback(feedbackConstant,
                    "View#performHapticFeedback", flags, privFlags);
            return true;
        }
        return mAttachInfo.mRootCallbacks.performHapticFeedback(feedbackConstant, flags, privFlags);
    }
@@ -28711,16 +28699,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                feedbackConstant, inputDeviceId, inputSource, flags, privFlags);
    }
    private Vibrator getSystemVibrator() {
        if (mVibrator != null) {
            return mVibrator;
        }
        return mVibrator = mContext.getSystemService(Vibrator.class);
    }
    private boolean isPerformHapticFeedbackSuppressed(int feedbackConstant, int flags) {
        if (feedbackConstant == HapticFeedbackConstants.NO_HAPTICS
                || mAttachInfo == null) {
                || mAttachInfo == null
                || mAttachInfo.mSession == null) {
            return true;
        }
        //noinspection SimplifiableIfStatement
@@ -32342,11 +32324,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            return events;
        }
        private boolean canPerformHapticFeedback() {
            return mSession != null
                    && (mDisplay.getFlags() & Display.FLAG_TOUCH_FEEDBACK_DISABLED) == 0;
        }
        @Nullable
        ScrollCaptureInternal getScrollCaptureInternal() {
            if (mScrollCaptureInternal != null) {
+3 −19
Original line number Diff line number Diff line
@@ -362,14 +362,6 @@ public final class ViewRootImpl implements ViewParent,
     */
    private static final boolean ENABLE_INPUT_LATENCY_TRACKING = true;
    /**
     * Controls whether to use the new oneway performHapticFeedback call. This returns
     * true in a few more conditions, but doesn't affect which haptics happen. Notably, it
     * makes the call to performHapticFeedback non-blocking, which reduces potential UI jank.
     * This is intended as a temporary flag, ultimately becoming permanently 'true'.
     */
    private static final boolean USE_ASYNC_PERFORM_HAPTIC_FEEDBACK = true;
    /**
     * Whether the client (system UI) is handling the transient gesture and the corresponding
     * animation.
@@ -9675,17 +9667,9 @@ public final class ViewRootImpl implements ViewParent,
            return false;
        }
        try {
            if (USE_ASYNC_PERFORM_HAPTIC_FEEDBACK) {
                mWindowSession.performHapticFeedbackAsync(effectId, flags, privFlags);
        getSystemVibrator().performHapticFeedback(
                effectId, "ViewRootImpl#performHapticFeedback", flags, privFlags);
        return true;
            } else {
                // Original blocking binder call path.
                return mWindowSession.performHapticFeedback(effectId, flags, privFlags);
            }
        } catch (RemoteException e) {
            return false;
        }
    }
    @Override
+0 −10
Original line number Diff line number Diff line
@@ -503,16 +503,6 @@ public class WindowlessWindowManager implements IWindowSession {
        }
    }

    @Override
    public boolean performHapticFeedback(int effectId, int flags, int privFlags) {
        return false;
    }

    @Override
    public void performHapticFeedbackAsync(int effectId, int flags, int privFlags) {
        performHapticFeedback(effectId, flags, privFlags);
    }

    @Override
    public android.os.IBinder performDrag(android.view.IWindow window, int flags,
            android.view.SurfaceControl surface, int touchSource, int touchDeviceId,
Loading