diff options
| author | 2020-03-06 13:48:02 +0000 | |
|---|---|---|
| committer | 2020-03-06 13:48:02 +0000 | |
| commit | ac8a5397bcd5e00479fdcef04de904ec01d428be (patch) | |
| tree | 6f9ca595a477ce9f945e54a330194dd4c6aece29 | |
| parent | 4cf6815168662d2766a0a9ecf9e2947eebbd156b (diff) | |
| parent | 78fd360cf6e7500806634a9f7f5ab6999b815043 (diff) | |
Merge "Update strings related to intent resolver and share sheet." into rvc-dev
8 files changed, 120 insertions, 39 deletions
diff --git a/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java b/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java index bcf731d993df..18d77386d063 100644 --- a/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java +++ b/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java @@ -299,11 +299,8 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED) .setStrings(getMetricsCategory()) .write(); - showEmptyState(activeListAdapter, - R.drawable.ic_work_apps_off, - R.string.resolver_turn_on_work_apps, - R.string.resolver_turn_on_work_apps_explanation, - (View.OnClickListener) v -> { + showWorkProfileOffEmptyState(activeListAdapter, + v -> { ProfileDescriptor descriptor = getItem( userHandleToPageIndex(activeListAdapter.getUserHandle())); showSpinner(descriptor.getEmptyStateView()); @@ -319,19 +316,13 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL) .setStrings(getMetricsCategory()) .write(); - showEmptyState(activeListAdapter, - R.drawable.ic_sharing_disabled, - R.string.resolver_cant_share_with_personal_apps, - R.string.resolver_cant_share_cross_profile_explanation); + showNoWorkToPersonalIntentsEmptyState(activeListAdapter); } else { DevicePolicyEventLogger.createEvent( DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_WORK) .setStrings(getMetricsCategory()) .write(); - showEmptyState(activeListAdapter, - R.drawable.ic_sharing_disabled, - R.string.resolver_cant_share_with_work_apps, - R.string.resolver_cant_share_cross_profile_explanation); + showNoPersonalToWorkIntentsEmptyState(activeListAdapter); } return false; } @@ -340,6 +331,15 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { return activeListAdapter.rebuildList(doPostProcessing); } + protected abstract void showWorkProfileOffEmptyState( + ResolverListAdapter activeListAdapter, View.OnClickListener listener); + + protected abstract void showNoPersonalToWorkIntentsEmptyState( + ResolverListAdapter activeListAdapter); + + protected abstract void showNoWorkToPersonalIntentsEmptyState( + ResolverListAdapter activeListAdapter); + void showEmptyState(ResolverListAdapter listAdapter) { UserHandle listUserHandle = listAdapter.getUserHandle(); if (UserHandle.myUserId() == listUserHandle.getIdentifier() @@ -353,16 +353,16 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { showEmptyState(listAdapter, R.drawable.ic_no_apps, R.string.resolver_no_apps_available, - R.string.resolver_no_apps_available_explanation); + /* subtitleRes */ 0); } } - private void showEmptyState(ResolverListAdapter activeListAdapter, + protected void showEmptyState(ResolverListAdapter activeListAdapter, @DrawableRes int iconRes, @StringRes int titleRes, @StringRes int subtitleRes) { showEmptyState(activeListAdapter, iconRes, titleRes, subtitleRes, /* buttonOnClick */ null); } - private void showEmptyState(ResolverListAdapter activeListAdapter, + protected void showEmptyState(ResolverListAdapter activeListAdapter, @DrawableRes int iconRes, @StringRes int titleRes, @StringRes int subtitleRes, View.OnClickListener buttonOnClick) { ProfileDescriptor descriptor = getItem( @@ -379,7 +379,12 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { title.setText(titleRes); TextView subtitle = emptyStateView.findViewById(R.id.resolver_empty_state_subtitle); - subtitle.setText(subtitleRes); + if (subtitleRes != 0) { + subtitle.setVisibility(View.VISIBLE); + subtitle.setText(subtitleRes); + } else { + subtitle.setVisibility(View.GONE); + } Button button = emptyStateView.findViewById(R.id.resolver_empty_state_button); button.setVisibility(buttonOnClick != null ? View.VISIBLE : View.GONE); diff --git a/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java b/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java index b39d42ec1e96..2167b1ebd473 100644 --- a/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java +++ b/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java @@ -20,6 +20,7 @@ import android.annotation.Nullable; import android.content.Context; import android.os.UserHandle; import android.view.LayoutInflater; +import android.view.View; import android.view.ViewGroup; import com.android.internal.R; @@ -169,6 +170,32 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd return ResolverActivity.METRICS_CATEGORY_CHOOSER; } + @Override + protected void showWorkProfileOffEmptyState(ResolverListAdapter activeListAdapter, + View.OnClickListener listener) { + showEmptyState(activeListAdapter, + R.drawable.ic_work_apps_off, + R.string.resolver_turn_on_work_apps_share, + /* subtitleRes */ 0, + listener); + } + + @Override + protected void showNoPersonalToWorkIntentsEmptyState(ResolverListAdapter activeListAdapter) { + showEmptyState(activeListAdapter, + R.drawable.ic_sharing_disabled, + R.string.resolver_cant_share_with_work_apps, + R.string.resolver_cant_share_cross_profile_explanation); + } + + @Override + protected void showNoWorkToPersonalIntentsEmptyState(ResolverListAdapter activeListAdapter) { + showEmptyState(activeListAdapter, + R.drawable.ic_sharing_disabled, + R.string.resolver_cant_share_with_personal_apps, + R.string.resolver_cant_share_cross_profile_explanation); + } + class ChooserProfileDescriptor extends ProfileDescriptor { private ChooserActivity.ChooserGridAdapter chooserGridAdapter; private RecyclerView recyclerView; diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 6ab61850480d..bd7b47d853d2 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -1595,9 +1595,17 @@ public class ResolverActivity extends Activity implements } private void resetTabsHeaderStyle(TabWidget tabWidget) { + String workContentDescription = getString(R.string.resolver_work_tab_accessibility); + String personalContentDescription = getString(R.string.resolver_personal_tab_accessibility); for (int i = 0; i < tabWidget.getChildCount(); i++) { - TextView title = tabWidget.getChildAt(i).findViewById(android.R.id.title); + View tabView = tabWidget.getChildAt(i); + TextView title = tabView.findViewById(android.R.id.title); title.setTextColor(getColor(R.color.resolver_tabs_inactive_color)); + if (title.getText().equals(getString(R.string.resolver_personal_tab))) { + tabView.setContentDescription(personalContentDescription); + } else if (title.getText().equals(getString(R.string.resolver_work_tab))) { + tabView.setContentDescription(workContentDescription); + } } } diff --git a/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java b/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java index f6382d397d6f..0440f5e92ce4 100644 --- a/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java +++ b/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java @@ -20,6 +20,7 @@ import android.annotation.Nullable; import android.content.Context; import android.os.UserHandle; import android.view.LayoutInflater; +import android.view.View; import android.view.ViewGroup; import android.widget.ListView; @@ -161,6 +162,32 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA return ResolverActivity.METRICS_CATEGORY_RESOLVER; } + @Override + protected void showWorkProfileOffEmptyState(ResolverListAdapter activeListAdapter, + View.OnClickListener listener) { + showEmptyState(activeListAdapter, + R.drawable.ic_work_apps_off, + R.string.resolver_turn_on_work_apps_view, + /* subtitleRes */ 0, + listener); + } + + @Override + protected void showNoPersonalToWorkIntentsEmptyState(ResolverListAdapter activeListAdapter) { + showEmptyState(activeListAdapter, + R.drawable.ic_sharing_disabled, + R.string.resolver_cant_access_work_apps, + R.string.resolver_cant_access_work_apps_explanation); + } + + @Override + protected void showNoWorkToPersonalIntentsEmptyState(ResolverListAdapter activeListAdapter) { + showEmptyState(activeListAdapter, + R.drawable.ic_sharing_disabled, + R.string.resolver_cant_access_personal_apps, + R.string.resolver_cant_access_personal_apps_explanation); + } + class ResolverProfileDescriptor extends ProfileDescriptor { private ResolverListAdapter resolverListAdapter; final ListView listView; diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 2356b1737acd..addcd81ae5c8 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5385,26 +5385,36 @@ <xliff:g id="package_name" example="com.android.example">%1$s</xliff:g> has been put into the RESTRICTED bucket</string> <!-- ResolverActivity - profile tabs --> - <!-- Label for the perosnal tab of the share sheet and intent resolver [CHAR LIMIT=NONE] --> + <!-- Label of a tab on a screen. A user can tap this tap to switch to the 'Personal' view (that shows their personal content) if they have a work profile on their device. [CHAR LIMIT=NONE] --> <string name="resolver_personal_tab">Personal</string> - <!-- Label for the work tab of the share sheet and intent resolver [CHAR LIMIT=NONE] --> + <!-- Label of a tab on a screen. A user can tap this tab to switch to the 'Work' view (that shows their work content) if they have a work profile on their device. [CHAR LIMIT=NONE] --> <string name="resolver_work_tab">Work</string> - <!-- Label to indicate that the user cannot share with work apps [CHAR LIMIT=NONE] --> + <!-- Accessibility label for the personal tab button. [CHAR LIMIT=NONE] --> + <string name="resolver_personal_tab_accessibility">Personal view</string> + <!-- Accessibility label for the work tab button. [CHAR LIMIT=NONE] --> + <string name="resolver_work_tab_accessibility">Work view</string> + <!-- Title of a screen. This text lets the user know that their IT admin doesn't allow them to share personal content with work apps. [CHAR LIMIT=NONE] --> <string name="resolver_cant_share_with_work_apps">Can\u2019t share with work apps</string> - <!-- Label to indicate that the user cannot share with personal apps [CHAR LIMIT=NONE] --> + <!-- Title of a screen. This text lets the user know that their IT admin doesn't allow them to share work content with personal apps. [CHAR LIMIT=NONE] --> <string name="resolver_cant_share_with_personal_apps">Can\u2019t share with personal apps</string> - <!-- Label to explain to the user that sharing between personal and work apps is not enabled by the IT admin [CHAR LIMIT=NONE] --> - <string name="resolver_cant_share_cross_profile_explanation">Your IT admin blocked sharing between personal and work apps</string> - <!-- Label to indicate that the user has to turn on work apps in order to access work data [CHAR LIMIT=NONE] --> - <string name="resolver_turn_on_work_apps">Turn on work apps</string> - <!-- Label to explain that the user has to turn on work apps in order to access work data [CHAR LIMIT=NONE] --> - <string name="resolver_turn_on_work_apps_explanation">Turn on work apps to access work apps & contacts</string> - <!-- Label to indicate that no apps are resolved [CHAR LIMIT=NONE] --> + <!-- Error message. This text is explaining that the user's IT admin doesn't allow sharing between personal and work apps. [CHAR LIMIT=NONE] --> + <string name="resolver_cant_share_cross_profile_explanation">Your IT admin blocked sharing between personal and work profiles</string> + <!-- Title of an error screen. This error message lets the user know that their IT admin blocked access to work apps, and the personal content that they're trying to view in a work app, such as Chrome, isn't allowed. [CHAR LIMIT=NONE] --> + <string name="resolver_cant_access_work_apps">Can\u2019t access work apps</string> + <!-- Error message. This message lets the user know that their IT admin blocked access to work apps, and the personal content that they're trying to view in a work app, such as Chrome, isn't allowed. [CHAR LIMIT=NONE] --> + <string name="resolver_cant_access_work_apps_explanation">Your IT admin doesn\u2019t let you view personal content in work apps</string> + <!-- Title of an error screen. This error message lets the user know that their IT admin blocked access to personal apps, and the work content that they're trying to view in a personal app, such as Chrome, isn't allowed. [CHAR LIMIT=NONE] --> + <string name="resolver_cant_access_personal_apps">Can\u2019t access personal apps</string> + <!-- Error message. This message lets the user know that their IT admin blocked access to personal apps, and the work content that they're trying to view in a personal app, such as Chrome, isn't allowed. [CHAR LIMIT=NONE] --> + <string name="resolver_cant_access_personal_apps_explanation">Your IT admin doesn\u2019t let you view work content in personal apps</string> + <!-- Error message. This text lets the user know that they need to turn on work apps in order to share content. There's also a button a user can tap to turn on the apps. [CHAR LIMIT=NONE] --> + <string name="resolver_turn_on_work_apps_share">Turn on work profile to share content</string> + <!-- Error message. This text lets the user know that they need to turn on work apps in order to view content. There's also a button a user can tap to turn on the apps. [CHAR LIMIT=NONE] --> + <string name="resolver_turn_on_work_apps_view">Turn on work profile to view content</string> + <!-- Error message. This text lets the user know that work apps aren't available on the device. [CHAR LIMIT=NONE] --> <string name="resolver_no_apps_available">No apps available</string> - <!-- Label to explain that no apps are resolved [CHAR LIMIT=NONE] --> - <string name="resolver_no_apps_available_explanation">We couldn\u2019t find any apps</string> - <!-- Button which switches on the disabled work profile [CHAR LIMIT=NONE] --> - <string name="resolver_switch_on_work">Switch on work</string> + <!-- Button text. This button turns on a user's work profile so they can access their work apps and data. [CHAR LIMIT=NONE] --> + <string name="resolver_switch_on_work">Turn on</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE] --> <string name="permlab_accessCallAudio">Record or play audio in telephony calls</string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index c1d8168e6287..0971aadfe4ab 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3874,7 +3874,9 @@ <java-symbol type="color" name="resolver_tabs_active_color" /> <java-symbol type="color" name="resolver_tabs_inactive_color" /> <java-symbol type="string" name="resolver_personal_tab" /> + <java-symbol type="string" name="resolver_personal_tab_accessibility" /> <java-symbol type="string" name="resolver_work_tab" /> + <java-symbol type="string" name="resolver_work_tab_accessibility" /> <java-symbol type="id" name="stub" /> <java-symbol type="id" name="resolver_empty_state" /> <java-symbol type="id" name="resolver_empty_state_icon" /> @@ -3886,11 +3888,13 @@ <java-symbol type="string" name="resolver_cant_share_with_work_apps" /> <java-symbol type="string" name="resolver_cant_share_with_personal_apps" /> <java-symbol type="string" name="resolver_cant_share_cross_profile_explanation" /> - <java-symbol type="string" name="resolver_turn_on_work_apps" /> - <java-symbol type="string" name="resolver_turn_on_work_apps_explanation" /> + <java-symbol type="string" name="resolver_cant_access_work_apps" /> + <java-symbol type="string" name="resolver_cant_access_work_apps_explanation" /> + <java-symbol type="string" name="resolver_cant_access_personal_apps" /> + <java-symbol type="string" name="resolver_cant_access_personal_apps_explanation" /> + <java-symbol type="string" name="resolver_turn_on_work_apps_view" /> + <java-symbol type="string" name="resolver_turn_on_work_apps_share" /> <java-symbol type="string" name="resolver_no_apps_available" /> - <java-symbol type="string" name="resolver_no_apps_available_explanation" /> - <java-symbol type="string" name="resolver_no_apps_available_explanation" /> <java-symbol type="string" name="resolver_switch_on_work" /> <java-symbol type="drawable" name="ic_work_apps_off" /> <java-symbol type="drawable" name="ic_sharing_disabled" /> diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java index 6d0e58bc89be..24e96d4b8463 100644 --- a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java +++ b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java @@ -1340,7 +1340,7 @@ public class ChooserActivityTest { onView(withText(R.string.resolver_work_tab)).perform(click()); waitForIdle(); - onView(withText(R.string.resolver_turn_on_work_apps)) + onView(withText(R.string.resolver_turn_on_work_apps_share)) .check(matches(isDisplayed())); } diff --git a/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java index a7bf48858e42..9d1ca615e54b 100644 --- a/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java +++ b/core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java @@ -624,7 +624,7 @@ public class ResolverActivityTest { onView(withText(R.string.resolver_work_tab)).perform(click()); waitForIdle(); - onView(withText(R.string.resolver_turn_on_work_apps)) + onView(withText(R.string.resolver_turn_on_work_apps_view)) .check(matches(isDisplayed())); } |