Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f9aa4c3 authored by Phil Weaver's avatar Phil Weaver
Browse files

Make a11y shortcut robust to services w/no summary

Fixes: 73254116
Test: Configure shortcut for TestBack. Now works.
Also adding test to internal test that fails without
this change.

Change-Id: I6bb1359f80c5e0145997bc107fe1580686edb30e
parent f157b9f9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
        }
+11 −0
Original line number Diff line number Diff line
@@ -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 {