From 4bc691b9881d2d6336cd39bf9d0063579f7d5fed Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 13 Jul 2020 20:02:13 -0700 Subject: [PATCH 01/72] Removing workarounds for a fixed bug Bug: 148422894 Change-Id: Ic6faa173ac5f28c8656daf68ac8304563264afdd --- .../com/android/quickstep/NavigationModeSwitchRule.java | 4 ++-- .../android/launcher3/util/rule/FailureInvestigator.java | 6 ------ .../android/launcher3/tapl/LauncherInstrumentation.java | 8 +------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java index 40265c47e2..0f6671d18c 100644 --- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java @@ -188,7 +188,7 @@ public class NavigationModeSwitchRule implements TestRule { SYS_UI_NAVIGATION_MODE.removeModeChangeListener(listener)); Wait.atMost(() -> "Navigation mode didn't change to " + expectedMode, - () -> currentSysUiNavigationMode() == expectedMode, 60000 /* b/148422894 */, + () -> currentSysUiNavigationMode() == expectedMode, WAIT_TIME_MS, launcher); // b/139137636 // assertTrue(launcher, "Navigation mode didn't change to " + expectedMode, @@ -202,7 +202,7 @@ public class NavigationModeSwitchRule implements TestRule { Wait.atMost(() -> "Switching nav mode: " + launcher.getNavigationModeMismatchError(), () -> launcher.getNavigationModeMismatchError() == null, - 60000 /* b/148422894 */, launcher); + WAIT_TIME_MS, launcher); AbstractLauncherUiTest.checkDetectedLeaks(launcher); return true; } diff --git a/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java b/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java index e4f520f891..77546de3cc 100644 --- a/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java +++ b/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java @@ -87,12 +87,6 @@ class FailureInvestigator { return 145935261; } - if (matches("java\\.lang\\.AssertionError\\: http\\:\\/\\/go\\/tapl \\: want to get " - + "workspace object; Presence of recents button doesn't match the interaction " - + "mode, mode\\=ZERO_BUTTON, hasRecents\\=true", exception)) { - return 148422894; - } - final String logSinceBoot; try { final String systemBootTime = diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 0cf611ad26..ecf51a7ff9 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -548,13 +548,7 @@ public final class LauncherInstrumentation { assertEquals("Unexpected display rotation", mExpectedRotation, mDevice.getDisplayRotation()); - // b/148422894 - String error = null; - for (int i = 0; i != 600; ++i) { - error = getNavigationModeMismatchError(); - if (error == null) break; - sleep(100); - } + final String error = getNavigationModeMismatchError(); assertTrue(error, error == null); log("verifyContainerType: " + containerType); From 40c9cfa3c87fda871486486b16ca353d15073c3f Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 14 Jul 2020 15:51:24 -0700 Subject: [PATCH 02/72] Productizing useful diags The bug doesn't repro, but it makes sense to keep the diags Bug: 156287114 Change-Id: I4a9f43e02eec1b1386067a90e4c17ad109adcfa5 --- .../launcher3/tapl/LauncherInstrumentation.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 0cf611ad26..f90dff281c 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -448,7 +448,7 @@ public final class LauncherInstrumentation { } } - dumpDiagnostics(); + dumpDiagnostics(message); log("Hierarchy dump for: " + message); dumpViewHierarchy(); @@ -456,10 +456,11 @@ public final class LauncherInstrumentation { return message; } - private void dumpDiagnostics() { - Log.e("b/156287114", "Input:"); + private void dumpDiagnostics(String message) { + log("Diagnostics for failure: " + message); + log("Input:"); logShellCommand("dumpsys input"); - Log.e("b/156287114", "TIS:"); + log("TIS:"); logShellCommand("dumpsys activity service TouchInteractionService"); } @@ -467,10 +468,10 @@ public final class LauncherInstrumentation { try { for (String line : mDevice.executeShellCommand(command).split("\\n")) { SystemClock.sleep(10); - Log.d("b/156287114", line); + log(line); } } catch (IOException e) { - Log.d("b/156287114", "Failed to execute " + command); + log("Failed to execute " + command); } } @@ -1365,7 +1366,7 @@ public final class LauncherInstrumentation { if (mCheckEventsForSuccessfulGestures) { final String message = eventChecker.verify(WAIT_TIME_MS, true); if (message != null) { - dumpDiagnostics(); + dumpDiagnostics(message); checkForAnomaly(); Assert.fail(formatSystemHealthMessage( "http://go/tapl : successful gesture produced " + message)); From 5e19073c237963a3f69c229e3778710077613fc8 Mon Sep 17 00:00:00 2001 From: Sreyas Date: Mon, 6 Jul 2020 17:45:59 -0700 Subject: [PATCH 03/72] Fixing oav text overlap. Bug: 159240113 Change-Id: I89d8249c21cca86f21cdf57a017745237b4b6cf1 --- quickstep/res/layout/overview_actions_container.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/quickstep/res/layout/overview_actions_container.xml b/quickstep/res/layout/overview_actions_container.xml index e05688eca3..258f24a54e 100644 --- a/quickstep/res/layout/overview_actions_container.xml +++ b/quickstep/res/layout/overview_actions_container.xml @@ -17,9 +17,7 @@ + android:layout_gravity="center_horizontal|bottom"> Date: Fri, 17 Jul 2020 18:23:59 -0700 Subject: [PATCH 04/72] Introducing a new gesture scope Gesture may occur outside of Launcher and not trigger system gesture recognition by TIS. Change-Id: Ibbb0180d6ef3856ab652164e6f3c1c86488a4caa --- .../android/launcher3/tapl/Background.java | 6 ++--- .../tapl/LauncherInstrumentation.java | 23 ++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index ce94a3e723..0c4e5a9461 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -85,7 +85,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer { final LauncherInstrumentation.GestureScope gestureScope = zeroButtonToOverviewGestureStartsInLauncher() ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE - : LauncherInstrumentation.GestureScope.OUTSIDE; + : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER; // b/156044202 mLauncher.log("Hierarchy before swiping up to overview:"); @@ -130,7 +130,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer { } mLauncher.swipeToState(startX, startY, endX, endY, 10, OVERVIEW_STATE_ORDINAL, - LauncherInstrumentation.GestureScope.OUTSIDE); + LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER); break; } @@ -194,7 +194,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer { mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState, launcherWasVisible && isZeroButton ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE - : LauncherInstrumentation.GestureScope.OUTSIDE); + : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER); break; } diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a32d2f9ba5..645eb4c1c0 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -112,9 +112,10 @@ public final class LauncherInstrumentation { public enum NavigationModel {ZERO_BUTTON, TWO_BUTTON, THREE_BUTTON} - // Where the gesture happens: outside of Launcher, inside or from inside to outside. + // Where the gesture happens: outside of Launcher, inside or from inside to outside and + // whether the gesture recognition triggers pilfer. public enum GestureScope { - OUTSIDE, INSIDE, INSIDE_TO_OUTSIDE + OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE } ; @@ -696,7 +697,7 @@ public final class LauncherInstrumentation { ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME, NORMAL_STATE_ORDINAL, launcherWasVisible ? GestureScope.INSIDE_TO_OUTSIDE - : GestureScope.OUTSIDE); + : GestureScope.OUTSIDE_WITH_PILFER); } } } else { @@ -1165,7 +1166,8 @@ public final class LauncherInstrumentation { final boolean notLauncher3 = !isLauncher3(); switch (action) { case MotionEvent.ACTION_DOWN: - if (gestureScope != GestureScope.OUTSIDE) { + if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER + && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); } if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) { @@ -1173,12 +1175,17 @@ public final class LauncherInstrumentation { } break; case MotionEvent.ACTION_UP: - if (notLauncher3 && gestureScope != GestureScope.INSIDE) { + if (notLauncher3 && gestureScope != GestureScope.INSIDE + && (gestureScope == GestureScope.OUTSIDE_WITH_PILFER + || gestureScope == GestureScope.INSIDE_TO_OUTSIDE)) { expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS); } - if (gestureScope != GestureScope.OUTSIDE) { - expectEvent(TestProtocol.SEQUENCE_MAIN, gestureScope == GestureScope.INSIDE - ? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL); + if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER + && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) { + expectEvent(TestProtocol.SEQUENCE_MAIN, + gestureScope == GestureScope.INSIDE + || gestureScope == GestureScope.OUTSIDE_WITHOUT_PILFER + ? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL); } if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); From 9ae44d6c2be08b94fde5356282858a8753c752ba Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Fri, 17 Jul 2020 11:18:25 -0700 Subject: [PATCH 05/72] Setup controller for on device search With introduction of feature flag ENABLE_DEVICE_SEARCH, Launcher can now show a softkey input when user goes to all apps. Bug: 161545076 Test: Manual Change-Id: Ie75d059da0a20d0fb98b87bb948a205c080ba529 --- src/com/android/launcher3/config/FeatureFlags.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 5c4a4922fd..78e8b82ddf 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -94,6 +94,10 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_SUGGESTED_ACTIONS_OVERVIEW = new DeviceFlag( "ENABLE_SUGGESTED_ACTIONS_OVERVIEW", false, "Show chip hints on the overview screen"); + + public static final BooleanFlag ENABLE_DEVICE_SEARCH = getDebugFlag( + "ENABLE_DEVICE_SEARCH", false, "Allows on device search in all apps"); + public static final BooleanFlag FOLDER_NAME_SUGGEST = new DeviceFlag( "FOLDER_NAME_SUGGEST", true, "Suggests folder names instead of blank text."); From a8c08584a7bb295a2f14eafd2923a2688d3e3626 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Thu, 16 Jul 2020 17:32:29 -0700 Subject: [PATCH 06/72] Fix bug where double swipe gets us stuck in Hint state while in Overview. With the second swipe, we never complete the swipe to Overview NoButtonNavbarToOverviewTouchController#maybeSwipeInteractionToOverviewComplete - mReachedOverview = true - mDetector.isSettlingState = false And then the second swipe starts the state transition to Hint but then it never gets completed because: 1. The animation starts 2. Gets cancelled 3. Starts again 4. Finishes, but is not marked as success since the cancel in #2 was never set back to false Bug: 160759508 Change-Id: I8c3972e6209c3d5a4a0bdd9f9b7683de18105d57 --- .../src/com/android/quickstep/BaseSwipeUpHandlerV2.java | 1 + .../src/com/android/quickstep/SwipeUpAnimationLogic.java | 1 + .../src/com/android/quickstep/views/TaskMenuView.java | 1 + src/com/android/launcher3/anim/AlphaUpdateListener.java | 3 ++- .../android/launcher3/anim/AnimationSuccessListener.java | 8 ++++++++ .../launcher3/anim/AnimatorPlaybackController.java | 1 + src/com/android/launcher3/statemanager/StateManager.java | 1 + 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java index a3f1dd4c5f..e084de1acb 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java @@ -1090,6 +1090,7 @@ public abstract class BaseSwipeUpHandlerV2, Q exte anim.addAnimatorListener(new AnimationSuccessListener() { @Override public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); if (mActivity != null) { removeLiveTileOverlay(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java index e54a21c073..07faab7aeb 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java @@ -287,6 +287,7 @@ public abstract class SwipeUpAnimationLogic { @Override public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); mHomeAnim.dispatchOnStart(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java index 8b49f2c212..9b2048e4ac 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java @@ -282,6 +282,7 @@ public class TaskMenuView extends AbstractFloatingView { mOpenCloseAnimator.addListener(new AnimationSuccessListener() { @Override public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); setVisibility(VISIBLE); } diff --git a/src/com/android/launcher3/anim/AlphaUpdateListener.java b/src/com/android/launcher3/anim/AlphaUpdateListener.java index eabd283699..69716eabf1 100644 --- a/src/com/android/launcher3/anim/AlphaUpdateListener.java +++ b/src/com/android/launcher3/anim/AlphaUpdateListener.java @@ -46,7 +46,8 @@ public class AlphaUpdateListener extends AnimationSuccessListener } @Override - public void onAnimationStart(Animator arg0) { + public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); // We want the views to be visible for animation, so fade-in/out is visible mView.setVisibility(View.VISIBLE); } diff --git a/src/com/android/launcher3/anim/AnimationSuccessListener.java b/src/com/android/launcher3/anim/AnimationSuccessListener.java index 9905e81638..b83417c2eb 100644 --- a/src/com/android/launcher3/anim/AnimationSuccessListener.java +++ b/src/com/android/launcher3/anim/AnimationSuccessListener.java @@ -19,6 +19,8 @@ package com.android.launcher3.anim; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; +import androidx.annotation.CallSuper; + /** * Extension of {@link AnimatorListenerAdapter} for listening for non-cancelled animations */ @@ -26,6 +28,12 @@ public abstract class AnimationSuccessListener extends AnimatorListenerAdapter { protected boolean mCancelled = false; + @Override + @CallSuper + public void onAnimationStart(Animator animation) { + mCancelled = false; + } + @Override public void onAnimationCancel(Animator animation) { mCancelled = true; diff --git a/src/com/android/launcher3/anim/AnimatorPlaybackController.java b/src/com/android/launcher3/anim/AnimatorPlaybackController.java index ea0ff8b687..31e0418571 100644 --- a/src/com/android/launcher3/anim/AnimatorPlaybackController.java +++ b/src/com/android/launcher3/anim/AnimatorPlaybackController.java @@ -335,6 +335,7 @@ public class AnimatorPlaybackController implements ValueAnimator.AnimatorUpdateL @Override public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); mCancelled = false; mDispatched = false; } diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index 60b87d984b..f1e7f166e5 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -315,6 +315,7 @@ public class StateManager> { @Override public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); // Change the internal state only when the transition actually starts onStateTransitionStart(state); } From 665232be613372d75173a1a61c7f936897b6561d Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 20 Jul 2020 12:22:59 -0700 Subject: [PATCH 07/72] Removing diags for a fixed flake Bug: 160238801 Change-Id: Ia166eb1f154ddeeb70da5a141c9e985a265ba49a --- .../android/launcher3/BaseRecyclerView.java | 27 ----------- .../compat/AccessibilityManagerCompat.java | 6 --- .../launcher3/testing/TestProtocol.java | 1 - .../launcher3/views/BaseDragLayer.java | 3 -- .../launcher3/widget/WidgetsDiffReporter.java | 6 +-- .../launcher3/widget/WidgetsFullSheet.java | 11 ----- .../launcher3/widget/WidgetsRecyclerView.java | 45 ------------------- .../tapl/LauncherInstrumentation.java | 7 +-- 8 files changed, 3 insertions(+), 103 deletions(-) diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java index 41eeb78bc7..c55b46b33a 100644 --- a/src/com/android/launcher3/BaseRecyclerView.java +++ b/src/com/android/launcher3/BaseRecyclerView.java @@ -16,11 +16,8 @@ package com.android.launcher3; -import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED; - import android.content.Context; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -29,8 +26,6 @@ import android.view.accessibility.AccessibilityNodeInfo; import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.compat.AccessibilityManagerCompat; -import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.RecyclerViewFastScroller; @@ -183,10 +178,6 @@ public abstract class BaseRecyclerView extends RecyclerView { public void onScrollStateChanged(int state) { super.onScrollStateChanged(state); - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onScrollStateChanged: " + state); - } - if (state == SCROLL_STATE_IDLE) { AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext()); } @@ -196,23 +187,5 @@ public abstract class BaseRecyclerView extends RecyclerView { public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (isLayoutSuppressed()) info.setScrollable(false); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, - "onInitializeAccessibilityNodeInfo, scrollable: " + info.isScrollable()); - } - } - - @Override - public void setLayoutFrozen(boolean frozen) { - final boolean changing = frozen != isLayoutSuppressed(); - super.setLayoutFrozen(frozen); - if (changing) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "setLayoutFrozen " + frozen - + " @ " + Log.getStackTraceString(new Throwable())); - ActivityContext.lookupContext(getContext()).getDragLayer() - .sendAccessibilityEvent(TYPE_WINDOW_CONTENT_CHANGED); - } - } } } \ No newline at end of file diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java index d86bb17698..1d32d1dfa2 100644 --- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java +++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java @@ -75,9 +75,6 @@ public class AccessibilityManagerCompat { } public static void sendScrollFinishedEventToTest(Context context) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "sendScrollFinishedEventToTest"); - } final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context); if (accessibilityManager == null) return; @@ -97,9 +94,6 @@ public class AccessibilityManagerCompat { AccessibilityEvent.TYPE_ANNOUNCEMENT); e.setClassName(eventTag); e.setParcelableData(data); - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "sendEventToTest " + e); - } accessibilityManager.sendAccessibilityEvent(e); } diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 2644db8f3c..8165627448 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -107,5 +107,4 @@ public final class TestProtocol { public static final String PAUSE_NOT_DETECTED = "b/139891609"; public static final String OVERIEW_NOT_ALLAPPS = "b/156095088"; public static final String NO_SWIPE_TO_HOME = "b/158017601"; - public static final String NO_SCROLL_END_WIDGETS = "b/160238801"; } diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index 2c75c74827..b010b4b94b 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -292,9 +292,6 @@ public abstract class BaseDragLayer @Override public boolean dispatchTouchEvent(MotionEvent ev) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "BaseDragLayer: " + ev); - } switch (ev.getAction()) { case ACTION_DOWN: { if ((mTouchDispatchState & TOUCH_DISPATCHING_TO_VIEW_IN_PROGRESS) != 0) { diff --git a/src/com/android/launcher3/widget/WidgetsDiffReporter.java b/src/com/android/launcher3/widget/WidgetsDiffReporter.java index c9e80dc848..df6e2c3023 100644 --- a/src/com/android/launcher3/widget/WidgetsDiffReporter.java +++ b/src/com/android/launcher3/widget/WidgetsDiffReporter.java @@ -20,10 +20,8 @@ import android.util.Log; import androidx.recyclerview.widget.RecyclerView; -import com.android.launcher3.Utilities; import com.android.launcher3.icons.IconCache; import com.android.launcher3.model.data.PackageItemInfo; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.widget.WidgetsListAdapter.WidgetListRowEntryComparator; import java.util.ArrayList; @@ -34,8 +32,8 @@ import java.util.Iterator; * methods accordingly. */ public class WidgetsDiffReporter { - private static final boolean DEBUG = Utilities.IS_RUNNING_IN_TEST_HARNESS; // b/160238801 - private static final String TAG = TestProtocol.NO_SCROLL_END_WIDGETS; + private static final boolean DEBUG = false; + private static final String TAG = "WidgetsDiffReporter"; private final IconCache mIconCache; private final RecyclerView.Adapter mListener; diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java index ba55f5adee..68a3ec51ee 100644 --- a/src/com/android/launcher3/widget/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java @@ -24,7 +24,6 @@ import android.animation.PropertyValuesHolder; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; -import android.util.Log; import android.util.Pair; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -39,10 +38,8 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetHost.ProviderChangedListener; import com.android.launcher3.R; -import com.android.launcher3.Utilities; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.compat.AccessibilityManagerCompat; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.views.RecyclerViewFastScroller; import com.android.launcher3.views.TopRoundedCornerView; @@ -71,14 +68,6 @@ public class WidgetsFullSheet extends BaseWidgetSheet } - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "WidgetsFullSheet: " + ev); - } - return super.dispatchTouchEvent(ev); - } - public WidgetsFullSheet(Context context, AttributeSet attrs) { this(context, attrs, 0); } diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java index 8f81977fc2..69de12b9d5 100644 --- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java +++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java @@ -19,14 +19,11 @@ package com.android.launcher3.widget; import android.content.Context; import android.graphics.Point; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import com.android.launcher3.BaseRecyclerView; import com.android.launcher3.R; -import com.android.launcher3.Utilities; -import com.android.launcher3.testing.TestProtocol; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -120,9 +117,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch public int getCurrentScrollY() { // Skip early if widgets are not bound. if (isModelNotReady() || getChildCount() == 0) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "getCurrentScrollY: -1"); - } return -1; } @@ -131,10 +125,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch int y = (child.getMeasuredHeight() * rowIndex); int offset = getLayoutManager().getDecoratedTop(child); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, - "getCurrentScrollY: " + (getPaddingTop() + y - offset)); - } return getPaddingTop() + y - offset; } @@ -166,22 +156,13 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch } if (mTouchDownOnScroller) { final boolean result = mScrollbar.handleTouchEvent(e, mFastScrollerOffset); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onInterceptTouchEvent 1 " + result); - } return result; } - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onInterceptTouchEvent 2 false"); - } return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "WidgetsRecyclerView.onTouchEvent"); - } if (mTouchDownOnScroller) { mScrollbar.handleTouchEvent(e, mFastScrollerOffset); } @@ -189,31 +170,5 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onRequestDisallowInterceptTouchEvent " - + disallowIntercept); - } - } - - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - final boolean result = super.dispatchTouchEvent(ev); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "WidgetsRecyclerView: state: " - + getScrollState() - + " can scroll: " + getLayoutManager().canScrollVertically() - + " result: " + result - + " layout suppressed: " + isLayoutSuppressed() - + " event: " + ev); - } - return result; - } - - @Override - public void stopNestedScroll() { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "stopNestedScroll"); - } - super.stopNestedScroll(); } } \ No newline at end of file diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a32d2f9ba5..e387a607b1 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -636,11 +636,9 @@ public final class LauncherInstrumentation { Parcelable executeAndWaitForEvent(Runnable command, UiAutomation.AccessibilityEventFilter eventFilter, Supplier message) { try { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "executeAndWaitForEvent: before"); final AccessibilityEvent event = mInstrumentation.getUiAutomation().executeAndWaitForEvent( command, eventFilter, LONG_WAIT_TIME_MS); - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "executeAndWaitForEvent: after"); assertNotNull("executeAndWaitForEvent returned null (this can't happen)", event); final Parcelable parcelableData = event.getParcelableData(); event.recycle(); @@ -1097,10 +1095,7 @@ public final class LauncherInstrumentation { executeAndWaitForEvent( () -> linearGesture( startX, startY, endX, endY, steps, slowDown, GestureScope.INSIDE), - event -> { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "scroll: received event: " + event); - return TestProtocol.SCROLL_FINISHED_MESSAGE.equals(event.getClassName()); - }, + event -> TestProtocol.SCROLL_FINISHED_MESSAGE.equals(event.getClassName()), () -> "Didn't receive a scroll end message: " + startX + ", " + startY + ", " + endX + ", " + endY); } From e47896cb915a0d7f1e7fb14901ec4f9b6649366a Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Mon, 20 Jul 2020 12:30:02 -0700 Subject: [PATCH 08/72] Invalidate stale BgDataModel when predictions are disabled Launcher stores ItemInfos for cached predictions in list BgDataModel.cachedPredictedItems on Launcher start (LoaderTask#run). The list reused if launcher has to rebind UI. Hence, the list should be cleared if launcher receives empty predictions. Bug: 161245294 Test: Manual Change-Id: I275655d5f52f6a6e5297473dd2f642728c1964a6 --- src/com/android/launcher3/model/PredictionModel.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/com/android/launcher3/model/PredictionModel.java b/src/com/android/launcher3/model/PredictionModel.java index 1429843b7e..cb3903d4ed 100644 --- a/src/com/android/launcher3/model/PredictionModel.java +++ b/src/com/android/launcher3/model/PredictionModel.java @@ -14,6 +14,7 @@ * limitations under the License. */ package com.android.launcher3.model; + import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import android.content.ComponentName; @@ -24,6 +25,7 @@ import android.os.UserHandle; import androidx.annotation.AnyThread; import androidx.annotation.WorkerThread; +import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.pm.UserCache; @@ -64,18 +66,28 @@ public class PredictionModel implements ResourceBasedOverride { mUserCache = UserCache.INSTANCE.get(mContext); } + /** * Formats and stores a list of component key in device preferences. */ @AnyThread public void cachePredictionComponentKeys(List componentKeys) { MODEL_EXECUTOR.execute(() -> { + LauncherAppState appState = LauncherAppState.getInstance(mContext); StringBuilder builder = new StringBuilder(); int count = Math.min(componentKeys.size(), MAX_CACHE_ITEMS); for (int i = 0; i < count; i++) { builder.append(serializeComponentKeyToString(componentKeys.get(i))); builder.append("\n"); } + if (componentKeys.isEmpty() /* should invalidate loader items */) { + appState.getModel().enqueueModelUpdateTask(new BaseModelUpdateTask() { + @Override + public void execute(LauncherAppState app, BgDataModel model, AllAppsList apps) { + model.cachedPredictedItems.clear(); + } + }); + } mDevicePrefs.edit().putString(CACHED_ITEMS_KEY, builder.toString()).apply(); }); } From 453475d568f8a0223b8e7e1bc2dc9472eb487551 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Mon, 20 Jul 2020 12:46:18 -0700 Subject: [PATCH 09/72] Fix hotseat file log name formatting Bug: 161001172 Test: Manual Change-Id: Ia03eeb897003267ce608430c94b3b01876939234 --- .../com/android/launcher3/hybridhotseat/HotseatFileLog.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java index c15a5963f6..20e1edc05f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java @@ -71,10 +71,9 @@ public class HotseatFileLog { } private PrintWriter getWriter() { - String fName = FILE_NAME_PREFIX + (LOG_DAYS % 10); - if (fName.equals(mFileName)) return mCurrentWriter; - Calendar cal = Calendar.getInstance(); + String fName = FILE_NAME_PREFIX + (cal.get(Calendar.DAY_OF_YEAR) % 10); + if (fName.equals(mFileName)) return mCurrentWriter; boolean append = false; File logFile = new File(mLogsDir, fName); From 00850fb588bf7b33b49d4771883039d5fd70be81 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 20 Jul 2020 13:57:56 -0700 Subject: [PATCH 10/72] Create a new instance of rotation touch helper per device state Change-Id: I4e4288eaf37aab5bf0b8115f5e06e64459c20f00 --- .../com/android/quickstep/RecentsAnimationDeviceState.java | 2 +- quickstep/src/com/android/quickstep/RotationTouchHelper.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index dd80bd758e..7a6bbb4ab9 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -114,7 +114,7 @@ public class RecentsAnimationDeviceState implements mDefaultDisplay = DefaultDisplay.INSTANCE.get(context); mDisplayId = mDefaultDisplay.getInfo().id; runOnDestroy(() -> mDefaultDisplay.removeChangeListener(this)); - mRotationTouchHelper = RotationTouchHelper.INSTANCE.get(context); + mRotationTouchHelper = new RotationTouchHelper(context); runOnDestroy(mRotationTouchHelper::destroy); // Register for user unlocked if necessary diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index d89ca10b69..5f3c02205e 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -41,8 +41,6 @@ import java.util.ArrayList; public class RotationTouchHelper implements SysUINavigationMode.NavigationModeChangeListener, DefaultDisplay.DisplayInfoChangeListener { - public static final MainThreadInitializedObject INSTANCE = - new MainThreadInitializedObject<>(RotationTouchHelper::new); private final OrientationTouchTransformer mOrientationTouchTransformer; private final DefaultDisplay mDefaultDisplay; @@ -122,7 +120,7 @@ public class RotationTouchHelper implements private final Context mContext; - private RotationTouchHelper(Context context) { + public RotationTouchHelper(Context context) { mContext = context; Resources resources = mContext.getResources(); mSysUiNavMode = SysUINavigationMode.INSTANCE.get(context); From a92c6bb53121c23ef3c4e192cbbfcc921e8c41da Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Mon, 20 Jul 2020 14:00:14 -0700 Subject: [PATCH 11/72] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I2ac85ce81a99d87d613ed1490c591d90323889f2 --- quickstep/res/values-ar/strings.xml | 2 +- quickstep/res/values-bg/strings.xml | 2 +- quickstep/res/values-bn/strings.xml | 2 +- quickstep/res/values-ca/strings.xml | 8 ++++---- quickstep/res/values-de/strings.xml | 6 +++--- quickstep/res/values-es-rUS/strings.xml | 2 +- quickstep/res/values-es/strings.xml | 10 +++++----- quickstep/res/values-fr-rCA/strings.xml | 2 +- quickstep/res/values-hi/strings.xml | 2 +- quickstep/res/values-hr/strings.xml | 10 +++++----- quickstep/res/values-is/strings.xml | 2 +- quickstep/res/values-it/strings.xml | 2 +- quickstep/res/values-kk/strings.xml | 10 +++++----- quickstep/res/values-km/strings.xml | 2 +- quickstep/res/values-lv/strings.xml | 2 +- quickstep/res/values-mn/strings.xml | 4 ++-- quickstep/res/values-my/strings.xml | 4 ++-- quickstep/res/values-nb/strings.xml | 2 +- quickstep/res/values-ne/strings.xml | 2 +- quickstep/res/values-pt-rPT/strings.xml | 2 +- quickstep/res/values-sq/strings.xml | 2 +- quickstep/res/values-sv/strings.xml | 6 +++--- quickstep/res/values-sw/strings.xml | 4 ++-- quickstep/res/values-te/strings.xml | 2 +- quickstep/res/values-th/strings.xml | 8 ++++---- quickstep/res/values-tl/strings.xml | 4 ++-- quickstep/res/values-uz/strings.xml | 10 +++++----- quickstep/res/values-zh-rCN/strings.xml | 4 ++-- quickstep/res/values-zh-rHK/strings.xml | 4 ++-- quickstep/res/values-zh-rTW/strings.xml | 2 +- 30 files changed, 62 insertions(+), 62 deletions(-) diff --git a/quickstep/res/values-ar/strings.xml b/quickstep/res/values-ar/strings.xml index 780104b326..c2348ecf50 100644 --- a/quickstep/res/values-ar/strings.xml +++ b/quickstep/res/values-ar/strings.xml @@ -34,7 +34,7 @@ "تطبيقاتك المتوقّعة" "رؤية التطبيقات المقترحة في الصف السفلي من الشاشة الرئيسية" "رؤية التطبيقات المقترحة في صف التطبيقات المفضّلة في الشاشة الرئيسية" - "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى سلاسل الإجراءات. سيتم نقل التطبيقات من الصف السفلي للعلوي في الشاشة الرئيسية." + "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى استخدامك الروتيني. وسيتم نقل التطبيقات من الصف السفلي في الشاشة الرئيسية إلى الصف الأعلى." "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى سلاسل الإجراءات. سيتم نقل التطبيقات من صف التطبيقات المفضّلة إلى الشاشة الرئيسية." "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى سلاسل الإجراءات. سيتم نقل التطبيقات من الصف الأسفل إلى مجلد جديد." "رؤية تطبيقات مقترحة" diff --git a/quickstep/res/values-bg/strings.xml b/quickstep/res/values-bg/strings.xml index db7006f564..5484bc9e8b 100644 --- a/quickstep/res/values-bg/strings.xml +++ b/quickstep/res/values-bg/strings.xml @@ -43,7 +43,7 @@ "Най-използваните приложения се показват тук и се променят въз основа на поредиците" "За да получавате предложения за приложения, с плъзгане премахнете приложенията от най-долния ред" "Предложенията за приложения са добавени на празното място" - "Функцията „Предложения за приложения“ е активирана" + "Предложенията за приложения са активирани" "Функцията „Предложения за приложения“ е деактивирана" "Предвидено приложение: %1$s" "Споделяне" diff --git a/quickstep/res/values-bn/strings.xml b/quickstep/res/values-bn/strings.xml index b230ec5611..9212a4b827 100644 --- a/quickstep/res/values-bn/strings.xml +++ b/quickstep/res/values-bn/strings.xml @@ -47,6 +47,6 @@ "অ্যাপ সাজেশন বন্ধ করা আছে" "আপনার প্রয়োজন হতে পারে এমন অ্যাপ: %1$s" "শেয়ার করুন" - "স্ক্রিনশট" + "স্ক্রিনশট নিন" "এই অ্যাপ বা আপনার প্রতিষ্ঠান এই অ্যাকশনটি পারফর্ম করার অনুমতি দেয়নি" diff --git a/quickstep/res/values-ca/strings.xml b/quickstep/res/values-ca/strings.xml index 657239ce0d..4b0acca10e 100644 --- a/quickstep/res/values-ca/strings.xml +++ b/quickstep/res/values-ca/strings.xml @@ -34,13 +34,13 @@ "Prediccions d\'aplicacions" "Obtén suggeriments d\'aplicacions a la fila inferior de la pantalla d\'inici" "Obtén suggeriments d\'aplicacions a la fila Preferides de la teva pantalla d\'inici" - "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció de la teva rutina. Les aplicacions de la fila inferior pujaran a la pantalla d\'inici." - "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció de la teva rutina. Les aplicacions de la fila Preferides es mouran a la teva pantalla d\'inici." - "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció de la teva rutina. Les aplicacions de la fila inferior es mouran a una carpeta nova." + "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció dels teus hàbits. Les aplicacions de la fila inferior pujaran a la pantalla d\'inici." + "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció dels teus hàbits. Les aplicacions de la fila Preferides es mouran a la teva pantalla d\'inici." + "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció dels teus hàbits. Les aplicacions de la fila inferior es mouran a una carpeta nova." "Mostra suggeriments d\'aplicacions" "No, gràcies" "Configuració" - "Les aplicacions que més utilitzes apareixen aquí i poden variar en funció de la teva rutina" + "Les aplicacions que més utilitzes apareixen aquí i poden variar en funció dels teus hàbits" "Arrossega les aplicacions fora de la fila inferior per obtenir suggeriments d\'aplicacions" "S\'han afegit suggeriments d\'aplicacions en un espai buit" "Els suggeriments d\'aplicacions estan activats" diff --git a/quickstep/res/values-de/strings.xml b/quickstep/res/values-de/strings.xml index 17ba8ad457..b51f04de98 100644 --- a/quickstep/res/values-de/strings.xml +++ b/quickstep/res/values-de/strings.xml @@ -35,17 +35,17 @@ "Lass dir in der unteren Reihe auf deinem Startbildschirm Vorschläge für Apps anzeigen" "Lass dir in der Favoritenleiste auf dem Startbildschirm App-Vorschläge anzeigen" "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge werden deiner Nutzung entsprechend laufend angepasst. Apps in der unteren Reihe werden nach oben auf den Startbildschirm verschoben." - "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge richten sich nach deiner gewöhnlichen Nutzung. Apps der Favoritenleiste werden auf den Startbildschirm verschoben." + "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge werden deiner Nutzung entsprechend laufend angepasst. Apps der Favoritenleiste werden auf den Startbildschirm verschoben." "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge werden deiner Nutzung entsprechend laufend angepasst. Apps in der unteren Reihe werden in einen neuen Ordner verschoben." "App-Vorschläge erhalten" "Nein danke" "Einstellungen" "Hier erscheinen die meistverwendeten Apps. Die Angaben können sich je nach deiner gewöhnlichen Nutzung ändern" - "Ziehe Apps aus der unteren Reihe heraus, um Vorschläge für Apps zu bekommen" + "Ziehe Apps aus der unteren Reihe heraus, um Vorschläge für Apps zu erhalten" "App-Vorschläge in freiem Bereich hinzugefügt" "Funktion \"App-Vorschläge\" aktiviert" "Funktion \"App-Vorschläge\" deaktiviert" - "App-Vorhersage: %1$s" + "Vorgeschlagene App: %1$s" "Teilen" "Screenshot" "Die App oder deine Organisation lässt diese Aktion nicht zu" diff --git a/quickstep/res/values-es-rUS/strings.xml b/quickstep/res/values-es-rUS/strings.xml index d62c8b3c82..1191becfa1 100644 --- a/quickstep/res/values-es-rUS/strings.xml +++ b/quickstep/res/values-es-rUS/strings.xml @@ -43,7 +43,7 @@ "Las apps que más se usan se muestran aquí y cambian según las rutinas" "Arrastra apps fuera de la fila inferior para obtener sugerencias" "Se agregaron sugerencias de aplicaciones a un espacio vacío" - "Las sugerencias de aplicaciones están habilitadas" + "Sugerencias de apps habilitadas" "Las sugerencias de aplicaciones están inhabilitadas" "Predicción de app: %1$s" "Compartir" diff --git a/quickstep/res/values-es/strings.xml b/quickstep/res/values-es/strings.xml index 1a8cbd2388..a2b930d068 100644 --- a/quickstep/res/values-es/strings.xml +++ b/quickstep/res/values-es/strings.xml @@ -32,12 +32,12 @@ "Sugerencias de aplicaciones" "Todas las aplicaciones" "Predicción de aplicaciones" - "Haz que aparezcan sugerencias de aplicaciones en la fila inferior de la pantalla de inicio" + "Obtén sugerencias de aplicaciones en la fila inferior de la pantalla de inicio" "Recibe sugerencias de aplicaciones en la fila de aplicaciones favoritas de la pantalla de inicio" - "Accede fácilmente desde la pantalla de inicio a las aplicaciones que más usas. Las sugerencias cambiarán según tus rutinas. Las aplicaciones de la fila inferior pasarán a mostrarse en la pantalla de inicio." - "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus rutinas. Las aplicaciones de la fila de aplicaciones favoritas se moverán a la pantalla de inicio." - "Accede fácilmente desde la pantalla de inicio a las aplicaciones que más usas. Las sugerencias cambiarán según tus rutinas. Las aplicaciones de la fila inferior se pondrán en una carpeta nueva." - "Ver sugerencias de aplicaciones" + "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus hábitos. Las aplicaciones de la fila inferior pasarán a mostrarse en la pantalla de inicio." + "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus hábitos. Las aplicaciones de la fila de aplicaciones favoritas se moverán a la pantalla de inicio." + "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus hábitos. Las aplicaciones de la fila inferior se pondrán en una carpeta nueva." + "Sí, obtener sugerencias" "No, gracias" "Ajustes" "Las aplicaciones que más usas aparecen aquí, y van variando según tus rutinas" diff --git a/quickstep/res/values-fr-rCA/strings.xml b/quickstep/res/values-fr-rCA/strings.xml index 8ae00237d2..46096f5263 100644 --- a/quickstep/res/values-fr-rCA/strings.xml +++ b/quickstep/res/values-fr-rCA/strings.xml @@ -32,7 +32,7 @@ "Suggestions d\'applications" "Toutes les applications" "Vos prédictions d\'applications" - "Obtenez des applications suggérées dans la rangée du bas de votre écran d\'accueil" + "Obtenir des suggestions d\'applications dans la rangée du bas de votre écran d\'accueil" "Retrouvez des suggestions d\'applications dans la rangée des favoris de votre écran d\'accueil" "Accédez facilement aux applications que vous utilisez le plus, directement à l\'écran d\'accueil. Les suggestions changeront en fonction de vos habitudes. Les applications dans la rangée du bas seront déplacées vers votre écran d\'accueil." "Accédez facilement aux applications que vous utilisez le plus, directement à l\'écran d\'accueil. Les suggestions changeront en fonction de vos habitudes. Les applications dans la rangée des favoris seront déplacées vers votre écran d\'accueil." diff --git a/quickstep/res/values-hi/strings.xml b/quickstep/res/values-hi/strings.xml index 8bf208f1aa..d98cc770a1 100644 --- a/quickstep/res/values-hi/strings.xml +++ b/quickstep/res/values-hi/strings.xml @@ -36,7 +36,7 @@ "अपने होम स्क्रीन की सबसे नीचे वाली पंक्ति में पसंदीदा ऐप्लिकेशन के सुझाव पाएं" "आप जिन ऐप्लिकेशन का ज़्यादा इस्तेमाल करते हैं उन्हें सीधा अपने होम स्क्रीन पर पाएं. ऐप्लिकेशन इस्तेमाल करने के आपके रूटीन के हिसाब से सुझाव बदलते रहते हैं. नीचे की पंक्ति के ऐप्लिकेशन होम स्क्रीन पर आ जाएंगे." "सबसे ज़्यादा इस्तेमाल होने वाले ऐप्लिकेशन सीधे होम स्क्रीन पर देखें. आप ऐप्लिकेशन का कितना इस्तेमाल कर रहे हैं, उसके हिसाब से सुझाव बदलते रहते हैं. आपके पसंदीदा ऐप्लिकेशन, होम स्क्रीन पर नीचे की पंक्ति में दिखाई देंगे." - "सबसे ज़्यादा इस्तेमाल होने वाले ऐप्लिकेशन, सीधे होम स्क्रीन पर देखें. ऐप्लिकेशन इस्तेमाल करने के आपके रूटीन के हिसाब से सुझाव बदलते रहते हैं. नीचे की पंक्ति के ऐप्लिकेशन एक नए फ़ोल्डर में चले जाएंगे." + "सबसे ज़्यादा इस्तेमाल होने वाले ऐप्लिकेशन, सीधे होम स्क्रीन पर पाएं. आपके ऐप्लिकेशन इस्तेमाल करने के रूटीन के हिसाब से सुझाव बदलते रहते हैं. नीचे की पंक्ति के ऐप्लिकेशन एक नए फ़ोल्डर में चले जाएंगे." "ऐप्लिकेशन के बारे में सुझाव पाएं" "रहने दें" "सेटिंग" diff --git a/quickstep/res/values-hr/strings.xml b/quickstep/res/values-hr/strings.xml index 21920a7113..a026ef8012 100644 --- a/quickstep/res/values-hr/strings.xml +++ b/quickstep/res/values-hr/strings.xml @@ -32,21 +32,21 @@ "Predložene aplikacije" "Sve aplikacije" "Vaše predviđene aplikacije" - "Prikažite predložene aplikacije u donjem retku početnog zaslona" + "Prijedloge aplikacija vidjet ćete u donjem retku početnog zaslona" "Primajte prijedloge aplikacija u retku omiljenih na početnom zaslonu" "Lako pristupite najčešće upotrebljavanim aplikacijama s početnog zaslona. Prijedlozi će se mijenjati na temelju vaših rutina. Aplikacije iz donjeg retka pomaknut će se na početni zaslon." "Lako pristupite najčešće upotrebljavanim aplikacijama s početnog zaslona. Prijedlozi će se mijenjati na temelju vaših rutina. Aplikacije koje se nalaze u retku omiljenih pomaknut će se na početni zaslon." "Lako pristupite najčešće upotrebljavanim aplikacijama s početnog zaslona. Prijedlozi će se mijenjati na temelju vaših rutina. Aplikacije iz donjeg retka pomaknut će se u novu mapu." - "Prikaži predložene aplikacije" + "Predloži mi aplikacije" "Ne, hvala" "Postavke" "Ovdje se prikazuju najčešće upotrebljavane aplikacije i mijenjaju se na temelju rutina" "Povucite aplikacije iz donjeg retka da biste dobili prijedloge aplikacija" "Predložene aplikacije dodane u prazan prostor" - "Predlaganje aplikacija je omogućeno" - "Predlaganje aplikacija je onemogućeno" + "Predlaganje apl. omogućeno" + "Predlaganje apl. onemogućeno" "Predviđena aplikacija: %1$s" - "Udio" + "Podijeli" "Snimka zaslona" "Aplikacija ili vaša organizacija ne dopuštaju ovu radnju" diff --git a/quickstep/res/values-is/strings.xml b/quickstep/res/values-is/strings.xml index f8b63fb64a..824fd7fb31 100644 --- a/quickstep/res/values-is/strings.xml +++ b/quickstep/res/values-is/strings.xml @@ -43,7 +43,7 @@ "Mest notuðu forritin birtast hér og breytast í samræmi við rútínur" "Dragðu forrit af neðstu röð til að fá tillögð forrit" "Tillögðum forritum bætt við autt svæði" - "Kveikt á tillögðum forritum" + "Kveikt á tillögum að forritum" "Slökkt er á tillögðum forritum" "Tillaga að forriti: %1$s" "Deila" diff --git a/quickstep/res/values-it/strings.xml b/quickstep/res/values-it/strings.xml index e0a78b2301..4038966102 100644 --- a/quickstep/res/values-it/strings.xml +++ b/quickstep/res/values-it/strings.xml @@ -41,7 +41,7 @@ "No, grazie" "Impostazioni" "Le app più utilizzate vengono visualizzate qui e variano in base alle routine" - "Trascina le app fuori dalla fila in basso per vedere le app suggerite" + "Trascina le app fuori dalla riga inferiore per visualizzare le app suggerite" "App suggerite aggiunte a uno spazio vuoto" "La funzionalità app suggerite è attiva" "La funzionalità app suggerite è disattivata" diff --git a/quickstep/res/values-kk/strings.xml b/quickstep/res/values-kk/strings.xml index 1bb1684dde..fb76660b1f 100644 --- a/quickstep/res/values-kk/strings.xml +++ b/quickstep/res/values-kk/strings.xml @@ -32,16 +32,16 @@ "Ұсынылған қолданбалар" "Барлық қолданбалар" "Ұсынылатын қолданбалар" - "Негізгі экранның төменгі жолында ұсынылған қолданбаларды алу" + "Негізгі экранның төменгі жолында қолданбаларды ұсыну" "Ұсынылған қолданбалар негізгі экранда таңдаулылар арасында көрсетілетін болады" - "Жиі пайдаланылатын қолданбаларға негізгі экраннан оңай кіріңіз. Ұсыныстар әрекеттер тізімі негізінде өзгереді. Төменгі жолдағы қолданбалар негізгі экраныңызға қарай жоғары жылжиды." + "Жиі пайдаланылатын қолданбаларға негізгі экраннан кіруге болады. Ұсыныстар күнделікті әрекеттеріңізге сәйкес өзгереді. Төменгі қатардағы қолданбалар негізгі экранға қарай жоғары жылжиды." "Жиі пайдаланылатын қолданбаларға негізгі экраннан оңай кіре аласыз. Ұсыныстар күнделікті әрекеттеріңізге сәйкес өзгереді. Таңдаулылар жолындағы қолданбалар негізгі экранға ауысады." - "Жиі пайдаланылатын қолданбаларға негізгі экраннан оңай кіріңіз. Ұсыныстар әрекеттер тізімі негізінде өзгереді. Төмендегі қолданбалар жаңа қалтаға жылжиды." + "Жиі пайдаланылатын қолданбаларға негізгі экраннан кіруге болады. Ұсыныстар күнделікті әрекеттеріңізге сәйкес өзгереді. Төменгі қатардағы қолданбалар жаңа қалтаға жылжиды." "Ұсынылған қолданбаларды көру" "Жоқ, рақмет" "Параметрлер" - "Жиі пайдаланылатын қолданбалар осы жерде көрсетіледі және әрекеттер тізімі негізінде өзгереді." - "Ұсынылған қолданбаларды алу үшін қолданбаларды төменгі жолдан жылжытыңыз." + "Жиі пайдаланылатын қолданбалар осы жерде көрсетіледі. Олар күнделікті әрекеттеріңізге сәйкес өзгереді." + "Ұсынылған қолданбаларды көру үшін төменгі қатардан керектерін сүйреп шығарыңыз." "Ұсынылған қолданбалар бос орынға қосылды." "\"Ұсынылған қолданбалар\" функциясы қосулы." "\"Ұсынылған қолданбалар\" функциясы өшірулі." diff --git a/quickstep/res/values-km/strings.xml b/quickstep/res/values-km/strings.xml index dd2fbacbed..3c3fccc022 100644 --- a/quickstep/res/values-km/strings.xml +++ b/quickstep/res/values-km/strings.xml @@ -37,7 +37,7 @@ "ចូលប្រើ​កម្មវិធី​ដែលអ្នកប្រើ​ញឹកញាប់បំផុត​បានយ៉ាង​ងាយស្រួល​នៅលើ​អេក្រង់ដើម​ផ្ទាល់។ ការណែនាំ​នឹងប្រែប្រួល​ទៅតាម​ទម្លាប់​របស់អ្នក។ កម្មវិធី​នៅជួរ​ខាងក្រោម​នឹងផ្លាស់ទីឡើង​ទៅអេក្រង់ដើម​របស់អ្នក។" "ចូលប្រើ​កម្មវិធី​ដែលអ្នកប្រើ​ញឹកញាប់បំផុត​បានយ៉ាង​ងាយស្រួល​នៅលើ​អេក្រង់ដើមដោយផ្ទាល់។ ការណែនាំ​នឹងប្រែប្រួល​ទៅតាម​ទម្លាប់​របស់អ្នក។ កម្មវិធី​នៅក្នុង​ជួរដេក​សំណព្វ​នឹងផ្លាស់ទី​ទៅអេក្រង់ដើម​របស់អ្នក។" "ចូលប្រើ​កម្មវិធី​ដែលអ្នកប្រើ​ញឹកញាប់បំផុត​បានយ៉ាង​ងាយស្រួល​នៅលើ​អេក្រង់ដើម​ផ្ទាល់។ ការណែនាំ​នឹងប្រែប្រួល​ទៅតាម​ទម្លាប់​របស់អ្នក។ កម្មវិធី​នៅជួរ​ខាងក្រោម​នឹងផ្លាស់ទី​ទៅថតថ្មី។" - "ទទួលបាន​ការណែនាំ​កម្មវិធី" + "ទទួលការណែនាំ​កម្មវិធី" "ទេ អរគុណ" "ការកំណត់" "កម្មវិធី​ដែលប្រើ​ញឹកញាប់បំផុត​បង្ហាញ​នៅទីនេះ និង​ប្រែប្រួល​ទៅតាមទម្លាប់" diff --git a/quickstep/res/values-lv/strings.xml b/quickstep/res/values-lv/strings.xml index 82c96fe213..65620c4683 100644 --- a/quickstep/res/values-lv/strings.xml +++ b/quickstep/res/values-lv/strings.xml @@ -47,6 +47,6 @@ "Ieteicamās lietotnes ir atspējotas" "Prognozētā lietotne: %1$s" "Kopīgot" - "Izveidot ekrānuzņēmumu" + "Veikt ekrānuzņēmumu" "Lietotne vai jūsu organizācija neatļauj veikt šo darbību." diff --git a/quickstep/res/values-mn/strings.xml b/quickstep/res/values-mn/strings.xml index f4b9d43e6e..ba083ef0e0 100644 --- a/quickstep/res/values-mn/strings.xml +++ b/quickstep/res/values-mn/strings.xml @@ -34,9 +34,9 @@ "Таны таамагласан аппууд" "Үндсэн нүүрнийхээ доод мөрөнд санал болгож буй аппуудыг аваарай" "Үндсэн нүүрний дуртай мөрнөөсөө санал болгож буй аппуудыг аваарай" - "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөр дэх аппуудыг таны Үндсэн нүүр лүү дээш зөөнө." + "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрнээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөрөнд буй аппуудыг таны Үндсэн нүүр лүү дээш зөөнө." "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрнээсээ хялбархан хандаарай. Санал болголтыг таны хэвшлээс хамааран өөрчилнө. Дуртай мөрөнд буй аппуудыг таны үндсэн нүүр лүү зөөнө." - "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөр дэх аппуудыг шинэ фолдер луу зөөнө." + "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрнээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөрөнд буй аппуудыг шинэ фолдер луу зөөнө." "Санал болгож буй аппуудыг авах" "Үгүй, баярлалаа" "Тохиргоо" diff --git a/quickstep/res/values-my/strings.xml b/quickstep/res/values-my/strings.xml index 0dc3a165b5..a18c1c451d 100644 --- a/quickstep/res/values-my/strings.xml +++ b/quickstep/res/values-my/strings.xml @@ -34,7 +34,7 @@ "သင်၏ ခန့်မှန်းအက်ပ်များ" "သင်၏ \'ပင်မစာမျက်နှာ\' အောက်ခြေအတန်းတွင် အက်ပ်အကြံပြုချက်များ ရယူခြင်း" "သင်၏ \'ပင်မစာမျက်နှာ\' ၏ အနှစ်သက်ဆုံးများအတန်းတွင် အက်ပ်အကြံပြုချက်များ ရယူခြင်း" - "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ သုံးနိုင်သည်။ သင်၏ ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အောက်ခြေအတန်းရှိ အက်ပ်များကို သင်၏ \'ပင်မစာမျက်နှာ\' သို့ရွှေ့လိုက်မည်။" + "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ ဖွင့်နိုင်သည်။ သင်၏ ပုံမှန်လုပ်ဆောင်ချက်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အောက်ခြေအတန်းရှိ အက်ပ်များကို သင်၏ \'ပင်မစာမျက်နှာ\' သို့ရွှေ့လိုက်မည်။" "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ သုံးနိုင်သည်။ သင်၏ ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အနှစ်သက်ဆုံးများအတန်းရှိ အက်ပ်များကို သင်၏ \'ပင်မစာမျက်နှာ\' သို့ရွှေ့လိုက်မည်။" "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ သုံးနိုင်သည်။ သင်၏ ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အောက်ခြေအတန်းရှိ အက်ပ်များကို ဖိုင်တွဲအသစ်သို့ ရွှေ့လိုက်မည်။" "အက်ပ်အကြံပြုချက်များ ရယူရန်" @@ -43,7 +43,7 @@ "အသုံးအများဆုံးအက်ပ်များကို ဤနေရာတွင် ပြပြီး ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ ပြောင်းလဲသည်" "အက်ပ်အကြံပြုချက်များ ရယူရန် အောက်ခြေအတန်းရှိ အက်ပ်များကို ဖိဆွဲထုတ်လိုက်ပါ" "အက်ပ်အကြံပြုချက်များကို နေရာလွတ်သို့ ထည့်လိုက်သည်" - "အက်ပ်အကြံပြုချက်များကို ဖွင့်ထားသည်" + "အက်ပ်အကြံပြုချက်များ ဖွင့်ထားသည်" "အက်ပ်အကြံပြုချက်များကို ပိတ်ထားသည်" "ကြိုတင်မှန်းဆထားသော အက်ပ်− %1$s" "မျှဝေရန်" diff --git a/quickstep/res/values-nb/strings.xml b/quickstep/res/values-nb/strings.xml index 161612212b..161d1c4f97 100644 --- a/quickstep/res/values-nb/strings.xml +++ b/quickstep/res/values-nb/strings.xml @@ -43,7 +43,7 @@ "Appene som brukes oftest, vises her og endres basert på rutiner" "Dra appene vekk fra den nederste raden for å få appforslag." "Appforslag er lagt til på et tomt område" - "Appforslag er slått på" + "Appforslag er på" "Appforslag er slått av" "Foreslått app: %1$s" "Del" diff --git a/quickstep/res/values-ne/strings.xml b/quickstep/res/values-ne/strings.xml index c8c35a8c80..99a22f922f 100644 --- a/quickstep/res/values-ne/strings.xml +++ b/quickstep/res/values-ne/strings.xml @@ -36,7 +36,7 @@ "आफ्नो होम स्क्रिनको मन पर्ने नामक पङ्क्तिमा सिफारिस गरिएका एपहरू प्राप्त गर्नुहोस्" "गृह स्क्रिनबाटै आफूले सबैभन्दा बढी प्रयोग गर्ने एप सजिलै चलाउनुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंले एप प्रयोग गर्ने समयतालिकाअनुसार बदलिने छ। फेदको पङ्क्तिमा रहेका एपहरू तपाईंको गृह स्क्रिनको सिरानमा सर्ने छन्।" "आफूले सबैभन्दा बढी प्रयोग गर्ने एपहरू गृह स्क्रिनबाटै सजिलैसँग खोल्नुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंको दिनचर्याअनुसार बदलिने छ। मन पर्ने नामक पङ्क्तिमा रहेका एपहरू सारेर होम स्क्रिनमा लगिने छन्।" - "गृह स्क्रिनबाटै आफूले सबैभन्दा बढी प्रयोग गर्ने एपमाथि सजिलैसँग पहुँच राख्नुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंले एप प्रयोग गर्ने समयतालिकाअनुसार बदलिने छ। फेदको पङ्क्तिमा रहेका एपहरू एउटा नयाँ फोल्डरमा सर्ने छन्।" + "गृह स्क्रिनबाटै आफूले सबैभन्दा बढी प्रयोग गर्ने एप सजिलै चलाउनुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंले एप प्रयोग गर्ने समयतालिकाअनुसार बदलिने छ। फेदको पङ्क्तिमा रहेका एपहरू एउटा नयाँ फोल्डरमा सर्ने छन्।" "सिफारिस गरिएका एपहरू प्राप्त गर्नुहोस्" "पर्दैन धन्यवाद" "सेटिङ" diff --git a/quickstep/res/values-pt-rPT/strings.xml b/quickstep/res/values-pt-rPT/strings.xml index 5ac7287f74..cff747fc84 100644 --- a/quickstep/res/values-pt-rPT/strings.xml +++ b/quickstep/res/values-pt-rPT/strings.xml @@ -25,7 +25,7 @@ "Nenhum item recente" "Definições de utilização de aplicações" "Limpar tudo" - "Aplicações recentes" + "Apps recentes" "%1$s, %2$s" "< 1 minuto" "Resta(m) %1$s hoje." diff --git a/quickstep/res/values-sq/strings.xml b/quickstep/res/values-sq/strings.xml index a4233446ee..a144b92aac 100644 --- a/quickstep/res/values-sq/strings.xml +++ b/quickstep/res/values-sq/strings.xml @@ -43,7 +43,7 @@ "Aplikacionet më të përdorura shfaqen këtu dhe ndryshojnë bazuar në rutinat" "Zvarrit aplikacionet jashtë rreshtit të poshtëm për të marrë aplikacione të sugjeruara" "Aplikacionet e sugjeruara u shtuan në hapësirën bosh" - "Sugjerimet e aplikacioneve janë aktivizuar" + "Aplikacionet e sugjeruara janë aktivizuar" "Sugjerimet e aplikacioneve janë çaktivizuar" "Aplikacioni i parashikuar: %1$s" "Ndaj" diff --git a/quickstep/res/values-sv/strings.xml b/quickstep/res/values-sv/strings.xml index 42d7327d1b..8252fec2de 100644 --- a/quickstep/res/values-sv/strings.xml +++ b/quickstep/res/values-sv/strings.xml @@ -34,9 +34,9 @@ "Föreslagna appar" "Få appförslag på den nedersta raden på startskärmen" "Få appförslag på raden Favoriter på startskärmen" - "Kom enkelt åt de appar du använder mest direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas upp till startskärmen." - "Kom enkelt åt de appar du använder mest direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på raden Favoriter flyttas till startskärmen." - "Kom enkelt åt de appar du använder mest direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas till en ny mapp." + "Kom enkelt åt de appar du använder mest, direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas upp till startskärmen." + "Kom enkelt åt de appar du använder mest, direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på raden Favoriter flyttas till startskärmen." + "Kom enkelt åt de appar du använder mest, direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas till en ny mapp." "Få appförslag" "Nej tack" "Inställningar" diff --git a/quickstep/res/values-sw/strings.xml b/quickstep/res/values-sw/strings.xml index 3e949e8ee6..778d558481 100644 --- a/quickstep/res/values-sw/strings.xml +++ b/quickstep/res/values-sw/strings.xml @@ -36,14 +36,14 @@ "Pata mapendekezo ya programu katika safu ya vipendwa ya Skrini yako ya kwanza" "Fikia kwa urahisi programu unazotumia sana moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na ratiba zako. Programu zilizo kwenye sehemu ya chini zitahamishiwa kwenye Skrini yako ya kwanza." "Fikia kwa urahisi programu unazotumia sana moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na utumiaji wako. Programu zilizo katika safu ya vipendwa zitahamishiwa kwenye Skrini yako ya kwanza." - "Fikia kwa urahisi programu unazotumia zaidi, moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na ratiba zako. Programu zilizo kwenye safu mlalo ya chini zitahamishiwa kwenye folda mpya." + "Fikia kwa urahisi programu unazotumia zaidi, moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na ratiba zako. Programu zilizo kwenye safu ya chini zitahamishiwa kwenye folda mpya." "Pata mapendekezo ya programu" "Hapana" "Mipangilio" "Programu zinazotumiwa zaidi huonekana hapa na hubadilika kulingana na ratiba" "Buruta programu kutoka kwenye safu ya chini ili upate mapendekezo ya programu" "Mapendekezo ya programu yamewekwa kwenye nafasi isiyo na kitu" - "Umewasha mapendekezo ya programu" + "Mapendekezo ya programu yamewashwa" "Umezima mapendekezo ya programu" "Programu iliyotabiriwa: %1$s" "Shiriki" diff --git a/quickstep/res/values-te/strings.xml b/quickstep/res/values-te/strings.xml index 35c455fb2b..b381af994b 100644 --- a/quickstep/res/values-te/strings.xml +++ b/quickstep/res/values-te/strings.xml @@ -43,7 +43,7 @@ "ఎక్కువగా ఉపయోగించిన యాప్‌లు ఇక్కడ కనిపిస్తాయి, అవి రోజువారీ కార్యకలాపాలను బట్టి మారుతూ ఉంటాయి" "యాప్ సలహాలను పొందడానికి దిగువ వరుస నుండి యాప్‌లను లాగండి" "యాప్ సూచ‌న‌లు ఖాళీ స్పేస్‌కు జోడించబడ్డాయి" - "యాప్ సూచ‌న‌లు ఎనేబుల్ చేయబడ్డాయి" + "యాప్ సలహాలు ఎనేబుల్ చేయబడ్డాయి" "యాప్ సూచ‌న‌లు డిజేబుల్‌ చేయబడ్డాయి" "సూచించబడిన యాప్: %1$s" "షేర్ చేయండి" diff --git a/quickstep/res/values-th/strings.xml b/quickstep/res/values-th/strings.xml index e81a97615e..42e0c5858f 100644 --- a/quickstep/res/values-th/strings.xml +++ b/quickstep/res/values-th/strings.xml @@ -32,18 +32,18 @@ "คำแนะนำเกี่ยวกับแอป" "แอปทั้งหมด" "แอปที่คาดการณ์ไว้" - "รับคำแนะนำเกี่ยวกับแอปที่แถวล่างของหน้าจอหลัก" + "ดูแอปแนะนำที่แถวล่างของหน้าจอหลัก" "รับคำแนะนำเกี่ยวกับแอปในแถวรายการโปรดของหน้าจอหลัก" "เข้าถึงแอปที่คุณใช้มากที่สุดได้อย่างง่ายดายจากหน้าจอหลัก คำแนะนำจะเปลี่ยนไปตามแอปที่ใช้งานเป็นประจำ แอปในแถวล่างจะย้ายขึ้นมาอยู่ในหน้าจอหลัก" "เข้าถึงแอปที่ใช้มากที่สุดได้อย่างง่ายดายในหน้าจอหลัก คำแนะนำจะเปลี่ยนไปตามการใช้งานประจำ แอปในแถวรายการโปรดจะย้ายไปอยู่ในหน้าจอหลัก" "เข้าถึงแอปที่คุณใช้มากที่สุดได้อย่างง่ายดายจากหน้าจอหลัก คำแนะนำจะเปลี่ยนไปตามแอปที่ใช้งานเป็นประจำ แอปในแถวล่างจะย้ายไปอยู่ในโฟลเดอร์ใหม่" - "รับคำแนะนำเกี่ยวกับแอป" + "ดูแอปแนะนำ" "ไม่เป็นไร" "การตั้งค่า" "แอปที่ใช้มากที่สุดจะปรากฎที่นี่และจะเปลี่ยนไปตามการใช้งานประจำ" - "ลากแอปออกจากแถวล่างเพื่อดูคำแนะนำเกี่ยวกับแอป" + "ลากแอปออกจากแถวล่างเพื่อดูแอปแนะนำ" "เพิ่มคำแนะนำเกี่ยวกับแอปในพื้นที่ว่างแล้ว" - "เปิดใช้คำแนะนำเกี่ยวกับแอปอยู่" + "เปิดใช้คำแนะนำเกี่ยวกับแอปแล้ว" "ปิดใช้คำแนะนำเกี่ยวกับแอปอยู่" "แอปที่คาดว่าจะใช้: %1$s" "แชร์" diff --git a/quickstep/res/values-tl/strings.xml b/quickstep/res/values-tl/strings.xml index 5d00b8b6d9..54aa564904 100644 --- a/quickstep/res/values-tl/strings.xml +++ b/quickstep/res/values-tl/strings.xml @@ -32,7 +32,7 @@ "Mga iminumungkahing app" "Lahat ng app" "Iyong mga nahulaang app" - "Makakuha ng mga iminumungkahing app sa ibabang row ng iyong Home screen" + "Makakuha ng mga suhestyon sa app sa ibabang row ng iyong Home screen" "Makakuha ng mga iminumungkahing app sa row ng mga paborito ng iyong Home screen" "Madaling ma-access ang mga pinakaginagamit mong app nang direkta sa Home screen. Magbabago ang mga suhestyon batay sa iyong mga routine. Mapupunta sa iyong Home screen ang mga app na nasa ibabang row." "Madaling ma-access ang mga pinakaginagamit mong app nang direkta sa Home screen. Magbabago ang mga suhestyon batay sa iyong mga routine. Mapupunta sa iyong Home screen ang mga app sa row ng mga paborito." @@ -41,7 +41,7 @@ "Huwag na lang" "Mga Setting" "Ipinapakita ang mga pinakaginagamit na app dito, at nababago ito batay sa mga routine" - "I-drag ang mga app mula sa ibabang row para makakuha ng mga iminumungkahing app" + "I-drag ang mga app mula sa ibabang row para makakuha ng mga suhestyon sa app" "Idinagdag sa bakanteng espasyo ang mga iminumungkahing app" "Naka-enable ang mga iminumungkahing app" "Naka-disable ang mga iminumungkahing app" diff --git a/quickstep/res/values-uz/strings.xml b/quickstep/res/values-uz/strings.xml index d6c0e7994a..737bd20fa0 100644 --- a/quickstep/res/values-uz/strings.xml +++ b/quickstep/res/values-uz/strings.xml @@ -32,18 +32,18 @@ "Tavsiya etiladigan ilovalar" "Barcha ilovalar" "Taklif qilingan ilovalaringiz" - "Ilova takliflari bosh ekran pastidagi qatorda chiqadi" - "Saralanganlar qatorida Bosh ekrandagi ilovalar taklif qilinsin" + "Tavsiya etiladigan ilovalar bosh ekran pastidagi qatorda chiqadi" + "Tavsiya etiladigan ilovalar bosh ekranning saralanganlar ruknida chiqadi" "Faol ishlatiladigan ilovalarga bosh ekrandan osongina kira olasiz. Tavsiyalar oxirgi faoliyatingiz asosida almashib boradi. Pastki qatordagi ilovalar bosh ekranga chiqadi." "Faol ishlatiladigan ilovalarga bosh ekrandan osongina kira olasiz. Tavsiyalar oxirgi faoliyatingiz asosida almashib boradi. Saralanganlar qatoridagi ilovalar bosh ekranga chiqadi." "Faol ishlatiladigan ilovalarga bosh ekrandan osongina kira olasiz. Tavsiyalar oxirgi faoliyatingiz asosida almashib boradi. Pastki qatordagi ilovalar yangi jildga chiqadi." - "Ilova takliflarini olish" + "Tavsiyalarni chiqarish" "Kerak emas" "Sozlamalar" "Faol ishlatiladigan ilovalar bu yerda chiqadi va oxirgi faoliyatingiz asosida almashadi" - "Takliflar olish uchun ilovalarni pastki qatordan tashqariga oling" + "Tavsiyalar olish uchun ilovalarni pastki qatordan tashqariga oling" "Tavsiya etilgan ilovalarni ochiq joylarga kiriting" - "Endi ilova takliflari chiqadi" + "Ilova tavsiyalari yoqildi" "Endi ilova takliflari chiqmaydi" "Taklif etilgan ilova: %1$s" "Ulashish" diff --git a/quickstep/res/values-zh-rCN/strings.xml b/quickstep/res/values-zh-rCN/strings.xml index 1a06aad744..ed65978233 100644 --- a/quickstep/res/values-zh-rCN/strings.xml +++ b/quickstep/res/values-zh-rCN/strings.xml @@ -32,7 +32,7 @@ "应用建议" "所有应用" "您的预测应用" - "在主屏幕的最下面一排获取应用建议" + "在主屏幕底部获取应用建议" "在主屏幕的收藏行获取应用建议" "直接在主屏幕上轻松访问您最常用的应用。系统会根据您的日常安排提供不同的建议。最下面一排中的应用会向上移动到主屏幕中。" "直接在主屏幕上轻松访问您最常用的应用。建议会因您的日常安排而变化,收藏行中的应用将移到主屏幕上。" @@ -41,7 +41,7 @@ "不用了" "设置" "最常用的应用会显示在此处,显示的项目会根据日常安排而发生变化" - "将应用从最下面一排拖至别处,以获取应用建议" + "将应用拖离底部,以获取应用建议" "应用建议已添加到空白区域" "已启用应用建议" "已停用应用建议" diff --git a/quickstep/res/values-zh-rHK/strings.xml b/quickstep/res/values-zh-rHK/strings.xml index dc9caadd90..d3fd7eefc3 100644 --- a/quickstep/res/values-zh-rHK/strings.xml +++ b/quickstep/res/values-zh-rHK/strings.xml @@ -36,12 +36,12 @@ "在主畫面「我的最愛」列取得應用程式建議" "在主畫面輕鬆存取常用的應用程式。系統會根據您的日常安排更改建議,並將底部的應用程式移到主畫面。" "在主畫面輕鬆存取最常用的應用程式。系統會根據您的日常安排變更建議,「我的最愛」列中的應用程式會移至主畫面。" - "在主畫面輕鬆存取最常用的應用程式。系統會根據您的日常安排變更建議,並將底部應用程式列的應用程式移至新資料夾。" + "在主畫面輕鬆存取最常用的應用程式。系統會根據您的日常安排變更建議,並將底列的應用程式移至新資料夾。" "取得應用程式建議" "不用了,謝謝" "設定" "最常用的應用程式會在這裡顯示,並會根據日常安排變更" - "將應用程式從底部應用程式列拖曳出來,即可獲取應用程式建議" + "將應用程式從底列拖曳出來,即可獲取應用程式建議" "系統會將應用程式建議新增至空白位置" "已啟用應用程式建議" "已停用應用程式建議" diff --git a/quickstep/res/values-zh-rTW/strings.xml b/quickstep/res/values-zh-rTW/strings.xml index d62629090e..3545a16769 100644 --- a/quickstep/res/values-zh-rTW/strings.xml +++ b/quickstep/res/values-zh-rTW/strings.xml @@ -41,7 +41,7 @@ "不用了,謝謝" "設定" "最常使用的應用程式會顯示在這裡,顯示的項目會根據日常安排有所不同" - "將應用程式從底部列向外拖曳即可取得應用程式建議" + "將應用程式從底部列向外拖曳,即可取得應用程式建議" "應用程式建議已新增到空白位置" "應用程式建議功能已啟用" "應用程式建議功能已停用" From d5821326f82c984f4759da525faf5fe8c8f6e760 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Mon, 20 Jul 2020 14:00:53 -0700 Subject: [PATCH 12/72] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I344fea4e320a851f0d04a3308c9f7f2dca4c934e --- quickstep/res/values-ar/strings.xml | 2 +- quickstep/res/values-bg/strings.xml | 2 +- quickstep/res/values-bn/strings.xml | 2 +- quickstep/res/values-ca/strings.xml | 8 ++++---- quickstep/res/values-de/strings.xml | 6 +++--- quickstep/res/values-es-rUS/strings.xml | 2 +- quickstep/res/values-es/strings.xml | 10 +++++----- quickstep/res/values-fr-rCA/strings.xml | 2 +- quickstep/res/values-hi/strings.xml | 2 +- quickstep/res/values-hr/strings.xml | 10 +++++----- quickstep/res/values-is/strings.xml | 2 +- quickstep/res/values-it/strings.xml | 2 +- quickstep/res/values-kk/strings.xml | 10 +++++----- quickstep/res/values-km/strings.xml | 2 +- quickstep/res/values-lv/strings.xml | 2 +- quickstep/res/values-mn/strings.xml | 4 ++-- quickstep/res/values-my/strings.xml | 4 ++-- quickstep/res/values-nb/strings.xml | 2 +- quickstep/res/values-ne/strings.xml | 2 +- quickstep/res/values-pt-rPT/strings.xml | 2 +- quickstep/res/values-sq/strings.xml | 2 +- quickstep/res/values-sv/strings.xml | 6 +++--- quickstep/res/values-sw/strings.xml | 4 ++-- quickstep/res/values-te/strings.xml | 2 +- quickstep/res/values-th/strings.xml | 8 ++++---- quickstep/res/values-tl/strings.xml | 4 ++-- quickstep/res/values-uz/strings.xml | 10 +++++----- quickstep/res/values-zh-rCN/strings.xml | 4 ++-- quickstep/res/values-zh-rHK/strings.xml | 4 ++-- quickstep/res/values-zh-rTW/strings.xml | 2 +- 30 files changed, 62 insertions(+), 62 deletions(-) diff --git a/quickstep/res/values-ar/strings.xml b/quickstep/res/values-ar/strings.xml index 780104b326..c2348ecf50 100644 --- a/quickstep/res/values-ar/strings.xml +++ b/quickstep/res/values-ar/strings.xml @@ -34,7 +34,7 @@ "تطبيقاتك المتوقّعة" "رؤية التطبيقات المقترحة في الصف السفلي من الشاشة الرئيسية" "رؤية التطبيقات المقترحة في صف التطبيقات المفضّلة في الشاشة الرئيسية" - "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى سلاسل الإجراءات. سيتم نقل التطبيقات من الصف السفلي للعلوي في الشاشة الرئيسية." + "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى استخدامك الروتيني. وسيتم نقل التطبيقات من الصف السفلي في الشاشة الرئيسية إلى الصف الأعلى." "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى سلاسل الإجراءات. سيتم نقل التطبيقات من صف التطبيقات المفضّلة إلى الشاشة الرئيسية." "يمكنك الوصول إلى التطبيقات الأكثر استخدامًا بسهولة من الشاشة الرئيسية مباشرةً. سيتم تغيير الاقتراحات استنادًا إلى سلاسل الإجراءات. سيتم نقل التطبيقات من الصف الأسفل إلى مجلد جديد." "رؤية تطبيقات مقترحة" diff --git a/quickstep/res/values-bg/strings.xml b/quickstep/res/values-bg/strings.xml index db7006f564..5484bc9e8b 100644 --- a/quickstep/res/values-bg/strings.xml +++ b/quickstep/res/values-bg/strings.xml @@ -43,7 +43,7 @@ "Най-използваните приложения се показват тук и се променят въз основа на поредиците" "За да получавате предложения за приложения, с плъзгане премахнете приложенията от най-долния ред" "Предложенията за приложения са добавени на празното място" - "Функцията „Предложения за приложения“ е активирана" + "Предложенията за приложения са активирани" "Функцията „Предложения за приложения“ е деактивирана" "Предвидено приложение: %1$s" "Споделяне" diff --git a/quickstep/res/values-bn/strings.xml b/quickstep/res/values-bn/strings.xml index b230ec5611..9212a4b827 100644 --- a/quickstep/res/values-bn/strings.xml +++ b/quickstep/res/values-bn/strings.xml @@ -47,6 +47,6 @@ "অ্যাপ সাজেশন বন্ধ করা আছে" "আপনার প্রয়োজন হতে পারে এমন অ্যাপ: %1$s" "শেয়ার করুন" - "স্ক্রিনশট" + "স্ক্রিনশট নিন" "এই অ্যাপ বা আপনার প্রতিষ্ঠান এই অ্যাকশনটি পারফর্ম করার অনুমতি দেয়নি" diff --git a/quickstep/res/values-ca/strings.xml b/quickstep/res/values-ca/strings.xml index 657239ce0d..4b0acca10e 100644 --- a/quickstep/res/values-ca/strings.xml +++ b/quickstep/res/values-ca/strings.xml @@ -34,13 +34,13 @@ "Prediccions d\'aplicacions" "Obtén suggeriments d\'aplicacions a la fila inferior de la pantalla d\'inici" "Obtén suggeriments d\'aplicacions a la fila Preferides de la teva pantalla d\'inici" - "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció de la teva rutina. Les aplicacions de la fila inferior pujaran a la pantalla d\'inici." - "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció de la teva rutina. Les aplicacions de la fila Preferides es mouran a la teva pantalla d\'inici." - "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció de la teva rutina. Les aplicacions de la fila inferior es mouran a una carpeta nova." + "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció dels teus hàbits. Les aplicacions de la fila inferior pujaran a la pantalla d\'inici." + "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció dels teus hàbits. Les aplicacions de la fila Preferides es mouran a la teva pantalla d\'inici." + "Accedeix fàcilment a les aplicacions que més utilitzes des de la pantalla d\'inici. Els suggeriments variaran en funció dels teus hàbits. Les aplicacions de la fila inferior es mouran a una carpeta nova." "Mostra suggeriments d\'aplicacions" "No, gràcies" "Configuració" - "Les aplicacions que més utilitzes apareixen aquí i poden variar en funció de la teva rutina" + "Les aplicacions que més utilitzes apareixen aquí i poden variar en funció dels teus hàbits" "Arrossega les aplicacions fora de la fila inferior per obtenir suggeriments d\'aplicacions" "S\'han afegit suggeriments d\'aplicacions en un espai buit" "Els suggeriments d\'aplicacions estan activats" diff --git a/quickstep/res/values-de/strings.xml b/quickstep/res/values-de/strings.xml index 17ba8ad457..b51f04de98 100644 --- a/quickstep/res/values-de/strings.xml +++ b/quickstep/res/values-de/strings.xml @@ -35,17 +35,17 @@ "Lass dir in der unteren Reihe auf deinem Startbildschirm Vorschläge für Apps anzeigen" "Lass dir in der Favoritenleiste auf dem Startbildschirm App-Vorschläge anzeigen" "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge werden deiner Nutzung entsprechend laufend angepasst. Apps in der unteren Reihe werden nach oben auf den Startbildschirm verschoben." - "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge richten sich nach deiner gewöhnlichen Nutzung. Apps der Favoritenleiste werden auf den Startbildschirm verschoben." + "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge werden deiner Nutzung entsprechend laufend angepasst. Apps der Favoritenleiste werden auf den Startbildschirm verschoben." "Schneller Zugriff auf deine meistverwendeten Apps direkt über den Startbildschirm. Die Vorschläge werden deiner Nutzung entsprechend laufend angepasst. Apps in der unteren Reihe werden in einen neuen Ordner verschoben." "App-Vorschläge erhalten" "Nein danke" "Einstellungen" "Hier erscheinen die meistverwendeten Apps. Die Angaben können sich je nach deiner gewöhnlichen Nutzung ändern" - "Ziehe Apps aus der unteren Reihe heraus, um Vorschläge für Apps zu bekommen" + "Ziehe Apps aus der unteren Reihe heraus, um Vorschläge für Apps zu erhalten" "App-Vorschläge in freiem Bereich hinzugefügt" "Funktion \"App-Vorschläge\" aktiviert" "Funktion \"App-Vorschläge\" deaktiviert" - "App-Vorhersage: %1$s" + "Vorgeschlagene App: %1$s" "Teilen" "Screenshot" "Die App oder deine Organisation lässt diese Aktion nicht zu" diff --git a/quickstep/res/values-es-rUS/strings.xml b/quickstep/res/values-es-rUS/strings.xml index d62c8b3c82..1191becfa1 100644 --- a/quickstep/res/values-es-rUS/strings.xml +++ b/quickstep/res/values-es-rUS/strings.xml @@ -43,7 +43,7 @@ "Las apps que más se usan se muestran aquí y cambian según las rutinas" "Arrastra apps fuera de la fila inferior para obtener sugerencias" "Se agregaron sugerencias de aplicaciones a un espacio vacío" - "Las sugerencias de aplicaciones están habilitadas" + "Sugerencias de apps habilitadas" "Las sugerencias de aplicaciones están inhabilitadas" "Predicción de app: %1$s" "Compartir" diff --git a/quickstep/res/values-es/strings.xml b/quickstep/res/values-es/strings.xml index 1a8cbd2388..a2b930d068 100644 --- a/quickstep/res/values-es/strings.xml +++ b/quickstep/res/values-es/strings.xml @@ -32,12 +32,12 @@ "Sugerencias de aplicaciones" "Todas las aplicaciones" "Predicción de aplicaciones" - "Haz que aparezcan sugerencias de aplicaciones en la fila inferior de la pantalla de inicio" + "Obtén sugerencias de aplicaciones en la fila inferior de la pantalla de inicio" "Recibe sugerencias de aplicaciones en la fila de aplicaciones favoritas de la pantalla de inicio" - "Accede fácilmente desde la pantalla de inicio a las aplicaciones que más usas. Las sugerencias cambiarán según tus rutinas. Las aplicaciones de la fila inferior pasarán a mostrarse en la pantalla de inicio." - "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus rutinas. Las aplicaciones de la fila de aplicaciones favoritas se moverán a la pantalla de inicio." - "Accede fácilmente desde la pantalla de inicio a las aplicaciones que más usas. Las sugerencias cambiarán según tus rutinas. Las aplicaciones de la fila inferior se pondrán en una carpeta nueva." - "Ver sugerencias de aplicaciones" + "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus hábitos. Las aplicaciones de la fila inferior pasarán a mostrarse en la pantalla de inicio." + "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus hábitos. Las aplicaciones de la fila de aplicaciones favoritas se moverán a la pantalla de inicio." + "Accede fácilmente a las aplicaciones que más usas desde la pantalla de inicio. Las sugerencias cambiarán según tus hábitos. Las aplicaciones de la fila inferior se pondrán en una carpeta nueva." + "Sí, obtener sugerencias" "No, gracias" "Ajustes" "Las aplicaciones que más usas aparecen aquí, y van variando según tus rutinas" diff --git a/quickstep/res/values-fr-rCA/strings.xml b/quickstep/res/values-fr-rCA/strings.xml index 8ae00237d2..46096f5263 100644 --- a/quickstep/res/values-fr-rCA/strings.xml +++ b/quickstep/res/values-fr-rCA/strings.xml @@ -32,7 +32,7 @@ "Suggestions d\'applications" "Toutes les applications" "Vos prédictions d\'applications" - "Obtenez des applications suggérées dans la rangée du bas de votre écran d\'accueil" + "Obtenir des suggestions d\'applications dans la rangée du bas de votre écran d\'accueil" "Retrouvez des suggestions d\'applications dans la rangée des favoris de votre écran d\'accueil" "Accédez facilement aux applications que vous utilisez le plus, directement à l\'écran d\'accueil. Les suggestions changeront en fonction de vos habitudes. Les applications dans la rangée du bas seront déplacées vers votre écran d\'accueil." "Accédez facilement aux applications que vous utilisez le plus, directement à l\'écran d\'accueil. Les suggestions changeront en fonction de vos habitudes. Les applications dans la rangée des favoris seront déplacées vers votre écran d\'accueil." diff --git a/quickstep/res/values-hi/strings.xml b/quickstep/res/values-hi/strings.xml index 8bf208f1aa..d98cc770a1 100644 --- a/quickstep/res/values-hi/strings.xml +++ b/quickstep/res/values-hi/strings.xml @@ -36,7 +36,7 @@ "अपने होम स्क्रीन की सबसे नीचे वाली पंक्ति में पसंदीदा ऐप्लिकेशन के सुझाव पाएं" "आप जिन ऐप्लिकेशन का ज़्यादा इस्तेमाल करते हैं उन्हें सीधा अपने होम स्क्रीन पर पाएं. ऐप्लिकेशन इस्तेमाल करने के आपके रूटीन के हिसाब से सुझाव बदलते रहते हैं. नीचे की पंक्ति के ऐप्लिकेशन होम स्क्रीन पर आ जाएंगे." "सबसे ज़्यादा इस्तेमाल होने वाले ऐप्लिकेशन सीधे होम स्क्रीन पर देखें. आप ऐप्लिकेशन का कितना इस्तेमाल कर रहे हैं, उसके हिसाब से सुझाव बदलते रहते हैं. आपके पसंदीदा ऐप्लिकेशन, होम स्क्रीन पर नीचे की पंक्ति में दिखाई देंगे." - "सबसे ज़्यादा इस्तेमाल होने वाले ऐप्लिकेशन, सीधे होम स्क्रीन पर देखें. ऐप्लिकेशन इस्तेमाल करने के आपके रूटीन के हिसाब से सुझाव बदलते रहते हैं. नीचे की पंक्ति के ऐप्लिकेशन एक नए फ़ोल्डर में चले जाएंगे." + "सबसे ज़्यादा इस्तेमाल होने वाले ऐप्लिकेशन, सीधे होम स्क्रीन पर पाएं. आपके ऐप्लिकेशन इस्तेमाल करने के रूटीन के हिसाब से सुझाव बदलते रहते हैं. नीचे की पंक्ति के ऐप्लिकेशन एक नए फ़ोल्डर में चले जाएंगे." "ऐप्लिकेशन के बारे में सुझाव पाएं" "रहने दें" "सेटिंग" diff --git a/quickstep/res/values-hr/strings.xml b/quickstep/res/values-hr/strings.xml index 21920a7113..a026ef8012 100644 --- a/quickstep/res/values-hr/strings.xml +++ b/quickstep/res/values-hr/strings.xml @@ -32,21 +32,21 @@ "Predložene aplikacije" "Sve aplikacije" "Vaše predviđene aplikacije" - "Prikažite predložene aplikacije u donjem retku početnog zaslona" + "Prijedloge aplikacija vidjet ćete u donjem retku početnog zaslona" "Primajte prijedloge aplikacija u retku omiljenih na početnom zaslonu" "Lako pristupite najčešće upotrebljavanim aplikacijama s početnog zaslona. Prijedlozi će se mijenjati na temelju vaših rutina. Aplikacije iz donjeg retka pomaknut će se na početni zaslon." "Lako pristupite najčešće upotrebljavanim aplikacijama s početnog zaslona. Prijedlozi će se mijenjati na temelju vaših rutina. Aplikacije koje se nalaze u retku omiljenih pomaknut će se na početni zaslon." "Lako pristupite najčešće upotrebljavanim aplikacijama s početnog zaslona. Prijedlozi će se mijenjati na temelju vaših rutina. Aplikacije iz donjeg retka pomaknut će se u novu mapu." - "Prikaži predložene aplikacije" + "Predloži mi aplikacije" "Ne, hvala" "Postavke" "Ovdje se prikazuju najčešće upotrebljavane aplikacije i mijenjaju se na temelju rutina" "Povucite aplikacije iz donjeg retka da biste dobili prijedloge aplikacija" "Predložene aplikacije dodane u prazan prostor" - "Predlaganje aplikacija je omogućeno" - "Predlaganje aplikacija je onemogućeno" + "Predlaganje apl. omogućeno" + "Predlaganje apl. onemogućeno" "Predviđena aplikacija: %1$s" - "Udio" + "Podijeli" "Snimka zaslona" "Aplikacija ili vaša organizacija ne dopuštaju ovu radnju" diff --git a/quickstep/res/values-is/strings.xml b/quickstep/res/values-is/strings.xml index f8b63fb64a..824fd7fb31 100644 --- a/quickstep/res/values-is/strings.xml +++ b/quickstep/res/values-is/strings.xml @@ -43,7 +43,7 @@ "Mest notuðu forritin birtast hér og breytast í samræmi við rútínur" "Dragðu forrit af neðstu röð til að fá tillögð forrit" "Tillögðum forritum bætt við autt svæði" - "Kveikt á tillögðum forritum" + "Kveikt á tillögum að forritum" "Slökkt er á tillögðum forritum" "Tillaga að forriti: %1$s" "Deila" diff --git a/quickstep/res/values-it/strings.xml b/quickstep/res/values-it/strings.xml index e0a78b2301..4038966102 100644 --- a/quickstep/res/values-it/strings.xml +++ b/quickstep/res/values-it/strings.xml @@ -41,7 +41,7 @@ "No, grazie" "Impostazioni" "Le app più utilizzate vengono visualizzate qui e variano in base alle routine" - "Trascina le app fuori dalla fila in basso per vedere le app suggerite" + "Trascina le app fuori dalla riga inferiore per visualizzare le app suggerite" "App suggerite aggiunte a uno spazio vuoto" "La funzionalità app suggerite è attiva" "La funzionalità app suggerite è disattivata" diff --git a/quickstep/res/values-kk/strings.xml b/quickstep/res/values-kk/strings.xml index 1bb1684dde..fb76660b1f 100644 --- a/quickstep/res/values-kk/strings.xml +++ b/quickstep/res/values-kk/strings.xml @@ -32,16 +32,16 @@ "Ұсынылған қолданбалар" "Барлық қолданбалар" "Ұсынылатын қолданбалар" - "Негізгі экранның төменгі жолында ұсынылған қолданбаларды алу" + "Негізгі экранның төменгі жолында қолданбаларды ұсыну" "Ұсынылған қолданбалар негізгі экранда таңдаулылар арасында көрсетілетін болады" - "Жиі пайдаланылатын қолданбаларға негізгі экраннан оңай кіріңіз. Ұсыныстар әрекеттер тізімі негізінде өзгереді. Төменгі жолдағы қолданбалар негізгі экраныңызға қарай жоғары жылжиды." + "Жиі пайдаланылатын қолданбаларға негізгі экраннан кіруге болады. Ұсыныстар күнделікті әрекеттеріңізге сәйкес өзгереді. Төменгі қатардағы қолданбалар негізгі экранға қарай жоғары жылжиды." "Жиі пайдаланылатын қолданбаларға негізгі экраннан оңай кіре аласыз. Ұсыныстар күнделікті әрекеттеріңізге сәйкес өзгереді. Таңдаулылар жолындағы қолданбалар негізгі экранға ауысады." - "Жиі пайдаланылатын қолданбаларға негізгі экраннан оңай кіріңіз. Ұсыныстар әрекеттер тізімі негізінде өзгереді. Төмендегі қолданбалар жаңа қалтаға жылжиды." + "Жиі пайдаланылатын қолданбаларға негізгі экраннан кіруге болады. Ұсыныстар күнделікті әрекеттеріңізге сәйкес өзгереді. Төменгі қатардағы қолданбалар жаңа қалтаға жылжиды." "Ұсынылған қолданбаларды көру" "Жоқ, рақмет" "Параметрлер" - "Жиі пайдаланылатын қолданбалар осы жерде көрсетіледі және әрекеттер тізімі негізінде өзгереді." - "Ұсынылған қолданбаларды алу үшін қолданбаларды төменгі жолдан жылжытыңыз." + "Жиі пайдаланылатын қолданбалар осы жерде көрсетіледі. Олар күнделікті әрекеттеріңізге сәйкес өзгереді." + "Ұсынылған қолданбаларды көру үшін төменгі қатардан керектерін сүйреп шығарыңыз." "Ұсынылған қолданбалар бос орынға қосылды." "\"Ұсынылған қолданбалар\" функциясы қосулы." "\"Ұсынылған қолданбалар\" функциясы өшірулі." diff --git a/quickstep/res/values-km/strings.xml b/quickstep/res/values-km/strings.xml index dd2fbacbed..3c3fccc022 100644 --- a/quickstep/res/values-km/strings.xml +++ b/quickstep/res/values-km/strings.xml @@ -37,7 +37,7 @@ "ចូលប្រើ​កម្មវិធី​ដែលអ្នកប្រើ​ញឹកញាប់បំផុត​បានយ៉ាង​ងាយស្រួល​នៅលើ​អេក្រង់ដើម​ផ្ទាល់។ ការណែនាំ​នឹងប្រែប្រួល​ទៅតាម​ទម្លាប់​របស់អ្នក។ កម្មវិធី​នៅជួរ​ខាងក្រោម​នឹងផ្លាស់ទីឡើង​ទៅអេក្រង់ដើម​របស់អ្នក។" "ចូលប្រើ​កម្មវិធី​ដែលអ្នកប្រើ​ញឹកញាប់បំផុត​បានយ៉ាង​ងាយស្រួល​នៅលើ​អេក្រង់ដើមដោយផ្ទាល់។ ការណែនាំ​នឹងប្រែប្រួល​ទៅតាម​ទម្លាប់​របស់អ្នក។ កម្មវិធី​នៅក្នុង​ជួរដេក​សំណព្វ​នឹងផ្លាស់ទី​ទៅអេក្រង់ដើម​របស់អ្នក។" "ចូលប្រើ​កម្មវិធី​ដែលអ្នកប្រើ​ញឹកញាប់បំផុត​បានយ៉ាង​ងាយស្រួល​នៅលើ​អេក្រង់ដើម​ផ្ទាល់។ ការណែនាំ​នឹងប្រែប្រួល​ទៅតាម​ទម្លាប់​របស់អ្នក។ កម្មវិធី​នៅជួរ​ខាងក្រោម​នឹងផ្លាស់ទី​ទៅថតថ្មី។" - "ទទួលបាន​ការណែនាំ​កម្មវិធី" + "ទទួលការណែនាំ​កម្មវិធី" "ទេ អរគុណ" "ការកំណត់" "កម្មវិធី​ដែលប្រើ​ញឹកញាប់បំផុត​បង្ហាញ​នៅទីនេះ និង​ប្រែប្រួល​ទៅតាមទម្លាប់" diff --git a/quickstep/res/values-lv/strings.xml b/quickstep/res/values-lv/strings.xml index 82c96fe213..65620c4683 100644 --- a/quickstep/res/values-lv/strings.xml +++ b/quickstep/res/values-lv/strings.xml @@ -47,6 +47,6 @@ "Ieteicamās lietotnes ir atspējotas" "Prognozētā lietotne: %1$s" "Kopīgot" - "Izveidot ekrānuzņēmumu" + "Veikt ekrānuzņēmumu" "Lietotne vai jūsu organizācija neatļauj veikt šo darbību." diff --git a/quickstep/res/values-mn/strings.xml b/quickstep/res/values-mn/strings.xml index f4b9d43e6e..ba083ef0e0 100644 --- a/quickstep/res/values-mn/strings.xml +++ b/quickstep/res/values-mn/strings.xml @@ -34,9 +34,9 @@ "Таны таамагласан аппууд" "Үндсэн нүүрнийхээ доод мөрөнд санал болгож буй аппуудыг аваарай" "Үндсэн нүүрний дуртай мөрнөөсөө санал болгож буй аппуудыг аваарай" - "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөр дэх аппуудыг таны Үндсэн нүүр лүү дээш зөөнө." + "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрнээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөрөнд буй аппуудыг таны Үндсэн нүүр лүү дээш зөөнө." "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрнээсээ хялбархан хандаарай. Санал болголтыг таны хэвшлээс хамааран өөрчилнө. Дуртай мөрөнд буй аппуудыг таны үндсэн нүүр лүү зөөнө." - "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөр дэх аппуудыг шинэ фолдер луу зөөнө." + "Хамгийн их ашигладаг аппууддаа Үндсэн нүүрнээс хялбархан хандаарай. Санал болгож буй аппуудыг таны хэвшлээс хамаарч өөрчилнө. Доод мөрөнд буй аппуудыг шинэ фолдер луу зөөнө." "Санал болгож буй аппуудыг авах" "Үгүй, баярлалаа" "Тохиргоо" diff --git a/quickstep/res/values-my/strings.xml b/quickstep/res/values-my/strings.xml index 0dc3a165b5..a18c1c451d 100644 --- a/quickstep/res/values-my/strings.xml +++ b/quickstep/res/values-my/strings.xml @@ -34,7 +34,7 @@ "သင်၏ ခန့်မှန်းအက်ပ်များ" "သင်၏ \'ပင်မစာမျက်နှာ\' အောက်ခြေအတန်းတွင် အက်ပ်အကြံပြုချက်များ ရယူခြင်း" "သင်၏ \'ပင်မစာမျက်နှာ\' ၏ အနှစ်သက်ဆုံးများအတန်းတွင် အက်ပ်အကြံပြုချက်များ ရယူခြင်း" - "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ သုံးနိုင်သည်။ သင်၏ ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အောက်ခြေအတန်းရှိ အက်ပ်များကို သင်၏ \'ပင်မစာမျက်နှာ\' သို့ရွှေ့လိုက်မည်။" + "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ ဖွင့်နိုင်သည်။ သင်၏ ပုံမှန်လုပ်ဆောင်ချက်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အောက်ခြေအတန်းရှိ အက်ပ်များကို သင်၏ \'ပင်မစာမျက်နှာ\' သို့ရွှေ့လိုက်မည်။" "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ သုံးနိုင်သည်။ သင်၏ ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အနှစ်သက်ဆုံးများအတန်းရှိ အက်ပ်များကို သင်၏ \'ပင်မစာမျက်နှာ\' သို့ရွှေ့လိုက်မည်။" "အသုံးအများဆုံးအက်ပ်များကို \'ပင်မစာမျက်နှာ\' တွင် အလွယ်တကူ သုံးနိုင်သည်။ သင်၏ ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ အကြံပြုချက်များ ပြောင်းလဲပါမည်။ အောက်ခြေအတန်းရှိ အက်ပ်များကို ဖိုင်တွဲအသစ်သို့ ရွှေ့လိုက်မည်။" "အက်ပ်အကြံပြုချက်များ ရယူရန်" @@ -43,7 +43,7 @@ "အသုံးအများဆုံးအက်ပ်များကို ဤနေရာတွင် ပြပြီး ပုံမှန်အစီအစဉ်များပေါ် အခြေခံ၍ ပြောင်းလဲသည်" "အက်ပ်အကြံပြုချက်များ ရယူရန် အောက်ခြေအတန်းရှိ အက်ပ်များကို ဖိဆွဲထုတ်လိုက်ပါ" "အက်ပ်အကြံပြုချက်များကို နေရာလွတ်သို့ ထည့်လိုက်သည်" - "အက်ပ်အကြံပြုချက်များကို ဖွင့်ထားသည်" + "အက်ပ်အကြံပြုချက်များ ဖွင့်ထားသည်" "အက်ပ်အကြံပြုချက်များကို ပိတ်ထားသည်" "ကြိုတင်မှန်းဆထားသော အက်ပ်− %1$s" "မျှဝေရန်" diff --git a/quickstep/res/values-nb/strings.xml b/quickstep/res/values-nb/strings.xml index 161612212b..161d1c4f97 100644 --- a/quickstep/res/values-nb/strings.xml +++ b/quickstep/res/values-nb/strings.xml @@ -43,7 +43,7 @@ "Appene som brukes oftest, vises her og endres basert på rutiner" "Dra appene vekk fra den nederste raden for å få appforslag." "Appforslag er lagt til på et tomt område" - "Appforslag er slått på" + "Appforslag er på" "Appforslag er slått av" "Foreslått app: %1$s" "Del" diff --git a/quickstep/res/values-ne/strings.xml b/quickstep/res/values-ne/strings.xml index c8c35a8c80..99a22f922f 100644 --- a/quickstep/res/values-ne/strings.xml +++ b/quickstep/res/values-ne/strings.xml @@ -36,7 +36,7 @@ "आफ्नो होम स्क्रिनको मन पर्ने नामक पङ्क्तिमा सिफारिस गरिएका एपहरू प्राप्त गर्नुहोस्" "गृह स्क्रिनबाटै आफूले सबैभन्दा बढी प्रयोग गर्ने एप सजिलै चलाउनुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंले एप प्रयोग गर्ने समयतालिकाअनुसार बदलिने छ। फेदको पङ्क्तिमा रहेका एपहरू तपाईंको गृह स्क्रिनको सिरानमा सर्ने छन्।" "आफूले सबैभन्दा बढी प्रयोग गर्ने एपहरू गृह स्क्रिनबाटै सजिलैसँग खोल्नुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंको दिनचर्याअनुसार बदलिने छ। मन पर्ने नामक पङ्क्तिमा रहेका एपहरू सारेर होम स्क्रिनमा लगिने छन्।" - "गृह स्क्रिनबाटै आफूले सबैभन्दा बढी प्रयोग गर्ने एपमाथि सजिलैसँग पहुँच राख्नुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंले एप प्रयोग गर्ने समयतालिकाअनुसार बदलिने छ। फेदको पङ्क्तिमा रहेका एपहरू एउटा नयाँ फोल्डरमा सर्ने छन्।" + "गृह स्क्रिनबाटै आफूले सबैभन्दा बढी प्रयोग गर्ने एप सजिलै चलाउनुहोस्। सिफारिस गरिने एपहरूको क्रम तपाईंले एप प्रयोग गर्ने समयतालिकाअनुसार बदलिने छ। फेदको पङ्क्तिमा रहेका एपहरू एउटा नयाँ फोल्डरमा सर्ने छन्।" "सिफारिस गरिएका एपहरू प्राप्त गर्नुहोस्" "पर्दैन धन्यवाद" "सेटिङ" diff --git a/quickstep/res/values-pt-rPT/strings.xml b/quickstep/res/values-pt-rPT/strings.xml index 5ac7287f74..cff747fc84 100644 --- a/quickstep/res/values-pt-rPT/strings.xml +++ b/quickstep/res/values-pt-rPT/strings.xml @@ -25,7 +25,7 @@ "Nenhum item recente" "Definições de utilização de aplicações" "Limpar tudo" - "Aplicações recentes" + "Apps recentes" "%1$s, %2$s" "< 1 minuto" "Resta(m) %1$s hoje." diff --git a/quickstep/res/values-sq/strings.xml b/quickstep/res/values-sq/strings.xml index a4233446ee..a144b92aac 100644 --- a/quickstep/res/values-sq/strings.xml +++ b/quickstep/res/values-sq/strings.xml @@ -43,7 +43,7 @@ "Aplikacionet më të përdorura shfaqen këtu dhe ndryshojnë bazuar në rutinat" "Zvarrit aplikacionet jashtë rreshtit të poshtëm për të marrë aplikacione të sugjeruara" "Aplikacionet e sugjeruara u shtuan në hapësirën bosh" - "Sugjerimet e aplikacioneve janë aktivizuar" + "Aplikacionet e sugjeruara janë aktivizuar" "Sugjerimet e aplikacioneve janë çaktivizuar" "Aplikacioni i parashikuar: %1$s" "Ndaj" diff --git a/quickstep/res/values-sv/strings.xml b/quickstep/res/values-sv/strings.xml index 42d7327d1b..8252fec2de 100644 --- a/quickstep/res/values-sv/strings.xml +++ b/quickstep/res/values-sv/strings.xml @@ -34,9 +34,9 @@ "Föreslagna appar" "Få appförslag på den nedersta raden på startskärmen" "Få appförslag på raden Favoriter på startskärmen" - "Kom enkelt åt de appar du använder mest direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas upp till startskärmen." - "Kom enkelt åt de appar du använder mest direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på raden Favoriter flyttas till startskärmen." - "Kom enkelt åt de appar du använder mest direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas till en ny mapp." + "Kom enkelt åt de appar du använder mest, direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas upp till startskärmen." + "Kom enkelt åt de appar du använder mest, direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på raden Favoriter flyttas till startskärmen." + "Kom enkelt åt de appar du använder mest, direkt från startskärmen. Förslagen ändras efter dina rutiner. Appar på nedersta raden flyttas till en ny mapp." "Få appförslag" "Nej tack" "Inställningar" diff --git a/quickstep/res/values-sw/strings.xml b/quickstep/res/values-sw/strings.xml index 3e949e8ee6..778d558481 100644 --- a/quickstep/res/values-sw/strings.xml +++ b/quickstep/res/values-sw/strings.xml @@ -36,14 +36,14 @@ "Pata mapendekezo ya programu katika safu ya vipendwa ya Skrini yako ya kwanza" "Fikia kwa urahisi programu unazotumia sana moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na ratiba zako. Programu zilizo kwenye sehemu ya chini zitahamishiwa kwenye Skrini yako ya kwanza." "Fikia kwa urahisi programu unazotumia sana moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na utumiaji wako. Programu zilizo katika safu ya vipendwa zitahamishiwa kwenye Skrini yako ya kwanza." - "Fikia kwa urahisi programu unazotumia zaidi, moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na ratiba zako. Programu zilizo kwenye safu mlalo ya chini zitahamishiwa kwenye folda mpya." + "Fikia kwa urahisi programu unazotumia zaidi, moja kwa moja kwenye Skrini ya kwanza. Mapendekezo yatabadilika kulingana na ratiba zako. Programu zilizo kwenye safu ya chini zitahamishiwa kwenye folda mpya." "Pata mapendekezo ya programu" "Hapana" "Mipangilio" "Programu zinazotumiwa zaidi huonekana hapa na hubadilika kulingana na ratiba" "Buruta programu kutoka kwenye safu ya chini ili upate mapendekezo ya programu" "Mapendekezo ya programu yamewekwa kwenye nafasi isiyo na kitu" - "Umewasha mapendekezo ya programu" + "Mapendekezo ya programu yamewashwa" "Umezima mapendekezo ya programu" "Programu iliyotabiriwa: %1$s" "Shiriki" diff --git a/quickstep/res/values-te/strings.xml b/quickstep/res/values-te/strings.xml index 35c455fb2b..b381af994b 100644 --- a/quickstep/res/values-te/strings.xml +++ b/quickstep/res/values-te/strings.xml @@ -43,7 +43,7 @@ "ఎక్కువగా ఉపయోగించిన యాప్‌లు ఇక్కడ కనిపిస్తాయి, అవి రోజువారీ కార్యకలాపాలను బట్టి మారుతూ ఉంటాయి" "యాప్ సలహాలను పొందడానికి దిగువ వరుస నుండి యాప్‌లను లాగండి" "యాప్ సూచ‌న‌లు ఖాళీ స్పేస్‌కు జోడించబడ్డాయి" - "యాప్ సూచ‌న‌లు ఎనేబుల్ చేయబడ్డాయి" + "యాప్ సలహాలు ఎనేబుల్ చేయబడ్డాయి" "యాప్ సూచ‌న‌లు డిజేబుల్‌ చేయబడ్డాయి" "సూచించబడిన యాప్: %1$s" "షేర్ చేయండి" diff --git a/quickstep/res/values-th/strings.xml b/quickstep/res/values-th/strings.xml index e81a97615e..42e0c5858f 100644 --- a/quickstep/res/values-th/strings.xml +++ b/quickstep/res/values-th/strings.xml @@ -32,18 +32,18 @@ "คำแนะนำเกี่ยวกับแอป" "แอปทั้งหมด" "แอปที่คาดการณ์ไว้" - "รับคำแนะนำเกี่ยวกับแอปที่แถวล่างของหน้าจอหลัก" + "ดูแอปแนะนำที่แถวล่างของหน้าจอหลัก" "รับคำแนะนำเกี่ยวกับแอปในแถวรายการโปรดของหน้าจอหลัก" "เข้าถึงแอปที่คุณใช้มากที่สุดได้อย่างง่ายดายจากหน้าจอหลัก คำแนะนำจะเปลี่ยนไปตามแอปที่ใช้งานเป็นประจำ แอปในแถวล่างจะย้ายขึ้นมาอยู่ในหน้าจอหลัก" "เข้าถึงแอปที่ใช้มากที่สุดได้อย่างง่ายดายในหน้าจอหลัก คำแนะนำจะเปลี่ยนไปตามการใช้งานประจำ แอปในแถวรายการโปรดจะย้ายไปอยู่ในหน้าจอหลัก" "เข้าถึงแอปที่คุณใช้มากที่สุดได้อย่างง่ายดายจากหน้าจอหลัก คำแนะนำจะเปลี่ยนไปตามแอปที่ใช้งานเป็นประจำ แอปในแถวล่างจะย้ายไปอยู่ในโฟลเดอร์ใหม่" - "รับคำแนะนำเกี่ยวกับแอป" + "ดูแอปแนะนำ" "ไม่เป็นไร" "การตั้งค่า" "แอปที่ใช้มากที่สุดจะปรากฎที่นี่และจะเปลี่ยนไปตามการใช้งานประจำ" - "ลากแอปออกจากแถวล่างเพื่อดูคำแนะนำเกี่ยวกับแอป" + "ลากแอปออกจากแถวล่างเพื่อดูแอปแนะนำ" "เพิ่มคำแนะนำเกี่ยวกับแอปในพื้นที่ว่างแล้ว" - "เปิดใช้คำแนะนำเกี่ยวกับแอปอยู่" + "เปิดใช้คำแนะนำเกี่ยวกับแอปแล้ว" "ปิดใช้คำแนะนำเกี่ยวกับแอปอยู่" "แอปที่คาดว่าจะใช้: %1$s" "แชร์" diff --git a/quickstep/res/values-tl/strings.xml b/quickstep/res/values-tl/strings.xml index 5d00b8b6d9..54aa564904 100644 --- a/quickstep/res/values-tl/strings.xml +++ b/quickstep/res/values-tl/strings.xml @@ -32,7 +32,7 @@ "Mga iminumungkahing app" "Lahat ng app" "Iyong mga nahulaang app" - "Makakuha ng mga iminumungkahing app sa ibabang row ng iyong Home screen" + "Makakuha ng mga suhestyon sa app sa ibabang row ng iyong Home screen" "Makakuha ng mga iminumungkahing app sa row ng mga paborito ng iyong Home screen" "Madaling ma-access ang mga pinakaginagamit mong app nang direkta sa Home screen. Magbabago ang mga suhestyon batay sa iyong mga routine. Mapupunta sa iyong Home screen ang mga app na nasa ibabang row." "Madaling ma-access ang mga pinakaginagamit mong app nang direkta sa Home screen. Magbabago ang mga suhestyon batay sa iyong mga routine. Mapupunta sa iyong Home screen ang mga app sa row ng mga paborito." @@ -41,7 +41,7 @@ "Huwag na lang" "Mga Setting" "Ipinapakita ang mga pinakaginagamit na app dito, at nababago ito batay sa mga routine" - "I-drag ang mga app mula sa ibabang row para makakuha ng mga iminumungkahing app" + "I-drag ang mga app mula sa ibabang row para makakuha ng mga suhestyon sa app" "Idinagdag sa bakanteng espasyo ang mga iminumungkahing app" "Naka-enable ang mga iminumungkahing app" "Naka-disable ang mga iminumungkahing app" diff --git a/quickstep/res/values-uz/strings.xml b/quickstep/res/values-uz/strings.xml index d6c0e7994a..737bd20fa0 100644 --- a/quickstep/res/values-uz/strings.xml +++ b/quickstep/res/values-uz/strings.xml @@ -32,18 +32,18 @@ "Tavsiya etiladigan ilovalar" "Barcha ilovalar" "Taklif qilingan ilovalaringiz" - "Ilova takliflari bosh ekran pastidagi qatorda chiqadi" - "Saralanganlar qatorida Bosh ekrandagi ilovalar taklif qilinsin" + "Tavsiya etiladigan ilovalar bosh ekran pastidagi qatorda chiqadi" + "Tavsiya etiladigan ilovalar bosh ekranning saralanganlar ruknida chiqadi" "Faol ishlatiladigan ilovalarga bosh ekrandan osongina kira olasiz. Tavsiyalar oxirgi faoliyatingiz asosida almashib boradi. Pastki qatordagi ilovalar bosh ekranga chiqadi." "Faol ishlatiladigan ilovalarga bosh ekrandan osongina kira olasiz. Tavsiyalar oxirgi faoliyatingiz asosida almashib boradi. Saralanganlar qatoridagi ilovalar bosh ekranga chiqadi." "Faol ishlatiladigan ilovalarga bosh ekrandan osongina kira olasiz. Tavsiyalar oxirgi faoliyatingiz asosida almashib boradi. Pastki qatordagi ilovalar yangi jildga chiqadi." - "Ilova takliflarini olish" + "Tavsiyalarni chiqarish" "Kerak emas" "Sozlamalar" "Faol ishlatiladigan ilovalar bu yerda chiqadi va oxirgi faoliyatingiz asosida almashadi" - "Takliflar olish uchun ilovalarni pastki qatordan tashqariga oling" + "Tavsiyalar olish uchun ilovalarni pastki qatordan tashqariga oling" "Tavsiya etilgan ilovalarni ochiq joylarga kiriting" - "Endi ilova takliflari chiqadi" + "Ilova tavsiyalari yoqildi" "Endi ilova takliflari chiqmaydi" "Taklif etilgan ilova: %1$s" "Ulashish" diff --git a/quickstep/res/values-zh-rCN/strings.xml b/quickstep/res/values-zh-rCN/strings.xml index 1a06aad744..ed65978233 100644 --- a/quickstep/res/values-zh-rCN/strings.xml +++ b/quickstep/res/values-zh-rCN/strings.xml @@ -32,7 +32,7 @@ "应用建议" "所有应用" "您的预测应用" - "在主屏幕的最下面一排获取应用建议" + "在主屏幕底部获取应用建议" "在主屏幕的收藏行获取应用建议" "直接在主屏幕上轻松访问您最常用的应用。系统会根据您的日常安排提供不同的建议。最下面一排中的应用会向上移动到主屏幕中。" "直接在主屏幕上轻松访问您最常用的应用。建议会因您的日常安排而变化,收藏行中的应用将移到主屏幕上。" @@ -41,7 +41,7 @@ "不用了" "设置" "最常用的应用会显示在此处,显示的项目会根据日常安排而发生变化" - "将应用从最下面一排拖至别处,以获取应用建议" + "将应用拖离底部,以获取应用建议" "应用建议已添加到空白区域" "已启用应用建议" "已停用应用建议" diff --git a/quickstep/res/values-zh-rHK/strings.xml b/quickstep/res/values-zh-rHK/strings.xml index dc9caadd90..d3fd7eefc3 100644 --- a/quickstep/res/values-zh-rHK/strings.xml +++ b/quickstep/res/values-zh-rHK/strings.xml @@ -36,12 +36,12 @@ "在主畫面「我的最愛」列取得應用程式建議" "在主畫面輕鬆存取常用的應用程式。系統會根據您的日常安排更改建議,並將底部的應用程式移到主畫面。" "在主畫面輕鬆存取最常用的應用程式。系統會根據您的日常安排變更建議,「我的最愛」列中的應用程式會移至主畫面。" - "在主畫面輕鬆存取最常用的應用程式。系統會根據您的日常安排變更建議,並將底部應用程式列的應用程式移至新資料夾。" + "在主畫面輕鬆存取最常用的應用程式。系統會根據您的日常安排變更建議,並將底列的應用程式移至新資料夾。" "取得應用程式建議" "不用了,謝謝" "設定" "最常用的應用程式會在這裡顯示,並會根據日常安排變更" - "將應用程式從底部應用程式列拖曳出來,即可獲取應用程式建議" + "將應用程式從底列拖曳出來,即可獲取應用程式建議" "系統會將應用程式建議新增至空白位置" "已啟用應用程式建議" "已停用應用程式建議" diff --git a/quickstep/res/values-zh-rTW/strings.xml b/quickstep/res/values-zh-rTW/strings.xml index d62629090e..3545a16769 100644 --- a/quickstep/res/values-zh-rTW/strings.xml +++ b/quickstep/res/values-zh-rTW/strings.xml @@ -41,7 +41,7 @@ "不用了,謝謝" "設定" "最常使用的應用程式會顯示在這裡,顯示的項目會根據日常安排有所不同" - "將應用程式從底部列向外拖曳即可取得應用程式建議" + "將應用程式從底部列向外拖曳,即可取得應用程式建議" "應用程式建議已新增到空白位置" "應用程式建議功能已啟用" "應用程式建議功能已停用" From 25ed0dce256476bbf260621558da800e153d92f2 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Mon, 20 Jul 2020 14:02:54 -0700 Subject: [PATCH 13/72] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: Ic9168efed903a1cc61b770bc32d754ca1858b3df --- res/values-az/strings.xml | 2 +- res/values-b+sr+Latn/strings.xml | 2 +- res/values-be/strings.xml | 2 +- res/values-bg/strings.xml | 2 +- res/values-bs/strings.xml | 4 ++-- res/values-de/strings.xml | 2 +- res/values-el/strings.xml | 2 +- res/values-fi/strings.xml | 2 +- res/values-fr-rCA/strings.xml | 4 ++-- res/values-gu/strings.xml | 2 +- res/values-hr/strings.xml | 2 +- res/values-hu/strings.xml | 2 +- res/values-in/strings.xml | 2 +- res/values-iw/strings.xml | 4 ++-- res/values-ja/strings.xml | 2 +- res/values-ml/strings.xml | 4 ++-- res/values-my/strings.xml | 2 +- res/values-nb/strings.xml | 2 +- res/values-or/strings.xml | 2 +- res/values-pa/strings.xml | 2 +- res/values-pl/strings.xml | 2 +- res/values-ru/strings.xml | 2 +- res/values-sk/strings.xml | 2 +- res/values-sl/strings.xml | 2 +- res/values-sq/strings.xml | 4 ++-- res/values-sr/strings.xml | 2 +- res/values-te/strings.xml | 2 +- res/values-th/strings.xml | 4 ++-- res/values-uz/strings.xml | 4 ++-- 29 files changed, 36 insertions(+), 36 deletions(-) diff --git a/res/values-az/strings.xml b/res/values-az/strings.xml index 72d211c44c..aed975ac42 100644 --- a/res/values-az/strings.xml +++ b/res/values-az/strings.xml @@ -52,7 +52,7 @@ "Sistemdən sil" "Tətbiq infosu" "Quraşdırın" - "Tətbiq təklif etməyin" + "Tətbiq təklif olunmasın" "Proqnozlaşdırılan tətbiqi bərkidin" "qısayolları quraşdır" "Tətbiqə istifadəçi müdaxiləsi olmadan qısayolları əlavə etməyə icazə verir." diff --git a/res/values-b+sr+Latn/strings.xml b/res/values-b+sr+Latn/strings.xml index 8f6f8c1cb9..e8123688e1 100644 --- a/res/values-b+sr+Latn/strings.xml +++ b/res/values-b+sr+Latn/strings.xml @@ -50,7 +50,7 @@ "Početna" "Ukloni" "Deinstaliraj" - "Inform. o aplikaciji" + "Infor. o aplikaciji" "Instaliraj" "Ne predlaži aplikaciju" "Zakači predviđanje" diff --git a/res/values-be/strings.xml b/res/values-be/strings.xml index 14bfd8b551..0b2b6f1bc9 100644 --- a/res/values-be/strings.xml +++ b/res/values-be/strings.xml @@ -50,7 +50,7 @@ "Галоўная" "Выдаліць" "Дэінсталяваць" - "Звесткі пра праграмы" + "Пра праграму" "Усталяваць" "Не прапаноўваць праграму" "Замацаваць прапанаваную праграму" diff --git a/res/values-bg/strings.xml b/res/values-bg/strings.xml index 0d06ead6b7..512a7fc069 100644 --- a/res/values-bg/strings.xml +++ b/res/values-bg/strings.xml @@ -50,7 +50,7 @@ "Начало" "Премахване" "Деинсталиране" - "Инфо за прилож." + "Информация за прилож." "Инсталиране" "Без предлагане на приложение" "Фиксиране на предвиждането" diff --git a/res/values-bs/strings.xml b/res/values-bs/strings.xml index bf07ed5ea8..6ce19d8fe6 100644 --- a/res/values-bs/strings.xml +++ b/res/values-bs/strings.xml @@ -50,10 +50,10 @@ "Početna" "Ukloni" "Deinstaliraj" - "Informacije o aplikaciji" + "Inform. o aplikaciji" "Instaliraj" "Ne predlaži aplikaciju" - "Predviđanje PIN-a" + "Zakači predviđanje" "instaliraj prečice" "Dopušta aplikaciji dodavanje prečica bez posredovanja korisnika." "čitaj postavke na početnom ekranu i prečice" diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 520d64a103..fdd92142ac 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -52,7 +52,7 @@ "Deinstallieren" "App-Info" "Installieren" - "App nicht empfehlen" + "App nicht vorschlagen" "Vorgeschlagene App anpinnen" "Verknüpfungen installieren" "Ermöglicht einer App das Hinzufügen von Verknüpfungen ohne Eingreifen des Nutzers" diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml index 2bb266b771..5d72b77410 100644 --- a/res/values-el/strings.xml +++ b/res/values-el/strings.xml @@ -50,7 +50,7 @@ "Αρχική οθόνη" "Κατάργηση" "Απεγκατάσταση" - "Πληροφορίες εφαρμογής" + "Πληροφ. εφαρμογής" "Εγκατάσταση" "Να μην προτείνεται η εφαρμογή" "Καρφίτσωμα πρόβλεψης" diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml index 2dbc9df998..9fea032da6 100644 --- a/res/values-fi/strings.xml +++ b/res/values-fi/strings.xml @@ -53,7 +53,7 @@ "Sovelluksen tiedot" "Asenna" "Älä ehdota sovellusta" - "Kiinnitä ennakoitu sovellus" + "Kiinnitä sovellus" "asenna pikakuvakkeita" "Antaa sovelluksen lisätä pikakuvakkeita itsenäisesti ilman käyttäjän valintaa." "lue aloitusruudun asetuksia ja pikakuvakkeita" diff --git a/res/values-fr-rCA/strings.xml b/res/values-fr-rCA/strings.xml index 23fd8d849d..aaffbd1a1d 100644 --- a/res/values-fr-rCA/strings.xml +++ b/res/values-fr-rCA/strings.xml @@ -50,10 +50,10 @@ "Accueil" "Supprimer" "Désinstaller" - "Détails de l\'application" + "Détails sur l\'appli" "Installer" "Ne pas suggérer d\'application" - "Prédiction d\'épinglage" + "Épingler la prédiction" "installer des raccourcis" "Permet à une application d\'ajouter des raccourcis sans l\'intervention de l\'utilisateur." "lire les paramètres et les raccourcis de la page d\'accueil" diff --git a/res/values-gu/strings.xml b/res/values-gu/strings.xml index 8f49421bda..01ecf73f02 100644 --- a/res/values-gu/strings.xml +++ b/res/values-gu/strings.xml @@ -50,7 +50,7 @@ "હોમ" "દૂર કરો" "અનઇન્સ્ટોલ કરો" - "ઍપ્લિકેશન માહિતી" + "ઍપની માહિતી" "ઇન્સ્ટૉલ કરો" "ઍપ સૂચવશો નહીં" "પૂર્વાનુમાનને પિન કરો" diff --git a/res/values-hr/strings.xml b/res/values-hr/strings.xml index f24dc06469..dd13ef0caf 100644 --- a/res/values-hr/strings.xml +++ b/res/values-hr/strings.xml @@ -53,7 +53,7 @@ "Info o aplikaciji" "Instaliraj" "Ne predlaži aplikaciju" - "Prikvači predviđenu aplikaciju" + "Prikvači predviđenu apl." "instaliranje prečaca" "Aplikaciji omogućuje dodavanje prečaca bez intervencije korisnika." "čitanje postavki početnog zaslona i prečaca" diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index 60c043fbe8..4f03908836 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -53,7 +53,7 @@ "Alkalmazásinformáció" "Telepítés" "Ne javasoljon alkalmazást" - "Várható kitűzés" + "Várható kitűzése" "parancsikonok telepítése" "Lehetővé teszi egy alkalmazás számára, hogy felhasználói beavatkozás nélkül adjon hozzá parancsikonokat." "Főoldal beállításainak és parancsikonjainak beolvasása" diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml index 9a49be55de..242e808040 100644 --- a/res/values-in/strings.xml +++ b/res/values-in/strings.xml @@ -53,7 +53,7 @@ "Info aplikasi" "Instal" "Jangan sarankan aplikasi" - "Pasang Pin pada Prediksi" + "Pin Prediksi" "memasang pintasan" "Mengizinkan aplikasi menambahkan pintasan tanpa campur tangan pengguna." "membaca setelan dan pintasan layar Utama" diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml index 17af02335d..a2068aa6ac 100644 --- a/res/values-iw/strings.xml +++ b/res/values-iw/strings.xml @@ -52,7 +52,7 @@ "להסרת התקנה" "פרטי אפליקציה" "התקנה" - "לא להציע את האפליקציה" + "בלי להציע את האפליקציה" "הצמדת החיזוי" "התקן קיצורי דרך" "מאפשר לאפליקציה להוסיף קיצורי דרך ללא התערבות המשתמש." @@ -132,7 +132,7 @@ "גודל הווידג\'ט שונה - רוחב %1$s גובה %2$s" "קיצורי דרך" "קיצורי דרך והתראות" - "סגור" + "סגירה" "סגירה" "ההתראה נסגרה" "אישיות" diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 0be3a0ff54..a6e37c4fb4 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -53,7 +53,7 @@ "アプリ情報" "インストール" "アプリの候補を表示しない" - "予測を固定" + "アプリの候補を固定表示" "ショートカットのインストール" "ユーザー操作なしでショートカットを追加することをアプリに許可します。" "ホームの設定とショートカットの読み取り" diff --git a/res/values-ml/strings.xml b/res/values-ml/strings.xml index 0d0a9518d4..01d8935672 100644 --- a/res/values-ml/strings.xml +++ b/res/values-ml/strings.xml @@ -50,10 +50,10 @@ "ഹോം" "നീക്കംചെയ്യുക" "അൺഇൻസ്റ്റാളുചെയ്യുക" - "ആപ്പ് വിവരം" + "ആപ്പ് വിവരങ്ങൾ" "ഇൻസ്‌റ്റാൾ ചെയ്യുക" "ആപ്പ് നിർദ്ദേശിക്കരുത്" - "പിൻ പ്രവചനം" + "പ്രവചനം പിൻ ചെയ്യുക" "കുറുക്കുവഴികൾ ഇൻസ്റ്റാളുചെയ്യുക" "ഉപയോക്തൃ ഇടപെടൽ ഇല്ലാതെ കുറുക്കുവഴികൾ ചേർക്കാൻ അപ്ലിക്കേഷനെ അനുവദിക്കുന്നു." "ഹോം ക്രമീകരണങ്ങളും കുറുക്കുവഴികളും റീഡുചെയ്യുക" diff --git a/res/values-my/strings.xml b/res/values-my/strings.xml index 4e465caf71..d753021886 100644 --- a/res/values-my/strings.xml +++ b/res/values-my/strings.xml @@ -50,7 +50,7 @@ "ပင်မစာမျက်နှာ" "ဖယ်ရှားမည်" "ဖြုတ်ရန်" - "အက်ပ်အချက်အလက်များ" + "အက်ပ်အချက်အလက်" "ထည့်သွင်းရန်" "အက်ပ်ကို အကြံမပြုပါနှင့်" "ခန့်မှန်းချက်ကို ပင်ထိုးရန်" diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml index 5750d26784..47b4635010 100644 --- a/res/values-nb/strings.xml +++ b/res/values-nb/strings.xml @@ -52,7 +52,7 @@ "Avinstaller" "Info om appen" "Installer" - "Ikke foreslå appen" + "Ikke foreslå app" "Fest forslaget" "installere snarveier" "Gir apper tillatelse til å legge til snarveier uten innblanding fra brukeren." diff --git a/res/values-or/strings.xml b/res/values-or/strings.xml index 105c033fc3..c6e2ba1dfe 100644 --- a/res/values-or/strings.xml +++ b/res/values-or/strings.xml @@ -52,7 +52,7 @@ "ଅନଇନଷ୍ଟଲ୍‌ କରନ୍ତୁ" "ଆପ୍‌ ସୂଚନା" "ଇନଷ୍ଟଲ୍‌ କରନ୍ତୁ" - "ଆପ୍ ସୁପାରିଶ କରନ୍ତୁ ନାହିଁ" + "ଆପ୍ ପରାମର୍ଶ ଦିଅନ୍ତୁ ନାହିଁ" "ପୂର୍ବାନୁମାନକୁ ପିନ୍ କରନ୍ତୁ" "ଶର୍ଟକଟ୍‍ ଇନଷ୍ଟଲ୍‌ କରନ୍ତୁ" "ୟୁଜରଙ୍କ ବିନା ହସ୍ତକ୍ଷେପରେ ଶର୍ଟକଟ୍‌ ଯୋଡ଼ିବାକୁ ଆପକୁ ଅନୁମତି ଦିଏ।" diff --git a/res/values-pa/strings.xml b/res/values-pa/strings.xml index 8b90a65394..c1d7dfadb0 100644 --- a/res/values-pa/strings.xml +++ b/res/values-pa/strings.xml @@ -53,7 +53,7 @@ "ਐਪ ਜਾਣਕਾਰੀ" "ਸਥਾਪਤ ਕਰੋ" "ਐਪ ਦਾ ਸੁਝਾਅ ਨਾ ਦਿਓ" - "ਪਿੰਨ ਦਾ ਪੂਰਵ-ਅਨੁਮਾਨ" + "ਪੂਰਵ-ਅਨੁਮਾਨ ਪਿੰਨ ਕਰੋ" "ਸ਼ਾਰਟਕੱਟ ਸਥਾਪਤ ਕਰੋ" "ਇੱਕ ਐਪ ਨੂੰ ਵਰਤੋਂਕਾਰ ਦੇ ਦਖ਼ਲ ਤੋਂ ਬਿਨਾਂ ਸ਼ਾਰਟਕੱਟ ਸ਼ਾਮਲ ਕਰਨ ਦੀ ਆਗਿਆ ਦਿੰਦਾ ਹੈ।" "ਹੋਮ ਸੈਟਿੰਗਾਂ ਅਤੇ ਸ਼ਾਰਟਕੱਟ ਪੜ੍ਹੋ" diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 49dceb06e8..24fe6f99ee 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -53,7 +53,7 @@ "O aplikacji" "Zainstaluj" "Nie proponuj aplikacji" - "Podpowiadanie kodu PIN" + "Przypnij podpowiedź" "instalowanie skrótów" "Pozwala aplikacji dodawać skróty bez interwencji użytkownika." "odczytywanie ustawień i skrótów na ekranie głównym" diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 9d144294e1..4d8ba8860f 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -52,7 +52,7 @@ "Удалить" "О приложении" "Установить" - "Скрыть рекомендацию" + "Не рекомендовать" "Закрепить рекомендацию" "Создание ярлыков" "Приложение сможет самостоятельно добавлять ярлыки." diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml index ab980633d3..e3b7894bf8 100644 --- a/res/values-sk/strings.xml +++ b/res/values-sk/strings.xml @@ -53,7 +53,7 @@ "Info o aplikácii" "Inštalovať" "Nenavrhovať aplikáciu" - "Pripnúť predpovedanú aplikáciu" + "Pripnúť predpoveď" "inštalovať odkazy" "Povoľuje aplikácii pridať odkazy bez zásahu používateľa." "čítanie nastavení a odkazov plochy" diff --git a/res/values-sl/strings.xml b/res/values-sl/strings.xml index 91d76b5ec6..7ec3652069 100644 --- a/res/values-sl/strings.xml +++ b/res/values-sl/strings.xml @@ -52,7 +52,7 @@ "Odmesti" "Podatki o aplikaciji" "Namesti" - "Ne predlagaj aplikacije" + "Ne predlagaj aplikacij" "Predvidevanje pripenjanja" "namestitev bližnjic" "Aplikaciji dovoli dodajanje bližnjic brez posredovanja uporabnika." diff --git a/res/values-sq/strings.xml b/res/values-sq/strings.xml index e3082daf37..c021061f60 100644 --- a/res/values-sq/strings.xml +++ b/res/values-sq/strings.xml @@ -50,10 +50,10 @@ "Faqja kryesore" "Hiqe" "Çinstalo" - "Informacion mbi aplikacionin" + "Info mbi aplikacionin" "Instalo" "Mos sugjero aplikacion" - "Gozhdo aplikacionin e parashikuar" + "Gozhdo parashikimin" "instalo shkurtore" "Lejon një aplikacion të shtojë shkurtore pa ndërhyrjen e përdoruesit." "lexo cilësimet dhe shkurtoret e ekranit bazë" diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml index 758ec6cf6a..a197f9e5d1 100644 --- a/res/values-sr/strings.xml +++ b/res/values-sr/strings.xml @@ -50,7 +50,7 @@ "Почетна" "Уклони" "Деинсталирај" - "Информ. о апликацији" + "Инфор. о апликацији" "Инсталирај" "Не предлажи апликацију" "Закачи предвиђање" diff --git a/res/values-te/strings.xml b/res/values-te/strings.xml index 2d3d446179..9816896fd6 100644 --- a/res/values-te/strings.xml +++ b/res/values-te/strings.xml @@ -53,7 +53,7 @@ "యాప్ సమాచారం" "ఇన్‌స్టాల్ చేయండి" "యాప్‌ను సూచించవద్దు" - "పిన్ సూచన" + "సూచనను పిన్ చేయండి" "షార్ట్‌కట్‌లను ఇన్‌స్టాల్ చేయడం" "వినియోగదారు ప్రమేయం లేకుండా సత్వరమార్గాలను జోడించడానికి అనువర్తనాన్ని అనుమతిస్తుంది." "హోమ్ సెట్టింగ్‌లు మరియు సత్వరమార్గాలను చదవడం" diff --git a/res/values-th/strings.xml b/res/values-th/strings.xml index 15498804ff..6a9a485911 100644 --- a/res/values-th/strings.xml +++ b/res/values-th/strings.xml @@ -52,8 +52,8 @@ "ถอนการติดตั้ง" "ข้อมูลแอป" "ติดตั้ง" - "อย่าแนะนำแอป" - "การคาดการณ์ PIN" + "ไม่ต้องแนะนำแอป" + "ตรึงแอปที่คาดการณ์ไว้" "ติดตั้งทางลัด" "อนุญาตให้แอปเพิ่มทางลัดโดยไม่ต้องให้ผู้ใช้จัดการ" "อ่านการตั้งค่าและทางลัดหน้าแรกแล้ว" diff --git a/res/values-uz/strings.xml b/res/values-uz/strings.xml index 002a75265f..15321244c4 100644 --- a/res/values-uz/strings.xml +++ b/res/values-uz/strings.xml @@ -52,8 +52,8 @@ "O‘chirib tashlash" "Ilova haqida" "O‘rnatish" - "Ilova taklif qilinmasin" - "Ilovalarni mahkamlash taklifi" + "Tavsiya qilinmasin" + "Tavsiyani mahkamlash" "yorliqlar yaratish" "Ilovalarga foydalanuvchidan so‘ramasdan yorliqlar qo‘shishga ruxsat beradi." "Uy sozlamalari va yorliqlarini o‘qish" From 19496b916b9a994fd8466b09e3c8c9f0f290f2f3 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Mon, 20 Jul 2020 14:03:37 -0700 Subject: [PATCH 14/72] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I4c326e8cf15da316393c3be70f6b1c8dfc559a52 --- res/values-az/strings.xml | 2 +- res/values-b+sr+Latn/strings.xml | 2 +- res/values-be/strings.xml | 2 +- res/values-bg/strings.xml | 2 +- res/values-bs/strings.xml | 4 ++-- res/values-de/strings.xml | 2 +- res/values-el/strings.xml | 2 +- res/values-fi/strings.xml | 2 +- res/values-fr-rCA/strings.xml | 4 ++-- res/values-gu/strings.xml | 2 +- res/values-hr/strings.xml | 2 +- res/values-hu/strings.xml | 2 +- res/values-in/strings.xml | 2 +- res/values-iw/strings.xml | 4 ++-- res/values-ja/strings.xml | 2 +- res/values-ml/strings.xml | 4 ++-- res/values-my/strings.xml | 2 +- res/values-nb/strings.xml | 2 +- res/values-or/strings.xml | 2 +- res/values-pa/strings.xml | 2 +- res/values-pl/strings.xml | 2 +- res/values-ru/strings.xml | 2 +- res/values-sk/strings.xml | 2 +- res/values-sl/strings.xml | 2 +- res/values-sq/strings.xml | 4 ++-- res/values-sr/strings.xml | 2 +- res/values-te/strings.xml | 2 +- res/values-th/strings.xml | 4 ++-- res/values-uz/strings.xml | 4 ++-- 29 files changed, 36 insertions(+), 36 deletions(-) diff --git a/res/values-az/strings.xml b/res/values-az/strings.xml index 72d211c44c..aed975ac42 100644 --- a/res/values-az/strings.xml +++ b/res/values-az/strings.xml @@ -52,7 +52,7 @@ "Sistemdən sil" "Tətbiq infosu" "Quraşdırın" - "Tətbiq təklif etməyin" + "Tətbiq təklif olunmasın" "Proqnozlaşdırılan tətbiqi bərkidin" "qısayolları quraşdır" "Tətbiqə istifadəçi müdaxiləsi olmadan qısayolları əlavə etməyə icazə verir." diff --git a/res/values-b+sr+Latn/strings.xml b/res/values-b+sr+Latn/strings.xml index 8f6f8c1cb9..e8123688e1 100644 --- a/res/values-b+sr+Latn/strings.xml +++ b/res/values-b+sr+Latn/strings.xml @@ -50,7 +50,7 @@ "Početna" "Ukloni" "Deinstaliraj" - "Inform. o aplikaciji" + "Infor. o aplikaciji" "Instaliraj" "Ne predlaži aplikaciju" "Zakači predviđanje" diff --git a/res/values-be/strings.xml b/res/values-be/strings.xml index 14bfd8b551..0b2b6f1bc9 100644 --- a/res/values-be/strings.xml +++ b/res/values-be/strings.xml @@ -50,7 +50,7 @@ "Галоўная" "Выдаліць" "Дэінсталяваць" - "Звесткі пра праграмы" + "Пра праграму" "Усталяваць" "Не прапаноўваць праграму" "Замацаваць прапанаваную праграму" diff --git a/res/values-bg/strings.xml b/res/values-bg/strings.xml index 0d06ead6b7..512a7fc069 100644 --- a/res/values-bg/strings.xml +++ b/res/values-bg/strings.xml @@ -50,7 +50,7 @@ "Начало" "Премахване" "Деинсталиране" - "Инфо за прилож." + "Информация за прилож." "Инсталиране" "Без предлагане на приложение" "Фиксиране на предвиждането" diff --git a/res/values-bs/strings.xml b/res/values-bs/strings.xml index bf07ed5ea8..6ce19d8fe6 100644 --- a/res/values-bs/strings.xml +++ b/res/values-bs/strings.xml @@ -50,10 +50,10 @@ "Početna" "Ukloni" "Deinstaliraj" - "Informacije o aplikaciji" + "Inform. o aplikaciji" "Instaliraj" "Ne predlaži aplikaciju" - "Predviđanje PIN-a" + "Zakači predviđanje" "instaliraj prečice" "Dopušta aplikaciji dodavanje prečica bez posredovanja korisnika." "čitaj postavke na početnom ekranu i prečice" diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 520d64a103..fdd92142ac 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -52,7 +52,7 @@ "Deinstallieren" "App-Info" "Installieren" - "App nicht empfehlen" + "App nicht vorschlagen" "Vorgeschlagene App anpinnen" "Verknüpfungen installieren" "Ermöglicht einer App das Hinzufügen von Verknüpfungen ohne Eingreifen des Nutzers" diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml index 2bb266b771..5d72b77410 100644 --- a/res/values-el/strings.xml +++ b/res/values-el/strings.xml @@ -50,7 +50,7 @@ "Αρχική οθόνη" "Κατάργηση" "Απεγκατάσταση" - "Πληροφορίες εφαρμογής" + "Πληροφ. εφαρμογής" "Εγκατάσταση" "Να μην προτείνεται η εφαρμογή" "Καρφίτσωμα πρόβλεψης" diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml index 2dbc9df998..9fea032da6 100644 --- a/res/values-fi/strings.xml +++ b/res/values-fi/strings.xml @@ -53,7 +53,7 @@ "Sovelluksen tiedot" "Asenna" "Älä ehdota sovellusta" - "Kiinnitä ennakoitu sovellus" + "Kiinnitä sovellus" "asenna pikakuvakkeita" "Antaa sovelluksen lisätä pikakuvakkeita itsenäisesti ilman käyttäjän valintaa." "lue aloitusruudun asetuksia ja pikakuvakkeita" diff --git a/res/values-fr-rCA/strings.xml b/res/values-fr-rCA/strings.xml index 23fd8d849d..aaffbd1a1d 100644 --- a/res/values-fr-rCA/strings.xml +++ b/res/values-fr-rCA/strings.xml @@ -50,10 +50,10 @@ "Accueil" "Supprimer" "Désinstaller" - "Détails de l\'application" + "Détails sur l\'appli" "Installer" "Ne pas suggérer d\'application" - "Prédiction d\'épinglage" + "Épingler la prédiction" "installer des raccourcis" "Permet à une application d\'ajouter des raccourcis sans l\'intervention de l\'utilisateur." "lire les paramètres et les raccourcis de la page d\'accueil" diff --git a/res/values-gu/strings.xml b/res/values-gu/strings.xml index 8f49421bda..01ecf73f02 100644 --- a/res/values-gu/strings.xml +++ b/res/values-gu/strings.xml @@ -50,7 +50,7 @@ "હોમ" "દૂર કરો" "અનઇન્સ્ટોલ કરો" - "ઍપ્લિકેશન માહિતી" + "ઍપની માહિતી" "ઇન્સ્ટૉલ કરો" "ઍપ સૂચવશો નહીં" "પૂર્વાનુમાનને પિન કરો" diff --git a/res/values-hr/strings.xml b/res/values-hr/strings.xml index f24dc06469..dd13ef0caf 100644 --- a/res/values-hr/strings.xml +++ b/res/values-hr/strings.xml @@ -53,7 +53,7 @@ "Info o aplikaciji" "Instaliraj" "Ne predlaži aplikaciju" - "Prikvači predviđenu aplikaciju" + "Prikvači predviđenu apl." "instaliranje prečaca" "Aplikaciji omogućuje dodavanje prečaca bez intervencije korisnika." "čitanje postavki početnog zaslona i prečaca" diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index 60c043fbe8..4f03908836 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -53,7 +53,7 @@ "Alkalmazásinformáció" "Telepítés" "Ne javasoljon alkalmazást" - "Várható kitűzés" + "Várható kitűzése" "parancsikonok telepítése" "Lehetővé teszi egy alkalmazás számára, hogy felhasználói beavatkozás nélkül adjon hozzá parancsikonokat." "Főoldal beállításainak és parancsikonjainak beolvasása" diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml index 9a49be55de..242e808040 100644 --- a/res/values-in/strings.xml +++ b/res/values-in/strings.xml @@ -53,7 +53,7 @@ "Info aplikasi" "Instal" "Jangan sarankan aplikasi" - "Pasang Pin pada Prediksi" + "Pin Prediksi" "memasang pintasan" "Mengizinkan aplikasi menambahkan pintasan tanpa campur tangan pengguna." "membaca setelan dan pintasan layar Utama" diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml index 17af02335d..a2068aa6ac 100644 --- a/res/values-iw/strings.xml +++ b/res/values-iw/strings.xml @@ -52,7 +52,7 @@ "להסרת התקנה" "פרטי אפליקציה" "התקנה" - "לא להציע את האפליקציה" + "בלי להציע את האפליקציה" "הצמדת החיזוי" "התקן קיצורי דרך" "מאפשר לאפליקציה להוסיף קיצורי דרך ללא התערבות המשתמש." @@ -132,7 +132,7 @@ "גודל הווידג\'ט שונה - רוחב %1$s גובה %2$s" "קיצורי דרך" "קיצורי דרך והתראות" - "סגור" + "סגירה" "סגירה" "ההתראה נסגרה" "אישיות" diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 0be3a0ff54..a6e37c4fb4 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -53,7 +53,7 @@ "アプリ情報" "インストール" "アプリの候補を表示しない" - "予測を固定" + "アプリの候補を固定表示" "ショートカットのインストール" "ユーザー操作なしでショートカットを追加することをアプリに許可します。" "ホームの設定とショートカットの読み取り" diff --git a/res/values-ml/strings.xml b/res/values-ml/strings.xml index 0d0a9518d4..01d8935672 100644 --- a/res/values-ml/strings.xml +++ b/res/values-ml/strings.xml @@ -50,10 +50,10 @@ "ഹോം" "നീക്കംചെയ്യുക" "അൺഇൻസ്റ്റാളുചെയ്യുക" - "ആപ്പ് വിവരം" + "ആപ്പ് വിവരങ്ങൾ" "ഇൻസ്‌റ്റാൾ ചെയ്യുക" "ആപ്പ് നിർദ്ദേശിക്കരുത്" - "പിൻ പ്രവചനം" + "പ്രവചനം പിൻ ചെയ്യുക" "കുറുക്കുവഴികൾ ഇൻസ്റ്റാളുചെയ്യുക" "ഉപയോക്തൃ ഇടപെടൽ ഇല്ലാതെ കുറുക്കുവഴികൾ ചേർക്കാൻ അപ്ലിക്കേഷനെ അനുവദിക്കുന്നു." "ഹോം ക്രമീകരണങ്ങളും കുറുക്കുവഴികളും റീഡുചെയ്യുക" diff --git a/res/values-my/strings.xml b/res/values-my/strings.xml index 4e465caf71..d753021886 100644 --- a/res/values-my/strings.xml +++ b/res/values-my/strings.xml @@ -50,7 +50,7 @@ "ပင်မစာမျက်နှာ" "ဖယ်ရှားမည်" "ဖြုတ်ရန်" - "အက်ပ်အချက်အလက်များ" + "အက်ပ်အချက်အလက်" "ထည့်သွင်းရန်" "အက်ပ်ကို အကြံမပြုပါနှင့်" "ခန့်မှန်းချက်ကို ပင်ထိုးရန်" diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml index 5750d26784..47b4635010 100644 --- a/res/values-nb/strings.xml +++ b/res/values-nb/strings.xml @@ -52,7 +52,7 @@ "Avinstaller" "Info om appen" "Installer" - "Ikke foreslå appen" + "Ikke foreslå app" "Fest forslaget" "installere snarveier" "Gir apper tillatelse til å legge til snarveier uten innblanding fra brukeren." diff --git a/res/values-or/strings.xml b/res/values-or/strings.xml index 105c033fc3..c6e2ba1dfe 100644 --- a/res/values-or/strings.xml +++ b/res/values-or/strings.xml @@ -52,7 +52,7 @@ "ଅନଇନଷ୍ଟଲ୍‌ କରନ୍ତୁ" "ଆପ୍‌ ସୂଚନା" "ଇନଷ୍ଟଲ୍‌ କରନ୍ତୁ" - "ଆପ୍ ସୁପାରିଶ କରନ୍ତୁ ନାହିଁ" + "ଆପ୍ ପରାମର୍ଶ ଦିଅନ୍ତୁ ନାହିଁ" "ପୂର୍ବାନୁମାନକୁ ପିନ୍ କରନ୍ତୁ" "ଶର୍ଟକଟ୍‍ ଇନଷ୍ଟଲ୍‌ କରନ୍ତୁ" "ୟୁଜରଙ୍କ ବିନା ହସ୍ତକ୍ଷେପରେ ଶର୍ଟକଟ୍‌ ଯୋଡ଼ିବାକୁ ଆପକୁ ଅନୁମତି ଦିଏ।" diff --git a/res/values-pa/strings.xml b/res/values-pa/strings.xml index 8b90a65394..c1d7dfadb0 100644 --- a/res/values-pa/strings.xml +++ b/res/values-pa/strings.xml @@ -53,7 +53,7 @@ "ਐਪ ਜਾਣਕਾਰੀ" "ਸਥਾਪਤ ਕਰੋ" "ਐਪ ਦਾ ਸੁਝਾਅ ਨਾ ਦਿਓ" - "ਪਿੰਨ ਦਾ ਪੂਰਵ-ਅਨੁਮਾਨ" + "ਪੂਰਵ-ਅਨੁਮਾਨ ਪਿੰਨ ਕਰੋ" "ਸ਼ਾਰਟਕੱਟ ਸਥਾਪਤ ਕਰੋ" "ਇੱਕ ਐਪ ਨੂੰ ਵਰਤੋਂਕਾਰ ਦੇ ਦਖ਼ਲ ਤੋਂ ਬਿਨਾਂ ਸ਼ਾਰਟਕੱਟ ਸ਼ਾਮਲ ਕਰਨ ਦੀ ਆਗਿਆ ਦਿੰਦਾ ਹੈ।" "ਹੋਮ ਸੈਟਿੰਗਾਂ ਅਤੇ ਸ਼ਾਰਟਕੱਟ ਪੜ੍ਹੋ" diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 49dceb06e8..24fe6f99ee 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -53,7 +53,7 @@ "O aplikacji" "Zainstaluj" "Nie proponuj aplikacji" - "Podpowiadanie kodu PIN" + "Przypnij podpowiedź" "instalowanie skrótów" "Pozwala aplikacji dodawać skróty bez interwencji użytkownika." "odczytywanie ustawień i skrótów na ekranie głównym" diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 9d144294e1..4d8ba8860f 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -52,7 +52,7 @@ "Удалить" "О приложении" "Установить" - "Скрыть рекомендацию" + "Не рекомендовать" "Закрепить рекомендацию" "Создание ярлыков" "Приложение сможет самостоятельно добавлять ярлыки." diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml index ab980633d3..e3b7894bf8 100644 --- a/res/values-sk/strings.xml +++ b/res/values-sk/strings.xml @@ -53,7 +53,7 @@ "Info o aplikácii" "Inštalovať" "Nenavrhovať aplikáciu" - "Pripnúť predpovedanú aplikáciu" + "Pripnúť predpoveď" "inštalovať odkazy" "Povoľuje aplikácii pridať odkazy bez zásahu používateľa." "čítanie nastavení a odkazov plochy" diff --git a/res/values-sl/strings.xml b/res/values-sl/strings.xml index 91d76b5ec6..7ec3652069 100644 --- a/res/values-sl/strings.xml +++ b/res/values-sl/strings.xml @@ -52,7 +52,7 @@ "Odmesti" "Podatki o aplikaciji" "Namesti" - "Ne predlagaj aplikacije" + "Ne predlagaj aplikacij" "Predvidevanje pripenjanja" "namestitev bližnjic" "Aplikaciji dovoli dodajanje bližnjic brez posredovanja uporabnika." diff --git a/res/values-sq/strings.xml b/res/values-sq/strings.xml index e3082daf37..c021061f60 100644 --- a/res/values-sq/strings.xml +++ b/res/values-sq/strings.xml @@ -50,10 +50,10 @@ "Faqja kryesore" "Hiqe" "Çinstalo" - "Informacion mbi aplikacionin" + "Info mbi aplikacionin" "Instalo" "Mos sugjero aplikacion" - "Gozhdo aplikacionin e parashikuar" + "Gozhdo parashikimin" "instalo shkurtore" "Lejon një aplikacion të shtojë shkurtore pa ndërhyrjen e përdoruesit." "lexo cilësimet dhe shkurtoret e ekranit bazë" diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml index 758ec6cf6a..a197f9e5d1 100644 --- a/res/values-sr/strings.xml +++ b/res/values-sr/strings.xml @@ -50,7 +50,7 @@ "Почетна" "Уклони" "Деинсталирај" - "Информ. о апликацији" + "Инфор. о апликацији" "Инсталирај" "Не предлажи апликацију" "Закачи предвиђање" diff --git a/res/values-te/strings.xml b/res/values-te/strings.xml index 2d3d446179..9816896fd6 100644 --- a/res/values-te/strings.xml +++ b/res/values-te/strings.xml @@ -53,7 +53,7 @@ "యాప్ సమాచారం" "ఇన్‌స్టాల్ చేయండి" "యాప్‌ను సూచించవద్దు" - "పిన్ సూచన" + "సూచనను పిన్ చేయండి" "షార్ట్‌కట్‌లను ఇన్‌స్టాల్ చేయడం" "వినియోగదారు ప్రమేయం లేకుండా సత్వరమార్గాలను జోడించడానికి అనువర్తనాన్ని అనుమతిస్తుంది." "హోమ్ సెట్టింగ్‌లు మరియు సత్వరమార్గాలను చదవడం" diff --git a/res/values-th/strings.xml b/res/values-th/strings.xml index 15498804ff..6a9a485911 100644 --- a/res/values-th/strings.xml +++ b/res/values-th/strings.xml @@ -52,8 +52,8 @@ "ถอนการติดตั้ง" "ข้อมูลแอป" "ติดตั้ง" - "อย่าแนะนำแอป" - "การคาดการณ์ PIN" + "ไม่ต้องแนะนำแอป" + "ตรึงแอปที่คาดการณ์ไว้" "ติดตั้งทางลัด" "อนุญาตให้แอปเพิ่มทางลัดโดยไม่ต้องให้ผู้ใช้จัดการ" "อ่านการตั้งค่าและทางลัดหน้าแรกแล้ว" diff --git a/res/values-uz/strings.xml b/res/values-uz/strings.xml index 002a75265f..15321244c4 100644 --- a/res/values-uz/strings.xml +++ b/res/values-uz/strings.xml @@ -52,8 +52,8 @@ "O‘chirib tashlash" "Ilova haqida" "O‘rnatish" - "Ilova taklif qilinmasin" - "Ilovalarni mahkamlash taklifi" + "Tavsiya qilinmasin" + "Tavsiyani mahkamlash" "yorliqlar yaratish" "Ilovalarga foydalanuvchidan so‘ramasdan yorliqlar qo‘shishga ruxsat beradi." "Uy sozlamalari va yorliqlarini o‘qish" From bd1f4c6a76b42246b7edc4d1cc9de733cf1d3eff Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Mon, 20 Jul 2020 13:05:13 -0700 Subject: [PATCH 15/72] Allow multiple hotseat restorations in single session restoreBackup uses mBackupRestored to prevent multiple restorations happening at once. This change is required to reset the value of mBackupRestored if a new backup is created. Bug: 160033826 Test: Manual Change-Id: I33836b26cf3876955cc14dcc8ec06202f3fe7fac --- .../android/launcher3/hybridhotseat/HotseatRestoreHelper.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java index 8c1db4e2e7..9e7c9fba6d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java @@ -30,7 +30,6 @@ import com.android.launcher3.provider.LauncherDbUtils; */ public class HotseatRestoreHelper { private final Launcher mLauncher; - private boolean mBackupRestored = false; HotseatRestoreHelper(Launcher context) { mLauncher = context; @@ -62,7 +61,6 @@ public class HotseatRestoreHelper { * Finds and restores a previously saved snapshow of Favorites table */ public void restoreBackup() { - if (mBackupRestored) return; MODEL_EXECUTOR.execute(() -> { try (LauncherDbUtils.SQLiteTransaction transaction = (LauncherDbUtils.SQLiteTransaction) LauncherSettings.Settings.call( @@ -78,7 +76,6 @@ public class HotseatRestoreHelper { idp.numRows); backupTable.restoreFromCustomBackupTable(HYBRID_HOTSEAT_BACKUP_TABLE, true); transaction.commit(); - mBackupRestored = true; mLauncher.getModel().forceReload(); } }); From 5b7bf9147b7cf99116f4ed28dd367444b4876d26 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 20 Jul 2020 13:57:56 -0700 Subject: [PATCH 16/72] Create a new instance of rotation touch helper per device state Change-Id: I4e4288eaf37aab5bf0b8115f5e06e64459c20f00 (cherry picked from commit 00850fb588bf7b33b49d4771883039d5fd70be81) --- .../com/android/quickstep/RecentsAnimationDeviceState.java | 2 +- quickstep/src/com/android/quickstep/RotationTouchHelper.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index dd80bd758e..7a6bbb4ab9 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -114,7 +114,7 @@ public class RecentsAnimationDeviceState implements mDefaultDisplay = DefaultDisplay.INSTANCE.get(context); mDisplayId = mDefaultDisplay.getInfo().id; runOnDestroy(() -> mDefaultDisplay.removeChangeListener(this)); - mRotationTouchHelper = RotationTouchHelper.INSTANCE.get(context); + mRotationTouchHelper = new RotationTouchHelper(context); runOnDestroy(mRotationTouchHelper::destroy); // Register for user unlocked if necessary diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index d89ca10b69..5f3c02205e 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -41,8 +41,6 @@ import java.util.ArrayList; public class RotationTouchHelper implements SysUINavigationMode.NavigationModeChangeListener, DefaultDisplay.DisplayInfoChangeListener { - public static final MainThreadInitializedObject INSTANCE = - new MainThreadInitializedObject<>(RotationTouchHelper::new); private final OrientationTouchTransformer mOrientationTouchTransformer; private final DefaultDisplay mDefaultDisplay; @@ -122,7 +120,7 @@ public class RotationTouchHelper implements private final Context mContext; - private RotationTouchHelper(Context context) { + public RotationTouchHelper(Context context) { mContext = context; Resources resources = mContext.getResources(); mSysUiNavMode = SysUINavigationMode.INSTANCE.get(context); From 0f620500b06342d496fa69d9f1677f4b883ddf40 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 20 Jul 2020 15:28:25 -0700 Subject: [PATCH 17/72] Fix bug where realtimeReorder is called after views have been unbound. Bug: 161498651 Change-Id: I89beaad9a91bfa1763454965bf95ba1a94d29902 --- src/com/android/launcher3/folder/FolderPagedView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java index 32531c040f..a08dd3064a 100644 --- a/src/com/android/launcher3/folder/FolderPagedView.java +++ b/src/com/android/launcher3/folder/FolderPagedView.java @@ -500,6 +500,9 @@ public class FolderPagedView extends PagedView { * Reorders the items such that the {@param empty} spot moves to {@param target} */ public void realTimeReorder(int empty, int target) { + if (!mViewsBound) { + return; + } completePendingPageChanges(); int delay = 0; float delayAmount = START_VIEW_REORDER_DELAY; From 447ea429cd9f48a608c11dbef7dec1d2ab22d1ef Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 20 Jul 2020 16:54:17 -0700 Subject: [PATCH 18/72] Fix folder crash where view is added when it already has a parent. The fix is to prevent re-arrangement if the views are already unbound. This is caused when: - Folder is open - Item has deep shortcuts - Long press on deep shortcut to create DragView that could land in the folder if the folder did not auto close. This is important because it starts a drag within the folder The folder unbinds all views as part of the Folder close complete callback. And then the folder exit alarm gets triggered (because we drag DragView outside of the folder) which causes the folder items to get rearranged and added back to the folder's CellLayout. Bug: 161559911 Change-Id: I142589b2c541dc21c47a67c20a93e627732107ef --- src/com/android/launcher3/folder/Folder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index de2b5da6ad..b91d1c3260 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -1135,6 +1135,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo * Rearranges the children based on their rank. */ public void rearrangeChildren() { + if (!mContent.areViewsBound()) { + return; + } mContent.arrangeChildren(getIconsInReadingOrder()); mItemsInvalidated = true; } From f1af0171b7c6b8f82179f2bfffda33f82ee16399 Mon Sep 17 00:00:00 2001 From: Pinyao Ting Date: Mon, 20 Jul 2020 11:54:38 -0700 Subject: [PATCH 19/72] Fix launcher crash after restore with some specific widgets. The internal implementation of PendingAppWidgetHostView#getDefaultViews uses the same view across updates which causes the exception in AppWidgetHostView#applyContent when it tries to call addView() because the view has already been added to its parent view in previous iteration. Bug: 151901506 Test: manual Change-Id: Ieccec814ac514e592d0d4f196b60ba89aec0d661 --- .../launcher3/widget/PendingAppWidgetHostView.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java index 9021d9eb21..ca47728020 100644 --- a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java +++ b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java @@ -52,7 +52,6 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView private static final float MIN_SATUNATION = 0.7f; private final Rect mRect = new Rect(); - private View mDefaultView; private OnClickListener mClickListener; private final LauncherAppWidgetInfo mInfo; private final int mStartState; @@ -111,12 +110,11 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView @Override protected View getDefaultView() { - if (mDefaultView == null) { - mDefaultView = mInflater.inflate(R.layout.appwidget_not_ready, this, false); - mDefaultView.setOnClickListener(this); - applyState(); - } - return mDefaultView; + View defaultView = mInflater.inflate(R.layout.appwidget_not_ready, this, false); + defaultView.setOnClickListener(this); + applyState(); + invalidate(); + return defaultView; } @Override From 354b8fc0810ae7c965183d3fc31cdc3965da1ac9 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Fri, 10 Jul 2020 21:07:55 +0800 Subject: [PATCH 20/72] Use display of activity to get rotation for recents The rotation of WindowConfiguration in Configuration is non-public field. There is no guarantee that the information will be updated. E.g. a 180 degree rotation change won't make difference to the public configurations, so the Resources will keep the old one. The display rotation of activity is accurate to use for its content because even the activity is transformed to different rotation than the physical display, there is FixedRotationAdjustments to adjust the information which will be consistent as how the activity is laid out. Bug: 159877752 Test: 1. Enable auto rotation. 2. Launch some portrait activities. 3. Put device in reverse portrait (upside down). 4. Launch a landscape activity. 5. Swipe to another activity with full-sensor orientation. 6. Return to home and enter recents to check the task views of step 2 don't show upside down. Change-Id: I5e16e71d43b8892a394c06de9e76fb3d4ad55919 --- .../android/quickstep/BaseSwipeUpHandlerV2.java | 2 +- .../quickstep/util/TaskViewSimulator.java | 4 ++-- .../com/android/quickstep/views/RecentsView.java | 4 ++-- .../quickstep/views/TaskThumbnailView.java | 5 ++--- .../quickstep/util/RecentsOrientedState.java | 16 +++++----------- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java index e084de1acb..80c145a959 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java @@ -333,7 +333,7 @@ public abstract class BaseSwipeUpHandlerV2, Q exte if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) { return; } - mTaskViewSimulator.setRecentsConfiguration(mActivity.getResources().getConfiguration()); + mTaskViewSimulator.setRecentsRotation(mActivity.getDisplay().getRotation()); // If we've already ended the gesture and are going home, don't prepare recents UI, // as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL. diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java index c9ed498af1..8a6efe4715 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java @@ -129,8 +129,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { /** * @see com.android.quickstep.views.RecentsView#onConfigurationChanged(Configuration) */ - public void setRecentsConfiguration(Configuration configuration) { - mOrientationState.setActivityConfiguration(configuration); + public void setRecentsRotation(int recentsRotation) { + mOrientationState.setRecentsRotation(recentsRotation); mLayoutValid = false; } 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 027a737cef..49c83e45fc 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 @@ -393,7 +393,7 @@ public abstract class RecentsView extends PagedView mActivity = BaseActivity.fromContext(context); mOrientationState = new RecentsOrientedState( context, mSizeStrategy, this::animateRecentsRotationInPlace); - mOrientationState.setActivityConfiguration(context.getResources().getConfiguration()); + mOrientationState.setRecentsRotation(mActivity.getDisplay().getRotation()); mFastFlingVelocity = getResources() .getDimensionPixelSize(R.dimen.recents_fast_fling_velocity); @@ -1657,7 +1657,7 @@ public abstract class RecentsView extends PagedView @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - if (mOrientationState.setActivityConfiguration(newConfig)) { + if (mOrientationState.setRecentsRotation(mActivity.getDisplay().getRotation())) { updateOrientationHandler(); } } 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 37f6faf523..a8d6442135 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 @@ -59,7 +59,6 @@ import com.android.systemui.plugins.OverviewScreenshotActions; import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; -import com.android.systemui.shared.system.ConfigurationCompat; /** * A task in the Recents view. @@ -385,8 +384,8 @@ public class TaskThumbnailView extends View implements PluginListener Date: Tue, 26 Nov 2019 14:00:14 +0800 Subject: [PATCH 21/72] Enable one-handed mode gestural in QuickStep Handling swipe-down/swipe-up gestural in device bottom area for one-handed mode 1) The regsion is larger than gesture navigationbar view 2) One handed gestural in quickstep only active on NO_BUTTON, TWO_BUTTONS mode 3) One handed gestural only support on portrait mode Bug: 150747547 Bug: 154189137 Bug: 156988988 Test: make and install Test: manual enable one handed mode and swipe down to trigger Test: manual start one handed and rotate device Change-Id: I7b2447bfb2fe4082c95176b62934b98077b84920 (cherry picked from commit 7d375e31fe5d221750f9128c20121e34c1ab142f) --- .../quickstep/TouchInteractionService.java | 16 ++ .../OneHandedModeInputConsumer.java | 143 ++++++++++++++++++ quickstep/res/values/dimens.xml | 4 + .../com/android/quickstep/InputConsumer.java | 4 +- .../OrientationTouchTransformer.java | 13 +- .../RecentsAnimationDeviceState.java | 43 ++++++ .../quickstep/RotationTouchHelper.java | 4 + .../com/android/quickstep/SystemUiProxy.java | 24 ++- .../util/SecureSettingsObserver.java | 8 + 9 files changed, 254 insertions(+), 5 deletions(-) create mode 100644 quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 8837c0ec75..574cd3402b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -74,6 +74,7 @@ import com.android.launcher3.util.WindowBounds; import com.android.quickstep.inputconsumers.AccessibilityInputConsumer; import com.android.quickstep.inputconsumers.AssistantInputConsumer; import com.android.quickstep.inputconsumers.DeviceLockedInputConsumer; +import com.android.quickstep.inputconsumers.OneHandedModeInputConsumer; import com.android.quickstep.inputconsumers.OtherActivityInputConsumer; import com.android.quickstep.inputconsumers.OverscrollInputConsumer; import com.android.quickstep.inputconsumers.OverviewInputConsumer; @@ -500,6 +501,11 @@ public class TouchInteractionService extends Service implements PluginListener mSquaredSlop) { + mStartDragPos.set(mLastPos.x, mLastPos.y); + if ((!mDeviceState.isOneHandedModeActive() && isValidStartAngle( + mDownPos.x - mLastPos.x, mDownPos.y - mLastPos.y)) + || (mDeviceState.isOneHandedModeActive() && isValidExitAngle( + mDownPos.x - mLastPos.x, mDownPos.y - mLastPos.y))) { + mPassedSlop = true; + setActive(ev); + } else { + mState = STATE_DELEGATE_ACTIVE; + } + } + } else { + float distance = (float) Math.hypot(mLastPos.x - mStartDragPos.x, + mLastPos.y - mStartDragPos.y); + if (distance > mDragDistThreshold && mPassedSlop + && mDeviceState.isOneHandedModeActive()) { + SystemUiProxy.INSTANCE.get(mContext).stopOneHandedMode(); + } + } + break; + } + case ACTION_UP: + case ACTION_CANCEL: { + if (mLastPos.y >= mStartDragPos.y && mPassedSlop + && !mDeviceState.isOneHandedModeActive()) { + SystemUiProxy.INSTANCE.get(mContext).startOneHandedMode(); + } + + mPassedSlop = false; + mState = STATE_INACTIVE; + break; + } + } + + if (mState != STATE_ACTIVE) { + mDelegate.onMotionEvent(ev); + } + } + + private boolean isValidStartAngle(float deltaX, float deltaY) { + final float angle = (float) Math.toDegrees(Math.atan2(deltaY, deltaX)); + return angle > -(ANGLE_MAX) && angle < -(ANGLE_MIN); + } + + private boolean isValidExitAngle(float deltaX, float deltaY) { + final float angle = (float) Math.toDegrees(Math.atan2(deltaY, deltaX)); + return angle > ANGLE_MIN && angle < ANGLE_MAX; + } +} diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 9d703167d9..6737c5f61d 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -76,6 +76,10 @@ 55dp 55dp + + + 20dp + 28dp diff --git a/quickstep/src/com/android/quickstep/InputConsumer.java b/quickstep/src/com/android/quickstep/InputConsumer.java index ec720d5d5e..67711c0810 100644 --- a/quickstep/src/com/android/quickstep/InputConsumer.java +++ b/quickstep/src/com/android/quickstep/InputConsumer.java @@ -35,6 +35,7 @@ public interface InputConsumer { int TYPE_RESET_GESTURE = 1 << 8; int TYPE_OVERSCROLL = 1 << 9; int TYPE_SYSUI_OVERLAY = 1 << 10; + int TYPE_ONE_HANDED = 1 << 11; String[] NAMES = new String[] { "TYPE_NO_OP", // 0 @@ -47,7 +48,8 @@ public interface InputConsumer { "TYPE_OVERVIEW_WITHOUT_FOCUS", // 7 "TYPE_RESET_GESTURE", // 8 "TYPE_OVERSCROLL", // 9 - "TYPE_SYSUI_OVERLAY" // 10 + "TYPE_SYSUI_OVERLAY", // 10 + "TYPE_ONE_HANDED", // 11 }; InputConsumer NO_OP = () -> TYPE_NO_OP; diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java index 1081548b0d..03d44e8c81 100644 --- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java +++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java @@ -63,6 +63,7 @@ class OrientationTouchTransformer { private SparseArray mSwipeTouchRegions = new SparseArray<>(MAX_ORIENTATIONS); private final RectF mAssistantLeftRegion = new RectF(); private final RectF mAssistantRightRegion = new RectF(); + private final RectF mOneHandedModeRegion = new RectF(); private int mCurrentDisplayRotation; private boolean mEnableMultipleRegions; private Resources mResources; @@ -216,10 +217,10 @@ class OrientationTouchTransformer { Point size = display.realSize; int rotation = display.rotation; + int touchHeight = getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE); OrientationRectF orientationRectF = new OrientationRectF(0, 0, size.x, size.y, rotation); if (mMode == SysUINavigationMode.Mode.NO_BUTTON) { - int touchHeight = getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE); orientationRectF.top = orientationRectF.bottom - touchHeight; updateAssistantRegions(orientationRectF); } else { @@ -235,10 +236,11 @@ class OrientationTouchTransformer { + getNavbarSize(ResourceUtils.NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE); break; default: - orientationRectF.top = orientationRectF.bottom - - getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE); + orientationRectF.top = orientationRectF.bottom - touchHeight; } } + // One handed gestural only active on portrait mode + mOneHandedModeRegion.set(0, orientationRectF.bottom - touchHeight, size.x, size.y); return orientationRectF; } @@ -264,6 +266,10 @@ class OrientationTouchTransformer { } + boolean touchInOneHandedModeRegion(MotionEvent ev) { + return mOneHandedModeRegion.contains(ev.getX(), ev.getY()); + } + private int getNavbarSize(String resName) { return ResourceUtils.getNavbarSize(resName, mResources); } @@ -355,6 +361,7 @@ class OrientationTouchTransformer { regions.append(rectF.mRotation).append(" "); } pw.println(regions.toString()); + pw.println(" mOneHandedModeRegion=" + mOneHandedModeRegion); } private class OrientationRectF extends RectF { diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index 7a6bbb4ab9..87522b852e 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -29,6 +29,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_G import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; @@ -43,10 +44,13 @@ import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Region; import android.os.Process; +import android.os.SystemProperties; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; +import android.util.DisplayMetrics; import android.view.MotionEvent; +import android.view.Surface; import androidx.annotation.BinderThread; @@ -73,6 +77,8 @@ public class RecentsAnimationDeviceState implements NavigationModeChangeListener, DefaultDisplay.DisplayInfoChangeListener { + private static boolean sIsOneHandedEnabled; + private final Context mContext; private final SysUINavigationMode mSysUiNavMode; private final DefaultDisplay mDefaultDisplay; @@ -84,6 +90,7 @@ public class RecentsAnimationDeviceState implements private @SystemUiStateFlags int mSystemUiStateFlags; private SysUINavigationMode.Mode mMode = THREE_BUTTONS; private NavBarPosition mNavBarPosition; + private SecureSettingsObserver mOneHandedEnabledObserver; private final Region mDeferredGestureRegion = new Region(); private boolean mAssistantAvailable; @@ -157,6 +164,13 @@ public class RecentsAnimationDeviceState implements } } + if (SystemProperties.getBoolean("ro.support_one_handed_mode", false)) { + mOneHandedEnabledObserver = SecureSettingsObserver.newOneHandedSettingsObserver( + mContext, this::onOneHandedEnabledSettingsChanged); + mOneHandedEnabledObserver.register(); + mOneHandedEnabledObserver.dispatchOnChange(); + } + SecureSettingsObserver userSetupObserver = new SecureSettingsObserver( context.getContentResolver(), e -> mIsUserSetupComplete = e, @@ -405,6 +419,13 @@ public class RecentsAnimationDeviceState implements return (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0; } + /** + * @return whether screen pinning is enabled and active + */ + public boolean isOneHandedModeActive() { + return (mSystemUiStateFlags & SYSUI_STATE_ONE_HANDED_ACTIVE) != 0; + } + /** * Sets the region in screen space where the gestures should be deferred (ie. due to specific * nav bar ui). @@ -467,6 +488,28 @@ public class RecentsAnimationDeviceState implements && !isGestureBlockedActivity(task); } + /** + * One handed gestural in quickstep only active on NO_BUTTON, TWO_BUTTONS, and portrait mode + * + * @param ev The touch screen motion event. + * @return whether the given motion event can trigger the one handed mode. + */ + public boolean canTriggerOneHandedAction(MotionEvent ev) { + if (!sIsOneHandedEnabled) { + return false; + } + + final DefaultDisplay.Info displayInfo = mDefaultDisplay.getInfo(); + return (mRotationTouchHelper.touchInOneHandedModeRegion(ev) + && displayInfo.rotation != Surface.ROTATION_90 + && displayInfo.rotation != Surface.ROTATION_270 + && displayInfo.metrics.densityDpi < DisplayMetrics.DENSITY_600); + } + + private void onOneHandedEnabledSettingsChanged(boolean isOneHandedEnabled) { + sIsOneHandedEnabled = isOneHandedEnabled; + } + public RotationTouchHelper getRotationTouchHelper() { return mRotationTouchHelper; } diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index 5f3c02205e..88a85bb118 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -188,6 +188,10 @@ public class RotationTouchHelper implements return mOrientationTouchTransformer.touchInAssistantRegion(ev); } + public boolean touchInOneHandedModeRegion(MotionEvent ev) { + return mOrientationTouchTransformer.touchInOneHandedModeRegion(ev); + } + /** * Updates the regions for detecting the swipe up/quickswitch and assistant gestures. */ diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 299e9e5af1..72510a999a 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -352,10 +352,32 @@ public class SystemUiProxy implements ISystemUiProxy { if (mSystemUiProxy != null) { try { mSystemUiProxy.handleImageBundleAsScreenshot(screenImageBundle, locationInScreen, - visibleInsets, task); + visibleInsets, task); } catch (RemoteException e) { Log.w(TAG, "Failed call handleImageBundleAsScreenshot"); } } } + + @Override + public void startOneHandedMode() { + if (mSystemUiProxy != null) { + try { + mSystemUiProxy.startOneHandedMode(); + } catch (RemoteException e) { + Log.w(TAG, "Failed call startOneHandedMode", e); + } + } + } + + @Override + public void stopOneHandedMode() { + if (mSystemUiProxy != null) { + try { + mSystemUiProxy.stopOneHandedMode(); + } catch (RemoteException e) { + Log.w(TAG, "Failed call stopOneHandedMode", e); + } + } + } } diff --git a/src/com/android/launcher3/util/SecureSettingsObserver.java b/src/com/android/launcher3/util/SecureSettingsObserver.java index 48aa02b799..08a8e6d255 100644 --- a/src/com/android/launcher3/util/SecureSettingsObserver.java +++ b/src/com/android/launcher3/util/SecureSettingsObserver.java @@ -29,6 +29,8 @@ public class SecureSettingsObserver extends ContentObserver { /** Hidden field Settings.Secure.NOTIFICATION_BADGING */ public static final String NOTIFICATION_BADGING = "notification_badging"; + /** Hidden field Settings.Secure.ONE_HANDED_MODE_ENABLED */ + public static final String ONE_HANDED_ENABLED = "one_handed_mode_enabled"; private final ContentResolver mResolver; private final String mKeySetting; @@ -79,4 +81,10 @@ public class SecureSettingsObserver extends ContentObserver { return new SecureSettingsObserver( context.getContentResolver(), listener, NOTIFICATION_BADGING, 1); } + + public static SecureSettingsObserver newOneHandedSettingsObserver(Context context, + OnChangeListener listener) { + return new SecureSettingsObserver( + context.getContentResolver(), listener, ONE_HANDED_ENABLED, 1); + } } From 1c1f5d9aef0bd5e55460547d2da21dba3a5985d4 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sat, 18 Jul 2020 23:37:47 +0000 Subject: [PATCH 22/72] Hook one-handed gesture to expand notification panel by default Notify to expand notification panel through SystemUiProxy when one-handed mode disabled and one-handed gesture detected. Bug: 154080211 Test: make and install Test: manual disable one handed mode and swipe down to trigger Test: verified the gesture works even outside of home page Change-Id: Iacc0e506ccd04dd81f6182759c8af7d686a7b77b (cherry picked from commit dd3eb7d075021df869b009d5a78666d7d225aaf1) --- .../OneHandedModeInputConsumer.java | 32 +++++++++++++++---- .../RecentsAnimationDeviceState.java | 13 ++++---- .../com/android/quickstep/SystemUiProxy.java | 11 +++++++ 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java index fced849a4d..46249d9fc5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java @@ -106,18 +106,16 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { } else { float distance = (float) Math.hypot(mLastPos.x - mStartDragPos.x, mLastPos.y - mStartDragPos.y); - if (distance > mDragDistThreshold && mPassedSlop - && mDeviceState.isOneHandedModeActive()) { - SystemUiProxy.INSTANCE.get(mContext).stopOneHandedMode(); + if (distance > mDragDistThreshold && mPassedSlop) { + onStopGestureDetected(); } } break; } case ACTION_UP: case ACTION_CANCEL: { - if (mLastPos.y >= mStartDragPos.y && mPassedSlop - && !mDeviceState.isOneHandedModeActive()) { - SystemUiProxy.INSTANCE.get(mContext).startOneHandedMode(); + if (mLastPos.y >= mStartDragPos.y && mPassedSlop) { + onStartGestureDetected(); } mPassedSlop = false; @@ -131,6 +129,28 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { } } + private void onStartGestureDetected() { + if (mDeviceState.isOneHandedModeActive()) { + return; + } + + if (mDeviceState.isOneHandedModeEnabled()) { + SystemUiProxy.INSTANCE.get(mContext).startOneHandedMode(); + return; + } + + // Hook one-handed gesture to expand notification panel by default + SystemUiProxy.INSTANCE.get(mContext).expandNotificationPanel(); + } + + private void onStopGestureDetected() { + if (!mDeviceState.isOneHandedModeEnabled() || !mDeviceState.isOneHandedModeActive()) { + return; + } + + SystemUiProxy.INSTANCE.get(mContext).stopOneHandedMode(); + } + private boolean isValidStartAngle(float deltaX, float deltaY) { final float angle = (float) Math.toDegrees(Math.atan2(deltaY, deltaX)); return angle > -(ANGLE_MAX) && angle < -(ANGLE_MIN); diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index 87522b852e..15e6ca5e93 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -77,8 +77,6 @@ public class RecentsAnimationDeviceState implements NavigationModeChangeListener, DefaultDisplay.DisplayInfoChangeListener { - private static boolean sIsOneHandedEnabled; - private final Context mContext; private final SysUINavigationMode mSysUiNavMode; private final DefaultDisplay mDefaultDisplay; @@ -95,6 +93,7 @@ public class RecentsAnimationDeviceState implements private final Region mDeferredGestureRegion = new Region(); private boolean mAssistantAvailable; private float mAssistantVisibility; + private boolean mIsOneHandedModeEnabled; private boolean mIsUserUnlocked; private final ArrayList mUserUnlockedActions = new ArrayList<>(); @@ -495,10 +494,6 @@ public class RecentsAnimationDeviceState implements * @return whether the given motion event can trigger the one handed mode. */ public boolean canTriggerOneHandedAction(MotionEvent ev) { - if (!sIsOneHandedEnabled) { - return false; - } - final DefaultDisplay.Info displayInfo = mDefaultDisplay.getInfo(); return (mRotationTouchHelper.touchInOneHandedModeRegion(ev) && displayInfo.rotation != Surface.ROTATION_90 @@ -506,8 +501,12 @@ public class RecentsAnimationDeviceState implements && displayInfo.metrics.densityDpi < DisplayMetrics.DENSITY_600); } + public boolean isOneHandedModeEnabled() { + return mIsOneHandedModeEnabled; + } + private void onOneHandedEnabledSettingsChanged(boolean isOneHandedEnabled) { - sIsOneHandedEnabled = isOneHandedEnabled; + mIsOneHandedModeEnabled = isOneHandedEnabled; } public RotationTouchHelper getRotationTouchHelper() { diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 72510a999a..e4b05aec12 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -380,4 +380,15 @@ public class SystemUiProxy implements ISystemUiProxy { } } } + + @Override + public void expandNotificationPanel() { + if (mSystemUiProxy != null) { + try { + mSystemUiProxy.expandNotificationPanel(); + } catch (RemoteException e) { + Log.w(TAG, "Failed call expandNotificationPanel", e); + } + } + } } From fc6c42107d826343e72312b1c75d5bad16d44408 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sat, 18 Jul 2020 23:50:05 +0000 Subject: [PATCH 23/72] Update state and touch region after one handed overlay changed The matrix for overall modes x state changes: ----------------------------------------------------- Mode | State changed | *Before|*After ----------------------------------------------------- OneHanded | Portrait->Landscape | 80dp | 32dp OneHanded | Landscape->Portrait | 32dp | 80dp ----------------------------------------------------- OneHanded | Disable->Enable | 32dp | 32dp (Landscape)| Enable->Disable | 32dp | 32dp ----------------------------------------------------- OneHanded | Disable->Enable | 32dp | 80dp (Portrait) | Enable->Disable | 80dp | 32dp ----------------------------------------------------- NO_BUTTON | Portrait->Landscape | 32dp | 32dp NO_BUTTON | Landscape->Portrait | 32dp | 32dp 2 BUTTON | Portrait->Landscape | 48dp | 48dp 2 BUTTON | Landscape->Portrait | 48dp | 48dp 3 BUTTON | Portrait->Landscape | 48dp | 48dp 3 BUTTON | Landscape->Portrait | 48dp | 48dp ----------------------------------------------------- * dimen : navigation_bar_gesture_height Test: adb bugrepot | grep mOneHandedModeRegion Test: manually triger one handed Test: atest WindowInsetsBehaviorTests Test: atest com.android.launcher3.memory.MemoryTests Test: flake -once Test: rnlot -t com.android.launcher3.memory.MemoryTests Bug: 157958539 Bug: 159183864 Change-Id: I19755938c3c93eb59a9f621af5722f5679c1da14 (cherry picked from commit 70b5ca2505c96f4d6176cf2439562b826601b354) --- .../quickstep/TouchInteractionService.java | 16 ++++ .../OrientationTouchTransformer.java | 31 ++++++-- .../RecentsAnimationDeviceState.java | 19 ++++- .../quickstep/RotationTouchHelper.java | 11 ++- .../quickstep/SysUINavigationMode.java | 73 +++++++++++++++---- src/com/android/launcher3/ResourceUtils.java | 9 ++- 6 files changed, 132 insertions(+), 27 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 574cd3402b..e5852be46f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -58,6 +58,7 @@ import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; +import com.android.launcher3.ResourceUtils; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.UserEventDispatcher; @@ -298,6 +299,7 @@ public class TouchInteractionService extends Service implements PluginListener mChangeListeners = new ArrayList<>(); + private final List mOneHandedOverlayChangeListeners = + new ArrayList<>(); public SysUINavigationMode(Context context) { mContext = context; @@ -76,8 +81,9 @@ public class SysUINavigationMode { @Override public void onReceive(Context context, Intent intent) { updateMode(); + updateGesturalHeight(); } - }, getPackageFilter("android", ACTION_OVERLAY_CHANGED)); + }, getPackageFilter(TARGET_OVERLAY_PACKAGE, ACTION_OVERLAY_CHANGED)); } /** Updates navigation mode when needed. */ @@ -89,9 +95,35 @@ public class SysUINavigationMode { } } + private void updateGesturalHeight() { + int newGesturalHeight = ResourceUtils.getDimenByName( + ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mContext.getResources(), + INVALID_RESOURCE_HANDLE); + + if (newGesturalHeight == INVALID_RESOURCE_HANDLE) { + Log.e(TAG, "Failed to get system resource ID. Incompatible framework version?"); + return; + } + + if (mNavBarGesturalHeight != newGesturalHeight) { + mNavBarGesturalHeight = newGesturalHeight; + dispatchOneHandedOverlayChange(); + } + } + private void initializeMode() { - int modeInt = getSystemIntegerRes(mContext, NAV_BAR_INTERACTION_MODE_RES_NAME); - for(Mode m : Mode.values()) { + int modeInt = ResourceUtils.getIntegerByName(NAV_BAR_INTERACTION_MODE_RES_NAME, + mContext.getResources(), INVALID_RESOURCE_HANDLE); + mNavBarGesturalHeight = ResourceUtils.getDimenByName( + ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mContext.getResources(), + INVALID_RESOURCE_HANDLE); + + if (modeInt == INVALID_RESOURCE_HANDLE) { + Log.e(TAG, "Failed to get system resource ID. Incompatible framework version?"); + return; + } + + for (Mode m : Mode.values()) { if (m.resValue == modeInt) { mMode = m; } @@ -104,6 +136,12 @@ public class SysUINavigationMode { } } + private void dispatchOneHandedOverlayChange() { + for (OneHandedModeChangeListener listener : mOneHandedOverlayChangeListeners) { + listener.onOneHandedModeChanged(mNavBarGesturalHeight); + } + } + public Mode addModeChangeListener(NavigationModeChangeListener listener) { mChangeListeners.add(listener); return mMode; @@ -113,20 +151,17 @@ public class SysUINavigationMode { mChangeListeners.remove(listener); } - public Mode getMode() { - return mMode; + public int addOneHandedOverlayChangeListener(OneHandedModeChangeListener listener) { + mOneHandedOverlayChangeListeners.add(listener); + return mNavBarGesturalHeight; } - private static int getSystemIntegerRes(Context context, String resName) { - Resources res = context.getResources(); - int resId = res.getIdentifier(resName, "integer", "android"); + public void removeOneHandedOverlayChangeListener(OneHandedModeChangeListener listener) { + mOneHandedOverlayChangeListeners.remove(listener); + } - if (resId != 0) { - return res.getInteger(resId); - } else { - Log.e(TAG, "Failed to get system resource ID. Incompatible framework version?"); - return -1; - } + public Mode getMode() { + return mMode; } /** @return Whether we can remove the shelf from overview. */ @@ -144,10 +179,16 @@ public class SysUINavigationMode { public void dump(PrintWriter pw) { pw.println("SysUINavigationMode:"); pw.println(" mode=" + mMode.name()); + pw.println(" mNavBarGesturalHeight=:" + mNavBarGesturalHeight); } public interface NavigationModeChangeListener { void onNavigationModeChanged(Mode newMode); } + + public interface OneHandedModeChangeListener { + + void onOneHandedModeChanged(int newGesturalHeight); + } } \ No newline at end of file diff --git a/src/com/android/launcher3/ResourceUtils.java b/src/com/android/launcher3/ResourceUtils.java index 403d77913c..c9fb75a2db 100644 --- a/src/com/android/launcher3/ResourceUtils.java +++ b/src/com/android/launcher3/ResourceUtils.java @@ -22,6 +22,7 @@ import android.util.TypedValue; public class ResourceUtils { public static final int DEFAULT_NAVBAR_VALUE = 48; + public static final int INVALID_RESOURCE_HANDLE = -1; public static final String NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE = "navigation_bar_width"; public static final String NAVBAR_BOTTOM_GESTURE_SIZE = "navigation_bar_gesture_height"; @@ -51,7 +52,13 @@ public class ResourceUtils { return val; } + public static int getIntegerByName(String resName, Resources res, int defaultValue) { + int resId = res.getIdentifier(resName, "integer", "android"); + return resId != 0 ? res.getInteger(resId) : defaultValue; + } + public static int pxFromDp(float size, DisplayMetrics metrics) { - return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, size, metrics)); + return size < 0 ? INVALID_RESOURCE_HANDLE : Math.round( + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, size, metrics)); } } From fbb8c69a56d7fe9a7e9e809262b8e6b17d00397f Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sat, 18 Jul 2020 23:55:26 +0000 Subject: [PATCH 24/72] Guard swipe to notification gesture with system settings preference Bug: 154080211 Test: make and install, check the gesture works as expectedly Change-Id: Ibd6bbd595d2fba5d68e66eb54e4a7fec160b9bf8 (cherry picked from commit 779efaca91309f82e133954e1fab032601b2aa93) --- .../OneHandedModeInputConsumer.java | 14 ++++----- .../RecentsAnimationDeviceState.java | 29 ++++++++++++++----- .../util/SecureSettingsObserver.java | 14 +++++++++ 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java index 46249d9fc5..0bb8fff2a1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java @@ -130,17 +130,13 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { } private void onStartGestureDetected() { - if (mDeviceState.isOneHandedModeActive()) { - return; - } - if (mDeviceState.isOneHandedModeEnabled()) { - SystemUiProxy.INSTANCE.get(mContext).startOneHandedMode(); - return; + if (!mDeviceState.isOneHandedModeActive()) { + SystemUiProxy.INSTANCE.get(mContext).startOneHandedMode(); + } + } else if (mDeviceState.isSwipeToNotificationEnabled()) { + SystemUiProxy.INSTANCE.get(mContext).expandNotificationPanel(); } - - // Hook one-handed gesture to expand notification panel by default - SystemUiProxy.INSTANCE.get(mContext).expandNotificationPanel(); } private void onStopGestureDetected() { diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index 1a786726a5..2868b1b37c 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -90,12 +90,12 @@ public class RecentsAnimationDeviceState implements private @SystemUiStateFlags int mSystemUiStateFlags; private SysUINavigationMode.Mode mMode = THREE_BUTTONS; private NavBarPosition mNavBarPosition; - private SecureSettingsObserver mOneHandedEnabledObserver; private final Region mDeferredGestureRegion = new Region(); private boolean mAssistantAvailable; private float mAssistantVisibility; private boolean mIsOneHandedModeEnabled; + private boolean mIsSwipeToNotificationEnabled; private boolean mIsUserUnlocked; private final ArrayList mUserUnlockedActions = new ArrayList<>(); @@ -166,12 +166,21 @@ public class RecentsAnimationDeviceState implements } if (SystemProperties.getBoolean("ro.support_one_handed_mode", false)) { - mOneHandedEnabledObserver = SecureSettingsObserver.newOneHandedSettingsObserver( - mContext, this::onOneHandedEnabledSettingsChanged); - mOneHandedEnabledObserver.register(); - mOneHandedEnabledObserver.dispatchOnChange(); + SecureSettingsObserver oneHandedEnabledObserver = + SecureSettingsObserver.newOneHandedSettingsObserver( + mContext, enabled -> mIsOneHandedModeEnabled = enabled); + oneHandedEnabledObserver.register(); + oneHandedEnabledObserver.dispatchOnChange(); + runOnDestroy(oneHandedEnabledObserver::unregister); } + SecureSettingsObserver swipeBottomEnabledObserver = + SecureSettingsObserver.newSwipeToNotificationSettingsObserver( + mContext, enabled -> mIsSwipeToNotificationEnabled = enabled); + swipeBottomEnabledObserver.register(); + swipeBottomEnabledObserver.dispatchOnChange(); + runOnDestroy(swipeBottomEnabledObserver::unregister); + SecureSettingsObserver userSetupObserver = new SecureSettingsObserver( context.getContentResolver(), e -> mIsUserSetupComplete = e, @@ -509,6 +518,10 @@ public class RecentsAnimationDeviceState implements * @return whether the given motion event can trigger the one handed mode. */ public boolean canTriggerOneHandedAction(MotionEvent ev) { + if (!mIsOneHandedModeEnabled && !mIsSwipeToNotificationEnabled) { + return false; + } + final DefaultDisplay.Info displayInfo = mDefaultDisplay.getInfo(); return (mRotationTouchHelper.touchInOneHandedModeRegion(ev) && displayInfo.rotation != Surface.ROTATION_90 @@ -520,8 +533,8 @@ public class RecentsAnimationDeviceState implements return mIsOneHandedModeEnabled; } - private void onOneHandedEnabledSettingsChanged(boolean isOneHandedEnabled) { - mIsOneHandedModeEnabled = isOneHandedEnabled; + public boolean isSwipeToNotificationEnabled() { + return mIsSwipeToNotificationEnabled; } public RotationTouchHelper getRotationTouchHelper() { @@ -538,6 +551,8 @@ public class RecentsAnimationDeviceState implements pw.println(" assistantDisabled=" + QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags)); pw.println(" isUserUnlocked=" + mIsUserUnlocked); + pw.println(" isOneHandedModeEnabled=" + mIsOneHandedModeEnabled); + pw.println(" isSwipeToNotificationEnabled=" + mIsSwipeToNotificationEnabled); mRotationTouchHelper.dump(pw); } } diff --git a/src/com/android/launcher3/util/SecureSettingsObserver.java b/src/com/android/launcher3/util/SecureSettingsObserver.java index 08a8e6d255..4b2242907b 100644 --- a/src/com/android/launcher3/util/SecureSettingsObserver.java +++ b/src/com/android/launcher3/util/SecureSettingsObserver.java @@ -31,6 +31,9 @@ public class SecureSettingsObserver extends ContentObserver { public static final String NOTIFICATION_BADGING = "notification_badging"; /** Hidden field Settings.Secure.ONE_HANDED_MODE_ENABLED */ public static final String ONE_HANDED_ENABLED = "one_handed_mode_enabled"; + /** Hidden field Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED */ + public static final String ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED = + "swipe_bottom_to_notification_enabled"; private final ContentResolver mResolver; private final String mKeySetting; @@ -87,4 +90,15 @@ public class SecureSettingsObserver extends ContentObserver { return new SecureSettingsObserver( context.getContentResolver(), listener, ONE_HANDED_ENABLED, 1); } + + /** + * Constructs settings observer for {@link #ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED} + * preference. + */ + public static SecureSettingsObserver newSwipeToNotificationSettingsObserver(Context context, + OnChangeListener listener) { + return new SecureSettingsObserver( + context.getContentResolver(), listener, + ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 1); + } } From 0c2b05947ec4d1b71910216552e29cfe1d575b07 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 20 Jul 2020 16:46:47 -0700 Subject: [PATCH 25/72] Handle uiMode changes - Launcher already dedupes if there are no theme changes Bug: 148988542 Test: adb shell cmd uimode car yes/no, adb shell cmd uimode night yes/no Change-Id: Ia83f02d18a0433c8be59d1f488e58b38476ba5ff --- AndroidManifest.xml | 2 +- quickstep/AndroidManifest-launcher.xml | 2 +- quickstep/AndroidManifest.xml | 2 +- tests/AndroidManifest-common.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8e01f82018..4664c9315a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -49,7 +49,7 @@ android:stateNotNeeded="true" android:windowSoftInputMode="adjustPan" android:screenOrientation="unspecified" - android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize" + android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" android:resizeableActivity="true" android:resumeWhilePausing="true" android:taskAffinity="" diff --git a/quickstep/AndroidManifest-launcher.xml b/quickstep/AndroidManifest-launcher.xml index 53910e344b..19f85e4c1f 100644 --- a/quickstep/AndroidManifest-launcher.xml +++ b/quickstep/AndroidManifest-launcher.xml @@ -49,7 +49,7 @@ android:stateNotNeeded="true" android:windowSoftInputMode="adjustPan" android:screenOrientation="unspecified" - android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize" + android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" android:resizeableActivity="true" android:resumeWhilePausing="true" android:taskAffinity="" diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index 4e7c3fa75b..5be32a89b4 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -59,7 +59,7 @@ android:stateNotNeeded="true" android:theme="@style/LauncherTheme" android:screenOrientation="unspecified" - android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize" + android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" android:resizeableActivity="true" android:resumeWhilePausing="true" android:taskAffinity=""/> diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml index f243f279eb..bc6356ffa6 100644 --- a/tests/AndroidManifest-common.xml +++ b/tests/AndroidManifest-common.xml @@ -98,7 +98,7 @@ Date: Wed, 24 Jun 2020 23:47:46 -0700 Subject: [PATCH 26/72] Adding home animation support for non-system Launcher When user swipes up to home, Launcher will receive a onNewIntent callwith a bundle-extra gesture_nav_contract_v1. It will contain the componentName & UserHandle of the closing app & a callback. Launcher can use the callback to return the final position where the app should animate to and an optional surface to be used for crossFade animation. The surface cleanup can be handled in onEnterAnimationComplete. Change-Id: I76fdd810fdcb80b71f7d7588ccac8976d9dfe278 --- .../quickstep/FallbackSwipeHandler.java | 138 +++++++++- .../launcher3/BaseQuickstepLauncher.java | 7 + res/layout/floating_surface_view.xml | 19 ++ .../launcher3/AbstractFloatingView.java | 9 +- src/com/android/launcher3/BubbleTextView.java | 14 +- .../android/launcher3/GestureNavContract.java | 101 ++++++++ src/com/android/launcher3/Launcher.java | 15 ++ .../launcher3/views/FloatingIconView.java | 20 +- .../launcher3/views/FloatingSurfaceView.java | 241 ++++++++++++++++++ 9 files changed, 546 insertions(+), 18 deletions(-) create mode 100644 res/layout/floating_surface_view.xml create mode 100644 src/com/android/launcher3/GestureNavContract.java create mode 100644 src/com/android/launcher3/views/FloatingSurfaceView.java diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java index 1909f4772e..f60a50bb43 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java @@ -15,14 +15,35 @@ */ package com.android.quickstep; +import static android.content.Intent.EXTRA_COMPONENT_NAME; +import static android.content.Intent.EXTRA_USER; + +import static com.android.launcher3.GestureNavContract.EXTRA_GESTURE_CONTRACT; +import static com.android.launcher3.GestureNavContract.EXTRA_ICON_POSITION; +import static com.android.launcher3.GestureNavContract.EXTRA_ICON_SURFACE; +import static com.android.launcher3.GestureNavContract.EXTRA_REMOTE_CALLBACK; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME; import android.animation.ObjectAnimator; +import android.annotation.TargetApi; import android.app.ActivityOptions; import android.content.Context; import android.content.Intent; import android.graphics.Matrix; +import android.graphics.Rect; +import android.graphics.RectF; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.os.Messenger; +import android.os.ParcelUuid; +import android.os.UserHandle; +import android.view.Surface; +import android.view.SurfaceControl; +import android.view.SurfaceControl.Transaction; import androidx.annotation.NonNull; @@ -32,19 +53,33 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.anim.SpringAnimationBuilder; import com.android.quickstep.fallback.FallbackRecentsView; +import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.TransformParams; import com.android.quickstep.util.TransformParams.BuilderProxy; +import com.android.systemui.shared.recents.model.Task.TaskKey; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams; +import java.lang.ref.WeakReference; +import java.util.UUID; +import java.util.function.Consumer; + /** * Handles the navigation gestures when a 3rd party launcher is the default home activity. */ +@TargetApi(Build.VERSION_CODES.R) public class FallbackSwipeHandler extends BaseSwipeUpHandlerV2 { + /** + * Message used for receiving gesture nav contract information. We use a static messenger to + * avoid leaking too make binders in case the receiving launcher does not handle the contract + * properly. + */ + private static StaticMessageReceiver sMessageReceiver = null; + private FallbackHomeAnimationFactory mActiveAnimationFactory; private final boolean mRunningOverHome; @@ -89,7 +124,9 @@ public class FallbackSwipeHandler extends protected HomeAnimationFactory createHomeAnimationFactory(long duration) { mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration); ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0); - mContext.startActivity(new Intent(mGestureState.getHomeIntent()), options.toBundle()); + Intent intent = new Intent(mGestureState.getHomeIntent()); + mActiveAnimationFactory.addGestureContract(intent); + mContext.startActivity(intent, options.toBundle()); return mActiveAnimationFactory; } @@ -130,15 +167,19 @@ public class FallbackSwipeHandler extends } private class FallbackHomeAnimationFactory extends HomeAnimationFactory { - + private final Rect mTempRect = new Rect(); private final TransformParams mHomeAlphaParams = new TransformParams(); private final AnimatedFloat mHomeAlpha; private final AnimatedFloat mVerticalShiftForScale = new AnimatedFloat(); - private final AnimatedFloat mRecentsAlpha = new AnimatedFloat(); + private final RectF mTargetRect = new RectF(); + private SurfaceControl mSurfaceControl; + private final long mDuration; + + private RectFSpringAnim mSpringAnim; FallbackHomeAnimationFactory(long duration) { mDuration = duration; @@ -161,6 +202,15 @@ public class FallbackSwipeHandler extends this::updateRecentsActivityTransformDuringHomeAnim); } + @NonNull + @Override + public RectF getWindowTargetRect() { + if (mTargetRect.isEmpty()) { + mTargetRect.set(super.getWindowTargetRect()); + } + return mTargetRect; + } + private void updateRecentsActivityTransformDuringHomeAnim(SurfaceParams.Builder builder, RemoteAnimationTargetCompat app, TransformParams params) { builder.withAlpha(mRecentsAlpha.value); @@ -217,5 +267,87 @@ public class FallbackSwipeHandler extends .start(); } } + + @Override + public void setAnimation(RectFSpringAnim anim) { + mSpringAnim = anim; + } + + private void onMessageReceived(Message msg) { + try { + Bundle data = msg.getData(); + RectF position = data.getParcelable(EXTRA_ICON_POSITION); + if (!position.isEmpty()) { + mSurfaceControl = data.getParcelable(EXTRA_ICON_SURFACE); + mTargetRect.set(position); + if (mSpringAnim != null) { + mSpringAnim.onTargetPositionChanged(); + } + } + } catch (Exception e) { + // Ignore + } + } + + @Override + public void update(RectF currentRect, float progress, float radius) { + if (mSurfaceControl != null) { + currentRect.roundOut(mTempRect); + Transaction t = new Transaction(); + t.setGeometry(mSurfaceControl, null, mTempRect, Surface.ROTATION_0); + t.apply(); + } + } + + private void addGestureContract(Intent intent) { + if (mRunningOverHome || mGestureState.getRunningTask() == null) { + return; + } + + TaskKey key = new TaskKey(mGestureState.getRunningTask()); + if (key.getComponent() != null) { + if (sMessageReceiver == null) { + sMessageReceiver = new StaticMessageReceiver(); + } + + Bundle gestureNavContract = new Bundle(); + gestureNavContract.putParcelable(EXTRA_COMPONENT_NAME, key.getComponent()); + gestureNavContract.putParcelable(EXTRA_USER, UserHandle.of(key.userId)); + gestureNavContract.putParcelable(EXTRA_REMOTE_CALLBACK, + sMessageReceiver.newCallback(this::onMessageReceived)); + intent.putExtra(EXTRA_GESTURE_CONTRACT, gestureNavContract); + } + } + } + + private static class StaticMessageReceiver implements Handler.Callback { + + private final Messenger mMessenger = + new Messenger(new Handler(Looper.getMainLooper(), this)); + + private ParcelUuid mCurrentUID = new ParcelUuid(UUID.randomUUID()); + private WeakReference> mCurrentCallback = new WeakReference<>(null); + + public Message newCallback(Consumer callback) { + mCurrentUID = new ParcelUuid(UUID.randomUUID()); + mCurrentCallback = new WeakReference<>(callback); + + Message msg = Message.obtain(); + msg.replyTo = mMessenger; + msg.obj = mCurrentUID; + return msg; + } + + @Override + public boolean handleMessage(@NonNull Message message) { + if (mCurrentUID.equals(message.obj)) { + Consumer consumer = mCurrentCallback.get(); + if (consumer != null) { + consumer.accept(message); + return true; + } + } + return false; + } } } diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 6b941be471..235df425b4 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -110,6 +110,13 @@ public abstract class BaseQuickstepLauncher extends Launcher .getHighResLoadingState().setVisible(true); } + @Override + protected void handleGestureContract(Intent intent) { + if (FeatureFlags.SEPARATE_RECENTS_ACTIVITY.get()) { + super.handleGestureContract(intent); + } + } + @Override public void onTrimMemory(int level) { super.onTrimMemory(level); diff --git a/res/layout/floating_surface_view.xml b/res/layout/floating_surface_view.xml new file mode 100644 index 0000000000..434e84f269 --- /dev/null +++ b/res/layout/floating_surface_view.xml @@ -0,0 +1,19 @@ + + + diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java index cd27a2ddca..ce37a30160 100644 --- a/src/com/android/launcher3/AbstractFloatingView.java +++ b/src/com/android/launcher3/AbstractFloatingView.java @@ -62,7 +62,8 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch TYPE_ALL_APPS_EDU, TYPE_TASK_MENU, - TYPE_OPTIONS_POPUP + TYPE_OPTIONS_POPUP, + TYPE_ICON_SURFACE }) @Retention(RetentionPolicy.SOURCE) public @interface FloatingViewType {} @@ -80,16 +81,18 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch // Popups related to quickstep UI public static final int TYPE_TASK_MENU = 1 << 10; public static final int TYPE_OPTIONS_POPUP = 1 << 11; + public static final int TYPE_ICON_SURFACE = 1 << 12; public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP | TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET | TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE | TYPE_TASK_MENU - | TYPE_OPTIONS_POPUP | TYPE_SNACKBAR | TYPE_LISTENER | TYPE_ALL_APPS_EDU; + | TYPE_OPTIONS_POPUP | TYPE_SNACKBAR | TYPE_LISTENER | TYPE_ALL_APPS_EDU + | TYPE_ICON_SURFACE; // Type of popups which should be kept open during launcher rebind public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET | TYPE_WIDGETS_BOTTOM_SHEET | TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE - | TYPE_ALL_APPS_EDU; + | TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE; // Usually we show the back button when a floating view is open. Instead, hide for these types. public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 48819cbfa0..198f13d02a 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -614,6 +614,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, @Override public void setIconVisible(boolean visible) { mIsIconVisible = visible; + if (!mIsIconVisible) { + resetIconScale(); + } Drawable icon = visible ? mIcon : new ColorDrawable(Color.TRANSPARENT); applyCompoundDrawables(icon); } @@ -753,11 +756,14 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, @Override public SafeCloseable prepareDrawDragView() { - if (getIcon() instanceof FastBitmapDrawable) { - FastBitmapDrawable icon = (FastBitmapDrawable) getIcon(); - icon.setScale(1f); - } + resetIconScale(); setForceHideDot(true); return () -> { }; } + + private void resetIconScale() { + if (mIcon instanceof FastBitmapDrawable) { + ((FastBitmapDrawable) mIcon).setScale(1f); + } + } } diff --git a/src/com/android/launcher3/GestureNavContract.java b/src/com/android/launcher3/GestureNavContract.java new file mode 100644 index 0000000000..2a7e629247 --- /dev/null +++ b/src/com/android/launcher3/GestureNavContract.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3; + +import static android.content.Intent.EXTRA_COMPONENT_NAME; +import static android.content.Intent.EXTRA_USER; + +import android.annotation.TargetApi; +import android.content.ComponentName; +import android.content.Intent; +import android.graphics.RectF; +import android.os.Build; +import android.os.Bundle; +import android.os.Message; +import android.os.RemoteException; +import android.os.UserHandle; +import android.util.Log; +import android.view.SurfaceControl; + +import androidx.annotation.Nullable; + +/** + * Class to encapsulate the handshake protocol between Launcher and gestureNav. + */ +public class GestureNavContract { + + private static final String TAG = "GestureNavContract"; + + public static final String EXTRA_GESTURE_CONTRACT = "gesture_nav_contract_v1"; + public static final String EXTRA_ICON_POSITION = "gesture_nav_contract_icon_position"; + public static final String EXTRA_ICON_SURFACE = "gesture_nav_contract_surface_control"; + public static final String EXTRA_REMOTE_CALLBACK = "android.intent.extra.REMOTE_CALLBACK"; + + public final ComponentName componentName; + public final UserHandle user; + + private final Message mCallback; + + public GestureNavContract(ComponentName componentName, UserHandle user, Message callback) { + this.componentName = componentName; + this.user = user; + this.mCallback = callback; + } + + /** + * Sends the position information to the receiver + */ + @TargetApi(Build.VERSION_CODES.R) + public void sendEndPosition(RectF position, @Nullable SurfaceControl surfaceControl) { + Bundle result = new Bundle(); + result.putParcelable(EXTRA_ICON_POSITION, position); + result.putParcelable(EXTRA_ICON_SURFACE, surfaceControl); + + Message callback = Message.obtain(); + callback.copyFrom(mCallback); + callback.setData(result); + + try { + callback.replyTo.send(callback); + } catch (RemoteException e) { + Log.e(TAG, "Error sending icon position", e); + } + } + + /** + * Clears and returns the GestureNavContract if it was present in the intent. + */ + public static GestureNavContract fromIntent(Intent intent) { + if (!Utilities.ATLEAST_R) { + return null; + } + Bundle extras = intent.getBundleExtra(EXTRA_GESTURE_CONTRACT); + if (extras == null) { + return null; + } + intent.removeExtra(EXTRA_GESTURE_CONTRACT); + + ComponentName componentName = extras.getParcelable(EXTRA_COMPONENT_NAME); + UserHandle userHandle = extras.getParcelable(EXTRA_USER); + Message callback = extras.getParcelable(EXTRA_REMOTE_CALLBACK); + + if (componentName != null && userHandle != null && callback != null + && callback.replyTo != null) { + return new GestureNavContract(componentName, userHandle, callback); + } + return null; + } +} diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d06ae7a9c5..4675362f64 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -21,6 +21,7 @@ import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; +import static com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR; import static com.android.launcher3.InstallShortcutReceiver.FLAG_DRAG_AND_DROP; @@ -168,6 +169,7 @@ import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.UiThreadHelper; import com.android.launcher3.util.ViewOnDrawExecutor; import com.android.launcher3.views.ActivityContext; +import com.android.launcher3.views.FloatingSurfaceView; import com.android.launcher3.views.OptionsPopupView; import com.android.launcher3.views.ScrimView; import com.android.launcher3.widget.LauncherAppWidgetHostView; @@ -509,6 +511,7 @@ public class Launcher extends StatefulActivity implements Launche public void onEnterAnimationComplete() { super.onEnterAnimationComplete(); mRotationHelper.setCurrentTransitionRequest(REQUEST_NONE); + AbstractFloatingView.closeOpenViews(this, false, TYPE_ICON_SURFACE); } @Override @@ -1450,6 +1453,7 @@ public class Launcher extends StatefulActivity implements Launche mLauncherCallbacks.onHomeIntent(internalStateHandled); } mOverlayManager.hideOverlay(isStarted() && !isForceInvisible()); + handleGestureContract(intent); } else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) { getStateManager().goToState(ALL_APPS, alreadyOnHome); } @@ -1457,6 +1461,17 @@ public class Launcher extends StatefulActivity implements Launche TraceHelper.INSTANCE.endSection(traceToken); } + /** + * Handles gesture nav contract + */ + protected void handleGestureContract(Intent intent) { + GestureNavContract gnc = GestureNavContract.fromIntent(intent); + if (gnc != null) { + AbstractFloatingView.closeOpenViews(this, false, TYPE_ICON_SURFACE); + FloatingSurfaceView.show(this, gnc); + } + } + /** * Hides the keyboard if visible */ diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 7cdde2e84b..8186dfa3dc 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -196,13 +196,18 @@ public class FloatingIconView extends FrameLayout implements layout(left, lp.topMargin, left + lp.width, lp.topMargin + lp.height); } + private static void getLocationBoundsForView(Launcher launcher, View v, boolean isOpening, + RectF outRect) { + getLocationBoundsForView(launcher, v, isOpening, outRect, new Rect()); + } + /** * Gets the location bounds of a view and returns the overall rotation. * - For DeepShortcutView, we return the bounds of the icon view. * - For BubbleTextView, we return the icon bounds. */ - private static void getLocationBoundsForView(Launcher launcher, View v, boolean isOpening, - RectF outRect) { + public static void getLocationBoundsForView(Launcher launcher, View v, boolean isOpening, + RectF outRect, Rect outViewBounds) { boolean ignoreTransform = !isOpening; if (v instanceof DeepShortcutView) { v = ((DeepShortcutView) v).getBubbleText(); @@ -215,17 +220,16 @@ public class FloatingIconView extends FrameLayout implements return; } - Rect iconBounds = new Rect(); if (v instanceof BubbleTextView) { - ((BubbleTextView) v).getIconBounds(iconBounds); + ((BubbleTextView) v).getIconBounds(outViewBounds); } else if (v instanceof FolderIcon) { - ((FolderIcon) v).getPreviewBounds(iconBounds); + ((FolderIcon) v).getPreviewBounds(outViewBounds); } else { - iconBounds.set(0, 0, v.getWidth(), v.getHeight()); + outViewBounds.set(0, 0, v.getWidth(), v.getHeight()); } - float[] points = new float[] {iconBounds.left, iconBounds.top, iconBounds.right, - iconBounds.bottom}; + float[] points = new float[] {outViewBounds.left, outViewBounds.top, outViewBounds.right, + outViewBounds.bottom}; Utilities.getDescendantCoordRelativeToAncestor(v, launcher.getDragLayer(), points, false, ignoreTransform); outRect.set( diff --git a/src/com/android/launcher3/views/FloatingSurfaceView.java b/src/com/android/launcher3/views/FloatingSurfaceView.java new file mode 100644 index 0000000000..040619e9c7 --- /dev/null +++ b/src/com/android/launcher3/views/FloatingSurfaceView.java @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.views; + +import static com.android.launcher3.views.FloatingIconView.getLocationBoundsForView; +import static com.android.launcher3.views.IconLabelDotView.setIconAndDotVisible; + +import android.annotation.TargetApi; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Picture; +import android.graphics.PixelFormat; +import android.graphics.Rect; +import android.graphics.RectF; +import android.os.Build; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.View; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; + +import androidx.annotation.NonNull; + +import com.android.launcher3.AbstractFloatingView; +import com.android.launcher3.GestureNavContract; +import com.android.launcher3.Insettable; +import com.android.launcher3.Launcher; +import com.android.launcher3.R; +import com.android.launcher3.util.DefaultDisplay; +import com.android.launcher3.util.Executors; + +/** + * Similar to {@link FloatingIconView} but displays a surface with the targetIcon. It then passes + * the surfaceHandle to the {@link GestureNavContract}. + */ +@TargetApi(Build.VERSION_CODES.R) +public class FloatingSurfaceView extends AbstractFloatingView implements + OnGlobalLayoutListener, Insettable, SurfaceHolder.Callback2 { + + private final RectF mTmpPosition = new RectF(); + + private final Launcher mLauncher; + private final RectF mIconPosition = new RectF(); + + private final Rect mIconBounds = new Rect(); + private final Picture mPicture = new Picture(); + private final Runnable mRemoveViewRunnable = this::removeViewFromParent; + + private final SurfaceView mSurfaceView; + + + private View mIcon; + private GestureNavContract mContract; + + public FloatingSurfaceView(Context context) { + this(context, null); + } + + public FloatingSurfaceView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public FloatingSurfaceView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + mLauncher = Launcher.getLauncher(context); + + mSurfaceView = new SurfaceView(context); + mSurfaceView.setZOrderOnTop(true); + + mSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); + mSurfaceView.getHolder().addCallback(this); + mIsOpen = true; + addView(mSurfaceView); + } + + @Override + protected void handleClose(boolean animate) { + setCurrentIconVisible(true); + mLauncher.getViewCache().recycleView(R.layout.floating_surface_view, this); + mContract = null; + mIcon = null; + mIsOpen = false; + + // Remove after some time, to avoid flickering + Executors.MAIN_EXECUTOR.getHandler().postDelayed(mRemoveViewRunnable, + DefaultDisplay.INSTANCE.get(mLauncher).getInfo().singleFrameMs); + } + + private void removeViewFromParent() { + mPicture.beginRecording(1, 1); + mPicture.endRecording(); + mLauncher.getDragLayer().removeView(this); + } + + /** + * Shows the surfaceView for the provided contract + */ + public static void show(Launcher launcher, GestureNavContract contract) { + FloatingSurfaceView view = launcher.getViewCache().getView(R.layout.floating_surface_view, + launcher, launcher.getDragLayer()); + view.mContract = contract; + view.mIsOpen = true; + + // Cancel any pending remove + Executors.MAIN_EXECUTOR.getHandler().removeCallbacks(view.mRemoveViewRunnable); + view.removeViewFromParent(); + launcher.getDragLayer().addView(view); + } + + @Override + public void logActionCommand(int command) { } + + @Override + protected boolean isOfType(int type) { + return (type & TYPE_ICON_SURFACE) != 0; + } + + @Override + public boolean onControllerInterceptTouchEvent(MotionEvent ev) { + close(false); + return false; + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + getViewTreeObserver().addOnGlobalLayoutListener(this); + updateIconLocation(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + getViewTreeObserver().removeOnGlobalLayoutListener(this); + setCurrentIconVisible(true); + } + + @Override + public void onGlobalLayout() { + updateIconLocation(); + } + + @Override + public void setInsets(Rect insets) { } + + private void updateIconLocation() { + if (mContract == null) { + return; + } + View icon = mLauncher.getWorkspace().getFirstMatchForAppClose( + mContract.componentName.getPackageName(), mContract.user); + + boolean iconChanged = mIcon != icon; + if (iconChanged) { + setCurrentIconVisible(true); + mIcon = icon; + setCurrentIconVisible(false); + } + + if (icon != null && icon.isAttachedToWindow()) { + getLocationBoundsForView(mLauncher, icon, false, mTmpPosition, mIconBounds); + + if (!mTmpPosition.equals(mIconPosition)) { + mIconPosition.set(mTmpPosition); + sendIconInfo(); + + LayoutParams lp = (LayoutParams) mSurfaceView.getLayoutParams(); + lp.width = Math.round(mIconPosition.width()); + lp.height = Math.round(mIconPosition.height()); + lp.leftMargin = Math.round(mIconPosition.left); + lp.topMargin = Math.round(mIconPosition.top); + } + } + if (iconChanged && !mIconBounds.isEmpty()) { + // Record the icon display + setCurrentIconVisible(true); + Canvas c = mPicture.beginRecording(mIconBounds.width(), mIconBounds.height()); + c.translate(-mIconBounds.left, -mIconBounds.top); + mIcon.draw(c); + mPicture.endRecording(); + setCurrentIconVisible(false); + drawOnSurface(); + } + } + + private void sendIconInfo() { + if (mContract != null && !mIconPosition.isEmpty()) { + mContract.sendEndPosition(mIconPosition, mSurfaceView.getSurfaceControl()); + } + } + + @Override + public void surfaceCreated(@NonNull SurfaceHolder surfaceHolder) { + drawOnSurface(); + sendIconInfo(); + } + + @Override + public void surfaceChanged(@NonNull SurfaceHolder surfaceHolder, + int format, int width, int height) { + drawOnSurface(); + } + + @Override + public void surfaceDestroyed(@NonNull SurfaceHolder surfaceHolder) {} + + @Override + public void surfaceRedrawNeeded(@NonNull SurfaceHolder surfaceHolder) { + drawOnSurface(); + } + + private void drawOnSurface() { + SurfaceHolder surfaceHolder = mSurfaceView.getHolder(); + + Canvas c = surfaceHolder.lockHardwareCanvas(); + if (c != null) { + mPicture.draw(c); + surfaceHolder.unlockCanvasAndPost(c); + } + } + + private void setCurrentIconVisible(boolean isVisible) { + if (mIcon != null) { + setIconAndDotVisible(mIcon, isVisible); + } + } +} From 422015cb9f5f5505c9450c1716fa95d5c16f21d8 Mon Sep 17 00:00:00 2001 From: Pinyao Ting Date: Thu, 16 Jul 2020 11:58:00 -0700 Subject: [PATCH 27/72] Minimal Phone Mode (part-1) Include feature flag for minimal phone mode Bug: 161462256 Test: manual Change-Id: I4ddbe7fd2fd73b4cfaa27ab18c210f38133dd3c2 --- src/com/android/launcher3/config/FeatureFlags.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 5c4a4922fd..45116b6b27 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -177,6 +177,10 @@ public final class FeatureFlags { public static final BooleanFlag USER_EVENT_DISPATCHER = new DeviceFlag( "USER_EVENT_DISPATCHER", true, "User event dispatcher collects logs."); + public static final BooleanFlag ENABLE_MINIMAL_DEVICE = new DeviceFlag( + "ENABLE_MINIMAL_DEVICE", false, + "Allow user to toggle minimal device mode in launcher."); + public static void initialize(Context context) { synchronized (sDebugFlags) { for (DebugFlag flag : sDebugFlags) { From 3344b8ce3da451ff624ce6b991b049c4ed331e1b Mon Sep 17 00:00:00 2001 From: thiruram Date: Wed, 15 Jul 2020 10:28:12 -0700 Subject: [PATCH 28/72] Fixes missing field mappings from launcher_atom.ItemInfo to Statslog. Bug: 161284668 Change-Id: I70b247e896bfcad5f6dbb6ce3ec5ed7aa57b8a61 --- .../logging/StatsLogCompatManager.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index eac45e9907..ba60185c79 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -33,6 +33,7 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.Utilities; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logger.LauncherAtom.ContainerInfo; +import com.android.launcher3.logger.LauncherAtom.FolderContainer.ParentContainerCase; import com.android.launcher3.logger.LauncherAtom.FolderIcon; import com.android.launcher3.logger.LauncherAtom.FromState; import com.android.launcher3.logger.LauncherAtom.ToState; @@ -59,9 +60,11 @@ import java.util.OptionalInt; * This class calls StatsLog compile time generated methods. * * To see if the logs are properly sent to statsd, execute following command. + *
    * $ wwdebug (to turn on the logcat printout) * $ wwlogcat (see logcat with grep filter on) * $ statsd_testdrive (see how ww is writing the proto to statsd buffer) + *
*/ public class StatsLogCompatManager extends StatsLogManager { @@ -109,7 +112,9 @@ public class StatsLogCompatManager extends StatsLogManager { } private class SnapshotWorker extends BaseModelUpdateTask { + private final InstanceId mInstanceId; + SnapshotWorker() { mInstanceId = new InstanceIdSequence( 1 << 20 /*InstanceId.INSTANCE_ID_MAX*/).newInstanceId(); @@ -132,7 +137,8 @@ public class StatsLogCompatManager extends StatsLogManager { LauncherAtom.ItemInfo atomInfo = info.buildProto(fInfo); writeSnapshot(atomInfo, mInstanceId); } - } catch (Exception e) { } + } catch (Exception e) { + } } for (ItemInfo info : appWidgets) { LauncherAtom.ItemInfo atomInfo = info.buildProto(null); @@ -337,7 +343,7 @@ public class StatsLogCompatManager extends StatsLogManager { } private static int getCardinality(LauncherAtom.ItemInfo info) { - switch (info.getContainerInfo().getContainerCase()){ + switch (info.getContainerInfo().getContainerCase()) { case PREDICTED_HOTSEAT_CONTAINER: return info.getContainerInfo().getPredictedHotseatContainer().getCardinality(); case SEARCH_RESULT_CONTAINER: @@ -402,9 +408,16 @@ public class StatsLogCompatManager extends StatsLogManager { } private static int getPageId(LauncherAtom.ItemInfo info) { + if (info.hasTask()) { + return info.getTask().getIndex(); + } switch (info.getContainerInfo().getContainerCase()) { case FOLDER: return info.getContainerInfo().getFolder().getPageIndex(); + case HOTSEAT: + return info.getContainerInfo().getHotseat().getIndex(); + case PREDICTED_HOTSEAT_CONTAINER: + return info.getContainerInfo().getPredictedHotseatContainer().getIndex(); default: return info.getContainerInfo().getWorkspace().getPageIndex(); } @@ -413,6 +426,10 @@ public class StatsLogCompatManager extends StatsLogManager { private static int getParentPageId(LauncherAtom.ItemInfo info) { switch (info.getContainerInfo().getContainerCase()) { case FOLDER: + if (info.getContainerInfo().getFolder().getParentContainerCase() + == ParentContainerCase.HOTSEAT) { + return info.getContainerInfo().getFolder().getHotseat().getIndex(); + } return info.getContainerInfo().getFolder().getWorkspace().getPageIndex(); case SEARCH_RESULT_CONTAINER: return info.getContainerInfo().getSearchResultContainer().getWorkspace() From efa41c1c522c039eefd85b1f3ae1c411010a8cf5 Mon Sep 17 00:00:00 2001 From: thiruram Date: Tue, 21 Jul 2020 23:17:32 -0700 Subject: [PATCH 29/72] Limit launcher snapshot logging once per day. This change will make sure launcher snapshot is logged only once in 24hrs interval using sharedpreference. Bug: 161375303 Change-Id: Iab6b25d931b2e91ae5647e266bd68ead86c99bc6 --- .../logging/StatsLogCompatManager.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index f378c2444f..b978c09f09 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -16,6 +16,10 @@ package com.android.quickstep.logging; +import static android.text.format.DateUtils.DAY_IN_MILLIS; +import static android.text.format.DateUtils.formatElapsedTime; + +import static com.android.launcher3.Utilities.getDevicePrefs; import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.FOLDER; import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.SEARCH_RESULT_CONTAINER; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_SNAPSHOT; @@ -24,6 +28,8 @@ import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGE import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__HOME; import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__OVERVIEW; +import static java.lang.System.currentTimeMillis; + import android.content.Context; import android.util.Log; @@ -71,7 +77,7 @@ public class StatsLogCompatManager extends StatsLogManager { private static final String TAG = "StatsLog"; private static final boolean IS_VERBOSE = Utilities.isPropertyEnabled(LogConfig.STATSLOG); - + private static final String LAST_SNAPSHOT_TIME_MILLIS = "LAST_SNAPSHOT_TIME_MILLIS"; private static final InstanceId DEFAULT_INSTANCE_ID = InstanceId.fakeInstanceId(0); // LauncherAtom.ItemInfo.getDefaultInstance() should be used but until launcher proto migrates // from nano to lite, bake constant to prevent robo test failure. @@ -113,6 +119,20 @@ public class StatsLogCompatManager extends StatsLogManager { @Override public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) { + long lastSnapshotTimeMillis = getDevicePrefs(mContext) + .getLong(LAST_SNAPSHOT_TIME_MILLIS, 0); + // Log snapshot only if previous snapshot was older than a day + if (currentTimeMillis() - lastSnapshotTimeMillis < DAY_IN_MILLIS) { + if (IS_VERBOSE) { + String elapsedTime = formatElapsedTime( + (currentTimeMillis() - lastSnapshotTimeMillis) / 1000); + Log.d(TAG, String.format( + "Skipped snapshot logging since previous snapshot was %s old.", + elapsedTime)); + } + return; + } + IntSparseArrayMap folders = dataModel.folders.clone(); ArrayList workspaceItems = (ArrayList) dataModel.workspaceItems.clone(); ArrayList appWidgets = (ArrayList) dataModel.appWidgets.clone(); @@ -135,10 +155,12 @@ public class StatsLogCompatManager extends StatsLogManager { LauncherAtom.ItemInfo atomInfo = info.buildProto(null); writeSnapshot(atomInfo, mInstanceId); } + getDevicePrefs(mContext).edit() + .putLong(LAST_SNAPSHOT_TIME_MILLIS, currentTimeMillis()).apply(); } } - private static void writeSnapshot(LauncherAtom.ItemInfo info, InstanceId instanceId) { + private void writeSnapshot(LauncherAtom.ItemInfo info, InstanceId instanceId) { if (IS_VERBOSE) { Log.d(TAG, String.format("\nwriteSnapshot(%d):\n%s", instanceId.getId(), info)); } From a4661192ff978ad2dbcb4923fcc86c5e245f5eef Mon Sep 17 00:00:00 2001 From: thiruram Date: Tue, 21 Jul 2020 23:17:32 -0700 Subject: [PATCH 30/72] Limit launcher snapshot logging once per day. This change will make sure launcher snapshot is logged only once in 24hrs interval using sharedpreference. Bug: 161375303 Change-Id: Iab6b25d931b2e91ae5647e266bd68ead86c99bc6 Merged-In: Iab6b25d931b2e91ae5647e266bd68ead86c99bc6 (cherry picked from commit efa41c1c522c039eefd85b1f3ae1c411010a8cf5) --- .../logging/StatsLogCompatManager.java | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index ba60185c79..a89319eacf 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -16,6 +16,10 @@ package com.android.quickstep.logging; +import static android.text.format.DateUtils.DAY_IN_MILLIS; +import static android.text.format.DateUtils.formatElapsedTime; + +import static com.android.launcher3.Utilities.getDevicePrefs; import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.FOLDER; import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.SEARCH_RESULT_CONTAINER; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_SNAPSHOT; @@ -24,6 +28,8 @@ import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGE import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__HOME; import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__OVERVIEW; +import static java.lang.System.currentTimeMillis; + import android.content.Context; import android.util.Log; @@ -71,8 +77,7 @@ public class StatsLogCompatManager extends StatsLogManager { private static final String TAG = "StatsLog"; private static final boolean IS_VERBOSE = Utilities.isPropertyEnabled(LogConfig.STATSLOG); - private static Context sContext; - + private static final String LAST_SNAPSHOT_TIME_MILLIS = "LAST_SNAPSHOT_TIME_MILLIS"; private static final InstanceId DEFAULT_INSTANCE_ID = InstanceId.fakeInstanceId(0); // LauncherAtom.ItemInfo.getDefaultInstance() should be used but until launcher proto migrates // from nano to lite, bake constant to prevent robo test failure. @@ -80,8 +85,10 @@ public class StatsLogCompatManager extends StatsLogManager { private static final int FOLDER_HIERARCHY_OFFSET = 100; private static final int SEARCH_RESULT_HIERARCHY_OFFSET = 200; + private final Context mContext; + public StatsLogCompatManager(Context context) { - sContext = context; + mContext = context; } @Override @@ -107,7 +114,7 @@ public class StatsLogCompatManager extends StatsLogManager { */ @Override public void logSnapshot() { - LauncherAppState.getInstance(sContext).getModel().enqueueModelUpdateTask( + LauncherAppState.getInstance(mContext).getModel().enqueueModelUpdateTask( new SnapshotWorker()); } @@ -122,6 +129,20 @@ public class StatsLogCompatManager extends StatsLogManager { @Override public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) { + long lastSnapshotTimeMillis = getDevicePrefs(mContext) + .getLong(LAST_SNAPSHOT_TIME_MILLIS, 0); + // Log snapshot only if previous snapshot was older than a day + if (currentTimeMillis() - lastSnapshotTimeMillis < DAY_IN_MILLIS) { + if (IS_VERBOSE) { + String elapsedTime = formatElapsedTime( + (currentTimeMillis() - lastSnapshotTimeMillis) / 1000); + Log.d(TAG, String.format( + "Skipped snapshot logging since previous snapshot was %s old.", + elapsedTime)); + } + return; + } + IntSparseArrayMap folders = dataModel.folders.clone(); ArrayList workspaceItems = (ArrayList) dataModel.workspaceItems.clone(); ArrayList appWidgets = (ArrayList) dataModel.appWidgets.clone(); @@ -144,10 +165,12 @@ public class StatsLogCompatManager extends StatsLogManager { LauncherAtom.ItemInfo atomInfo = info.buildProto(null); writeSnapshot(atomInfo, mInstanceId); } + getDevicePrefs(mContext).edit() + .putLong(LAST_SNAPSHOT_TIME_MILLIS, currentTimeMillis()).apply(); } } - private static void writeSnapshot(LauncherAtom.ItemInfo info, InstanceId instanceId) { + private void writeSnapshot(LauncherAtom.ItemInfo info, InstanceId instanceId) { if (IS_VERBOSE) { Log.d(TAG, String.format("\nwriteSnapshot(%d):\n%s", instanceId.getId(), info)); } @@ -266,7 +289,7 @@ public class StatsLogCompatManager extends StatsLogManager { } else { // Item is inside the folder, fetch folder info in a BG thread // and then write to StatsLog. - LauncherAppState.getInstance(sContext).getModel().enqueueModelUpdateTask( + LauncherAppState.getInstanceNoCreate().getModel().enqueueModelUpdateTask( new BaseModelUpdateTask() { @Override public void execute(LauncherAppState app, BgDataModel dataModel, From 3c3116826b087e6258e62f3dabbc7c5dc9eadaed Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Mon, 20 Jul 2020 13:23:08 -0700 Subject: [PATCH 31/72] Pass through touches in FolderIcon padding area Pass touch events happening in padding of folder icon to workspace. BubbleTextView already does this. Bug: 161014416 Test: Manual Change-Id: Ibfa24adb2d84efbfab36f02a2240837f03858e43 --- src/com/android/launcher3/folder/FolderIcon.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index 75275b20e5..32d061cb42 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -129,6 +129,8 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel private float mDotScale; private Animator mDotScaleAnim; + private Rect mTouchArea = new Rect(); + private final PointF mTranslationForReorderBounce = new PointF(0, 0); private final PointF mTranslationForReorderPreview = new PointF(0, 0); private float mScaleForReorderBounce = 1f; @@ -711,6 +713,11 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel @Override public boolean onTouchEvent(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN + && shouldIgnoreTouchDown(event.getX(), event.getY())) { + return false; + } + // Call the superclass onTouchEvent first, because sometimes it changes the state to // isPressed() on an ACTION_UP super.onTouchEvent(event); @@ -719,6 +726,15 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel return true; } + /** + * Returns true if the touch down at the provided position be ignored + */ + protected boolean shouldIgnoreTouchDown(float x, float y) { + mTouchArea.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(), + getHeight() - getPaddingBottom()); + return !mTouchArea.contains((int) x, (int) y); + } + @Override public void cancelLongPress() { super.cancelLongPress(); From ccf92c65871ac50c883df93791956486181a778c Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Thu, 16 Jul 2020 16:08:12 -0700 Subject: [PATCH 32/72] Use TouchDelegate to listen for icon view taps on RecentsView Using a negative margin to move the icon view to stick out above the task prevents that part sticking out from receiving touches. They go directly through to RecentsView, which interprets it as a touch to home. Now we use a touch delegate that recents view passes touches to before processing it directly. Note we can't override should steal touches from children in LauncherRecentsView because the icon view isn't actually seen as a child of RecentsView if it's outside of the task view area. Fixes: 159820339 Test: Touching anywhere on the icon works. Scrolled to previous/next tasks and in different rotations and verified tap registers correctly. Change-Id: I4559c34b20079e06aac401e2c93ac36a74b653ea --- .../android/quickstep/views/RecentsView.java | 11 +++++ .../com/android/quickstep/views/TaskView.java | 44 ++++++++++++++++--- 2 files changed, 50 insertions(+), 5 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 027a737cef..ac9049f869 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 @@ -78,6 +78,7 @@ import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; +import android.view.TouchDelegate; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; @@ -648,6 +649,16 @@ public abstract class RecentsView extends PagedView @Override public boolean onTouchEvent(MotionEvent ev) { super.onTouchEvent(ev); + + TaskView taskView = getCurrentPageTaskView(); + if (taskView != null) { + TouchDelegate mChildTouchDelegate = taskView.getIconTouchDelegate(ev); + if (mChildTouchDelegate != null && mChildTouchDelegate.onTouchEvent(ev)) { + // Keep consuming events to pass to delegate + return true; + } + } + final int x = (int) ev.getX(); final int y = (int) ev.getY(); switch (ev.getAction()) { 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 222f6e6728..2058a7f375 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 @@ -22,16 +22,19 @@ import static android.view.Gravity.CENTER_VERTICAL; import static android.view.Gravity.END; import static android.view.Gravity.START; import static android.view.Gravity.TOP; +import static android.view.Surface.ROTATION_180; +import static android.view.Surface.ROTATION_270; +import static android.view.Surface.ROTATION_90; import static android.widget.Toast.LENGTH_SHORT; import static com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION; import static com.android.launcher3.Utilities.comp; +import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; -import static com.android.launcher3.logging.StatsLogManager.LauncherEvent - .LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP; import android.animation.Animator; @@ -53,7 +56,9 @@ import android.os.Handler; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Log; +import android.view.MotionEvent; import android.view.Surface; +import android.view.TouchDelegate; import android.view.View; import android.view.ViewOutlineProvider; import android.view.accessibility.AccessibilityNodeInfo; @@ -78,6 +83,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.ComponentKey; +import com.android.launcher3.util.TransformingTouchDelegate; import com.android.launcher3.util.ViewPool.Reusable; import com.android.quickstep.RecentsModel; import com.android.quickstep.TaskIconCache; @@ -122,6 +128,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { public static final long SCALE_ICON_DURATION = 120; private static final long DIM_ANIM_DURATION = 700; + /** + * This technically can be a vanilla {@link TouchDelegate} class, however that class requires + * setting the touch bounds at construction, so we'd repeatedly be created many instances + * unnecessarily as scrolling occurs, whereas {@link TransformingTouchDelegate} allows touch + * delegated bounds only to be updated. + */ + private TransformingTouchDelegate mIconTouchDelegate; private static final List SYSTEM_GESTURE_EXCLUSION_RECT = Collections.singletonList(new Rect()); @@ -186,6 +199,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private int mStackHeight; private View mContextualChipWrapper; private View mContextualChip; + private final float[] mIconCenterCoords = new float[2]; public TaskView(Context context) { this(context, null); @@ -246,6 +260,26 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { super.onFinishInflate(); mSnapshotView = findViewById(R.id.snapshot); mIconView = findViewById(R.id.icon); + mIconTouchDelegate = new TransformingTouchDelegate(mIconView); + } + + public TouchDelegate getIconTouchDelegate(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + computeAndSetIconTouchDelegate(); + } + return mIconTouchDelegate; + } + + private void computeAndSetIconTouchDelegate() { + float iconHalfSize = mIconView.getWidth() / 2f; + mIconCenterCoords[0] = mIconCenterCoords[1] = iconHalfSize; + getDescendantCoordRelativeToAncestor(mIconView, mActivity.getDragLayer(), mIconCenterCoords, + false); + mIconTouchDelegate.setBounds( + (int) (mIconCenterCoords[0] - iconHalfSize), + (int) (mIconCenterCoords[1] - iconHalfSize), + (int) (mIconCenterCoords[0] + iconHalfSize), + (int) (mIconCenterCoords[1] + iconHalfSize)); } /** @@ -468,18 +502,18 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { int thumbnailPadding = (int) getResources().getDimension(R.dimen.task_thumbnail_top_margin); LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams(); switch (orientationHandler.getRotation()) { - case Surface.ROTATION_90: + case ROTATION_90: iconParams.gravity = (isRtl ? START : END) | CENTER_VERTICAL; iconParams.rightMargin = -thumbnailPadding; iconParams.leftMargin = 0; iconParams.topMargin = snapshotParams.topMargin / 2; break; - case Surface.ROTATION_180: + case ROTATION_180: iconParams.gravity = BOTTOM | CENTER_HORIZONTAL; iconParams.bottomMargin = -thumbnailPadding; iconParams.leftMargin = iconParams.topMargin = iconParams.rightMargin = 0; break; - case Surface.ROTATION_270: + case ROTATION_270: iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL; iconParams.leftMargin = -thumbnailPadding; iconParams.rightMargin = 0; From 457ae09acc35e511c5423b3eeea5220ef719c4f4 Mon Sep 17 00:00:00 2001 From: alexmang Date: Sat, 18 Jul 2020 14:34:12 -0700 Subject: [PATCH 33/72] Add filtering of preferences in developer options Search will recursively go into each preference group and set visibility of preferences based on title match. If a preference group (category) has no preferences, we will hide that preference group as well. All queries and titles are sanitized by turning them to lower case and replacing underscores with spaces for convenience. Change-Id: Ibdc689d74d0c872c92c1d523bbc0efdb9e31aecd --- res/layout/home_settings.xml | 21 ++++++++ res/values/dimens.xml | 3 ++ res/values/strings.xml | 3 +- res/values/styles.xml | 9 ++++ .../settings/DeveloperOptionsFragment.java | 51 +++++++++++++++++++ 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 res/layout/home_settings.xml diff --git a/res/layout/home_settings.xml b/res/layout/home_settings.xml new file mode 100644 index 0000000000..0f2461ad9e --- /dev/null +++ b/res/layout/home_settings.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 947e635d73..969765f121 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -247,6 +247,9 @@ 12sp 14sp + + 10dp + 8dp diff --git a/res/values/strings.xml b/res/values/strings.xml index 935bb40fb3..80b511a54c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -348,7 +348,8 @@ Work profile is paused. Work apps can\’t send you notifications, use your battery, or access your location - + + Filter Pause work apps and notifications diff --git a/res/values/styles.xml b/res/values/styles.xml index 25f21f35ec..3b9532eeee 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -149,6 +149,15 @@ + + + + - diff --git a/res/drawable/drag_handle_indicator_no_shadow.xml b/res/drawable/drag_handle_indicator_no_shadow.xml deleted file mode 100644 index 341e60cda9..0000000000 --- a/res/drawable/drag_handle_indicator_no_shadow.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml index a13790826b..0c18c8a2ba 100644 --- a/res/layout/launcher.xml +++ b/res/layout/launcher.xml @@ -28,6 +28,12 @@ android:clipToPadding="false" android:importantForAccessibility="no"> + + 1dp 0dp - - 4dp - 18dp - 6dp - 1dp - 48dp - 16dp - 48dp 20dp diff --git a/res/values/drawables.xml b/res/values/drawables.xml index 7d631426cb..9c57ec1214 100644 --- a/res/values/drawables.xml +++ b/res/values/drawables.xml @@ -18,5 +18,4 @@ @drawable/ic_remove_no_shadow @drawable/ic_uninstall_no_shadow @drawable/ic_block_no_shadow - @drawable/drag_handle_indicator_no_shadow \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 80b511a54c..12beeeb566 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -36,7 +36,7 @@ Shortcut isn\'t available - Home screen + Home Custom actions @@ -88,10 +88,6 @@ Personal apps list Work apps list - - Home - Remove diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index e49c4559f0..f9fba6f80f 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -453,10 +453,10 @@ public class Launcher extends StatefulActivity implements Launche mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha); } else if (finalState == OVERVIEW || finalState == OVERVIEW_PEEK) { mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha); - mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha); + mScrimView.setAlpha(alpha); } else { mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f); - mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f); + mScrimView.setAlpha(1f); } } }); @@ -553,7 +553,7 @@ public class Launcher extends StatefulActivity implements Launche mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha); } else if (state == OVERVIEW || state == OVERVIEW_PEEK) { mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha); - mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha); + mScrimView.setAlpha(alpha); } } @@ -1936,7 +1936,7 @@ public class Launcher extends StatefulActivity implements Launche // Populate event with a fake title based on the current state. // TODO: When can workspace be null? text.add(mWorkspace == null - ? getString(R.string.all_apps_home_button_label) + ? getString(R.string.home_screen) : mStateManager.getState().getDescription(this)); return result; } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 15e0daa8ea..3be9ac7e07 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -3263,7 +3263,7 @@ public class Workspace extends PagedView } if (nScreens == 0) { // When the workspace is not loaded, we do not know how many screen will be bound. - return getContext().getString(R.string.all_apps_home_button_label); + return getContext().getString(R.string.home_screen); } return getContext().getString(R.string.workspace_scroll_format, page + 1, nScreens); } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 5b00631659..1224cb0080 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -19,7 +19,6 @@ import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT; import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA; import static com.android.launcher3.LauncherState.APPS_VIEW_ITEM_MASK; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.LauncherState.VERTICAL_SWIPE_INDICATOR; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; @@ -222,9 +221,6 @@ public class AllAppsTransitionController implements StateHandler, mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade); - setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA, - (visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, allAppsFade); - // Set visibility of the container at the very beginning or end of the transition. setter.setViewAlpha(mAppsView, hasAnyVisibleItem ? 1 : 0, hasAnyVisibleItem ? INSTANT : FINAL_FRAME); diff --git a/src/com/android/launcher3/util/OnboardingPrefs.java b/src/com/android/launcher3/util/OnboardingPrefs.java index 26313e5a21..6e5e7d9355 100644 --- a/src/com/android/launcher3/util/OnboardingPrefs.java +++ b/src/com/android/launcher3/util/OnboardingPrefs.java @@ -36,7 +36,6 @@ public class OnboardingPrefs { public static final String SHELF_BOUNCE_SEEN = "launcher.shelf_bounce_seen"; public static final String HOME_BOUNCE_COUNT = "launcher.home_bounce_count"; public static final String SHELF_BOUNCE_COUNT = "launcher.shelf_bounce_count"; - public static final String ALL_APPS_COUNT = "launcher.all_apps_count"; public static final String HOTSEAT_DISCOVERY_TIP_COUNT = "launcher.hotseat_discovery_tip_count"; public static final String HOTSEAT_LONGPRESS_TIP_SEEN = "launcher.hotseat_longpress_tip_seen"; @@ -56,7 +55,6 @@ public class OnboardingPrefs { @StringDef(value = { HOME_BOUNCE_COUNT, SHELF_BOUNCE_COUNT, - ALL_APPS_COUNT, HOTSEAT_DISCOVERY_TIP_COUNT }) @Retention(RetentionPolicy.SOURCE) @@ -67,7 +65,6 @@ public class OnboardingPrefs { Map maxCounts = new ArrayMap<>(4); maxCounts.put(HOME_BOUNCE_COUNT, 3); maxCounts.put(SHELF_BOUNCE_COUNT, 3); - maxCounts.put(ALL_APPS_COUNT, 5); maxCounts.put(HOTSEAT_DISCOVERY_TIP_COUNT, 5); MAX_COUNTS = Collections.unmodifiableMap(maxCounts); } diff --git a/src/com/android/launcher3/views/AccessibilityActionsView.java b/src/com/android/launcher3/views/AccessibilityActionsView.java new file mode 100644 index 0000000000..0eacaa3009 --- /dev/null +++ b/src/com/android/launcher3/views/AccessibilityActionsView.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.views; + +import static com.android.launcher3.LauncherState.ALL_APPS; +import static com.android.launcher3.LauncherState.NORMAL; + +import android.content.Context; +import android.os.Bundle; +import android.util.AttributeSet; +import android.view.View; +import android.view.accessibility.AccessibilityNodeInfo; +import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; + +import androidx.annotation.Nullable; + +import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherState; +import com.android.launcher3.R; +import com.android.launcher3.statemanager.StateManager.StateListener; +import com.android.launcher3.views.OptionsPopupView.OptionItem; + +/** + * Placeholder view to expose additional Launcher actions via accessibility actions + */ +public class AccessibilityActionsView extends View implements StateListener { + + public AccessibilityActionsView(Context context) { + this(context, null); + } + + public AccessibilityActionsView(Context context, @Nullable AttributeSet attrs) { + this(context, attrs, 0); + } + + public AccessibilityActionsView(Context context, @Nullable AttributeSet attrs, + int defStyleAttr) { + super(context, attrs, defStyleAttr); + Launcher.getLauncher(context).getStateManager().addStateListener(this); + setWillNotDraw(true); + } + + @Override + public void onStateTransitionComplete(LauncherState finalState) { + setImportantForAccessibility(finalState == NORMAL + ? IMPORTANT_FOR_ACCESSIBILITY_YES : IMPORTANT_FOR_ACCESSIBILITY_NO); + } + + @Override + public AccessibilityNodeInfo createAccessibilityNodeInfo() { + AccessibilityNodeInfo info = super.createAccessibilityNodeInfo(); + Launcher l = Launcher.getLauncher(getContext()); + info.addAction(new AccessibilityAction( + R.string.all_apps_button_label, l.getText(R.string.all_apps_button_label))); + for (OptionItem item : OptionsPopupView.getOptions(l)) { + info.addAction(new AccessibilityAction(item.labelRes, l.getText(item.labelRes))); + } + return info; + } + + @Override + public boolean performAccessibilityAction(int action, Bundle arguments) { + if (super.performAccessibilityAction(action, arguments)) { + return true; + } + Launcher l = Launcher.getLauncher(getContext()); + if (action == R.string.all_apps_button_label) { + l.getStateManager().goToState(ALL_APPS); + return true; + } + for (OptionItem item : OptionsPopupView.getOptions(l)) { + if (item.labelRes == action) { + if (item.eventId.getId() > 0) { + l.getStatsLogManager().logger().log(item.eventId); + } + if (item.clickListener.onLongClick(this)) { + return true; + } + } + } + return false; + } +} diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java index 049a1acbf3..e95dc5b83f 100644 --- a/src/com/android/launcher3/views/OptionsPopupView.java +++ b/src/com/android/launcher3/views/OptionsPopupView.java @@ -85,10 +85,10 @@ public class OptionsPopupView extends ArrowPopup if (item == null) { return false; } - if (item.mEventId.getId() > 0) { - mLauncher.getStatsLogManager().logger().log(item.mEventId); + if (item.eventId.getId() > 0) { + mLauncher.getStatsLogManager().logger().log(item.eventId); } - if (item.mClickListener.onLongClick(view)) { + if (item.clickListener.onLongClick(view)) { close(true); return true; } @@ -130,8 +130,8 @@ public class OptionsPopupView extends ArrowPopup for (OptionItem item : items) { DeepShortcutView view = (DeepShortcutView) popup.inflateAndAdd(R.layout.system_shortcut, popup); - view.getIconView().setBackgroundResource(item.mIconRes); - view.getBubbleText().setText(item.mLabelRes); + view.getIconView().setBackgroundResource(item.iconRes); + view.getBubbleText().setText(item.labelRes); view.setDividerVisibility(View.INVISIBLE); view.setOnClickListener(popup); view.setOnLongClickListener(popup); @@ -152,7 +152,13 @@ public class OptionsPopupView extends ArrowPopup y = launcher.getDragLayer().getHeight() / 2; } RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize); + show(launcher, target, getOptions(launcher)); + } + /** + * Returns the list of supported actions + */ + public static ArrayList getOptions(Launcher launcher) { ArrayList options = new ArrayList<>(); int resString = Utilities.existsStyleWallpapers(launcher) ? R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text; @@ -170,10 +176,10 @@ public class OptionsPopupView extends ArrowPopup LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS, OptionsPopupView::startSettings)); - show(launcher, target, options); + return options; } - public static boolean onWidgetsClicked(View view) { + private static boolean onWidgetsClicked(View view) { return openWidgets(Launcher.getLauncher(view.getContext())) != null; } @@ -188,7 +194,7 @@ public class OptionsPopupView extends ArrowPopup } } - public static boolean startSettings(View view) { + private static boolean startSettings(View view) { TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "start: startSettings"); Launcher launcher = Launcher.getLauncher(view.getContext()); launcher.startActivity(new Intent(Intent.ACTION_APPLICATION_PREFERENCES) @@ -201,7 +207,7 @@ public class OptionsPopupView extends ArrowPopup * Event handler for the wallpaper picker button that appears after a long press * on the home screen. */ - public static boolean startWallpaperPicker(View v) { + private static boolean startWallpaperPicker(View v) { Launcher launcher = Launcher.getLauncher(v.getContext()); if (!Utilities.isWallpaperAllowed(launcher)) { Toast.makeText(launcher, R.string.msg_disabled_by_admin, Toast.LENGTH_SHORT).show(); @@ -233,17 +239,17 @@ public class OptionsPopupView extends ArrowPopup public static class OptionItem { - private final int mLabelRes; - private final int mIconRes; - private final EventEnum mEventId; - private final OnLongClickListener mClickListener; + public final int labelRes; + public final int iconRes; + public final EventEnum eventId; + public final OnLongClickListener clickListener; public OptionItem(int labelRes, int iconRes, EventEnum eventId, OnLongClickListener clickListener) { - mLabelRes = labelRes; - mIconRes = iconRes; - mEventId = eventId; - mClickListener = clickListener; + this.labelRes = labelRes; + this.iconRes = iconRes; + this.eventId = eventId; + this.clickListener = clickListener; } } } diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java index 22faf97cc4..7f0765becd 100644 --- a/src/com/android/launcher3/views/ScrimView.java +++ b/src/com/android/launcher3/views/ScrimView.java @@ -15,119 +15,37 @@ */ package com.android.launcher3.views; -import static android.content.Context.ACCESSIBILITY_SERVICE; -import static android.view.MotionEvent.ACTION_DOWN; - import static androidx.core.graphics.ColorUtils.compositeColors; -import static com.android.launcher3.LauncherState.ALL_APPS; -import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL; -import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.anim.Interpolators.clampToProgress; import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound; import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.Keyframe; -import android.animation.ObjectAnimator; -import android.animation.PropertyValuesHolder; -import android.animation.RectEvaluator; import android.content.Context; -import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Point; import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.drawable.Drawable; -import android.os.Bundle; import android.util.AttributeSet; -import android.util.IntProperty; -import android.view.KeyEvent; -import android.view.MotionEvent; import android.view.View; -import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.core.graphics.ColorUtils; -import androidx.core.view.ViewCompat; -import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; -import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; -import androidx.customview.widget.ExploreByTouchHelper; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.Utilities; -import com.android.launcher3.statemanager.StateManager; -import com.android.launcher3.statemanager.StateManager.StateListener; import com.android.launcher3.uioverrides.WallpaperColorInfo; import com.android.launcher3.uioverrides.WallpaperColorInfo.OnChangeListener; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action; -import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; -import com.android.launcher3.util.MultiValueAlpha; -import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.launcher3.util.Themes; -import com.android.launcher3.widget.WidgetsFullSheet; - -import java.util.List; /** * Simple scrim which draws a flat color */ -public class ScrimView extends View implements Insettable, OnChangeListener, - AccessibilityStateChangeListener { - - public static final IntProperty DRAG_HANDLE_ALPHA = - new IntProperty("dragHandleAlpha") { - - @Override - public Integer get(ScrimView scrimView) { - return scrimView.mDragHandleAlpha; - } - - @Override - public void setValue(ScrimView scrimView, int value) { - scrimView.setDragHandleAlpha(value); - } - }; - private static final int WALLPAPERS = R.string.wallpaper_button_text; - private static final int WIDGETS = R.string.widget_button_text; - private static final int SETTINGS = R.string.settings_button_text; - private static final int ALPHA_CHANNEL_COUNT = 1; - - private static final long DRAG_HANDLE_BOUNCE_DURATION_MS = 300; - // How much to delay before repeating the bounce. - private static final long DRAG_HANDLE_BOUNCE_DELAY_MS = 200; - // Repeat this many times (i.e. total number of bounces is 1 + this). - private static final int DRAG_HANDLE_BOUNCE_REPEAT_COUNT = 2; - - private final Rect mTempRect = new Rect(); - private final int[] mTempPos = new int[2]; +public class ScrimView extends View implements Insettable, OnChangeListener { protected final T mLauncher; private final WallpaperColorInfo mWallpaperColorInfo; - private final AccessibilityManager mAM; protected final int mEndScrim; protected final boolean mIsScrimDark; - private final StateListener mAccessibilityLauncherStateListener = - new StateListener() { - @Override - public void onStateTransitionComplete(LauncherState finalState) { - setImportantForAccessibility(finalState == ALL_APPS - ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - : IMPORTANT_FOR_ACCESSIBILITY_AUTO); - } - }; - protected float mMaxScrimAlpha; protected float mProgress = 1; @@ -137,22 +55,6 @@ public class ScrimView extends View implements Insettable, O protected int mEndFlatColor; protected int mEndFlatColorAlpha; - protected final Point mDragHandleSize; - private final int mDragHandleTouchSize; - private final int mDragHandlePaddingInVerticalBarLayout; - protected float mDragHandleOffset; - private final Rect mDragHandleBounds; - private final RectF mHitRect = new RectF(); - private ObjectAnimator mDragHandleAnim; - - private final MultiValueAlpha mMultiValueAlpha; - - private final AccessibilityHelper mAccessibilityHelper; - @Nullable - protected Drawable mDragHandle; - - private int mDragHandleAlpha = 255; - public ScrimView(Context context, AttributeSet attrs) { super(context, attrs); mLauncher = Launcher.cast(Launcher.getLauncher(context)); @@ -161,59 +63,24 @@ public class ScrimView extends View implements Insettable, O mIsScrimDark = ColorUtils.calculateLuminance(mEndScrim) < 0.5f; mMaxScrimAlpha = 0.7f; - - Resources res = context.getResources(); - mDragHandleSize = new Point(res.getDimensionPixelSize(R.dimen.vertical_drag_handle_width), - res.getDimensionPixelSize(R.dimen.vertical_drag_handle_height)); - mDragHandleBounds = new Rect(0, 0, mDragHandleSize.x, mDragHandleSize.y); - mDragHandleTouchSize = res.getDimensionPixelSize(R.dimen.vertical_drag_handle_touch_size); - mDragHandlePaddingInVerticalBarLayout = context.getResources() - .getDimensionPixelSize(R.dimen.vertical_drag_handle_padding_in_vertical_bar_layout); - - mAccessibilityHelper = createAccessibilityHelper(); - ViewCompat.setAccessibilityDelegate(this, mAccessibilityHelper); - - mAM = (AccessibilityManager) context.getSystemService(ACCESSIBILITY_SERVICE); setFocusable(false); - mMultiValueAlpha = new MultiValueAlpha(this, ALPHA_CHANNEL_COUNT); - } - - public AlphaProperty getAlphaProperty(int index) { - return mMultiValueAlpha.getProperty(index); - } - - @NonNull - protected AccessibilityHelper createAccessibilityHelper() { - return new AccessibilityHelper(); } @Override - public void setInsets(Rect insets) { - updateDragHandleBounds(); - updateDragHandleVisibility(); - } + public void setInsets(Rect insets) { } - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - updateDragHandleBounds(); - } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); mWallpaperColorInfo.addOnChangeListener(this); onExtractedColorsChanged(mWallpaperColorInfo); - - mAM.addAccessibilityStateChangeListener(this); - onAccessibilityStateChanged(mAM.isEnabled()); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mWallpaperColorInfo.removeOnChangeListener(this); - mAM.removeAccessibilityStateChangeListener(this); } @Override @@ -234,10 +101,8 @@ public class ScrimView extends View implements Insettable, O public void setProgress(float progress) { if (mProgress != progress) { mProgress = progress; - stopDragHandleEducationAnim(); updateColors(); updateSysUiColors(); - updateDragHandleAlpha(); invalidate(); } } @@ -260,286 +125,10 @@ public class ScrimView extends View implements Insettable, O } } - protected void updateDragHandleAlpha() { - if (mDragHandle != null) { - mDragHandle.setAlpha(mDragHandleAlpha); - } - } - - private void setDragHandleAlpha(int alpha) { - if (alpha != mDragHandleAlpha) { - mDragHandleAlpha = alpha; - if (mDragHandle != null) { - mDragHandle.setAlpha(mDragHandleAlpha); - invalidate(); - } - } - } - @Override protected void onDraw(Canvas canvas) { if (mCurrentFlatColor != 0) { canvas.drawColor(mCurrentFlatColor); } - drawDragHandle(canvas); - } - - protected void drawDragHandle(Canvas canvas) { - if (mDragHandle != null) { - canvas.translate(0, -mDragHandleOffset); - mDragHandle.draw(canvas); - canvas.translate(0, mDragHandleOffset); - } - } - - @Override - public boolean onTouchEvent(MotionEvent event) { - boolean superHandledTouch = super.onTouchEvent(event); - if (event.getAction() == ACTION_DOWN) { - if (!superHandledTouch && mHitRect.contains(event.getX(), event.getY())) { - if (startDragHandleEducationAnim()) { - return true; - } - } - stopDragHandleEducationAnim(); - } - return superHandledTouch; - } - - /** - * Animates the drag handle to demonstrate how to get to all apps. - * @return Whether the animation was started (false if drag handle is invisible). - */ - public boolean startDragHandleEducationAnim() { - stopDragHandleEducationAnim(); - - if (mDragHandle == null || mDragHandle.getAlpha() != 255) { - return false; - } - - final Drawable drawable = mDragHandle; - mDragHandle = null; - - Rect bounds = new Rect(mDragHandleBounds); - bounds.offset(0, -(int) mDragHandleOffset); - drawable.setBounds(bounds); - - Rect topBounds = new Rect(bounds); - topBounds.offset(0, -bounds.height()); - - Rect invalidateRegion = new Rect(bounds); - invalidateRegion.top = topBounds.top; - - final float progressToReachTop = 0.6f; - Keyframe frameTop = Keyframe.ofObject(progressToReachTop, topBounds); - frameTop.setInterpolator(DEACCEL); - Keyframe frameBot = Keyframe.ofObject(1, bounds); - frameBot.setInterpolator(ACCEL_DEACCEL); - PropertyValuesHolder holder = PropertyValuesHolder.ofKeyframe("bounds", - Keyframe.ofObject(0, bounds), frameTop, frameBot); - holder.setEvaluator(new RectEvaluator()); - - mDragHandleAnim = ObjectAnimator.ofPropertyValuesHolder(drawable, holder); - long totalBounceDuration = DRAG_HANDLE_BOUNCE_DURATION_MS + DRAG_HANDLE_BOUNCE_DELAY_MS; - // The bounce finishes by this progress, the rest of the duration just delays next bounce. - float delayStartProgress = 1f - (float) DRAG_HANDLE_BOUNCE_DELAY_MS / totalBounceDuration; - mDragHandleAnim.addUpdateListener((v) -> invalidate(invalidateRegion)); - mDragHandleAnim.setDuration(totalBounceDuration); - mDragHandleAnim.setInterpolator(clampToProgress(LINEAR, 0, delayStartProgress)); - mDragHandleAnim.setRepeatCount(DRAG_HANDLE_BOUNCE_REPEAT_COUNT); - getOverlay().add(drawable); - - mDragHandleAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mDragHandleAnim = null; - getOverlay().remove(drawable); - updateDragHandleVisibility(drawable); - } - }); - mDragHandleAnim.start(); - return true; - } - - private void stopDragHandleEducationAnim() { - if (mDragHandleAnim != null) { - mDragHandleAnim.end(); - } - } - - protected void updateDragHandleBounds() { - DeviceProfile grid = mLauncher.getDeviceProfile(); - final int left; - final int width = getMeasuredWidth(); - final int top = getMeasuredHeight() - mDragHandleSize.y - grid.getInsets().bottom; - final int topMargin; - - if (grid.isVerticalBarLayout()) { - topMargin = grid.workspacePadding.bottom + mDragHandlePaddingInVerticalBarLayout; - if (grid.isSeascape()) { - left = width - grid.getInsets().right - mDragHandleSize.x - - mDragHandlePaddingInVerticalBarLayout; - } else { - left = grid.getInsets().left + mDragHandlePaddingInVerticalBarLayout; - } - } else { - left = Math.round((width - mDragHandleSize.x) / 2f); - topMargin = grid.hotseatBarSizePx; - } - mDragHandleBounds.offsetTo(left, top - topMargin); - mHitRect.set(mDragHandleBounds); - // Inset outwards to increase touch size. - mHitRect.inset((mDragHandleSize.x - mDragHandleTouchSize) / 2f, - (mDragHandleSize.y - mDragHandleTouchSize) / 2f); - - if (mDragHandle != null) { - mDragHandle.setBounds(mDragHandleBounds); - } - } - - @Override - public void onAccessibilityStateChanged(boolean enabled) { - StateManager stateManager = mLauncher.getStateManager(); - stateManager.removeStateListener(mAccessibilityLauncherStateListener); - - if (enabled) { - stateManager.addStateListener(mAccessibilityLauncherStateListener); - mAccessibilityLauncherStateListener.onStateTransitionComplete(stateManager.getState()); - } else { - setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); - } - updateDragHandleVisibility(); - } - - public void updateDragHandleVisibility() { - updateDragHandleVisibility(null); - } - - private void updateDragHandleVisibility(@Nullable Drawable recycle) { - boolean visible = shouldDragHandleBeVisible(); - boolean wasVisible = mDragHandle != null; - if (visible != wasVisible) { - if (visible) { - mDragHandle = recycle != null ? recycle : - mLauncher.getDrawable(R.drawable.drag_handle_indicator_shadow); - mDragHandle.setBounds(mDragHandleBounds); - - updateDragHandleAlpha(); - } else { - mDragHandle = null; - } - invalidate(); - } - } - - protected boolean shouldDragHandleBeVisible() { - return mLauncher.getDeviceProfile().isVerticalBarLayout() || mAM.isEnabled(); - } - - @Override - public boolean dispatchHoverEvent(MotionEvent event) { - return mAccessibilityHelper.dispatchHoverEvent(event) || super.dispatchHoverEvent(event); - } - - @Override - public boolean dispatchKeyEvent(KeyEvent event) { - return mAccessibilityHelper.dispatchKeyEvent(event) || super.dispatchKeyEvent(event); - } - - @Override - public void onFocusChanged(boolean gainFocus, int direction, - Rect previouslyFocusedRect) { - super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); - mAccessibilityHelper.onFocusChanged(gainFocus, direction, previouslyFocusedRect); - } - - protected class AccessibilityHelper extends ExploreByTouchHelper { - - private static final int DRAG_HANDLE_ID = 1; - - public AccessibilityHelper() { - super(ScrimView.this); - } - - @Override - protected int getVirtualViewAt(float x, float y) { - return mHitRect.contains((int) x, (int) y) - ? DRAG_HANDLE_ID : INVALID_ID; - } - - @Override - protected void getVisibleVirtualViews(List virtualViewIds) { - virtualViewIds.add(DRAG_HANDLE_ID); - } - - @Override - protected void onPopulateNodeForVirtualView(int virtualViewId, - AccessibilityNodeInfoCompat node) { - node.setContentDescription(getContext().getString(R.string.all_apps_button_label)); - node.setBoundsInParent(mDragHandleBounds); - - getLocationOnScreen(mTempPos); - mTempRect.set(mDragHandleBounds); - mTempRect.offset(mTempPos[0], mTempPos[1]); - node.setBoundsInScreen(mTempRect); - - node.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK); - node.setClickable(true); - node.setFocusable(true); - - if (mLauncher.isInState(NORMAL)) { - Context context = getContext(); - if (Utilities.isWallpaperAllowed(context)) { - node.addAction( - new AccessibilityActionCompat(WALLPAPERS, context.getText(WALLPAPERS))); - } - node.addAction(new AccessibilityActionCompat(WIDGETS, context.getText(WIDGETS))); - node.addAction(new AccessibilityActionCompat(SETTINGS, context.getText(SETTINGS))); - } - } - - @Override - protected boolean onPerformActionForVirtualView( - int virtualViewId, int action, Bundle arguments) { - if (action == AccessibilityNodeInfoCompat.ACTION_CLICK) { - mLauncher.getUserEventDispatcher().logActionOnControl( - Action.Touch.TAP, ControlType.ALL_APPS_BUTTON, - mLauncher.getStateManager().getState().containerType); - mLauncher.getStateManager().goToState(ALL_APPS); - return true; - } else if (action == WALLPAPERS) { - return OptionsPopupView.startWallpaperPicker(ScrimView.this); - } else if (action == WIDGETS) { - int originalImportanceForAccessibility = getImportantForAccessibility(); - setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); - WidgetsFullSheet widgetsFullSheet = OptionsPopupView.openWidgets(mLauncher); - if (widgetsFullSheet == null) { - setImportantForAccessibility(originalImportanceForAccessibility); - return false; - } - widgetsFullSheet.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { - @Override - public void onViewAttachedToWindow(View view) {} - - @Override - public void onViewDetachedFromWindow(View view) { - setImportantForAccessibility(originalImportanceForAccessibility); - widgetsFullSheet.removeOnAttachStateChangeListener(this); - } - }); - return true; - } else if (action == SETTINGS) { - return OptionsPopupView.startSettings(ScrimView.this); - } - - return false; - } - } - - /** - * @return The top of this scrim view, or {@link Float#MAX_VALUE} if there's no distinct top. - */ - public float getVisualTop() { - return Float.MAX_VALUE; } } From df10ff46bd916e7bd0f685f8c59af8783d52906d Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Sun, 26 Jul 2020 19:11:14 -0700 Subject: [PATCH 56/72] Migrate AllAppsSearch [part 1/3] [Video attached to bug report] Setup DeviceSearchAlgorithm to handle on device search Bug: 161801950 Test: Manual Change-Id: Ib55f415f9992ceab687bbbfe904d153157541648 --- res/layout/search_section_title.xml | 25 +++++ res/values/strings.xml | 4 + .../launcher3/allapps/AllAppsGridAdapter.java | 9 ++ .../allapps/AllAppsRecyclerView.java | 1 + .../allapps/AlphabeticalAppsList.java | 94 ++++++++++--------- .../search/AllAppsSearchBarController.java | 7 +- .../search/AppsSearchContainerLayout.java | 13 +-- .../allapps/search/AppsSearchPipeline.java | 92 ++++++++++++++++++ .../search/DefaultAppSearchAlgorithm.java | 34 ++----- .../allapps/search/SearchPipeline.java | 32 +++++++ .../allapps/search/SearchSectionInfo.java | 36 +++++++ 11 files changed, 267 insertions(+), 80 deletions(-) create mode 100644 res/layout/search_section_title.xml create mode 100644 src/com/android/launcher3/allapps/search/AppsSearchPipeline.java create mode 100644 src/com/android/launcher3/allapps/search/SearchPipeline.java create mode 100644 src/com/android/launcher3/allapps/search/SearchSectionInfo.java diff --git a/res/layout/search_section_title.xml b/res/layout/search_section_title.xml new file mode 100644 index 0000000000..9ab27c1620 --- /dev/null +++ b/res/layout/search_section_title.xml @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 80b511a54c..0ec0581457 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -67,6 +67,10 @@ App + + + Apps + Notifications diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index d65316090c..dec92df2d3 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -66,6 +66,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter mSearchResults; + private ArrayList mSearchResults; private AllAppsGridAdapter mAdapter; private AppInfoComparator mAppNameComparator; private final int mNumAppsPerRow; @@ -210,10 +225,10 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { } /** - * Sets the sorted list of filtered components. + * Sets results list for search */ - public boolean setOrderedFilter(ArrayList f) { - if (mSearchResults != f) { + public boolean setSearchResults(ArrayList f) { + if (f == null || mSearchResults != f) { boolean same = mSearchResults != null && mSearchResults.equals(f); mSearchResults = f; onAppsUpdated(); @@ -298,35 +313,42 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { // Recreate the filtered and sectioned apps (for convenience for the grid layout) from the // ordered set of sections - for (AppInfo info : getFiltersAppInfos()) { - String sectionName = info.sectionName; + if (!hasFilter()) { + for (AppInfo info : mApps) { + String sectionName = info.sectionName; - // Create a new section if the section names do not match - if (!sectionName.equals(lastSectionName)) { - lastSectionName = sectionName; - lastFastScrollerSectionInfo = new FastScrollSectionInfo(sectionName); - mFastScrollerSections.add(lastFastScrollerSectionInfo); + // Create a new section if the section names do not match + if (!sectionName.equals(lastSectionName)) { + lastSectionName = sectionName; + lastFastScrollerSectionInfo = new FastScrollSectionInfo(sectionName); + mFastScrollerSections.add(lastFastScrollerSectionInfo); + } + + // Create an app item + AdapterItem appItem = AdapterItem.asApp(position++, sectionName, info, appIndex++); + if (lastFastScrollerSectionInfo.fastScrollToItem == null) { + lastFastScrollerSectionInfo.fastScrollToItem = appItem; + } + mAdapterItems.add(appItem); + mFilteredApps.add(info); } + } else { + mAdapterItems.addAll(mSearchResults); + List appInfos = mSearchResults.stream().filter( + i -> AllAppsGridAdapter.isIconViewType(i.viewType)).map(i -> i.appInfo).collect( + Collectors.toList()); + mFilteredApps.addAll(appInfos); + if (!FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { + // Append the search market item + if (hasNoFilteredResults()) { + mAdapterItems.add(AdapterItem.asEmptySearch(position++)); + } else { + mAdapterItems.add(AdapterItem.asAllAppsDivider(position++)); + } + mAdapterItems.add(AdapterItem.asMarketSearch(position++)); - // Create an app item - AdapterItem appItem = AdapterItem.asApp(position++, sectionName, info, appIndex++); - if (lastFastScrollerSectionInfo.fastScrollToItem == null) { - lastFastScrollerSectionInfo.fastScrollToItem = appItem; } - mAdapterItems.add(appItem); - mFilteredApps.add(info); } - - if (hasFilter()) { - // Append the search market item - if (hasNoFilteredResults()) { - mAdapterItems.add(AdapterItem.asEmptySearch(position++)); - } else { - mAdapterItems.add(AdapterItem.asAllAppsDivider(position++)); - } - mAdapterItems.add(AdapterItem.asMarketSearch(position++)); - } - if (mNumAppsPerRow != 0) { // Update the number of rows in the adapter after we do all the merging (otherwise, we // would have to shift the values again) @@ -381,18 +403,4 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { } } } - - private List getFiltersAppInfos() { - if (mSearchResults == null) { - return mApps; - } - ArrayList result = new ArrayList<>(); - for (ComponentKey key : mSearchResults) { - AppInfo match = mAllAppsStore.getApp(key); - if (match != null) { - result.add(match); - } - } - return result; - } } diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java index df1cd26da4..db94e8b6e8 100644 --- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java +++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java @@ -28,7 +28,7 @@ import android.widget.TextView.OnEditorActionListener; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.ExtendedEditText; import com.android.launcher3.Utilities; -import com.android.launcher3.util.ComponentKey; +import com.android.launcher3.allapps.AlphabeticalAppsList; import com.android.launcher3.util.PackageManagerHelper; import java.util.ArrayList; @@ -50,6 +50,7 @@ public class AllAppsSearchBarController public void setVisibility(int visibility) { mInput.setVisibility(visibility); } + /** * Sets the references to the apps model and the search result callback. */ @@ -164,9 +165,9 @@ public class AllAppsSearchBarController /** * Called when the search is complete. * - * @param apps sorted list of matching components or null if in case of failure. + * @param items sorted list of search result adapter items. */ - void onSearchResult(String query, ArrayList apps); + void onSearchResult(String query, ArrayList items); /** * Called when the search results should be cleared. diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java index 356c52ca39..df6a89bcb1 100644 --- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java @@ -38,13 +38,13 @@ import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.ExtendedEditText; import com.android.launcher3.Insettable; +import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AlphabeticalAppsList; import com.android.launcher3.allapps.SearchUiManager; import com.android.launcher3.anim.PropertySetter; -import com.android.launcher3.util.ComponentKey; import java.util.ArrayList; @@ -135,7 +135,8 @@ public class AppsSearchContainerLayout extends ExtendedEditText mApps = appsView.getApps(); mAppsView = appsView; mSearchBarController.initialize( - new DefaultAppSearchAlgorithm(mApps.getApps()), this, mLauncher, this); + new DefaultAppSearchAlgorithm(LauncherAppState.getInstance(mLauncher)), this, + mLauncher, this); } @Override @@ -168,9 +169,9 @@ public class AppsSearchContainerLayout extends ExtendedEditText } @Override - public void onSearchResult(String query, ArrayList apps) { - if (apps != null) { - mApps.setOrderedFilter(apps); + public void onSearchResult(String query, ArrayList items) { + if (items != null) { + mApps.setSearchResults(items); notifyResultChanged(); mAppsView.setLastSearchQuery(query); } @@ -178,7 +179,7 @@ public class AppsSearchContainerLayout extends ExtendedEditText @Override public void clearSearchResult() { - if (mApps.setOrderedFilter(null)) { + if (mApps.setSearchResults(null)) { notifyResultChanged(); } diff --git a/src/com/android/launcher3/allapps/search/AppsSearchPipeline.java b/src/com/android/launcher3/allapps/search/AppsSearchPipeline.java new file mode 100644 index 0000000000..5beb956079 --- /dev/null +++ b/src/com/android/launcher3/allapps/search/AppsSearchPipeline.java @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.allapps.search; + +import androidx.annotation.WorkerThread; + +import com.android.launcher3.LauncherAppState; +import com.android.launcher3.R; +import com.android.launcher3.allapps.AlphabeticalAppsList.AdapterItem; +import com.android.launcher3.model.AllAppsList; +import com.android.launcher3.model.BaseModelUpdateTask; +import com.android.launcher3.model.BgDataModel; +import com.android.launcher3.model.data.AppInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +/** + * A device search section for handling app searches + */ +public class AppsSearchPipeline implements SearchPipeline { + + private static final int MAX_RESULTS_COUNT = 5; + + private final SearchSectionInfo mSearchSectionInfo; + private final LauncherAppState mLauncherAppState; + + public AppsSearchPipeline(LauncherAppState launcherAppState) { + mLauncherAppState = launcherAppState; + mSearchSectionInfo = new SearchSectionInfo(R.string.search_corpus_apps); + } + + @Override + @WorkerThread + public void performSearch(String query, Consumer> callback) { + mLauncherAppState.getModel().enqueueModelUpdateTask(new BaseModelUpdateTask() { + @Override + public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) { + callback.accept(getAdapterItems(getTitleMatchResult(apps.data, query))); + } + }); + } + + /** + * Filters {@link AppInfo}s matching specified query + */ + public static ArrayList getTitleMatchResult(List apps, String query) { + // Do an intersection of the words in the query and each title, and filter out all the + // apps that don't match all of the words in the query. + final String queryTextLower = query.toLowerCase(); + final ArrayList result = new ArrayList<>(); + DefaultAppSearchAlgorithm.StringMatcher matcher = + DefaultAppSearchAlgorithm.StringMatcher.getInstance(); + for (AppInfo info : apps) { + if (DefaultAppSearchAlgorithm.matches(info, queryTextLower, matcher)) { + result.add(info); + } + } + return result; + } + + private ArrayList getAdapterItems(List matchingApps) { + ArrayList items = new ArrayList<>(); + if (matchingApps.isEmpty()) { + return items; + } + items.add(AdapterItem.asSearchTitle(mSearchSectionInfo, 0)); + int existingItems = items.size(); + int searchResultsCount = Math.min(matchingApps.size(), MAX_RESULTS_COUNT); + for (int i = 0; i < searchResultsCount; i++) { + AdapterItem appItem = AdapterItem.asApp(i + existingItems, "", matchingApps.get(i), i); + appItem.searchSectionInfo = mSearchSectionInfo; + items.add(appItem); + } + + return items; + } +} diff --git a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java index f72a9888cf..db10311675 100644 --- a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java +++ b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java @@ -17,24 +17,22 @@ package com.android.launcher3.allapps.search; import android.os.Handler; +import com.android.launcher3.LauncherAppState; import com.android.launcher3.model.data.AppInfo; -import com.android.launcher3.util.ComponentKey; import java.text.Collator; -import java.util.ArrayList; -import java.util.List; /** * The default search implementation. */ public class DefaultAppSearchAlgorithm implements SearchAlgorithm { - private final List mApps; protected final Handler mResultHandler; + private final AppsSearchPipeline mAppsSearchPipeline; - public DefaultAppSearchAlgorithm(List apps) { - mApps = apps; + public DefaultAppSearchAlgorithm(LauncherAppState launcherAppState) { mResultHandler = new Handler(); + mAppsSearchPipeline = new AppsSearchPipeline(launcherAppState); } @Override @@ -47,28 +45,8 @@ public class DefaultAppSearchAlgorithm implements SearchAlgorithm { @Override public void doSearch(final String query, final AllAppsSearchBarController.Callbacks callback) { - final ArrayList result = getTitleMatchResult(query); - mResultHandler.post(new Runnable() { - - @Override - public void run() { - callback.onSearchResult(query, result); - } - }); - } - - private ArrayList getTitleMatchResult(String query) { - // Do an intersection of the words in the query and each title, and filter out all the - // apps that don't match all of the words in the query. - final String queryTextLower = query.toLowerCase(); - final ArrayList result = new ArrayList<>(); - StringMatcher matcher = StringMatcher.getInstance(); - for (AppInfo info : mApps) { - if (matches(info, queryTextLower, matcher)) { - result.add(info.toComponentKey()); - } - } - return result; + mAppsSearchPipeline.performSearch(query, + results -> mResultHandler.post(() -> callback.onSearchResult(query, results))); } public static boolean matches(AppInfo info, String query, StringMatcher matcher) { diff --git a/src/com/android/launcher3/allapps/search/SearchPipeline.java b/src/com/android/launcher3/allapps/search/SearchPipeline.java new file mode 100644 index 0000000000..321674025a --- /dev/null +++ b/src/com/android/launcher3/allapps/search/SearchPipeline.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.allapps.search; + +import com.android.launcher3.allapps.AlphabeticalAppsList; + +import java.util.ArrayList; +import java.util.function.Consumer; + +/** + * An interface for handling search within pipeline + */ +public interface SearchPipeline { + + /** + * Perform query + */ + void performSearch(String query, Consumer> cb); +} diff --git a/src/com/android/launcher3/allapps/search/SearchSectionInfo.java b/src/com/android/launcher3/allapps/search/SearchSectionInfo.java new file mode 100644 index 0000000000..880b2466dc --- /dev/null +++ b/src/com/android/launcher3/allapps/search/SearchSectionInfo.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.allapps.search; + +import android.content.Context; + +/** + * Info class for a search section + */ +public class SearchSectionInfo { + private final int mTitleResId; + + public SearchSectionInfo(int titleResId) { + mTitleResId = titleResId; + } + + /** + * Returns the section's title + */ + public String getTitle(Context context) { + return context.getString(mTitleResId); + } +} From 261d817a95a039a49f971254140b4ce07d53ccb4 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Wed, 29 Jul 2020 02:50:35 +0000 Subject: [PATCH 57/72] Revert "Recycling already running activities" This reverts commit 0bc32dcce64b20459ff6f8eff960b217810d59d8. Reason for revert: Tests are broken, perhaps caused by this one Change-Id: Ie409f04931a27bd6da616c1e52e279eb07479631 --- .../quickstep/StartLauncherViaGestureTests.java | 4 +--- .../android/quickstep/TaplTestsQuickstep.java | 16 +++++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java index 664958a18e..0c5b9ada5d 100644 --- a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java +++ b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java @@ -48,9 +48,7 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest { // b/143488140 mLauncher.pressHome(); // Start an activity where the gestures start. - if (mLauncher.getRecentTasks().isEmpty()) { - startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); - } + startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); } private void runTest(String... eventSequence) { diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index ed25cc71ca..bf093fdabf 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -69,16 +69,14 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { } private void startTestApps() throws Exception { - if (mLauncher.getRecentTasks().size() < 3) { - startAppFast(getAppPackageName()); - startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); - startTestActivity(2); + startAppFast(getAppPackageName()); + startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + startTestActivity(2); - executeOnLauncher(launcher -> assertTrue( - "Launcher activity is the top activity; expecting another activity to be the " - + "top one", - isInBackground(launcher))); - } + executeOnLauncher(launcher -> assertTrue( + "Launcher activity is the top activity; expecting another activity to be the top " + + "one", + isInBackground(launcher))); } @Test From f496ea46342bd7420c3cf453bcbd5c12f7ecfc5d Mon Sep 17 00:00:00 2001 From: Jonathan Miranda Date: Wed, 29 Jul 2020 19:03:29 +0000 Subject: [PATCH 58/72] Revert "Fix bug where double swipe gets us stuck in Hint state while in Overview." This reverts commit a8c08584a7bb295a2f14eafd2923a2688d3e3626. Reason for revert: "caused a regression with quick switch from home: if you start the gesture then swipe back to the left, it ends up launching the task anyway" Change-Id: I8e12e2de46b6fc6a3faeb0336762da08080c61d6 --- .../src/com/android/quickstep/BaseSwipeUpHandlerV2.java | 1 - .../src/com/android/quickstep/SwipeUpAnimationLogic.java | 1 - .../src/com/android/quickstep/views/TaskMenuView.java | 1 - src/com/android/launcher3/anim/AlphaUpdateListener.java | 3 +-- .../android/launcher3/anim/AnimationSuccessListener.java | 8 -------- .../launcher3/anim/AnimatorPlaybackController.java | 1 - src/com/android/launcher3/statemanager/StateManager.java | 1 - 7 files changed, 1 insertion(+), 15 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java index e084de1acb..a3f1dd4c5f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java @@ -1090,7 +1090,6 @@ public abstract class BaseSwipeUpHandlerV2, Q exte anim.addAnimatorListener(new AnimationSuccessListener() { @Override public void onAnimationStart(Animator animation) { - super.onAnimationStart(animation); if (mActivity != null) { removeLiveTileOverlay(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java index 07faab7aeb..e54a21c073 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeUpAnimationLogic.java @@ -287,7 +287,6 @@ public abstract class SwipeUpAnimationLogic { @Override public void onAnimationStart(Animator animation) { - super.onAnimationStart(animation); mHomeAnim.dispatchOnStart(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java index 9b2048e4ac..8b49f2c212 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java @@ -282,7 +282,6 @@ public class TaskMenuView extends AbstractFloatingView { mOpenCloseAnimator.addListener(new AnimationSuccessListener() { @Override public void onAnimationStart(Animator animation) { - super.onAnimationStart(animation); setVisibility(VISIBLE); } diff --git a/src/com/android/launcher3/anim/AlphaUpdateListener.java b/src/com/android/launcher3/anim/AlphaUpdateListener.java index 69716eabf1..eabd283699 100644 --- a/src/com/android/launcher3/anim/AlphaUpdateListener.java +++ b/src/com/android/launcher3/anim/AlphaUpdateListener.java @@ -46,8 +46,7 @@ public class AlphaUpdateListener extends AnimationSuccessListener } @Override - public void onAnimationStart(Animator animation) { - super.onAnimationStart(animation); + public void onAnimationStart(Animator arg0) { // We want the views to be visible for animation, so fade-in/out is visible mView.setVisibility(View.VISIBLE); } diff --git a/src/com/android/launcher3/anim/AnimationSuccessListener.java b/src/com/android/launcher3/anim/AnimationSuccessListener.java index b83417c2eb..9905e81638 100644 --- a/src/com/android/launcher3/anim/AnimationSuccessListener.java +++ b/src/com/android/launcher3/anim/AnimationSuccessListener.java @@ -19,8 +19,6 @@ package com.android.launcher3.anim; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; -import androidx.annotation.CallSuper; - /** * Extension of {@link AnimatorListenerAdapter} for listening for non-cancelled animations */ @@ -28,12 +26,6 @@ public abstract class AnimationSuccessListener extends AnimatorListenerAdapter { protected boolean mCancelled = false; - @Override - @CallSuper - public void onAnimationStart(Animator animation) { - mCancelled = false; - } - @Override public void onAnimationCancel(Animator animation) { mCancelled = true; diff --git a/src/com/android/launcher3/anim/AnimatorPlaybackController.java b/src/com/android/launcher3/anim/AnimatorPlaybackController.java index 31e0418571..ea0ff8b687 100644 --- a/src/com/android/launcher3/anim/AnimatorPlaybackController.java +++ b/src/com/android/launcher3/anim/AnimatorPlaybackController.java @@ -335,7 +335,6 @@ public class AnimatorPlaybackController implements ValueAnimator.AnimatorUpdateL @Override public void onAnimationStart(Animator animation) { - super.onAnimationStart(animation); mCancelled = false; mDispatched = false; } diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index f1e7f166e5..60b87d984b 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -315,7 +315,6 @@ public class StateManager> { @Override public void onAnimationStart(Animator animation) { - super.onAnimationStart(animation); // Change the internal state only when the transition actually starts onStateTransitionStart(state); } From 7383d4e6d2769937f8a8fe33e82e960aeb5771f4 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 7 Jul 2020 19:25:25 -0700 Subject: [PATCH 59/72] Fix adjacent task offset distance Instead of calculating an overall distance for tasks to translate based on RecentsView width, calculate the distance for the tasks to the left and right of the midpoint based on how far the first adjacent tasks in those directions are from being offscreen. Changes made to make "distance to offscreen" calculations possible: - Update TaskView curve scale to reach final scale as soon as it is completely offscreen. Before, it would reach its final scale just shy of that point (calculations were off). - As we update RecentsView scale, calculate how much the new scale will push out tasks that are just offscreen. - With both above, we can calculate the scale and position of a TaskView such that it is just offscreen, and interpolate between its current position and that position. Tests: - Task comes in immediately when quick switching from home, and doesn't shift as you swipe directly upwards. - When swiping far up from an app, tasks come in from all the way offscreen, and cover distance appropriately (e.g. if you're scrolled a bit to the right when you pause, the left adjacent app will move faster to cover the farther distance). - Task modalness: entering Select mode now animates adjacent tasks at the same rate as the scaling up, because they move only the distance needed to get offscreen (before they moved way too far and thus seemed to be much faster than the rest of the animation). Bug: 149934536 Change-Id: Ie3fffe0e5c304cb16e7637f058f5ce72cee40aeb --- .../QuickstepAtomicAnimationFactory.java | 4 +- .../NoButtonQuickSwitchTouchController.java | 7 +- .../FallbackRecentsStateController.java | 4 +- .../quickstep/util/TaskViewSimulator.java | 6 +- .../android/quickstep/views/RecentsView.java | 126 ++++++++++++++++-- .../BaseRecentsViewStateController.java | 6 +- .../quickstep/BaseActivityInterface.java | 4 +- src/com/android/launcher3/PagedView.java | 21 ++- .../touch/LandscapePagedViewHandler.java | 1 + .../touch/PagedOrientationHandler.java | 1 + .../touch/PortraitPagedViewHandler.java | 1 + 11 files changed, 146 insertions(+), 35 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index a0af79743b..131fcbfbf1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -17,7 +17,6 @@ package com.android.launcher3.uioverrides.states; import static android.view.View.VISIBLE; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; @@ -52,6 +51,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_S import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.animation.Animator; import android.animation.AnimatorSet; @@ -212,7 +212,7 @@ public class QuickstepAtomicAnimationFactory extends // Scale up the recents, if it is not coming from the side RecentsView overview = mActivity.getOverviewPanel(); if (overview.getVisibility() != VISIBLE || overview.getContentAlpha() == 0) { - SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE); + RECENTS_SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE); } } config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 1b439d1d31..821ada400e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; @@ -47,6 +46,7 @@ import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.Animator; @@ -244,7 +244,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, final LauncherState toState = OVERVIEW; // Set RecentView's initial properties. - SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]); + RECENTS_SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]); ADJACENT_PAGE_OFFSET.set(mRecentsView, 1f); mRecentsView.setContentAlpha(1); mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress()); @@ -266,7 +266,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // - RecentsView scale // - RecentsView fullscreenProgress PendingAnimation yAnim = new PendingAnimation((long) (mYRange * 2)); - yAnim.setFloat(mRecentsView, SCALE_PROPERTY, scaleAndOffset[0], SCALE_DOWN_INTERPOLATOR); + yAnim.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0], + SCALE_DOWN_INTERPOLATOR); yAnim.setFloat(mRecentsView, FULLSCREEN_PROGRESS, toState.getOverviewFullscreenProgress(), SCALE_DOWN_INTERPOLATOR); mYOverviewAnim = yAnim.createPlaybackController(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 3f1e7bad9b..163c23268b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -15,7 +15,6 @@ */ package com.android.quickstep.fallback; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; @@ -25,6 +24,7 @@ import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVER import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.TASK_MODALNESS; import com.android.launcher3.anim.PendingAnimation; @@ -82,7 +82,7 @@ public class FallbackRecentsStateController implements StateHandler extends PagedView } }; + /** Same as normal SCALE_PROPERTY, but also updates page offsets that depend on this scale. */ + public static final FloatProperty RECENTS_SCALE_PROPERTY = + new FloatProperty("recentsScale") { + @Override + public void setValue(RecentsView view, float scale) { + view.setScaleX(scale); + view.setScaleY(scale); + view.mLastComputedTaskPushOutDistance = null; + view.updatePageOffsets(); + } + + @Override + public Float get(RecentsView view) { + return view.getScaleX(); + } + }; + protected RecentsOrientedState mOrientationState; protected final BaseActivityInterface mSizeStrategy; protected RecentsAnimationController mRecentsAnimationController; @@ -219,8 +236,12 @@ public abstract class RecentsView extends PagedView protected int mTaskHeight; protected final TransformParams mLiveTileParams = new TransformParams(); protected final TaskViewSimulator mLiveTileTaskViewSimulator; + protected final Rect mLastComputedTaskSize = new Rect(); + // How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot. + protected Float mLastComputedTaskPushOutDistance = null; protected boolean mEnableDrawingLiveTile = false; protected final Rect mTempRect = new Rect(); + protected final RectF mTempRectF = new RectF(); private final PointF mTempPointF = new PointF(); private static final int DISMISS_TASK_DURATION = 300; @@ -887,6 +908,7 @@ public abstract class RecentsView extends PagedView public void getTaskSize(Rect outRect) { mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(), outRect, mOrientationHandler); + mLastComputedTaskSize.set(outRect); } /** Gets the task size for modal state. */ @@ -934,8 +956,8 @@ public abstract class RecentsView extends PagedView final int pageCount = getPageCount(); for (int i = 0; i < pageCount; i++) { View page = getPageAt(i); - mScrollState.updateInterpolation(mOrientationHandler.getChildStartWithTranslation(page), - mPageSpacing); + mScrollState.updateInterpolation( + mOrientationHandler.getChildStartWithTranslation(page)); ((PageCallbacks) page).onPageScroll(mScrollState); } } @@ -1357,10 +1379,14 @@ public abstract class RecentsView extends PagedView /** * Updates linearInterpolation for the provided child position */ - public void updateInterpolation(float childStart, int pageSpacing) { - float pageCenter = childStart + halfPageSize; + public void updateInterpolation(float childStart) { + float scaledHalfPageSize = halfPageSize / pageParentScale; + float pageCenter = childStart + scaledHalfPageSize; float distanceFromScreenCenter = screenCenter - pageCenter; - float distanceToReachEdge = halfScreenSize + halfPageSize + pageSpacing; + // How far the page has to move from the center to be offscreen, taking into account + // the EDGE_SCALE_DOWN_FACTOR that will be applied at that position. + float distanceToReachEdge = halfScreenSize + + scaledHalfPageSize * (1 - TaskView.EDGE_SCALE_DOWN_FACTOR); linearInterpolation = Math.min(1, Math.abs(distanceFromScreenCenter) / distanceToReachEdge); } @@ -1802,14 +1828,15 @@ public abstract class RecentsView extends PagedView setPivotX(mTempPointF.x); setPivotY(mTempPointF.y); setTaskModalness(mTaskModalness); + mLastComputedTaskPushOutDistance = null; updatePageOffsets(); setImportantForAccessibility(isModal() ? IMPORTANT_FOR_ACCESSIBILITY_NO : IMPORTANT_FOR_ACCESSIBILITY_AUTO); } private void updatePageOffsets() { - float offset = mAdjacentPageOffset * getWidth(); - float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness) * getWidth(); + float offset = mAdjacentPageOffset; + float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness); if (mIsRtl) { offset = -offset; modalOffset = -modalOffset; @@ -1818,18 +1845,89 @@ public abstract class RecentsView extends PagedView TaskView runningTask = mRunningTaskId == -1 || !mRunningTaskTileHidden ? null : getTaskView(mRunningTaskId); - int midPoint = runningTask == null ? -1 : indexOfChild(runningTask); - int currentPage = getCurrentPage(); + int midpoint = runningTask == null ? -1 : indexOfChild(runningTask); + int modalMidpoint = getCurrentPage(); + + float midpointOffsetSize = 0; + float leftOffsetSize = midpoint - 1 >= 0 + ? -getOffsetSize(midpoint - 1, midpoint, offset) + : 0; + float rightOffsetSize = midpoint + 1 < count + ? getOffsetSize(midpoint + 1, midpoint, offset) + : 0; + + float modalMidpointOffsetSize = 0; + float modalLeftOffsetSize = modalMidpoint - 1 >= 0 + ? -getOffsetSize(modalMidpoint - 1, modalMidpoint, modalOffset) + : 0; + float modalRightOffsetSize = modalMidpoint + 1 < count + ? getOffsetSize(modalMidpoint + 1, modalMidpoint, modalOffset) + : 0; for (int i = 0; i < count; i++) { - float translation = i == midPoint ? 0 : (i < midPoint ? -offset : offset); - float modalTranslation = - i == currentPage ? 0 : (i < currentPage ? -modalOffset : modalOffset); + float translation = i == midpoint + ? midpointOffsetSize + : i < midpoint + ? leftOffsetSize + : rightOffsetSize; + float modalTranslation = i == modalMidpoint + ? modalMidpointOffsetSize + : i < modalMidpoint + ? modalLeftOffsetSize + : modalRightOffsetSize; getChildAt(i).setTranslationX(translation + modalTranslation); } updateCurveProperties(); } + /** + * Computes the distance to offset the given child such that it is completely offscreen when + * translating away from the given midpoint. + * @param offsetProgress From 0 to 1 where 0 means no offset and 1 means offset offscreen. + */ + private float getOffsetSize(int childIndex, int midpointIndex, float offsetProgress) { + if (offsetProgress == 0) { + // Don't bother calculating everything below if we won't offset anyway. + return 0; + } + // First, get the position of the task relative to the midpoint. If there is no midpoint + // then we just use the normal (centered) task position. + mTempRectF.set(mLastComputedTaskSize); + RectF taskPosition = mTempRectF; + float desiredLeft = getWidth(); + float distanceToOffscreen = desiredLeft - taskPosition.left; + // Used to calculate the scale of the task view based on its new offset. + float centerToOffscreenProgress = Math.abs(offsetProgress); + if (midpointIndex > -1) { + // When there is a midpoint reference task, adjacent tasks have less distance to travel + // to reach offscreen. Offset the task position to the task's starting point. + View child = getChildAt(childIndex); + View midpointChild = getChildAt(midpointIndex); + int distanceFromMidpoint = Math.abs(mOrientationHandler.getChildStart(child) + - mOrientationHandler.getChildStart(midpointChild) + + getDisplacementFromScreenCenter(midpointIndex)); + taskPosition.offset(distanceFromMidpoint, 0); + centerToOffscreenProgress = Utilities.mapRange(centerToOffscreenProgress, + distanceFromMidpoint / distanceToOffscreen, 1); + } + // Find the task's scale based on its offscreen progress, then see how far it still needs to + // move to be completely offscreen. + Utilities.scaleRectFAboutCenter(taskPosition, + TaskView.getCurveScaleForInterpolation(centerToOffscreenProgress)); + distanceToOffscreen = desiredLeft - taskPosition.left; + // Finally, we need to account for RecentsView scale, because it moves tasks based on its + // pivot. To do this, we move the task position to where it would be offscreen at scale = 1 + // (computed above), then we apply the scale via getMatrix() to determine how much that + // moves the task from its desired position, and adjust the computed distance accordingly. + if (mLastComputedTaskPushOutDistance == null) { + taskPosition.offsetTo(desiredLeft, 0); + getMatrix().mapRect(taskPosition); + mLastComputedTaskPushOutDistance = (taskPosition.left - desiredLeft) / getScaleX(); + } + distanceToOffscreen -= mLastComputedTaskPushOutDistance; + return distanceToOffscreen * offsetProgress; + } + /** * TODO: Do not assume motion across X axis for adjacent page */ @@ -1928,7 +2026,7 @@ public abstract class RecentsView extends PagedView float toScale = getMaxScaleForFullScreen(); if (launchingCenterTask) { RecentsView recentsView = tv.getRecentsView(); - anim.play(ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, toScale)); + anim.play(ObjectAnimator.ofFloat(recentsView, RECENTS_SCALE_PROPERTY, toScale)); anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1)); } else { // We are launching an adjacent task, so parallax the center and other adjacent task. diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index ec3a4905f5..6e120e8bd8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -16,7 +16,6 @@ package com.android.launcher3.uioverrides; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS; @@ -29,6 +28,7 @@ import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVER import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_SCALE; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.util.FloatProperty; @@ -61,7 +61,7 @@ public abstract class BaseRecentsViewStateController @Override public void setState(@NonNull LauncherState state) { float[] scaleAndOffset = state.getOverviewScaleAndOffset(mLauncher); - SCALE_PROPERTY.set(mRecentsView, scaleAndOffset[0]); + RECENTS_SCALE_PROPERTY.set(mRecentsView, scaleAndOffset[0]); ADJACENT_PAGE_OFFSET.set(mRecentsView, scaleAndOffset[1]); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); @@ -93,7 +93,7 @@ public abstract class BaseRecentsViewStateController void setStateWithAnimationInternal(@NonNull final LauncherState toState, @NonNull StateAnimationConfig config, @NonNull PendingAnimation setter) { float[] scaleAndOffset = toState.getOverviewScaleAndOffset(mLauncher); - setter.setFloat(mRecentsView, SCALE_PROPERTY, scaleAndOffset[0], + setter.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0], config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR)); setter.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR)); diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 0ae386f39a..9dc2132683 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -15,7 +15,6 @@ */ package com.android.quickstep; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; @@ -28,6 +27,7 @@ import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_REC import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.animation.Animator; import android.annotation.TargetApi; @@ -393,7 +393,7 @@ public abstract class BaseActivityInterface extends ViewGrou int minDistanceFromScreenCenterIndex = -1; final int childCount = getChildCount(); for (int i = 0; i < childCount; ++i) { - View layout = getPageAt(i); - int childSize = mOrientationHandler.getMeasuredSize(layout); - int halfChildSize = (childSize / 2); - int childCenter = getChildOffset(i) + halfChildSize; - int distanceFromScreenCenter = Math.abs(childCenter - screenCenter); + int distanceFromScreenCenter = Math.abs( + getDisplacementFromScreenCenter(i, screenCenter)); if (distanceFromScreenCenter < minDistanceFromScreenCenter) { minDistanceFromScreenCenter = distanceFromScreenCenter; minDistanceFromScreenCenterIndex = i; @@ -1461,6 +1458,20 @@ public abstract class PagedView extends ViewGrou return minDistanceFromScreenCenterIndex; } + private int getDisplacementFromScreenCenter(int childIndex, int screenCenter) { + View layout = getPageAt(childIndex); + int childSize = mOrientationHandler.getMeasuredSize(layout); + int halfChildSize = (childSize / 2); + int childCenter = getChildOffset(childIndex) + halfChildSize; + return childCenter - screenCenter; + } + + protected int getDisplacementFromScreenCenter(int childIndex) { + int pageOrientationSize = mOrientationHandler.getMeasuredSize(this); + int screenCenter = mOrientationHandler.getPrimaryScroll(this) + (pageOrientationSize / 2); + return getDisplacementFromScreenCenter(childIndex, screenCenter); + } + protected void snapToDestination() { snapToPage(getPageNearestToCenterOfScreen(), getPageSnapDuration()); } diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index ac1ade260d..1aaa608657 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -72,6 +72,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { out.halfPageSize = view.getNormalChildHeight() / 2; out.halfScreenSize = view.getMeasuredHeight() / 2; out.screenCenter = insets.top + view.getPaddingTop() + out.scroll + out.halfPageSize; + out.pageParentScale = view.getScaleY(); } @Override diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index d4f5cba40e..f88cdb3b0d 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -109,6 +109,7 @@ public interface PagedOrientationHandler { public int halfPageSize; public int screenCenter; public int halfScreenSize; + public float pageParentScale; } class ChildBounds { diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 3341996383..f18b109515 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -70,6 +70,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { out.halfPageSize = view.getNormalChildWidth() / 2; out.halfScreenSize = view.getMeasuredWidth() / 2; out.screenCenter = insets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize; + out.pageParentScale = view.getScaleX(); } @Override From 8b74cc761b5a3185f3cfffe0a3833bbf7dd32636 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 27 Jul 2020 17:50:33 -0700 Subject: [PATCH 60/72] Moving all-apps predictions to Launcher model Predictions are loaded and managed by Launcher model and follow the model lifecycle. They are then bound to the callback which handles the UI Bug: 160748731 Change-Id: I4a3ea0698d80fafe94afb4ce66ffa7f4a6a91c68 --- .../res/values/override.xml | 5 +- .../appprediction/PredictionRowView.java | 78 +--- .../PredictionUiStateManager.java | 348 ------------------ .../AppEventProducer.java} | 125 +------ .../launcher3/model/PredictionUpdateTask.java | 117 ++++++ .../model/QuickstepModelDelegate.java | 138 +++++++ .../uioverrides/QuickstepLauncher.java | 39 +- .../quickstep/LauncherActivityInterface.java | 1 - ...EventDispatcherAppPredictionExtension.java | 49 --- .../quickstep/AppPredictionsUITests.java | 162 -------- res/values/config.xml | 1 + src/com/android/launcher3/Launcher.java | 5 +- .../android/launcher3/LauncherAppState.java | 3 +- src/com/android/launcher3/LauncherModel.java | 30 +- .../graphics/LauncherPreviewRenderer.java | 3 +- .../launcher3/model/AppLaunchTracker.java | 33 -- .../android/launcher3/model/BgDataModel.java | 7 - .../android/launcher3/model/LoaderTask.java | 7 +- .../launcher3/model/ModelDelegate.java | 75 ++++ .../launcher3/ui/AbstractLauncherUiTest.java | 3 - 20 files changed, 424 insertions(+), 805 deletions(-) delete mode 100644 quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java rename quickstep/recents_ui_overrides/src/com/android/launcher3/{appprediction/PredictionAppTracker.java => model/AppEventProducer.java} (65%) create mode 100644 quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java create mode 100644 quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java delete mode 100644 quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java delete mode 100644 quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java delete mode 100644 src/com/android/launcher3/model/AppLaunchTracker.java create mode 100644 src/com/android/launcher3/model/ModelDelegate.java diff --git a/quickstep/recents_ui_overrides/res/values/override.xml b/quickstep/recents_ui_overrides/res/values/override.xml index 6aa9619cc9..1937164b7d 100644 --- a/quickstep/recents_ui_overrides/res/values/override.xml +++ b/quickstep/recents_ui_overrides/res/values/override.xml @@ -25,8 +25,11 @@ com.android.quickstep.QuickstepProcessInitializer - com.android.quickstep.logging.UserEventDispatcherAppPredictionExtension + com.android.quickstep.logging.UserEventDispatcherExtension com.android.launcher3.hybridhotseat.HotseatPredictionModel + + com.android.launcher3.model.QuickstepModelDelegate + diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index e11c701640..55384af96b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -30,7 +30,6 @@ import android.graphics.Rect; import android.os.Build; import android.util.AttributeSet; import android.util.IntProperty; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.animation.Interpolator; @@ -44,19 +43,15 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.FloatingHeaderRow; import com.android.launcher3.allapps.FloatingHeaderView; import com.android.launcher3.anim.AlphaUpdateListener; import com.android.launcher3.anim.PropertySetter; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusIndicatorHelper; import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; -import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -67,15 +62,12 @@ import com.android.launcher3.util.Themes; import com.android.quickstep.AnimatedFloat; import java.util.ArrayList; -import java.util.Collections; import java.util.List; @TargetApi(Build.VERSION_CODES.P) public class PredictionRowView extends LinearLayout implements LogContainerProvider, OnDeviceProfileChangeListener, FloatingHeaderRow { - private static final String TAG = "PredictionRowView"; - private static final IntProperty TEXT_ALPHA = new IntProperty("textAlpha") { @Override @@ -93,16 +85,14 @@ public class PredictionRowView extends LinearLayout implements (t) -> (t < 0.8f) ? 0 : (t - 0.8f) / 0.2f; private final Launcher mLauncher; - private final PredictionUiStateManager mPredictionUiStateManager; private int mNumPredictedAppsPerRow; - // The set of predicted app component names - private final List mPredictedAppComponents = new ArrayList<>(); - // The set of predicted apps resolved from the component names and the current set of apps - private final ArrayList mPredictedApps = new ArrayList<>(); // Helper to drawing the focus indicator. private final FocusIndicatorHelper mFocusHelper; + // The set of predicted apps resolved from the component names and the current set of apps + private final List mPredictedApps = new ArrayList<>(); + private final int mIconTextColor; private final int mIconFullTextAlpha; private int mIconLastSetTextAlpha; @@ -134,8 +124,6 @@ public class PredictionRowView extends LinearLayout implements mLauncher = Launcher.getLauncher(context); mLauncher.addOnDeviceProfileChangeListener(this); - mPredictionUiStateManager = PredictionUiStateManager.INSTANCE.get(context); - mIconTextColor = Themes.getAttrColor(context, android.R.attr.textColorSecondary); mIconFullTextAlpha = Color.alpha(mIconTextColor); mIconCurrentTextAlpha = mIconFullTextAlpha; @@ -146,24 +134,9 @@ public class PredictionRowView extends LinearLayout implements @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - - mPredictionUiStateManager.setTargetAppsView(mLauncher.getAppsView()); - getAppsStore().registerIconContainer(this); AllAppsTipView.scheduleShowIfNeeded(mLauncher); } - private AllAppsStore getAppsStore() { - return mLauncher.getAppsView().getAppsStore(); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - - mPredictionUiStateManager.setTargetAppsView(null); - getAppsStore().unregisterIconContainer(this); - } - public void setup(FloatingHeaderView parent, FloatingHeaderRow[] rows, boolean tabsHidden) { mParent = parent; } @@ -205,7 +178,7 @@ public class PredictionRowView extends LinearLayout implements * Returns the predicted apps. */ public List getPredictedApps() { - return mPredictedApps; + return new ArrayList<>(mPredictedApps); } /** @@ -217,12 +190,12 @@ public class PredictionRowView extends LinearLayout implements * If the number of predicted apps is the same as the previous list of predicted apps, * we can optimize by swapping them in place. */ - public void setPredictedApps(List apps) { - mPredictedAppComponents.clear(); - mPredictedAppComponents.addAll(apps); - + public void setPredictedApps(List items) { mPredictedApps.clear(); - mPredictedApps.addAll(processPredictedAppComponents(mPredictedAppComponents)); + items.stream() + .filter(itemInfo -> itemInfo instanceof WorkspaceItemInfo) + .map(itemInfo -> (WorkspaceItemInfo) itemInfo) + .forEach(mPredictedApps::add); applyPredictionApps(); } @@ -264,11 +237,7 @@ public class PredictionRowView extends LinearLayout implements icon.reset(); if (predictionCount > i) { icon.setVisibility(View.VISIBLE); - if (mPredictedApps.get(i) instanceof AppInfo) { - icon.applyFromApplicationInfo((AppInfo) mPredictedApps.get(i)); - } else if (mPredictedApps.get(i) instanceof WorkspaceItemInfo) { - icon.applyFromWorkspaceItem((WorkspaceItemInfo) mPredictedApps.get(i)); - } + icon.applyFromWorkspaceItem(mPredictedApps.get(i)); icon.setTextColor(iconColor); } else { icon.setVisibility(predictionCount == 0 ? GONE : INVISIBLE); @@ -284,33 +253,6 @@ public class PredictionRowView extends LinearLayout implements mParent.onHeightUpdated(); } - private List processPredictedAppComponents( - List components) { - if (getAppsStore().getApps().length == 0) { - // Apps have not been bound yet. - return Collections.emptyList(); - } - - List predictedApps = new ArrayList<>(); - for (ComponentKeyMapper mapper : components) { - ItemInfoWithIcon info = mapper.getApp(getAppsStore()); - if (info != null) { - ItemInfoWithIcon predictedApp = info.clone(); - predictedApp.container = LauncherSettings.Favorites.CONTAINER_PREDICTION; - predictedApps.add(predictedApp); - } else { - if (FeatureFlags.IS_STUDIO_BUILD) { - Log.e(TAG, "Predicted app not found: " + mapper); - } - } - // Stop at the number of predicted apps - if (predictedApps.size() == mNumPredictedAppsPerRow) { - break; - } - } - return predictedApps; - } - @Override public void fillInLogContainerData(ItemInfo childInfo, LauncherLogProto.Target child, ArrayList parents) { diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java deleted file mode 100644 index 830c1032ba..0000000000 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3.appprediction; - -import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; -import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; -import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; -import static com.android.launcher3.LauncherState.BACKGROUND_APP; -import static com.android.launcher3.LauncherState.OVERVIEW; - -import android.app.prediction.AppPredictor; -import android.app.prediction.AppTarget; -import android.content.ComponentName; -import android.content.Context; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener; -import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherSettings; -import com.android.launcher3.LauncherState; -import com.android.launcher3.Utilities; -import com.android.launcher3.allapps.AllAppsContainerView; -import com.android.launcher3.allapps.AllAppsStore.OnUpdateListener; -import com.android.launcher3.hybridhotseat.HotseatPredictionController; -import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver; -import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.model.data.ItemInfoWithIcon; -import com.android.launcher3.shortcuts.ShortcutKey; -import com.android.launcher3.statemanager.StateManager.StateListener; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.util.ComponentKey; -import com.android.launcher3.util.MainThreadInitializedObject; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.OptionalInt; -import java.util.stream.IntStream; - -/** - * Handler responsible to updating the UI due to predicted apps changes. Operations: - * 1) Pushes the predicted apps to all-apps. If all-apps is visible, waits until it becomes - * invisible again before applying the changes. This ensures that the UI does not change abruptly - * in front of the user, even if an app launched and user pressed back button to return to the - * all-apps UI again. - * 2) Prefetch high-res icons for predicted apps. This ensures that we have the icons in memory - * even if all-apps is not opened as they are shown in search UI as well - * 3) Load instant app if it is not already in memory. As predictions are persisted on disk, - * instant app will not be in memory when launcher starts. - * 4) Maintains the current active client id (for the predictions) and all updates are performed on - * that client id. - */ -public class PredictionUiStateManager implements StateListener, - ItemInfoUpdateReceiver, OnIDPChangeListener, OnUpdateListener { - - public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state"; - - // TODO (b/129421797): Update the client constants - public enum Client { - HOME("home"); - - public final String id; - - Client(String id) { - this.id = id; - } - } - - public static final MainThreadInitializedObject INSTANCE = - new MainThreadInitializedObject<>(PredictionUiStateManager::new); - - private final Context mContext; - - private final DynamicItemCache mDynamicItemCache; - private List mPredictionServicePredictions = Collections.emptyList(); - - private int mMaxIconsPerRow; - - private AllAppsContainerView mAppsView; - - private PredictionState mPendingState; - private PredictionState mCurrentState; - - private boolean mGettingValidPredictionResults; - - private PredictionUiStateManager(Context context) { - mContext = context; - - mDynamicItemCache = new DynamicItemCache(context, this::onAppsUpdated); - - InvariantDeviceProfile idp = LauncherAppState.getIDP(context); - mMaxIconsPerRow = idp.numColumns; - - idp.addOnChangeListener(this); - mGettingValidPredictionResults = Utilities.getDevicePrefs(context) - .getBoolean(LAST_PREDICTION_ENABLED_STATE, true); - - // Call this last - mCurrentState = parseLastState(); - } - - @Override - public void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) { - mMaxIconsPerRow = profile.numColumns; - } - - public void setTargetAppsView(AllAppsContainerView appsView) { - if (mAppsView != null) { - mAppsView.getAppsStore().removeUpdateListener(this); - } - mAppsView = appsView; - if (mAppsView != null) { - mAppsView.getAppsStore().addUpdateListener(this); - } - if (mPendingState != null) { - applyState(mPendingState); - mPendingState = null; - } else { - applyState(mCurrentState); - } - updateDependencies(mCurrentState); - } - - @Override - public void reapplyItemInfo(ItemInfoWithIcon info) { } - - @Override - public void onStateTransitionComplete(LauncherState state) { - if (mAppsView == null) { - return; - } - if (mPendingState != null && canApplyPredictions(mPendingState)) { - applyState(mPendingState); - mPendingState = null; - } - if (mPendingState == null) { - Launcher.getLauncher(mAppsView.getContext()).getStateManager() - .removeStateListener(this); - } - } - - private void scheduleApplyPredictedApps(PredictionState state) { - boolean registerListener = mPendingState == null; - mPendingState = state; - if (registerListener) { - // Add a listener and wait until appsView is invisible again. - Launcher.getLauncher(mAppsView.getContext()).getStateManager().addStateListener(this); - } - } - - private void applyState(PredictionState state) { - mCurrentState = state; - if (mAppsView != null) { - mAppsView.getFloatingHeaderView().findFixedRowByType(PredictionRowView.class) - .setPredictedApps(mCurrentState.apps); - } - } - - private void updatePredictionStateAfterCallback() { - boolean validResults = mPredictionServicePredictions != null - && !mPredictionServicePredictions.isEmpty(); - if (validResults != mGettingValidPredictionResults) { - mGettingValidPredictionResults = validResults; - Utilities.getDevicePrefs(mContext).edit() - .putBoolean(LAST_PREDICTION_ENABLED_STATE, true) - .apply(); - } - dispatchOnChange(true); - } - - public AppPredictor.Callback appPredictorCallback(Client client) { - return targets -> { - mPredictionServicePredictions = targets; - updatePredictionStateAfterCallback(); - }; - } - - private void dispatchOnChange(boolean changed) { - PredictionState newState = changed - ? parseLastState() - : mPendingState != null && canApplyPredictions(mPendingState) - ? mPendingState - : mCurrentState; - if (changed && mAppsView != null && !canApplyPredictions(newState)) { - scheduleApplyPredictedApps(newState); - } else { - applyState(newState); - } - } - - private PredictionState parseLastState() { - PredictionState state = new PredictionState(); - state.isEnabled = mGettingValidPredictionResults; - if (!state.isEnabled) { - state.apps = Collections.EMPTY_LIST; - return state; - } - - state.apps = new ArrayList<>(); - - List appTargets = mPredictionServicePredictions; - if (!appTargets.isEmpty()) { - for (AppTarget appTarget : appTargets) { - ComponentKey key; - if (appTarget.getShortcutInfo() != null) { - key = ShortcutKey.fromInfo(appTarget.getShortcutInfo()); - } else { - key = new ComponentKey(new ComponentName(appTarget.getPackageName(), - appTarget.getClassName()), appTarget.getUser()); - } - state.apps.add(new ComponentKeyMapper(key, mDynamicItemCache)); - } - } - updateDependencies(state); - return state; - } - - private void updateDependencies(PredictionState state) { - if (!state.isEnabled || mAppsView == null) { - return; - } - mDynamicItemCache.updateDependencies(state.apps, mAppsView.getAppsStore(), this, - mMaxIconsPerRow); - } - - @Override - public void onAppsUpdated() { - dispatchOnChange(false); - } - - private boolean canApplyPredictions(PredictionState newState) { - if (mAppsView == null) { - // If there is no apps view, no need to schedule. - return true; - } - Launcher launcher = Launcher.getLauncher(mAppsView.getContext()); - PredictionRowView predictionRow = mAppsView.getFloatingHeaderView(). - findFixedRowByType(PredictionRowView.class); - if (!predictionRow.isShown() || predictionRow.getAlpha() == 0 || - launcher.isForceInvisible()) { - return true; - } - - if (mCurrentState.isEnabled != newState.isEnabled - || mCurrentState.apps.isEmpty() != newState.apps.isEmpty()) { - // If the visibility of the prediction row is changing, apply immediately. - return true; - } - - if (launcher.getDeviceProfile().isVerticalBarLayout()) { - // If we are here & mAppsView.isShown() = true, we are probably in all-apps or mid way - return false; - } - if (!launcher.isInState(OVERVIEW) && !launcher.isInState(BACKGROUND_APP)) { - // Just a fallback as we dont need to apply instantly, if we are not in the swipe-up UI - return false; - } - - // Instead of checking against 1, we should check against (1 + delta), where delta accounts - // for the nav-bar height (as app icon can still be visible under the nav-bar). Checking - // against 1, keeps the logic simple :) - return launcher.getAllAppsController().getProgress() > 1; - } - - public PredictionState getCurrentState() { - return mCurrentState; - } - - /** - * Returns ranking info for the app within all apps prediction. - * Only applicable when {@link ItemInfo#itemType} is one of the followings: - * {@link LauncherSettings.Favorites#ITEM_TYPE_APPLICATION}, - * {@link LauncherSettings.Favorites#ITEM_TYPE_SHORTCUT}, - * {@link LauncherSettings.Favorites#ITEM_TYPE_DEEP_SHORTCUT} - */ - public OptionalInt getAllAppsRank(@Nullable ItemInfo itemInfo) { - if (itemInfo == null || itemInfo.getTargetComponent() == null || itemInfo.user == null) { - return OptionalInt.empty(); - } - - if (itemInfo.itemType == ITEM_TYPE_APPLICATION - || itemInfo.itemType == ITEM_TYPE_SHORTCUT - || itemInfo.itemType == ITEM_TYPE_DEEP_SHORTCUT) { - ComponentKey key = new ComponentKey(itemInfo.getTargetComponent(), - itemInfo.user); - final List apps = getCurrentState().apps; - return IntStream.range(0, apps.size()) - .filter(index -> key.equals(apps.get(index).getComponentKey())) - .findFirst(); - } - - return OptionalInt.empty(); - } - - /** - * Fill in predicted_rank field based on app prediction. - * Only applicable when {@link ItemInfo#itemType} is one of the followings: - * {@link LauncherSettings.Favorites#ITEM_TYPE_APPLICATION}, - * {@link LauncherSettings.Favorites#ITEM_TYPE_SHORTCUT}, - * {@link LauncherSettings.Favorites#ITEM_TYPE_DEEP_SHORTCUT} - */ - public static void fillInPredictedRank( - @NonNull ItemInfo itemInfo, @NonNull LauncherLogProto.Target target) { - - final PredictionUiStateManager manager = PredictionUiStateManager.INSTANCE.getNoCreate(); - if (manager == null || itemInfo.getTargetComponent() == null || itemInfo.user == null - || (itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_APPLICATION - && itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT - && itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT)) { - return; - } - if (itemInfo.container != LauncherSettings.Favorites.CONTAINER_PREDICTION) { - HotseatPredictionController.encodeHotseatLayoutIntoPredictionRank(itemInfo, target); - return; - } - - final ComponentKey k = new ComponentKey(itemInfo.getTargetComponent(), itemInfo.user); - final List predictedApps = manager.getCurrentState().apps; - IntStream.range(0, predictedApps.size()) - .filter((i) -> k.equals(predictedApps.get(i).getComponentKey())) - .findFirst() - .ifPresent((rank) -> target.predictedRank = 0 - rank); - } - - public static class PredictionState { - - public boolean isEnabled; - public List apps; - } -} diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/AppEventProducer.java similarity index 65% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java rename to quickstep/recents_ui_overrides/src/com/android/launcher3/model/AppEventProducer.java index 8cabe3d80b..8e4c43f464 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/AppEventProducer.java @@ -13,175 +13,76 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.appprediction; +package com.android.launcher3.model; -import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_GRID; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROPPED_ON_DONT_SUGGEST; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP; -import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; +import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import android.annotation.TargetApi; -import android.app.prediction.AppPredictionContext; -import android.app.prediction.AppPredictionManager; -import android.app.prediction.AppPredictor; import android.app.prediction.AppTarget; import android.app.prediction.AppTargetEvent; import android.app.prediction.AppTargetId; import android.content.ComponentName; import android.content.Context; import android.os.Build; -import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Process; import android.os.SystemClock; import android.os.UserHandle; import android.text.TextUtils; -import android.util.Log; import androidx.annotation.AnyThread; import androidx.annotation.Nullable; -import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; -import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.appprediction.PredictionUiStateManager.Client; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logger.LauncherAtom.ContainerInfo; import com.android.launcher3.logger.LauncherAtom.FolderContainer; import com.android.launcher3.logger.LauncherAtom.HotseatContainer; import com.android.launcher3.logger.LauncherAtom.WorkspaceContainer; import com.android.launcher3.logging.StatsLogManager.EventEnum; -import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.pm.UserCache; -import com.android.quickstep.logging.StatsLogCompatManager; import com.android.quickstep.logging.StatsLogCompatManager.StatsLogConsumer; import java.util.Locale; +import java.util.function.Consumer; import java.util.function.Predicate; /** - * Subclass of app tracker which publishes the data to the prediction engine and gets back results. + * Utility class to track stats log and emit corresponding app events */ -@TargetApi(Build.VERSION_CODES.Q) -public class PredictionAppTracker extends AppLaunchTracker implements StatsLogConsumer { +@TargetApi(Build.VERSION_CODES.R) +public class AppEventProducer implements StatsLogConsumer { - private static final String TAG = "PredictionAppTracker"; - private static final boolean DBG = false; + private static final int MSG_LAUNCH = 0; - private static final int MSG_INIT = 0; - private static final int MSG_DESTROY = 1; - private static final int MSG_LAUNCH = 2; - private static final int MSG_PREDICT = 3; - - protected final Context mContext; + private final Context mContext; private final Handler mMessageHandler; + private final Consumer mCallback; - // Accessed only on worker thread - private AppPredictor mHomeAppPredictor; - - public PredictionAppTracker(Context context) { + public AppEventProducer(Context context, Consumer callback) { mContext = context; - mMessageHandler = new Handler(UI_HELPER_EXECUTOR.getLooper(), this::handleMessage); - InvariantDeviceProfile.INSTANCE.get(mContext).addOnChangeListener(this::onIdpChanged); - - mMessageHandler.sendEmptyMessage(MSG_INIT); - } - - @UiThread - private void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) { - if ((changeFlags & CHANGE_FLAG_GRID) != 0) { - // Reinitialize everything - mMessageHandler.sendEmptyMessage(MSG_INIT); - } - } - - @WorkerThread - private void destroy() { - if (mHomeAppPredictor != null) { - mHomeAppPredictor.destroy(); - mHomeAppPredictor = null; - } - StatsLogCompatManager.LOGS_CONSUMER.remove(this); - } - - @WorkerThread - private AppPredictor createPredictor(Client client, int count) { - AppPredictionManager apm = mContext.getSystemService(AppPredictionManager.class); - - if (apm == null) { - return null; - } - - AppPredictor predictor = apm.createAppPredictionSession( - new AppPredictionContext.Builder(mContext) - .setUiSurface(client.id) - .setPredictedTargetCount(count) - .setExtras(getAppPredictionContextExtras(client)) - .build()); - predictor.registerPredictionUpdates(mContext.getMainExecutor(), - PredictionUiStateManager.INSTANCE.get(mContext).appPredictorCallback(client)); - predictor.requestPredictionUpdate(); - return predictor; - } - - /** - * Override to add custom extras. - */ - @WorkerThread - @Nullable - public Bundle getAppPredictionContextExtras(Client client) { - return null; + mMessageHandler = new Handler(MODEL_EXECUTOR.getLooper(), this::handleMessage); + mCallback = callback; } @WorkerThread private boolean handleMessage(Message msg) { switch (msg.what) { - case MSG_INIT: { - // Destroy any existing clients - destroy(); - - // Initialize the clients - int count = InvariantDeviceProfile.INSTANCE.get(mContext).numAllAppsColumns; - mHomeAppPredictor = createPredictor(Client.HOME, count); - StatsLogCompatManager.LOGS_CONSUMER.add(this); - return true; - } - case MSG_DESTROY: { - destroy(); - return true; - } case MSG_LAUNCH: { - if (mHomeAppPredictor != null) { - mHomeAppPredictor.notifyAppTargetEvent((AppTargetEvent) msg.obj); - } - return true; - } - case MSG_PREDICT: { - if (mHomeAppPredictor != null) { - mHomeAppPredictor.requestPredictionUpdate(); - } + mCallback.accept((AppTargetEvent) msg.obj); return true; } } return false; } - @Override - @UiThread - public void onReturnedToHome() { - String client = Client.HOME.id; - mMessageHandler.removeMessages(MSG_PREDICT, client); - Message.obtain(mMessageHandler, MSG_PREDICT, client).sendToTarget(); - if (DBG) { - Log.d(TAG, String.format("Sent immediate message to update %s", client)); - } - } - @AnyThread private void sendEvent(LauncherAtom.ItemInfo atomInfo, int eventId) { AppTarget target = toAppTarget(atomInfo); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java new file mode 100644 index 0000000000..721e2bebd5 --- /dev/null +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.model; + +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; +import static com.android.launcher3.model.QuickstepModelDelegate.LAST_PREDICTION_ENABLED_STATE; +import static com.android.quickstep.InstantAppResolverImpl.COMPONENT_CLASS_MARKER; + +import android.app.prediction.AppTarget; +import android.content.ComponentName; +import android.content.pm.LauncherActivityInfo; +import android.content.pm.LauncherApps; +import android.content.pm.ShortcutInfo; +import android.os.UserHandle; + +import com.android.launcher3.LauncherAppState; +import com.android.launcher3.Utilities; +import com.android.launcher3.model.BgDataModel.FixedContainerItems; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Task to update model as a result of predicted apps update + */ +public class PredictionUpdateTask extends BaseModelUpdateTask { + + private final List mTargets; + private final int mContainerId; + + PredictionUpdateTask(int containerId, List targets) { + mContainerId = containerId; + mTargets = targets; + } + + @Override + public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) { + // TODO: persist the whole list + Utilities.getDevicePrefs(app.getContext()).edit() + .putBoolean(LAST_PREDICTION_ENABLED_STATE, !mTargets.isEmpty()).apply(); + + FixedContainerItems fci; + synchronized (dataModel) { + fci = dataModel.extraItems.get(mContainerId); + if (fci == null) { + return; + } + } + + Set usersForChangedShortcuts = new HashSet<>(fci.items.stream() + .filter(info -> info.itemType == ITEM_TYPE_DEEP_SHORTCUT) + .map(info -> info.user) + .collect(Collectors.toSet())); + fci.items.clear(); + + for (AppTarget target : mTargets) { + WorkspaceItemInfo itemInfo; + ShortcutInfo si = target.getShortcutInfo(); + if (si != null) { + usersForChangedShortcuts.add(si.getUserHandle()); + itemInfo = new WorkspaceItemInfo(si, app.getContext()); + app.getIconCache().getShortcutIcon(itemInfo, si); + } else { + String className = target.getClassName(); + if (COMPONENT_CLASS_MARKER.equals(className)) { + // TODO: Implement this + continue; + } + ComponentName cn = new ComponentName(target.getPackageName(), className); + UserHandle user = target.getUser(); + itemInfo = apps.data.stream() + .filter(info -> user.equals(info.user) && cn.equals(info.componentName)) + .map(AppInfo::makeWorkspaceItem) + .findAny() + .orElseGet(() -> { + LauncherActivityInfo lai = app.getContext() + .getSystemService(LauncherApps.class) + .resolveActivity(AppInfo.makeLaunchIntent(cn), user); + if (lai == null) { + return null; + } + AppInfo ai = new AppInfo(app.getContext(), lai, user); + app.getIconCache().getTitleAndIcon(ai, lai, false); + return ai.makeWorkspaceItem(); + }); + + if (itemInfo == null) { + continue; + } + } + + itemInfo.container = mContainerId; + fci.items.add(itemInfo); + } + + bindExtraContainerItems(fci); + usersForChangedShortcuts.forEach( + u -> dataModel.updateShortcutPinnedState(app.getContext(), u)); + } +} diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java new file mode 100644 index 0000000000..b5164695d5 --- /dev/null +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.model; + +import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_GRID; +import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION; + +import android.app.prediction.AppPredictionContext; +import android.app.prediction.AppPredictionManager; +import android.app.prediction.AppPredictor; +import android.app.prediction.AppTarget; +import android.app.prediction.AppTargetEvent; +import android.content.Context; + +import androidx.annotation.WorkerThread; + +import com.android.launcher3.InvariantDeviceProfile; +import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener; +import com.android.launcher3.model.BgDataModel.FixedContainerItems; +import com.android.launcher3.util.Executors; +import com.android.quickstep.logging.StatsLogCompatManager; + +import java.util.List; + +/** + * Model delegate which loads prediction items + */ +public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChangeListener { + + public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state"; + + private final InvariantDeviceProfile mIDP; + private final AppEventProducer mAppEventProducer; + + private AppPredictor mAllAppsPredictor; + private boolean mActive = false; + + public QuickstepModelDelegate(Context context) { + mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent); + + mIDP = InvariantDeviceProfile.INSTANCE.get(context); + mIDP.addOnChangeListener(this); + StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer); + } + + @Override + public void loadItems() { + // TODO: Implement caching and preloading + super.loadItems(); + mDataModel.extraItems.put( + CONTAINER_PREDICTION, new FixedContainerItems(CONTAINER_PREDICTION)); + + mActive = true; + recreatePredictors(); + } + + @Override + public void validateData() { + super.validateData(); + if (mAllAppsPredictor != null) { + mAllAppsPredictor.requestPredictionUpdate(); + } + } + + @Override + public void destroy() { + super.destroy(); + mActive = false; + StatsLogCompatManager.LOGS_CONSUMER.remove(mAppEventProducer); + + destroyPredictors(); + mIDP.removeOnChangeListener(this); + } + + private void destroyPredictors() { + if (mAllAppsPredictor != null) { + mAllAppsPredictor.destroy(); + mAllAppsPredictor = null; + } + } + + @WorkerThread + private void recreatePredictors() { + destroyPredictors(); + if (!mActive) { + return; + } + + Context context = mApp.getContext(); + AppPredictionManager apm = context.getSystemService(AppPredictionManager.class); + if (apm == null) { + return; + } + + int count = mIDP.numAllAppsColumns; + + mAllAppsPredictor = apm.createAppPredictionSession( + new AppPredictionContext.Builder(context) + .setUiSurface("home") + .setPredictedTargetCount(count) + .build()); + mAllAppsPredictor.registerPredictionUpdates( + Executors.MODEL_EXECUTOR, this::onAllAppsPredictionChanged); + mAllAppsPredictor.requestPredictionUpdate(); + } + + private void onAllAppsPredictionChanged(List targets) { + mApp.getModel().enqueueModelUpdateTask( + new PredictionUpdateTask(CONTAINER_PREDICTION, targets)); + } + + @Override + public void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) { + if ((changeFlags & CHANGE_FLAG_GRID) != 0) { + // Reinitialize everything + Executors.MODEL_EXECUTOR.execute(this::recreatePredictors); + } + } + + private void onAppTargetEvent(AppTargetEvent event) { + if (mAllAppsPredictor != null) { + mAllAppsPredictor.notifyAppTargetEvent(event); + } + } +} diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index f87138e536..23a05295bf 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -17,6 +17,9 @@ package com.android.launcher3.uioverrides; import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; @@ -37,16 +40,18 @@ import android.view.View; import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.LauncherState; import com.android.launcher3.Workspace; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorPlaybackController; -import com.android.launcher3.appprediction.PredictionUiStateManager; +import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.Folder; import com.android.launcher3.hybridhotseat.HotseatPredictionController; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.StatsLogManager.StatsLogger; +import com.android.launcher3.model.BgDataModel.FixedContainerItems; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -79,7 +84,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; -import java.util.OptionalInt; +import java.util.Objects; import java.util.stream.Stream; public class QuickstepLauncher extends BaseQuickstepLauncher { @@ -91,6 +96,8 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { public static final AsyncCommand SET_SHELF_HEIGHT = (context, arg1, arg2) -> SystemUiProxy.INSTANCE.get(context).setShelfHeight(arg1 != 0, arg2); + private FixedContainerItems mAllAppsPredictions; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -111,8 +118,23 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { protected void logAppLaunch(ItemInfo info, InstanceId instanceId) { StatsLogger logger = getStatsLogManager() .logger().withItemInfo(info).withInstanceId(instanceId); - OptionalInt allAppsRank = PredictionUiStateManager.INSTANCE.get(this).getAllAppsRank(info); - allAppsRank.ifPresent(logger::withRank); + + if (mAllAppsPredictions != null + && (info.itemType == ITEM_TYPE_APPLICATION + || info.itemType == ITEM_TYPE_SHORTCUT + || info.itemType == ITEM_TYPE_DEEP_SHORTCUT)) { + int count = mAllAppsPredictions.items.size(); + for (int i = 0; i < count; i++) { + ItemInfo targetInfo = mAllAppsPredictions.items.get(i); + if (targetInfo.itemType == info.itemType + && targetInfo.user.equals(info.user) + && Objects.equals(targetInfo.getIntent(), info.getIntent())) { + logger.withRank(i); + break; + } + + } + } logger.log(LAUNCHER_APP_LAUNCH_TAP); if (mHotseatPredictionController != null) { @@ -199,6 +221,15 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { } } + @Override + public void bindExtraContainerItems(FixedContainerItems item) { + if (item.containerId == Favorites.CONTAINER_PREDICTION) { + mAllAppsPredictions = item; + getAppsView().getFloatingHeaderView().findFixedRowByType(PredictionRowView.class) + .setPredictedApps(item.items); + } + } + @Override public void onDestroy() { super.onDestroy(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index b02035516d..5a35eb5eb2 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -41,7 +41,6 @@ import com.android.launcher3.R; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.appprediction.PredictionUiStateManager; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty; import com.android.launcher3.statemanager.StateManager; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java deleted file mode 100644 index e0008033b4..0000000000 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.quickstep.logging; - -import android.content.Context; - -import androidx.annotation.NonNull; - -import com.android.launcher3.appprediction.PredictionUiStateManager; -import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto; - -import java.util.ArrayList; - -/** - * This class handles AOSP MetricsLogger function calls and logging around - * quickstep interactions and app launches. - */ -@SuppressWarnings("unused") -public class UserEventDispatcherAppPredictionExtension extends UserEventDispatcherExtension { - - public static final int ALL_APPS_PREDICTION_TIPS = 2; - - private static final String TAG = "UserEventDispatcher"; - - public UserEventDispatcherAppPredictionExtension(Context context) { - super(context); - } - - @Override - protected void onFillInLogContainerData( - @NonNull ItemInfo itemInfo, @NonNull LauncherLogProto.Target target, - @NonNull ArrayList targets) { - PredictionUiStateManager.fillInPredictedRank(itemInfo, target); - } -} diff --git a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java deleted file mode 100644 index 5904fcd691..0000000000 --- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.android.quickstep; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -import android.app.prediction.AppPredictor; -import android.app.prediction.AppTarget; -import android.app.prediction.AppTargetId; -import android.content.ComponentName; -import android.content.pm.LauncherActivityInfo; -import android.content.pm.LauncherApps; -import android.os.Process; -import android.view.View; - -import androidx.test.filters.LargeTest; -import androidx.test.runner.AndroidJUnit4; - -import com.android.launcher3.BubbleTextView; -import com.android.launcher3.Launcher; -import com.android.launcher3.appprediction.PredictionRowView; -import com.android.launcher3.appprediction.PredictionUiStateManager; -import com.android.launcher3.appprediction.PredictionUiStateManager.Client; -import com.android.launcher3.model.AppLaunchTracker; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.ArrayList; -import java.util.List; - -@LargeTest -@RunWith(AndroidJUnit4.class) -public class AppPredictionsUITests extends AbstractQuickStepTest { - - private LauncherActivityInfo mSampleApp1; - private LauncherActivityInfo mSampleApp2; - private LauncherActivityInfo mSampleApp3; - - private AppPredictor.Callback mCallback; - - @Before - public void setUp() throws Exception { - super.setUp(); - - List activities = mTargetContext.getSystemService(LauncherApps.class) - .getActivityList(null, Process.myUserHandle()); - mSampleApp1 = activities.get(0); - mSampleApp2 = activities.get(1); - mSampleApp3 = activities.get(2); - - // Disable app tracker - AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker()); - PredictionUiStateManager.INSTANCE.initializeForTesting(null); - - mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback( - Client.HOME); - - mDevice.setOrientationNatural(); - } - - @After - public void tearDown() throws Throwable { - AppLaunchTracker.INSTANCE.initializeForTesting(null); - PredictionUiStateManager.INSTANCE.initializeForTesting(null); - mDevice.unfreezeRotation(); - } - - /** - * Test that prediction UI is updated as soon as we get predictions from the system - */ - @Test - public void testPredictionExistsInAllApps() { - mLauncher.pressHome().switchToAllApps(); - - // Dispatch an update - sendPredictionUpdate(mSampleApp1, mSampleApp2); - // The first update should apply immediately. - waitForLauncherCondition("Predictions were not updated in loading state", - launcher -> getPredictedApp(launcher).size() == 2); - } - - /** - * Test that prediction update is deferred if it is already visible - */ - @Test - public void testPredictionsDeferredUntilHome() { - mDevice.pressHome(); - sendPredictionUpdate(mSampleApp1, mSampleApp2); - mLauncher.pressHome().switchToAllApps(); - waitForLauncherCondition("Predictions were not updated in loading state", - launcher -> getPredictedApp(launcher).size() == 2); - - // Update predictions while all-apps is visible - sendPredictionUpdate(mSampleApp1, mSampleApp2, mSampleApp3); - assertEquals(2, getFromLauncher(this::getPredictedApp).size()); - - // Go home and go back to all-apps - mLauncher.pressHome().switchToAllApps(); - assertEquals(3, getFromLauncher(this::getPredictedApp).size()); - } - - @Test - public void testPredictionsDisabled() { - mDevice.pressHome(); - sendPredictionUpdate(); - mLauncher.pressHome().switchToAllApps(); - - waitForLauncherCondition("Predictions were not updated in loading state", - launcher -> launcher.getAppsView().getFloatingHeaderView() - .findFixedRowByType(PredictionRowView.class).getVisibility() == View.GONE); - assertFalse(PredictionUiStateManager.INSTANCE.get(mTargetContext) - .getCurrentState().isEnabled); - } - - public ArrayList getPredictedApp(Launcher launcher) { - PredictionRowView container = launcher.getAppsView().getFloatingHeaderView() - .findFixedRowByType(PredictionRowView.class); - - ArrayList predictedAppViews = new ArrayList<>(); - for (int i = 0; i < container.getChildCount(); i++) { - View view = container.getChildAt(i); - if (view instanceof BubbleTextView && view.getVisibility() == View.VISIBLE) { - predictedAppViews.add((BubbleTextView) view); - } - } - return predictedAppViews; - } - - private void sendPredictionUpdate(LauncherActivityInfo... activities) { - getOnUiThread(() -> { - List targets = new ArrayList<>(activities.length); - for (LauncherActivityInfo info : activities) { - ComponentName cn = info.getComponentName(); - AppTarget target = new AppTarget.Builder( - new AppTargetId("app:" + cn), cn.getPackageName(), info.getUser()) - .setClassName(cn.getClassName()) - .build(); - targets.add(target); - } - mCallback.onTargetsAvailable(targets); - return null; - }); - } -} diff --git a/res/values/config.xml b/res/values/config.xml index 75fcc907db..dc8bdffca3 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -70,6 +70,7 @@ + diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index e49c4559f0..1123c79b37 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -119,7 +119,6 @@ import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logging.FileLog; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.UserEventDispatcher; -import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.model.data.AppInfo; @@ -911,14 +910,12 @@ public class Launcher extends StatefulActivity implements Launche logStopAndResume(Action.Command.RESUME); getUserEventDispatcher().startSession(); - AppLaunchTracker.INSTANCE.get(this).onReturnedToHome(); - // Process any items that were added while Launcher was away. InstallShortcutReceiver.disableAndFlushInstallQueue( InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this); // Refresh shortcuts if the permission changed. - mModel.refreshShortcutsIfRequired(); + mModel.validateModelDataOnResume(); // Set the notification listener and fetch updated notifications when we resume NotificationListener.setNotificationsChangedListener(mPopupDataProvider); diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 53e5274c0c..e3fe87d1e9 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -128,7 +128,7 @@ public class LauncherAppState { mInvariantDeviceProfile = InvariantDeviceProfile.INSTANCE.get(context); mIconCache = new IconCache(mContext, mInvariantDeviceProfile, iconCacheFileName); mWidgetCache = new WidgetPreviewLoader(mContext, mIconCache); - mModel = new LauncherModel(this, mIconCache, AppFilter.newInstance(mContext)); + mModel = new LauncherModel(context, this, mIconCache, AppFilter.newInstance(mContext)); mPredictionModel = PredictionModel.newInstance(mContext); } @@ -157,6 +157,7 @@ public class LauncherAppState { * Call from Application.onTerminate(), which is not guaranteed to ever be called. */ public void onTerminate() { + mModel.destroy(); if (mModelChangeReceiver != null) { mContext.unregisterReceiver(mModelChangeReceiver); } diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index ff4b545a06..e2568d5ef6 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -20,7 +20,6 @@ import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD; import static com.android.launcher3.config.FeatureFlags.IS_STUDIO_BUILD; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; -import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission; import android.content.Context; import android.content.Intent; @@ -46,6 +45,7 @@ import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.CacheDataUpdatedTask; import com.android.launcher3.model.LoaderResults; import com.android.launcher3.model.LoaderTask; +import com.android.launcher3.model.ModelDelegate; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.model.PackageInstallStateChangedTask; import com.android.launcher3.model.PackageUpdatedTask; @@ -112,20 +112,22 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi */ private final BgDataModel mBgDataModel = new BgDataModel(); + private final ModelDelegate mModelDelegate; + // Runnable to check if the shortcuts permission has changed. - private final Runnable mShortcutPermissionCheckRunnable = new Runnable() { + private final Runnable mDataValidationCheck = new Runnable() { @Override public void run() { - if (mModelLoaded && hasShortcutsPermission(mApp.getContext()) - != mBgAllAppsList.hasShortcutHostPermission()) { - forceReload(); + if (mModelLoaded) { + mModelDelegate.validateData(); } } }; - LauncherModel(LauncherAppState app, IconCache iconCache, AppFilter appFilter) { + LauncherModel(Context context, LauncherAppState app, IconCache iconCache, AppFilter appFilter) { mApp = app; mBgAllAppsList = new AllAppsList(iconCache, appFilter); + mModelDelegate = ModelDelegate.newInstance(context, app, mBgAllAppsList, mBgDataModel); } /** @@ -217,6 +219,13 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi } } + /** + * Called when the model is destroyed + */ + public void destroy() { + MODEL_EXECUTOR.execute(mModelDelegate::destroy); + } + public void onBroadcastIntent(Intent intent) { if (DEBUG_RECEIVER) Log.d(TAG, "onReceive intent=" + intent); final String action = intent.getAction(); @@ -372,7 +381,8 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi public void startLoaderForResults(LoaderResults results) { synchronized (mLock) { stopLoader(); - mLoaderTask = new LoaderTask(mApp, mBgAllAppsList, mBgDataModel, results); + mLoaderTask = new LoaderTask( + mApp, mBgAllAppsList, mBgDataModel, mModelDelegate, results); // Always post the loader task, instead of running directly (even on same thread) so // that we exit any nested synchronized blocks @@ -491,9 +501,9 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi * Current implementation simply reloads the workspace, but it can be optimized to * use partial updates similar to {@link UserCache} */ - public void refreshShortcutsIfRequired() { - MODEL_EXECUTOR.getHandler().removeCallbacks(mShortcutPermissionCheckRunnable); - MODEL_EXECUTOR.post(mShortcutPermissionCheckRunnable); + public void validateModelDataOnResume() { + MODEL_EXECUTOR.getHandler().removeCallbacks(mDataValidationCheck); + MODEL_EXECUTOR.post(mDataValidationCheck); } /** diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index a424f8458a..d8eb838ed5 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -74,6 +74,7 @@ import com.android.launcher3.model.BgDataModel; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.LoaderResults; import com.android.launcher3.model.LoaderTask; +import com.android.launcher3.model.ModelDelegate; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.model.WidgetsModel; import com.android.launcher3.model.data.AppInfo; @@ -579,7 +580,7 @@ public class LauncherPreviewRenderer { private final FutureTask mTask = new FutureTask<>(this); WorkspaceItemsInfoFromPreviewFetcher(LauncherAppState app) { - super(app, null, new BgDataModel(), null); + super(app, null, new BgDataModel(), new ModelDelegate(), null); } @Override diff --git a/src/com/android/launcher3/model/AppLaunchTracker.java b/src/com/android/launcher3/model/AppLaunchTracker.java deleted file mode 100644 index a93c0dd77c..0000000000 --- a/src/com/android/launcher3/model/AppLaunchTracker.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.launcher3.model; - -import static com.android.launcher3.util.MainThreadInitializedObject.forOverride; - -import com.android.launcher3.R; -import com.android.launcher3.util.MainThreadInitializedObject; -import com.android.launcher3.util.ResourceBasedOverride; - -/** - * Callback for receiving various app launch events - */ -public class AppLaunchTracker implements ResourceBasedOverride { - - public static final MainThreadInitializedObject INSTANCE = - forOverride(AppLaunchTracker.class, R.string.app_launch_tracker_class); - - public void onReturnedToHome() { } -} diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java index dfdc1387ff..6158a9c6b4 100644 --- a/src/com/android/launcher3/model/BgDataModel.java +++ b/src/com/android/launcher3/model/BgDataModel.java @@ -108,13 +108,6 @@ public class BgDataModel { */ public final ArrayList cachedPredictedItems = new ArrayList<>(); - /** - * @see Callbacks#FLAG_HAS_SHORTCUT_PERMISSION - * @see Callbacks#FLAG_QUIET_MODE_ENABLED - * @see Callbacks#FLAG_QUIET_MODE_CHANGE_PERMISSION - */ - public int flags; - /** * Maps all launcher activities to counts of their shortcuts. */ diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java index bea00869ee..b0679095f3 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -109,6 +109,7 @@ public class LoaderTask implements Runnable { protected final LauncherAppState mApp; private final AllAppsList mBgAllAppsList; protected final BgDataModel mBgDataModel; + private final ModelDelegate mModelDelegate; private FirstScreenBroadcast mFirstScreenBroadcast; @@ -128,10 +129,11 @@ public class LoaderTask implements Runnable { private boolean mStopped; public LoaderTask(LauncherAppState app, AllAppsList bgAllAppsList, BgDataModel dataModel, - LoaderResults results) { + ModelDelegate modelDelegate, LoaderResults results) { mApp = app; mBgAllAppsList = bgAllAppsList; mBgDataModel = dataModel; + mModelDelegate = modelDelegate; mResults = results; mLauncherApps = mApp.getContext().getSystemService(LauncherApps.class); @@ -767,6 +769,9 @@ public class LoaderTask implements Runnable { IOUtils.closeSilently(c); } + // Load delegate items + mModelDelegate.loadItems(); + // Break early if we've stopped loading if (mStopped) { mBgDataModel.clear(); diff --git a/src/com/android/launcher3/model/ModelDelegate.java b/src/com/android/launcher3/model/ModelDelegate.java new file mode 100644 index 0000000000..ce4eed5bbd --- /dev/null +++ b/src/com/android/launcher3/model/ModelDelegate.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.model; + +import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission; + +import android.content.Context; + +import androidx.annotation.WorkerThread; + +import com.android.launcher3.LauncherAppState; +import com.android.launcher3.R; +import com.android.launcher3.util.ResourceBasedOverride; + +/** + * Class to extend LauncherModel functionality to provide extra data + */ +public class ModelDelegate implements ResourceBasedOverride { + + /** + * Creates and initializes a new instance of the delegate + */ + public static ModelDelegate newInstance( + Context context, LauncherAppState app, AllAppsList appsList, BgDataModel dataModel) { + ModelDelegate delegate = Overrides.getObject( + ModelDelegate.class, context, R.string.model_delegate_class); + + delegate.mApp = app; + delegate.mAppsList = appsList; + delegate.mDataModel = dataModel; + return delegate; + } + + protected LauncherAppState mApp; + protected AllAppsList mAppsList; + protected BgDataModel mDataModel; + + public ModelDelegate() { } + + /** + * Called periodically to validate and update any data + */ + @WorkerThread + public void validateData() { + if (hasShortcutsPermission(mApp.getContext()) + != mAppsList.hasShortcutHostPermission()) { + mApp.getModel().forceReload(); + } + } + + /** + * Load delegate items if any in the data model + */ + @WorkerThread + public void loadItems() { } + + /** + * Called when the delegate is no loner needed + */ + @WorkerThread + public void destroy() { } +} diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 858e183ab7..201218b79a 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -53,7 +53,6 @@ import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; import com.android.launcher3.common.WidgetUtils; -import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.tapl.LauncherInstrumentation; @@ -272,8 +271,6 @@ public abstract class AbstractLauncherUiTest { } mLauncherPid = 0; - // Disable app tracker - AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker()); mTargetContext = InstrumentationRegistry.getTargetContext(); mTargetPackage = mTargetContext.getPackageName(); From 16eb9226c5c21e6cb6913c50b7b13057b851152c Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 7 Jul 2020 19:25:25 -0700 Subject: [PATCH 61/72] Fix adjacent task offset distance Instead of calculating an overall distance for tasks to translate based on RecentsView width, calculate the distance for the tasks to the left and right of the midpoint based on how far the first adjacent tasks in those directions are from being offscreen. Changes made to make "distance to offscreen" calculations possible: - Update TaskView curve scale to reach final scale as soon as it is completely offscreen. Before, it would reach its final scale just shy of that point (calculations were off). - As we update RecentsView scale, calculate how much the new scale will push out tasks that are just offscreen. - With both above, we can calculate the scale and position of a TaskView such that it is just offscreen, and interpolate between its current position and that position. Tests: - Task comes in immediately when quick switching from home, and doesn't shift as you swipe directly upwards. - When swiping far up from an app, tasks come in from all the way offscreen, and cover distance appropriately (e.g. if you're scrolled a bit to the right when you pause, the left adjacent app will move faster to cover the farther distance). - Task modalness: entering Select mode now animates adjacent tasks at the same rate as the scaling up, because they move only the distance needed to get offscreen (before they moved way too far and thus seemed to be much faster than the rest of the animation). Bug: 149934536 Change-Id: Ie3fffe0e5c304cb16e7637f058f5ce72cee40aeb Merged-In: Ie3fffe0e5c304cb16e7637f058f5ce72cee40aeb --- .../QuickstepAtomicAnimationFactory.java | 4 +- .../NoButtonQuickSwitchTouchController.java | 7 +- .../FallbackRecentsStateController.java | 4 +- .../quickstep/util/TaskViewSimulator.java | 6 +- .../android/quickstep/views/RecentsView.java | 126 ++++++++++++++++-- .../BaseRecentsViewStateController.java | 6 +- .../quickstep/BaseActivityInterface.java | 4 +- src/com/android/launcher3/PagedView.java | 21 ++- .../touch/LandscapePagedViewHandler.java | 1 + .../touch/PagedOrientationHandler.java | 1 + .../touch/PortraitPagedViewHandler.java | 1 + 11 files changed, 146 insertions(+), 35 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index a0af79743b..131fcbfbf1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -17,7 +17,6 @@ package com.android.launcher3.uioverrides.states; import static android.view.View.VISIBLE; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; @@ -52,6 +51,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_S import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.animation.Animator; import android.animation.AnimatorSet; @@ -212,7 +212,7 @@ public class QuickstepAtomicAnimationFactory extends // Scale up the recents, if it is not coming from the side RecentsView overview = mActivity.getOverviewPanel(); if (overview.getVisibility() != VISIBLE || overview.getContentAlpha() == 0) { - SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE); + RECENTS_SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE); } } config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 1b439d1d31..821ada400e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; @@ -47,6 +46,7 @@ import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.Animator; @@ -244,7 +244,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, final LauncherState toState = OVERVIEW; // Set RecentView's initial properties. - SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]); + RECENTS_SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]); ADJACENT_PAGE_OFFSET.set(mRecentsView, 1f); mRecentsView.setContentAlpha(1); mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress()); @@ -266,7 +266,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // - RecentsView scale // - RecentsView fullscreenProgress PendingAnimation yAnim = new PendingAnimation((long) (mYRange * 2)); - yAnim.setFloat(mRecentsView, SCALE_PROPERTY, scaleAndOffset[0], SCALE_DOWN_INTERPOLATOR); + yAnim.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0], + SCALE_DOWN_INTERPOLATOR); yAnim.setFloat(mRecentsView, FULLSCREEN_PROGRESS, toState.getOverviewFullscreenProgress(), SCALE_DOWN_INTERPOLATOR); mYOverviewAnim = yAnim.createPlaybackController(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 3f1e7bad9b..163c23268b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -15,7 +15,6 @@ */ package com.android.quickstep.fallback; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; @@ -25,6 +24,7 @@ import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVER import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.TASK_MODALNESS; import com.android.launcher3.anim.PendingAnimation; @@ -82,7 +82,7 @@ public class FallbackRecentsStateController implements StateHandler { }); mCurrentFullscreenParams = new FullscreenDrawParams(context); - mPageSpacing = context.getResources().getDimensionPixelSize(R.dimen.recents_page_spacing); } /** @@ -251,7 +248,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { int start = mOrientationState.getOrientationHandler() .getPrimaryValue(mTaskRect.left, mTaskRect.top); mScrollState.screenCenter = start + mScrollState.scroll + mScrollState.halfPageSize; - mScrollState.updateInterpolation(start, mPageSpacing); + mScrollState.pageParentScale = recentsViewScale.value; + mScrollState.updateInterpolation(start); mCurveScale = TaskView.getCurveScaleForInterpolation(mScrollState.linearInterpolation); } 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 26e6d87a67..9c93fed833 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 @@ -22,7 +22,6 @@ import static android.view.View.MeasureSpec.makeMeasureSpec; import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.Utilities.EDGE_NAV_BAR; @@ -62,6 +61,7 @@ import android.graphics.Canvas; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; +import android.graphics.RectF; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Build; @@ -209,6 +209,23 @@ public abstract class RecentsView extends PagedView } }; + /** Same as normal SCALE_PROPERTY, but also updates page offsets that depend on this scale. */ + public static final FloatProperty RECENTS_SCALE_PROPERTY = + new FloatProperty("recentsScale") { + @Override + public void setValue(RecentsView view, float scale) { + view.setScaleX(scale); + view.setScaleY(scale); + view.mLastComputedTaskPushOutDistance = null; + view.updatePageOffsets(); + } + + @Override + public Float get(RecentsView view) { + return view.getScaleX(); + } + }; + protected RecentsOrientedState mOrientationState; protected final BaseActivityInterface mSizeStrategy; protected RecentsAnimationController mRecentsAnimationController; @@ -216,8 +233,12 @@ public abstract class RecentsView extends PagedView protected SurfaceTransactionApplier mSyncTransactionApplier; protected int mTaskWidth; protected int mTaskHeight; + protected final Rect mLastComputedTaskSize = new Rect(); + // How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot. + protected Float mLastComputedTaskPushOutDistance = null; protected boolean mEnableDrawingLiveTile = false; protected final Rect mTempRect = new Rect(); + protected final RectF mTempRectF = new RectF(); private final PointF mTempPointF = new PointF(); private static final int DISMISS_TASK_DURATION = 300; @@ -864,6 +885,7 @@ public abstract class RecentsView extends PagedView public void getTaskSize(Rect outRect) { mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(), outRect, mOrientationHandler); + mLastComputedTaskSize.set(outRect); } /** Gets the task size for modal state. */ @@ -905,8 +927,8 @@ public abstract class RecentsView extends PagedView final int pageCount = getPageCount(); for (int i = 0; i < pageCount; i++) { View page = getPageAt(i); - mScrollState.updateInterpolation(mOrientationHandler.getChildStartWithTranslation(page), - mPageSpacing); + mScrollState.updateInterpolation( + mOrientationHandler.getChildStartWithTranslation(page)); ((PageCallbacks) page).onPageScroll(mScrollState); } } @@ -1321,10 +1343,14 @@ public abstract class RecentsView extends PagedView /** * Updates linearInterpolation for the provided child position */ - public void updateInterpolation(float childStart, int pageSpacing) { - float pageCenter = childStart + halfPageSize; + public void updateInterpolation(float childStart) { + float scaledHalfPageSize = halfPageSize / pageParentScale; + float pageCenter = childStart + scaledHalfPageSize; float distanceFromScreenCenter = screenCenter - pageCenter; - float distanceToReachEdge = halfScreenSize + halfPageSize + pageSpacing; + // How far the page has to move from the center to be offscreen, taking into account + // the EDGE_SCALE_DOWN_FACTOR that will be applied at that position. + float distanceToReachEdge = halfScreenSize + + scaledHalfPageSize * (1 - TaskView.EDGE_SCALE_DOWN_FACTOR); linearInterpolation = Math.min(1, Math.abs(distanceFromScreenCenter) / distanceToReachEdge); } @@ -1761,14 +1787,15 @@ public abstract class RecentsView extends PagedView setPivotX(mTempPointF.x); setPivotY(mTempPointF.y); setTaskModalness(mTaskModalness); + mLastComputedTaskPushOutDistance = null; updatePageOffsets(); setImportantForAccessibility(isModal() ? IMPORTANT_FOR_ACCESSIBILITY_NO : IMPORTANT_FOR_ACCESSIBILITY_AUTO); } private void updatePageOffsets() { - float offset = mAdjacentPageOffset * getWidth(); - float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness) * getWidth(); + float offset = mAdjacentPageOffset; + float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness); if (mIsRtl) { offset = -offset; modalOffset = -modalOffset; @@ -1777,18 +1804,89 @@ public abstract class RecentsView extends PagedView TaskView runningTask = mRunningTaskId == -1 || !mRunningTaskTileHidden ? null : getTaskView(mRunningTaskId); - int midPoint = runningTask == null ? -1 : indexOfChild(runningTask); - int currentPage = getCurrentPage(); + int midpoint = runningTask == null ? -1 : indexOfChild(runningTask); + int modalMidpoint = getCurrentPage(); + + float midpointOffsetSize = 0; + float leftOffsetSize = midpoint - 1 >= 0 + ? -getOffsetSize(midpoint - 1, midpoint, offset) + : 0; + float rightOffsetSize = midpoint + 1 < count + ? getOffsetSize(midpoint + 1, midpoint, offset) + : 0; + + float modalMidpointOffsetSize = 0; + float modalLeftOffsetSize = modalMidpoint - 1 >= 0 + ? -getOffsetSize(modalMidpoint - 1, modalMidpoint, modalOffset) + : 0; + float modalRightOffsetSize = modalMidpoint + 1 < count + ? getOffsetSize(modalMidpoint + 1, modalMidpoint, modalOffset) + : 0; for (int i = 0; i < count; i++) { - float translation = i == midPoint ? 0 : (i < midPoint ? -offset : offset); - float modalTranslation = - i == currentPage ? 0 : (i < currentPage ? -modalOffset : modalOffset); + float translation = i == midpoint + ? midpointOffsetSize + : i < midpoint + ? leftOffsetSize + : rightOffsetSize; + float modalTranslation = i == modalMidpoint + ? modalMidpointOffsetSize + : i < modalMidpoint + ? modalLeftOffsetSize + : modalRightOffsetSize; getChildAt(i).setTranslationX(translation + modalTranslation); } updateCurveProperties(); } + /** + * Computes the distance to offset the given child such that it is completely offscreen when + * translating away from the given midpoint. + * @param offsetProgress From 0 to 1 where 0 means no offset and 1 means offset offscreen. + */ + private float getOffsetSize(int childIndex, int midpointIndex, float offsetProgress) { + if (offsetProgress == 0) { + // Don't bother calculating everything below if we won't offset anyway. + return 0; + } + // First, get the position of the task relative to the midpoint. If there is no midpoint + // then we just use the normal (centered) task position. + mTempRectF.set(mLastComputedTaskSize); + RectF taskPosition = mTempRectF; + float desiredLeft = getWidth(); + float distanceToOffscreen = desiredLeft - taskPosition.left; + // Used to calculate the scale of the task view based on its new offset. + float centerToOffscreenProgress = Math.abs(offsetProgress); + if (midpointIndex > -1) { + // When there is a midpoint reference task, adjacent tasks have less distance to travel + // to reach offscreen. Offset the task position to the task's starting point. + View child = getChildAt(childIndex); + View midpointChild = getChildAt(midpointIndex); + int distanceFromMidpoint = Math.abs(mOrientationHandler.getChildStart(child) + - mOrientationHandler.getChildStart(midpointChild) + + getDisplacementFromScreenCenter(midpointIndex)); + taskPosition.offset(distanceFromMidpoint, 0); + centerToOffscreenProgress = Utilities.mapRange(centerToOffscreenProgress, + distanceFromMidpoint / distanceToOffscreen, 1); + } + // Find the task's scale based on its offscreen progress, then see how far it still needs to + // move to be completely offscreen. + Utilities.scaleRectFAboutCenter(taskPosition, + TaskView.getCurveScaleForInterpolation(centerToOffscreenProgress)); + distanceToOffscreen = desiredLeft - taskPosition.left; + // Finally, we need to account for RecentsView scale, because it moves tasks based on its + // pivot. To do this, we move the task position to where it would be offscreen at scale = 1 + // (computed above), then we apply the scale via getMatrix() to determine how much that + // moves the task from its desired position, and adjust the computed distance accordingly. + if (mLastComputedTaskPushOutDistance == null) { + taskPosition.offsetTo(desiredLeft, 0); + getMatrix().mapRect(taskPosition); + mLastComputedTaskPushOutDistance = (taskPosition.left - desiredLeft) / getScaleX(); + } + distanceToOffscreen -= mLastComputedTaskPushOutDistance; + return distanceToOffscreen * offsetProgress; + } + /** * TODO: Do not assume motion across X axis for adjacent page */ @@ -1887,7 +1985,7 @@ public abstract class RecentsView extends PagedView float toScale = getMaxScaleForFullScreen(); if (launchingCenterTask) { RecentsView recentsView = tv.getRecentsView(); - anim.play(ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, toScale)); + anim.play(ObjectAnimator.ofFloat(recentsView, RECENTS_SCALE_PROPERTY, toScale)); anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1)); } else { // We are launching an adjacent task, so parallax the center and other adjacent task. diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index ec3a4905f5..6e120e8bd8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -16,7 +16,6 @@ package com.android.launcher3.uioverrides; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS; @@ -29,6 +28,7 @@ import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVER import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_SCALE; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.util.FloatProperty; @@ -61,7 +61,7 @@ public abstract class BaseRecentsViewStateController @Override public void setState(@NonNull LauncherState state) { float[] scaleAndOffset = state.getOverviewScaleAndOffset(mLauncher); - SCALE_PROPERTY.set(mRecentsView, scaleAndOffset[0]); + RECENTS_SCALE_PROPERTY.set(mRecentsView, scaleAndOffset[0]); ADJACENT_PAGE_OFFSET.set(mRecentsView, scaleAndOffset[1]); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); @@ -93,7 +93,7 @@ public abstract class BaseRecentsViewStateController void setStateWithAnimationInternal(@NonNull final LauncherState toState, @NonNull StateAnimationConfig config, @NonNull PendingAnimation setter) { float[] scaleAndOffset = toState.getOverviewScaleAndOffset(mLauncher); - setter.setFloat(mRecentsView, SCALE_PROPERTY, scaleAndOffset[0], + setter.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0], config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR)); setter.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR)); diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 56005893cd..df8f31d2c0 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -15,7 +15,6 @@ */ package com.android.quickstep; -import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; @@ -28,6 +27,7 @@ import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_REC import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; +import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.animation.Animator; import android.annotation.TargetApi; @@ -400,7 +400,7 @@ public abstract class BaseActivityInterface extends ViewGrou int minDistanceFromScreenCenterIndex = -1; final int childCount = getChildCount(); for (int i = 0; i < childCount; ++i) { - View layout = getPageAt(i); - int childSize = mOrientationHandler.getMeasuredSize(layout); - int halfChildSize = (childSize / 2); - int childCenter = getChildOffset(i) + halfChildSize; - int distanceFromScreenCenter = Math.abs(childCenter - screenCenter); + int distanceFromScreenCenter = Math.abs( + getDisplacementFromScreenCenter(i, screenCenter)); if (distanceFromScreenCenter < minDistanceFromScreenCenter) { minDistanceFromScreenCenter = distanceFromScreenCenter; minDistanceFromScreenCenterIndex = i; @@ -1461,6 +1458,20 @@ public abstract class PagedView extends ViewGrou return minDistanceFromScreenCenterIndex; } + private int getDisplacementFromScreenCenter(int childIndex, int screenCenter) { + View layout = getPageAt(childIndex); + int childSize = mOrientationHandler.getMeasuredSize(layout); + int halfChildSize = (childSize / 2); + int childCenter = getChildOffset(childIndex) + halfChildSize; + return childCenter - screenCenter; + } + + protected int getDisplacementFromScreenCenter(int childIndex) { + int pageOrientationSize = mOrientationHandler.getMeasuredSize(this); + int screenCenter = mOrientationHandler.getPrimaryScroll(this) + (pageOrientationSize / 2); + return getDisplacementFromScreenCenter(childIndex, screenCenter); + } + protected void snapToDestination() { snapToPage(getPageNearestToCenterOfScreen(), getPageSnapDuration()); } diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index c2bfb167a2..ab495eadc7 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -72,6 +72,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { out.halfPageSize = view.getNormalChildHeight() / 2; out.halfScreenSize = view.getMeasuredHeight() / 2; out.screenCenter = insets.top + view.getPaddingTop() + out.scroll + out.halfPageSize; + out.pageParentScale = view.getScaleY(); } @Override diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index b650526fe1..8abb0475dc 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -109,6 +109,7 @@ public interface PagedOrientationHandler { public int halfPageSize; public int screenCenter; public int halfScreenSize; + public float pageParentScale; } class ChildBounds { diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index e87c887d33..3acb3aef90 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -70,6 +70,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { out.halfPageSize = view.getNormalChildWidth() / 2; out.halfScreenSize = view.getMeasuredWidth() / 2; out.screenCenter = insets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize; + out.pageParentScale = view.getScaleX(); } @Override From b0611351e3cb70a9868226fc54bc23534311ae2e Mon Sep 17 00:00:00 2001 From: Jason Chang Date: Tue, 30 Jun 2020 15:44:14 +0800 Subject: [PATCH 62/72] Refactoring to use more precise statements when calculating gesture distance and others 1) Use more precise statements when calculating gesture distance and refine ACTION_CANCEL motion events and others. 2) Check system property "ro.support_one_handed_mode" to enable or disable one-handed quicksteps gesture feature. Bug: 160315874 Test: make and install Test: manual enable one handed mode and swipe down to trigger Test: manual start one handed and rotate device Change-Id: Ib27f9b6f92edda3cbff1ecb554b1a70f2e56e552 --- .../OneHandedModeInputConsumer.java | 15 ++++++++------- .../quickstep/RecentsAnimationDeviceState.java | 12 ++++++++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java index 0bb8fff2a1..22bd334517 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java @@ -52,7 +52,6 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { private final PointF mDownPos = new PointF(); private final PointF mLastPos = new PointF(); - private final PointF mStartDragPos = new PointF(); private boolean mPassedSlop; @@ -92,7 +91,6 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { if (!mPassedSlop) { if (squaredHypot(mLastPos.x - mDownPos.x, mLastPos.y - mDownPos.y) > mSquaredSlop) { - mStartDragPos.set(mLastPos.x, mLastPos.y); if ((!mDeviceState.isOneHandedModeActive() && isValidStartAngle( mDownPos.x - mLastPos.x, mDownPos.y - mLastPos.y)) || (mDeviceState.isOneHandedModeActive() && isValidExitAngle( @@ -104,17 +102,16 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { } } } else { - float distance = (float) Math.hypot(mLastPos.x - mStartDragPos.x, - mLastPos.y - mStartDragPos.y); + float distance = (float) Math.hypot(mLastPos.x - mDownPos.x, + mLastPos.y - mDownPos.y); if (distance > mDragDistThreshold && mPassedSlop) { onStopGestureDetected(); } } break; } - case ACTION_UP: - case ACTION_CANCEL: { - if (mLastPos.y >= mStartDragPos.y && mPassedSlop) { + case ACTION_UP: { + if (mLastPos.y >= mDownPos.y && mPassedSlop) { onStartGestureDetected(); } @@ -122,6 +119,10 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { mState = STATE_INACTIVE; break; } + case ACTION_CANCEL: + mPassedSlop = false; + mState = STATE_INACTIVE; + break; } if (mState != STATE_ACTIVE) { diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index 2868b1b37c..716887509d 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -79,6 +79,8 @@ public class RecentsAnimationDeviceState implements DefaultDisplay.DisplayInfoChangeListener, OneHandedModeChangeListener { + static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode"; + private final Context mContext; private final SysUINavigationMode mSysUiNavMode; private final DefaultDisplay mDefaultDisplay; @@ -165,13 +167,15 @@ public class RecentsAnimationDeviceState implements } } - if (SystemProperties.getBoolean("ro.support_one_handed_mode", false)) { + if (SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) { SecureSettingsObserver oneHandedEnabledObserver = SecureSettingsObserver.newOneHandedSettingsObserver( mContext, enabled -> mIsOneHandedModeEnabled = enabled); oneHandedEnabledObserver.register(); oneHandedEnabledObserver.dispatchOnChange(); runOnDestroy(oneHandedEnabledObserver::unregister); + } else { + mIsOneHandedModeEnabled = false; } SecureSettingsObserver swipeBottomEnabledObserver = @@ -443,7 +447,7 @@ public class RecentsAnimationDeviceState implements } /** - * @return whether screen pinning is enabled and active + * @return whether one-handed mode is enabled and active */ public boolean isOneHandedModeActive() { return (mSystemUiStateFlags & SYSUI_STATE_ONE_HANDED_ACTIVE) != 0; @@ -518,6 +522,10 @@ public class RecentsAnimationDeviceState implements * @return whether the given motion event can trigger the one handed mode. */ public boolean canTriggerOneHandedAction(MotionEvent ev) { + if (!SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) { + return false; + } + if (!mIsOneHandedModeEnabled && !mIsSwipeToNotificationEnabled) { return false; } From bcdbf27b967263db9a9499764546b2248f065312 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 30 Jul 2020 09:42:36 -0700 Subject: [PATCH 63/72] Revert "Finish the current task in live tile mode when swiping up and right to the previous task" This is a manual revert to ag/9654924 (WindowTransformSwipeHandler has been moved) Fixes: 143714109 Test: manual Change-Id: I3c55e7bcacfcdc9c9343b2df5804064053169ade --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java index f3711459a1..3a5c027698 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1221,15 +1221,6 @@ public abstract class AbsSwipeUpHandler, Q extends @UiThread private void startNewTask() { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mRecentsAnimationController.finish(true /* toRecents */, this::startNewTaskInternal); - } else { - startNewTaskInternal(); - } - } - - @UiThread - private void startNewTaskInternal() { TaskView taskToLaunch = mRecentsView == null ? null : mRecentsView.getNextPageTaskView(); startNewTask(success -> { if (!success) { From cded4dd923ffaf0be870ed07227e9ceffaf93126 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 30 Jul 2020 12:25:58 -0700 Subject: [PATCH 64/72] Create a copy of the original list instead of a new view unmodifiableList is backed up by the original list and is not suitable to passing to different thead. Bug: 162518472 Change-Id: I71774ced89d64acc7176269e107cfcf47627f7c4 --- src/com/android/launcher3/model/BgDataModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java index 6158a9c6b4..fd8520dcdf 100644 --- a/src/com/android/launcher3/model/BgDataModel.java +++ b/src/com/android/launcher3/model/BgDataModel.java @@ -422,7 +422,7 @@ public class BgDataModel { @Override public FixedContainerItems clone() { - return new FixedContainerItems(containerId, Collections.unmodifiableList(items)); + return new FixedContainerItems(containerId, new ArrayList<>(items)); } } From 553d4dfe7d30376baabebe9c09408e68b64224ef Mon Sep 17 00:00:00 2001 From: Pinyao Ting Date: Mon, 20 Jul 2020 11:03:39 -0700 Subject: [PATCH 65/72] Minimal Phone Mode (part-2) Integrate with ContentProvider from Digital Wellbeing Change-Id: Ie1fbb706e767ac5d760d686af88a9a0adf162418 --- .../launcher3/model/WellbeingModel.java | 57 +++++++++++++++++-- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/launcher3/model/WellbeingModel.java b/quickstep/src/com/android/launcher3/model/WellbeingModel.java index f42b124fd6..cc7b712842 100644 --- a/quickstep/src/com/android/launcher3/model/WellbeingModel.java +++ b/quickstep/src/com/android/launcher3/model/WellbeingModel.java @@ -43,9 +43,11 @@ import android.util.ArrayMap; import android.util.Log; import androidx.annotation.MainThread; +import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.RemoteActionShortcut; import com.android.launcher3.popup.SystemShortcut; @@ -57,6 +59,7 @@ import com.android.launcher3.util.SimpleBroadcastReceiver; import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; /** * Data model for digital wellbeing status of apps. @@ -72,6 +75,9 @@ public final class WellbeingModel { private static final int MSG_FULL_REFRESH = 3; // Welbeing contract + private static final String PATH_ACTIONS = "actions"; + private static final String PATH_MINIMAL_DEVICE = "minimal_device"; + private static final String METHOD_GET_MINIMAL_DEVICE_CONFIG = "get_minimal_device_config"; private static final String METHOD_GET_ACTIONS = "get_actions"; private static final String EXTRA_ACTIONS = "actions"; private static final String EXTRA_ACTION = "action"; @@ -104,15 +110,22 @@ public final class WellbeingModel { mContentObserver = new ContentObserver(MAIN_EXECUTOR.getHandler()) { @Override public void onChange(boolean selfChange, Uri uri) { - // Wellbeing reports that app actions have changed. if (DEBUG || mIsInTest) { - Log.d(TAG, "ContentObserver.onChange() called with: selfChange = [" + selfChange - + "], uri = [" + uri + "]"); + Log.d(TAG, "ContentObserver.onChange() called with: selfChange = [" + + selfChange + "], uri = [" + uri + "]"); } Preconditions.assertUIThread(); - updateWellbeingData(); + + if (uri.getPath().contains(PATH_ACTIONS)) { + // Wellbeing reports that app actions have changed. + updateWellbeingData(); + } else if (uri.getPath().contains(PATH_MINIMAL_DEVICE)) { + // Wellbeing reports that minimal device state or config is changed. + updateLauncherModel(); + } } }; + FeatureFlags.ENABLE_MINIMAL_DEVICE.addChangeListener(mContext, this::updateLauncherModel); if (!TextUtils.isEmpty(mWellbeingProviderPkg)) { context.registerReceiver( @@ -146,14 +159,18 @@ public final class WellbeingModel { private void restartObserver() { final ContentResolver resolver = mContext.getContentResolver(); resolver.unregisterContentObserver(mContentObserver); - Uri actionsUri = apiBuilder().path("actions").build(); + Uri actionsUri = apiBuilder().path(PATH_ACTIONS).build(); + Uri minimalDeviceUri = apiBuilder().path(PATH_MINIMAL_DEVICE).build(); try { resolver.registerContentObserver( actionsUri, true /* notifyForDescendants */, mContentObserver); + resolver.registerContentObserver( + minimalDeviceUri, true /* notifyForDescendants */, mContentObserver); } catch (Exception e) { Log.e(TAG, "Failed to register content observer for " + actionsUri + ": " + e); if (mIsInTest) throw new RuntimeException(e); } + updateWellbeingData(); } @@ -191,12 +208,42 @@ public final class WellbeingModel { mWorkerHandler.sendEmptyMessage(MSG_FULL_REFRESH); } + private void updateLauncherModel() { + if (!FeatureFlags.ENABLE_MINIMAL_DEVICE.get()) return; + + // TODO: init Launcher in minimal device / normal mode + } + private Uri.Builder apiBuilder() { return new Uri.Builder() .scheme(SCHEME_CONTENT) .authority(mWellbeingProviderPkg + ".api"); } + /** + * Fetch most up-to-date minimal device config. + */ + @WorkerThread + private void runWithMinimalDeviceConfigs(Consumer consumer) { + if (DEBUG || mIsInTest) { + Log.d(TAG, "runWithMinimalDeviceConfigs() called"); + } + Preconditions.assertNonUiThread(); + + final Uri contentUri = apiBuilder().build(); + final Bundle remoteBundle; + try (ContentProviderClient client = mContext.getContentResolver() + .acquireUnstableContentProviderClient(contentUri)) { + remoteBundle = client.call( + METHOD_GET_MINIMAL_DEVICE_CONFIG, null /* args */, null /* extras */); + consumer.accept(remoteBundle); + } catch (Exception e) { + Log.e(TAG, "Failed to retrieve data from " + contentUri + ": " + e); + if (mIsInTest) throw new RuntimeException(e); + } + if (DEBUG || mIsInTest) Log.i(TAG, "runWithMinimalDeviceConfigs(): finished"); + } + private boolean updateActions(String... packageNames) { if (packageNames.length == 0) { return true; From e873a171f761ef1b256b482cd6b0028e59742fbd Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 30 Jul 2020 15:08:34 -0700 Subject: [PATCH 66/72] Expecting TYPE_WINDOW_STATE_CHANGED in quick switch Bug: 142654442 Change-Id: I48c8d929952872e444d1a3f7a40721d8edcd8942 --- .../android/launcher3/tapl/Background.java | 108 +++++++++--------- .../tapl/com/android/launcher3/tapl/Home.java | 6 - 2 files changed, 55 insertions(+), 59 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index e538f60218..c9c846fc1a 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -16,8 +16,9 @@ package com.android.launcher3.tapl; +import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED; + import static com.android.launcher3.tapl.OverviewTask.TASK_START_EVENT; -import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL; import android.graphics.Point; @@ -150,67 +151,68 @@ public class Background extends LauncherInstrumentation.VisibleContainer { /** * Swipes right or double presses the square button to switch to the previous app. */ + @NonNull public Background quickSwitchToPreviousApp() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "want to quick switch to the previous app")) { verifyActiveContainer(); - quickSwitchToPreviousApp(getExpectedStateForQuickSwitch()); + 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 left to the bottom right of the screen. + startX = 0; + startY = getSwipeStartY(); + endX = mLauncher.getDevice().getDisplayWidth(); + 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; + LauncherInstrumentation.GestureScope gestureScope = + launcherWasVisible && isZeroButton + ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE + : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER; + mLauncher.executeAndWaitForEvent( + () -> mLauncher.linearGesture( + startX, startY, endX, endY, 20, false, gestureScope), + event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED, + () -> "Quick switch gesture didn't change window state"); + 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); + mLauncher.executeAndWaitForEvent( + () -> recentsButton.click(), + event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED, + () -> "Pressing recents button didn't change window state"); + break; + } + mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT); return new Background(mLauncher); } } - protected int getExpectedStateForQuickSwitch() { - return BACKGROUND_APP_STATE_ORDINAL; - } - - protected void quickSwitchToPreviousApp(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 left to the bottom right of the screen. - startX = 0; - startY = getSwipeStartY(); - endX = mLauncher.getDevice().getDisplayWidth(); - 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; } diff --git a/tests/tapl/com/android/launcher3/tapl/Home.java b/tests/tapl/com/android/launcher3/tapl/Home.java index c06e254135..0060844ced 100644 --- a/tests/tapl/com/android/launcher3/tapl/Home.java +++ b/tests/tapl/com/android/launcher3/tapl/Home.java @@ -16,8 +16,6 @@ package com.android.launcher3.tapl; -import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL; - import androidx.annotation.NonNull; /** @@ -65,8 +63,4 @@ public abstract class Home extends Background { return true; } - @Override - protected int getExpectedStateForQuickSwitch() { - return QUICK_SWITCH_STATE_ORDINAL; - } } \ No newline at end of file From 2c80b305f46c9fe69b28239a2a7533cdf1d85a13 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Thu, 30 Jul 2020 15:42:30 -0700 Subject: [PATCH 67/72] Log entire touchable region rect Bug: 162001398 Change-Id: Icac1d81cd6d11aa47279c81db8cc2e5ff92d6b0c --- .../src/com/android/quickstep/OrientationTouchTransformer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java index 0710a0aaa4..b2bce0c043 100644 --- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java +++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java @@ -374,7 +374,7 @@ class OrientationTouchTransformer { StringBuilder regions = new StringBuilder(" currentTouchableRotations="); for(int i = 0; i < mSwipeTouchRegions.size(); i++) { OrientationRectF rectF = mSwipeTouchRegions.get(mSwipeTouchRegions.keyAt(i)); - regions.append(rectF.mRotation).append(" "); + regions.append(rectF).append(" "); } pw.println(regions.toString()); pw.println(" mNavBarGesturalHeight=" + mNavBarGesturalHeight); From 48afb6b3b9f5a4d67e36a7c6cc994efeb8b9be38 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 30 Jul 2020 14:40:29 -0700 Subject: [PATCH 68/72] Fixing wrong velocity state when there are too few samples Bug: 160568387 Change-Id: I32b3b7ee1bff5595941fc0c0b37c9f5a28d1a1fa --- .../quickstep/util/MotionPauseDetector.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java index a5d456878a..969fa5067d 100644 --- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java +++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java @@ -358,18 +358,23 @@ public class MotionPauseDetector { if (count < 3) { // Too few samples - if (count == 2) { - int endPos = pointPos - 1; - if (endPos < 0) { - endPos += HISTORY_SIZE; - } - float denominator = eventTime - mHistoricTimes[endPos]; - if (denominator != 0) { - return (eventTime - mHistoricPos[endPos]) / denominator; - + switch (count) { + case 2: { + int endPos = pointPos - 1; + if (endPos < 0) { + endPos += HISTORY_SIZE; + } + float denominator = eventTime - mHistoricTimes[endPos]; + if (denominator != 0) { + return (mHistoricPos[pointPos] - mHistoricPos[endPos]) / denominator; + } } + // fall through + case 1: + return 0f; + default: + return null; } - return null; } float Sxx = sxi2 - sxi * sxi / count; From 30caccbbc24ad7944cd4cc37bca1bc3c6e3fdd69 Mon Sep 17 00:00:00 2001 From: Yuchen He Date: Wed, 29 Jul 2020 17:15:03 +0000 Subject: [PATCH 69/72] Enable memory dump for Launcher Bug: 154772063 Change-Id: I3b2bc2e341037746891658f2596999248ec272ef (cherry picked from commit 12baaadeca97160ab567f4380991470ff536ff5f) --- tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 201218b79a..5e42d9b988 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -115,8 +115,7 @@ public abstract class AbstractLauncherUiTest { if (TestHelpers.isInLauncherProcess()) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder() -// b/154772063 -// .detectActivityLeaks() + .detectActivityLeaks() .penaltyLog() .penaltyListener(Runnable::run, violation -> { if (sStrictmodeDetectedActivityLeak == null) { From bf103f16b18642dcaa631fb0892c55084164a468 Mon Sep 17 00:00:00 2001 From: Sreyas Date: Tue, 5 May 2020 12:29:37 -0700 Subject: [PATCH 70/72] Creating UI tests for overview action buttons. Change-Id: Ie6298064a068dc978ca33fb64e1856c3ba2a8cb1 --- .../QuickstepTestInformationHandler.java | 6 + .../android/quickstep/TaplTestsQuickstep.java | 24 +++- .../launcher3/testing/TestProtocol.java | 1 + .../android/launcher3/tapl/BaseOverview.java | 17 ++- .../tapl/LauncherInstrumentation.java | 14 ++ .../launcher3/tapl/OverviewActions.java | 130 ++++++++++++++++++ .../launcher3/tapl/SelectModeButtons.java | 68 +++++++++ 7 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 tests/tapl/com/android/launcher3/tapl/OverviewActions.java create mode 100644 tests/tapl/com/android/launcher3/tapl/SelectModeButtons.java diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java index 6f4d34c8c7..5026f36e08 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -58,6 +58,12 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()); return response; } + + case TestProtocol.REQUEST_OVERVIEW_SHARE_ENABLED: { + response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, + FeatureFlags.ENABLE_OVERVIEW_SHARE.get()); + return response; + } } return super.call(method); diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index bf093fdabf..ecd4e2bd67 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -36,6 +36,7 @@ import com.android.launcher3.tapl.AllAppsFromOverview; import com.android.launcher3.tapl.Background; import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel; import com.android.launcher3.tapl.Overview; +import com.android.launcher3.tapl.OverviewActions; import com.android.launcher3.tapl.OverviewTask; import com.android.launcher3.tapl.TestHelpers; import com.android.launcher3.ui.TaplTestsLauncher3; @@ -68,11 +69,14 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { }); } - private void startTestApps() throws Exception { + public static void startTestApps() throws Exception { startAppFast(getAppPackageName()); startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); startTestActivity(2); + } + private void startTestAppsWithCheck() throws Exception { + startTestApps(); executeOnLauncher(launcher -> assertTrue( "Launcher activity is the top activity; expecting another activity to be the top " + "one", @@ -105,7 +109,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @PortraitLandscape public void testOverview() throws Exception { - startTestApps(); + startTestAppsWithCheck(); // mLauncher.pressHome() also tests an important case of pressing home while in background. Overview overview = mLauncher.pressHome().switchToOverview(); assertTrue("Launcher internal state didn't switch to Overview", @@ -189,6 +193,22 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { 0, getTaskCount(launcher))); } + /** + * Smoke test for action buttons: Presses all the buttons and makes sure no crashes occur. + */ + @Test + @NavigationModeSwitch + @PortraitLandscape + public void testOverviewActions() throws Exception { + if (mLauncher.getNavigationModel() != NavigationModel.TWO_BUTTON) { + startTestAppsWithCheck(); + OverviewActions actionsView = + mLauncher.pressHome().switchToOverview().getOverviewActions(); + actionsView.clickAndDismissScreenshot(); + actionsView.clickAndDismissShare(); + } + } + private int getCurrentOverviewPage(Launcher launcher) { return launcher.getOverviewPanel().getCurrentPage(); } diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 626d9dd966..58bff090e8 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -98,6 +98,7 @@ public final class TestProtocol { public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing"; public static final String REQUEST_OVERVIEW_ACTIONS_ENABLED = "overview-actions-enabled"; + public static final String REQUEST_OVERVIEW_SHARE_ENABLED = "overview-share-enabled"; public static boolean sDisableSensorRotation; public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation"; diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java index 223ae298b9..588b6b8f07 100644 --- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java +++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java @@ -27,7 +27,7 @@ import java.util.Collections; import java.util.List; /** - * Common overview pane for both Launcher and fallback recents + * Common overview panel for both Launcher and fallback recents */ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { private static final int FLINGS_FOR_DISMISS_LIMIT = 40; @@ -135,4 +135,19 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { public boolean hasTasks() { return getTasks().size() > 0; } + + /** + * Gets Overview Actions. + * + * @return The Overview Actions + */ + @NonNull + public OverviewActions getOverviewActions() { + try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "want to get overview actions")) { + verifyActiveContainer(); + UiObject2 overviewActions = mLauncher.waitForLauncherObject("action_buttons"); + return new OverviewActions(overviewActions, mLauncher); + } + } } \ No newline at end of file diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 94c75b0bea..85f3234bf1 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -154,6 +154,7 @@ public final class LauncherInstrumentation { private static final String CONTEXT_MENU_RES_ID = "deep_shortcuts_container"; public static final int WAIT_TIME_MS = 10000; private static final String SYSTEMUI_PACKAGE = "com.android.systemui"; + private static final String ANDROID_PACKAGE = "android"; private static WeakReference sActiveContainer = new WeakReference<>(null); @@ -926,6 +927,14 @@ public final class LauncherInstrumentation { return waitForObjectBySelector(getOverviewObjectSelector(resName)); } + @NonNull + UiObject2 waitForAndroidObject(String resId) { + final UiObject2 object = mDevice.wait( + Until.findObject(By.res(ANDROID_PACKAGE, resId)), WAIT_TIME_MS); + assertNotNull("Can't find a android object with id: " + resId, object); + return object; + } + private UiObject2 waitForObjectBySelector(BySelector selector) { final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS); assertNotNull("Can't find a view in Launcher, selector: " + selector, object); @@ -1302,6 +1311,11 @@ public final class LauncherInstrumentation { TestProtocol.TEST_INFO_RESPONSE_FIELD); } + boolean overviewShareEnabled() { + return getTestInfo(TestProtocol.REQUEST_OVERVIEW_SHARE_ENABLED).getBoolean( + TestProtocol.TEST_INFO_RESPONSE_FIELD); + } + private void disableSensorRotation() { getTestInfo(TestProtocol.REQUEST_MOCK_SENSOR_ROTATION); } diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewActions.java b/tests/tapl/com/android/launcher3/tapl/OverviewActions.java new file mode 100644 index 0000000000..a30a404764 --- /dev/null +++ b/tests/tapl/com/android/launcher3/tapl/OverviewActions.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.tapl; + +import androidx.annotation.NonNull; +import androidx.test.uiautomator.UiObject2; + +import com.android.launcher3.testing.TestProtocol; + +/** + * View containing overview actions + */ +public class OverviewActions { + private final UiObject2 mOverviewActions; + private final LauncherInstrumentation mLauncher; + + OverviewActions(UiObject2 overviewActions, LauncherInstrumentation launcherInstrumentation) { + this.mOverviewActions = overviewActions; + this.mLauncher = launcherInstrumentation; + } + + /** + * Clicks screenshot button and closes screenshot ui. + */ + @NonNull + public Overview clickAndDismissScreenshot() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "want to click screenshot button and exit screenshot ui")) { + UiObject2 screenshot = mLauncher.waitForObjectInContainer(mOverviewActions, + "action_screenshot"); + mLauncher.clickLauncherObject(screenshot); + try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( + "clicked screenshot button")) { + UiObject2 closeScreenshot = mLauncher.waitForSystemUiObject( + "global_screenshot_dismiss_image"); + if (mLauncher.getNavigationModel() + != LauncherInstrumentation.NavigationModel.THREE_BUTTON) { + mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, + LauncherInstrumentation.EVENT_TOUCH_DOWN_TIS); + mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, + LauncherInstrumentation.EVENT_TOUCH_UP_TIS); + } + closeScreenshot.click(); + try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer( + "dismissed screenshot")) { + return new Overview(mLauncher); + } + } + } + } + + /** + * Click share button, then drags sharesheet down to remove it. + * + * Share is currently hidden behind flag, test is kept in case share becomes a default feature. + * If share is completely removed then remove this test as well. + */ + @NonNull + public Overview clickAndDismissShare() { + if (mLauncher.overviewShareEnabled()) { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "want to click share button and dismiss sharesheet")) { + UiObject2 share = mLauncher.waitForObjectInContainer(mOverviewActions, + "action_share"); + mLauncher.clickLauncherObject(share); + try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( + "clicked share button")) { + mLauncher.waitForAndroidObject("contentPanel"); + mLauncher.getDevice().pressBack(); + try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer( + "dismissed sharesheet")) { + return new Overview(mLauncher); + } + } + } + } + return new Overview(mLauncher); + } + + /** + * Click select button + * + * @return The select mode buttons that are now shown instead of action buttons. + */ + @NonNull + public SelectModeButtons clickSelect() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = + mLauncher.addContextLayer("want to click select button")) { + UiObject2 select = mLauncher.waitForObjectInContainer(mOverviewActions, + "action_select"); + mLauncher.clickLauncherObject(select); + try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( + "clicked select button")) { + return getSelectModeButtons(); + } + + } + } + + /** + * Gets the Select Mode Buttons. + * + * @return The Select Mode Buttons. + */ + @NonNull + private SelectModeButtons getSelectModeButtons() { + try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "want to get select mode buttons")) { + UiObject2 selectModeButtons = mLauncher.waitForLauncherObject("select_mode_buttons"); + return new SelectModeButtons(selectModeButtons, mLauncher); + } + } +} diff --git a/tests/tapl/com/android/launcher3/tapl/SelectModeButtons.java b/tests/tapl/com/android/launcher3/tapl/SelectModeButtons.java new file mode 100644 index 0000000000..35074184d6 --- /dev/null +++ b/tests/tapl/com/android/launcher3/tapl/SelectModeButtons.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.tapl; + +import androidx.annotation.NonNull; +import androidx.test.uiautomator.UiObject2; + +/** + * View containing select mode buttons + */ +public class SelectModeButtons { + private final UiObject2 mSelectModeButtons; + private final LauncherInstrumentation mLauncher; + + SelectModeButtons(UiObject2 selectModeButtons, + LauncherInstrumentation launcherInstrumentation) { + mSelectModeButtons = selectModeButtons; + mLauncher = launcherInstrumentation; + } + + /** + * Click close button. + */ + @NonNull + public Overview clickClose() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = + mLauncher.addContextLayer("want to click close button")) { + UiObject2 close = mLauncher.waitForObjectInContainer(mSelectModeButtons, "close"); + mLauncher.clickLauncherObject(close); + try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( + "clicked close button")) { + return new Overview(mLauncher); + } + } + } + + /** + * Click feedback button. + */ + @NonNull + public Background clickFeedback() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = + mLauncher.addContextLayer("want to click feedback button")) { + UiObject2 feedback = mLauncher.waitForObjectInContainer(mSelectModeButtons, "feedback"); + mLauncher.clickLauncherObject(feedback); + try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( + "clicked feedback button")) { + return new Background(mLauncher); + } + } + } +} From ca9590c3901360bd8bd0d9429a17a72312dde842 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 30 Jul 2020 19:51:41 -0700 Subject: [PATCH 71/72] Reset live tile task view simulator params Since we reuse the same mLiveTileTaskViewSimulator in the RecentsView, we need to reset the params after it settles in Overview from swipe up so that we don't render with obsolete param values. Test: manual Fixes: 160911104 Change-Id: I523a321e44d867c5bb68afe93e7a83e7ae23498b --- .../src/com/android/quickstep/views/RecentsView.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 51e4a85a14..0335ee7748 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 @@ -849,6 +849,14 @@ public abstract class RecentsView extends PagedView taskView.setModalness(mTaskModalness); } } + if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { + // Since we reuse the same mLiveTileTaskViewSimulator in the RecentsView, we need + // to reset the params after it settles in Overview from swipe up so that we don't + // render with obsolete param values. + mLiveTileTaskViewSimulator.fullScreenProgress.value = 0; + mLiveTileTaskViewSimulator.recentsViewScale.value = 1; + mLiveTileTaskViewSimulator.setOffsetY(0); + } if (mRunningTaskTileHidden) { setRunningTaskHidden(mRunningTaskTileHidden); } From f58a2b9cd982a6a761deaa05b3d3e9802df040c3 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 30 Jul 2020 14:40:29 -0700 Subject: [PATCH 72/72] Fixing wrong velocity state when there are too few samples Bug: 160568387 Change-Id: I32b3b7ee1bff5595941fc0c0b37c9f5a28d1a1fa (cherry picked from commit 48afb6b3b9f5a4d67e36a7c6cc994efeb8b9be38) --- .../quickstep/util/MotionPauseDetector.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java index a5d456878a..969fa5067d 100644 --- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java +++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java @@ -358,18 +358,23 @@ public class MotionPauseDetector { if (count < 3) { // Too few samples - if (count == 2) { - int endPos = pointPos - 1; - if (endPos < 0) { - endPos += HISTORY_SIZE; - } - float denominator = eventTime - mHistoricTimes[endPos]; - if (denominator != 0) { - return (eventTime - mHistoricPos[endPos]) / denominator; - + switch (count) { + case 2: { + int endPos = pointPos - 1; + if (endPos < 0) { + endPos += HISTORY_SIZE; + } + float denominator = eventTime - mHistoricTimes[endPos]; + if (denominator != 0) { + return (mHistoricPos[pointPos] - mHistoricPos[endPos]) / denominator; + } } + // fall through + case 1: + return 0f; + default: + return null; } - return null; } float Sxx = sxi2 - sxi * sxi / count;