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

Commit 5d28b2ec authored by Shane's avatar Shane
Browse files

Fix the activity leak issue

Fix the activity leak issue by removing the the messages in the handler.

Bug: 332876871
Test: atest ViewRootImplTest
Change-Id: I226941bf58a95dc8d7197b05569accc515ed424d
parent 18235e5f
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -9581,6 +9581,8 @@ public final class ViewRootImpl implements ViewParent,
            }
            mRemoved = true;
            mOnBackInvokedDispatcher.detachFromWindow();
            removeVrrMessages();
            if (mAdded) {
                dispatchDetachedFromWindow();
            }
@@ -12545,8 +12547,8 @@ public final class ViewRootImpl implements ViewParent,
                if (sToolkitFrameRateFunctionEnablingReadOnlyFlagValue) {
                    mFrameRateTransaction.setFrameRateCategory(mSurfaceControl,
                        frameRateCategory, false).applyAsyncUnsafe();
                    mLastPreferredFrameRateCategory = frameRateCategory;
                }
                mLastPreferredFrameRateCategory = frameRateCategory;
            }
        } catch (Exception e) {
            Log.e(mTag, "Unable to set frame rate category", e);
@@ -12606,8 +12608,8 @@ public final class ViewRootImpl implements ViewParent,
                if (sToolkitFrameRateFunctionEnablingReadOnlyFlagValue) {
                    mFrameRateTransaction.setFrameRate(mSurfaceControl, preferredFrameRate,
                    mFrameRateCompatibility).applyAsyncUnsafe();
                    mLastPreferredFrameRate = preferredFrameRate;
                }
                mLastPreferredFrameRate = preferredFrameRate;
            }
        } catch (Exception e) {
            Log.e(mTag, "Unable to set frame rate", e);
@@ -12849,4 +12851,10 @@ public final class ViewRootImpl implements ViewParent,
            mHasIdledMessage = true;
        }
    }
    private void removeVrrMessages() {
        mHandler.removeMessages(MSG_TOUCH_BOOST_TIMEOUT);
        mHandler.removeMessages(MSG_CHECK_INVALIDATION_IDLE);
        mHandler.removeMessages(MSG_FRAME_RATE_SETTING);
    }
}