diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-06-15 11:00:17 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-06-15 11:00:17 -0700 |
commit | e458832c765ed5c3de836384338c7626c80b5686 (patch) | |
tree | 4de269811031098ba8e1a3536be7e3ada0bce5d7 | |
parent | 5ea994c552ea72385022c0c81b8b69acbe30a113 (diff) | |
download | packages_apps_settings-e458832c765ed5c3de836384338c7626c80b5686.zip packages_apps_settings-e458832c765ed5c3de836384338c7626c80b5686.tar.gz packages_apps_settings-e458832c765ed5c3de836384338c7626c80b5686.tar.bz2 |
Implement issue #6633077: Improve permissions display for...
...inherited permissions from shared UIDs
Bug: 6633077
Change-Id: I91917339e83b79a3dfcfcb70a68d571c9a7f7e14
-rw-r--r-- | res/layout/installed_app_details.xml | 2 | ||||
-rw-r--r-- | res/values/strings.xml | 22 | ||||
-rw-r--r-- | src/com/android/settings/applications/InstalledAppDetails.java | 43 |
3 files changed, 64 insertions, 3 deletions
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml index f623d04..d69f98a 100644 --- a/res/layout/installed_app_details.xml +++ b/res/layout/installed_app_details.xml @@ -393,7 +393,7 @@ style="?android:attr/listSeparatorTextViewStyle" android:layout_marginTop="8dip" android:text="@string/permissions_label" /> - <TextView + <TextView android:id="@+id/security_settings_desc" android:text="@string/security_settings_desc" android:textAppearance="?android:attr/textAppearanceSmall" android:paddingTop="6dip" diff --git a/res/values/strings.xml b/res/values/strings.xml index 80a2415..00ed06b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2495,6 +2495,28 @@ <string name="security_settings_desc" product="tablet">This app can access the following on your tablet:</string> <!-- Manage applications, individual application info screen, text that appears under the "Permissions" heading. This describes the permissions that the application has. --> <string name="security_settings_desc" product="default">This app can access the following on your phone:</string> + <!-- [CHAR_LIMIT=NONE] Manage applications, individual application info screen, text that appears under the "Permissions" heading. + This describes the permissions that the application has. It is used when multiple packages are contributing + to the permissions and need to be listed here. --> + <string name="security_settings_desc_multi" product="tablet">This app can access the following on your tablet. + In order to improve performance and reduce memory usage, some of these permissions + are available to <xliff:g id="base_app_name">%1$s</xliff:g> + because it runs in the same process as <xliff:g id="additional_apps_list">%2$s</xliff:g>:</string> + <!-- [CHAR_LIMIT=NONE] Manage applications, individual application info screen, text that appears under the "Permissions" heading. + This describes the permissions that the application has. It is used when multiple packages are contributing + to the permissions and need to be listed here. --> + <string name="security_settings_desc_multi" product="default">This app can access the following on your phone. + In order to improve performance and reduce memory usage, some of these permissions + are available to <xliff:g id="base_app_name">%1$s</xliff:g> + because it runs in the same process as <xliff:g id="additional_apps_list">%2$s</xliff:g>:</string> + <!-- [CHAR_LIMIT=NONE] Format to put together two items in a list. --> + <string name="join_two_items"><xliff:g id="first_item">%1$s</xliff:g> and <xliff:g id="second_item">%2$s</xliff:g></string> + <!-- [CHAR_LIMIT=NONE] Format to put the last item at the end of a series of 3 or more items in a list --> + <string name="join_many_items_last"><xliff:g id="all_but_last_item">%1$s</xliff:g> and <xliff:g id="last_item">%2$s</xliff:g></string> + <!-- [CHAR_LIMIT=NONE] Format to put the first item at the start of a series of 3 or more items in a list --> + <string name="join_many_items_first"><xliff:g id="first_item">%1$s</xliff:g>, <xliff:g id="all_but_first_and_last_item">%2$s</xliff:g></string> + <!-- [CHAR_LIMIT=NONE] Format to put the middle items together in a series of 4 or more items in a list --> + <string name="join_many_items_middle"><xliff:g id="added_item">%1$s</xliff:g>, <xliff:g id="rest_of_items">%2$s</xliff:g></string> <string name="computing_size">Computing\u2026</string> <string name="invalid_size_value">Couldn\'t compute package size.</string> <!-- String displayed when list is empty --> diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index c2e358c..9166b15 100644 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -27,7 +27,6 @@ import android.app.Dialog; import android.app.DialogFragment; import android.app.Fragment; import android.app.INotificationManager; -import android.app.NotificationManager; import android.app.admin.DevicePolicyManager; import android.appwidget.AppWidgetManager; import android.content.BroadcastReceiver; @@ -43,6 +42,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; import android.hardware.usb.IUsbManager; import android.net.Uri; import android.os.AsyncTask; @@ -72,7 +72,6 @@ import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.Switch; import android.widget.TextView; /** @@ -595,6 +594,46 @@ public class InstalledAppDetails extends Fragment R.id.security_settings_list); securityList.removeAllViews(); securityList.addView(asp.getPermissionsView()); + // If this app is running under a shared user ID with other apps, + // update the description to explain this. + String[] packages = mPm.getPackagesForUid(mPackageInfo.applicationInfo.uid); + if (packages != null && packages.length > 1) { + ArrayList<CharSequence> pnames = new ArrayList<CharSequence>(); + for (int i=0; i<packages.length; i++) { + String pkg = packages[i]; + if (mPackageInfo.packageName.equals(pkg)) { + continue; + } + try { + ApplicationInfo ainfo = mPm.getApplicationInfo(pkg, 0); + pnames.add(ainfo.loadLabel(mPm)); + } catch (PackageManager.NameNotFoundException e) { + } + } + final int N = pnames.size(); + if (N > 0) { + final Resources res = getActivity().getResources(); + String appListStr; + if (N == 1) { + appListStr = pnames.get(0).toString(); + } else if (N == 2) { + appListStr = res.getString(R.string.join_two_items, pnames.get(0), + pnames.get(1)); + } else { + appListStr = pnames.get(N-2).toString(); + for (int i=N-3; i>=0; i--) { + appListStr = res.getString(i == 0 ? R.string.join_many_items_first + : R.string.join_many_items_middle, pnames.get(i), appListStr); + } + appListStr = res.getString(R.string.join_many_items_last, + appListStr, pnames.get(N-1)); + } + TextView descr = (TextView) mRootView.findViewById( + R.id.security_settings_desc); + descr.setText(res.getString(R.string.security_settings_desc_multi, + mPackageInfo.applicationInfo.loadLabel(mPm), appListStr)); + } + } } else { permsView.setVisibility(View.GONE); } |