Prevent taskbar on phone from crashing

* Update code behind flag to work with transient taskbar
* We explicitly set the mDestroyed flag to false in
TaskbarActivityContext because it gets set to true when
the flag is on, but nothing resets it unless it gets
recreated normally.

Bug: 274517647
Flag: persist.wm.debug.hide_navbar_window
Test: Enable flag and verify no crash
Change-Id: I9a149ffb47a10efedfc9dff8399d12d4c1a31553
This commit is contained in:
Vinit Nayak
2023-04-10 15:50:05 -07:00
parent fc7fa8f36b
commit f00760ac23
6 changed files with 41 additions and 13 deletions

View File

@@ -77,6 +77,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -835,12 +836,18 @@ public class TouchInteractionService extends Service
// If Taskbar is present, we listen for long press to unstash it.
TaskbarActivityContext tac = mTaskbarManager.getCurrentActivityContext();
if (tac != null && canStartSystemGesture) {
reasonString.append(NEWLINE_PREFIX)
.append(reasonPrefix)
.append(SUBSTRING_PREFIX)
.append("TaskbarActivityContext != null, using TaskbarStashInputConsumer");
base = new TaskbarStashInputConsumer(this, base, mInputMonitorCompat, tac);
if (tac != null) {
// Present always on large screen or on small screen w/ flag
DeviceProfile dp = tac.getDeviceProfile();
boolean useTaskbarConsumer = dp.isTaskbarPresent && !TaskbarManager.isPhoneMode(dp);
if (canStartSystemGesture && useTaskbarConsumer) {
reasonString.append(NEWLINE_PREFIX)
.append(reasonPrefix)
.append(SUBSTRING_PREFIX)
.append("TaskbarActivityContext != null, "
+ "using TaskbarStashInputConsumer");
base = new TaskbarStashInputConsumer(this, base, mInputMonitorCompat, tac);
}
}
if (mDeviceState.isBubblesExpanded()) {