Add a11y titles for a few sysui windows
Adding for status bar, nav bar, and global actions dialog. Also removing some extra code from global actions dialog that populated window state changes. Apps in general don't need this extra information, so we don't need to maintain it in SysUi either. In verifying the fix, I noticed that all windows were considered anchored because of a mismatch between long and int. Fixing that too. Bug: 73131182 Test: With the testback a11y service, verified that these titles do indeed appear in the window information provided to accessibility services. Also noted that windows are no longer reporting themselves as anchored. Change-Id: Ie09fbb88250b3c9663d6c28001e0ce9f70c67954
This commit is contained in:
@@ -21,6 +21,7 @@ import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Pools;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -46,7 +47,7 @@ public class WindowInfo implements Parcelable {
|
||||
public final Rect boundsInScreen = new Rect();
|
||||
public List<IBinder> childTokens;
|
||||
public CharSequence title;
|
||||
public int accessibilityIdOfAnchor = View.NO_ID;
|
||||
public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
|
||||
public boolean inPictureInPicture;
|
||||
|
||||
private WindowInfo() {
|
||||
@@ -105,7 +106,7 @@ public class WindowInfo implements Parcelable {
|
||||
parcel.writeInt(focused ? 1 : 0);
|
||||
boundsInScreen.writeToParcel(parcel, flags);
|
||||
parcel.writeCharSequence(title);
|
||||
parcel.writeInt(accessibilityIdOfAnchor);
|
||||
parcel.writeLong(accessibilityIdOfAnchor);
|
||||
parcel.writeInt(inPictureInPicture ? 1 : 0);
|
||||
|
||||
if (childTokens != null && !childTokens.isEmpty()) {
|
||||
@@ -142,7 +143,7 @@ public class WindowInfo implements Parcelable {
|
||||
focused = (parcel.readInt() == 1);
|
||||
boundsInScreen.readFromParcel(parcel);
|
||||
title = parcel.readCharSequence();
|
||||
accessibilityIdOfAnchor = parcel.readInt();
|
||||
accessibilityIdOfAnchor = parcel.readLong();
|
||||
inPictureInPicture = (parcel.readInt() == 1);
|
||||
|
||||
final boolean hasChildren = (parcel.readInt() == 1);
|
||||
|
||||
@@ -63,6 +63,7 @@ import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -2344,7 +2345,7 @@ public interface WindowManager extends ViewManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int accessibilityIdOfAnchor = -1;
|
||||
public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
|
||||
|
||||
/**
|
||||
* The window title isn't kept in sync with what is displayed in the title bar, so we
|
||||
@@ -2538,7 +2539,7 @@ public interface WindowManager extends ViewManager {
|
||||
out.writeInt(hasManualSurfaceInsets ? 1 : 0);
|
||||
out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
|
||||
out.writeInt(needsMenuKey);
|
||||
out.writeInt(accessibilityIdOfAnchor);
|
||||
out.writeLong(accessibilityIdOfAnchor);
|
||||
TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
|
||||
out.writeInt(mColorMode);
|
||||
out.writeLong(hideTimeoutMilliseconds);
|
||||
@@ -2594,7 +2595,7 @@ public interface WindowManager extends ViewManager {
|
||||
hasManualSurfaceInsets = in.readInt() != 0;
|
||||
preservePreviousSurfaceInsets = in.readInt() != 0;
|
||||
needsMenuKey = in.readInt();
|
||||
accessibilityIdOfAnchor = in.readInt();
|
||||
accessibilityIdOfAnchor = in.readLong();
|
||||
accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
|
||||
mColorMode = in.readInt();
|
||||
hideTimeoutMilliseconds = in.readLong();
|
||||
|
||||
@@ -1716,6 +1716,7 @@
|
||||
<java-symbol type="string" name="bugreport_status" />
|
||||
<java-symbol type="string" name="bugreport_title" />
|
||||
<java-symbol type="string" name="faceunlock_multiple_failures" />
|
||||
<java-symbol type="string" name="global_actions" />
|
||||
<java-symbol type="string" name="global_action_power_off" />
|
||||
<java-symbol type="string" name="global_action_restart" />
|
||||
<java-symbol type="string" name="global_actions_airplane_mode_off_status" />
|
||||
|
||||
@@ -1369,6 +1369,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
mListView = findViewById(android.R.id.list);
|
||||
mHardwareLayout = HardwareUiLayout.get(mListView);
|
||||
mHardwareLayout.setOutsideTouchListener(view -> dismiss());
|
||||
setTitle(R.string.global_actions);
|
||||
}
|
||||
|
||||
private void updateList() {
|
||||
@@ -1463,20 +1464,6 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
com.android.systemui.R.dimen.global_actions_panel_width) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
||||
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
for (int i = 0; i < mAdapter.getCount(); ++i) {
|
||||
CharSequence label =
|
||||
mAdapter.getItem(i).getLabelForAccessibility(getContext());
|
||||
if (label != null) {
|
||||
event.getText().add(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.dispatchPopulateAccessibilityEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onColorsChanged(ColorExtractor extractor, int which) {
|
||||
if (mKeyguardShowing) {
|
||||
|
||||
@@ -960,6 +960,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
|
||||
PixelFormat.TRANSLUCENT);
|
||||
lp.token = new Binder();
|
||||
lp.setTitle("NavigationBar");
|
||||
lp.accessibilityTitle = context.getString(R.string.nav_bar);
|
||||
lp.windowAnimations = 0;
|
||||
|
||||
View navigationBarView = LayoutInflater.from(context).inflate(
|
||||
|
||||
@@ -106,6 +106,7 @@ public class StatusBarWindowManager implements RemoteInputController.Callback, D
|
||||
mLp.gravity = Gravity.TOP;
|
||||
mLp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
||||
mLp.setTitle("StatusBar");
|
||||
mLp.accessibilityTitle = mContext.getString(R.string.status_bar);
|
||||
mLp.packageName = mContext.getPackageName();
|
||||
mStatusBarView = statusBarView;
|
||||
mBarHeight = barHeight;
|
||||
|
||||
Reference in New Issue
Block a user