Merge "Add content description for ScreenRecordTile" into rvc-dev

This commit is contained in:
Fabian Kozynski
2020-04-21 14:12:23 +00:00
committed by Android (Google) Code Review
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));
}
}