239 Commits

Author SHA1 Message Date
Stefan Andonian
146701ca3e Move SharedPreferences code to its own class.
Bug: 251502424
Test: Code compiled correctly.
Change-Id: Iea0d6ab2999504117546ee0f7adc0c7b8b45c065
2022-11-17 17:22:47 +00:00
Abhilasha Chahal
ee14d4761a Add LAUNCHER_SYSTEM_SHORTCUT_APP_SHARE_TAP event
Bug: 233224567
Test: Manually verified the event in logs
Change-Id: Ie81ca8774adb241f1c8635444dad884f34f3929d
2022-05-19 19:21:45 +00:00
kholoud mohamed
00f80ed1ae Add missing enterprise string
Bug: 231592687
Test: manual
Change-Id: I59e4d899084c965dfbca49f6c65c3b9809a89ed8
2022-05-09 19:48:40 +01:00
Tracy Zhou
c2538d748a Add originalView of the menu to SystemShortcut
Split from home animation needs to originate from the app icon instead of the menu item icon. This can be useful for other animations in the future.

Bug: 226395821
Test: N/A
Change-Id: If45d80e347ba275bd550b6acd6ad81b319e753a3
2022-04-11 17:13:35 -07:00
Jon Spivack
4a2732da03 AppSharing: Better handling of Work Profiles
This change improves the Work Profile use case in two ways:
1. When sharing is disabled for the profile, the Share App button is grayed out, and an appropriate message is displayed if the user taps it.
2. When sharing is enabled for the profile, it actually works.

Bug: 175159046
Bug: 210168826
Test: Manual (toggled DISALLOW_BLUETOOTH_SHARING via Test DPC on local device)
Test: m -j RunLauncherGoGoogleRoboTests ROBOTEST_FILTER=com.android.launcher3.AppSharingTest
Change-Id: Id7ba8efc587d0b94aa1f9b2004bf45254b39f992
2022-01-05 14:14:00 -08:00
Fedor Kudasov
920dc2f28f Add @Nullable annotations for simple cases
Add @Nullable annotations for the fields that are expected
to be null at arbitrary lifecycle time and are their usage
is protected by null checks.

Bug: 205828770
Test: m LauncherGoResLib
Change-Id: I9c31e1dc0d01cdd68dfff0a005ba1f40c257f8ea
2021-11-11 14:58:45 +00:00
Jon Spivack
688621498a P2P App Sharing: Gray out disabled SystemShortcut
The Share App system shortcut is disabled for apps that are deemed unshareable. This updates the UX to gray out the shortcut instead of hiding it. When the user clicks on the grayed out shortcut, a Toast message is displayed. This update also enables the shareability check.

In order to properly gray out the shortcut, this also fixes a bug with BubbleTextView in which ColorStateLists weren't applied correctly.

Bug: 202556634
Bug: 204495363
Test: Manual (observed UX on Wembley device in regular and dark themes)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: Ieb04baf8c9cb9d325119cb97fceb96f2fc5a62ff
2021-10-28 19:30:31 -07:00
TreeHugger Robot
e57bcd984f Merge "Remove check that system rotation must be allowed for recents rotation to be allowed." into sc-v2-dev am: 42b5b78bbf am: d60f4bf549
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15940373

Change-Id: I887750ba8b885e371d8268cb8e615cae4a17b403
2021-09-29 17:08:39 +00:00
Pat Manning
da71f41263 Remove check that system rotation must be allowed for recents rotation
to be allowed.

This check existed before the user was able to rotate via the rotation
button while autorotate setting is off.

Test: manual
Fix: 201511975
Change-Id: I920886cb42ec5b8f4d3eb0bdd80b216cd7c3c849
2021-09-29 14:06:55 +00:00
Jon Spivack
89c21c77f5 P2P App Sharing: Add Shareability Cache
This update allows Launcher to check with an external API to determine whether apps
are shareable before displaying the Share App button. To prevent
extraneous calls to the API, the retrieved shareability data
are cached. A job is scheduled to update this cache once a week.

This feature can be toggled with the ENABLE_SHAREABILITY_CHECK flag in
AppSharing.java. It is currently disabled, as the Play API has only been
partially rolled out.

More details on the design are available at go/app-shareability-cache-design

Bug: 168831749
Test: manual (local Wembley device)
Test: m -j RunLauncherGoGoogleRoboTests ROBOTEST_FILTER="AppShareabilityManagerTest|AppSharingTest"
Change-Id: I971a3776e09b6842dedf315ec592317050dd6790
2021-09-20 17:11:04 -07:00
Jon Spivack
0dea19a9d2 NIU Actions: Dismiss modal dialogs when overlay is closed
This prevents overlay-specific dialogs (e.g. the privacy confirmation for NIU Actions) from staying open when the user closes the overlay. For example, the user can tap the Home button or lock the device while a dialog is open on the Recents screen. In these cases, the user is sent to the Home screen, so it wouldn't make sense to leave Recents-related dialogs open.

Bug: 194991283
Test: Manual (local Wembley device)
Change-Id: Ie922ddf5d503b8b9818ee7887021f4df8520ae00
2021-09-02 16:16:08 -07:00
Jon Spivack
bb7553017c Add callback to ImageActionUtils for unresolved intents
Adding an optional callback to ImageActionUtils.persistBitmapAndStartActivity allows for external handling of the case in which the given intent cannot be resolved. The main use case is for NIU Actions when the user has chosen an assistant that does not support the feature. TaskOverlayFactoryGo provides a callback that shows a dialog in this case.

Various parts of TaskOverlayFactoryGo were also made public for better testability.

Bug: 196125662
Bug: 192406446
Bug: 195681795
Test: m -j RunLauncherGoGoogleRoboTests ROBOTEST_FILTER=TaskOverlayFactoryGoTest
Change-Id: I64f3a1274bc942a64e964dca20bd4245e336ad9d
2021-08-13 13:30:22 -07:00
Jon Spivack
65b105bdee Merge "NIU Actions: Handle null default assistant" 2021-08-05 21:38:49 +00:00
Jon Spivack
91fdf160c5 NIU Actions: Handle null default assistant
This handles the case where Settings.Secure.ASSISTANT is null, which occurs when config_defaultAssistant is not set at build time.

Bug: 195600539
Test: Manual (built locally without config_defaultAssistant)
Test: b/195681795
Change-Id: Ie8da67be5f448847c07438a25b12e8b5b2022f05
2021-08-05 20:42:12 +00:00
kumarashishg
6a5c260404 NIU Tooltip : tooltip timer changes
Tooltip will hide only when the user tapped anywhere on the screen. Earlier tooltip was auto dismissed after 10 seconds.

Bug: 194775081
Test: Local build and run on Pixel 4a
Change-Id: I22f5cdd20e602fc261218d4fa801e80910083c62
(cherry picked from commit 89f7d40c217a81d17519ebf04bcb6b24c2c76b8a)
2021-08-03 02:22:38 +00:00
kumarashishg
8185dedf56 NIU Tooltip : tooltip overlap issue fix
Overlay is getting updated multiple times, So If a tooltip is getting
shown then next overlay update call will trigger new tooltip regardless of current tooltip behavior.

If a tooltip is getting shown then other tooltips should not be triggered. Added a check for this.

Bug: 194458724
Test: Local build and run on Pixel 4a
Change-Id: I5266ddd7cfa84258b46dc14846d77872752ac442
(cherry picked from commit ced47f4ae652987f746daeec2367d184b1d63937)
2021-07-28 17:53:50 +00:00
Jon Spivack
de28038e64 NIU Actions: Hide button captions when feature is disabled
Previously, only the buttons themselves were hidden when the feature was flagged off at build time. This adds the rest of the relevant layout UI (captions, spaces) to that logic.

Bug: 192692326
Test: Manual (Pixel 3A, enable_niu_actions on and off)
Change-Id: Ic58d9891887e3e0eb10d38af80b73f04cf66ea79
2021-07-13 18:56:45 -07:00
TreeHugger Robot
ccd3026485 Merge "NIU Actions: Add assistant error dialogs" into sc-dev 2021-07-13 01:05:03 +00:00
Jon Spivack
8bf8ba735a NIU Actions: Add assistant error dialogs
The NIU Actions buttons send intents to the user's default assistant. If the user clicks one of the buttons without an appropriate default assistant set, a dialog will appear to explain the situation and redirect the user to Settings.

The existing privacy confirmation dialog code has been refactored into a reusable dialog, which is used here.

Bug: 192505939
Test: Manual on local Pixel 3A (unit tests to be added in b/192406446)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: I7b43e008aa74805b166c09936fa938a5834c8460
2021-07-12 16:23:46 -07:00
Tracy Zhou
e23157bbb0 End live tile for overview actions in Android Go
Fixes: 193275019
Test: N/A
Change-Id: I0c22e557face73f656273da4fec4521a9c86d606
2021-07-10 07:13:58 +00:00
kumarashishg
88be649d21 NIU Actions: Add NIU Actions tooltip
These tooltips are added to educate the user about NIU buttons actions. We have added tooltips for Translate and Listen NIU actions buttons.

Bug: 186006700
Test: Manual
Change-Id: Ib076c2a44055b62f2daf06bddf45aca220a28756
2021-07-08 00:48:22 +00:00
Jon Spivack
58905b4f0a NIU Actions: Add privacy confirmation dialog
This adds a dialog to inform the user that the NIU Actions buttons need to send data to Google in order to function. The user can accept or reject this. The dialog will block use of the feature until the user accepts.

Bug: 191818216
Test: Manual (Pixel 3A with multiple user profiles)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: Iedd056ce239de5269d02a31d28a9778efae34ede
2021-06-29 18:29:22 -07:00
Jon Spivack
02bbd80ee9 NIU Actions: More specific permissions error codes
The user must enable two different Assistant permissions for the NIU Actions feature to function. Previously, a single error code was sent if either permission was missing. Now a different code is sent depending on which permission is missing, allowing Google Go to better direct the user to the proper setting.

Bug: 191109150
Test: Manual (Pixel 3A)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: Id301ffddf36b992b5722c52ccc6e597e003942dd
2021-06-21 16:49:40 -07:00
Jon Spivack
77edb686d7 Send NIU Actions Intents to default Assistant
This changes the recipient for NIU Actions from a package hard-coded in a config file to the currently selected default Assistant. The user can change this under Settings -> Default apps.

ImageActionUtils has also been updated to handle the case where its
Intents cannot be resolved, preventing a crash if the user sets the
default Assistant to something that cannot receive NIU Actions.

Bug: 186655099
Test: Manual (Pixel 3A, set default Assistant to Google Go and None)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: I03b93597092575902d507615f32b63f4050c4c69
2021-06-11 13:58:57 -07:00
Jon Spivack
1bd7ccd90b TaskOverlayFactoryGo: Keep persistent instance of AssistContentRequester
Holding a reference to AssistContentRequester prevents it from being deleted by the garbage collector while it is still in use.

Bug: 189985872
Test: Manual (Pixel 3A)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: I204aab907175a171c496c3bd146a8b23d2bbcf16
2021-06-02 16:40:09 -07:00
Jon Spivack
6eb0186616 NIU Actions: Do not send image URI when sending error code
In the case of a permissions denial, we do not send a screenshot in the NIU Actions Intent. Previously, we sent a fake URI to fit with existing recipient Intent filters, but the recipients have been updated to no longer require this.

Bug: 186780965
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: I7cf92a03946e1663150f963fcea7f6b92833da68
2021-05-27 14:39:16 -07:00
Jon Spivack
cdbaea4486 Disable NIU Actions on Work Profile apps
If the currently selected Recent app belongs to a Work Profile, do not allow the user to invoke any of the overview actions. Instead, show the standard blocked by policy message (R.string.blocked_by_policy).

Bug: 187491010
Test: Manual (Pixel 3A)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: I552da9512ab19993eb4bb65fe9269d2aee9f0c4e
2021-05-19 14:58:27 -07:00
Jon Spivack
9e0189bac6 Default screen context permissions for NIU Actions
This updates the checks for ASSIST_STRUCTURE_ENABLED and ASSIST_SCREENSHOT_ENABLED to return 1 if the settings do not exist. This matches the logic in the Settings app iself, which has the toggle boxes on by default but does not actually initialize those values until they are toggled for the first time.

Bug: 187868947
Test: Manual (tested on Pixel 3A)
Change-Id: I4ef067dcf21b40eea71199e057d7a00d1d8fb2b3
2021-05-11 19:02:58 -07:00
Jon Spivack
bdf64e79bd Add app package names to NIU Actions Intents
This adds the package name of the currently suspended app to the NIU Actions Intents, for logging purposes.

Bug: 186388671
Test: Manual (printed out the Intent extras while trying various apps)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: I8180347675c8940c960e4aa4c47dec508207c780
2021-04-30 17:37:16 -07:00
Jon Spivack
c5919749ea Check screen context permissions for NIU Actions
This checks for the ASSIST_STRUCTURE_ENABLED and ASSIST_SCREENSHOT_ENABLED permissions before sending NIU Actions Intents. If either permission is absent, the screenshot is not sent, and an error code is added to the Intent.

Bug: 182010359
Test: Manual (toggled permissions and clicked NIU Actions buttons on Wembley device)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: Icf0db739f5010862cc2bac496f5410665625f3be
2021-04-28 18:26:13 -07:00
Zak Cohen
733efa1bcd Overview - extract AssistContentRequester logic for reuse.
Extract the logic for fetching AssistContent into a common reusable place.

Bug: 179705864
Test: Local build of main launcher
Change-Id: Ife37a393d93f899fa1ae460bdcf0cadff6468b04
2021-03-27 14:53:34 -07:00
Alex Johnston
ad4c83ad36 Merge "Block recent work profile apps content capture" into sc-dev 2021-03-25 09:14:05 +00:00
Jon Spivack
375a1bbb92 TaskOverlayFactoryGo: Minor updates for testability
Made a few things public and marked them as @VisibleForTesting.

Bug: 179738220
Test: atest -v LauncherGoGoogleRoboTests
Change-Id: I231316ecf9282ad4d54038e218f44f062b3fa413
2021-03-24 04:05:03 -07:00
Alex Johnston
284aaba153 Block recent work profile apps content capture
Stop data exposure of work profile by blocking
content capture of recents apps when the work
profile is locked.

Manual testing steps
* Set up work profile
* Set personal and work pattern
* Open work app, enter work pattern and
  verify content capture is possible
* Lock device
* Go to Recents and select already opened
  work app. Verify content capture is not
  possible until work pattern is entered.

Bug: 168802517
Test: manual testing
Change-Id: I3e6ba1d8645335785e8e26cdc895ea9c0017a0fd
2021-03-23 16:09:39 +00:00
Jon Spivack
840b42f66f Pass Assistant web URI in NIU Actions
The Task Overlay for the activity shown in Recents requests the AssistContent for that activity. If the content includes a web URI, this is added to the Intents sent by the NIU Actions buttons.

Bug: 180157890
Test: Manual (tested with Chrome as the recent activity on local device)
Test: TODO (b/179738220)
Change-Id: I33c79e75678605693e0282e4ad82dc6af28957dd
2021-03-17 17:47:29 -07:00
Jon Spivack
3a1cfc9082 Add NIU Actions buttons to the Go Overview
The buttons send Intents to the designated app (specified by
niu_actions_package) to do the following:
Listen - Read the contents of the screen aloud
Translate - Translate the contents of the screen
Search - Perform a visual search on the contents of the screen

The Intents also include (via URI) the screenshot of current app used as
a thumbnail by Recents.

The feature is controlled by the enable_niu_actions flag, set to false
here. Both this flag and the niu_actions_package String must be set for
a given Launcher to use these buttons.

Bug: 177955244
Bug: 177955748
Test: Manual (enabled on LauncherGoGoogle and sent Intents to demo Lens
app)

Change-Id: I3d1f870bb176ed0cbae637a45c072bd8acac1d4b
2021-02-09 14:50:56 -08:00
Jon Spivack
a89a5084f2 Add the Share App system shortcut to the Go Launcher
This shortcut allows users to initiate peer-to-peer app sharing from an app's long-press menu on the home screen. It does so by passing an intent to the specified component. In this base implementation, that specification in config.xml is left blank, and the button will not appear. In GMS Launchers such as LauncherGoGoogle, the config should be set to point to Nearby Sharing.

This also establishes Launcher3QuickStepGo as a distinct subclass of QuickstepLauncher instead of merely a build configuration.

Bug: 157515296
Bug: 174286192
Test: Manual (tested on local wembley devices)
Test: m -j RunLauncherGoGoogleRoboTests
Change-Id: I826bd03721d2e7e963b15d5958e9a18a1cc16f1d
2020-11-30 18:53:56 -08:00
Peter Kalauskas
0842cf5f9d Remove Launcher3GoIconRecents
Bug: 144129431
Test: Build and check that Launcher3QuickStepGo is used instead
Change-Id: Ib2a30c9e1e78de7792f34c3505372c8af1cb307d
2019-12-11 12:18:52 -08:00
Sunny Goyal
337c81f664 Removing static instances of UserManagerCompat and AppWidgetManager
> Changing the lifecycle to follow other static objects in Launcher
> Removing compat interface and inlining everything to helpers

Bug: 141376165
Change-Id: I82bd5db1969101de9a7eac77f32728d70195bb35
2019-12-11 10:03:19 -08:00
Tony Wickham
37a0970bf5 Improve quick switch from home by tracking both x and y motion
- Add NoButtonQuickSwitchTouchController which uses
  BothAxesSwipeDetector to track horizontal and vertical motion.
- Initially, we only detect swipe left to right to quick switch
  (like before), but then we allow swipe up to either go to
  overview (if you hold) or back home (if you don't hold).
- xDisplacement transitions non-overview components out (e.g. shelf
  and workspace), and translates overview in.
- yDisplacement translates overview up and scales it down

Bug: 126596417
Change-Id: Id679ad84c08246e205c667a78ed5df00d7276258
2019-11-14 15:50:18 -08:00
Tony Wickham
85d6f25016 Move shelf peeking anim code to ShelfPeekAnim class
Bug: 126596417
Change-Id: I5ba501b04b3eaf12a20ba1312ef362f9734761c3
2019-11-07 15:21:23 -08:00
Sunny Goyal
14168431bd Adding support for dynamic calendar and clock icons
Change-Id: Icdba34340a27a4f6dff7310d0bf9fd29aef1330c
2019-10-29 13:50:02 -07:00
Sunny Goyal
210e174c9c Subclassing Launcher instead of using UiFactory
Allows us to override only the required methods, instead of providing
a proxy method for everything

Change-Id: I816dcdb2a8d5432496050118ded0f2bbe7122cf7
2019-10-21 11:10:21 -07:00
Winson Chung
dd9d1ea1bf 12/ Clean up some ActivityInterface calls
- Require users of the activity interface to go through the interface to
  get the raw activity
- Remove calls that pass in the activity since the interface already can
  get the reference to it internally (and the interface always has the
  reference before the caller)

Bug: 141886704

Change-Id: I13e52caba593db918e8a7764c751044142fe7ece
Signed-off-by: Winson Chung <winsonc@google.com>
2019-10-16 17:18:12 -07:00
Winson Chung
c9bf6d45ac 9/ Clean up swipe shared state
- Add TaskAnimationManager which keeps track of the animation state whose
  lifecycle can be longer than the gesture.  Move some of the logic related
  to cleaning up old animations into this class (called when the state is
  shared across gestures).
- Instead of calling into the shared state directly via UIFactory, add
  callback to cleanup the animation and shared state from Launcher

Bug: 141886704

Change-Id: Ib6140b37162f7460a20fa1046cfd4f4068e4a1c6
Signed-off-by: Winson Chung <winsonc@google.com>
2019-10-16 17:17:34 -07:00
Winson Chung
d7269bf8b6 8/ Rename ActivityControlHelper
- ActivityControlHelper -> BaseActivityInterface
  LauncherActivityControlHelper -> LauncherActivityInterface
  FallbackActivityControlHelper -> FallbackActivityInterface
  QuickCaptureTouchConsumer -> QuickCaptureInputConsumer
- Move gestures to use the activity interface from the gesture state

Bug: 141886704
Change-Id: I6f12daeb03d564143404767dfe4576e3e5da2a1d
2019-10-08 13:39:13 -07:00
Winson Chung
d3da92ac66 7/ Rename RecentsAnimationWrapper
- Move the recents animation classes out of util into base quickstep pkg
- Clean up some local var names

Bug: 141886704
Change-Id: I1556179e203cbb43b77ea58e6fe520aa9944099b
2019-10-08 13:30:27 -07:00
Winson Chung
8ff53f7e65 4/ Move SystemUiProxy to its own singleton instead of routing through the model
Bug: 141886704
Change-Id: I415b9ef7b57b525407e3a341b946e3ca66125102
2019-10-08 13:15:13 -07:00
Winson Chung
75eb0e0f20 2/ Move device state logic to its own class
- Feed the class down to the input consumers and related gesture classes
  instead of specific sysui state flags

Bug: 141886704

Change-Id: I2ade7f48555c9d0ba0d3fac5c1f2dae694624224
2019-10-07 20:49:08 -07:00
Winson Chung
92a015f2fc 1/ Renaming some classes for clarity
- SwipeAnimationTargetSet -> RecentsAnimationTargets
- RemoteAnimationTargetSet -> RemoteAnimationTargets
- RecentsAnimationListenerSet -> RecentsAnimationCallbacks
- SwipeAnimationTargetSet.SwipeAnimationListener -> RecentsAnimationCallbacks.RecentsAnimationListener
- ClipAnimationHelper -> AppWindowAnimationHelper
- AssistantTouchConsumer -> AssistantInputConsumer

Bug: 141886704

Change-Id: I78485a1651bb360ffbac2d0c462855931a995ee1
2019-10-07 20:49:08 -07:00