AppSecurityPermissions.java revision a5043ed7eac5dccf7ec58b9f7095fda3992951a4
1/*
2**
3** Copyright 2007, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9**     http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17package android.widget;
18
19import com.android.internal.R;
20
21import android.app.AlertDialog;
22import android.content.Context;
23import android.content.pm.ApplicationInfo;
24import android.content.pm.PackageInfo;
25import android.content.pm.PackageManager;
26import android.content.pm.PackageManager.NameNotFoundException;
27import android.content.pm.PermissionGroupInfo;
28import android.content.pm.PermissionInfo;
29import android.graphics.drawable.Drawable;
30import android.os.Parcel;
31import android.text.SpannableStringBuilder;
32import android.text.TextUtils;
33import android.util.AttributeSet;
34import android.util.Log;
35import android.view.LayoutInflater;
36import android.view.View;
37import android.view.ViewGroup;
38
39import java.text.Collator;
40import java.util.ArrayList;
41import java.util.Collections;
42import java.util.Comparator;
43import java.util.HashMap;
44import java.util.HashSet;
45import java.util.List;
46import java.util.Map;
47import java.util.Set;
48
49/**
50 * This class contains the SecurityPermissions view implementation.
51 * Initially the package's advanced or dangerous security permissions
52 * are displayed under categorized
53 * groups. Clicking on the additional permissions presents
54 * extended information consisting of all groups and permissions.
55 * To use this view define a LinearLayout or any ViewGroup and add this
56 * view by instantiating AppSecurityPermissions and invoking getPermissionsView.
57 *
58 * {@hide}
59 */
60public class AppSecurityPermissions {
61
62    public static final int WHICH_PERSONAL = 1<<0;
63    public static final int WHICH_DEVICE = 1<<1;
64    public static final int WHICH_NEW = 1<<2;
65    public static final int WHICH_ALL = 0xffff;
66
67    private final static String TAG = "AppSecurityPermissions";
68    private final static boolean localLOGV = false;
69    private final Context mContext;
70    private final LayoutInflater mInflater;
71    private final PackageManager mPm;
72    private final Map<String, MyPermissionGroupInfo> mPermGroups
73            = new HashMap<String, MyPermissionGroupInfo>();
74    private final List<MyPermissionGroupInfo> mPermGroupsList
75            = new ArrayList<MyPermissionGroupInfo>();
76    private final PermissionGroupInfoComparator mPermGroupComparator = new PermissionGroupInfoComparator();
77    private final PermissionInfoComparator mPermComparator = new PermissionInfoComparator();
78    private final List<MyPermissionInfo> mPermsList = new ArrayList<MyPermissionInfo>();
79    private final CharSequence mNewPermPrefix;
80
81    static class MyPermissionGroupInfo extends PermissionGroupInfo {
82        CharSequence mLabel;
83
84        final ArrayList<MyPermissionInfo> mNewPermissions = new ArrayList<MyPermissionInfo>();
85        final ArrayList<MyPermissionInfo> mPersonalPermissions = new ArrayList<MyPermissionInfo>();
86        final ArrayList<MyPermissionInfo> mDevicePermissions = new ArrayList<MyPermissionInfo>();
87        final ArrayList<MyPermissionInfo> mAllPermissions = new ArrayList<MyPermissionInfo>();
88
89        MyPermissionGroupInfo(PermissionInfo perm) {
90            name = perm.packageName;
91            packageName = perm.packageName;
92        }
93
94        MyPermissionGroupInfo(PermissionGroupInfo info) {
95            super(info);
96        }
97
98        public Drawable loadGroupIcon(PackageManager pm) {
99            if (icon != 0) {
100                return loadIcon(pm);
101            } else {
102                ApplicationInfo appInfo;
103                try {
104                    appInfo = pm.getApplicationInfo(packageName, 0);
105                    return appInfo.loadIcon(pm);
106                } catch (NameNotFoundException e) {
107                }
108            }
109            return null;
110        }
111    }
112
113    private static class MyPermissionInfo extends PermissionInfo {
114        CharSequence mLabel;
115
116        /**
117         * PackageInfo.requestedPermissionsFlags for the new package being installed.
118         */
119        int mNewReqFlags;
120
121        /**
122         * PackageInfo.requestedPermissionsFlags for the currently installed
123         * package, if it is installed.
124         */
125        int mExistingReqFlags;
126
127        /**
128         * True if this should be considered a new permission.
129         */
130        boolean mNew;
131
132        MyPermissionInfo(PermissionInfo info) {
133            super(info);
134        }
135    }
136
137    public static class PermissionItemView extends LinearLayout implements View.OnClickListener {
138        MyPermissionGroupInfo mGroup;
139        MyPermissionInfo mPerm;
140        AlertDialog mDialog;
141
142        public PermissionItemView(Context context, AttributeSet attrs) {
143            super(context, attrs);
144            setClickable(true);
145        }
146
147        public void setPermission(MyPermissionGroupInfo grp, MyPermissionInfo perm,
148                boolean first, CharSequence newPermPrefix) {
149            mGroup = grp;
150            mPerm = perm;
151
152            ImageView permGrpIcon = (ImageView) findViewById(R.id.perm_icon);
153            TextView permNameView = (TextView) findViewById(R.id.perm_name);
154
155            PackageManager pm = getContext().getPackageManager();
156            Drawable icon = null;
157            if (first) {
158                icon = grp.loadGroupIcon(pm);
159            }
160            CharSequence label = perm.mLabel;
161            if (perm.mNew && newPermPrefix != null) {
162                // If this is a new permission, format it appropriately.
163                SpannableStringBuilder builder = new SpannableStringBuilder();
164                Parcel parcel = Parcel.obtain();
165                TextUtils.writeToParcel(newPermPrefix, parcel, 0);
166                parcel.setDataPosition(0);
167                CharSequence newStr = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
168                parcel.recycle();
169                builder.append(newStr);
170                builder.append(label);
171                label = builder;
172            }
173
174            permGrpIcon.setImageDrawable(icon);
175            permNameView.setText(label);
176            setOnClickListener(this);
177            if (localLOGV) Log.i(TAG, "Made perm item " + perm.name
178                    + ": " + label + " in group " + grp.name);
179        }
180
181        @Override
182        public void onClick(View v) {
183            if (mGroup != null && mPerm != null) {
184                if (mDialog != null) {
185                    mDialog.dismiss();
186                }
187                PackageManager pm = getContext().getPackageManager();
188                AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
189                builder.setTitle(mGroup.mLabel);
190                if (mPerm.descriptionRes != 0) {
191                    builder.setMessage(mPerm.loadDescription(pm));
192                } else {
193                    CharSequence appName;
194                    try {
195                        ApplicationInfo app = pm.getApplicationInfo(mPerm.packageName, 0);
196                        appName = app.loadLabel(pm);
197                    } catch (NameNotFoundException e) {
198                        appName = mPerm.packageName;
199                    }
200                    StringBuilder sbuilder = new StringBuilder(128);
201                    sbuilder.append(getContext().getString(
202                            R.string.perms_description_app, appName));
203                    sbuilder.append("\n\n");
204                    sbuilder.append(mPerm.name);
205                    builder.setMessage(sbuilder.toString());
206                }
207                builder.setCancelable(true);
208                builder.setIcon(mGroup.loadGroupIcon(pm));
209                mDialog = builder.show();
210                mDialog.setCanceledOnTouchOutside(true);
211            }
212        }
213
214        @Override
215        protected void onDetachedFromWindow() {
216            super.onDetachedFromWindow();
217            if (mDialog != null) {
218                mDialog.dismiss();
219            }
220        }
221    }
222
223    private AppSecurityPermissions(Context context) {
224        mContext = context;
225        mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
226        mPm = mContext.getPackageManager();
227        // Pick up from framework resources instead.
228        mNewPermPrefix = mContext.getText(R.string.perms_new_perm_prefix);
229    }
230
231    public AppSecurityPermissions(Context context, String packageName) {
232        this(context);
233        Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
234        PackageInfo pkgInfo;
235        try {
236            pkgInfo = mPm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
237        } catch (NameNotFoundException e) {
238            Log.w(TAG, "Couldn't retrieve permissions for package:"+packageName);
239            return;
240        }
241        // Extract all user permissions
242        if((pkgInfo.applicationInfo != null) && (pkgInfo.applicationInfo.uid != -1)) {
243            getAllUsedPermissions(pkgInfo.applicationInfo.uid, permSet);
244        }
245        mPermsList.addAll(permSet);
246        setPermissions(mPermsList);
247    }
248
249    public AppSecurityPermissions(Context context, PackageInfo info) {
250        this(context);
251        Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
252        if(info == null) {
253            return;
254        }
255
256        // Convert to a PackageInfo
257        PackageInfo installedPkgInfo = null;
258        // Get requested permissions
259        if (info.requestedPermissions != null) {
260            try {
261                installedPkgInfo = mPm.getPackageInfo(info.packageName,
262                        PackageManager.GET_PERMISSIONS);
263            } catch (NameNotFoundException e) {
264            }
265            extractPerms(info, permSet, installedPkgInfo);
266        }
267        // Get permissions related to  shared user if any
268        if (info.sharedUserId != null) {
269            int sharedUid;
270            try {
271                sharedUid = mPm.getUidForSharedUser(info.sharedUserId);
272                getAllUsedPermissions(sharedUid, permSet);
273            } catch (NameNotFoundException e) {
274                Log.w(TAG, "Couldn't retrieve shared user id for: " + info.packageName);
275            }
276        }
277        // Retrieve list of permissions
278        mPermsList.addAll(permSet);
279        setPermissions(mPermsList);
280    }
281
282    /**
283     * Utility to retrieve a view displaying a single permission.  This provides
284     * the old UI layout for permissions; it is only here for the device admin
285     * settings to continue to use.
286     */
287    public static View getPermissionItemView(Context context,
288            CharSequence grpName, CharSequence description, boolean dangerous) {
289        LayoutInflater inflater = (LayoutInflater)context.getSystemService(
290                Context.LAYOUT_INFLATER_SERVICE);
291        Drawable icon = context.getResources().getDrawable(dangerous
292                ? R.drawable.ic_bullet_key_permission : R.drawable.ic_text_dot);
293        return getPermissionItemViewOld(context, inflater, grpName,
294                description, dangerous, icon);
295    }
296
297    private void getAllUsedPermissions(int sharedUid, Set<MyPermissionInfo> permSet) {
298        String sharedPkgList[] = mPm.getPackagesForUid(sharedUid);
299        if(sharedPkgList == null || (sharedPkgList.length == 0)) {
300            return;
301        }
302        for(String sharedPkg : sharedPkgList) {
303            getPermissionsForPackage(sharedPkg, permSet);
304        }
305    }
306
307    private void getPermissionsForPackage(String packageName, Set<MyPermissionInfo> permSet) {
308        try {
309            PackageInfo pkgInfo = mPm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
310            extractPerms(pkgInfo, permSet, pkgInfo);
311        } catch (NameNotFoundException e) {
312            Log.w(TAG, "Couldn't retrieve permissions for package: " + packageName);
313        }
314    }
315
316    private void extractPerms(PackageInfo info, Set<MyPermissionInfo> permSet,
317            PackageInfo installedPkgInfo) {
318        String[] strList = info.requestedPermissions;
319        int[] flagsList = info.requestedPermissionsFlags;
320        if ((strList == null) || (strList.length == 0)) {
321            return;
322        }
323        for (int i=0; i<strList.length; i++) {
324            String permName = strList[i];
325            // If we are only looking at an existing app, then we only
326            // care about permissions that have actually been granted to it.
327            if (installedPkgInfo != null && info == installedPkgInfo) {
328                if ((flagsList[i]&PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0) {
329                    continue;
330                }
331            }
332            try {
333                PermissionInfo tmpPermInfo = mPm.getPermissionInfo(permName, 0);
334                if (tmpPermInfo == null) {
335                    continue;
336                }
337                int existingIndex = -1;
338                if (installedPkgInfo != null
339                        && installedPkgInfo.requestedPermissions != null) {
340                    for (int j=0; j<installedPkgInfo.requestedPermissions.length; j++) {
341                        if (permName.equals(installedPkgInfo.requestedPermissions[j])) {
342                            existingIndex = j;
343                            break;
344                        }
345                    }
346                }
347                final int existingFlags = existingIndex >= 0 ?
348                        installedPkgInfo.requestedPermissionsFlags[existingIndex] : 0;
349                if (!isDisplayablePermission(tmpPermInfo, flagsList[i], existingFlags)) {
350                    // This is not a permission that is interesting for the user
351                    // to see, so skip it.
352                    continue;
353                }
354                final String origGroupName = tmpPermInfo.group;
355                String groupName = origGroupName;
356                if (groupName == null) {
357                    groupName = tmpPermInfo.packageName;
358                    tmpPermInfo.group = groupName;
359                }
360                MyPermissionGroupInfo group = mPermGroups.get(groupName);
361                if (group == null) {
362                    PermissionGroupInfo grp = null;
363                    if (origGroupName != null) {
364                        grp = mPm.getPermissionGroupInfo(origGroupName, 0);
365                    }
366                    if (grp != null) {
367                        group = new MyPermissionGroupInfo(grp);
368                    } else {
369                        // We could be here either because the permission
370                        // didn't originally specify a group or the group it
371                        // gave couldn't be found.  In either case, we consider
372                        // its group to be the permission's package name.
373                        tmpPermInfo.group = tmpPermInfo.packageName;
374                        group = mPermGroups.get(tmpPermInfo.group);
375                        if (group == null) {
376                            group = new MyPermissionGroupInfo(tmpPermInfo);
377                        }
378                        group = new MyPermissionGroupInfo(tmpPermInfo);
379                    }
380                    mPermGroups.put(tmpPermInfo.group, group);
381                }
382                final boolean newPerm = installedPkgInfo != null
383                        && (existingFlags&PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0;
384                MyPermissionInfo myPerm = new MyPermissionInfo(tmpPermInfo);
385                myPerm.mNewReqFlags = flagsList[i];
386                myPerm.mExistingReqFlags = existingFlags;
387                // This is a new permission if the app is already installed and
388                // doesn't currently hold this permission.
389                myPerm.mNew = newPerm;
390                permSet.add(myPerm);
391            } catch (NameNotFoundException e) {
392                Log.i(TAG, "Ignoring unknown permission:"+permName);
393            }
394        }
395    }
396
397    public int getPermissionCount() {
398        return getPermissionCount(WHICH_ALL);
399    }
400
401    private List<MyPermissionInfo> getPermissionList(MyPermissionGroupInfo grp, int which) {
402        if (which == WHICH_NEW) {
403            return grp.mNewPermissions;
404        } else if (which == WHICH_PERSONAL) {
405            return grp.mPersonalPermissions;
406        } else if (which == WHICH_DEVICE) {
407            return grp.mDevicePermissions;
408        } else {
409            return grp.mAllPermissions;
410        }
411    }
412
413    public int getPermissionCount(int which) {
414        int N = 0;
415        for (int i=0; i<mPermGroupsList.size(); i++) {
416            N += getPermissionList(mPermGroupsList.get(i), which).size();
417        }
418        return N;
419    }
420
421    public View getPermissionsView() {
422        return getPermissionsView(WHICH_ALL);
423    }
424
425    public View getPermissionsView(int which) {
426        LinearLayout permsView = (LinearLayout) mInflater.inflate(R.layout.app_perms_summary, null);
427        LinearLayout displayList = (LinearLayout) permsView.findViewById(R.id.perms_list);
428        View noPermsView = permsView.findViewById(R.id.no_permissions);
429
430        displayPermissions(mPermGroupsList, displayList, which);
431        if (displayList.getChildCount() <= 0) {
432            noPermsView.setVisibility(View.VISIBLE);
433        }
434
435        return permsView;
436    }
437
438    /**
439     * Utility method that displays permissions from a map containing group name and
440     * list of permission descriptions.
441     */
442    private void displayPermissions(List<MyPermissionGroupInfo> groups,
443            LinearLayout permListView, int which) {
444        permListView.removeAllViews();
445
446        int spacing = (int)(8*mContext.getResources().getDisplayMetrics().density);
447
448        for (int i=0; i<groups.size(); i++) {
449            MyPermissionGroupInfo grp = groups.get(i);
450            final List<MyPermissionInfo> perms = getPermissionList(grp, which);
451            for (int j=0; j<perms.size(); j++) {
452                MyPermissionInfo perm = perms.get(j);
453                View view = getPermissionItemView(grp, perm, j == 0,
454                        which != WHICH_NEW ? mNewPermPrefix : null);
455                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
456                        ViewGroup.LayoutParams.MATCH_PARENT,
457                        ViewGroup.LayoutParams.WRAP_CONTENT);
458                if (j == 0) {
459                    lp.topMargin = spacing;
460                }
461                if (j == grp.mAllPermissions.size()-1) {
462                    lp.bottomMargin = spacing;
463                }
464                if (permListView.getChildCount() == 0) {
465                    lp.topMargin *= 2;
466                }
467                permListView.addView(view, lp);
468            }
469        }
470    }
471
472    private PermissionItemView getPermissionItemView(MyPermissionGroupInfo grp,
473            MyPermissionInfo perm, boolean first, CharSequence newPermPrefix) {
474        return getPermissionItemView(mContext, mInflater, grp, perm, first, newPermPrefix);
475    }
476
477    private static PermissionItemView getPermissionItemView(Context context, LayoutInflater inflater,
478            MyPermissionGroupInfo grp, MyPermissionInfo perm, boolean first,
479            CharSequence newPermPrefix) {
480        PermissionItemView permView = (PermissionItemView)inflater.inflate(
481                (perm.flags & PermissionInfo.FLAG_COSTS_MONEY) != 0
482                        ? R.layout.app_permission_item_money : R.layout.app_permission_item,
483                null);
484        permView.setPermission(grp, perm, first, newPermPrefix);
485        return permView;
486    }
487
488    private static View getPermissionItemViewOld(Context context, LayoutInflater inflater,
489            CharSequence grpName, CharSequence permList, boolean dangerous, Drawable icon) {
490        View permView = inflater.inflate(R.layout.app_permission_item_old, null);
491
492        TextView permGrpView = (TextView) permView.findViewById(R.id.permission_group);
493        TextView permDescView = (TextView) permView.findViewById(R.id.permission_list);
494
495        ImageView imgView = (ImageView)permView.findViewById(R.id.perm_icon);
496        imgView.setImageDrawable(icon);
497        if(grpName != null) {
498            permGrpView.setText(grpName);
499            permDescView.setText(permList);
500        } else {
501            permGrpView.setText(permList);
502            permDescView.setVisibility(View.GONE);
503        }
504        return permView;
505    }
506
507    private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags,
508            int existingReqFlags) {
509        final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
510        final boolean isNormal = (base == PermissionInfo.PROTECTION_NORMAL);
511        final boolean isDangerous = (base == PermissionInfo.PROTECTION_DANGEROUS);
512        final boolean isRequired =
513                ((newReqFlags&PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0);
514        final boolean isDevelopment =
515                ((pInfo.protectionLevel&PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0);
516        final boolean wasGranted =
517                ((existingReqFlags&PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);
518
519        // Dangerous and normal permissions are always shown to the user if the permission
520        // is required, or it was previously granted
521        if ((isNormal || isDangerous) && (isRequired || wasGranted)) {
522            return true;
523        }
524
525        // Development permissions are only shown to the user if they are already
526        // granted to the app -- if we are installing an app and they are not
527        // already granted, they will not be granted as part of the install.
528        if (isDevelopment && wasGranted) {
529            if (localLOGV) Log.i(TAG, "Special perm " + pInfo.name
530                    + ": protlevel=0x" + Integer.toHexString(pInfo.protectionLevel));
531            return true;
532        }
533        return false;
534    }
535
536    private static class PermissionGroupInfoComparator implements Comparator<MyPermissionGroupInfo> {
537        private final Collator sCollator = Collator.getInstance();
538        PermissionGroupInfoComparator() {
539        }
540        public final int compare(MyPermissionGroupInfo a, MyPermissionGroupInfo b) {
541            if (((a.flags^b.flags)&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) {
542                return ((a.flags&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) ? -1 : 1;
543            }
544            if (a.priority != b.priority) {
545                return a.priority > b.priority ? -1 : 1;
546            }
547            return sCollator.compare(a.mLabel, b.mLabel);
548        }
549    }
550
551    private static class PermissionInfoComparator implements Comparator<MyPermissionInfo> {
552        private final Collator sCollator = Collator.getInstance();
553        PermissionInfoComparator() {
554        }
555        public final int compare(MyPermissionInfo a, MyPermissionInfo b) {
556            return sCollator.compare(a.mLabel, b.mLabel);
557        }
558    }
559
560    private void addPermToList(List<MyPermissionInfo> permList,
561            MyPermissionInfo pInfo) {
562        if (pInfo.mLabel == null) {
563            pInfo.mLabel = pInfo.loadLabel(mPm);
564        }
565        int idx = Collections.binarySearch(permList, pInfo, mPermComparator);
566        if(localLOGV) Log.i(TAG, "idx="+idx+", list.size="+permList.size());
567        if (idx < 0) {
568            idx = -idx-1;
569            permList.add(idx, pInfo);
570        }
571    }
572
573    private void setPermissions(List<MyPermissionInfo> permList) {
574        if (permList != null) {
575            // First pass to group permissions
576            for (MyPermissionInfo pInfo : permList) {
577                if(localLOGV) Log.i(TAG, "Processing permission:"+pInfo.name);
578                if(!isDisplayablePermission(pInfo, pInfo.mNewReqFlags, pInfo.mExistingReqFlags)) {
579                    if(localLOGV) Log.i(TAG, "Permission:"+pInfo.name+" is not displayable");
580                    continue;
581                }
582                MyPermissionGroupInfo group = mPermGroups.get(pInfo.group);
583                if (group != null) {
584                    pInfo.mLabel = pInfo.loadLabel(mPm);
585                    addPermToList(group.mAllPermissions, pInfo);
586                    if (pInfo.mNew) {
587                        addPermToList(group.mNewPermissions, pInfo);
588                    }
589                    if ((group.flags&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) {
590                        addPermToList(group.mPersonalPermissions, pInfo);
591                    } else {
592                        addPermToList(group.mDevicePermissions, pInfo);
593                    }
594                }
595            }
596        }
597
598        for (MyPermissionGroupInfo pgrp : mPermGroups.values()) {
599            if (pgrp.labelRes != 0 || pgrp.nonLocalizedLabel != null) {
600                pgrp.mLabel = pgrp.loadLabel(mPm);
601            } else {
602                ApplicationInfo app;
603                try {
604                    app = mPm.getApplicationInfo(pgrp.packageName, 0);
605                    pgrp.mLabel = app.loadLabel(mPm);
606                } catch (NameNotFoundException e) {
607                    pgrp.mLabel = pgrp.loadLabel(mPm);
608                }
609            }
610            mPermGroupsList.add(pgrp);
611        }
612        Collections.sort(mPermGroupsList, mPermGroupComparator);
613        if (localLOGV) {
614            for (MyPermissionGroupInfo grp : mPermGroupsList) {
615                Log.i(TAG, "Group " + grp.name + " personal="
616                        + ((grp.flags&PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0)
617                        + " priority=" + grp.priority);
618            }
619        }
620    }
621}
622