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

Commit dc23eaea authored by Stanley Wang's avatar Stanley Wang Committed by Android (Google) Code Review
Browse files

Merge "Fix the 'Google play system update' button is not actionable."

parents aa461b09 10ec7712
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@
        android:key="module_version"
        android:title="@string/module_version"
        android:summary="@string/summary_placeholder"
        android:selectable="false"
        settings:enableCopying="true"
        settings:controller="com.android.settings.deviceinfo.firmwareversion.MainlineModuleVersionPreferenceController"/>

+3 −0
Original line number Diff line number Diff line
@@ -86,8 +86,11 @@ public class MainlineModuleVersionPreferenceController extends BasePreferenceCon
                mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0 /* flags */);
        if (resolved != null) {
            preference.setIntent(MODULE_UPDATE_INTENT);
            preference.setSelectable(true);
        } else {
            Log.d(TAG, "The ResolveInfo of the update intent is null.");
            preference.setIntent(null);
            preference.setSelectable(false);
        }
    }

+14 −0
Original line number Diff line number Diff line
@@ -110,6 +110,20 @@ public class MainlineModuleVersionPreferenceControllerTest {
        assertThat(mPreference.getIntent()).isEqualTo(MODULE_UPDATE_INTENT);
    }

    @Test
    public void updateStates_canHandleIntent_preferenceShouldBeSelectable() throws Exception {
        setupModulePackage("test version 123");
        when(mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0))
                .thenReturn(new ResolveInfo());

        final MainlineModuleVersionPreferenceController controller =
                new MainlineModuleVersionPreferenceController(mContext, "key");

        controller.updateState(mPreference);

        assertThat(mPreference.isSelectable()).isTrue();
    }

    @Test
    public void updateStates_cannotHandleIntent_setNullToPreference() throws Exception {
        setupModulePackage("test version 123");