Commit Graph

57 Commits

Author SHA1 Message Date
Tony Wickham
eccf070bae Change TAPL to swipe to stash taskbar (instead of deprecated long press)
This also means Taskbar is transient by default in automated tests,
instead of persistent. Updated some checks accordingly.

Flag: LEGACY ENABLE_TRANSIENT_TASKBAR ENABLED
Test: TaskbarExpandCollapse#hideShowTaskbar; TaplTestsTaskbar;
TaplTestsTransientTaskbar; TaplTestsPersistentTaskbar
Bug: 270395798

Change-Id: Ib6e592a31a55a912a7ea991a421a9c60bca51c80
2023-11-01 23:16:10 +00:00
Jagrut Desai
3a7d139110 Add isTransientTaskbar as DeviceProfile Builder Property
- Breakout CL part 5
- This is a breakout cl from ag/24272821 to make it more readable and atomic.
- This cl consist of adding isTransientTaskbar as DeviceProfile Builder Poropety
- This cl alos consist a shared pref listener for taskbar pinning to update device profile.

Test: Manual, Visual
Bug: 265170176
Flag: ENABLE_TASKBAR_PINNING
Change-Id: I2ade751ffc8c59bd4b862b56c8ca7eb2aa05b7f2
2023-09-28 12:01:58 -07:00
Alex Chau
5fa9a2f49b Add additional logs when DisplayController detects unexpected bounds
Bug: 283944974
Test: manual
Change-Id: I8f50c79e00be0a4be812634678e9e05a80343a07
2023-05-24 15:23:39 +00:00
Alex Chau
7af659da9e DisplayController should deep compare mPerDisplayBounds
- In CHANGE_SUPPORTED_BOUNDS check, it uses Map.equals, but as the value is a primitive array WindowBounds[], equals check does not deep compare the arrays and may result in false negative
- One example is when fontScale changes, DisplayController re-create bounds from WindowManagerProxy, result in new WindowBounds[] created, and the shallow compare results in unexpected CHANGE_SUPPORTED_BOUNDS

Fix: 282736623
Test: DisplayControllerTest
Change-Id: I3897595c58559192b951ecfee7c9f62a07dafe1f
2023-05-17 09:40:46 +00:00
Jagrut Desai
c6d625b8db Exposing functionality to pin Taskbar from TaskbarDividerPopupView.
This CL allows user to long press on Taskbar divider view to bring up divider popup view. It also included functionality of allowing user to turn on always show taskbar from the divider popup view.

Test: Manual
Bug: 265436055
Bug: 265434718
Bug: 265434902
Bug: 265434705
Flag: ENABLE_TASKBAR_PINNING

Change-Id: Ied54d718483a9b06b053d68988e5c294a786002a
2023-04-20 22:04:21 -07:00
Sunny Goyal
08a13d6aae Merge "Removing unnecessary device sumaltion code" into tm-qpr-dev 2023-04-04 17:00:34 +00:00
Tony Wickham
df59884370 Add debug logs for why taskbar might not be destroyed
Test: Manually read log output
Flag: None
Bug: 254119092
Change-Id: Ibaa7ffdc91030c5c999ddc5f2807a55763854331
2023-04-03 23:20:57 +00:00
Sunny Goyal
076e04bcc2 Removing unnecessary device sumaltion code
Bug: 276774148
Test: Verified on device
Change-Id: Icb8c2e7649e5b0e107af184b63f7e30f2df717bd
2023-04-03 12:38:52 -07:00
Brian Isganitis
fdd044e16e Expose IS_RUNNING_IN_TEST_HARNESS as static method.
This variable is now mutable, making the uppercase format misleading.
For instance, users might assume they can use this value in other
immutable properties, when they really should be accessing the latest
value every time they need it.

Context: https://source.android.com/docs/setup/contribute/code-style#follow-field-naming-conventions

Test: Manual
Bug: 271160958
Change-Id: Iaaa51d9153cb8a7d686c72e1210b1948029dcfd5
2023-03-03 00:17:33 +00:00
Sunny Goyal
a992ac9e8d Moving all intent receiver register calls to a single place
This is eventually allow us to move all register to background thread
Also creating a single ScreenOn tracked which is used at multiple places

Bug: 264465756
Test: Verified on device
Change-Id: Ibadf9ca43218e578954420d97a733adfa0a94fc7
Merged-In: Ib410e5bf02773cefde5bf0a0a1f2f1c108718d24
2023-01-22 05:24:48 +00:00
Alex Chau
1b276a1ba7 Add transientTaskbarMargin above taskbar in overview
- Also removed transient_taskbar_two_panels_size and use sw720dp override instead, to be consistent with how we handle small vs large tablet in overview
- Also made isTransientTaskbar mockable so we can test that in DeviceProfileDumpTest

Bug: 260596114
Test: DeviceProfileDumpTest
Change-Id: I3c2236b95d91246e9581531478e3c97601cfb2ec
2022-12-19 17:23:27 +00:00
Tony Wickham
5de5ac9008 Add IS_RUNNING_IN_TEST_HARNESS check for isTransientTaskbar
This avoids us trying to read FORCE_PERSISTENT_TASKBAR feature flag
which apparently crashes tests due to permission issues. Going forward,
when we support persistent taskbar better, we should update the tests
and this check as commented in the code.

Test: com.google.android.apps.nexuslauncher.TaplTestsNexus#testSearchNoInputs
Fixes: 261604544
Change-Id: I35c20825e8171766834f0f32be4f3818d02ab1df
2022-12-08 16:19:16 +00:00
Tony Wickham
7286c5be98 Add feature flag to force taskbar to be persistent.
This will allow us to test taskbar pinning before the entrypoint for
such a setting is finalized.

Test: manual, TODO: will need to update TaplTestsTaskbar to account for
this mode
Flag: FORCE_PERSISTENT_TASKBAR [off]
Bug: 258604917

Change-Id: I4535978563ffbe9a6cc6ece7720cdb75e787ff44
2022-12-06 00:51:46 +00:00
Jon Miranda
f0349354ec Revert "Revert "Add TaskbarModeSwitchRule to test both transient/persistent taskbar.""
This reverts commit e7011d2b87.

Reason for revert: attempt to fix test issues

- Instead of using SharedPrefs which can be flaky anyways,
  we pass along a boolean to test transient taskbar when
  we are in the test harness

Bug: 257549303
Test: TaplTestsTaskbar
Change-Id: I7c15a97363adc377f29853c1fe60b1960c77bfc3
2022-11-10 11:11:14 -08:00
Jon Miranda
184a04266d Add transient taskbar UI
This change is only for the visual appearance of the
transient taskbar.

Bug: 252905206
Test: manual
Change-Id: I4990b20b39089a0c27ec2a72dd3010cf64ddba1d
2022-10-25 13:46:19 -07:00
Alex Chau
e818bcb997 Use real IDP in DeviceProfileTest
- Mock WindowManagerProxy instead of IDP in DeviceProfileTest
- Extracted NavigationMode to standalone class
- Moved parseNavigationMode to WindowManagerProxy so it can be mocked
- Moved DeviceProfileTest to internal repo

Bug: 242086027
Test: DeviceProfileTest
Change-Id: Ia5a43293b1380f04d786d2adf8503cfd10f7674a
2022-09-07 10:35:21 +01:00
TreeHugger Robot
f49287d627 Merge "Listen to DisplayController for ignoreAutoRotateSettings" into tm-qpr-dev 2022-07-29 18:05:17 +00:00
Alex Chau
6209af67d3 Listen to DisplayController for ignoreAutoRotateSettings
- Also skip most of initDeviceProfile/onIdpChanged if DeviceProfile didn't actually change to effectively skip the 2nd unexpected onConfigurationChangeded caused by setRequestedOrientation (b/211763738)

Test: Change display size while in app or at home screen
Fix: 240019605
Change-Id: If307742639bd269622140a7da0dc900887c67937
2022-07-29 13:09:17 +01:00
vadimt
f6ef879cf4 Moving all sources that are shared between Launcher and TAPL in one directory
This will help SysUI test team (who uses TAPL) to set up Gradle build for their tests.

Bug: 202567877, 234414088
Test: presubmit
Change-Id: I3d923ea4b54d1a4c3d2b345be09692727d30433e
2022-07-27 20:18:46 +00:00
Alex Chau
0adc36623d Clean up DisplayController logs
- Moved debug logs under DEBUG flag which defaults to false
- Moved info+ logs to permanent log tags

Fix: 198965093
Test: manual
Change-Id: Iea99f053da08e921542a8f532a9837997e10de5e
2022-07-04 13:13:44 +01:00
Alex Chau
661f02de18 Use normalized CachedDisplayInfo as key
- For system Launcher, migrate to use getPossibleMaximumWindowMetrics instead of getDisplays
- Removed usage of displayId
- In estimateInternalDisplayBounds, use CachedDisplayInfo directly as a key
- When cache retunrs null for the current display (e.g. the 3P launcher case), invalidate the cache and estimate again, and only add to supportedBounds if current display is not found in the new cache

Bug: 227459045
Bug: 198965093
Test: manual
Change-Id: Ibcc05ba483ed31a40d16e3cf49c3f3d43af68cf6
2022-06-09 11:36:47 +01:00
Alex Chau
80d36083c2 Avoid DisplayController.currentSize from being stuck at wrong value
- Update Info when perDisplayBounds has changed
- Add more detailed logging to displayInfo, realBounds and perDisplayBounds
- Add perDisplayBounds to dumpsys and replace supportedBounds

Bug: 233562339
Test: manual
Change-Id: I9a040e8465a8b0a2dcde61bab06c6ca1df3006da
2022-05-30 18:09:45 +01:00
Thales Lima
425f6828f1 Fix hotseat width to span a number of columns
Fix: 227344807
Fix: 231283023
Test: manual
Change-Id: Iad0f38c2323be6d9752a8e509fc7e1164edbcf4e
2022-05-11 10:09:03 -03:00
Sunny Goyal
89a89d63a4 Revert "Fix hotseat width to span a number of columns"
Revert submission 17983445-hotseat_span

Reason for revert: b/231283023
Reverted Changes:
Ice4e37929:Fix hotseat width to span a number of columns
I9ed508490:Fix hotseat width to span a number of columns

Change-Id: Iabf67c5efd8155131a0c8a88192ddd671a43747b
2022-05-09 19:32:07 +00:00
Thales Lima
828875cd12 Fix hotseat width to span a number of columns
Bug: 227344807
Test: manual
Change-Id: Ice4e37929bcbb8c9cf3af340e67b6bec002578bd
2022-04-29 14:56:30 +00:00
Sebastian Franco
00aff95ac0 Give the tests the ability to emulate other devices screens
This code contains utility clases that can change the display
of a device and make it look like another device.
The function DisplayEmulator#emulate receives a DeviceEmulationData
a certain grid to emulate and a callback, everyting that happens
inside of the callback will happen when the device is being emulated
and can be used by other tests.

Example test:
package com.android.launcher3.deviceemulator;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.MediumTest;
import com.android.launcher3.deviceemulator.models.DeviceEmulationData;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.concurrent.TimeUnit;

@MediumTest
@RunWith(AndroidJUnit4.class)
public class TestTest extends AbstractLauncherUiTest {
    @Test
    public void testEmulation() throws Exception {
        String deviceCode = "pixel6pro";
        DeviceEmulationData deviceData = DeviceEmulationData.getDevice(deviceCode);
        String grid = "normal";
        DisplayEmulator displayEmulator = new DisplayEmulator(mTargetContext);

        displayEmulator.emulate(deviceData, grid, () ->{
            TimeUnit.SECONDS.sleep(10);
            return true;
        });
    }
}

Test: You could use the test above to make your device look like a
Pixel6 pro for 10 secons.
Fix: 229028257

Change-Id: Icd79be405a2e14dda0bc5f555b0e46149e16f912
2022-04-25 11:57:58 -05:00
Alex Chau
5f8386cf26 Merge "Using the WindowMetrics API instead of display.getRealSize" into tm-dev 2022-03-31 10:58:40 +00:00
Sunny Goyal
36c0f76e21 Using the WindowMetrics API instead of display.getRealSize
Bug: 221961069
Bug: 195408476
Bug: 198965093
Test: Verified locally and presubmit
Change-Id: I4dac9c19df4c43e6a38ba5c05f27d25f4cfcb071
2022-03-30 21:07:23 +00:00
Thales Lima
12d0eff037 Make inline qsb part of grid attrs
This should make it more configurable, and be independent of the screen size set by the user.

Fix: 223726518
Test: atest Launcher3Tests:HotseatSizeTest
Test: atest Launcher3Tests:InlineQsbTest
Change-Id: If04f3fb0f556103f60b580c757a9fc06da561516
2022-03-30 20:57:57 +01:00
Alex Chau
a6907dc8c9 Use correct config.smallestScreenWidthDp when creating Resource in DeviceProfile
- This is a regression from ag/17070486 when tested, likely because DeviceProfiles are no longer re-created when changing display sizes, so correct values need to be calculated on the starting state

Bug: 221961069
Test: verify smallestWidth specific resource on changing display sizes
Change-Id: I1539bad4b35b36f0056d59307ab5fbec23a71f49
2022-03-18 15:24:07 +00:00
Sunny Goyal
187b16cb91 Updating window manager estimation logic:
> Moving the code from ApiWrapper to Resource overlays for better maintainability
> Accounting for display cutouts in insets estimation
> Using same logic in display controller and view inset dispatching

Test: Verified on device
Bug: 221961069
Change-Id: I78466353563692ce3f7512b0146ef8b61ef14bc0
2022-03-09 11:15:58 -08:00
Alex Chau
6ed408f59f Use less icons in hotseat when in 3 button nav for tablet
- We have less space on tablets when 3 button nav is enabled because QSB is now inline with the icons. This creates a new attribute to define how many icons should be shown when in that mode. This could be used for other grids in the future as well.
- InvariantDeviceProfile now listens for nav mode changes

Fixes 214882090, 221420204
Test: manual

Change-Id: I012432a1a322c4e5505e46a1198c841ab124aaa6
2022-03-07 18:38:05 +00:00
Sunny Goyal
4403d078a6 Moving NavigationMode to display controller
Navigation mode affects display properties like bounds and
most listeners already had a similar display listener. This
will remove race conditions when managing the two events.

Bug: 221961069
Test: Presubmit
Change-Id: If7a22e006e6b969ecddf075001066809aa72995c
2022-03-04 18:11:33 -08:00
Sunny Goyal
6bc4257d86 Separating refresh rate tracking to a separate class
Bug: 221961069
Test: Presubmit
Change-Id: I04091ebc9f3d88d2dbbde1bf0d5390c815e026d1
2022-02-28 17:13:00 -08:00
Evan Rosky
52ab94bf17 Don't update everything when only refreshrate changes
This was going through the whole display-info-changed flow
when only the refreshrate changed. This was causing updates
with outdated information (where displaymanager callback
happens before configurationchanged). The result is that
things like touch-monitors (based on display info) were
out-of-sync with view content (which is based on configuration).

This change just updates the local record of screenrefresh
when it changes.

Bug: 179308296
Test: With fixed-rotation-in-config, open recents and repeatedly
      rotate the device. Make sure touch regions stay aligned
      with recents content.
Change-Id: I9a8c553dfa55ec4402edcecac44bc87cb51c75fc
2022-01-26 12:11:02 -08:00
Alex Chau
3ec6fc46cf Log display size and bounds returned from each dispaly
Bug: 211775278
Test: manual
Change-Id: I87389ccae5dee2c9a474e93cf8466a11ab6b49d4
2022-01-20 16:04:56 +00:00
Alex Chau
4f49c9ce62 Log the display state when number of screen bounds is inconsistent
- If the number of screen bounds a.k.a. number of displays has changed, it should be a bug from system and add a log for that

Bug: 198965093
Test: manual
Change-Id: I74612e6c0d2f3cfd52b509e43ea16adf0eec76de
2021-11-22 15:16:17 +00:00
Alex Chau
4f140f96e8 Use displayId to determine CHANGE_ACTIVE_SCREEN
- Currently CHANGE_ACTIVE_SCREEN is dispatched when rotating too, which is incorrect. mScreenSizeDp is different in portrait and landscape, and varies more than swapping width/height due to different insets applied. Therefore, use the change of unique display id as a signal instead.

Fix: 202366729
Test: Rotate device, overview stays
Test: Unfold devices, overview goes away
Change-Id: Id8a7d4a1e237717521bfc5a5a67f23c4ee801c61
2021-10-07 14:44:01 +01:00
Sunny Goyal
807de418e9 Ignoring display size change when display is off
Bug: 198965093
Test: Verified with the script provided on the bug
Change-Id: I0efaa5a9b7be94f406a9c283219c715a6c430256
2021-09-30 11:43:26 -07:00
Tracy Zhou
c8beebf5a3 Consolidate isTablet logic across Launcher and SysUI
Fixes: 197960261
Test: Change display size; no nav bar and task bar showing at the same time
Change-Id: I56753e9389a49ca3ee455b248a041b3c1569f153
2021-09-23 15:06:53 -07:00
TreeHugger Robot
667bda8448 Merge "Revert "Revert "Migrating all model tests to Instrumentation tests""" into sc-v2-dev 2021-08-31 10:52:02 +00:00
Sunny Goyal
777d49062f Revert "Revert "Migrating all model tests to Instrumentation tests""
This reverts commit 7a4a30d86d.

Test: Presubmit
Reason for revert: Fixing original bug

Bug: 196825541
Change-Id: Id4b1eb24a89564d264266d305aebea52917dfcd9
2021-08-31 10:51:52 +00:00
Sunny Goyal
6e6f79933e Do not reload launcher when changing active display
> Updating IDP to use fixed bitmap sizes, so that the cache
  stays valid
> Caching last known windowMetrices for non-active displays and
  using estimation only when the cache is not available
> Only reloading model if IDP change could have affected the model
> Remove unnecessary listeners from IDP which are already controlled by
  model lifecycle

Bug: 191657065
Test: Manual
Change-Id: Ia8e6dfafd0977e62aa3fcf367ad79f7a49b2df51
2021-08-26 15:55:21 -07:00
Alex Chau
7a4a30d86d Revert "Migrating all model tests to Instrumentation tests"
This reverts commit 455ba62b5d.

Reason for revert: Breaks tests on all targets

Bug: 196825541
Bug: 197570389
Change-Id: Ida6792a09c54dee46105b6b914a0dd1545bdf48d
2021-08-24 17:27:52 +00:00
Sunny Goyal
455ba62b5d Migrating all model tests to Instrumentation tests
Bug: 196825541
Test: Presubmit
Change-Id: Iebd46eb41eb46c187d569197f4b97b4fddc0f6f7
2021-08-23 12:34:44 -07:00
Alex Chau
e9b2bf514b Use mWindowContext instead of re-creating to avoid stale Resource
- ag/14286682 changed to re-create window context in onConfigChange, which regressed the stale Resource problem, changed back to use mWindowContext instead
- Removed unnecessary extraInternalDisplays empty check, as empty / before S is already handled inside Display Info CTOR

Test: Change display size between default and large, taskbar is enabled/disabled correctly
Bug: 181215299
Change-Id: I7397d2dc1a1ce8e132e706e9de592558df6a18e7
2021-05-06 19:34:49 +01:00
Sunny Goyal
19ff728b92 Adding support for determining split layout for launcher.
> Simulating the windo wmanager API to get available device
  profiles until final API
> When a device has multiple internal displays, and with both
  tablet and phone possibilities, it uses a split workspace layout

Bug: 186160341
Bug: 175782275
Test: Manual
Change-Id: Ieff2329acac7cdd6b9abe6f96cd459cd45bd0efe
2021-05-03 14:48:28 -07:00
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
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
TreeHugger Robot
aa14b19725 Merge changes Id68b6c37,I16d39d3e into sc-dev
* changes:
  Fix a couple of crashes when taskbar isn't yet attached
  Subtract taskbar size from DeviceProfile#availableHeight
2021-02-19 19:01:38 +00:00