diff options
| author | 2023-02-05 04:03:56 +0000 | |
|---|---|---|
| committer | 2023-02-06 02:38:45 +0000 | |
| commit | 6333997c2c04f2e71c8fefad56a651e88bd25922 (patch) | |
| tree | ed71e1585d4b2597b75b4cfa74b7b58c46418a9d /java | |
| parent | 9f5489d8213f4ff6259c43b076d9538db83180d0 (diff) | |
[intentresolver] Reselection -> modify share
Doesn't change the UI or logging in this change, just API and code naming.
Bug: 267870268
Test: atest UnbundledChooserActivityTest
Change-Id: I2b8a68ed1e3fe1e6d4bdb1a89f155afdf377159a
Diffstat (limited to 'java')
4 files changed, 23 insertions, 23 deletions
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java index 3a7d4e68..c11b8060 100644 --- a/java/src/com/android/intentresolver/ChooserActivity.java +++ b/java/src/com/android/intentresolver/ChooserActivity.java @@ -763,12 +763,12 @@ public class ChooserActivity extends ResolverActivity implements @Nullable @Override - public Runnable getReselectionAction() { + public Runnable getModifyShareAction() { if (!mFeatureFlagRepository .isEnabled(Flags.SHARESHEET_RESELECTION_ACTION)) { return null; } - PendingIntent reselectionAction = mChooserRequest.getReselectionAction(); + PendingIntent reselectionAction = mChooserRequest.getModifyShareAction(); return reselectionAction == null ? null : createReselectionRunnable(reselectionAction); diff --git a/java/src/com/android/intentresolver/ChooserContentPreviewUi.java b/java/src/com/android/intentresolver/ChooserContentPreviewUi.java index 91abd9d0..a294e1a1 100644 --- a/java/src/com/android/intentresolver/ChooserContentPreviewUi.java +++ b/java/src/com/android/intentresolver/ChooserContentPreviewUi.java @@ -98,10 +98,10 @@ public final class ChooserContentPreviewUi { List<ActionRow.Action> createCustomActions(); /** - * Provides a re-selection action, if any. + * Provides a share modification action, if any. */ @Nullable - Runnable getReselectionAction(); + Runnable getModifyShareAction(); /** * <p> @@ -254,13 +254,13 @@ public final class ChooserContentPreviewUi { default: Log.e(TAG, "Unexpected content preview type: " + previewType); } - Runnable reselectionAction = actionFactory.getReselectionAction(); - if (reselectionAction != null && layout != null + Runnable modifyShareAction = actionFactory.getModifyShareAction(); + if (modifyShareAction != null && layout != null && mFeatureFlagRepository.isEnabled(Flags.SHARESHEET_RESELECTION_ACTION)) { - View reselectionView = layout.findViewById(R.id.reselection_action); - if (reselectionView != null) { - reselectionView.setVisibility(View.VISIBLE); - reselectionView.setOnClickListener(view -> reselectionAction.run()); + View modifyShareView = layout.findViewById(R.id.reselection_action); + if (modifyShareView != null) { + modifyShareView.setVisibility(View.VISIBLE); + modifyShareView.setOnClickListener(view -> modifyShareAction.run()); } } diff --git a/java/src/com/android/intentresolver/ChooserRequestParameters.java b/java/src/com/android/intentresolver/ChooserRequestParameters.java index 0d004b0d..2b67b273 100644 --- a/java/src/com/android/intentresolver/ChooserRequestParameters.java +++ b/java/src/com/android/intentresolver/ChooserRequestParameters.java @@ -76,7 +76,7 @@ public class ChooserRequestParameters { private final ImmutableList<ComponentName> mFilteredComponentNames; private final ImmutableList<ChooserTarget> mCallerChooserTargets; private final ImmutableList<ChooserAction> mChooserActions; - private final PendingIntent mReselectionAction; + private final PendingIntent mModifyShareAction; private final boolean mRetainInOnStop; @Nullable @@ -142,8 +142,8 @@ public class ChooserRequestParameters { mChooserActions = featureFlags.isEnabled(Flags.SHARESHEET_CUSTOM_ACTIONS) ? getChooserActions(clientIntent) : ImmutableList.of(); - mReselectionAction = featureFlags.isEnabled(Flags.SHARESHEET_RESELECTION_ACTION) - ? getReselectionActionExtra(clientIntent) + mModifyShareAction = featureFlags.isEnabled(Flags.SHARESHEET_RESELECTION_ACTION) + ? getModifyShareAction(clientIntent) : null; } @@ -191,8 +191,8 @@ public class ChooserRequestParameters { } @Nullable - public PendingIntent getReselectionAction() { - return mReselectionAction; + public PendingIntent getModifyShareAction() { + return mModifyShareAction; } /** @@ -335,15 +335,15 @@ public class ChooserRequestParameters { } @Nullable - private static PendingIntent getReselectionActionExtra(Intent intent) { + private static PendingIntent getModifyShareAction(Intent intent) { try { return intent.getParcelableExtra( - Intent.EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION, + Intent.EXTRA_CHOOSER_MODIFY_SHARE_ACTION, PendingIntent.class); } catch (Throwable t) { Log.w( TAG, - "Unable to retrieve Intent.EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION argument", + "Unable to retrieve Intent.EXTRA_CHOOSER_MODIFY_SHARE_ACTION argument", t); return null; } diff --git a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java index c90f0b63..17fd5bd9 100644 --- a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java +++ b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java @@ -1998,7 +1998,7 @@ public class UnbundledChooserActivityTest { } @Test - public void testLaunchWithPayloadReselection() throws InterruptedException { + public void testLaunchWithShareModification() throws InterruptedException { ChooserActivityOverrideData.getInstance().featureFlagRepository = new TestFeatureFlagRepository( Collections.singletonMap(Flags.SHARESHEET_RESELECTION_ACTION, true)); @@ -2015,14 +2015,14 @@ public class UnbundledChooserActivityTest { .thenReturn(resolvedComponentInfos); Context testContext = InstrumentationRegistry.getInstrumentation().getContext(); - final String reselectionAction = "test-broadcast-receiver-action"; + final String modifyShareAction = "test-broadcast-receiver-action"; Intent chooserIntent = Intent.createChooser(createSendTextIntent(), null); chooserIntent.putExtra( - Intent.EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION, + Intent.EXTRA_CHOOSER_MODIFY_SHARE_ACTION, PendingIntent.getBroadcast( testContext, 123, - new Intent(reselectionAction), + new Intent(modifyShareAction), PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_ONE_SHOT)); // Start activity mActivityRule.launchActivity(chooserIntent); @@ -2035,7 +2035,7 @@ public class UnbundledChooserActivityTest { broadcastInvoked.countDown(); } }; - testContext.registerReceiver(testReceiver, new IntentFilter(reselectionAction)); + testContext.registerReceiver(testReceiver, new IntentFilter(modifyShareAction)); try { onView(withText(R.string.select_text)).perform(click()); |