Fixing Launcher crases due to methods being called on Ui Threads.
This CL fixes the following two issues: 1. Launcher crashing while calling `addPrivateSpaceSettingsButton` from BaseAllAppsAdapter as the thread is UI 2. Decorator is not removed from Private Space Header during reset to paused state. https://screenshot.googleplex.com/BZdLqaZQwdDApfV Flag: ACONFIG com.android.launcher3.Flags.enable_private_space DEVELOPMENT Bug: 311337961, 311342946 Test: Ran Launcher3 tests Change-Id: I2763338ebf0f5468ad38f61a781e8a8334194c5c
This commit is contained in:
@@ -19,7 +19,6 @@ package com.android.launcher3.allapps;
|
||||
import static com.android.launcher3.allapps.PrivateProfileManager.STATE_DISABLED;
|
||||
import static com.android.launcher3.allapps.PrivateProfileManager.STATE_ENABLED;
|
||||
import static com.android.launcher3.allapps.PrivateProfileManager.STATE_TRANSITION;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
@@ -50,7 +49,7 @@ public class PrivateSpaceHeaderViewController {
|
||||
//Add image and action for private space settings button
|
||||
ImageButton settingsButton = parent.findViewById(R.id.ps_settings_button);
|
||||
assert settingsButton != null;
|
||||
UI_HELPER_EXECUTOR.post(() -> addPrivateSpaceSettingsButton(settingsButton));
|
||||
addPrivateSpaceSettingsButton(settingsButton);
|
||||
|
||||
//Add image for private space transitioning view
|
||||
ImageView transitionView = parent.findViewById(R.id.ps_transition_image);
|
||||
@@ -78,7 +77,7 @@ public class PrivateSpaceHeaderViewController {
|
||||
|
||||
private void addPrivateSpaceSettingsButton(ImageButton settingsButton) {
|
||||
if (mPrivateProfileManager.getCurrentState() == STATE_ENABLED
|
||||
&& mPrivateProfileManager.isPrivateSpaceSettingsButtonVisible()) {
|
||||
&& mPrivateProfileManager.isPrivateSpaceSettingsAvailable()) {
|
||||
settingsButton.setVisibility(View.VISIBLE);
|
||||
settingsButton.setOnClickListener(view ->
|
||||
mPrivateProfileManager.openPrivateSpaceSettings());
|
||||
|
||||
Reference in New Issue
Block a user