summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Wickham <awickham@google.com>2019-08-29 23:11:30 -0700
committerAndy Wickham <awickham@google.com>2019-09-03 21:20:22 +0000
commitc40872b913ac657561d4fbfa0289c1f550756588 (patch)
tree3c12921b89cc3fd4c4ff5cbc846f313c8cf24822 /src
parent505a88140e442c3bb1256b2bd73f0705d2bfe600 (diff)
downloadandroid_packages_apps_Trebuchet-c40872b913ac657561d4fbfa0289c1f550756588.tar.gz
android_packages_apps_Trebuchet-c40872b913ac657561d4fbfa0289c1f550756588.tar.bz2
android_packages_apps_Trebuchet-c40872b913ac657561d4fbfa0289c1f550756588.zip
Marks ScrimView unimportant for accessibility when Widgets screen is opened.
This prevents it from holding focus while the Widgets screen is visible (after using Widgets action from the All Apps caret thingy). Test: Manually followed steps provided in bug, and issue not seen after this change. Fixes: 139918680 Change-Id: I280ac97fb7ff9fa67f1c6a1ce9cdfa9e451231eb
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/views/AbstractSlideInView.java8
-rw-r--r--src/com/android/launcher3/views/OptionsPopupView.java17
-rw-r--r--src/com/android/launcher3/views/ScrimView.java39
3 files changed, 42 insertions, 22 deletions
diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java
index f948beb8d..a4518bae3 100644
--- a/src/com/android/launcher3/views/AbstractSlideInView.java
+++ b/src/com/android/launcher3/views/AbstractSlideInView.java
@@ -153,15 +153,15 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
}
protected void handleClose(boolean animate, long defaultDuration) {
- if (mIsOpen && !animate) {
+ if (!mIsOpen) {
+ return;
+ }
+ if (!animate) {
mOpenCloseAnimator.cancel();
setTranslationShift(TRANSLATION_SHIFT_CLOSED);
onCloseComplete();
return;
}
- if (!mIsOpen) {
- return;
- }
mOpenCloseAnimator.setValues(
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_CLOSED));
mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 63f742768..465df448e 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -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_OFFSET;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.ResolveInfo;
import android.graphics.Rect;
import android.graphics.RectF;
import android.text.TextUtils;
@@ -33,6 +31,9 @@ import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.Toast;
+import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -46,7 +47,6 @@ import com.android.launcher3.widget.WidgetsFullSheet;
import java.util.ArrayList;
import java.util.List;
-import androidx.annotation.VisibleForTesting;
/**
* 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) {
- 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()) {
Toast.makeText(launcher, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show();
- return false;
+ return null;
} else {
- WidgetsFullSheet.show(launcher, true /* animated */);
- return true;
+ return WidgetsFullSheet.show(launcher, true /* animated */);
}
}
diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java
index c36011745..da1df3f89 100644
--- a/src/com/android/launcher3/views/ScrimView.java
+++ b/src/com/android/launcher3/views/ScrimView.java
@@ -18,14 +18,14 @@ 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;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
-import static androidx.core.graphics.ColorUtils.compositeColors;
-
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.Keyframe;
@@ -47,6 +47,13 @@ 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.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;
@@ -62,15 +69,10 @@ 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;
-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
@@ -325,7 +327,7 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
if (enabled) {
stateManager.addStateListener(this);
- handleStateChangedComplete(mLauncher.getStateManager().getState());
+ handleStateChangedComplete(stateManager.getState());
} else {
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
}
@@ -437,7 +439,24 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
} else if (action == WALLPAPERS) {
return OptionsPopupView.startWallpaperPicker(ScrimView.this);
} 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) {
return OptionsPopupView.startSettings(ScrimView.this);
}