Skip to content

Commit 8818edb

Browse files
author
Jim Miller
committed
Fix 6485058: remove OnTriggerListeners from Wave*Methods in cleanup
This fixes a rare crash that could happen when the device orientation changes while the handle is held over a target. LockScreen.cleanUp() was being called which set mCallback to null which then causes it to crash in MultiWaveViewMethods.onTrigger(). The solution is to also remove OnTriggerListeners in LockScreen.cleanup(). Change-Id: I487c7c9dbbe40417e685b39f2e79b1c43b30fa00
1 parent ab1c545 commit 8818edb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

policy/src/com/android/internal/policy/impl/LockScreen.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ private interface UnlockWidgetCommonMethods {
129129

130130
// Get the target position for the given resource. Returns -1 if not found.
131131
public int getTargetPosition(int resourceId);
132+
133+
// Clean up when this widget is going away
134+
public void cleanUp();
132135
}
133136

134137
class SlidingTabMethods implements SlidingTab.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -197,6 +200,10 @@ public void setEnabled(int resourceId, boolean enabled) {
197200
public int getTargetPosition(int resourceId) {
198201
return -1; // Not supported
199202
}
203+
204+
public void cleanUp() {
205+
mSlidingTab.setOnTriggerListener(null);
206+
}
200207
}
201208

202209
class WaveViewMethods implements WaveView.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -240,6 +247,9 @@ public void setEnabled(int resourceId, boolean enabled) {
240247
public int getTargetPosition(int resourceId) {
241248
return -1; // Not supported
242249
}
250+
public void cleanUp() {
251+
mWaveView.setOnTriggerListener(null);
252+
}
243253
}
244254

245255
private Intent getAssistIntent() {
@@ -374,6 +384,10 @@ public void setEnabled(int resourceId, boolean enabled) {
374384
public int getTargetPosition(int resourceId) {
375385
return mMultiWaveView.getTargetPosition(resourceId);
376386
}
387+
388+
public void cleanUp() {
389+
mMultiWaveView.setOnTriggerListener(null);
390+
}
377391
}
378392

379393
private void requestUnlockScreen() {
@@ -592,6 +606,7 @@ public void onResume() {
592606
public void cleanUp() {
593607
mUpdateMonitor.removeCallback(mInfoCallback); // this must be first
594608
mUpdateMonitor.removeCallback(mSimStateCallback);
609+
mUnlockWidgetMethods.cleanUp();
595610
mLockPatternUtils = null;
596611
mUpdateMonitor = null;
597612
mCallback = null;

0 commit comments

Comments
 (0)