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

Commit c08984be authored by Doris Ling's avatar Doris Ling
Browse files

Add intent fields when launching instant app.

- add browseable category, package name, and new task flag.

Change-Id: Ie558f5885b5f0f78c88241de7c2d7a21cfb9d0fe
Fixes: 74131502
Test: make RunSettingsRoboTests
parent b76682af
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -147,7 +147,10 @@ public class InstantAppButtonsPreferenceController extends BasePreferenceControl
        if (!TextUtils.isEmpty(mLaunchUri)) {
            installButton.setVisibility(View.GONE);
            final Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_BROWSABLE);
            intent.setPackage(mPackageName);
            intent.setData(Uri.parse(mLaunchUri));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            launchButton.setOnClickListener(v -> mParent.startActivity(intent));
        } else {
            launchButton.setVisibility(View.GONE);
+3 −0
Original line number Diff line number Diff line
@@ -262,6 +262,9 @@ public class InstantAppButtonsPreferenceControllerTest {

        verify(mFragment).startActivity(argThat(intent-> intent != null
            && intent.getAction().equals(Intent.ACTION_VIEW)
            && intent.hasCategory(Intent.CATEGORY_BROWSABLE)
            && (intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0
            && TextUtils.equals(intent.getPackage(), TEST_AIA_PACKAGE_NAME)
            && TextUtils.equals(intent.getDataString(), launchUri)));
    }