Add intent fields when launching instant app.
- add browseable category, package name, and new task flag. Change-Id: Ie558f5885b5f0f78c88241de7c2d7a21cfb9d0fe Fixes: 74131502 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -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);
|
||||
|
@@ -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)));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user