diff options
| author | 2023-03-13 19:57:27 +0000 | |
|---|---|---|
| committer | 2023-03-14 15:01:18 +0000 | |
| commit | 961d141bc72743ee8c42ce21bb6b0e5e01b30c4c (patch) | |
| tree | c6e03189e14ca37a925c8deaafafd1483575a722 /java | |
| parent | e7f8555d956c8bf5f338a182d8023b2740edc389 (diff) | |
Stop sharing framework strings from unbundled Java
This kind of sharing was a relic of unbundling, and is known to cause
inscrutable failures (e.g. b/270760957) when the unbundled tests were
run on a device with an out-of-date framework version. We've already
hard-forked (duplicated into the IntentResolver package) most string
resources, and this CL addresses the remainder, w/ exceptions:
1. Layout XML and other resource files may not have the same
compatibility issues, so I've left them unchanged or now; we may
need to make a similar change to those files in the future.
2. I left one string, `com.android.internal.R.string.copy`, because
I don't think we'd ever want to diverge from the system value and
it's currently exported in the frameworks `public-final.xml`
resource (so there's no risk of binary-incompatibility issues).
In some cases, the resource-sharing wasn't apparent due to file-level
imports of `com.android.internal.R`; I removed those imports (so that
all the unbundled code loads resources from the `intentresolver`
package by default) and converted the non-string resource references
to explicitly reference the framework symbols by fully-qualified name.
This only addresses string resources and may be inadequate to prevent
all regressions in the class of b/270760957, and view ID resources are
particularly concerning because it wouldn't be straightforward to fix
them by an analogous "hard-fork" process. In fact, an earlier
workaround (removed in ag/20065287) had separate cases specifically to
address resource sharing for strings vs. view IDs, so we may expect to
need some fix there. If we encounter similar regressions based on the
view IDs (and don't have any better ideas), we may be able to
reinstate the workaround from ag/20065287 (just for the view IDs;
strings should never need the old workaround now).
Bug: 270760957
Test: `atest IntentResolverUnitTests`, before and after adding a new
placeholder string resource at the top of frameworks' `strings.xml`.
Prior to this CL, that modification would've caused the tests to start
failing unless the framework was rebuilt (e.g. by `mp droid`).
Change-Id: Ifaf069124ba677a79517894d7aba847c5d869b74
Diffstat (limited to 'java')
10 files changed, 151 insertions, 76 deletions
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 24604ed3..1cd39d42 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -17,17 +17,92 @@ <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Title of the IntentResolver application. [CHAR LIMIT=50] --> - <string name="app_label">IntentResolver</string> - + <string name="app_label" translatable="false">IntentResolver</string> + + <!-- Title of intent resolver dialog when selecting an application to run. --> + <string name="whichApplication">Complete action using</string> + <!-- Title of intent resolver dialog when selecting an application to run + and a previously used application is known. --> + <string name="whichApplicationNamed">Complete action using <xliff:g id="app" example="YouTube">%1$s</xliff:g></string> + <!-- Generic label for a link to a intent resolver. --> + <string name="whichApplicationLabel">Complete action</string> + <!-- Title of intent resolver dialog when selecting a viewer application to run. --> + <string name="whichViewApplication">Open with</string> + <!-- Title of intent resolver dialog when selecting a viewer application to run + and a previously used application is known. --> + <string name="whichViewApplicationNamed">Open with <xliff:g id="app" example="YouTube">%1$s</xliff:g></string> <!-- Label for a link to a intent resolver dialog to view something --> <string name="whichViewApplicationLabel">Open</string> + <!-- Title of intent resolver dialog when selecting a browser/application that opens specific URIs + [CHAR LIMIT=128]. --> + <string name="whichOpenHostLinksWith">Open <xliff:g id="host" example="mail.google.com">%1$s</xliff:g> links with</string> + <!-- Title of intent resolver dialog when selecting a browser that opens URI + [CHAR LIMIT=128]. --> + <string name="whichOpenLinksWith">Open links with</string> + <!-- Title of intent resolver dialog when defaulting to a specific browser that opens URI + [CHAR LIMIT=128]. --> + <string name="whichOpenLinksWithApp">Open links with <xliff:g id="application" example="Chrome">%1$s</xliff:g></string> + <!-- Title of intent resolver dialog when defaulting to a specific browser that opens URI + [CHAR LIMIT=128]. --> + <string name="whichOpenHostLinksWithApp">Open <xliff:g id="host" example="mail.google.com">%1$s</xliff:g> links with <xliff:g id="application" example="Chrome">%2$s</xliff:g></string> + <!-- Label for a link to an intent resolver dialog to open URI [CHAR LIMIT=18] --> + <string name="whichGiveAccessToApplicationLabel">Give access</string> + <!-- Title of intent resolver dialog when selecting an editor application to run. --> + <string name="whichEditApplication">Edit with</string> + <!-- Title of intent resolver dialog when selecting an editor application to run + and a previously used application is known. --> + <string name="whichEditApplicationNamed">Edit with <xliff:g id="app" example="YouTube">%1$s</xliff:g></string> + <!-- Label for a link to a intent resolver dialog when selecting an editor application --> + <string name="whichEditApplicationLabel">Edit</string> + <!-- Title of intent resolver dialog when selecting a sharing application to run. --> + <string name="whichSendApplication">Share</string> + <!-- Title of intent resolver dialog when selecting a sharing application to run + and a previously used application is known. --> + <string name="whichSendApplicationNamed">Share with <xliff:g id="app" example="YouTube">%1$s</xliff:g></string> + <!-- Label for a link to a intent resolver dialog to sharing something --> + <string name="whichSendApplicationLabel">Share</string> + <!-- Title of intent resolver dialog when selecting an application to run to + send content to a specific recipient. Often used for email. --> + <string name="whichSendToApplication">Send using</string> + <!-- Title of intent resolver dialog when selecting an application to run to + send content to a specific recipient and a previously used application is known. + Often used for email. --> + <string name="whichSendToApplicationNamed">Send using <xliff:g id="app" example="YouTube">%1$s</xliff:g></string> + <!-- Label for a link to a intent resolver dialog to send content to a specific recipient. --> + <string name="whichSendToApplicationLabel">Send</string> + <!-- Title of intent resolver dialog when selecting a HOME application to run. --> + <string name="whichHomeApplication">Select a Home app</string> + <!-- Title of intent resolver dialog when selecting a HOME application to run + and a previously used application is known. --> + <string name="whichHomeApplicationNamed">Use <xliff:g id="app" example="YouTube">%1$s</xliff:g> as Home</string> + <!-- Label for a link to a intent resolver dialog when selecting a HOME --> + <string name="whichHomeApplicationLabel">Capture image</string> + <!-- Option to always use the selected application resolution in the future. See the "Complete action using" dialog title--> + <!-- Title of intent resolver dialog when capturing an image. --> + <string name="whichImageCaptureApplication">Capture image with</string> + <!-- Title of intent resolver dialog when capturing an image + and a previously used application is known. --> + <string name="whichImageCaptureApplicationNamed">Capture image with <xliff:g id="app" example="YouTube">%1$s</xliff:g></string> + <!-- Label for a link to a intent resolver dialog when capturing an image --> + <string name="whichImageCaptureApplicationLabel">Capture image</string> + <!-- Title of the list of alternate options to complete an action shown when the last used option is being displayed separately. --> <string name="use_a_different_app">Use a different app</string> + <!-- Default title for the activity chooser, when one is not given. Android allows multiple + activities to perform an action. for example, there may be many ringtone pickers installed. + A dialog is shown to the user allowing them to pick which activity should be used. This is + the title. --> + <string name="chooseActivity">Choose an action</string> <!-- Text to display when there are no activities found to display in the activity chooser. See the "Select an action" title. --> <string name="noApplications">No apps can perform this action.</string> + <!-- Message to show when an intent automatically switches users into the personal profile. --> + <string name="forward_intent_to_owner">You\'re using this app outside of your work profile</string> + <!-- Message to show when an intent automatically switches users into a work profile. --> + <string name="forward_intent_to_work">You\'re using this app in your work profile</string> + <!-- Title for a button to choose the currently selected activity as the default in the activity resolver. [CHAR LIMIT=25] --> <string name="activity_resolver_use_always">Always</string> @@ -36,12 +111,19 @@ from the activity resolver to use just this once. [CHAR LIMIT=25] --> <string name="activity_resolver_use_once">Just once</string> + <!-- Text for the toast that is shown when the user clicks on a launcher that + doesn't support the work profile. [CHAR LIMIT=100] --> + <string name="activity_resolver_work_profiles_support"><xliff:g id="app" example="YouTube">%1$s</xliff:g> doesn\'t support work profile</string> + <!-- Resolver target actions strings --> <!-- Pin this app to the top of the Sharesheet app list. [CHAR LIMIT=60]--> <string name="pin_specific_target">Pin <xliff:g id="label" example="Tweet">%1$s</xliff:g></string> <!-- Un-pin this app in the Sharesheet, so that it is sorted normally. [CHAR LIMIT=60]--> <string name="unpin_specific_target">Unpin <xliff:g id="label" example="Tweet">%1$s</xliff:g></string> + <!-- Notification action for editing a screenshot (drawing on it, cropping it, etc) --> + <string name="screenshot_edit">Edit</string> + <string name="file_count">{count, plural, =1 {{file_name} + # file} other {{file_name} + # files} diff --git a/java/src/com/android/intentresolver/ChooserActionFactory.java b/java/src/com/android/intentresolver/ChooserActionFactory.java index 947155f3..82103b39 100644 --- a/java/src/com/android/intentresolver/ChooserActionFactory.java +++ b/java/src/com/android/intentresolver/ChooserActionFactory.java @@ -386,7 +386,7 @@ public final class ChooserActionFactory implements ChooserContentPreviewUi.Actio final DisplayResolveInfo dri = DisplayResolveInfo.newDisplayResolveInfo( originalIntent, ri, - context.getString(com.android.internal.R.string.screenshot_edit), + context.getString(R.string.screenshot_edit), "", resolveIntent, null); diff --git a/java/src/com/android/intentresolver/ChooserRequestParameters.java b/java/src/com/android/intentresolver/ChooserRequestParameters.java index 3d99e475..dbd72a1f 100644 --- a/java/src/com/android/intentresolver/ChooserRequestParameters.java +++ b/java/src/com/android/intentresolver/ChooserRequestParameters.java @@ -310,8 +310,7 @@ public class ChooserRequestParameters { requestedTitle = null; } - int defaultTitleRes = - (requestedTitle == null) ? com.android.internal.R.string.chooseActivity : 0; + int defaultTitleRes = (requestedTitle == null) ? R.string.chooseActivity : 0; return Pair.create(requestedTitle, defaultTitleRes); } diff --git a/java/src/com/android/intentresolver/IntentForwarderActivity.java b/java/src/com/android/intentresolver/IntentForwarderActivity.java index 78240250..5e8945f1 100644 --- a/java/src/com/android/intentresolver/IntentForwarderActivity.java +++ b/java/src/com/android/intentresolver/IntentForwarderActivity.java @@ -162,13 +162,13 @@ public class IntentForwarderActivity extends Activity { private String getForwardToPersonalMessage() { return getSystemService(DevicePolicyManager.class).getResources().getString( FORWARD_INTENT_TO_PERSONAL, - () -> getString(com.android.internal.R.string.forward_intent_to_owner)); + () -> getString(R.string.forward_intent_to_owner)); } private String getForwardToWorkMessage() { return getSystemService(DevicePolicyManager.class).getResources().getString( FORWARD_INTENT_TO_WORK, - () -> getString(com.android.internal.R.string.forward_intent_to_work)); + () -> getString(R.string.forward_intent_to_work)); } private boolean isIntentForwarderResolveInfo(ResolveInfo resolveInfo) { diff --git a/java/src/com/android/intentresolver/NoAppsAvailableEmptyStateProvider.java b/java/src/com/android/intentresolver/NoAppsAvailableEmptyStateProvider.java index c1373f4b..d424f295 100644 --- a/java/src/com/android/intentresolver/NoAppsAvailableEmptyStateProvider.java +++ b/java/src/com/android/intentresolver/NoAppsAvailableEmptyStateProvider.java @@ -31,7 +31,6 @@ import android.stats.devicepolicy.nano.DevicePolicyEnums; import com.android.intentresolver.AbstractMultiProfilePagerAdapter.EmptyState; import com.android.intentresolver.AbstractMultiProfilePagerAdapter.EmptyStateProvider; import com.android.intentresolver.AbstractMultiProfilePagerAdapter.MyUserIdProvider; -import com.android.internal.R; import java.util.List; diff --git a/java/src/com/android/intentresolver/ResolverActivity.java b/java/src/com/android/intentresolver/ResolverActivity.java index d224299e..a240968b 100644 --- a/java/src/com/android/intentresolver/ResolverActivity.java +++ b/java/src/com/android/intentresolver/ResolverActivity.java @@ -237,47 +237,43 @@ public class ResolverActivity extends FragmentActivity implements private enum ActionTitle { VIEW(Intent.ACTION_VIEW, - com.android.internal.R.string.whichViewApplication, - com.android.internal.R.string.whichViewApplicationNamed, - com.android.internal.R.string.whichViewApplicationLabel), + R.string.whichViewApplication, + R.string.whichViewApplicationNamed, + R.string.whichViewApplicationLabel), EDIT(Intent.ACTION_EDIT, - com.android.internal.R.string.whichEditApplication, - com.android.internal.R.string.whichEditApplicationNamed, - com.android.internal.R.string.whichEditApplicationLabel), + R.string.whichEditApplication, + R.string.whichEditApplicationNamed, + R.string.whichEditApplicationLabel), SEND(Intent.ACTION_SEND, - com.android.internal.R.string.whichSendApplication, - com.android.internal.R.string.whichSendApplicationNamed, - com.android.internal.R.string.whichSendApplicationLabel), + R.string.whichSendApplication, + R.string.whichSendApplicationNamed, + R.string.whichSendApplicationLabel), SENDTO(Intent.ACTION_SENDTO, - com.android.internal.R.string.whichSendToApplication, - com.android.internal.R.string.whichSendToApplicationNamed, - com.android.internal.R.string.whichSendToApplicationLabel), + R.string.whichSendToApplication, + R.string.whichSendToApplicationNamed, + R.string.whichSendToApplicationLabel), SEND_MULTIPLE(Intent.ACTION_SEND_MULTIPLE, - com.android.internal.R.string.whichSendApplication, - com.android.internal.R.string.whichSendApplicationNamed, - com.android.internal.R.string.whichSendApplicationLabel), + R.string.whichSendApplication, + R.string.whichSendApplicationNamed, + R.string.whichSendApplicationLabel), CAPTURE_IMAGE(MediaStore.ACTION_IMAGE_CAPTURE, - com.android.internal.R.string.whichImageCaptureApplication, - com.android.internal.R.string.whichImageCaptureApplicationNamed, - com.android.internal.R.string.whichImageCaptureApplicationLabel), + R.string.whichImageCaptureApplication, + R.string.whichImageCaptureApplicationNamed, + R.string.whichImageCaptureApplicationLabel), DEFAULT(null, - com.android.internal.R.string.whichApplication, - com.android.internal.R.string.whichApplicationNamed, - com.android.internal.R.string.whichApplicationLabel), + R.string.whichApplication, + R.string.whichApplicationNamed, + R.string.whichApplicationLabel), HOME(Intent.ACTION_MAIN, - com.android.internal.R.string.whichHomeApplication, - com.android.internal.R.string.whichHomeApplicationNamed, - com.android.internal.R.string.whichHomeApplicationLabel); + R.string.whichHomeApplication, + R.string.whichHomeApplicationNamed, + R.string.whichHomeApplicationLabel); // titles for layout that deals with http(s) intents - public static final int BROWSABLE_TITLE_RES = - com.android.internal.R.string.whichOpenLinksWith; - public static final int BROWSABLE_HOST_TITLE_RES = - com.android.internal.R.string.whichOpenHostLinksWith; - public static final int BROWSABLE_HOST_APP_TITLE_RES = - com.android.internal.R.string.whichOpenHostLinksWithApp; - public static final int BROWSABLE_APP_TITLE_RES = - com.android.internal.R.string.whichOpenLinksWithApp; + public static final int BROWSABLE_TITLE_RES = R.string.whichOpenLinksWith; + public static final int BROWSABLE_HOST_TITLE_RES = R.string.whichOpenHostLinksWith; + public static final int BROWSABLE_HOST_APP_TITLE_RES = R.string.whichOpenHostLinksWithApp; + public static final int BROWSABLE_APP_TITLE_RES = R.string.whichOpenLinksWithApp; public final String action; public final int titleRes; @@ -1361,13 +1357,13 @@ public class ResolverActivity extends FragmentActivity implements private String getForwardToPersonalMsg() { return getSystemService(DevicePolicyManager.class).getResources().getString( FORWARD_INTENT_TO_PERSONAL, - () -> getString(com.android.internal.R.string.forward_intent_to_owner)); + () -> getString(R.string.forward_intent_to_owner)); } private String getForwardToWorkMsg() { return getSystemService(DevicePolicyManager.class).getResources().getString( FORWARD_INTENT_TO_WORK, - () -> getString(com.android.internal.R.string.forward_intent_to_work)); + () -> getString(R.string.forward_intent_to_work)); } /** @@ -1544,7 +1540,7 @@ public class ResolverActivity extends FragmentActivity implements return getSystemService(DevicePolicyManager.class).getResources().getString( RESOLVER_WORK_PROFILE_NOT_SUPPORTED, () -> getString( - com.android.internal.R.string.activity_resolver_work_profiles_support, + R.string.activity_resolver_work_profiles_support, launcherName), launcherName); } diff --git a/java/src/com/android/intentresolver/WorkProfilePausedEmptyStateProvider.java b/java/src/com/android/intentresolver/WorkProfilePausedEmptyStateProvider.java index 0333039b..2f3dfbd5 100644 --- a/java/src/com/android/intentresolver/WorkProfilePausedEmptyStateProvider.java +++ b/java/src/com/android/intentresolver/WorkProfilePausedEmptyStateProvider.java @@ -29,7 +29,6 @@ import android.stats.devicepolicy.nano.DevicePolicyEnums; import com.android.intentresolver.AbstractMultiProfilePagerAdapter.EmptyState; import com.android.intentresolver.AbstractMultiProfilePagerAdapter.EmptyStateProvider; import com.android.intentresolver.AbstractMultiProfilePagerAdapter.OnSwitchOnWorkSelectedListener; -import com.android.internal.R; /** * Chooser/ResolverActivity empty state provider that returns empty state which is shown when diff --git a/java/tests/src/com/android/intentresolver/ResolverActivityTest.java b/java/tests/src/com/android/intentresolver/ResolverActivityTest.java index ae1b99f8..e2772423 100644 --- a/java/tests/src/com/android/intentresolver/ResolverActivityTest.java +++ b/java/tests/src/com/android/intentresolver/ResolverActivityTest.java @@ -55,7 +55,6 @@ import androidx.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.intentresolver.widget.ResolverDrawerLayout; -import com.android.internal.R; import org.junit.Before; import org.junit.Ignore; @@ -117,7 +116,7 @@ public class ResolverActivityTest { ResolveInfo toChoose = resolvedComponentInfos.get(0).getResolveInfoAt(0); onView(withText(toChoose.activityInfo.name)) .perform(click()); - onView(withId(R.id.button_once)) + onView(withId(com.android.internal.R.id.button_once)) .perform(click()); waitForIdle(); assertThat(chosen[0], is(toChoose)); @@ -133,13 +132,13 @@ public class ResolverActivityTest { waitForIdle(); final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent); - final View viewPager = activity.findViewById(R.id.profile_pager); + final View viewPager = activity.findViewById(com.android.internal.R.id.profile_pager); final int initialResolverHeight = viewPager.getHeight(); activity.runOnUiThread(() -> { ResolverDrawerLayout layout = (ResolverDrawerLayout) activity.findViewById( - R.id.contentPanel); + com.android.internal.R.id.contentPanel); ((ResolverDrawerLayout.LayoutParams) viewPager.getLayoutParams()).maxHeight = initialResolverHeight - 1; // Force a relayout @@ -153,7 +152,7 @@ public class ResolverActivityTest { activity.runOnUiThread(() -> { ResolverDrawerLayout layout = (ResolverDrawerLayout) activity.findViewById( - R.id.contentPanel); + com.android.internal.R.id.contentPanel); ((ResolverDrawerLayout.LayoutParams) viewPager.getLayoutParams()).maxHeight = initialResolverHeight + 1; // Force a relayout @@ -175,10 +174,11 @@ public class ResolverActivityTest { waitForIdle(); final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent); - final View viewPager = activity.findViewById(R.id.profile_pager); - final View divider = activity.findViewById(R.id.divider); + final View viewPager = activity.findViewById(com.android.internal.R.id.profile_pager); + final View divider = activity.findViewById(com.android.internal.R.id.divider); final RelativeLayout profileView = - (RelativeLayout) activity.findViewById(R.id.profile_button).getParent(); + (RelativeLayout) activity.findViewById(com.android.internal.R.id.profile_button) + .getParent(); assertThat("Drawer should show at bottom by default", profileView.getBottom() + divider.getHeight() == viewPager.getTop() && profileView.getTop() > 0); @@ -186,7 +186,7 @@ public class ResolverActivityTest { activity.runOnUiThread(() -> { ResolverDrawerLayout layout = (ResolverDrawerLayout) activity.findViewById( - R.id.contentPanel); + com.android.internal.R.id.contentPanel); layout.setShowAtTop(true); }); waitForIdle(); @@ -218,7 +218,7 @@ public class ResolverActivityTest { return true; }; - onView(withId(R.id.button_once)).perform(click()); + onView(withId(com.android.internal.R.id.button_once)).perform(click()); waitForIdle(); assertThat(chosen[0], is(toChoose)); } @@ -251,7 +251,7 @@ public class ResolverActivityTest { // We pick the first one as there is another one in the work profile side onView(first(withText(stableCopy.get(1).getResolveInfoAt(0).activityInfo.name))) .perform(click()); - onView(withId(R.id.button_once)) + onView(withId(com.android.internal.R.id.button_once)) .perform(click()); waitForIdle(); assertThat(chosen[0], is(toChoose)); @@ -280,7 +280,7 @@ public class ResolverActivityTest { }; // Confirm that the button bar is disabled by default - onView(withId(R.id.button_once)).check(matches(not(isEnabled()))); + onView(withId(com.android.internal.R.id.button_once)).check(matches(not(isEnabled()))); // Make a stable copy of the components as the original list may be modified List<ResolvedComponentInfo> stableCopy = @@ -288,7 +288,7 @@ public class ResolverActivityTest { onView(withText(stableCopy.get(1).getResolveInfoAt(0).activityInfo.name)) .perform(click()); - onView(withId(R.id.button_once)).perform(click()); + onView(withId(com.android.internal.R.id.button_once)).perform(click()); waitForIdle(); assertThat(chosen[0], is(toChoose)); } @@ -321,7 +321,7 @@ public class ResolverActivityTest { }; // Confirm that the button bar is disabled by default - onView(withId(R.id.button_once)).check(matches(not(isEnabled()))); + onView(withId(com.android.internal.R.id.button_once)).check(matches(not(isEnabled()))); // Make a stable copy of the components as the original list may be modified List<ResolvedComponentInfo> stableCopy = @@ -329,7 +329,7 @@ public class ResolverActivityTest { onView(withText(stableCopy.get(1).getResolveInfoAt(0).activityInfo.name)) .perform(click()); - onView(withId(R.id.button_once)).perform(click()); + onView(withId(com.android.internal.R.id.button_once)).perform(click()); waitForIdle(); assertThat(chosen[0], is(toChoose)); } @@ -342,7 +342,7 @@ public class ResolverActivityTest { mActivityRule.launchActivity(sendIntent); waitForIdle(); - onView(withId(R.id.tabs)).check(matches(isDisplayed())); + onView(withId(com.android.internal.R.id.tabs)).check(matches(isDisplayed())); } @Test @@ -352,7 +352,7 @@ public class ResolverActivityTest { mActivityRule.launchActivity(sendIntent); waitForIdle(); - onView(withId(R.id.tabs)).check(matches(not(isDisplayed()))); + onView(withId(com.android.internal.R.id.tabs)).check(matches(not(isDisplayed()))); } @Test @@ -447,7 +447,7 @@ public class ResolverActivityTest { onView(first(allOf(withText(workResolvedComponentInfos.get(0) .getResolveInfoAt(0).activityInfo.applicationInfo.name), isCompletelyDisplayed()))) .perform(click()); - onView(withId(R.id.button_once)) + onView(withId(com.android.internal.R.id.button_once)) .perform(click()); waitForIdle(); @@ -484,7 +484,7 @@ public class ResolverActivityTest { final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent); waitForIdle(); - TextView headerText = activity.findViewById(R.id.title); + TextView headerText = activity.findViewById(com.android.internal.R.id.title); String initialText = headerText.getText().toString(); assertFalse(initialText.isEmpty(), "Header text is empty."); assertThat(headerText.getVisibility(), is(View.VISIBLE)); @@ -501,7 +501,7 @@ public class ResolverActivityTest { final ResolverWrapperActivity activity = mActivityRule.launchActivity(sendIntent); waitForIdle(); - TextView headerText = activity.findViewById(R.id.title); + TextView headerText = activity.findViewById(com.android.internal.R.id.title); String initialText = headerText.getText().toString(); onView(withText(R.string.resolver_work_tab)) .perform(click()); @@ -539,7 +539,7 @@ public class ResolverActivityTest { .getResolveInfoAt(0).activityInfo.applicationInfo.name), isDisplayed()))) .perform(click()); - onView(withId(R.id.button_once)) + onView(withId(com.android.internal.R.id.button_once)) .perform(click()); waitForIdle(); @@ -563,7 +563,7 @@ public class ResolverActivityTest { waitForIdle(); onView(withText(R.string.resolver_work_tab)).perform(click()); waitForIdle(); - onView(withId(R.id.contentPanel)) + onView(withId(com.android.internal.R.id.contentPanel)) .perform(swipeUp()); onView(withText(R.string.resolver_cross_profile_blocked)) @@ -585,7 +585,7 @@ public class ResolverActivityTest { mActivityRule.launchActivity(sendIntent); waitForIdle(); - onView(withId(R.id.contentPanel)) + onView(withId(com.android.internal.R.id.contentPanel)) .perform(swipeUp()); onView(withText(R.string.resolver_work_tab)).perform(click()); waitForIdle(); @@ -607,7 +607,7 @@ public class ResolverActivityTest { mActivityRule.launchActivity(sendIntent); waitForIdle(); - onView(withId(R.id.contentPanel)) + onView(withId(com.android.internal.R.id.contentPanel)) .perform(swipeUp()); onView(withText(R.string.resolver_work_tab)).perform(click()); waitForIdle(); @@ -631,7 +631,7 @@ public class ResolverActivityTest { mActivityRule.launchActivity(sendIntent); waitForIdle(); - onView(withId(R.id.contentPanel)) + onView(withId(com.android.internal.R.id.contentPanel)) .perform(swipeUp()); onView(withText(R.string.resolver_work_tab)).perform(click()); waitForIdle(); @@ -655,7 +655,7 @@ public class ResolverActivityTest { mActivityRule.launchActivity(sendIntent); waitForIdle(); - onView(withId(R.id.open_cross_profile)).check(matches(isDisplayed())); + onView(withId(com.android.internal.R.id.open_cross_profile)).check(matches(isDisplayed())); } @Test @@ -678,7 +678,8 @@ public class ResolverActivityTest { private void assertNotMiniResolver() { try { - onView(withId(R.id.open_cross_profile)).check(matches(isDisplayed())); + onView(withId(com.android.internal.R.id.open_cross_profile)) + .check(matches(isDisplayed())); } catch (NoMatchingViewException e) { return; } @@ -699,7 +700,7 @@ public class ResolverActivityTest { mActivityRule.launchActivity(sendIntent); waitForIdle(); - onView(withId(R.id.contentPanel)) + onView(withId(com.android.internal.R.id.contentPanel)) .perform(swipeUp()); onView(withText(R.string.resolver_work_tab)).perform(click()); waitForIdle(); diff --git a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java index 0aab0536..3bf9f1d8 100644 --- a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java +++ b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java @@ -350,7 +350,7 @@ public class UnbundledChooserActivityTest { mActivityRule.launchActivity(Intent.createChooser(sendIntent, "chooser test")); waitForIdle(); onView(withId(android.R.id.title)) - .check(matches(withText(com.android.internal.R.string.whichSendApplication))); + .check(matches(withText(R.string.whichSendApplication))); } @Test @@ -362,7 +362,7 @@ public class UnbundledChooserActivityTest { mActivityRule.launchActivity(Intent.createChooser(sendIntent, null)); waitForIdle(); onView(withId(android.R.id.title)) - .check(matches(withText(com.android.internal.R.string.whichSendApplication))); + .check(matches(withText(R.string.whichSendApplication))); } @Test diff --git a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java index 87dc1b9d..6c1edfbc 100644 --- a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java +++ b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java @@ -49,7 +49,6 @@ import androidx.test.espresso.NoMatchingViewException; import androidx.test.rule.ActivityTestRule; import com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.Tab; -import com.android.internal.R; import junit.framework.AssertionFailedError; @@ -356,7 +355,7 @@ public class UnbundledChooserActivityWorkProfileTest { } }); - onView(withId(R.id.contentPanel)) + onView(withId(com.android.internal.R.id.contentPanel)) .perform(swipeUp()); waitForIdle(); } |