import android.animation.ValueAnimator;
import android.view.View;
+import android.view.View.AccessibilityDelegate;
import com.android.systemui.Interpolators;
import com.android.systemui.plugins.statusbar.phone.NavBarButtonProvider.ButtonInterface;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
private View mCurrentView;
private boolean mVertical;
private ValueAnimator mFadeAnimator;
+ private AccessibilityDelegate mAccessibilityDelegate;
private final ValueAnimator.AnimatorUpdateListener mAlphaListener = animation ->
setAlpha((float) animation.getAnimatedValue());
if (mVisibility != null && mVisibility != -1) {
view.setVisibility(mVisibility);
}
+ if (mAccessibilityDelegate != null) {
+ view.setAccessibilityDelegate(mAccessibilityDelegate);
+ }
if (view instanceof ButtonInterface) {
final ButtonInterface button = (ButtonInterface) view;
if (mDarkIntensity != null) {
}
}
+ public void setAccessibilityDelegate(AccessibilityDelegate delegate) {
+ mAccessibilityDelegate = delegate;
+ final int N = mViews.size();
+ for (int i = 0; i < N; i++) {
+ mViews.get(i).setAccessibilityDelegate(delegate);
+ }
+ }
+
public void setClickable(boolean clickable) {
abortCurrentGesture();
final int N = mViews.size();
import android.graphics.Rect;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
+import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.os.RemoteException;
import android.os.SystemProperties;
import android.support.annotation.ColorInt;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowManager;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import com.android.systemui.OverviewProxyService;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
+import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.PluginManager;
import com.android.systemui.plugins.statusbar.phone.NavGesture;
import com.android.systemui.plugins.statusbar.phone.NavGesture.GestureHelper;
+import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsOnboarding;
+import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.NavigationBarCompat;
import com.android.systemui.shared.system.WindowManagerWrapper;
}
}
+ private final AccessibilityDelegate mQuickStepAccessibilityDelegate
+ = new AccessibilityDelegate() {
+ private AccessibilityAction mToggleOverviewAction;
+
+ @Override
+ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(host, info);
+ if (mToggleOverviewAction == null) {
+ mToggleOverviewAction = new AccessibilityAction(R.id.action_toggle_overview,
+ getContext().getString(R.string.quick_step_accessibility_toggle_overview));
+ }
+ info.addAction(mToggleOverviewAction);
+ }
+
+ @Override
+ public boolean performAccessibilityAction(View host, int action, Bundle args) {
+ switch (action) {
+ case R.id.action_toggle_overview:
+ SysUiServiceProvider.getComponent(getContext(), Recents.class)
+ .toggleRecentApps();
+ break;
+ default:
+ return super.performAccessibilityAction(host, action, args);
+ }
+ return true;
+ }
+ };
+
public NavigationBarView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void updateStates() {
+ final boolean showSwipeUpUI = mOverviewProxyService.shouldShowSwipeUpUI();
updateSlippery();
reloadNavIcons();
updateNavButtonIcons();
setUpSwipeUpOnboarding(isQuickStepSwipeUpEnabled());
- WindowManagerWrapper.getInstance().setNavBarVirtualKeyHapticFeedbackEnabled(
- !mOverviewProxyService.shouldShowSwipeUpUI());
+ WindowManagerWrapper.getInstance().setNavBarVirtualKeyHapticFeedbackEnabled(!showSwipeUpUI);
+ getHomeButton().setAccessibilityDelegate(
+ showSwipeUpUI ? mQuickStepAccessibilityDelegate : null);
}
private void updateSlippery() {