summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip P. Moltmann <moltmann@google.com>2016-05-23 19:09:07 (GMT)
committerThe Android Automerger <android-build@google.com>2016-05-26 01:17:12 (GMT)
commita84b4365732931570e44b373081e484ec26db637 (patch)
tree0ac212d488b4d782d6d5ab98aa8b3610cd69cc09
parent1014fb38d7480b7fd07b3ccc20504a09d1c38fdf (diff)
downloadandroid_packages_apps_PackageInstaller-a84b4365732931570e44b373081e484ec26db637.zip
android_packages_apps_PackageInstaller-a84b4365732931570e44b373081e484ec26db637.tar.gz
android_packages_apps_PackageInstaller-a84b4365732931570e44b373081e484ec26db637.tar.bz2
Format the template using HTML tags.
Manual formatting is to complicated to do. Fixes: 28852429 Change-Id: Ibab723b82a2b14ad94a3038dffccc96f86ba8ee4
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java15
2 files changed, 5 insertions, 12 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a58c5e5..12ad5f1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -172,7 +172,7 @@
<!-- Template for the warning message when an app requests a permission. -->
<string name="permission_warning_template">Allow
- <xliff:g id="app_name" example="Gmail">%1$s</xliff:g> to
+ &lt;b><xliff:g id="app_name" example="Gmail">%1$s</xliff:g>&lt;/b> to
<xliff:g id="action" example="do something">%2$s</xliff:g>?</string>
<!-- Permissions -->
diff --git a/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java b/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java
index 787f153..4ee76a1 100644
--- a/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java
+++ b/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java
@@ -27,13 +27,12 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PermissionInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.Typeface;
import android.graphics.drawable.Icon;
import android.hardware.camera2.utils.ArrayUtils;
import android.os.Build;
import android.os.Bundle;
-import android.text.SpannableString;
-import android.text.style.StyleSpan;
+import android.text.Html;
+import android.text.Spanned;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -231,16 +230,10 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
for (GroupState groupState : mRequestGrantPermissionGroups.values()) {
if (groupState.mState == GroupState.STATE_UNKNOWN) {
CharSequence appLabel = mAppPermissions.getAppLabel();
- SpannableString message = new SpannableString(getString(
- R.string.permission_warning_template, appLabel,
- groupState.mGroup.getDescription()));
+ Spanned message = Html.fromHtml(getString(R.string.permission_warning_template,
+ appLabel, groupState.mGroup.getDescription()), 0);
// Set the permission message as the title so it can be announced.
setTitle(message);
- // Color the app name.
- int appLabelStart = message.toString().indexOf(" " + appLabel.toString() + " ", 0);
- int appLabelLength = appLabel.length() + 1;
- message.setSpan(new StyleSpan(Typeface.BOLD), appLabelStart,
- appLabelStart + appLabelLength, 0);
// Set the new grant view
// TODO: Use a real message for the action. We need group action APIs