From 3a1cfc908209cf1f5fbd40beb8e0580dbc55729f Mon Sep 17 00:00:00 2001 From: Jon Spivack Date: Mon, 11 Jan 2021 17:20:00 -0800 Subject: [PATCH] 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 --- Android.mk | 11 +- .../res/layout/overview_actions_container.xml | 98 ++++++++++++ .../res/values/config.xml | 22 +++ go/quickstep/res/drawable/ic_listen.xml | 32 ++++ go/quickstep/res/drawable/ic_search.xml | 32 ++++ go/quickstep/res/drawable/ic_translate.xml | 32 ++++ go/quickstep/res/values/config.xml | 6 + go/quickstep/res/values/strings.xml | 8 + .../quickstep/TaskOverlayFactoryGo.java | 147 ++++++++++++++++++ .../views/GoOverviewActionsView.java | 75 +++++++++ .../res/layout/overview_actions_container.xml | 0 .../res/values/config.xml | 18 +++ quickstep/res/values/config.xml | 2 - .../android/quickstep/ImageActionsApi.java | 24 ++- .../android/quickstep/TaskOverlayFactory.java | 52 ++++--- 15 files changed, 527 insertions(+), 32 deletions(-) create mode 100644 go/quickstep/overview_ui_overrides/res/layout/overview_actions_container.xml create mode 100644 go/quickstep/overview_ui_overrides/res/values/config.xml create mode 100644 go/quickstep/res/drawable/ic_listen.xml create mode 100644 go/quickstep/res/drawable/ic_search.xml create mode 100644 go/quickstep/res/drawable/ic_translate.xml create mode 100644 go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java create mode 100644 go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java rename quickstep/{ => overview_ui_overrides}/res/layout/overview_actions_container.xml (100%) create mode 100644 quickstep/overview_ui_overrides/res/values/config.xml diff --git a/Android.mk b/Android.mk index 19ad328187..127df79f3b 100644 --- a/Android.mk +++ b/Android.mk @@ -145,7 +145,9 @@ LOCAL_SRC_FILES := \ $(call all-java-files-under, quickstep/src) \ $(call all-java-files-under, src_shortcuts_overrides) -LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/quickstep/res +LOCAL_RESOURCE_DIR := \ + $(LOCAL_PATH)/quickstep/res \ + $(LOCAL_PATH)/quickstep/overview_ui_overrides/res LOCAL_PROGUARD_ENABLED := disabled @@ -174,7 +176,9 @@ LOCAL_SYSTEM_EXT_MODULE := true LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3 -LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/quickstep/res +LOCAL_RESOURCE_DIR := \ + $(LOCAL_PATH)/quickstep/res \ + $(LOCAL_PATH)/quickstep/overview_ui_overrides/res LOCAL_FULL_LIBS_MANIFEST_FILES := \ $(LOCAL_PATH)/quickstep/AndroidManifest-launcher.xml \ @@ -213,7 +217,8 @@ LOCAL_SRC_FILES := \ LOCAL_RESOURCE_DIR := \ $(LOCAL_PATH)/quickstep/res \ $(LOCAL_PATH)/go/res \ - $(LOCAL_PATH)/go/quickstep/res + $(LOCAL_PATH)/go/quickstep/res \ + $(LOCAL_PATH)/go/quickstep/overview_ui_overrides/res LOCAL_PROGUARD_FLAG_FILES := proguard.flags LOCAL_PROGUARD_ENABLED := full diff --git a/go/quickstep/overview_ui_overrides/res/layout/overview_actions_container.xml b/go/quickstep/overview_ui_overrides/res/layout/overview_actions_container.xml new file mode 100644 index 0000000000..b438da32eb --- /dev/null +++ b/go/quickstep/overview_ui_overrides/res/layout/overview_actions_container.xml @@ -0,0 +1,98 @@ + + + + + + + + +