android.content.pm.PermissionGroupInfo Java Examples

The following examples show how to use android.content.pm.PermissionGroupInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: letv   Author: JackChan1999   File: IApkManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) throws RemoteException {
    waitForReadyInner();
    try {
        enforcePluginFileExists();
        if (shouldNotBlockOtherInfo()) {
            for (PluginPackageParser pluginPackageParser : this.mPluginCache.values()) {
                for (PermissionGroupInfo permissionGroupInfo : pluginPackageParser.getPermissionGroups()) {
                    if (TextUtils.equals(permissionGroupInfo.name, name)) {
                        return permissionGroupInfo;
                    }
                }
            }
        }
        List<String> pkgs = this.mActivityManagerService.getPackageNamesByPid(Binder.getCallingPid());
        for (PluginPackageParser pluginPackageParser2 : this.mPluginCache.values()) {
            for (PermissionGroupInfo permissionGroupInfo2 : pluginPackageParser2.getPermissionGroups()) {
                if (TextUtils.equals(permissionGroupInfo2.name, name) && pkgs.contains(permissionGroupInfo2.packageName)) {
                    return permissionGroupInfo2;
                }
            }
        }
    } catch (Exception e) {
        handleException(e);
    }
    return null;
}
 
Example #2
Source Project: YalpStore   Author: yeriomin   File: Permissions.java    License: GNU General Public License v2.0 6 votes vote down vote up
private PermissionGroupInfo getPermissionGroupInfo(PermissionInfo permissionInfo) {
    PermissionGroupInfo permissionGroupInfo;
    if (null == permissionInfo.group) {
        permissionGroupInfo = getFakePermissionGroupInfo(permissionInfo.packageName);
    } else {
        try {
            permissionGroupInfo = pm.getPermissionGroupInfo(permissionInfo.group, 0);
        } catch (PackageManager.NameNotFoundException e) {
            permissionGroupInfo = getFakePermissionGroupInfo(permissionInfo.packageName);
        }
    }
    if (permissionGroupInfo.icon == 0) {
        permissionGroupInfo.icon = R.drawable.ic_permission_android;
    }
    return permissionGroupInfo;
}
 
Example #3
Source Project: YalpStore   Author: yeriomin   File: Permissions.java    License: GNU General Public License v2.0 6 votes vote down vote up
private PermissionGroupInfo getFakePermissionGroupInfo(String packageName) {
    PermissionGroupInfo permissionGroupInfo = new PermissionGroupInfo();
    switch (packageName) {
        case "android":
            permissionGroupInfo.icon = R.drawable.ic_permission_android;
            permissionGroupInfo.name = "android";
            break;
        case "com.google.android.gsf":
        case "com.android.vending":
            permissionGroupInfo.icon = R.drawable.ic_permission_google;
            permissionGroupInfo.name = "google";
            break;
        default:
            permissionGroupInfo.icon = R.drawable.ic_permission_unknown;
            permissionGroupInfo.name = "unknown";
            break;
    }
    return permissionGroupInfo;

}
 
Example #4
Source Project: DroidPlugin   Author: DroidPluginTeam   File: IPackageManagerHookHandle.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable {
    //API 2.3, 4.01_r1, 4.0.3_r1, 4.1.1_r1, 4.2_r1, 4.3_r1, 4.4_r1, 5.0.2_r1
/*public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) throws RemoteException;*/
    if (args != null) {
        final int index0 = 0, index1 = 1;
        if (args.length > 1 && args[index0] instanceof String && args[index1] instanceof Integer) {
            String name = (String) args[index0];
            int flags = (Integer) args[index1];
            PermissionGroupInfo permissionInfo = PluginManager.getInstance().getPermissionGroupInfo(name, flags);
            if (permissionInfo != null) {
                setFakedResult(permissionInfo);
                return true;
            }
        }
    }
    return super.beforeInvoke(receiver, method, args);
}
 
Example #5
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
        int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(name);
}
 
Example #6
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #7
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
        int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(name);
}
 
Example #8
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #9
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
                                                  int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }

    throw new NameNotFoundException(name);
}
 
Example #10
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        return mPM.getAllPermissionGroups(flags);
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }
}
 
Example #11
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
        int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(name);
}
 
Example #12
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #13
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
        int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(name);
}
 
Example #14
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #15
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
                                                  int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }

    throw new NameNotFoundException(name);
}
 
Example #16
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        return mPM.getAllPermissionGroups(flags);
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }
}
 
Example #17
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
                                                  int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }

    throw new NameNotFoundException(name);
}
 
Example #18
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        return mPM.getAllPermissionGroups(flags);
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }
}
 
Example #19
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #20
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
        int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(name);
}
 
Example #21
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #22
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
        int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(name);
}
 
Example #23
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #24
Source Project: android_9.0.0_r45   Author: lulululbj   File: PermissionManagerService.java    License: Apache License 2.0 5 votes vote down vote up
private PermissionGroupInfo getPermissionGroupInfo(String groupName, int flags,
        int callingUid) {
    if (mPackageManagerInt.getInstantAppPackageName(callingUid) != null) {
        return null;
    }
    synchronized (mLock) {
        return PackageParser.generatePermissionGroupInfo(
                mSettings.mPermissionGroups.get(groupName), flags);
    }
}
 
Example #25
Source Project: android_9.0.0_r45   Author: lulululbj   File: PermissionManagerService.java    License: Apache License 2.0 5 votes vote down vote up
private List<PermissionGroupInfo> getAllPermissionGroups(int flags, int callingUid) {
    if (mPackageManagerInt.getInstantAppPackageName(callingUid) != null) {
        return null;
    }
    synchronized (mLock) {
        final int N = mSettings.mPermissionGroups.size();
        final ArrayList<PermissionGroupInfo> out
                = new ArrayList<PermissionGroupInfo>(N);
        for (PackageParser.PermissionGroup pg : mSettings.mPermissionGroups.values()) {
            out.add(PackageParser.generatePermissionGroupInfo(pg, flags));
        }
        return out;
    }
}
 
Example #26
Source Project: android_9.0.0_r45   Author: lulululbj   File: PackageManagerShellCommand.java    License: Apache License 2.0 5 votes vote down vote up
private int runListPermissionGroups() throws RemoteException {
    final PrintWriter pw = getOutPrintWriter();
    final List<PermissionGroupInfo> pgs = mInterface.getAllPermissionGroups(0).getList();

    final int count = pgs.size();
    for (int p = 0; p < count ; p++) {
        final PermissionGroupInfo pgi = pgs.get(p);
        pw.print("permission group:");
        pw.println(pgi.name);
    }
    return 0;
}
 
Example #27
Source Project: android_9.0.0_r45   Author: lulululbj   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name,
        int flags) throws NameNotFoundException {
    try {
        PermissionGroupInfo pgi = mPM.getPermissionGroupInfo(name, flags);
        if (pgi != null) {
            return pgi;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(name);
}
 
Example #28
Source Project: android_9.0.0_r45   Author: lulululbj   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
    try {
        ParceledListSlice<PermissionGroupInfo> parceledList =
                mPM.getAllPermissionGroups(flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #29
Source Project: Collection-Android   Author: usernameyangyan   File: GetPermissionsUtils.java    License: MIT License 5 votes vote down vote up
public static String  getAllPermissons(Context context){

        StringBuffer stringBuffer=new StringBuffer();
        try {
            PackageManager pm = context.getPackageManager();
            PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
            //得到自己的包名
            String pkgName = pi.packageName;

            PermissionGroupInfo pgi;
            PackageInfo pkgInfo = pm.getPackageInfo(pkgName, PackageManager.GET_PERMISSIONS);
            String sharedPkgList[] = pkgInfo.requestedPermissions;
            LogUtils.error("权限",sharedPkgList.length+"");

            for(int i=0;i<sharedPkgList.length;i++){
                String permName = sharedPkgList[i];

                PermissionInfo tmpPermInfo = pm.getPermissionInfo(permName, 0);

                stringBuffer.append("========"+permName+"========"+"\n");
                stringBuffer.append(tmpPermInfo.loadLabel(pm).toString()+"\n");
            }


        } catch (PackageManager.NameNotFoundException e) {
            LogUtils.error("权限","报错:"+e);
        }

        return stringBuffer.toString();
    }
 
Example #30
Source Project: letv   Author: JackChan1999   File: IApkManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) throws RemoteException {
    waitForReadyInner();
    try {
        enforcePluginFileExists();
        List<PermissionGroupInfo> list = new ArrayList();
        if (shouldNotBlockOtherInfo()) {
            for (PluginPackageParser pluginPackageParser : this.mPluginCache.values()) {
                for (PermissionGroupInfo permissionGroupInfo : pluginPackageParser.getPermissionGroups()) {
                    if (!list.contains(permissionGroupInfo)) {
                        list.add(permissionGroupInfo);
                    }
                }
            }
            return list;
        }
        List<String> pkgs = this.mActivityManagerService.getPackageNamesByPid(Binder.getCallingPid());
        for (PluginPackageParser pluginPackageParser2 : this.mPluginCache.values()) {
            for (PermissionGroupInfo permissionGroupInfo2 : pluginPackageParser2.getPermissionGroups()) {
                if (!list.contains(permissionGroupInfo2) && pkgs.contains(permissionGroupInfo2.packageName)) {
                    list.add(permissionGroupInfo2);
                }
            }
        }
        return list;
    } catch (Exception e) {
        handleException(e);
        return null;
    }
}