本文整理汇总了Java中android.content.pm.PermissionGroupInfo类的典型用法代码示例。如果您正苦于以下问题:Java PermissionGroupInfo类的具体用法?Java PermissionGroupInfo怎么用?Java PermissionGroupInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PermissionGroupInfo类属于android.content.pm包,在下文中一共展示了PermissionGroupInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPermissionGroupInfo
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
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;
}
示例2: beforeInvoke
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
@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);
}
示例3: afterInvoke
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
@Override
protected void afterInvoke(Object receiver, Method method, Object[] args, Object invokeResult) 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 List<PermissionGroupInfo> getAllPermissionGroups(int flags) throws RemoteException;*/
if (args != null && invokeResult instanceof List) {
final int index = 0;
if (args.length > index && args[index] instanceof Integer) {
int flags = (Integer) args[index];
List<PermissionGroupInfo> infos = PluginManager.getInstance().getAllPermissionGroups(flags);
if (infos != null && infos.size() > 0) {
List old = (List) invokeResult;
old.addAll(infos);
}
}
}
super.afterInvoke(receiver, method, args, invokeResult);
}
示例4: doPermissionCheck
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
private void doPermissionCheck(Context context, ResultCollector collector, final String permission) {
PackageManager pm = context.getPackageManager();
try {
PermissionInfo info = pm.getPermissionInfo(permission, 0);
PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null;
CharSequence permLabel = info.loadLabel(pm);
CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel;
collector.addResult(context.getString(R.string.self_check_name_permission, permLabel),
context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative,
context.getString(R.string.self_check_resolution_permission, groupLabel),
new SelfCheckGroup.CheckResolver() {
@Override
public void tryResolve(Fragment fragment) {
fragment.requestPermissions(new String[]{permission}, 0);
}
});
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, e);
}
}
示例5: getAll
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
public List<PermissionInfo> getAll() {
if (allPerms == null) {
allPerms = new ArrayList<PermissionInfo>();
List<PermissionGroupInfo> permGroups = getAllGroups();
permGroups.add(null);
for (PermissionGroupInfo pgi : permGroups) {
List<PermissionInfo> perms;
try {
perms = getByGroup(pgi == null ? null : pgi.name);
} catch (NameNotFoundException e) {
throw new AssertionError();
}
allPerms.addAll(perms);
}
Collections.sort(allPerms, PermissionComparator.getInstance());
}
return Collections.unmodifiableList(allPerms);
}
示例6: getAllPermissionGroups
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
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;
}
}
示例7: getPermissionGroupInfo
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) throws RemoteException {
try {
if (!(this.mApkManager == null || name == null)) {
return this.mApkManager.getPermissionGroupInfo(name, flags);
}
} catch (RemoteException e) {
JLog.log("wuxinrong", "获取PermissionGroupInfo 失败 e=" + e.getMessage());
throw e;
} catch (Exception e2) {
JLog.log("wuxinrong", "获取PermissionGroupInfo 失败 e=" + e2.getMessage());
}
return null;
}
示例8: getAllPermissionGroups
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) throws RemoteException {
try {
if (this.mApkManager != null) {
return this.mApkManager.getAllPermissionGroups(flags);
}
} catch (RemoteException e) {
JLog.log("wuxinrong", "获取PermissionGroupInfo列表 失败 e=" + e.getMessage());
throw e;
} catch (Exception e2) {
JLog.log("wuxinrong", "获取PermissionGroupInfo列表 失败 e=" + e2.getMessage());
}
return null;
}
示例9: call
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
String name = (String) args[0];
int flags = (int) args[1];
PermissionGroupInfo info = VPackageManager.get().getPermissionGroupInfo(name, flags);
if (info != null) {
return info;
}
return super.call(who, method, args);
}
示例10: getPermissionGroupInfo
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) {
try {
return getInterface().getPermissionGroupInfo(name, flags);
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
示例11: getAllPermissionGroups
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
try {
return getInterface().getAllPermissionGroups(flags);
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
示例12: generatePermissionGroupInfo
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
public static PermissionGroupInfo generatePermissionGroupInfo(
VPackage.PermissionGroupComponent pg, int flags) {
if (pg == null) return null;
if ((flags & PackageManager.GET_META_DATA) == 0) {
return pg.info;
}
PermissionGroupInfo pgi = new PermissionGroupInfo(pg.info);
pgi.metaData = pg.metaData;
return pgi;
}
示例13: getPermissionGroupInfo
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) {
synchronized (mPackages) {
VPackage.PermissionGroupComponent p = mPermissionGroups.get(name);
if (p != null) {
return new PermissionGroupInfo(p.info);
}
}
return null;
}
示例14: getAllPermissionGroups
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
@Override
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
synchronized (mPackages) {
final int N = mPermissionGroups.size();
ArrayList<PermissionGroupInfo> out = new ArrayList<>(N);
for (VPackage.PermissionGroupComponent pg : mPermissionGroups.values()) {
out.add(new PermissionGroupInfo(pg.info));
}
return out;
}
}
示例15: getPermissionGroupInfo
import android.content.pm.PermissionGroupInfo; //导入依赖的package包/类
private PermissionGroupInfo getPermissionGroupInfo(PackageManager packageManager, String group) {
if (TextUtils.isEmpty(group)) {
return null;
}
try {
return packageManager.getPermissionGroupInfo(group, 0);
} catch (PackageManager.NameNotFoundException e) {
UILog.w("Can't find permission group " + group, e);
return null;
}
}