mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Fixing activity leak via alarm in SecondaryDropTarget
Change-Id: I12c099ee1bb55d9db81e14d27d2eb09fbbc83e0f
This commit is contained in:
@@ -56,6 +56,7 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
private final ArrayMap<UserHandle, Boolean> mUninstallDisabledCache = new ArrayMap<>(1);
|
||||
|
||||
private final Alarm mCacheExpireAlarm;
|
||||
private boolean mHadPendingAlarm;
|
||||
|
||||
protected int mCurrentAccessibilityAction = -1;
|
||||
public SecondaryDropTarget(Context context, AttributeSet attrs) {
|
||||
@@ -69,6 +70,24 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
mCacheExpireAlarm.setOnAlarmListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
if (mHadPendingAlarm) {
|
||||
mCacheExpireAlarm.setAlarm(CACHE_EXPIRE_TIMEOUT);
|
||||
mHadPendingAlarm = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (mCacheExpireAlarm.alarmPending()) {
|
||||
mCacheExpireAlarm.cancelAlarm();
|
||||
mHadPendingAlarm = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
Reference in New Issue
Block a user