diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-06-15 17:53:40 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-15 17:53:40 -0700 |
commit | 4d8dac0792ec7994f9f4cbf2648cf8f3185876ca (patch) | |
tree | 042339ec762cc126ac25457b6fd91e7d306c20bd /src/com/android | |
parent | ed99a81e1595c25d7070866ee0c2aa1d94103955 (diff) | |
parent | e458832c765ed5c3de836384338c7626c80b5686 (diff) | |
download | packages_apps_settings-4d8dac0792ec7994f9f4cbf2648cf8f3185876ca.zip packages_apps_settings-4d8dac0792ec7994f9f4cbf2648cf8f3185876ca.tar.gz packages_apps_settings-4d8dac0792ec7994f9f4cbf2648cf8f3185876ca.tar.bz2 |
Merge "Implement issue #6633077: Improve permissions display for..." into jb-dev
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/applications/InstalledAppDetails.java | 43 |
1 files changed, 41 insertions, 2 deletions
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); } |