From 657d50ab9218a3755d0ea5b8dce8a0946112b6fb Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sat, 20 Jun 2020 20:48:25 -0700 Subject: [PATCH] Add additional logging for region sampling helper Change-Id: Icb2759d56fb98a2e961195c601b9b5dc7aff1450 Bug: 158666327 Test: adb shell dumpsys activity service SystemUIService --- .../statusbar/phone/NavigationBarTransitions.java | 3 --- .../systemui/statusbar/phone/NavigationBarView.java | 3 +++ .../systemui/statusbar/phone/RegionSamplingHelper.java | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java index 1a6d3d770f9f1..1f509549efd18 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java @@ -57,7 +57,6 @@ public final class NavigationBarTransitions extends BarTransitions implements } private final NavigationBarView mView; - private final IStatusBarService mBarService; private final LightBarTransitionsController mLightTransitionsController; private final boolean mAllowAutoDimWallpaperNotVisible; private boolean mWallpaperVisible; @@ -82,8 +81,6 @@ public final class NavigationBarTransitions extends BarTransitions implements public NavigationBarTransitions(NavigationBarView view, CommandQueue commandQueue) { super(view, R.drawable.nav_background); mView = view; - mBarService = IStatusBarService.Stub.asInterface( - ServiceManager.getService(Context.STATUS_BAR_SERVICE)); mLightTransitionsController = new LightBarTransitionsController( view.getContext(), this, commandQueue); mAllowAutoDimWallpaperNotVisible = view.getContext().getResources() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 84aecd4e07593..6dfc4d26786aa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -139,6 +139,7 @@ public class NavigationBarView extends FrameLayout implements private boolean mInCarMode = false; private boolean mDockedStackExists; private boolean mImeVisible; + private boolean mScreenOn = true; private final SparseArray mButtonDispatchers = new SparseArray<>(); private final ContextualButtonGroup mContextualButtonGroup; @@ -562,6 +563,7 @@ public class NavigationBarView extends FrameLayout implements /** To be called when screen lock/unlock state changes */ public void onScreenStateChanged(boolean isScreenOn) { + mScreenOn = isScreenOn; if (isScreenOn) { if (isGesturalModeOnDefaultDisplay(getContext(), mNavBarMode)) { mRegionSamplingHelper.start(mSamplingBounds); @@ -1199,6 +1201,7 @@ public class NavigationBarView extends FrameLayout implements dumpButton(pw, "a11y", getAccessibilityButton()); pw.println(" }"); + pw.println(" mScreenOn: " + mScreenOn); mContextualButtonGroup.dump(pw); mRecentsOnboarding.dump(pw); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/RegionSamplingHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/RegionSamplingHelper.java index bf52a7ae2bf93..3c8aa86dd2096 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/RegionSamplingHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/RegionSamplingHelper.java @@ -41,7 +41,6 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, private final View mSampledView; private final CompositionSamplingListener mSamplingListener; - private final Runnable mUpdateSamplingListener = this::updateSamplingListener; /** * The requested sampling bounds that we want to sample from @@ -59,6 +58,7 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, private float mLastMedianLuma; private float mCurrentMedianLuma; private boolean mWaitingOnDraw; + private boolean mIsDestroyed; // Passing the threshold of this luminance value will make the button black otherwise white private final float mLuminanceThreshold; @@ -130,6 +130,7 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, void stopAndDestroy() { stop(); mSamplingListener.destroy(); + mIsDestroyed = true; } @Override @@ -229,12 +230,17 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, pw.println(" sampleView isAttached: " + mSampledView.isAttachedToWindow()); pw.println(" sampleView isScValid: " + (mSampledView.isAttachedToWindow() ? mSampledView.getViewRootImpl().getSurfaceControl().isValid() - : "false")); + : "notAttached")); + pw.println(" mSamplingEnabled: " + mSamplingEnabled); pw.println(" mSamplingListenerRegistered: " + mSamplingListenerRegistered); pw.println(" mSamplingRequestBounds: " + mSamplingRequestBounds); + pw.println(" mRegisteredSamplingBounds: " + mRegisteredSamplingBounds); pw.println(" mLastMedianLuma: " + mLastMedianLuma); pw.println(" mCurrentMedianLuma: " + mCurrentMedianLuma); pw.println(" mWindowVisible: " + mWindowVisible); + pw.println(" mWaitingOnDraw: " + mWaitingOnDraw); + pw.println(" mRegisteredStopLayer: " + mRegisteredStopLayer); + pw.println(" mIsDestroyed: " + mIsDestroyed); } public interface SamplingCallback {