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

Commit ac8a5397 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update strings related to intent resolver and share sheet." into rvc-dev

parents 4cf68151 78fd360c
Loading
Loading
Loading
Loading
+22 −17
Original line number Original line Diff line number Diff line
@@ -299,11 +299,8 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
                    .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED)
                    .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED)
                    .setStrings(getMetricsCategory())
                    .setStrings(getMetricsCategory())
                    .write();
                    .write();
            showEmptyState(activeListAdapter,
            showWorkProfileOffEmptyState(activeListAdapter,
                    R.drawable.ic_work_apps_off,
                    v -> {
                    R.string.resolver_turn_on_work_apps,
                    R.string.resolver_turn_on_work_apps_explanation,
                    (View.OnClickListener) v -> {
                        ProfileDescriptor descriptor = getItem(
                        ProfileDescriptor descriptor = getItem(
                                userHandleToPageIndex(activeListAdapter.getUserHandle()));
                                userHandleToPageIndex(activeListAdapter.getUserHandle()));
                        showSpinner(descriptor.getEmptyStateView());
                        showSpinner(descriptor.getEmptyStateView());
@@ -319,19 +316,13 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
                                DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL)
                                DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL)
                            .setStrings(getMetricsCategory())
                            .setStrings(getMetricsCategory())
                            .write();
                            .write();
                    showEmptyState(activeListAdapter,
                    showNoWorkToPersonalIntentsEmptyState(activeListAdapter);
                            R.drawable.ic_sharing_disabled,
                            R.string.resolver_cant_share_with_personal_apps,
                            R.string.resolver_cant_share_cross_profile_explanation);
                } else {
                } else {
                    DevicePolicyEventLogger.createEvent(
                    DevicePolicyEventLogger.createEvent(
                            DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_WORK)
                            DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_WORK)
                            .setStrings(getMetricsCategory())
                            .setStrings(getMetricsCategory())
                            .write();
                            .write();
                    showEmptyState(activeListAdapter,
                    showNoPersonalToWorkIntentsEmptyState(activeListAdapter);
                            R.drawable.ic_sharing_disabled,
                            R.string.resolver_cant_share_with_work_apps,
                            R.string.resolver_cant_share_cross_profile_explanation);
                }
                }
                return false;
                return false;
            }
            }
@@ -340,6 +331,15 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
        return activeListAdapter.rebuildList(doPostProcessing);
        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) {
    void showEmptyState(ResolverListAdapter listAdapter) {
        UserHandle listUserHandle = listAdapter.getUserHandle();
        UserHandle listUserHandle = listAdapter.getUserHandle();
        if (UserHandle.myUserId() == listUserHandle.getIdentifier()
        if (UserHandle.myUserId() == listUserHandle.getIdentifier()
@@ -353,16 +353,16 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
            showEmptyState(listAdapter,
            showEmptyState(listAdapter,
                    R.drawable.ic_no_apps,
                    R.drawable.ic_no_apps,
                    R.string.resolver_no_apps_available,
                    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) {
            @DrawableRes int iconRes, @StringRes int titleRes, @StringRes int subtitleRes) {
        showEmptyState(activeListAdapter, iconRes, titleRes, subtitleRes, /* buttonOnClick */ null);
        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,
            @DrawableRes int iconRes, @StringRes int titleRes, @StringRes int subtitleRes,
            View.OnClickListener buttonOnClick) {
            View.OnClickListener buttonOnClick) {
        ProfileDescriptor descriptor = getItem(
        ProfileDescriptor descriptor = getItem(
@@ -379,7 +379,12 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
        title.setText(titleRes);
        title.setText(titleRes);


        TextView subtitle = emptyStateView.findViewById(R.id.resolver_empty_state_subtitle);
        TextView subtitle = emptyStateView.findViewById(R.id.resolver_empty_state_subtitle);
        if (subtitleRes != 0) {
            subtitle.setVisibility(View.VISIBLE);
            subtitle.setText(subtitleRes);
            subtitle.setText(subtitleRes);
        } else {
            subtitle.setVisibility(View.GONE);
        }


        Button button = emptyStateView.findViewById(R.id.resolver_empty_state_button);
        Button button = emptyStateView.findViewById(R.id.resolver_empty_state_button);
        button.setVisibility(buttonOnClick != null ? View.VISIBLE : View.GONE);
        button.setVisibility(buttonOnClick != null ? View.VISIBLE : View.GONE);
+27 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.content.Context;
import android.content.Context;
import android.os.UserHandle;
import android.os.UserHandle;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;


import com.android.internal.R;
import com.android.internal.R;
@@ -169,6 +170,32 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd
        return ResolverActivity.METRICS_CATEGORY_CHOOSER;
        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 {
    class ChooserProfileDescriptor extends ProfileDescriptor {
        private ChooserActivity.ChooserGridAdapter chooserGridAdapter;
        private ChooserActivity.ChooserGridAdapter chooserGridAdapter;
        private RecyclerView recyclerView;
        private RecyclerView recyclerView;
+9 −1
Original line number Original line Diff line number Diff line
@@ -1595,9 +1595,17 @@ public class ResolverActivity extends Activity implements
    }
    }


    private void resetTabsHeaderStyle(TabWidget tabWidget) {
    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++) {
        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));
            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);
            }
        }
        }
    }
    }


+27 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.content.Context;
import android.content.Context;
import android.os.UserHandle;
import android.os.UserHandle;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.ListView;


@@ -161,6 +162,32 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA
        return ResolverActivity.METRICS_CATEGORY_RESOLVER;
        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 {
    class ResolverProfileDescriptor extends ProfileDescriptor {
        private ResolverListAdapter resolverListAdapter;
        private ResolverListAdapter resolverListAdapter;
        final ListView listView;
        final ListView listView;
+25 −15
Original line number Original line Diff line number Diff line
@@ -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>
        <xliff:g id="package_name" example="com.android.example">%1$s</xliff:g> has been put into the RESTRICTED bucket</string>


    <!-- ResolverActivity - profile tabs -->
    <!-- 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>
    <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>
    <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>
    <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>
    <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] -->
    <!-- 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 apps</string>
    <string name="resolver_cant_share_cross_profile_explanation">Your IT admin blocked sharing between personal and work profiles</string>
    <!-- Label to indicate that the user has to turn on work apps in order to access work data [CHAR LIMIT=NONE] -->
    <!-- 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_turn_on_work_apps">Turn on work apps</string>
    <string name="resolver_cant_access_work_apps">Can\u2019t access work apps</string>
    <!-- Label to explain that the user has to turn on work apps in order to access work data [CHAR LIMIT=NONE] -->
    <!-- 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_turn_on_work_apps_explanation">Turn on work apps to access work apps &amp; contacts</string>
    <string name="resolver_cant_access_work_apps_explanation">Your IT admin doesn\u2019t let you view personal content in work apps</string>
    <!-- Label to indicate that no apps are resolved [CHAR LIMIT=NONE] -->
    <!-- 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>
    <string name="resolver_no_apps_available">No apps available</string>
    <!-- Label to explain that no apps are resolved [CHAR LIMIT=NONE] -->
    <!-- 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_no_apps_available_explanation">We couldn\u2019t find any apps</string>
    <string name="resolver_switch_on_work">Turn on</string>
    <!-- Button which switches on the disabled work profile [CHAR LIMIT=NONE] -->
    <string name="resolver_switch_on_work">Switch on work</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] -->
    <!-- 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>
    <string name="permlab_accessCallAudio">Record or play audio in telephony calls</string>
Loading