/** * Returns the string representation of this {@code ConditionInfo}. The * string is created by calling the {@code getEncoded} method on this * {@code ConditionInfo}. * * @return The string representation of this {@code ConditionInfo}. */ @Override public String toString() { return getEncoded(); }
escapeString(args[i], output); output.append('\"');
public AppPermissionImpl(ConditionalPermissionAdmin cpa, String uri) { this.cpa = cpa; this.pTypes = new ArrayList<>(); this.nTypes = new ArrayList<>(); this.allTypes = new HashMap<>(); this.granted = new ConcurrentHashMap<>(); this.blcArgs = new String[1]; this.blcArgs[0] = uri; this.blcInfo = new ConditionInfo(BUNDLE_LOCATION_CONDITION_NAME, blcArgs); this.location = uri; initLogger(); }
/** * Returns the negated <code>Condition</code> of * <code>BundleLocationCondition</code>. * * @param bundle The Bundle being evaluated. * @param info The ConditionInfo to construct the condition for. * @return Condition object for the requested condition. */ static public Condition getCondition(final Bundle bundle, ConditionInfo info) { ConditionInfo bundleLocationInfo = new ConditionInfo( BundleLocationCondition.class.getName(), info.getArgs()); Condition result = BundleLocationCondition.getCondition(bundle, bundleLocationInfo); return result == Condition.TRUE ? Condition.FALSE: Condition.TRUE; } }
argsList.add(unescapeString(encoded, begin, pos)); pos++;
String imsi = conditionInfo.getArgs()[0]; int length = imsi.length(); if (length > IMSI_LENGTH) {
public void registerPermission(PermissionInfo[] pia, ConditionInfo[] cia) { for (PermissionInfo pi : pia) { perms.add(pi); } for (ConditionInfo ci : cia) { if (!ci.getType().equals(AppPermissionImpl.BUNDLE_LOCATION_CONDITION_NAME)) conds.add(ci); } }
static int getHashCode(String name, ConditionInfo[] conds, PermissionInfo[] perms, String decision) { int h = 31 * 17 + decision.hashCode(); for (int i = 0; i < conds.length; i++) h = 31 * h + conds[i].hashCode(); for (int i = 0; i < perms.length; i++) h = 31 * h + perms[i].hashCode(); if (name != null) h = 31 * h + name.hashCode(); return h; }
AppPermissionImpl(ConditionalPermissionAdmin cpa, AppID man) { this.appID = man; this.cpa = cpa; this.pTypes = new ArrayList<>(); this.nTypes = new ArrayList<>(); this.allTypes = new HashMap<>(); this.granted = new ConcurrentHashMap<>(); this.blcArgs = new String[1]; this.blcArgs[0] = man.getLocation(); this.blcInfo = new ConditionInfo(BUNDLE_LOCATION_CONDITION_NAME, blcArgs); initLogger(); }
argsList.add(unescapeString(encoded, begin, pos)); pos++;
String imei = conditionInfo.getArgs()[0]; int length = imei.length(); if (length > IMEI_LENGTH) {
clazz = Class.forName(conditionInfos[i].getType()); } catch (ClassNotFoundException e) {
static int getHashCode(String name, ConditionInfo[] conds, PermissionInfo[] perms, String decision) { int h = 31 * 17 + decision.hashCode(); for (int i = 0; i < conds.length; i++) h = 31 * h + conds[i].hashCode(); for (int i = 0; i < perms.length; i++) h = 31 * h + perms[i].hashCode(); if (name != null) h = 31 * h + name.hashCode(); return h; }
/** * Update the permissions from the graph. * @param bundleLocation */ private void updateFromSystemGraph(String bundleLocation) { logger.debug("Updating from system graph"); logger.debug("location: {}, cpa: {}", bundleLocation, cpa); cpa.setConditionalPermissionInfo(bundleLocation, new ConditionInfo[]{ new ConditionInfo( BundleLocationCondition.class.getName(), new String[]{bundleLocation}) }, permissionDefinitions.retrievePermissions(bundleLocation)); }
/** * Returns the string representation of this {@code ConditionInfo}. The * string is created by calling the {@code getEncoded} method on this * {@code ConditionInfo}. * * @return The string representation of this {@code ConditionInfo}. */ @Override public String toString() { return getEncoded(); }
escapeString(args[i], output); output.append('\"');
argsList.add(unescapeString(encoded, begin, pos)); pos++;
String[] args = conditionInfo.getArgs(); if (args==null) throw new NullPointerException("args"); if (args.length!=4) throw new IllegalArgumentException("args.length=="+args.length+" (should be 4)");