mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Remove redundant instances of depth controller.
During each app launch, a new `MyDepthController` is instantiated, which registers two of its methods as listeners for cross window blur and opaqueness. This controller's usefulness spans that specific animation only, but the listeners are never unregistered. This creates conflicts when an opaqueness signal happens, which cause the background to flicker (see videos). Bug: 283335820 Test: manual, see videos in the bug Flag: not needed, bug fix Change-Id: I3dcb0b8ff0aa77bf3183a926889d0131b17bcaa4
This commit is contained in:
@@ -84,8 +84,7 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener);
|
||||
mLauncher.getScrimView().removeOpaquenessListener(mOpaquenessListener);
|
||||
removeSecondaryListeners();
|
||||
}
|
||||
};
|
||||
rootView.addOnAttachStateChangeListener(mOnAttachListener);
|
||||
@@ -95,6 +94,27 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up after this controller so it can be garbage collected without leaving traces.
|
||||
*/
|
||||
public void dispose() {
|
||||
removeSecondaryListeners();
|
||||
|
||||
if (mLauncher.getRootView() != null && mOnAttachListener != null) {
|
||||
mLauncher.getRootView().removeOnAttachStateChangeListener(mOnAttachListener);
|
||||
mOnAttachListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void removeSecondaryListeners() {
|
||||
if (mCrossWindowBlurListener != null) {
|
||||
CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener);
|
||||
}
|
||||
if (mOpaquenessListener != null) {
|
||||
mLauncher.getScrimView().removeOpaquenessListener(mOpaquenessListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the underlying activity is started or not
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user