Esempio n. 1
0
        public virtual int addIntentOptions(int groupId, int itemId, int order, android.content.ComponentName
                                            caller, android.content.Intent[] specifics, android.content.Intent intent, int
                                            flags, android.view.MenuItem[] outSpecificItems)
        {
            android.content.pm.PackageManager pm = mContext.getPackageManager();
            java.util.List <android.content.pm.ResolveInfo> lri = pm.queryIntentActivityOptions
                                                                      (caller, specifics, intent, 0);
            int N = lri != null?lri.size() : 0;

            if ((flags & android.view.MenuClass.FLAG_APPEND_TO_GROUP) == 0)
            {
                removeGroup(groupId);
            }
            {
                for (int i = 0; i < N; i++)
                {
                    android.content.pm.ResolveInfo ri      = lri.get(i);
                    android.content.Intent         rintent = new android.content.Intent(ri.specificIndex < 0 ?
                                                                                        intent : specifics[ri.specificIndex]);
                    rintent.setComponent(new android.content.ComponentName(ri.activityInfo.applicationInfo
                                                                           .packageName, ri.activityInfo.name));
                    android.view.MenuItem item = add(groupId, itemId, order, ri.loadLabel(pm)).setIcon
                                                     (ri.loadIcon(pm)).setIntent(rintent);
                    if (outSpecificItems != null && ri.specificIndex >= 0)
                    {
                        outSpecificItems[ri.specificIndex] = item;
                    }
                }
            }
            return(N);
        }
 public AppSecurityPermissions(android.content.Context context, string packageName
                               )
 {
     mContext   = context;
     mPm        = mContext.getPackageManager();
     mPermsList = new java.util.ArrayList <android.content.pm.PermissionInfo>();
     java.util.Set <android.content.pm.PermissionInfo> permSet = new java.util.HashSet <
         android.content.pm.PermissionInfo>();
     android.content.pm.PackageInfo pkgInfo;
     try
     {
         pkgInfo = mPm.getPackageInfo(packageName, android.content.pm.PackageManager.GET_PERMISSIONS
                                      );
     }
     catch (android.content.pm.PackageManager.NameNotFoundException)
     {
         android.util.Log.w(TAG, "Could'nt retrieve permissions for package:" + packageName
                            );
         return;
     }
     // Extract all user permissions
     if ((pkgInfo.applicationInfo != null) && (pkgInfo.applicationInfo.uid != -1))
     {
         getAllUsedPermissions(pkgInfo.applicationInfo.uid, permSet);
     }
     foreach (android.content.pm.PermissionInfo tmpInfo in Sharpen.IterableProxy.Create
                  (permSet))
     {
         mPermsList.add(tmpInfo);
     }
 }
 public AppSecurityPermissions(android.content.Context context, java.util.List <android.content.pm.PermissionInfo
                                                                                > permList)
 {
     mContext   = context;
     mPm        = mContext.getPackageManager();
     mPermsList = permList;
 }
 public AppSecurityPermissions(android.content.Context context, android.content.pm.PackageParser
                               .Package pkg)
 {
     mContext   = context;
     mPm        = mContext.getPackageManager();
     mPermsList = new java.util.ArrayList <android.content.pm.PermissionInfo>();
     java.util.Set <android.content.pm.PermissionInfo> permSet = new java.util.HashSet <
         android.content.pm.PermissionInfo>();
     if (pkg == null)
     {
         return;
     }
     // Get requested permissions
     if (pkg.requestedPermissions != null)
     {
         java.util.ArrayList <string> strList = pkg.requestedPermissions;
         int size = strList.size();
         if (size > 0)
         {
             extractPerms(strList.toArray(new string[size]), permSet);
         }
     }
     // Get permissions related to  shared user if any
     if (pkg.mSharedUserId != null)
     {
         int sharedUid;
         try
         {
             sharedUid = mPm.getUidForSharedUser(pkg.mSharedUserId);
             getAllUsedPermissions(sharedUid, permSet);
         }
         catch (android.content.pm.PackageManager.NameNotFoundException)
         {
             android.util.Log.w(TAG, "Could'nt retrieve shared user id for:" + pkg.packageName
                                );
         }
     }
     // Retrieve list of permissions
     foreach (android.content.pm.PermissionInfo tmpInfo in Sharpen.IterableProxy.Create
                  (permSet))
     {
         mPermsList.add(tmpInfo);
     }
 }
Esempio n. 5
0
        // Not for instantiating.
        /// <summary>
        /// Returns the broadcast intent to fire with
        /// <see cref="android.content.Context.sendOrderedBroadcast(android.content.Intent, string, android.content.BroadcastReceiver, android.os.Handler, int, string, android.os.Bundle)
        ///     ">android.content.Context.sendOrderedBroadcast(android.content.Intent, string, android.content.BroadcastReceiver, android.os.Handler, int, string, android.os.Bundle)
        ///     </see>
        /// to receive details from the package that implements voice search.
        /// <p>
        /// This is based on the value specified by the voice search
        /// <see cref="android.app.Activity">android.app.Activity</see>
        /// in
        /// <see cref="DETAILS_META_DATA">DETAILS_META_DATA</see>
        /// , and if this is not specified, will return null. Also if there
        /// is no chosen default to resolve for
        /// <see cref="ACTION_WEB_SEARCH">ACTION_WEB_SEARCH</see>
        /// , this will return null.
        /// <p>
        /// If an intent is returned and is fired, a
        /// <see cref="android.os.Bundle">android.os.Bundle</see>
        /// of extras will be returned to the
        /// provided result receiver, and should ideally contain values for
        /// <see cref="EXTRA_LANGUAGE_PREFERENCE">EXTRA_LANGUAGE_PREFERENCE</see>
        /// and
        /// <see cref="EXTRA_SUPPORTED_LANGUAGES">EXTRA_SUPPORTED_LANGUAGES</see>
        /// .
        /// <p>
        /// (Whether these are actually provided is up to the particular implementation. It is
        /// recommended that
        /// <see cref="android.app.Activity">android.app.Activity</see>
        /// s implementing
        /// <see cref="ACTION_WEB_SEARCH">ACTION_WEB_SEARCH</see>
        /// provide this
        /// information, but it is not required.)
        /// </summary>
        /// <param name="context">a context object</param>
        /// <returns>the broadcast intent to fire or null if not available</returns>
        public static android.content.Intent getVoiceDetailsIntent(android.content.Context
                                                                   context)
        {
            android.content.Intent voiceSearchIntent = new android.content.Intent(ACTION_WEB_SEARCH
                                                                                  );
            android.content.pm.ResolveInfo ri = context.getPackageManager().resolveActivity(voiceSearchIntent
                                                                                            , android.content.pm.PackageManager.GET_META_DATA);
            if (ri == null || ri.activityInfo == null || ri.activityInfo.metaData == null)
            {
                return(null);
            }
            string className = ri.activityInfo.metaData.getString(DETAILS_META_DATA);

            if (className == null)
            {
                return(null);
            }
            android.content.Intent detailsIntent = new android.content.Intent(ACTION_GET_LANGUAGE_DETAILS
                                                                              );
            detailsIntent.setComponent(new android.content.ComponentName(ri.activityInfo.packageName
                                                                         , className));
            return(detailsIntent);
        }
Esempio n. 6
0
 public override android.content.pm.PackageManager getPackageManager()
 {
     return(mBase.getPackageManager());
 }