mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Fix a couple of crashes when taskbar isn't yet attached
- Handle back to back addTaskbarIfNecessary(). Specifically, handle cleanup() before the previous add was attached. This is already handled on WM side, just had to remove isAttachedToWindow() check. - Add isAttachedToWindow() check to isViewInTaskbar() Test: call addTaskbarIfNecessary() three times back to back, ensure no crash. Fixes: 180509238 Bug: 171917176 Change-Id: Id68b6c376029eb5c651f47afa56666391c516aef
This commit is contained in:
@@ -232,14 +232,10 @@ public class TaskbarController {
|
||||
}
|
||||
|
||||
private void removeFromWindowManager() {
|
||||
if (mTaskbarContainerView.isAttachedToWindow()) {
|
||||
mWindowManager.removeViewImmediate(mTaskbarContainerView);
|
||||
}
|
||||
mWindowManager.removeViewImmediate(mTaskbarContainerView);
|
||||
}
|
||||
|
||||
private void addToWindowManager() {
|
||||
removeFromWindowManager();
|
||||
|
||||
final int gravity = Gravity.BOTTOM;
|
||||
|
||||
mWindowLayoutParams = new WindowManager.LayoutParams(
|
||||
@@ -377,7 +373,8 @@ public class TaskbarController {
|
||||
* @return Whether the given View is in the same window as Taskbar.
|
||||
*/
|
||||
public boolean isViewInTaskbar(View v) {
|
||||
return mTaskbarContainerView.getWindowId().equals(v.getWindowId());
|
||||
return mTaskbarContainerView.isAttachedToWindow()
|
||||
&& mTaskbarContainerView.getWindowId().equals(v.getWindowId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user