Defer recreation until resumed am: 3f8d868110

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12309024

Change-Id: I814a6cab9046b82d66426fbe19636087cfd3e2b6
This commit is contained in:
Winson Chung
2020-08-05 06:02:28 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ import android.widget.Toast;
import androidx.annotation.Nullable;
import com.android.launcher3.Launcher.OnResumeCallback;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.InstanceIdSequence;
@@ -107,10 +108,20 @@ public abstract class BaseDraggingActivity extends BaseActivity
private void updateTheme() {
if (mThemeRes != Themes.getActivityThemeRes(this)) {
recreate();
// Workaround (b/162812884): The system currently doesn't allow recreating an activity
// when it is not resumed, in such a case defer recreation until it is possible
if (hasBeenResumed()) {
recreate();
} else {
addOnResumeCallback(this::recreate);
}
}
}
protected void addOnResumeCallback(OnResumeCallback callback) {
// To be overridden
}
@Override
public void onActionModeStarted(ActionMode mode) {
super.onActionModeStarted(mode);