summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matthew Ng <ngmatthew@google.com> 2017-05-23 15:00:56 -0700
committer Matthew Ng <ngmatthew@google.com> 2017-05-23 15:00:56 -0700
commita10a9db792fc1c619f5331c251742e1c86bf87b0 (patch)
tree2c4bcdd216c9e95fa4337bcb0c89dd01b61d76bc
parentbc13f7174abd63a03d1a19e9c4360701072cab5b (diff)
DividerView choreographer set earlier to avoid null exception
DividerView sometimes gets attached (after created) after minimized mode has triggered and therefore causes choreographer to trigger a null exception. So put it in the constructor to avoid this issue. Change-Id: Iad32fa42ab2bc60bde4ac0be8f8eac8b55de40ae Fixes: 38017227 Test: manual - hard to repro, keep rotating screen while minimized
-rw-r--r--packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 0c7703663810..16f5140d9e08 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -160,7 +160,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
private boolean mHomeStackResizable;
private boolean mAdjustedForIme;
private DividerState mState;
- private SurfaceFlingerVsyncChoreographer mSfChoreographer;
+ private final SurfaceFlingerVsyncChoreographer mSfChoreographer;
private final Handler mHandler = new Handler() {
@Override
@@ -250,20 +250,22 @@ public class DividerView extends FrameLayout implements OnTouchListener,
};
public DividerView(Context context) {
- super(context);
+ this(context, null);
}
public DividerView(Context context, @Nullable AttributeSet attrs) {
- super(context, attrs);
+ this(context, attrs, 0);
}
public DividerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
+ this(context, attrs, defStyleAttr, 0);
}
public DividerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
+ mSfChoreographer = new SurfaceFlingerVsyncChoreographer(mHandler, context.getDisplay(),
+ Choreographer.getInstance());
}
@Override
@@ -313,8 +315,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
protected void onAttachedToWindow() {
super.onAttachedToWindow();
EventBus.getDefault().register(this);
- mSfChoreographer = new SurfaceFlingerVsyncChoreographer(mHandler, getDisplay(),
- Choreographer.getInstance());
}
@Override