Add content description for ScreenRecordTile

Adds description with name and state for QQS.

Test: manual
Test: atest
Fixes: 153518955
Change-Id: Idc599d891c769791ee4ed2aec9f30db758846897
This commit is contained in:
Fabian Kozynski
2020-04-20 15:03:50 -04:00
parent edaedb06ee
commit 0daa9708d0
2 changed files with 14 additions and 0 deletions

View File

@@ -18,7 +18,9 @@ package com.android.systemui.qs.tiles;
import android.content.Intent;
import android.service.quicksettings.Tile;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Switch;
import com.android.systemui.R;
import com.android.systemui.plugins.qs.QSTile;
@@ -88,6 +90,10 @@ public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState>
state.icon = ResourceIcon.get(R.drawable.ic_qs_screenrecord);
state.secondaryLabel = mContext.getString(R.string.quick_settings_screen_record_start);
}
state.contentDescription = TextUtils.isEmpty(state.secondaryLabel)
? state.label
: TextUtils.concat(state.label, ", ", state.secondaryLabel);
state.expandedAccessibilityClassName = Switch.class.getName();
}
@Override

View File

@@ -133,4 +133,12 @@ public class ScreenRecordTileTest extends SysuiTestCase {
verify(mController, times(1)).stopRecording();
}
@Test
public void testContentDescriptionHasTileName() {
mTile.refreshState();
mTestableLooper.processAllMessages();
assertTrue(mTile.getState().contentDescription.toString().contains(mTile.getState().label));
}
}