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

Commit d24cd904 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Adding accessibility support to the Status Bar."

parents 374d3872 6179ea31
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -97,9 +97,10 @@ public class StatusBarManager {
        }
    }

    public void setIcon(String slot, int iconId, int iconLevel) {
    public void setIcon(String slot, int iconId, int iconLevel, String contentDescription) {
        try {
            mService.setIcon(slot, mContext.getPackageName(), iconId, iconLevel);
            mService.setIcon(slot, mContext.getPackageName(), iconId, iconLevel,
                    contentDescription);
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
+6 −3
Original line number Diff line number Diff line
@@ -2148,11 +2148,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        onPopulateAccessibilityEvent(event);
        // Let our children have a shot in populating the event.
        for (int i = 0, count = getChildCount(); i < count; i++) {
            View child = getChildAt(i);
            if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
                boolean handled = getChildAt(i).dispatchPopulateAccessibilityEvent(event);
                if (handled) {
                    return handled;
                }
            }
        }
        return false;
    }

+10 −9
Original line number Diff line number Diff line
@@ -902,16 +902,17 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {

    @Override
    public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
        if (super.onRequestSendAccessibilityEvent(child, event)) {
            // Add a record for ourselves as well.
            AccessibilityEvent record = AccessibilityEvent.obtain();
        record.setSource(this);
        // Set the class since it is not populated in #dispatchPopulateAccessibilityEvent
        record.setClassName(getClass().getName());
        child.onInitializeAccessibilityEvent(record);
            onInitializeAccessibilityEvent(record);
            // Populate with the text of the requesting child.
            child.dispatchPopulateAccessibilityEvent(record);
            event.appendRecord(record);
            return true;
        }
        return false;
    }

    @Override
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+11 −2
Original line number Diff line number Diff line
@@ -30,14 +30,15 @@ import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.RemotableViewMethod;
import android.view.View;
import android.view.ViewDebug;
import android.view.accessibility.AccessibilityEvent;
import android.widget.RemoteViews.RemoteView;


/**
 * Displays an arbitrary image, such as an icon.  The ImageView class
 * can load images from various sources (such as resources or content
@@ -209,6 +210,14 @@ public class ImageView extends View {
        return false;
    }

    @Override
    public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
        CharSequence contentDescription = getContentDescription();
        if (!TextUtils.isEmpty(contentDescription)) {
            event.getText().add(contentDescription);
        }
    }

    /**
     * Set this to true if you want the ImageView to adjust its bounds
     * to preserve the aspect ratio of its drawable.
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ interface IStatusBarService
    void expand();
    void collapse();
    void disable(int what, IBinder token, String pkg);
    void setIcon(String slot, String iconPackage, int iconId, int iconLevel);
    void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
    void setIconVisibility(String slot, boolean visible);
    void removeIcon(String slot);
    void topAppWindowChanged(boolean menuVisible);
Loading