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

Commit 256e51d3 authored by Svetoslav's avatar Svetoslav Committed by Android (Google) Code Review
Browse files

Merge "Ignore print service settings activities if they are not exported." into klp-dev

parents 2d29fad1 17e72aa9
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -3419,9 +3419,8 @@
         <xliff:g id="service" example="My Print Service">%1$s</xliff:g>?</string>
    <!-- Summary for a warning message about security implications of enabling a print service,
         displayed as a dialog message when the user selects to enable a print service. [CHAR LIMIT=NONE] -->
    <string name="print_service_security_warning_summary">
         <xliff:g id="print_service_name">%1$s</xliff:g> can receive documents you print.
         Such documents may contain sensitive data.</string>
    <string name="print_service_security_warning_summary">Your document may pass through
        one or more servers on its way to the printer.</string>

    <!-- Title for the prompt shown as a placeholder if no print serivices are installed. [CHAR LIMIT=50] -->
    <string name="print_no_services_installed">No services installed</string>
@@ -3446,8 +3445,14 @@
    <!-- Title for the search action bar menu item. [CHAR LIMIT=20] -->
    <string name="print_menu_item_search">Search</string>

    <!-- Title for the printer categoty showing a list of available printers. [CHAR LIMIT=25] -->
    <string name="category_printers">Printers</string>
    <!-- Title for the prompt if no printers are available and the system is searching for such. [CHAR LIMIT=50] -->
    <string name="print_searching_for_printers">Searching for printers</string>

    <!-- Title for the menu item to open the print jobs screen. [CHAR LIMIT=25] -->
    <string name="print_print_jobs">Print jobs</string>

    <!-- Title for the print jobs screen. [CHAR LIMIT=25] -->
    <string name="print_active_print_jobs">Active print jobs</string>

    <!-- App Fuel Gauge strings -->
    <skip />
+10 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
@@ -41,6 +42,7 @@ import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
import android.util.Log;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
@@ -66,6 +68,8 @@ import java.util.Set;
 */
public class AccessibilitySettings extends SettingsPreferenceFragment implements DialogCreatable,
        Preference.OnPreferenceChangeListener {
    private static final String LOG_TAG = "AccessibilitySettings";

    private static final String DEFAULT_SCREENREADER_MARKET_LINK =
            "market://search?q=pname:com.google.android.marvin.talkback";

@@ -605,7 +609,12 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
                                        Uri marketUri = Uri.parse(screenreaderMarketLink);
                                        Intent marketIntent = new Intent(Intent.ACTION_VIEW,
                                                marketUri);
                                        try {
                                            startActivity(marketIntent);
                                        } catch (ActivityNotFoundException anfe) {
                                            Log.w(LOG_TAG, "Couldn't start play store activity",
                                                    anfe);
                                        }
                                    }
                                })
                        .setNegativeButton(android.R.string.cancel, null)
+19 −6
Original line number Diff line number Diff line
@@ -27,7 +27,10 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Loader;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.database.ContentObserver;
import android.database.DataSetObserver;
@@ -275,11 +278,16 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment
        if (!TextUtils.isEmpty(settingsTitle) && !TextUtils.isEmpty(settingsComponentName)) {
            Intent settingsIntent = new Intent(Intent.ACTION_MAIN).setComponent(
                    ComponentName.unflattenFromString(settingsComponentName.toString()));
            if (!getPackageManager().queryIntentActivities(settingsIntent, 0).isEmpty()) {
            List<ResolveInfo> resolvedActivities = getPackageManager().queryIntentActivities(
                    settingsIntent, 0);
            if (!resolvedActivities.isEmpty()) {
                // The activity is a component name, therefore it is one or none.
                if (resolvedActivities.get(0).activityInfo.exported) {
                    mSettingsTitle = settingsTitle;
                    mSettingsIntent = settingsIntent;
                }
            }
        }

        // Add printers title and intent.
        String addPrintersTitle = arguments.getString(
@@ -290,11 +298,16 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment
                && !TextUtils.isEmpty(addPrintersComponentName)) {
            Intent addPritnersIntent = new Intent(Intent.ACTION_MAIN).setComponent(
                    ComponentName.unflattenFromString(addPrintersComponentName.toString()));
            if (!getPackageManager().queryIntentActivities(addPritnersIntent, 0).isEmpty()) {
            List<ResolveInfo> resolvedActivities = getPackageManager().queryIntentActivities(
                    addPritnersIntent, 0);
            if (!resolvedActivities.isEmpty()) {
                // The activity is a component name, therefore it is one or none.
                if (resolvedActivities.get(0).activityInfo.exported) {
                    mAddPrintersTitle = addPrintersTitle;
                    mAddPrintersIntent = addPritnersIntent;
                }
            }
        }

        // Enable warning title.
        mEnableWarningTitle = arguments.getCharSequence(