Merge "Make a11y shortcut robust to services w/no summary"
This commit is contained in:
committed by
Android (Google) Code Review
commit
0b48b075c8
@@ -319,7 +319,7 @@ public class AccessibilityShortcutController {
|
||||
}
|
||||
final PackageManager pm = mContext.getPackageManager();
|
||||
String label = serviceInfo.getResolveInfo().loadLabel(pm).toString();
|
||||
String summary = serviceInfo.loadSummary(pm).toString();
|
||||
CharSequence summary = serviceInfo.loadSummary(pm);
|
||||
if (!includeSummary || TextUtils.isEmpty(summary)) {
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -397,6 +397,17 @@ public class AccessibilityShortcutControllerTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnAccessibilityShortcut_forServiceWithNoSummary_doesNotCrash()
|
||||
throws Exception {
|
||||
configureShortcutEnabled(ENABLED_EXCEPT_LOCK_SCREEN);
|
||||
configureValidShortcutService();
|
||||
when(mServiceInfo.loadSummary(any())).thenReturn(null);
|
||||
Settings.Secure.putInt(mContentResolver, ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, 1);
|
||||
getController().performAccessibilityShortcut();
|
||||
verify(mAccessibilityManagerService).performAccessibilityShortcut();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnAccessibilityShortcut_forFrameworkFeature_callsServiceWithNoToast()
|
||||
throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user