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

Commit 1f3b82ba authored by Andy Wickham's avatar Andy Wickham Committed by android-build-merger
Browse files

Marks ScrimView unimportant for accessibility when Widgets screen is opened. am: c40872b9

am: 42cbb23d

Change-Id: I3f52c9905e73547fa885de33159f75d5fa4e5cb7
parents 0b439b44 42cbb23d
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -153,15 +153,15 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
    }
    }


    protected void handleClose(boolean animate, long defaultDuration) {
    protected void handleClose(boolean animate, long defaultDuration) {
        if (mIsOpen && !animate) {
        if (!mIsOpen) {
            return;
        }
        if (!animate) {
            mOpenCloseAnimator.cancel();
            mOpenCloseAnimator.cancel();
            setTranslationShift(TRANSLATION_SHIFT_CLOSED);
            setTranslationShift(TRANSLATION_SHIFT_CLOSED);
            onCloseComplete();
            onCloseComplete();
            return;
            return;
        }
        }
        if (!mIsOpen) {
            return;
        }
        mOpenCloseAnimator.setValues(
        mOpenCloseAnimator.setValues(
                PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_CLOSED));
                PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_CLOSED));
        mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
        mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
+9 −8
Original line number Original line Diff line number Diff line
@@ -18,10 +18,8 @@ package com.android.launcher3.views;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_FLAVOR;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_FLAVOR;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_OFFSET;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_OFFSET;


import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;
import android.text.TextUtils;
import android.text.TextUtils;
@@ -33,6 +31,9 @@ import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.View.OnLongClickListener;
import android.widget.Toast;
import android.widget.Toast;


import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Utilities;
@@ -46,7 +47,6 @@ import com.android.launcher3.widget.WidgetsFullSheet;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;


import androidx.annotation.VisibleForTesting;


/**
/**
 * Popup shown on long pressing an empty space in launcher
 * Popup shown on long pressing an empty space in launcher
@@ -169,16 +169,17 @@ public class OptionsPopupView extends ArrowPopup
    }
    }


    public static boolean onWidgetsClicked(View view) {
    public static boolean onWidgetsClicked(View view) {
        return openWidgets(Launcher.getLauncher(view.getContext()));
        return openWidgets(Launcher.getLauncher(view.getContext())) != null;
    }
    }


    public static boolean openWidgets(Launcher launcher) {
    /** Returns WidgetsFullSheet that was opened, or null if nothing was opened. */
    @Nullable
    public static WidgetsFullSheet openWidgets(Launcher launcher) {
        if (launcher.getPackageManager().isSafeMode()) {
        if (launcher.getPackageManager().isSafeMode()) {
            Toast.makeText(launcher, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show();
            Toast.makeText(launcher, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show();
            return false;
            return null;
        } else {
        } else {
            WidgetsFullSheet.show(launcher, true /* animated */);
            return WidgetsFullSheet.show(launcher, true /* animated */);
            return true;
        }
        }
    }
    }


+29 −10
Original line number Original line Diff line number Diff line
@@ -18,14 +18,14 @@ package com.android.launcher3.views;
import static android.content.Context.ACCESSIBILITY_SERVICE;
import static android.content.Context.ACCESSIBILITY_SERVICE;
import static android.view.MotionEvent.ACTION_DOWN;
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.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;


import static androidx.core.graphics.ColorUtils.compositeColors;

import android.animation.Animator;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
import android.animation.Keyframe;
import android.animation.Keyframe;
@@ -47,6 +47,13 @@ import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener;
import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
@@ -62,15 +69,10 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Themes;
import com.android.launcher3.widget.WidgetsFullSheet;


import java.util.List;
import java.util.List;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
import androidx.customview.widget.ExploreByTouchHelper;


/**
/**
 * Simple scrim which draws a flat color
 * Simple scrim which draws a flat color
@@ -325,7 +327,7 @@ public class ScrimView extends View implements Insettable, OnChangeListener,


        if (enabled) {
        if (enabled) {
            stateManager.addStateListener(this);
            stateManager.addStateListener(this);
            handleStateChangedComplete(mLauncher.getStateManager().getState());
            handleStateChangedComplete(stateManager.getState());
        } else {
        } else {
            setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
            setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
        }
        }
@@ -437,7 +439,24 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
            } else if (action == WALLPAPERS) {
            } else if (action == WALLPAPERS) {
                return OptionsPopupView.startWallpaperPicker(ScrimView.this);
                return OptionsPopupView.startWallpaperPicker(ScrimView.this);
            } else if (action == WIDGETS) {
            } else if (action == WIDGETS) {
                return OptionsPopupView.onWidgetsClicked(ScrimView.this);
                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) {
            } else if (action == SETTINGS) {
                return OptionsPopupView.startSettings(ScrimView.this);
                return OptionsPopupView.startSettings(ScrimView.this);
            }
            }