本文整理汇总了Java中org.fdroid.fdroid.Utils.debugLog方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.debugLog方法的具体用法?Java Utils.debugLog怎么用?Java Utils.debugLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fdroid.fdroid.Utils
的用法示例。
在下文中一共展示了Utils.debugLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null) {
String action = intent.getAction();
if (Intent.ACTION_PACKAGE_ADDED.equals(action)) {
InstalledAppProviderService.insert(context, intent.getData());
} else if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
if (TextUtils.equals(context.getPackageName(), intent.getData().getSchemeSpecificPart())) {
Utils.debugLog(TAG, "Ignoring request to remove ourselves from cache.");
} else {
InstalledAppProviderService.delete(context, intent.getData());
}
} else {
Utils.debugLog(TAG, "unsupported action: " + action + " " + intent);
}
}
}
示例2: delete
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public int delete(Uri uri, String where, String[] whereArgs) {
if (MATCHER.match(uri) != CODE_SINGLE) {
throw new UnsupportedOperationException("Delete not supported for " + uri + ".");
}
String packageName = uri.getLastPathSegment();
QuerySelection query = new QuerySelection(where, whereArgs);
query = query.add(queryAppSubQuery(packageName));
Utils.debugLog(TAG, "Deleting " + packageName);
int count = db().delete(getTableName(), query.getSelection(), query.getArgs());
Utils.debugLog(TAG, "Requesting the suggested apk get recalculated for " + packageName);
AppProvider.Helper.calcSuggestedApk(getContext(), packageName);
return count;
}
示例3: delete
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public int delete(Uri uri, String where, String[] whereArgs) {
QuerySelection selection = new QuerySelection(where, whereArgs);
switch (MATCHER.match(uri)) {
case CODE_LIST:
// Don't support deleting of multiple repos.
return 0;
case CODE_SINGLE:
selection = selection.add(Cols._ID + " = ?", new String[]{uri.getLastPathSegment()});
break;
default:
Log.e(TAG, "Invalid URI for repo content provider: " + uri);
throw new UnsupportedOperationException("Invalid URI for repo content provider: " + uri);
}
int rowsAffected = db().delete(getTableName(), selection.getSelection(), selection.getArgs());
Utils.debugLog(TAG, "Deleted repo. Notifying provider change: '" + uri + "'.");
getContext().getContentResolver().notifyChange(uri, null);
return rowsAffected;
}
示例4: onHandleIntent
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_LOWEST);
if (intent == null || !ACTION_PARSE_APP.equals(intent.getAction())) {
Utils.debugLog(TAG, "received bad Intent: " + intent);
return;
}
try {
PackageManager pm = getPackageManager();
String packageName = intent.getData().getSchemeSpecificPart();
App app = new App(this, pm, packageName);
SwapService.putAppInCache(packageName, app);
} catch (CertificateEncodingException | IOException | PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
示例5: send
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
public void send(BluetoothConnection connection) throws IOException {
Utils.debugLog(TAG, "Sending Bluetooth HTTP-ish response...");
Writer output = new OutputStreamWriter(connection.getOutputStream());
output.write("HTTP(ish)/0.1 200 OK\n");
for (Map.Entry<String, String> entry : headers.entrySet()) {
output.write(entry.getKey());
output.write(": ");
output.write(entry.getValue());
output.write("\n");
}
output.write("\n");
output.flush();
if (contentStream != null) {
Utils.copy(contentStream, connection.getOutputStream());
}
output.flush();
}
示例6: onHandleIntent
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_LOWEST);
if (intent == null) {
Utils.debugLog(TAG, "received null Intent, ignoring");
return;
}
Utils.debugLog(TAG, "WiFi change service started, clearing info about wifi state until we have figured it out again.");
NetworkInfo ni = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
int wifiState = wifiManager.getWifiState();
if (ni == null || ni.isConnected()) {
Utils.debugLog(TAG, "ni == " + ni + " wifiState == " + printWifiState(wifiState));
if (wifiState == WifiManager.WIFI_STATE_ENABLED
|| wifiState == WifiManager.WIFI_STATE_DISABLING // might be switching to hotspot
|| wifiState == WifiManager.WIFI_STATE_DISABLED // might be hotspot
|| wifiState == WifiManager.WIFI_STATE_UNKNOWN) { // might be hotspot
if (wifiInfoThread != null) {
wifiInfoThread.interrupt();
}
wifiInfoThread = new WifiInfoThread();
wifiInfoThread.start();
}
}
}
示例7: updateSuggestedFromLatest
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
/**
* We set each app's suggested version to the latest available that is
* compatible, or the latest available if none are compatible.
*
* If the suggested version is null, it means that we could not figure it
* out from the upstream vercode. In such a case, fall back to the simpler
* algorithm as if upstreamVercode was 0.
*
* @see #updateSuggestedFromUpstream(String)
*/
private void updateSuggestedFromLatest(@Nullable String packageName) {
Utils.debugLog(TAG, "Calculating suggested versions for all apps which don't specify an upstream version code.");
final String apk = getApkTableName();
final String app = getTableName();
final String installed = InstalledAppTable.NAME;
final String restrictToApps;
final String[] args;
if (packageName == null) {
restrictToApps = " COALESCE(" + Cols.UPSTREAM_VERSION_CODE + ", 0) = 0 OR " + Cols.SUGGESTED_VERSION_CODE + " IS NULL ";
args = null;
} else {
// Don't update an app with an upstream version code, because that would have been updated
// by updateSuggestedFromUpdate(packageName).
restrictToApps = " COALESCE(" + Cols.UPSTREAM_VERSION_CODE + ", 0) = 0 AND " + app + "." + Cols.PACKAGE_ID + " = (" + getPackageIdFromPackageNameQuery() + ") ";
args = new String[]{packageName};
}
String updateSql =
"UPDATE " + app + " SET " + Cols.SUGGESTED_VERSION_CODE + " = ( " +
" SELECT MAX( " + apk + "." + ApkTable.Cols.VERSION_CODE + " ) " +
" FROM " + apk +
" JOIN " + app + " AS appForThisApk ON (appForThisApk." + Cols.ROW_ID + " = " + apk + "." + ApkTable.Cols.APP_ID + ") " +
" LEFT JOIN " + installed + " ON (" + installed + "." + InstalledAppTable.Cols.PACKAGE_ID + " = " + app + "." + Cols.PACKAGE_ID + ") " +
" WHERE " +
app + "." + Cols.PACKAGE_ID + " = appForThisApk." + Cols.PACKAGE_ID + " AND " +
apk + "." + ApkTable.Cols.SIGNATURE + " IS COALESCE(" + installed + "." + InstalledAppTable.Cols.SIGNATURE + ", " + apk + "." + ApkTable.Cols.SIGNATURE + ") AND " +
" ( " + app + "." + Cols.IS_COMPATIBLE + " = 0 OR " + apk + "." + ApkTable.Cols.IS_COMPATIBLE + " = 1 ) ) " +
" WHERE " + restrictToApps;
LoggingQuery.execSQL(db(), updateSql, args);
}
示例8: requestSwap
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
private void requestSwap(String repo) {
Utils.debugLog(TAG, "Received request to swap with " + repo);
Utils.debugLog(TAG, "Showing confirm screen to check whether that is okay with the user.");
Uri repoUri = Uri.parse(repo);
Intent intent = new Intent(context, SwapWorkflowActivity.class);
intent.setData(repoUri);
intent.putExtra(SwapWorkflowActivity.EXTRA_CONFIRM, true);
intent.putExtra(SwapWorkflowActivity.EXTRA_PREVENT_FURTHER_SWAP_REQUESTS, true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
示例9: queue
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
/**
* Add a URL to the download queue.
* <p/>
* All notifications are sent as an {@link Intent} via local broadcasts to be received by
*
* @param context this app's {@link Context}
* @param urlString The URL to add to the download queue
* @see #cancel(Context, String)
*/
public static void queue(Context context, String urlString, long repoId, String originalUrlString) {
if (TextUtils.isEmpty(urlString)) {
return;
}
Utils.debugLog(TAG, "Preparing " + urlString + " to go into the download queue");
Intent intent = new Intent(context, DownloaderService.class);
intent.setAction(ACTION_QUEUE);
intent.setData(Uri.parse(urlString));
intent.putExtra(Downloader.EXTRA_REPO_ID, repoId);
intent.putExtra(Downloader.EXTRA_CANONICAL_URL, originalUrlString);
context.startService(intent);
}
示例10: addObbFiles
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
private void addObbFiles(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 64) {
return;
}
Utils.debugLog(TAG, "Ensuring " + ApkTable.Cols.OBB_MAIN_FILE + ", " +
ApkTable.Cols.OBB_PATCH_FILE + ", and hash columns exist on " + ApkTable.NAME);
if (!columnExists(db, ApkTable.NAME, ApkTable.Cols.OBB_MAIN_FILE)) {
db.execSQL("alter table " + ApkTable.NAME + " add column "
+ ApkTable.Cols.OBB_MAIN_FILE + " string");
}
if (!columnExists(db, ApkTable.NAME, ApkTable.Cols.OBB_MAIN_FILE_SHA256)) {
db.execSQL("alter table " + ApkTable.NAME + " add column "
+ ApkTable.Cols.OBB_MAIN_FILE_SHA256 + " string");
}
if (!columnExists(db, ApkTable.NAME, ApkTable.Cols.OBB_PATCH_FILE)) {
db.execSQL("alter table " + ApkTable.NAME + " add column "
+ ApkTable.Cols.OBB_PATCH_FILE + " string");
}
if (!columnExists(db, ApkTable.NAME, ApkTable.Cols.OBB_PATCH_FILE_SHA256)) {
db.execSQL("alter table " + ApkTable.NAME + " add column "
+ ApkTable.Cols.OBB_PATCH_FILE_SHA256 + " string");
}
}
示例11: updateIconUrlLarge
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
private void updateIconUrlLarge(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 50) {
return;
}
Utils.debugLog(TAG, "Recalculating app icon URLs so that the newly added large icons will get updated.");
String query = "UPDATE fdroid_app "
+ "SET iconUrl = ("
+ " SELECT (fdroid_repo.address || CASE WHEN fdroid_repo.version >= ? THEN ? ELSE ? END || fdroid_app.icon) "
+ " FROM fdroid_apk "
+ " JOIN fdroid_repo ON (fdroid_repo._id = fdroid_apk.repo) "
+ " WHERE fdroid_app.id = fdroid_apk.id AND fdroid_apk.vercode = fdroid_app.suggestedVercode "
+ "), iconUrlLarge = ("
+ " SELECT (fdroid_repo.address || CASE WHEN fdroid_repo.version >= ? THEN ? ELSE ? END || fdroid_app.icon) "
+ " FROM fdroid_apk "
+ " JOIN fdroid_repo ON (fdroid_repo._id = fdroid_apk.repo) "
+ " WHERE fdroid_app.id = fdroid_apk.id AND fdroid_apk.vercode = fdroid_app.suggestedVercode"
+ ")";
String iconsDir = Utils.getIconsDir(context, 1.0);
String iconsDirLarge = Utils.getIconsDir(context, 1.5);
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
Utils.debugLog(TAG, "Using icons dir '" + iconsDir + "'");
Utils.debugLog(TAG, "Using large icons dir '" + iconsDirLarge + "'");
String[] args = {
repoVersion, iconsDir, Utils.FALLBACK_ICONS_DIR,
repoVersion, iconsDirLarge, Utils.FALLBACK_ICONS_DIR,
};
db.rawQuery(query, args);
clearRepoEtags(db);
}
示例12: recreateInstalledAppTable
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
/**
* If any column was added or removed, just drop the table, create it again
* and let the cache be filled from scratch by {@link InstalledAppProviderService}
* For DB versions older than 43, this will create the {@link InstalledAppProvider}
* table for the first time.
*/
private void recreateInstalledAppTable(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 56) {
return;
}
Utils.debugLog(TAG, "(re)creating 'installed app' database table.");
if (tableExists(db, "fdroid_installedApp")) {
db.execSQL("DROP TABLE fdroid_installedApp;");
}
db.execSQL(CREATE_TABLE_INSTALLED_APP);
}
示例13: update
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public int update(Uri uri, ContentValues values, String where, String[] whereArgs) {
// When the priority of a repo changes, we need to update the "preferred metadata" foreign
// key in the package table to point to the best possible record in the app metadata table.
// The full list of times when we need to recalculate the preferred metadata includes:
// * After the priority of a repo changes
// * After a repo is disabled
// * After a repo is enabled
// * After an update is performed
// This code only checks for the priority changing. All other occasions we can't do the
// recalculation right now, because we likely haven't added/removed the relevant apps
// from the metadata table yet. Usually the repo details are updated, then a request is
// made to do the heavier work (e.g. a repo update to get new list of apps from server).
// After the heavier work is complete, then that process can request the preferred metadata
// to be recalculated.
boolean priorityChanged = false;
if (values.containsKey(Cols.PRIORITY)) {
Cursor priorityCursor = db().query(getTableName(), new String[]{Cols.PRIORITY},
where, whereArgs, null, null, null);
if (priorityCursor.getCount() > 0) {
priorityCursor.moveToFirst();
int oldPriority = priorityCursor.getInt(priorityCursor.getColumnIndex(Cols.PRIORITY));
priorityChanged = oldPriority != values.getAsInteger(Cols.PRIORITY);
}
priorityCursor.close();
}
int numRows = db().update(getTableName(), values, where, whereArgs);
if (priorityChanged) {
AppProvider.Helper.recalculatePreferredMetadata(getContext());
}
Utils.debugLog(TAG, "Updated repo. Notifying provider change: '" + uri + "'.");
getContext().getContentResolver().notifyChange(uri, null);
return numRows;
}
示例14: onStartCommand
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Utils.debugLog(TAG, "Received Intent for downloading: " + intent + " (with a startId of " + startId + ")");
if (intent == null) {
return START_NOT_STICKY;
}
String uriString = intent.getDataString();
if (uriString == null) {
Utils.debugLog(TAG, "Received Intent with no URI: " + intent);
return START_NOT_STICKY;
}
if (ACTION_CANCEL.equals(intent.getAction())) {
Utils.debugLog(TAG, "Cancelling download of " + uriString);
Integer whatToRemove = uriString.hashCode();
if (serviceHandler.hasMessages(whatToRemove)) {
Utils.debugLog(TAG, "Removing download with ID of " + whatToRemove
+ " from service handler, then sending interrupted event.");
serviceHandler.removeMessages(whatToRemove);
sendBroadcast(intent.getData(), Downloader.ACTION_INTERRUPTED);
} else if (isActive(uriString)) {
downloader.cancelDownload();
} else {
Utils.debugLog(TAG, "ACTION_CANCEL called on something not queued or running"
+ " (expected to find message with ID of " + whatToRemove + " in queue).");
}
} else if (ACTION_QUEUE.equals(intent.getAction())) {
Message msg = serviceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = intent;
msg.what = uriString.hashCode();
serviceHandler.sendMessage(msg);
Utils.debugLog(TAG, "Queued download of " + uriString);
} else {
Utils.debugLog(TAG, "Received Intent with unknown action: " + intent);
}
return START_REDELIVER_INTENT; // if killed before completion, retry Intent
}
示例15: renameRepoId
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
private void renameRepoId(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 36 || columnExists(db, RepoTable.NAME, RepoTable.Cols._ID)) {
return;
}
Utils.debugLog(TAG, "Renaming " + RepoTable.NAME + ".id to " + RepoTable.Cols._ID);
db.beginTransaction();
try {
// http://stackoverflow.com/questions/805363/how-do-i-rename-a-column-in-a-sqlite-database-table#805508
String tempTableName = RepoTable.NAME + "__temp__";
db.execSQL("ALTER TABLE " + RepoTable.NAME + " RENAME TO " + tempTableName + ";");
// I realise this is available in the CREATE_TABLE_REPO above,
// however I have a feeling that it will need to be the same as the
// current structure of the table as of DBVersion 36, or else we may
// get into strife. For example, if there was a field that
// got removed, then it will break the "insert select"
// statement. Therefore, I've put a copy of CREATE_TABLE_REPO
// here that is the same as it was at DBVersion 36.
String createTableDdl = "create table " + RepoTable.NAME + " ("
+ RepoTable.Cols._ID + " integer not null primary key, "
+ RepoTable.Cols.ADDRESS + " text not null, "
+ RepoTable.Cols.NAME + " text, "
+ RepoTable.Cols.DESCRIPTION + " text, "
+ RepoTable.Cols.IN_USE + " integer not null, "
+ RepoTable.Cols.PRIORITY + " integer not null, "
+ RepoTable.Cols.SIGNING_CERT + " text, "
+ RepoTable.Cols.FINGERPRINT + " text, "
+ RepoTable.Cols.MAX_AGE + " integer not null default 0, "
+ RepoTable.Cols.VERSION + " integer not null default 0, "
+ RepoTable.Cols.LAST_ETAG + " text, "
+ RepoTable.Cols.LAST_UPDATED + " string);";
db.execSQL(createTableDdl);
String nonIdFields = TextUtils.join(", ", new String[] {
RepoTable.Cols.ADDRESS,
RepoTable.Cols.NAME,
RepoTable.Cols.DESCRIPTION,
RepoTable.Cols.IN_USE,
RepoTable.Cols.PRIORITY,
RepoTable.Cols.SIGNING_CERT,
RepoTable.Cols.FINGERPRINT,
RepoTable.Cols.MAX_AGE,
RepoTable.Cols.VERSION,
RepoTable.Cols.LAST_ETAG,
RepoTable.Cols.LAST_UPDATED,
});
String insertSql = "INSERT INTO " + RepoTable.NAME +
"(" + RepoTable.Cols._ID + ", " + nonIdFields + " ) " +
"SELECT id, " + nonIdFields + " FROM " + tempTableName + ";";
db.execSQL(insertSql);
db.execSQL("DROP TABLE " + tempTableName + ";");
db.setTransactionSuccessful();
} catch (Exception e) {
Log.e(TAG, "Error renaming id to " + RepoTable.Cols._ID, e);
}
db.endTransaction();
}