mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Fix an issue with nav bar translations not being updated
- There are flows where the shared taskbar state is updated prior
to being destroyed, and not updated to the latest values when
the taskbar is recreated.
ie.
unfolded -> lock screen -> LauncherTaskbarUiController's
mTaskbarInAppDisplayProgress[SYSUI_SURFACE_PROGRESS_INDEX]
is set to 1 due to the notif shade (lockscreen) showing.
This is written into TaskbarSharedState's sysuiStateFlags
and inAppDisplayProgressMultiPropValues.
fold -> TaskbarActivityContext is destroyed
unlock -> TaskbarManager and TaskbarSharedState's
sysuiStateFlags are updated while the device is folded
unfold -> TaskbarActivityContext is recreated and initialized
which restores from the shared state's
inAppDisplayProgressMultiPropValues. It also tries to reapply
the shared state's sysuiStateFlags, but this doesn't update
inAppDisplayProgressMultiPropValues because the state's
"enabled" state is not updated (default is no flag set, and
lockscreen sysui state is not set anymore).
-> The restored inAppDisplayProgressMultiPropValues value
results in the wrong translation.
- Note that after the above, the NavbarButtonsViewController state
is actually correct and reflects the SysUI state, but the
LauncherTaskbarUiController state is wrong. This CL tries to
manually update the ui controller to the correct state when it
is recreated.
- CL also fixes a separate issue where LauncherTaskbarUIController
could potentially overwrite the saved state progresses while
restoring them due to the state callback being called
Bug: 283346744
Test: Unfold -> Lockscreen -> Fold -> Unlock -> Unfold and ensure
the buttons are translated correctly
Change-Id: I43e473faf4fa2a493b9705506e3755df8f6264e7
Signed-off-by: Winson Chung <winsonc@google.com>
This commit is contained in:
@@ -50,6 +50,7 @@ import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* A data source which integrates with a Launcher instance
|
||||
@@ -105,6 +106,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
|
||||
// Restore the in-app display progress from before Taskbar was recreated.
|
||||
float[] prevProgresses = mControllers.getSharedState().inAppDisplayProgressMultiPropValues;
|
||||
// Make a copy of the previous progress to set since updating the multiprop will update
|
||||
// the property which also calls onInAppDisplayProgressChanged() which writes the current
|
||||
// values into the shared state
|
||||
prevProgresses = Arrays.copyOf(prevProgresses, prevProgresses.length);
|
||||
for (int i = 0; i < prevProgresses.length; i++) {
|
||||
mTaskbarInAppDisplayProgressMultiProp.get(i).setValue(prevProgresses[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user