Commit Graph

92 Commits

Author SHA1 Message Date
Alex Chau
fd6d942220 Pass WindowContext to DisplayInfoChangeListener
- WindowContext (or updated DisplayContext for Pre-S) contains updated Resources to be used for the listener

Fixes: 181215299
Fixes: 176656141
Test: Swap between large/small screen, large sreen UI is seen
Test: Swap between font size, launcher icon text is updated
Test: Start secondary home
Test: Repeat the above tests with Utilities.ATLEAST_S hardcoded to false
Change-Id: Ib33025ac0276c84fe2b3213e9946721e5988e3da
2021-04-23 19:14:20 +01:00
TreeHugger Robot
70938389d6 Merge "Remove temp logic added to migrate users to new 4x5 grid." into sc-dev 2021-04-23 01:56:17 +00:00
Sunny Goyal
35c7b19fa8 Using WindowContext for listening to configuration changes
Pre-S: Continue to use config-changed broadcast for configuration changes
and display-changed event for rotation changes
S+: Use WindowContext#componentCallbacks for config and rotation changes, and
continue to use display listener for frame-rate changes

Bug: 179308296
Test: Manual and presubmit
Change-Id: I533e69068b5fa6c052a02759ef309dd075ee6a4b
2021-04-22 00:23:02 -07:00
Winson Chung
dc0f3978e7 Logging config changes as well
Reduce some logging from previous CL

Bug: 185820525
Test: Presubmit
Change-Id: I69baed7b819b529db30a65cb39a80fb310d76243
2021-04-20 18:18:51 -07:00
Winson Chung
0bba6a79fc Reduce some logging from previous CL
Bug: 185820525
Test: Presubmit
Change-Id: I38a1da163eedf5f07bd507674ecb8661e8649d23
2021-04-20 15:42:43 -07:00
Winson Chung
8e64bba9cf Add some logging for transposed mode in landscape
Bug: 185820525
Test: Presubmit
Change-Id: Id4cf605fd5c3277273025ac1a73f25add0608412
2021-04-20 20:38:04 +00:00
Tony Wickham
b87f3cdc1c Add support for having more hotseat icons in the DB than we show
Split InvariantDeviceProfile#numHotseatIcons into two variables:
numDatabaseHotseatIcons and numShownHotseatIcons. These are generally
the same, but different DisplayOptions within the same GridOption
can choose to show different numbers of hotseat icons while sharing
the same database.

numDatabaseHotseatIcons is used for all reading/writing/migrating
purposes, while numShownHotseatIcons determines how many Hotseat
icons to show in the UI.

Test: Existing tests pass, added two new migration tests
Bug: 184789479
Bug: 171917176

Change-Id: I54583504f61a47a4444b6a637ebb7e3ab31528b7
2021-04-12 16:08:15 -07:00
Jon Miranda
5eff0bbe13 Remove temp logic added to migrate users to new 4x5 grid.
Related changes:
- I81a91b8415effbe0bf7ba722f11ab44a4169e3df
- Ia7ae129048bf5878b216f31f949e10c71e608818

Bug: 183965808
Bug: 175329686
Test: manual
Change-Id: If9ae69d746f1c86db98275f0c00ae054e146b67e
2021-04-09 14:58:46 +00:00
Andras Kloczl
6057cb9fe6 Update icon and text size for two panel home screen
Adding new field for landscape icon text size and changing
the logic for when to use landscape sizes.

Test: manual
Bug: 182796672
Change-Id: I89833e8fd90f2606937c3b95ac10229a042213ec
2021-04-08 15:27:27 +02:00
Jon Miranda
ec1277eec1 Migrate existing 4x5 and 4x4 grid users to a new 4x5 grid.
Due to the dogfood 4x5 grid using the wrong db, there may
be some rearranging of items.

The goal is to completely remove the old 4x4 and 4x5 grid,
but first we need to silently migrate users to the new grid.

We still  need to keep the old grids in the device profile
so we hide them from the Styles & Wallpaper app.

We also need to reset and remove the ENABLE_FOUR_COLUMN feature
flag from the UI.

- Added TODO to remove this logic in the tracking doc

Bug: 183965808
Bug: 175329686
Test: have old 4x4 or 4x5 grid set up
      install apk with these changes
      confirm that we are now using the new grid and the
      other grid options are inaccessible to the user
Change-Id: I81a91b8415effbe0bf7ba722f11ab44a4169e3df
2021-03-30 13:17:37 +00:00
Alex Chau
06452a427d Merge "Move numAllAppsColumns to displayOptions" into sc-dev 2021-03-25 11:16:00 +00:00
Alex Chau
7c43972c50 Move numAllAppsColumns to displayOptions
- Allow different number of columns per screen size

Bug: 171915986
Test: Manual
Change-Id: I7b7d518289ea56624dc87512f639e92f10f6b586
2021-03-24 19:36:11 +00:00
Jon Miranda
c9e69fa98d Refactor device padding to be set per grid option
- Fixes bug where devices with scaled grids were not
  getting the correct deivce padding.
- Also fix bug where device padding was invalid.
  Added validation check when processing paddings to prevent
  this from happening again.

Bug: 175329686
Test: manual, enable debug flag,
      run and verify no crash from validation check

Change-Id: I35b019c40667c08de4fad95ac4b05b2d8f8a0e74
2021-03-24 14:58:44 -04:00
Andras Kloczl
8e57cce4ee Two panel & two page swipe & currentPage fixes
- Pagespacing set to 0 to have similar design to figma
- Added padding to left side of left panel and right side of right panel to match figma
- getPageScrolls changed to support two page scrolling
- validateNewPage changed so that only even indexed pages can be switched to
- getPageWidthSize added for measurements, it returns half screen width when two panel is active
- onMeasure changed to use getPageWidthSize
- panelCount has been increased from 1 to 2 when two panel is active
- add feature flag for two panel home
- shouldConsumeTouch changed so not only currentpage is checked but currentpage+1 screen as well
- add one more extra check for setDropLayoutForDragObject for currentpage + 2, next to right panel
- using new grid option for two panel home screen

Test: manual
Bug: 174464115
Change-Id: I1bad7eecc67f65fb833608744a5aa5aca65373b4
2021-03-17 12:19:02 +01:00
Jon Miranda
e126d72fa8 More grid changes, closer to final specs.
* Added isScalable, minCellWidth, minCellHeight, and borderSpacing attrs

When isScalable is true, we use set workspace cell values to
minCellWidth/minCellHeight and then scale the cell values to
fit the available space. This allows us to have consistent
aspect ratios when two devices match the display/grid options.

This is different from the dynamic grid, which calculates
cell values based on iconSize/textSize/etc and then allows
the cell width to be as wide as space allows.

I adjusted some variables so that they will auto adjust
based on another value, indepenent from whether the
grid isScalable or not. An example of this is the folder
label text, where it's always set to be 1.14x of whatever
the workspace icon text size is. This is so we don't need
to add a bunch of more variables to DisplayOption/GridOption.

Bug: 175329686
Test: - switching between device profiles,
      - testing folder open/close
      - testing in multiwindow
      - testing in landscape
Change-Id: Ia469ae0d65b518469ef264b726db46f4a3210056
2021-02-25 17:34:56 -05:00
Jon Miranda
228877d37c Add border spacing and fixed cell height to grid.
- Border spacing is the spacing between the cells.
- Workspace cell height is now fixed, and we allocate
  all the "extra" space to three different variable height
  areas.

* Built behind ENABLE_FOUR_COLUMNS flag because it hinders the
default grid.

Bug: 175329686
Test: - set border spacing to 0 and confirm matches prior layout
      - test drag and drop still worked
      - test reordering
      - test widgets
      - test folders
      - test multiwindow

Change-Id: Ic6f3dff577d28ff214bda4b0a787ec7fd08c108b
2021-02-10 17:22:37 -05:00
Sunny Goyal
ead22a5257 Removing released features
Bug: 179224463
Test: Presubmit
Change-Id: I6aa989fa8e52398112cca2c7f4bed0ae69881f7b
2021-02-05 11:36:08 -08:00
Alex Chau
417bd72b71 Revert "Use Diplay.getMetrics in DisplayController"
This reverts commit acfac6187d.

Reason for revert: b/176656141

Bug: 176656141
Change-Id: Ic28e50779811d18450000efc2cdfd8184a931bbb
2021-01-26 15:23:20 +00:00
Jon Miranda
73dcc9878d Add FeatureFlag for ENABLE_FOUR_COLUMNS.
Will be paired with new device profile used to dogfood
upcoming grid changes.

Bug: 175329686
Change-Id: Iab08d9ed0dec14fd6a05c4485ac4e066533d2540
2020-12-11 14:19:13 -08:00
Alex Chau
acfac6187d Use Diplay.getMetrics in DisplayController
- This is a workaround of b/163815566, where DisplayMetrics is stale
  when onDisplayChanged is called.
- Instead of relying on stale DisplayConext, get the DisplayMetrics
  from the Display directly.
- Also optimized how DisplayController.Info is created by passing in
  Display only
- Use mDisplayContext.getDisplay directly if availalbe

Bug: 163815566, 160544577
Test: DPI looks correct on device boot
Change-Id: I2a7454bb8cf2073ce592e8662781b87fc998444f
(cherry picked from commit 177c38243dc3bf245d1f7db3c265dfb56522f441)
2020-10-20 20:19:57 +01:00
Sunny Goyal
fd58da6a75 Wrapping display properties in a wrapper class
This would allow us to support gestures on multiple-displays

Change-Id: I8f426bbdf04520f4189cadce2bde6aab4933c8d9
2020-08-12 13:43:56 -07:00
Tony Wickham
9459f3101f Don't reset RecentsView in onIdpChanged()
Resetting unloads visible task data and thus will leave recents
blank if overview state is enabled. Instead, unload and reload
visible task data to take new icon shape into account.

(The reason we're getting onIdpChanged() on nav bar mode change
is because the change in nav bar height causes the computed icon
size to change very slightly.)

Also fix InvariantDeviceProfile copy constructor by copying
iconBitmapSize.

Test:
- Change between 0 button and 3 button nav modes, verify recents
  doesn't appear blank
- Change icon shape in Styles and Wallpapers and go to recents,
  verify icon shape is reflected in task icons

Bug: 156354328
Change-Id: Ife29f51e85814ff483d055005fa2645135d5ec3d
2020-06-15 14:02:12 -05:00
Jon Miranda
7772fcde47 Fix bug where font size (etc.) doesn't change after changing display settings.
The metrics we get from Display#getMetrics does not change regardless of
what the new configuration is (we would expect the scaledDensity to change).

Documentation shows that Display#getMetrics is deprecated in R.

Using guidance from b/154665987#comment14 we get the metrics from the derived
context.

Bug: 156141463
Change-Id: I25e5f2c13f94e0471111f6c895694947998e3222
2020-06-01 14:08:16 -07:00
Tracy Zhou
c6060e6e2a Refactor usage of getting GRID_OPTIONS_PREFERENCE_KEY value into whether GridOptionsProvider is enabled
Bug: 154154093
Test: manual testing of the feature
Change-Id: Ibe78a75b061aad20e8fa0e229589400b65016ff4
2020-04-28 14:02:49 -07:00
Tracy Zhou
ed5f3082b0 Special handling when a db for one grid option is not setup yet
- Init KEY_MIGRATION_SRC_WORKSPACE_SIZE and KEY_MIGRATION_SRC_HOTSEAT_COUNT
- Load default workspace only when default db is created, not when peeking into dbs of other grid options during grid preview / migration

Fixes: 154184711
Test: run grid preview and migration right after a cleared cache Pixel Launcher
Change-Id: I86c7072b8c4a9da76e289c55ab440071f192fc38
2020-04-22 18:13:42 -07:00
Sunny Goyal
0e7a338e8b Fixing SecondaryDisplay Launcher
> All apps layout broken in landscpae UI
> Crash when manager profile is added
> Wrong icon size on low resolution

Change-Id: If01dacf9f62a0384ebd8b31b62500178416d3ab4
2020-04-21 23:19:11 -07:00
Sunny Goyal
ae190ff807 Revert "Have consistent All Apps UI between grid size changes."
Revert submission 557031-1571265377317-631e3e5

Reason for revert: Breaks multiwindow and secondary display layout
Reverted Changes:
Idee087e31:Remove numAllAppsColumns, allAppsIconSize, allApps...
I6235862c9:Have consistent All Apps UI between grid size chan...

Change-Id: I64156123a8fbaba1a7d2b64cddd5376671123aa2
2020-04-14 17:19:47 -07:00
Tracy Zhou
42255d22a7 Set default value of gridName to current grid name in GridOptionsProvider
With grid preview, a grid name is passed in when requesting preview under different grid setting. With wallpaper preview, no such grid name will be passed in, and it should be set to the current.

Bug: 145242344
Test: N/A
Change-Id: I282cb5341b7f3756d41c4abd8d97f986abaa6d27
2020-03-18 16:52:28 -07:00
Tracy Zhou
be13d109b7 Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview

With this change, we can see actual grid migration in wallpaper preview.

The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.

UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.

Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-02-21 15:49:00 -08:00
Tracy Zhou
7df93d28d4 Setup infrastructure (multi-db support) for the new grid migration algorithm
We'll have a db for each grid option and a db for back up / restore.

TODO(pinyaoting): support back up / restore using the new infrastructure, particularly calls to GridBackupTable should use different DBs when the feature flag (NEW_GRID_MIGRATION_ALGORITHM) is on.

Bug: 144052802
Test: N/A

Change-Id: I644a3e70148bd78204a747a337446a3c038f616f
2020-02-05 19:55:05 -08:00
Sunny Goyal
9c2b96090b Adding SecondaryDisplayLauncher in Launcher using common listener
Bug: 141596722
Change-Id: I480bfadf592f7d0309f17c33a3fe14bb77fb5586
2020-01-30 08:27:27 +00:00
Jon Miranda
2bdd24340d Cleaning up unused allAppsIconSize/allAppsIconTextSize variables.
Change-Id: Ifb77458ca0febdf97a806c34e6d1c16f41789d35
2019-10-25 12:01:45 -07:00
Jon Miranda
64d7481597 Have consistent All Apps UI between grid size changes.
We build an IDP with no grid size override values. This
allows us to reference the profile measurements so that we can have a
consistent UI for areas that the grid size change should not affect.

Bug: 124967099
Change-Id: I6235862c95800d8f31dbf2de1d12b1fcf4dbd850
2019-10-16 11:21:36 -07:00
Jon Miranda
6f7e9702e3 Support defining X column layout for all apps as a display option.
Bug: 124967099
Change-Id: I7bf576759b3fa4f6ca617fbbd660541c12fd09ac
2019-09-16 16:24:59 -07:00
Winson Chung
13c1c2cd65 Migrate to using DefaultDisplay
- Remove extra binder calls to get the default display

Bug: 140633033
Change-Id: I532645deac101a6065d90484b87a67b67aa717f5
2019-09-09 10:21:28 -07:00
Sunny Goyal
6fe3eec95c Moving various common executors to a single location
Change-Id: I44bca49b8adb6fa22c3b48d10f674e42c28d792c
2019-08-20 14:36:17 -07:00
Jon Miranda
c0f1f4f3af Fix bug where changing the display size does not update the launcher grid.
The bug is caused by launcher saving the grid name and using that grid name
to look for matching display options. This makes sense when changing the grid
size, but doesn't work well when changing the display size.

Example: Initial Pixel display size is set to Default, so we save "normal" as
the KEY_IDP_GRID_NAME. When we change display size to Largest, the
KEY_IDP_GRID_NAME is still "normal" and so we only look at display options
under "normal". Before this, Pixel with display size set to Largest would be
set to "reasonable".

This should be safe change for Q, and we can have a proper fix when we
officially support changing grid size.

Bug: 131867841
Change-Id: If5f3b0a13b90069973e929024b26bd9b9c45a7d8
2019-05-28 16:05:09 -07:00
vadimt
1b383af652 Not using magic constants for navbar height
Change-Id: I6783b8a2ebb059ce35748d8c3e818cbe732ff40d
2019-05-08 17:20:34 -07:00
Sunny Goyal
905262c1a7 Adding utility method to get adaptive icon scale
Change-Id: I5ff190c3b794bb13309375782ccd420e85b59091
2019-05-03 21:31:46 -07:00
Ryan Mitchell
01b8b68db7 Rename launcher:iconSize attribute to prevent overriding material
A previous change [1] introduced the material library as a static library
for the SecondaryDisplayLauncher. The material library defines a
resource "attr/iconSize" with format="dimension" while Launcher3 defines
a resource of the same name with format="float". The material resource
is being overriden by the Launcher3 resource and is preventing aapt2
from disallowing multiple definitions of the same attribute with
different formats.

This change renames the Launcher3 iconSize so it will not collide with
the material resource.

[1] If183dd35a1d197c4a9a8225a021e36c4f1662587

Bug: 129146717
Test: build success and inspection of generated apk
Change-Id: I5eb54ea606ddcfb47d5150b44906a8707203e905
2019-04-24 16:22:51 +00:00
Sunny Goyal
8b0cb4113f Listening only for "android" package for overlay changes
Bug: 130917995
Change-Id: I37160a886a0afdc02dca8f7da6e8aa54c795882d
2019-04-22 09:02:08 -07:00
Sunny Goyal
58fa4b66ea Removing some redundant resource definitions
Change-Id: I68ae602116e6eb334dfce2a013fcc42068c464bf
2019-03-22 16:24:16 -07:00
Hyunyoung Song
e11eb47c4e Move overlay monitoring logic out of config monitor
Bug: 126417894

Change-Id: I5b474a2a41bbd951fa0a99673fa8bf4342adade5
2019-03-19 15:46:09 -07:00
Sunny Goyal
90e3fbca62 Updating folder shape when icon shape changes
> Removing unnecessary threading logic and the code was running on main thread anyway

Bug: 118757840
Change-Id: I7a012db5a0dbe2c23bd6ff2cd39679a803731ee8
2019-01-23 16:43:26 -08:00
Sunny Goyal
7d892ff198 Adding API to set the current grid
Bug: 122262084
Change-Id: Ie356d4a90cf1e5a3715fde62cd3502384856e8b5
2019-01-11 15:09:06 -08:00
Sunny Goyal
eff44f331c Adding content provider for exposing launcher grid settings
Bug: 122262084
Change-Id: I3e89e0a9400fb3e81f932af3606eb49c36d34894
2019-01-09 17:47:24 -08:00
TreeHugger Robot
238f324ebf Merge "Adding support for putting arbitary attributes in InvariantDeviceProfile" into ub-launcher3-master 2019-01-09 20:21:03 +00:00
Hyunyoung Song
b4d1ca4902 Refresh icon cache for recents when rro overrides the adaptive icon path
Bug: 122472687
Change-Id: I646c3918480740ea322e60252e3ceb006964567f
2019-01-09 11:37:12 -08:00
Sunny Goyal
5bc1846375 Adding support for putting arbitary attributes in InvariantDeviceProfile
This would allow derivative projects to profile profile specific
customization options

Change-Id: Id4703dc54d649a8d8a930f72c836c4ec23ffc45d
2019-01-07 15:26:21 -08:00
Hyunyoung Song
c55a350da8 Refresh icon cache when icon shape path has changed
Bug: 120505990

$ adb shell cmd overlay enable --user 0 com.android.theme.icon.roundedrect
$ adb shell cmd overlay disable --user 0 com.android.theme.icon.roundedrect
$ adb shell cmd overlay enable --user 0 com.android.theme.icon.teardrop
$ adb shell cmd overlay disable --user 0 com.android.theme.icon.teardrop

Change-Id: I06663b9727f7434aae737d39977f1e6cf09bffbf
2019-01-04 11:57:52 -08:00