From a361c7204ffdee046246b2cb98a7268c6df33073 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 4 Jul 2017 09:43:06 -0700 Subject: [PATCH] Ensure mCurrentPage is valid after page is removed Specific case this addresses: removing work profile - Removing work profile causes workspace to be rebound - This means pages are removed and re-added - As icons are added back to the pages, they use the context of the current page to ensure theming is correct (see ag/1919636) - Without this change, the current page could be null, causing a crash. Now we make sure the index is valid. Bug: 62699220 Change-Id: I0aa1d0c2c6150c51dacb2eb860e4dacd183b3505 --- src/com/android/launcher3/PagedView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index dcc7a9d1ed..185c8879d9 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -926,6 +926,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc @Override public void onChildViewRemoved(View parent, View child) { updateFreescrollBounds(); + mCurrentPage = validateNewPage(mCurrentPage); invalidate(); }