Merge "Set screenrecord a11y live region mode" into rvc-dev am: ce6e7ba108 am: d634448bfb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11876504 Change-Id: Id78b620cefdec25a2260576c2a1ec45f360ad0b5
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