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

Commit 9f8d8d55 authored by Jagrut Desai's avatar Jagrut Desai Committed by Automerger Merge Worker
Browse files

Merge "Announce for accessiblity when taskbar is invoked/closed" into...

Merge "Announce for accessiblity when taskbar is invoked/closed" into tm-qpr-dev am: d301c9b6 am: 545f6540

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21735251



Change-Id: I9a2976339d0587052293afd35db900e607059644
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d342b320 545f6540
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -278,6 +278,10 @@
    <string name="taskbar_button_quick_settings">Quick Settings</string>
    <!-- Accessibility title for the Taskbar window. [CHAR_LIMIT=NONE] -->
    <string name="taskbar_a11y_title">Taskbar</string>
    <!-- Accessibility title for the Taskbar window appeared. [CHAR_LIMIT=NONE] -->
    <string name="taskbar_a11y_shown_title">Taskbar shown</string>
    <!-- Accessibility title for the Taskbar window being close. [CHAR_LIMIT=NONE] -->
    <string name="taskbar_a11y_hidden_title">Taskbar hidden</string>
    <!-- Accessibility title for the Taskbar window on phones. [CHAR_LIMIT=NONE] -->
    <string name="taskbar_phone_a11y_title">Navigation bar</string>

+1 −0
Original line number Diff line number Diff line
@@ -600,6 +600,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
                if (!mIsStashed) {
                    tryStartTaskbarTimeout();
                }
                mControllers.taskbarViewController.announceForAccessibility();
            }
        });
    }
+22 −0
Original line number Diff line number Diff line
@@ -16,15 +16,18 @@
package com.android.launcher3.taskbar;

import static android.content.pm.PackageManager.FEATURE_PC;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;

import androidx.annotation.LayoutRes;
@@ -153,7 +156,26 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar

        // TODO: Disable touch events on QSB otherwise it can crash.
        mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
    }

    @Override
    public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
        if (action == AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS) {
            announceForAccessibility(mContext.getString(R.string.taskbar_a11y_shown_title));
        } else if (action == AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS) {
            announceForAccessibility(mContext.getString(R.string.taskbar_a11y_hidden_title));
        }
        return super.performAccessibilityActionInternal(action, arguments);

    }

    protected void announceAccessibilityChanges() {
        this.performAccessibilityAction(
                isVisibleToUser() ? AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS
                        : AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null);

        ActivityContext.lookupContext(getContext()).getDragLayer()
                .sendAccessibilityEvent(TYPE_WINDOW_CONTENT_CHANGED);
    }

    private int getColorWithGivenLuminance(int color, float luminance) {
+7 −0
Original line number Diff line number Diff line
@@ -189,6 +189,13 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        mActivity.addOnDeviceProfileChangeListener(mDeviceProfileChangeListener);
    }

    /**
     * Announcement for Accessibility when Taskbar stashes/unstashes.
     */
    public void announceForAccessibility() {
        mTaskbarView.announceAccessibilityChanges();
    }

    public void onDestroy() {
        LauncherAppState.getInstance(mActivity).getModel().removeCallbacks(mModelCallbacks);
        mActivity.removeOnDeviceProfileChangeListener(mDeviceProfileChangeListener);
+7 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityEvent;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
@@ -78,6 +79,12 @@ public class IconButtonView extends BubbleTextView {
        }
    }

    @Override
    public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
        super.onPopulateAccessibilityEvent(event);
        event.getText().add(this.getContentDescription());
    }

    /** Sets given Drawable as icon */
    public void setIconDrawable(@NonNull Drawable drawable) {
        ColorStateList tintList = getBackgroundTintList();