diff options
| author | 2018-12-10 11:31:49 -0500 | |
|---|---|---|
| committer | 2018-12-10 21:47:17 +0000 | |
| commit | c56db333a22b0dfad224211b80fbaa57bad0d464 (patch) | |
| tree | e41a2092e8c806c9d00ecaf66f28e64a7910f271 | |
| parent | 6ad12e57bb1991be1bd8f8ffad898dc2a92d3a57 (diff) | |
Initialize ViewState member variable in constructor and make it final.
Bug: 119762423
Test: atest SystemUITests
Change-Id: I5f8c305f7aa68ba7ef4dcd5bf44e10613b54b38b
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java index 1e8de076cbed..44c527664f39 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java @@ -21,7 +21,6 @@ import android.content.Context; import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; -import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -58,10 +57,11 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable { private ViewGroup mTransientContainer; private boolean mInShelf; private boolean mTransformingInShelf; - @Nullable private ExpandableViewState mViewState; + private final ExpandableViewState mViewState; public ExpandableView(Context context, AttributeSet attrs) { super(context, attrs); + mViewState = createExpandableViewState(); } @Override @@ -522,11 +522,6 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable { /** Sets {@link ExpandableViewState} to default state. */ public ExpandableViewState resetViewState() { - // TODO(http://b/119762423): Move the null check to getViewState(). - if (mViewState == null) { - mViewState = createExpandableViewState(); - } - // initialize with the default values of the view mViewState.height = getIntrinsicHeight(); mViewState.gone = getVisibility() == View.GONE; @@ -559,9 +554,7 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable { /** Applies internal {@link ExpandableViewState} to this view. */ public void applyViewState() { - if (mViewState == null) { - Log.wtf(TAG, "No child state was found when applying this state to the hostView"); - } else if (!mViewState.gone) { + if (!mViewState.gone) { mViewState.applyToView(this); } } |