From a824fea0995b85937fa660ba53d1c9aa1ca0b82d Mon Sep 17 00:00:00 2001 From: icechang Date: Thu, 22 Oct 2020 15:22:45 +0800 Subject: [PATCH 1/7] [DO NOT MERGE ANYWHERE] Add swipes left method in Background.java Bug: 153276032 Test: TF_GLOBAL_CONFIG=/google/src/cloud///google3/wireless/android/test_tools/forrest/configs/local-host-config.xml \ pts-tradefed run commandAndExit cuj/ \ --primary-abi-only \ --log-level verbose --log-level-display verbose \ --wifi-network GoogleGuest Change-Id: Ib1cbc609f47a547f173e8170f00af9e8bdfa77bb --- .../android/launcher3/tapl/Background.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index ce94a3e723..b3d487e3bf 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -211,6 +211,65 @@ public class Background extends LauncherInstrumentation.VisibleContainer { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT); } + /** Swipes left to switch to the previous app. */ + public Background quickSwitchToPreviousAppSwipeLeft() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = + mLauncher.addContextLayer("want to quick switch to the previous app")) { + verifyActiveContainer(); + quickSwitchToPreviousAppSwipeLeft(getExpectedStateForQuickSwitch()); + return new Background(mLauncher); + } + } + + protected void quickSwitchToPreviousAppSwipeLeft(int expectedState) { + final boolean launcherWasVisible = mLauncher.isLauncherVisible(); + boolean transposeInLandscape = false; + switch (mLauncher.getNavigationModel()) { + case TWO_BUTTON: + transposeInLandscape = true; + // Fall through, zero button and two button modes behave the same. + case ZERO_BUTTON: { + final int startX; + final int startY; + final int endX; + final int endY; + if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) { + // Swipe from the bottom right to the bottom left of the screen. + startX = mLauncher.getDevice().getDisplayWidth(); + startY = getSwipeStartY(); + endX = 0; + endY = startY; + } else { + // Swipe from the bottom right to the top right of the screen. + startX = getSwipeStartX(); + startY = mLauncher.getRealDisplaySize().y - 1; + endX = startX; + endY = 0; + } + final boolean isZeroButton = + mLauncher.getNavigationModel() + == LauncherInstrumentation.NavigationModel.ZERO_BUTTON; + mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState, + launcherWasVisible && isZeroButton + ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE + : LauncherInstrumentation.GestureScope.OUTSIDE); + break; + } + + case THREE_BUTTON: + // Double press the recents button. + UiObject2 recentsButton = mLauncher.waitForSystemUiObject("recent_apps"); + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); + mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL); + mLauncher.getOverview(); + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); + recentsButton.click(); + break; + } + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT); + } + protected String getSwipeHeightRequestName() { return TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT; } From 8492c6763915ef06cd463ffedfcaf106dc832b23 Mon Sep 17 00:00:00 2001 From: linalex Date: Wed, 25 Nov 2020 10:12:07 +0800 Subject: [PATCH 2/7] [DO NOT MERGE ANYWHERE] Add swipes left method in Background.java Bug: 153276032 Test: TF_GLOBAL_CONFIG=/google/src/cloud///google3/wireless/android/test_tools/forrest/configs/local-host-config.xml \ pts-tradefed run commandAndExit cuj/ \ --primary-abi-only \ --log-level verbose --log-level-display verbose \ --wifi-network GoogleGuest Change-Id: Ib1cbc609f47a547f173e8170f00af9e8bdfa77bb --- .../android/launcher3/tapl/Background.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index 0c4e5a9461..816cd7d3eb 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -210,6 +210,64 @@ public class Background extends LauncherInstrumentation.VisibleContainer { } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT); } + /** Swipes left to switch to the previous app. */ + public Background quickSwitchToPreviousAppSwipeLeft() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = + mLauncher.addContextLayer("want to quick switch to the previous app")) { + verifyActiveContainer(); + quickSwitchToPreviousAppSwipeLeft(getExpectedStateForQuickSwitch()); + return new Background(mLauncher); + } + } + + protected void quickSwitchToPreviousAppSwipeLeft(int expectedState) { + final boolean launcherWasVisible = mLauncher.isLauncherVisible(); + boolean transposeInLandscape = false; + switch (mLauncher.getNavigationModel()) { + case TWO_BUTTON: + transposeInLandscape = true; + // Fall through, zero button and two button modes behave the same. + case ZERO_BUTTON: { + final int startX; + final int startY; + final int endX; + final int endY; + if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) { + // Swipe from the bottom right to the bottom left of the screen. + startX = mLauncher.getDevice().getDisplayWidth(); + startY = getSwipeStartY(); + endX = 0; + endY = startY; + } else { + // Swipe from the bottom right to the top right of the screen. + startX = getSwipeStartX(); + startY = mLauncher.getRealDisplaySize().y - 1; + endX = startX; + endY = 0; + } + final boolean isZeroButton = + mLauncher.getNavigationModel() + == LauncherInstrumentation.NavigationModel.ZERO_BUTTON; + mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState, + launcherWasVisible && isZeroButton + ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE + : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER); + break; + } + + case THREE_BUTTON: + // Double press the recents button. + UiObject2 recentsButton = mLauncher.waitForSystemUiObject("recent_apps"); + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); + mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL); + mLauncher.getOverview(); + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); + recentsButton.click(); + break; + } + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT); + } protected String getSwipeHeightRequestName() { return TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT; From 5662a653da81d73f11578e4f9825c75717269a12 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 15 Jan 2021 09:02:22 -0800 Subject: [PATCH 3/7] Separate TaskView translationX into dismiss + offset translations - Previously, these both setTranslationX() directly, meaning one could clobber the other. Now they are set independently and aggregated to setTranslationX(). - For fake landscape, we actually are setting translationY, so had to create both translationX and translationY properties, and set the appropriate one via the current orientation handler's "primary" dimension. Fixes: 176766821 Change-Id: I204f039331dd43bbbf87bf6a2249238daf4d9877 --- .../android/quickstep/views/RecentsView.java | 11 ++- .../com/android/quickstep/views/TaskView.java | 99 +++++++++++++++++++ .../touch/LandscapePagedViewHandler.java | 4 +- .../touch/PagedOrientationHandler.java | 4 +- .../touch/PortraitPagedViewHandler.java | 4 +- 5 files changed, 113 insertions(+), 9 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 0130cae47b..23941fadc7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -73,7 +73,6 @@ import android.text.StaticLayout; import android.text.TextPaint; import android.util.AttributeSet; import android.util.FloatProperty; -import android.util.Property; import android.util.SparseBooleanArray; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; @@ -1488,7 +1487,9 @@ public abstract class RecentsView extends PagedView } int scrollDiff = newScroll[i] - oldScroll[i] + offset; if (scrollDiff != 0) { - Property translationProperty = mOrientationHandler.getPrimaryViewTranslate(); + FloatProperty translationProperty = child instanceof TaskView + ? ((TaskView) child).getPrimaryFillDismissGapTranslationProperty() + : mOrientationHandler.getPrimaryViewTranslate(); ResourceProvider rp = DynamicResource.provider(mActivity); SpringProperty sp = new SpringProperty(SpringProperty.FLAG_CAN_SPRING_ON_END) @@ -1883,7 +1884,11 @@ public abstract class RecentsView extends PagedView ? modalLeftOffsetSize : modalRightOffsetSize; float totalTranslation = translation + modalTranslation; - mOrientationHandler.getPrimaryViewTranslate().set(getChildAt(i), + View child = getChildAt(i); + FloatProperty translationProperty = child instanceof TaskView + ? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty() + : mOrientationHandler.getPrimaryViewTranslate(); + translationProperty.set(child, totalTranslation * mOrientationHandler.getPrimaryTranslationDirectionFactor()); } updateCurveProperties(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index 0bc6e5166f..a8f2a1cd0e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -153,6 +153,58 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } }; + private static final FloatProperty FILL_DISMISS_GAP_TRANSLATION_X = + new FloatProperty("fillDismissGapTranslationX") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setFillDismissGapTranslationX(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mFillDismissGapTranslationX; + } + }; + + private static final FloatProperty FILL_DISMISS_GAP_TRANSLATION_Y = + new FloatProperty("fillDismissGapTranslationY") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setFillDismissGapTranslationY(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mFillDismissGapTranslationY; + } + }; + + private static final FloatProperty TASK_OFFSET_TRANSLATION_X = + new FloatProperty("taskOffsetTranslationX") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setTaskOffsetTranslationX(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mTaskOffsetTranslationX; + } + }; + + private static final FloatProperty TASK_OFFSET_TRANSLATION_Y = + new FloatProperty("taskOffsetTranslationY") { + @Override + public void setValue(TaskView taskView, float v) { + taskView.setTaskOffsetTranslationY(v); + } + + @Override + public Float get(TaskView taskView) { + return taskView.mTaskOffsetTranslationY; + } + }; + private final OnAttachStateChangeListener mTaskMenuStateListener = new OnAttachStateChangeListener() { @Override @@ -180,6 +232,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private final FullscreenDrawParams mCurrentFullscreenParams; private final BaseDraggingActivity mActivity; + // Various causes of changing primary translation, which we aggregate to setTranslationX/Y(). + // TODO: We should do this for secondary translation properties as well. + private float mFillDismissGapTranslationX; + private float mFillDismissGapTranslationY; + private float mTaskOffsetTranslationX; + private float mTaskOffsetTranslationY; + private ObjectAnimator mIconAndDimAnimator; private float mIconScaleAnimStartProgress = 0; private float mFocusTransitionProgress = 1; @@ -619,6 +678,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { protected void resetViewTransforms() { setCurveScale(1); + mFillDismissGapTranslationX = mTaskOffsetTranslationX = 0f; + mFillDismissGapTranslationY = mTaskOffsetTranslationY = 0f; setTranslationX(0f); setTranslationY(0f); setTranslationZ(0); @@ -835,6 +896,44 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { return mCurveScale; } + private void setFillDismissGapTranslationX(float x) { + mFillDismissGapTranslationX = x; + applyTranslationX(); + } + + private void setFillDismissGapTranslationY(float y) { + mFillDismissGapTranslationY = y; + applyTranslationY(); + } + + private void setTaskOffsetTranslationX(float x) { + mTaskOffsetTranslationX = x; + applyTranslationX(); + } + + private void setTaskOffsetTranslationY(float y) { + mTaskOffsetTranslationY = y; + applyTranslationY(); + } + + private void applyTranslationX() { + setTranslationX(mFillDismissGapTranslationX + mTaskOffsetTranslationX); + } + + private void applyTranslationY() { + setTranslationY(mFillDismissGapTranslationY + mTaskOffsetTranslationY); + } + + public FloatProperty getPrimaryFillDismissGapTranslationProperty() { + return getPagedOrientationHandler().getPrimaryValue( + FILL_DISMISS_GAP_TRANSLATION_X, FILL_DISMISS_GAP_TRANSLATION_Y); + } + + public FloatProperty getPrimaryTaskOffsetTranslationProperty() { + return getPagedOrientationHandler().getPrimaryValue( + TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y); + } + @Override public boolean hasOverlappingRendering() { // TODO: Clip-out the icon region from the thumbnail, since they are overlapping. diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index e64d2bb0f9..bfa24ebf35 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -42,12 +42,12 @@ import com.android.launcher3.util.OverScroller; public class LandscapePagedViewHandler implements PagedOrientationHandler { @Override - public int getPrimaryValue(int x, int y) { + public T getPrimaryValue(T x, T y) { return y; } @Override - public int getSecondaryValue(int x, int y) { + public T getSecondaryValue(T x, T y) { return x; } diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index e4a24072f0..e7d2ad5c3d 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -83,8 +83,8 @@ public interface PagedOrientationHandler { boolean getRecentsRtlSetting(Resources resources); float getDegreesRotated(); int getRotation(); - int getPrimaryValue(int x, int y); - int getSecondaryValue(int x, int y); + T getPrimaryValue(T x, T y); + T getSecondaryValue(T x, T y); void delegateScrollTo(PagedView pagedView, int secondaryScroll, int primaryScroll); /** Uses {@params pagedView}.getScroll[X|Y]() method for the secondary amount*/ void delegateScrollTo(PagedView pagedView, int primaryScroll); diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index e4662de3b3..e5a89679e2 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -40,12 +40,12 @@ import com.android.launcher3.util.OverScroller; public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override - public int getPrimaryValue(int x, int y) { + public T getPrimaryValue(T x, T y) { return x; } @Override - public int getSecondaryValue(int x, int y) { + public T getSecondaryValue(T x, T y) { return y; } From 0646238ab40a43f8db7c9c1dcb3029db2348e41c Mon Sep 17 00:00:00 2001 From: linalex Date: Wed, 25 Nov 2020 10:12:07 +0800 Subject: [PATCH 4/7] [DO NOT MERGE ANYWHERE] Add swipes left method in Background.java Bug: 153276032 Test: TF_GLOBAL_CONFIG=/google/src/cloud///google3/wireless/android/test_tools/forrest/configs/local-host-config.xml \ pts-tradefed run commandAndExit cuj/ \ --primary-abi-only \ --log-level verbose --log-level-display verbose \ --wifi-network GoogleGuest Change-Id: Ib1cbc609f47a547f173e8170f00af9e8bdfa77bb (cherry picked from commit 8492c6763915ef06cd463ffedfcaf106dc832b23) --- .../android/launcher3/tapl/Background.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index 0c4e5a9461..816cd7d3eb 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -210,6 +210,64 @@ public class Background extends LauncherInstrumentation.VisibleContainer { } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT); } + /** Swipes left to switch to the previous app. */ + public Background quickSwitchToPreviousAppSwipeLeft() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = + mLauncher.addContextLayer("want to quick switch to the previous app")) { + verifyActiveContainer(); + quickSwitchToPreviousAppSwipeLeft(getExpectedStateForQuickSwitch()); + return new Background(mLauncher); + } + } + + protected void quickSwitchToPreviousAppSwipeLeft(int expectedState) { + final boolean launcherWasVisible = mLauncher.isLauncherVisible(); + boolean transposeInLandscape = false; + switch (mLauncher.getNavigationModel()) { + case TWO_BUTTON: + transposeInLandscape = true; + // Fall through, zero button and two button modes behave the same. + case ZERO_BUTTON: { + final int startX; + final int startY; + final int endX; + final int endY; + if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) { + // Swipe from the bottom right to the bottom left of the screen. + startX = mLauncher.getDevice().getDisplayWidth(); + startY = getSwipeStartY(); + endX = 0; + endY = startY; + } else { + // Swipe from the bottom right to the top right of the screen. + startX = getSwipeStartX(); + startY = mLauncher.getRealDisplaySize().y - 1; + endX = startX; + endY = 0; + } + final boolean isZeroButton = + mLauncher.getNavigationModel() + == LauncherInstrumentation.NavigationModel.ZERO_BUTTON; + mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState, + launcherWasVisible && isZeroButton + ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE + : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER); + break; + } + + case THREE_BUTTON: + // Double press the recents button. + UiObject2 recentsButton = mLauncher.waitForSystemUiObject("recent_apps"); + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); + mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL); + mLauncher.getOverview(); + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); + recentsButton.click(); + break; + } + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT); + } protected String getSwipeHeightRequestName() { return TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT; From b453ef76212b31cd20075242108726b393d14fdb Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 25 Jan 2021 15:30:26 -0500 Subject: [PATCH 5/7] Fix bug where dragview gets stuck on screen. * Since the BubbleTextViews views do not have a listener, the long press was still getting triggered even though it was in a pressed state. * We only trigger long press if the view is not pressed or if there is no listener. * A listener is only added for widgets, and for long press wiidgets are not pressed state. Bug: 162636845 Test: manual test, repo steps in bug Change-Id: Ia9df12cf31a0844403d69ddacebf2bdbc5c59d3b (cherry picked from commit 6fa63473e197e0abf6664a3899555019a829e119) --- src/com/android/launcher3/CheckLongPressHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/CheckLongPressHelper.java b/src/com/android/launcher3/CheckLongPressHelper.java index ff405ece3e..c707df04c0 100644 --- a/src/com/android/launcher3/CheckLongPressHelper.java +++ b/src/com/android/launcher3/CheckLongPressHelper.java @@ -115,7 +115,7 @@ public class CheckLongPressHelper { private void triggerLongPress() { if ((mView.getParent() != null) && mView.hasWindowFocus() - && (!mView.isPressed() || mListener == null) + && (!mView.isPressed() || mListener != null) && !mHasPerformedLongPress) { boolean handled; if (mListener != null) { From a62e49b365739d8b3c918380c316e65376de085e Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 27 Jan 2021 14:05:01 -0800 Subject: [PATCH 6/7] Fix missing grid for devices that upgrade from R Fixes: 178435615 Test: TODO Change-Id: I9894b88485daf5b641b4674a5abff05e0f53138b --- AndroidManifest-common.xml | 2 +- src/com/android/launcher3/Utilities.java | 4 ++-- ...idOptionsProvider.java => GridCustomizationsProvider.java} | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/com/android/launcher3/graphics/{GridOptionsProvider.java => GridCustomizationsProvider.java} (97%) diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index ff5bf0d1e5..77f2428177 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -154,7 +154,7 @@ TODO: Add proper permissions --> diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index bf637886b7..292a808b4e 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -67,7 +67,7 @@ import androidx.core.os.BuildCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dragndrop.FolderAdaptiveIcon; -import com.android.launcher3.graphics.GridOptionsProvider; +import com.android.launcher3.graphics.GridCustomizationsProvider; import com.android.launcher3.graphics.TintedDrawableSpan; import com.android.launcher3.icons.IconProvider; import com.android.launcher3.icons.LauncherIcons; @@ -521,7 +521,7 @@ public final class Utilities { public static boolean isGridOptionsEnabled(Context context) { return isComponentEnabled(context.getPackageManager(), context.getPackageName(), - GridOptionsProvider.class.getName()); + GridCustomizationsProvider.class.getName()); } private static boolean isComponentEnabled(PackageManager pm, String pkgName, String clsName) { diff --git a/src/com/android/launcher3/graphics/GridOptionsProvider.java b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java similarity index 97% rename from src/com/android/launcher3/graphics/GridOptionsProvider.java rename to src/com/android/launcher3/graphics/GridCustomizationsProvider.java index 08d7e4c65e..cb42e7aa05 100644 --- a/src/com/android/launcher3/graphics/GridOptionsProvider.java +++ b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java @@ -40,9 +40,9 @@ import java.util.List; * /default_grid: Call update to set the current grid, with values * name: name of the grid to apply */ -public class GridOptionsProvider extends ContentProvider { +public class GridCustomizationsProvider extends ContentProvider { - private static final String TAG = "GridOptionsProvider"; + private static final String TAG = "GridCustomizationsProvider"; private static final String KEY_NAME = "name"; private static final String KEY_ROWS = "rows"; From 8786016e859c639de1d3722c1911b5389ef8fc39 Mon Sep 17 00:00:00 2001 From: Alex Johnston Date: Mon, 29 Mar 2021 13:51:38 +0100 Subject: [PATCH 7/7] 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 Merged-In: I3e6ba1d8645335785e8e26cdc895ea9c0017a0fd --- .../src/com/android/quickstep/TaskOverlayFactory.java | 2 +- .../src/com/android/quickstep/views/TaskThumbnailView.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java index e9614d1351..1eaacd30bb 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java @@ -146,7 +146,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { */ public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix, boolean rotated) { - final boolean isAllowedByPolicy = thumbnail.isRealSnapshot; + final boolean isAllowedByPolicy = mThumbnailView.isRealSnapshot(); getActionsView().updateDisabledFlags(DISABLED_ROTATED, rotated); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java index b2f937f8c2..dbea80adbc 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java @@ -447,13 +447,14 @@ public class TaskThumbnailView extends View implements PluginListener