Set screenrecord a11y live region mode
For a11y the countdown displayed by the status bar icon should be announced by talkback. ASSERTIVE will notify the user ASAP, since the countdown only lasts 3 seconds. Fixes: 153518579 Test: manual Change-Id: I59eae4a2f92d478118ebe4832b32642411db3a07
This commit is contained in:
@@ -38,6 +38,7 @@ import android.service.notification.ZenModeConfig;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
@@ -677,12 +678,18 @@ public class PhoneStatusBarPolicy
|
||||
}
|
||||
mIconController.setIcon(mSlotScreenRecord, resourceId, description);
|
||||
mIconController.setIconVisibility(mSlotScreenRecord, true);
|
||||
// Set as assertive so talkback will announce the countdown
|
||||
mIconController.setIconAccessibilityLiveRegion(mSlotScreenRecord,
|
||||
View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCountdownEnd() {
|
||||
if (DEBUG) Log.d(TAG, "screenrecord: hiding icon during countdown");
|
||||
mHandler.post(() -> mIconController.setIconVisibility(mSlotScreenRecord, false));
|
||||
// Reset talkback priority
|
||||
mIconController.setIconAccessibilityLiveRegion(mSlotScreenRecord,
|
||||
View.ACCESSIBILITY_LIVE_REGION_NONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,6 +67,15 @@ public interface StatusBarIconController {
|
||||
public void setSignalIcon(String slot, WifiIconState state);
|
||||
public void setMobileIcons(String slot, List<MobileIconState> states);
|
||||
public void setIconVisibility(String slot, boolean b);
|
||||
|
||||
/**
|
||||
* Sets the live region mode for the icon
|
||||
* @see android.view.View#setAccessibilityLiveRegion(int)
|
||||
* @param slot Icon slot to set region for
|
||||
* @param accessibilityLiveRegion live region mode for the icon
|
||||
*/
|
||||
void setIconAccessibilityLiveRegion(String slot, int accessibilityLiveRegion);
|
||||
|
||||
/**
|
||||
* If you don't know what to pass for `tag`, either remove all icons for slot, or use
|
||||
* TAG_PRIMARY to refer to the first icon at a given slot.
|
||||
|
||||
@@ -265,6 +265,22 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
||||
handleSet(index, holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIconAccessibilityLiveRegion(String slotName, int accessibilityLiveRegion) {
|
||||
Slot slot = getSlot(slotName);
|
||||
if (!slot.hasIconsInSlot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int slotIndex = getSlotIndex(slotName);
|
||||
List<StatusBarIconHolder> iconsToUpdate = slot.getHolderListInViewOrder();
|
||||
for (StatusBarIconHolder holder : iconsToUpdate) {
|
||||
int viewIndex = getViewIndex(slotIndex, holder.getTag());
|
||||
mIconGroups.forEach(l -> l.mGroup.getChildAt(viewIndex)
|
||||
.setAccessibilityLiveRegion(accessibilityLiveRegion));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeIcon(String slot) {
|
||||
removeAllIconsForSlot(slot);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.android.systemui.statusbar.phone.StatusBarIconController;
|
||||
import com.android.systemui.statusbar.phone.StatusBarIconController.IconManager;
|
||||
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
|
||||
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.WifiIconState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FakeStatusBarIconController extends BaseLeakChecker<IconManager>
|
||||
@@ -75,4 +76,8 @@ public class FakeStatusBarIconController extends BaseLeakChecker<IconManager>
|
||||
public void removeAllIconsForSlot(String slot) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIconAccessibilityLiveRegion(String slot, int mode) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user