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

Commit 650f0453 authored by Matt Pietal's avatar Matt Pietal Committed by Android Build Coastguard Worker
Browse files

Remove dumpmanager from KeyguardStatusView

We just don't use it at all for any info, and it'll
fix a leak.

Fixes: 353503323
Test: check heapdump
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7daecd56bdb128f42efeb9841116004e7f140b08)
Merged-In: I40049fb2e37d422a92cbf896eeaecc4622abc1d5
Change-Id: I40049fb2e37d422a92cbf896eeaecc4622abc1d5
parent a39b9a80
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.android.systemui.res.R;
import com.android.systemui.shade.TouchLogger;
import com.android.systemui.statusbar.CrossFadeHelper;

import java.io.PrintWriter;
import java.util.Set;

/**
@@ -117,18 +116,6 @@ public class KeyguardStatusView extends GridLayout {
        return TouchLogger.logDispatchTouch(TAG, ev, super.dispatchTouchEvent(ev));
    }

    public void dump(PrintWriter pw, String[] args) {
        pw.println("KeyguardStatusView:");
        pw.println("  mDarkAmount: " + mDarkAmount);
        pw.println("  visibility: " + getVisibility());
        if (mClockView != null) {
            mClockView.dump(pw, args);
        }
        if (mKeyguardSlice != null) {
            mKeyguardSlice.dump(pw, args);
        }
    }

    @Override
    public ViewPropertyAnimator animate() {
        if (Build.IS_DEBUGGABLE) {
+1 −22
Original line number Diff line number Diff line
@@ -48,9 +48,7 @@ import com.android.app.animation.Interpolators;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.keyguard.KeyguardClockSwitch.ClockSize;
import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.Dumpable;
import com.android.systemui.animation.ViewHierarchyAnimator;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.MigrateClocksToBlueprint;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.plugins.clocks.ClockController;
@@ -70,15 +68,12 @@ import com.android.systemui.util.ViewController;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;

import java.io.PrintWriter;

import javax.inject.Inject;

/**
 * Injectable controller for {@link KeyguardStatusView}.
 */
public class KeyguardStatusViewController extends ViewController<KeyguardStatusView> implements
        Dumpable {
public class KeyguardStatusViewController extends ViewController<KeyguardStatusView> {
    private static final boolean DEBUG = KeyguardConstants.DEBUG;
    @VisibleForTesting static final String TAG = "KeyguardStatusViewController";
    private static final long STATUS_AREA_HEIGHT_ANIMATION_MILLIS = 133;
@@ -108,7 +103,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV

    private Boolean mSplitShadeEnabled = false;
    private Boolean mStatusViewCentered = true;
    private DumpManager mDumpManager;

    private final TransitionListenerAdapter mKeyguardStatusAlignmentTransitionListener =
            new TransitionListenerAdapter() {
@@ -176,7 +170,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
            KeyguardLogger logger,
            InteractionJankMonitor interactionJankMonitor,
            KeyguardInteractor keyguardInteractor,
            DumpManager dumpManager,
            PowerInteractor powerInteractor) {
        super(keyguardStatusView);
        mKeyguardSliceViewController = keyguardSliceViewController;
@@ -188,7 +181,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
                dozeParameters, screenOffAnimationController, /* animateYPos= */ true,
                logger.getBuffer());
        mInteractionJankMonitor = interactionJankMonitor;
        mDumpManager = dumpManager;
        mKeyguardInteractor = keyguardInteractor;
        mPowerInteractor = powerInteractor;
    }
@@ -222,7 +214,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
                    });
        }

        mDumpManager.registerDumpable(getInstanceName(), this);
        if (MigrateClocksToBlueprint.isEnabled()) {
            startCoroutines(EmptyCoroutineContext.INSTANCE);
            mView.setVisibility(View.GONE);
@@ -275,13 +266,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        mKeyguardClockSwitchController.setShownOnSecondaryDisplay(true);
    }

    /**
     * Called in notificationPanelViewController to avoid leak
     */
    public void onDestroy() {
        mDumpManager.unregisterDumpable(getInstanceName());
    }

    /**
     * Updates views on doze time tick.
     */
@@ -604,11 +588,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        return mKeyguardClockSwitchController.getClock();
    }

    @Override
    public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
        mView.dump(pw, args);
    }

    String getInstanceName() {
        return TAG + "#" + hashCode();
    }
+0 −4
Original line number Diff line number Diff line
@@ -1306,10 +1306,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    /** Updates the StatusBarViewController and updates any that depend on it. */
    public void updateStatusViewController() {
        // Re-associate the KeyguardStatusViewController
        if (mKeyguardStatusViewController != null) {
            mKeyguardStatusViewController.onDestroy();
        }

        if (MigrateClocksToBlueprint.isEnabled()) {
            // Need a shared controller until mKeyguardStatusViewController can be removed from
            // here, due to important state being set in that controller. Rebind in order to pick
+0 −3
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.widget.FrameLayout;

import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory;
import com.android.systemui.kosmos.KosmosJavaAdapter;
@@ -59,7 +58,6 @@ public class KeyguardStatusViewControllerBaseTest extends SysuiTestCase {
    @Mock protected KeyguardLogger mKeyguardLogger;
    @Mock protected KeyguardStatusViewController mControllerMock;
    @Mock protected ViewTreeObserver mViewTreeObserver;
    @Mock protected DumpManager mDumpManager;
    protected FakeKeyguardRepository mFakeKeyguardRepository;
    protected FakePowerRepository mFakePowerRepository;

@@ -90,7 +88,6 @@ public class KeyguardStatusViewControllerBaseTest extends SysuiTestCase {
                mKeyguardLogger,
                mKosmos.getInteractionJankMonitor(),
                deps.getKeyguardInteractor(),
                mDumpManager,
                PowerInteractorFactory.create(
                        mFakePowerRepository
                ).getPowerInteractor()) {
+0 −8
Original line number Diff line number Diff line
@@ -139,14 +139,6 @@ public class KeyguardStatusViewControllerTest extends KeyguardStatusViewControll
        verify(mKeyguardClockSwitchController, times(0)).setSplitShadeEnabled(true);
    }

    @Test
    public void correctlyDump() {
        mController.onInit();
        verify(mDumpManager).registerDumpable(eq(mController.getInstanceName()), eq(mController));
        mController.onDestroy();
        verify(mDumpManager, times(1)).unregisterDumpable(eq(mController.getInstanceName()));
    }

    @Test
    public void onInit_addsOnLayoutChangeListenerToClockSwitch() {
        when(mKeyguardStatusView.findViewById(R.id.status_view_media_container)).thenReturn(
Loading