use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class RepoXMLHandler method startElement.
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
super.startElement(uri, localName, qName, attributes);
if ("repo".equals(localName)) {
repoSigningCert = attributes.getValue("", "pubkey");
repoMaxAge = Utils.parseInt(attributes.getValue("", "maxage"), -1);
repoVersion = Utils.parseInt(attributes.getValue("", "version"), -1);
repoName = cleanWhiteSpace(attributes.getValue("", "name"));
repoDescription = cleanWhiteSpace(attributes.getValue("", "description"));
repoTimestamp = parseLong(attributes.getValue("", "timestamp"), 0);
repoIcon = attributes.getValue("", "icon");
} else if (RepoPushRequest.INSTALL.equals(localName) || RepoPushRequest.UNINSTALL.equals(localName)) {
if (repo.pushRequests == Repo.PUSH_REQUEST_ACCEPT_ALWAYS) {
RepoPushRequest r = new RepoPushRequest(localName, attributes.getValue("packageName"), attributes.getValue("versionCode"));
onRepoPushRequestParsed(r);
}
} else if ("application".equals(localName) && curapp == null) {
curapp = new App();
curapp.repoId = repo.getId();
curapp.packageName = attributes.getValue("", "id");
// To appease the NON NULL constraint in the DB. Usually there is a description, and it
// is quite difficult to get an app to _not_ have a description when using fdroidserver.
// However, it shouldn't crash the client when this happens.
curapp.description = "";
} else if ("package".equals(localName) && curapp != null && curapk == null) {
curapk = new Apk();
curapk.packageName = curapp.packageName;
curapk.repoId = repo.getId();
currentApkHashType = null;
} else if ("hash".equals(localName) && curapk != null) {
currentApkHashType = attributes.getValue("", "type");
} else if ("uses-permission".equals(localName) && curapk != null) {
String maxSdkVersion = attributes.getValue("maxSdkVersion");
if (maxSdkVersion == null || Build.VERSION.SDK_INT <= Integer.valueOf(maxSdkVersion)) {
addRequestedPermission(attributes.getValue("name"));
} else {
removeRequestedPermission(attributes.getValue("name"));
}
} else if ("uses-permission-sdk-23".equals(localName) && curapk != null) {
String maxSdkVersion = attributes.getValue("maxSdkVersion");
if (Build.VERSION.SDK_INT >= 23 && (maxSdkVersion == null || Build.VERSION.SDK_INT <= Integer.valueOf(maxSdkVersion))) {
addRequestedPermission(attributes.getValue("name"));
} else {
removeRequestedPermission(attributes.getValue("name"));
}
}
curchars.setLength(0);
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class AppDetails2 method reset.
/**
* Reset the display and list contents. Used when entering the activity, and
* also when something has been installed/uninstalled.
* Return true if the app was found, false otherwise.
*/
private boolean reset(String packageName) {
Utils.debugLog(TAG, "Getting application details for " + packageName);
App newApp = null;
if (!TextUtils.isEmpty(packageName)) {
newApp = AppProvider.Helper.findHighestPriorityMetadata(getContentResolver(), packageName);
}
setApp(newApp);
return this.app != null;
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class LocalRepoManager method addApp.
public void addApp(Context context, String packageName) {
App app;
try {
app = SwapService.getAppFromCache(packageName);
if (app == null) {
app = new App(context.getApplicationContext(), pm, packageName);
}
if (!app.isValid()) {
return;
}
} catch (PackageManager.NameNotFoundException | CertificateEncodingException | IOException e) {
Log.e(TAG, "Error adding app to local repo", e);
return;
}
Utils.debugLog(TAG, "apps.put: " + packageName);
apps.put(packageName, app);
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class ProperMultiRepoUpdaterTest method assert2048Metadata.
private void assert2048Metadata(Repo repo, @RepoIdentifier String id) {
App a2048 = AppProvider.Helper.findSpecificApp(context.getContentResolver(), "com.uberspot.a2048", repo.getId(), AppMetadataTable.Cols.ALL);
assert2048Metadata(a2048, id);
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class ProperMultiRepoUpdaterTest method assertAdbMetadata.
private void assertAdbMetadata(Repo repo, @RepoIdentifier String id) {
App adb = AppProvider.Helper.findSpecificApp(context.getContentResolver(), "siir.es.adbWireless", repo.getId(), AppMetadataTable.Cols.ALL);
assertAdbMetadata(adb, id);
}
Aggregations