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

Commit 6eeb2228 authored by Ahmad Khalil's avatar Ahmad Khalil Committed by Android (Google) Code Review
Browse files

Merge "Fix Activity leak via ViewRootImpl" into main

parents 70b8d380 c1e51da0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -9349,6 +9349,16 @@ public final class ViewRootImpl implements ViewParent,
        return mVibrator;
    }
    /**
     * Clears the system vibrator.
     *
     * <p>This method releases the reference to the system vibrator. It's crucial to call this
     * method when the vibrator is no longer needed to prevent any potential memory leaks.
     */
    public void clearSystemVibrator() {
        mVibrator = null;
    }
    private @Nullable AutofillManager getAutofillManager() {
        if (mView instanceof ViewGroup) {
            ViewGroup decorView = (ViewGroup) mView;
+11 −0
Original line number Diff line number Diff line
@@ -461,3 +461,14 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "clear_system_vibrator"
    namespace: "windowing_frontend"
    description: "Clears the system vibrator before attaching new window, to avoid leaks."
    bug: "393190314"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -436,6 +436,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            if (viewRoot != null) {
                // Clear the old callbacks and attach to the new window.
                viewRoot.getOnBackInvokedDispatcher().clear();
                if (Flags.clearSystemVibrator()) {
                    viewRoot.clearSystemVibrator();
                }
                onViewRootImplSet(viewRoot);
            }
        }