From 09fee3abd5719e043675c5962a49b4ffc0c7ee89 Mon Sep 17 00:00:00 2001 From: Suphon Thanakornpakapong Date: Sat, 23 Oct 2021 00:32:34 +0700 Subject: [PATCH] Fix overview screenshot button --- .../systemui/shared/recents/ISystemUiProxy.aidl | 6 ++++++ .../res/layout/overview_actions_container.xml | 4 +--- .../overview/LawnchairOverviewActionsView.kt | 8 ++++++++ .../src/com/android/quickstep/SystemUiProxy.java | 16 ++++++++++++++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/SystemUIShared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/SystemUIShared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl index 351941162d..d5fe7d07fe 100644 --- a/SystemUIShared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +++ b/SystemUIShared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl @@ -123,6 +123,12 @@ interface ISystemUiProxy { */ void notifyPrioritizedRotation(int rotation) = 25; + /** + * Handle the provided image as if it was a screenshot. + */ + void handleImageBundleAsScreenshotR(in Bundle screenImageBundle, in Rect locationInScreen, + in Insets visibleInsets, in Task.TaskKey task) = 26; + /** * Handle the provided image as if it was a screenshot. */ diff --git a/lawnchair/res/layout/overview_actions_container.xml b/lawnchair/res/layout/overview_actions_container.xml index 8596d6bcb0..e43850d50a 100644 --- a/lawnchair/res/layout/overview_actions_container.xml +++ b/lawnchair/res/layout/overview_actions_container.xml @@ -38,9 +38,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableStart="@drawable/ic_screenshot" - android:text="@string/action_screenshot" - android:theme="@style/ThemeControlHighlightWorkspaceColor" - android:visibility="gone" /> + android:text="@string/action_screenshot" /> (this, R.id.action_screenshot).isVisible = false + } else { + ViewCompat.requireViewById(this, R.id.action_share).isVisible = false + } + val lensIntent = context.packageManager.getLaunchIntentForPackage("com.google.ar.lens") val lensAvailable = lensIntent != null diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 44c568d753..096ad6c188 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -35,6 +35,7 @@ import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceControl; +import com.android.launcher3.Utilities; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.systemui.shared.recents.ISystemUiProxy; @@ -399,13 +400,24 @@ public class SystemUiProxy implements ISystemUiProxy, } } + @Override + public void handleImageBundleAsScreenshotR(Bundle screenImageBundle, Rect locationInScreen, + Insets visibleInsets, Task.TaskKey task) { + // just a placeholder + } + @Override public void handleImageBundleAsScreenshot(Bundle screenImageBundle, Rect locationInScreen, Insets visibleInsets, Task.TaskKey task) { if (mSystemUiProxy != null) { try { - mSystemUiProxy.handleImageBundleAsScreenshot(screenImageBundle, locationInScreen, - visibleInsets, task); + if (Utilities.ATLEAST_S) { + mSystemUiProxy.handleImageBundleAsScreenshot(screenImageBundle, locationInScreen, + visibleInsets, task); + } else { + mSystemUiProxy.handleImageBundleAsScreenshotR(screenImageBundle, locationInScreen, + visibleInsets, task); + } } catch (RemoteException e) { Log.w(TAG, "Failed call handleImageBundleAsScreenshot"); }