x-JOCandClaude 5c1979227e fix(fold): keep the device type stable across folds (#7402)
* fix(display): keep the device type stable across folds

LawnchairWindowManagerProxy estimated the supported bounds only from
DisplayManager#getDisplays, which reports the panel in use. On a foldable
the DisplayController cache then held a single state, so every fold and
unfold invalidated it ("Unexpected normalizedDisplayInfo found"), the
device type flipped between PHONE (folded) and MULTI_DISPLAY (unfolded,
through the hinge check), and CHANGE_SUPPORTED_BOUNDS reloaded the grid
and the model. The smaller dock of the phone profile also made the
loader delete the dock items past its size.

On devices with FEATURE_SENSOR_HINGE_ANGLE, the estimate now also holds
the other states of the internal display:
- WindowManager#getPossibleMaximumWindowMetrics, like
  SystemWindowManagerProxy, when the system answers (it only does for the
  recents provider) and the current state is one of its states.
- Otherwise each state of the default display seen on the device is
  remembered. A state with the same aspect ratio replaces an older one,
  so a resolution change leaves no stale bounds.

The extra states are built the way DisplayController.Info builds the key
it looks up (getDisplayInfo(context).normalize(), no-cutout default), so
the lookup finds them and folding no longer changes the supported
bounds. Once both panels are known they hold a phone and a tablet size,
and the device type is MULTI_DISPLAY in both states, across restarts too.
A hinge device never seen unfolded still reports PHONE: flip phones also
have the hinge sensor, so it can't be assumed.

The states are kept in their own device-protected file,
lc_display_states, not in boot_aware_prefs: DisplayController can run
before unlock, the values must not be backed up or restored on another
device, and the write happens while DisplayController is being
constructed. AOSP's taskbar-pinning listener on boot_aware_prefs calls
getInfo() for every change, which is still null at that point, so a write
to that file crashed the launcher when it started on the other screen
than last time.

The hinge check now lives in one place, LawnchairWindowManagerProxy
.isFoldable(), which DisplayController.Info uses as well.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 14e6051ac83cba92cb371eec1c408966cb41ba9d)

* chore(display): log the device type once per info

getDeviceType() is called many times for each display change (once per
DeviceProfile and more), and logged its result every time. Log it once
per DisplayController.Info, that is once per display change, with the
current size, so the device type of each state can be read in logcat.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 9fa57ec7e3d678c3e19d6ce1309ae11b893e18fc)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 17:09:10 +08:00
2024-09-14 10:49:35 +08:00
2026-01-10 20:48:14 +07:00
2022-05-17 23:14:06 +07:00
2026-01-10 20:49:40 +07:00
2022-08-10 15:07:14 +05:30
2024-04-30 10:03:35 +08:00
2024-12-19 07:57:45 +08:00
2019-11-25 20:24:07 +09:00
2024-03-22 15:45:32 -07:00

Lawnchair 16

Build debug APK Build release APK Crowdin OpenCollective Telegram Discord GitHub Downloads Play Store Installs

Smartphone home screen shown in day and night themes, featuring Android Material You dynamic color styling across the wallpaper, clock widget, and app icons.

Lawnchair is a free, open-source home app for Android. Taking Launcher3—Android’s default home app—as a starting point, it ports Pixel Launcher features and introduces rich customization options.

This branch houses the codebase of Lawnchair 16, which is currently in development and is based on Launcher3 from Android 16. For Lawnchair 9 to 15, see the branches with the 9- to 15- prefixes, respectively.

Features

  • Material 3 Expressive theming that follows your wallpaper and system colors.
  • At a Glance widget support, with integration for Smartspacer.
  • QuickSwitch support for Android Recents integration on Android 15-16 (root required).
  • Global search for apps, contacts, and web results from the home screen.
  • Customization options for icon packs, fonts, and color settings.

Download

Get it on Google Play Get it on IzzyOnDroid Get it on Obtainium Get it on GitHub

Lawnchair on Play Store will install as a different app compared to other sources. Features may be restricted to comply with Google Play’s publishing rules.

You can also verify your installation to check if you have installed an official build.

Development builds

Interested in keeping yourself up-to-date with every Lawnchair development? Try our development builds!

These builds offer the latest features and bug fixes at a cost of performance and additional issues. Make backups before installing.

Download: Obtainium • GitHub • nightly.link

Sponsors

CodeRabbit

CodeRabbit is an AI-powered code review platform that integrates directly into pull-request workflows and IDEs, examining code changes in context and suggesting improvements.

Support Lawnchair

If you love what we do, consider supporting us on Open Collective! Your contributions help keep Lawnchair independent and enable us to develop faster.

A huge thank you to our Core Backers ($5+): (These backers directly fund our Project Velocity Fund)

Core Backers

Become a supporter to help us cover our operational costs, or become a Core Backer to be featured here!

Contribute

Visit the Lawnchair contributing guidelines for information and tips on contributing to Lawnchair.

S
Description
No description provided
Readme
697 MiB
0 Stars 1 Watchers 0 Forks
Languages
Java 55.6%
Kotlin 43.5%
JavaScript 0.3%
AIDL 0.2%
CSS 0.2%