Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1a45422 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12354992 from c912c8fb to 24Q4-release

Change-Id: I47470bb4d207e61ee90a06253271f86fbcc3a1d2
parents 7a1601ad c912c8fb
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -388,3 +388,13 @@ flag {
    description: "Refactor grid migration such that the code is simpler to understand and update"
    bug: "358399271"
}

flag {
    name: "accessibility_scroll_on_allapps"
    namespace: "launcher"
    description: "Scroll to item position if accessibility focused"
    bug: "265392261"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@
    <string name="gesture_tutorial_nice" msgid="2936275692616928280">"أحسنت"</string>
    <string name="gesture_tutorial_step" msgid="1279786122817620968">"الدليل التوجيهي <xliff:g id="CURRENT">%1$d</xliff:g> من إجمالي <xliff:g id="TOTAL">%2$d</xliff:g>"</string>
    <string name="allset_title" msgid="5021126669778966707">"اكتملت عملية الإعداد"</string>
    <string name="allset_hint" msgid="459504134589971527">"يمكنك التمرير سريعًا إلى الأعلى للانتقال إلى الشاشة الرئيسية"</string>
    <string name="allset_hint" msgid="459504134589971527">"مرّر سريعًا للأعلى للانتقال إلى الشاشة الرئيسية"</string>
    <string name="allset_button_hint" msgid="2395219947744706291">"انقر على زر الشاشة الرئيسية للانتقال إلى الشاشة الرئيسية."</string>
    <string name="allset_description_generic" msgid="5385500062202019855">"يمكنك الآن بدء استخدام <xliff:g id="DEVICE">%1$s</xliff:g>"</string>
    <string name="default_device_name" msgid="6660656727127422487">"الجهاز"</string>
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@
    <string name="allset_hint" msgid="459504134589971527">"Башкы бетке өтүү үчүн экранды өйдө сүрүңүз"</string>
    <string name="allset_button_hint" msgid="2395219947744706291">"Башкы экранга өтүү үчүн башкы бет баскычын таптап коюңуз"</string>
    <string name="allset_description_generic" msgid="5385500062202019855">"<xliff:g id="DEVICE">%1$s</xliff:g> колдоно берсеңиз болот"</string>
    <string name="default_device_name" msgid="6660656727127422487">"түзмөк"</string>
    <string name="default_device_name" msgid="6660656727127422487">"Түзмөктү"</string>
    <string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Өтүү аракетинин системалык параметрлери"</annotation></string>
    <string name="action_share" msgid="2648470652637092375">"Бөлүшүү"</string>
    <string name="action_screenshot" msgid="8171125848358142917">"Скриншот"</string>
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@
    <string name="allset_button_hint" msgid="2395219947744706291">"Нажмите кнопку главного экрана, чтобы открыть его."</string>
    <string name="allset_description_generic" msgid="5385500062202019855">"Теперь вы можете использовать <xliff:g id="DEVICE">%1$s</xliff:g>."</string>
    <string name="default_device_name" msgid="6660656727127422487">"устройство"</string>
    <string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Системные настройки навигации"</annotation></string>
    <string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Настройки навигации в системе"</annotation></string>
    <string name="action_share" msgid="2648470652637092375">"Поделиться"</string>
    <string name="action_screenshot" msgid="8171125848358142917">"Скриншот"</string>
    <string name="action_split" msgid="2098009717623550676">"Разделить"</string>
+56 −0
Original line number Diff line number Diff line
@@ -15,10 +15,19 @@
 */
package com.android.launcher3;

import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;

import android.view.KeyEvent;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;

import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.allapps.AllAppsRecyclerView;
import com.android.launcher3.allapps.SearchRecyclerView;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.uioverrides.PredictedAppIcon;
import com.android.launcher3.uioverrides.QuickstepLauncher;
@@ -26,13 +35,60 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
import java.util.List;

public class QuickstepAccessibilityDelegate extends LauncherAccessibilityDelegate {
    private QuickstepLauncher mLauncher;

    public QuickstepAccessibilityDelegate(QuickstepLauncher launcher) {
        super(launcher);
        mLauncher = launcher;
        mActions.put(PIN_PREDICTION, new LauncherAction(
                PIN_PREDICTION, R.string.pin_prediction, KeyEvent.KEYCODE_P));
    }

    @Override
    public void onPopulateAccessibilityEvent(View view, AccessibilityEvent event) {
        super.onPopulateAccessibilityEvent(view, event);
        // Scroll to the position if focused view in main allapps list and not completely visible.
        scrollToPositionIfNeeded(view);
    }

    private void scrollToPositionIfNeeded(View view) {
        if (!Flags.accessibilityScrollOnAllapps()) {
            return;
        }
        AllAppsRecyclerView contentView = mLauncher.getAppsView().getActiveRecyclerView();
        if (contentView instanceof SearchRecyclerView) {
            return;
        }
        LinearLayoutManager layoutManager = (LinearLayoutManager) contentView.getLayoutManager();
        if (layoutManager == null) {
            return;
        }
        RecyclerView.ViewHolder vh = contentView.findContainingViewHolder(view);
        if (vh == null) {
            return;
        }
        int itemPosition = vh.getBindingAdapterPosition();
        if (itemPosition == NO_POSITION) {
            return;
        }
        int firstCompletelyVisible = layoutManager.findFirstCompletelyVisibleItemPosition();
        int lastCompletelyVisible = layoutManager.findLastCompletelyVisibleItemPosition();
        boolean itemCompletelyVisible = firstCompletelyVisible <= itemPosition
                && lastCompletelyVisible >= itemPosition;
        if (itemCompletelyVisible) {
            return;
        }
        RecyclerView.SmoothScroller smoothScroller =
                new LinearSmoothScroller(mLauncher.asContext()) {
                    @Override
                    protected int getVerticalSnapPreference() {
                        return LinearSmoothScroller.SNAP_TO_ANY;
                    }
                };
        smoothScroller.setTargetPosition(itemPosition);
        layoutManager.startSmoothScroll(smoothScroller);
    }

    @Override
    protected void getSupportedActions(View host, ItemInfo item, List<LauncherAction> out) {
        if (host instanceof PredictedAppIcon && !((PredictedAppIcon) host).isPinned()) {
Loading