Commit Graph

254 Commits

Author SHA1 Message Date
Federico Baron
dc1e7d004c Remove demo mode layout code
It's no longer used/needed

Bug: 407120123
Flag: EXEMPT internal cleanup
Test: EXEMPT internal cleanup
Change-Id: Ie0ae18b67ed4d7119b7901e652c27c024450da4b
2025-03-28 23:58:50 +00:00
Federico Baron
c7e8c4e8e7 Add logging for which type of migration occurs.
When upgrading from non one grid to one grid, we should do the row
shift migration type, here we are logging data to make sure that is what
happens on upgrade

Flag: EXEMPT logging
Test: n/a
Bug: 393175684
Change-Id: Id09257094bc9bc44da757c73a4f63bf15987772c
2025-03-20 01:31:45 +00:00
Treehugger Robot
ca902dc757 Merge "Don't modify invariant device profile" into main 2025-02-20 09:59:54 -08:00
Federico Baron
c07bf539ee Don't modify invariant device profile
We flag guard the code that modifies IDP as that's not needed with one
grid, and we don't want to modify idp outside of it

Bug: 332974074
Flag: com.android.launcher3.one_grid_specs
Test: verified manually with b&r
Change-Id: Ica2ffa79638fa693cde421adb13feebb0d09cbc4
2025-02-19 19:20:03 +00:00
Sunny Goyal
b82394758f Moving LauncherModel initialization to a separate class
Bug: 361850561
Test: Presubmit
Flag: EXEMPT dagger

Change-Id: Ie210473a9e158faa421c00f115ffcca680f84ae4
2025-02-18 13:11:50 -08:00
Sunny Goyal
29f9c3d231 Merging IconShape with ThemeManager
The order of initialization for IconShape is closely tied to ThemeManager
which makes it difficult for change listeners to work. Merging these keeps
all the theming information at one place

Bug: 381897614
Test: Updated tests
Flag: EXEMPT refactor
Change-Id: Ie29efa20c3308a24be3e284c1c93ed7444b68d58
2025-02-13 22:38:01 -08:00
Adnan Begovic
1b26bb4a74 launcher3: Improve SimpleBroadcastReceiver.
Unless explicitly annotated, parameters in java are by
  default nullable. There are a few cases where a null context
  may be passed to the unregisterReceiverSafely function
  of SimpleBroadcastReceiver.

  To mitigate misuses or incorrect contexts being passed for
  register vs unregister, keep the context as a strong reference
  in the constructor.

  Also added NonNull annotations for any public callsites to
  enforce behavior.

Bug: 395019017, 395966395
Flag: NONE - bug fixed
Test: manual - presubmit
Change-Id: Ie371fa45cadceaf51cf184b446df9123ef27c337
2025-02-12 13:43:34 -08:00
Sunny Goyal
5bca45a739 Moving InvariantDeviceProfile to Dagger
Bug: 361850561
Test: Presubmit
Flag: EXEMPT dagger
Change-Id: Ia99ee031e96c5e6069a56fe90a262a533dd8665a
2025-02-11 15:22:18 -08:00
Treehugger Robot
0d9c54fc51 Merge "Make sure only old grids show up when the flag is off" into main 2025-02-11 13:52:38 -08:00
Federico Baron
72dc958b9f Make sure only old grids show up when the flag is off
XL and large grid icons were showing up with the flag off

Bug: 395139926
Test: ValidGridOptionsTest
Flag: com.android.launcher3.one_grid_specs
Change-Id: If6b077ce854341563d8c2fbefd741b598b77a7a8
2025-02-11 00:13:21 +00:00
Cole Faust
04bff7b50c Merge "Replace .toList() with .collect()" into main 2025-02-10 11:59:47 -08:00
Federico Baron
54b09dc41f Fix issue where turning off fixed landscape goes to default grid
Bug: 390091751
Test: manually verified on device
Flag: com.android.launcher3.one_grid_specs
Change-Id: Id9de8cadc6fc1ee0ac0124638b2c487b8f8357bb
2025-02-07 09:22:42 +00:00
Cole Faust
1b9fd985d4 Replace .toList() with .collect()
.toList() was only introduced to android in api level 34, which is newer than
this module's min_sdk_version. Replace it with .collect().

This was found while updating android lint.

Flag: EXEMPT refactor
Bug: 394096385
Test: Presubmits
Change-Id: Id8d1de1531b67a7daf448e45592b7ef78f685fc2
2025-02-03 14:19:12 -08:00
fbaron
9ed02b841b Add grid icon for wallpaper picker
Bug: 384938435
Test: n/a
Flag: com.android.launcher3.one_grid_specs
Change-Id: I3480244d63cd8b4796ff656245a862094a1b5854
2025-01-31 19:26:02 +00:00
Sebastian Franco
f59d3de3c6 Using pixels instead of DPI for selecting the grid size
Fix: 383132640
Bug: 386479043
Test: Screenshot test
Flag: com.android.launcher3.one_grid_specs
Change-Id: Ic3eda69324e03cc6f049cd7d21dac7ab6a22271e
2025-01-07 10:32:07 -08:00
Sunny Goyal
e79d453bc8 Converting LauncherPrefs to dagger
Fixing ENABLE_TWOLINE_ALLAPPS_TOGGLE not properly tied to IDP:
http://recall/-/ep7WJ8pKwCEklUN5J1mAkM

Bug: 361850561
Flag: EXEMPT dagger-migration
Test: atest LauncherPrefsTest FakeLauncherPrefsTest
Change-Id: Iba63d060f4a8c2e31033fca2a4638c559c161338
2025-01-03 13:49:53 -08:00
Charlie Anderson
3eec1895ed Prevent bad grid configuration by making sure RestoreDbTask updates IDP correctly.
IPD#reset() was resetting the internal IDP dbFile to the factory default instead of current grid/db

This lead to LoaderTask and grid migration creating an empty DB for the wrong grid size, while the restored DB remained unused. Leading to an empty home screen because an empty DB file was used.

Bug: 377510898
Flag: EXEMPT bugfix
Test: manually testing backup & restore with various grid sizes
Change-Id: I709201e484afb8f12a4fde21198d2c5793d89ca1
2024-12-16 14:39:41 -08:00
Sebastian Franco
dabf02fd86 Prevent Hotseat jank when switching Fixed Landscape setting
Fix: 380998389
Test: HomeScreenImageTest
Flag: com.android.launcher3.one_grid_specs
Change-Id: I6e7334b9f5b3d6abab57d461987db64fe3700ac4
2024-12-12 17:32:11 -08:00
Charlie Anderson
bad2be4944 Add more logs to investigate empty launcher restore
Flag: EXEMPT logs
Test: presubmit
Bug: 377510898
Change-Id: I1c05b90c9e1337663c4c06703ad14b6c0d00aa07
2024-12-06 22:14:19 +00:00
Sebastián Franco
8f3a671ff6 Merge "Fix findMinWidthAndHeightDpForDevice so it finds the smallest dp height of the cached displays" into main 2024-12-05 12:54:52 +00:00
Sebastian Franco
2b0cdbbc87 Make sure GRID_NAME is updated every time it changes.
Bore it was only updated when the device was innitialized,
but other changes to the IDP would not udpate the GRID_NAME pref.

Fix: 380954618
Test: NA
Flag: com.android.launcher3.one_grid_specs
Change-Id: I4fa73a4b838c0d0c7c1c88ea91c62ac8ae6676b7
2024-12-05 01:25:25 +00:00
fbaron
9ce45bac05 Fix findMinWidthAndHeightDpForDevice so it finds the smallest dp height of the cached displays
Bug: 364711064
Flag: com.android.launcher3.one_grid_specs
Test: HomeScreenImageTest
Change-Id: I04bc264a3f3579eff18412c02546460aaaeff955
2024-12-04 23:51:43 +00:00
fbaron
d1cd8c2ea6 Add GridDimensionSpecs to fixed landscape and make grid dimension generalized so we can use it to determine row count or col count
Bug: 364711064
Flag: com.android.launcher3.one_grid_specs
Test: HomeScreenImageTest
Change-Id: If1dafedc710ebc483fc7b6b5cd6cae6f70dc3cfc
2024-12-03 02:43:13 +00:00
fbaron
493583435b Convert px to dp for determining minWidth and minHeight for each row count, and add breakpoints
Bug: 364711064
Flag: com.android.launcher3.one_grid_specs
Test: HomeScreenImageTest
Change-Id: I391e001ddee454baccbc0a8f1e002cc815722239
2024-11-26 00:38:19 +00:00
Sebastian Franco
394a7e64f8 Changing name of RowCount to GridDimension to be more general
Bug: 364711064
Flag: com.android.launcher3.one_grid_specs
Test: HomeScreenImageTest
Change-Id: I7ca46babf0c4ce647a4c98a7dd0326b35450479f
2024-11-14 18:58:16 -08:00
fbaron
6c91ef9191 Add OldGrid field for GridOption so we can properly filter out the old grids when the flag is on
Bug: 364711064
Flag: com.android.launcher3.one_grid_specs
Test: NexusLauncherImageTests, DeviceProfileDumpTest
Change-Id: I8e3ff70d2f3008d1de7c8419290ff44c18c72e70
2024-11-13 11:31:50 -08:00
fbaron
c1b68f4f6d Add mounted mode image tests and remove some image tests for OneGrid
Bug: 364711064
Flag: com.android.launcher3.one_grid_specs
Test: HomeScreenImageTest, AllAppsImageTest, FolderImageTest
Change-Id: I1d51596d50d63b00614a2efd342cce72d9a4af8e
2024-11-09 01:21:40 -08:00
Sebastian Franco
9e4c99befd Adding Launcher Mode settings to Launcher settings
Bug: 364711735
Test: NA
Flag: com.android.launcher3.one_grid_specs
Change-Id: Iab688ebdb8449f9258b61f59a0afe97875f82a81
2024-11-07 21:17:10 -08:00
Federico Baron
56307d2cf4 Fix failing robo test TaskbarStashControllerTest#testRecreateAsTransient_timeoutStarted
Flag: EXEMPT bugfix
Test: TaskbarStashControllerTest#testRecreateAsTransient_timeoutStarted
Bug: 377256218
Change-Id: If326525a6186eb8f3cfd3e22a979828ce37e87ba
2024-11-07 04:15:16 +00:00
Treehugger Robot
230b2f50a7 Merge "Fix flag guarding for oneGridRotationHandling" into main 2024-11-06 17:04:05 +00:00
fbaron
49f7df0444 Fix flag guarding for oneGridRotationHandling
Bug: 364711064
Flag: com.android.launcher3.one_grid_rotation_handling
Test: n/a
Change-Id: Ic0027bf82912bf56470a8abc29880599820b3352
2024-11-05 16:29:26 -08:00
fbaron
8f26e042b2 Remove flags that are no longer necessary
Flag: EXEMPT code cleanup
Test: GridSizeMigrationTest
Bug: b/325286145, b/325285743
Change-Id: I056021c299b56a186b754b94b33509d0b01816e0
2024-11-05 14:22:37 -08:00
fbaron
ebc10c9ecc OneGrid Grid Option Updates
Bug: 330900048
Flag: com.android.launcher3.one_grid_specs
Test: n/a
Change-Id: I919195dbc7ac78c3be42f0f9d7620193a24d7e99
2024-10-30 11:38:09 -07:00
Brandon Dayauon
51db65ee49 Add trace logs in Launcher for perfetto to investigate two line issue
bug:375267130
Test manually screenshot:
onIdpChange: https://screenshot.googleplex.com/ASbyGFoAhTXgnWK
statefulActivityOnConfigChange: https://screenshot.googleplex.com/gLqxeJN7TzUURCy
Flag: NONE adding traces to perfetto

Change-Id: Ib2ac49fb8668fdfc91c8e38b91a4afd10127a4c5
2024-10-23 22:59:58 -07:00
fbaron
b633b9aa2b Fix for bug where we don't use default grid on comet, and migrate normally if not in a B&R case
-The grid migration where we just copy the grid and move everything one row up should only occur in a B&R scenario, so now we add that restriction
-We should default to 4x5 in comet if migrating from a 4x4 grid if the device we're migrating from does not have any other grids saved
-if we have other grids saved, then we'll try using the saved grid if possible. If not possible, we use the default grid for the new device

Bug: 360462379
Test: GridSizeMigrationUtilTest
Flag: EXEMPT bugfix
Change-Id: Ia905081046431c08dc058bd61b2b4ab42dee0506
2024-09-24 16:52:05 -07:00
Jagrut Desai
2e8ca87c21 Taskbar in Desktop Windowing Mode
Test: presubmit
Bug: 330146462
Flag: NONE
Change-Id: Ib33f90704c3010df6a52e2a1c420960b11dbd0d4
2024-05-01 09:29:24 -07:00
Sunny Goyal
10fa016352 Fixing MainThreadInitializedObject
> Making SafeCloseable implementation mandatory, to prevent leaks during test and preview
> Removing getNoCreate method and defining executeIfCreated to avoid null pointer exceptions
> Fixing sandbox value leaking into main, by Checking sandbox against App context
> Converting sanbox to an interface instead a class

Bug: 335280439
Test: Presubmit
Flag: None
Change-Id: I951dcde871898e745ff6490a1c4f8fd1512888f5
2024-04-22 17:04:33 -07:00
Sunny Goyal
a82ce1feda Merge "Making moving getDisplayType to DisplayController so that it can be accessed without IDP" into main 2024-04-18 05:51:58 +00:00
Sunny Goyal
25c4276ba9 Making moving getDisplayType to DisplayController so that it can be accessed without IDP
Bug: 335280439
Test: Presubmit
Flag: None
Change-Id: Ib1ef3c970a56044c81e36c4af67981715fe50a9e
2024-04-17 10:39:50 -07:00
Federico Baron
6188ec4157 Merge "Make hotseat column span responsive" into main 2024-04-16 17:17:55 +00:00
fbaron
e4b0b71faa Make hotseat column span responsive
Flag: NONE
Test: DeviceProfileDumpTest, DeviceProfileAlternativeDumpTest, HomeScreenImageTest
Bug: 325084912
Change-Id: Ifa9e8066662a1ab053f66b8800b739d813d2dab8
2024-04-16 06:19:16 +00:00
Sebastian Franco
df7d2b0861 Set default grid when doing a backup and restore
When restoring from a tablet because phones don't have
the same table some issues can ocure because we setup a
non valid grid, the correct thing is to setup a default.

Bug: 325285743
Fix: 332964986
Flag: ACONFIG narrow_grid_restore enabled
Test: BackupAndRestoreDBSelectionTest
Change-Id: I28bf02e83dddf5ae84818d879a5e21600eddf67e
2024-04-05 08:53:32 -07:00
Sebastián Franco
ad46eb75f4 Revert^4 "Removing all restored backups except one so we don't have old backups"
To prevent the error I introduce the method restorePreviousState().

This reverts commit 1234090589.

Reason for revert: Fixing presubmit breaks

Bug: 325285743
Flag:  ACONFIG narrow_grid_restore disabled
Test: BackupAndRestoreDBSelectionTest
Change-Id: I63666c29eb91dada4243af019ab0538c40bc0f78
2024-03-12 11:01:26 -07:00
Sebastián Franco
1234090589 Revert^3 "Removing all restored backups except one so we don't have old backups"
This reverts commit 4b960d1f11.

Reason for revert: Breaking presubmit, no bug number yet 

Change-Id: I0bafad8bf63fae1d9408b65c6c18c79ab5d40d05
2024-03-11 20:15:24 +00:00
Sebastián Franco
4b960d1f11 Revert^2 "Removing all restored backups except one so we don't have old backups"
This reverts commit 3306fa5325.

Reason for revert: Fixing issue that caused b/328782012

Change-Id: Ib6a1bbfeedf608f5f77ac6be500271e811320f32
2024-03-08 18:53:57 +00:00
Sebastián Franco
3306fa5325 Revert "Removing all restored backups except one so we don't have old backups"
This reverts commit bd43b9344f.

Reason for revert: b/328782012

Change-Id: I1666fbd63d82da06ed8c3d9ce58b5ed6b298618b
2024-03-08 18:42:30 +00:00
Sebastian Franco
bd43b9344f Removing all restored backups except one so we don't have old backups
Adding test to make sure this is the case.

Bug: 325285743
Flag:  ACONFIG narrow_grid_restore disabled
Test: BackupAndRestoreDBSelectionTest
Change-Id: I84c3a92f40598137d5c5c52d34af7583b384122c
2024-03-07 11:23:55 -06:00
Jordan Silva
d29f0644f2 Update the device twoPanelId specs to use the default spec when it is not defined
In some situations, DeviceProfile is recreated with an invalid InvariantDeviceProfile leading to a crash, because it tries to use an non existent responsive grid spec. To prevent the crash, we are update the responsive grid two panel specs to use the default spec when two panel spec is not defined.

Bug: 317993862
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: NexusLauncherImageTests
Test: DeviceProfileDumpTest
Test: DeviceProfileAlternativeDisplaysDumpTest
Change-Id: I8b8095745787ad47b006892452a54942f981713e
2024-01-10 15:11:26 -03:00
Jordan Silva
2de6a277b7 Update responsive grid spec cell size remainderSpace logic
Refactoring the cellSize spec of responsive grid to divide the remainder space in code instead of dividing by cols/rows in the spec definition. For example, instead of using 0.2 in the spec for 5x5 grid (1 / number of rows), it is going to use 1 (100% of the remainder space) and divide the percentage by the number of cols or rows in code.

Fix: 313621277
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: NexusLauncherImageTests
Test: CalculatedWorkspaceSpecTest
Test: DeviceProfileDumpTest
Test: DeviceProfileAlternativeDisplaysDumpTest
Change-Id: Ifaec838ac9751562ecedc1fe39b966ee3d092de3
2024-01-08 19:40:01 -03:00
Andy Wickham
99d7d4f2cb Better handling of insets for All Apps.
Changes:
 - For tablet, always center All Apps without applying additional
   insets for things like cutouts.
 - For tablet, allow the panel to span the full height of the
   screen (minus system bars), rather than 5.5 app rows. This also
   ensures the panel fully closes even if there are cutouts.
 - Remove additional padding for vertical bar mode (landscape on
   phones). This was double counting the cutout insets, but only
   for some views, so things were not aligned. Now the apps line
   up with the search bar, and the scroll bar still makes room for
   any side insets.

Before and after examples:
https://drive.google.com/drive/folders/1k0vSzisf4ZuGyp-qR-IF0QwM-IcHBFrZ?resourcekey=0-uxjzuVQ1KA3WwOQ4v6Dh2w&usp=drive_link

Bug: 299923399
Bug: 259617884
Fix: 300761324
Test: Manual
Flag: NA
Change-Id: I136d516260a1343b1198693c73fa389fe0e11cc9
2024-01-03 19:21:01 +00:00