Making AsyncClockEventDelegate a singleton
RemoteViews can get inflated after the activity is destroyed during async inflation. This can cause the delegate to loose the destroy event. Bug: 303686041 Test: Presubmit Flag: N/A Change-Id: Iecb9d69d95b2c924e1189ac15515fac327d8f44d
This commit is contained in:
@@ -218,8 +218,6 @@ public class QuickstepLauncher extends Launcher {
|
||||
private SplitWithKeyboardShortcutController mSplitWithKeyboardShortcutController;
|
||||
private SplitToWorkspaceController mSplitToWorkspaceController;
|
||||
|
||||
private AsyncClockEventDelegate mAsyncClockEventDelegate;
|
||||
|
||||
/**
|
||||
* If Launcher restarted while in the middle of an Overview split select, it needs this data to
|
||||
* recover. In all other cases this will remain null.
|
||||
@@ -497,10 +495,6 @@ public class QuickstepLauncher extends Launcher {
|
||||
mSplitSelectStateController.onDestroy();
|
||||
}
|
||||
|
||||
if (mAsyncClockEventDelegate != null) {
|
||||
mAsyncClockEventDelegate.onDestroy();
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
mHotseatPredictionController.destroy();
|
||||
mSplitWithKeyboardShortcutController.onDestroy();
|
||||
@@ -1346,18 +1340,12 @@ public class QuickstepLauncher extends Launcher {
|
||||
switch (name) {
|
||||
case "TextClock", "android.widget.TextClock" -> {
|
||||
TextClock tc = new TextClock(context, attrs);
|
||||
if (mAsyncClockEventDelegate == null) {
|
||||
mAsyncClockEventDelegate = new AsyncClockEventDelegate(this);
|
||||
}
|
||||
tc.setClockEventDelegate(mAsyncClockEventDelegate);
|
||||
tc.setClockEventDelegate(AsyncClockEventDelegate.INSTANCE.get(this));
|
||||
return tc;
|
||||
}
|
||||
case "AnalogClock", "android.widget.AnalogClock" -> {
|
||||
AnalogClock ac = new AnalogClock(context, attrs);
|
||||
if (mAsyncClockEventDelegate == null) {
|
||||
mAsyncClockEventDelegate = new AsyncClockEventDelegate(this);
|
||||
}
|
||||
ac.setClockEventDelegate(mAsyncClockEventDelegate);
|
||||
ac.setClockEventDelegate(AsyncClockEventDelegate.INSTANCE.get(this));
|
||||
return ac;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user