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

Commit 88d9977b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add a content description to the app info button."

parents 4bc25cc2 93e08ebf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -267,6 +267,8 @@ public class AppHeaderController {
                        || !AppHeader.includeAppInfo(mFragment)) {
                    button.setVisibility(View.GONE);
                } else {
                    button.setContentDescription(
                            mContext.getString(R.string.application_info_label));
                    button.setImageResource(com.android.settings.R.drawable.ic_info);
                    button.setOnClickListener(v -> AppInfoBase.startAppInfoFragment(
                            InstalledAppDetails.class, R.string.application_info_label,
+20 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import org.robolectric.shadows.ShadowApplication;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -233,6 +234,25 @@ public class AppHeaderControllerTest {
                .isEqualTo(View.GONE);
    }

    @Test
    public void bindButton_hasAppInfo_shouldHaveContentDescription() {
        final View appLinks = mLayoutInflater
                .inflate(R.layout.app_details, null /* root */);
        when(mFragment.getActivity()).thenReturn(mock(Activity.class));
        when(mContext.getString(eq(R.string.application_info_label))).thenReturn("App Info");

        mController = new AppHeaderController(mContext, mFragment, appLinks);
        mController.setPackageName("123")
                .setUid(UserHandle.USER_SYSTEM)
                .setButtonActions(
                        AppHeaderController.ActionType.ACTION_APP_INFO,
                        AppHeaderController.ActionType.ACTION_NOTIF_PREFERENCE);
        mController.done();

        assertThat(appLinks.findViewById(R.id.left_button).getContentDescription())
                .isEqualTo("App Info");
    }

    @Test
    public void bindButton_hasAppNotifIntent_shouldShowButton() {
        final View appLinks = mLayoutInflater