Ignore print service settings activities if they are not exported.
1. The print spooler cannot start not exported activities and they
should not be started from another application anyway. Therefore,
we do not start them from settings too even though settings can
do that since it is signed with the platform certificate.
2. Adding some string changes to meet the translation deadline.
bug:10680224
Change-Id: I69c189e1c502985aceb68d269492f2e86de44ec4
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4b3e261..c49fe2f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3410,9 +3410,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>
@@ -3437,8 +3436,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 />
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 5834f99..4d24d09 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -20,6 +20,7 @@
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.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 @@
*/
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 @@
Uri marketUri = Uri.parse(screenreaderMarketLink);
Intent marketIntent = new Intent(Intent.ACTION_VIEW,
marketUri);
- startActivity(marketIntent);
+ try {
+ startActivity(marketIntent);
+ } catch (ActivityNotFoundException anfe) {
+ Log.w(LOG_TAG, "Couldn't start play store activity",
+ anfe);
+ }
}
})
.setNegativeButton(android.R.string.cancel, null)
diff --git a/src/com/android/settings/print/PrintServiceSettingsFragment.java b/src/com/android/settings/print/PrintServiceSettingsFragment.java
index 8dae1f0..87db29b 100644
--- a/src/com/android/settings/print/PrintServiceSettingsFragment.java
+++ b/src/com/android/settings/print/PrintServiceSettingsFragment.java
@@ -27,7 +27,10 @@
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,9 +278,14 @@
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()) {
- mSettingsTitle = settingsTitle;
- mSettingsIntent = settingsIntent;
+ 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;
+ }
}
}
@@ -290,9 +298,14 @@
&& !TextUtils.isEmpty(addPrintersComponentName)) {
Intent addPritnersIntent = new Intent(Intent.ACTION_MAIN).setComponent(
ComponentName.unflattenFromString(addPrintersComponentName.toString()));
- if (!getPackageManager().queryIntentActivities(addPritnersIntent, 0).isEmpty()) {
- mAddPrintersTitle = addPrintersTitle;
- mAddPrintersIntent = addPritnersIntent;
+ 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;
+ }
}
}