Fix a11y issues in notification history
- crash at large display sizes/landscape - no content description for expand buttons - no call to action on tappable notification rows Test: manual Fixes: 149307144 Change-Id: I63f59de66d96a55c48852e4fbf79c87c7826076f
This commit is contained in:
@@ -8055,6 +8055,9 @@
|
|||||||
<!-- Notification history screen; summary when history is off [CHAR LIMIT=200] -->
|
<!-- Notification history screen; summary when history is off [CHAR LIMIT=200] -->
|
||||||
<string name="notification_history_off_title_extended">Notification history is turned off</string>
|
<string name="notification_history_off_title_extended">Notification history is turned off</string>
|
||||||
|
|
||||||
|
<!-- Notification history screen; content description describing what happens when you tap on a notification history entry [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="notification_history_view_settings">view notification settings</string>
|
||||||
|
|
||||||
<!-- Configure Notifications: setting title, whether the snooze menu is shown on notifications [CHAR LIMIT=80] -->
|
<!-- Configure Notifications: setting title, whether the snooze menu is shown on notifications [CHAR LIMIT=80] -->
|
||||||
<string name="snooze_options_title">Allow notification snoozing</string>
|
<string name="snooze_options_title">Allow notification snoozing</string>
|
||||||
|
|
||||||
|
@@ -77,12 +77,18 @@ public class NotificationHistoryActivity extends Activity {
|
|||||||
final View container = viewForPackage.findViewById(R.id.list_container);
|
final View container = viewForPackage.findViewById(R.id.list_container);
|
||||||
container.setVisibility(View.GONE);
|
container.setVisibility(View.GONE);
|
||||||
ImageButton expand = viewForPackage.findViewById(R.id.expand);
|
ImageButton expand = viewForPackage.findViewById(R.id.expand);
|
||||||
|
expand.setContentDescription(container.getVisibility() == View.VISIBLE
|
||||||
|
? getString(R.string.condition_expand_hide)
|
||||||
|
: getString(R.string.condition_expand_show));
|
||||||
expand.setOnClickListener(v -> {
|
expand.setOnClickListener(v -> {
|
||||||
container.setVisibility(container.getVisibility() == View.VISIBLE
|
container.setVisibility(container.getVisibility() == View.VISIBLE
|
||||||
? View.GONE : View.VISIBLE);
|
? View.GONE : View.VISIBLE);
|
||||||
expand.setImageResource(container.getVisibility() == View.VISIBLE
|
expand.setImageResource(container.getVisibility() == View.VISIBLE
|
||||||
? R.drawable.ic_expand_less
|
? R.drawable.ic_expand_less
|
||||||
: com.android.internal.R.drawable.ic_expand_more);
|
: com.android.internal.R.drawable.ic_expand_more);
|
||||||
|
expand.setContentDescription(container.getVisibility() == View.VISIBLE
|
||||||
|
? getString(R.string.condition_expand_hide)
|
||||||
|
: getString(R.string.condition_expand_show));
|
||||||
});
|
});
|
||||||
|
|
||||||
TextView label = viewForPackage.findViewById(R.id.label);
|
TextView label = viewForPackage.findViewById(R.id.label);
|
||||||
|
@@ -26,6 +26,9 @@ import android.view.View;
|
|||||||
import android.widget.DateTimeView;
|
import android.widget.DateTimeView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.core.view.AccessibilityDelegateCompat;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -66,5 +69,18 @@ public class NotificationHistoryViewHolder extends RecyclerView.ViewHolder {
|
|||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
itemView.getContext().startActivityAsUser(intent, UserHandle.of(userId));
|
itemView.getContext().startActivityAsUser(intent, UserHandle.of(userId));
|
||||||
});
|
});
|
||||||
|
ViewCompat.setAccessibilityDelegate(itemView, new AccessibilityDelegateCompat() {
|
||||||
|
@Override
|
||||||
|
public void onInitializeAccessibilityNodeInfo(View host,
|
||||||
|
AccessibilityNodeInfoCompat info) {
|
||||||
|
super.onInitializeAccessibilityNodeInfo(host, info);
|
||||||
|
CharSequence description =
|
||||||
|
host.getResources().getText(R.string.notification_history_view_settings);
|
||||||
|
AccessibilityNodeInfoCompat.AccessibilityActionCompat customClick =
|
||||||
|
new AccessibilityNodeInfoCompat.AccessibilityActionCompat(
|
||||||
|
AccessibilityNodeInfoCompat.ACTION_CLICK, description);
|
||||||
|
info.addAction(customClick);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ import android.os.UserHandle;
|
|||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.Slog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -70,17 +71,21 @@ public class NotificationSbnAdapter extends
|
|||||||
public void onBindViewHolder(final @NonNull NotificationSbnViewHolder holder,
|
public void onBindViewHolder(final @NonNull NotificationSbnViewHolder holder,
|
||||||
int position) {
|
int position) {
|
||||||
final StatusBarNotification sbn = mValues.get(position);
|
final StatusBarNotification sbn = mValues.get(position);
|
||||||
holder.setIcon(loadIcon(sbn));
|
if (sbn != null) {
|
||||||
holder.setPackageName(loadPackageName(sbn.getPackageName()).toString());
|
holder.setIcon(loadIcon(sbn));
|
||||||
holder.setTitle(getTitleString(sbn.getNotification()));
|
holder.setPackageName(loadPackageName(sbn.getPackageName()).toString());
|
||||||
holder.setSummary(getTextString(mContext, sbn.getNotification()));
|
holder.setTitle(getTitleString(sbn.getNotification()));
|
||||||
holder.setPostedTime(sbn.getPostTime());
|
holder.setSummary(getTextString(mContext, sbn.getNotification()));
|
||||||
if (!mUserBadgeCache.containsKey(sbn.getUserId())) {
|
holder.setPostedTime(sbn.getPostTime());
|
||||||
Drawable profile = mContext.getPackageManager().getUserBadgeForDensity(
|
if (!mUserBadgeCache.containsKey(sbn.getUserId())) {
|
||||||
UserHandle.of(sbn.getUserId()), -1);
|
Drawable profile = mContext.getPackageManager().getUserBadgeForDensity(
|
||||||
mUserBadgeCache.put(sbn.getUserId(), profile);
|
UserHandle.of(sbn.getUserId()), -1);
|
||||||
|
mUserBadgeCache.put(sbn.getUserId(), profile);
|
||||||
|
}
|
||||||
|
holder.setProfileBadge(mUserBadgeCache.get(sbn.getUserId()));
|
||||||
|
} else {
|
||||||
|
Slog.w(TAG, "null entry in list at position " + position);
|
||||||
}
|
}
|
||||||
holder.setProfileBadge(mUserBadgeCache.get(sbn.getUserId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user