Java Code Examples for android.content.pm.PackageParser#PermissionGroup

The following examples show how to use android.content.pm.PackageParser#PermissionGroup . 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 File: PermissionManagerService.java    From android_9.0.0_r45 with 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 2
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 5 votes vote down vote up
@Override
public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) {
	synchronized (mPackages) {
		PackageParser.PermissionGroup p = mPermissionGroups.get(name);
		if (p != null) {
			return new PermissionGroupInfo(p.info);
		}
	}
	return null;
}
 
Example 3
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
	synchronized (mPackages) {
		final int N = mPermissionGroups.size();
		ArrayList<PermissionGroupInfo> out = new ArrayList<>(N);
		for (PackageParser.PermissionGroup pg : mPermissionGroups.values()) {
			out.add(new PermissionGroupInfo(pg.info));
		}
		return out;
	}
}
 
Example 4
Source File: PermissionManagerService.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private void addAllPermissionGroups(PackageParser.Package pkg, boolean chatty) {
    final int N = pkg.permissionGroups.size();
    StringBuilder r = null;
    for (int i=0; i<N; i++) {
        final PackageParser.PermissionGroup pg = pkg.permissionGroups.get(i);
        final PackageParser.PermissionGroup cur = mSettings.mPermissionGroups.get(pg.info.name);
        final String curPackageName = (cur == null) ? null : cur.info.packageName;
        final boolean isPackageUpdate = pg.info.packageName.equals(curPackageName);
        if (cur == null || isPackageUpdate) {
            mSettings.mPermissionGroups.put(pg.info.name, pg);
            if (chatty && DEBUG_PACKAGE_SCANNING) {
                if (r == null) {
                    r = new StringBuilder(256);
                } else {
                    r.append(' ');
                }
                if (isPackageUpdate) {
                    r.append("UPD:");
                }
                r.append(pg.info.name);
            }
        } else {
            Slog.w(TAG, "Permission group " + pg.info.name + " from package "
                    + pg.info.packageName + " ignored: original from "
                    + cur.info.packageName);
            if (chatty && DEBUG_PACKAGE_SCANNING) {
                if (r == null) {
                    r = new StringBuilder(256);
                } else {
                    r.append(' ');
                }
                r.append("DUP:");
                r.append(pg.info.name);
            }
        }
    }
    if (r != null && DEBUG_PACKAGE_SCANNING) {
        Log.d(TAG, "  Permission Groups: " + r);
    }

}