mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Fix NPE from NavbarButtonsViewController on FEATURE_PC devices.
When FEATURE_PC is enabled on a device, DesktopNavbarButtonsViewController is instantiated. Previously, DesktopNavbarButtonsViewController saves an internal copy of mControllers and the mControllers field in NavbarButtonsViewController is left unset. This was not a problem because mControllers in NavbarButtonsViewController was not used in any code that was not overridden by DesktopNavbarButtonsViewController. ag/17944073 added some code that accesses mControllers in NavbarButtonsViewController. Even though the code would be skipped for FEATURE_PC devices (due to the TaskbarUIController check, which is overridden by DesktopTaskbarUIController) in the end, it still caused an NPE. DesktopNavbarButtonsViewController does not require most of the button updates done in NavbarButtonsViewController. Regardless, this CL provides a workaround to avoid the NPE by setting mControllers in NavbarButtonsViewController in FEATURE_PC devices. Bug: 296623609 Bug: 297260211 Test: Manual; build and launch sdk_gpc emulator. Ensure that no crash occurs Change-Id: Ica22359b96fd0a277c575a238abb194d762e81ea
This commit is contained in:
@@ -219,11 +219,15 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
*/
|
||||
public void init(TaskbarControllers controllers) {
|
||||
mControllers = controllers;
|
||||
setupController();
|
||||
}
|
||||
|
||||
protected void setupController() {
|
||||
boolean isThreeButtonNav = mContext.isThreeButtonNav();
|
||||
DeviceProfile deviceProfile = mContext.getDeviceProfile();
|
||||
Resources resources = mContext.getResources();
|
||||
Point p = !mContext.isUserSetupComplete()
|
||||
? new Point(0, controllers.taskbarActivityContext.getSetupWindowHeight())
|
||||
? new Point(0, mControllers.taskbarActivityContext.getSetupWindowHeight())
|
||||
: DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources,
|
||||
TaskbarManager.isPhoneMode(deviceProfile));
|
||||
mNavButtonsView.getLayoutParams().height = p.y;
|
||||
|
||||
Reference in New Issue
Block a user