Example usage for android.util Log WARN

List of usage examples for android.util Log WARN

Introduction

In this page you can find the example usage for android.util Log WARN.

Prototype

int WARN

To view the source code for android.util Log WARN.

Click Source Link

Document

Priority constant for the println method; use Log.w.

Usage

From source file:org.fs.galleon.views.ContactFragmentView.java

@Override
public void showError(String errorStr) {
    final View view = view();
    if (view != null) {
        Snackbar.make(view, errorStr, Snackbar.LENGTH_LONG).show();
    } else {//w w  w .j ava2  s.com
        log(Log.WARN,
                String.format(Locale.ENGLISH, "Error occured and snackbar is not available, '%s'", errorStr));
    }
}

From source file:com.scvngr.levelup.core.util.LogManager.java

/**
 * Log a message./*from   w  ww  . j a  v a2 s  .c om*/
 *
 * @param msg message to log.
 * @param err an exception that occurred, whose trace will be printed with the log message.
 */
public static void w(@NonNull final String msg, @NonNull final Throwable err) {
    logMessage(Log.WARN, msg, null, err);
}

From source file:org.thoughtland.xlocation.UpdateService.java

private static void migrate(Context context) throws IOException, RemoteException {
    int first = 0;
    String format = context.getString(R.string.msg_migrating);
    List<ApplicationInfo> listApp = context.getPackageManager().getInstalledApplications(0);

    // Start migrate
    PrivacyProvider.migrateLegacy(context);

    // Migrate global settings
    PrivacyManager.setSettingList(PrivacyProvider.migrateSettings(context, 0));
    PrivacyProvider.finishMigrateSettings(0);

    // Migrate application settings/restrictions
    for (int i = 1; i <= listApp.size(); i++) {
        int uid = listApp.get(i - 1).uid;
        // Settings
        List<PSetting> listSetting = PrivacyProvider.migrateSettings(context, uid);
        PrivacyManager.setSettingList(listSetting);
        PrivacyProvider.finishMigrateSettings(uid);

        // Restrictions
        List<PRestriction> listRestriction = PrivacyProvider.migrateRestrictions(context, uid);
        PrivacyManager.setRestrictionList(listRestriction);
        PrivacyProvider.finishMigrateRestrictions(uid);

        if (first == 0)
            if (listSetting.size() > 0 || listRestriction.size() > 0)
                first = i;/*from  w w  w . j  av  a2 s .co m*/
        if (first > 0 && first < listApp.size())
            notifyProgress(context, Util.NOTIFY_MIGRATE, format, 100 * (i - first) / (listApp.size() - first));
    }
    if (first == 0)
        Util.log(null, Log.WARN, "Nothing to migrate");

    // Complete migration
    int userId = Util.getUserId(Process.myUid());
    PrivacyService.getClient()
            .setSetting(new PSetting(userId, "", PrivacyManager.cSettingMigrated, Boolean.toString(true)));
}

From source file:com.digipom.manteresting.android.service.cache.CacheService.java

private void initializeSecondaryFileCache() {
    // Limit external disk cache to 512 MB of available space.
    try {//from w  ww  . j a  v  a  2s.  c  o  m
        secondaryFileCache = new ImageFileCache(getExternalCacheDir(), 512 * 1024 * 1024);
    } catch (Throwable t) {
        if (LoggerConfig.canLog(Log.WARN)) {
            Log.w(TAG, "Could not open secondary image cache.", t);
        }
    }
}

From source file:ru.strider.simplerecognizer.util.AdMob.java

public static boolean checkAdFreePackage() {
    boolean isHazard = false;

    ApplicationInfo info = null;/*ww w .j a v  a2 s. co  m*/

    try {
        info = SimpleRecognizer.getPackageContext().getPackageManager().getApplicationInfo(AD_FREE_PACKAGE_OLD,
                0);
    } catch (NameNotFoundException e) {
        try {
            info = SimpleRecognizer.getPackageContext().getPackageManager().getApplicationInfo(AD_FREE_PACKAGE,
                    0);
        } catch (NameNotFoundException ex) {
            SimpleRecognizer.logIfDebug(Log.WARN, LOG_TAG, ("AdFree Package" + Text.SEPARATOR + "Not Found"));
        }
    }

    if (info != null) {
        File hostsFile = new File(HOSTS_PATH);

        if (hostsFile.exists() && (hostsFile.length() > (1024L * 1024L / 2L))) {
            isHazard = true;
        }

        SimpleRecognizer.logIfDebug(Log.WARN, LOG_TAG,
                ("AdFree Package" + Text.SEPARATOR + (isHazard ? "Found" : "Disabled")));
    }

    return isHazard;
}

From source file:com.facebook.SharedPreferencesTokenCache.java

/**
 * Returns a Bundle that contains the information stored in this cache
 *
 * @return A Bundle with the information contained in this cache
 *///  ww  w  .  j a  v a2 s. c  o  m
public Bundle load() {
    Bundle settings = new Bundle();

    Map<String, ?> allCachedEntries = cache.getAll();

    for (String key : allCachedEntries.keySet()) {
        try {
            deserializeKey(key, settings);
        } catch (JSONException e) {
            // Error in the cache. So consider it corrupted and return null
            Logger.log(LoggingBehaviors.CACHE, Log.WARN, TAG,
                    "Error reading cached value for key: '" + key + "' -- " + e);
            return null;
        }
    }

    return settings;
}

From source file:org.fs.galleon.views.ContactFragmentView.java

@Override
public void showError(String errorStr, String btnStr, View.OnClickListener listener) {
    final View view = view();
    if (view != null) {
        final Snackbar snackbar = Snackbar.make(view, errorStr, Snackbar.LENGTH_LONG);
        snackbar.setAction(btnStr, (v) -> {
            if (listener != null) {
                listener.onClick(v);/*from  w w w.j av a  2  s .  c  om*/
            }
            snackbar.dismiss();
        });
        snackbar.show();
    } else {
        log(Log.WARN,
                String.format(Locale.ENGLISH, "Error occured and snackbar is not available, '%s'", errorStr));
    }
}

From source file:de.escoand.readdaily.DownloadHandler.java

@Override
public void onReceive(final Context context, final Intent intent) {
    final DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
    final Database db = Database.getInstance(context);
    final Cursor downloads = db.getDownloads();

    LogHandler.log(Log.WARN, "receive starting");

    while (downloads.moveToNext()) {
        final long id = downloads.getLong(downloads.getColumnIndex(Database.COLUMN_ID));
        final String name = downloads.getString(downloads.getColumnIndex(Database.COLUMN_SUBSCRIPTION));
        final String mime = downloads.getString(downloads.getColumnIndex(Database.COLUMN_TYPE));
        final Cursor download = manager.query(new DownloadManager.Query().setFilterById(id));

        // download exists
        if (!download.moveToFirst())
            continue;

        // download finished
        if (download.getInt(
                download.getColumnIndex(DownloadManager.COLUMN_STATUS)) != DownloadManager.STATUS_SUCCESSFUL)
            continue;

        // import file in background
        new Thread(new Runnable() {
            @Override//  w w w.ja va  2 s  .co m
            public void run() {
                try {
                    LogHandler.log(Log.WARN, "import starting of " + name);

                    final FileInputStream stream = new ParcelFileDescriptor.AutoCloseInputStream(
                            manager.openDownloadedFile(id));
                    final String mimeServer = manager.getMimeTypeForDownloadedFile(id);

                    LogHandler.log(Log.INFO, "id: " + String.valueOf(id));
                    LogHandler.log(Log.INFO, "manager: " + manager.toString());
                    LogHandler.log(Log.INFO, "stream: " + stream.toString());
                    LogHandler.log(Log.INFO, "mime: " + mime);
                    LogHandler.log(Log.INFO, "mimeServer: " + mimeServer);

                    switch (mime != null ? mime : (mimeServer != null ? mimeServer : "")) {

                    // register feedback
                    case "application/json":
                        final byte[] buf = new byte[256];
                        final int len = stream.read(buf);
                        LogHandler.log(Log.WARN, "register feedback: " + new String(buf, 0, len));
                        break;

                    // csv data
                    case "text/plain":
                        db.importCSV(name, stream);
                        break;

                    // xml data
                    case "application/xml":
                    case "text/xml":
                        db.importXML(name, stream);
                        break;

                    // zipped data
                    case "application/zip":
                        db.importZIP(name, stream);
                        break;

                    // do nothing
                    default:
                        LogHandler.log(new IntentFilter.MalformedMimeTypeException());
                        break;
                    }

                    stream.close();
                    LogHandler.log(Log.WARN, "import finished (" + name + ")");
                }

                // file error
                catch (FileNotFoundException e) {
                    LogHandler.logAndShow(e, context, R.string.message_download_open);
                }

                // stream error
                catch (IOException e) {
                    LogHandler.logAndShow(e, context, R.string.message_download_read);
                }

                // xml error
                catch (XmlPullParserException e) {
                    LogHandler.logAndShow(e, context, R.string.message_download_xml);
                }

                // clean
                finally {
                    manager.remove(id);
                    db.removeDownload(id);
                    LogHandler.log(Log.WARN, "clean finished");
                }
            }
        }).start();
    }

    downloads.close();
    LogHandler.log(Log.WARN, "receiving done");
}

From source file:com.digipom.manteresting.android.service.cache.CacheService.java

private void initializePrimaryFileCache() {
    // Limit internal disk cache to 32 MB of available space.
    try {/*from ww w  .  j a va 2 s.  c  o m*/
        primaryFileCache = new ImageFileCache(getCacheDir(), 32 * 1024 * 1024);
    } catch (Throwable t) {
        if (LoggerConfig.canLog(Log.WARN)) {
            Log.w(TAG, "Could not open primary image cache.", t);
        }
    }
}

From source file:com.facebook.SharedPreferencesTokenCachingStrategy.java

/**
 * Returns a Bundle that contains the information stored in this cache
 *
 * @return A Bundle with the information contained in this cache
 *//*from w  w w . j a v  a2 s  .  c o m*/
public Bundle load() {
    Bundle settings = new Bundle();

    Map<String, ?> allCachedEntries = cache.getAll();

    for (String key : allCachedEntries.keySet()) {
        try {
            deserializeKey(key, settings);
        } catch (JSONException e) {
            // Error in the cache. So consider it corrupted and return null
            Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG,
                    "Error reading cached value for key: '" + key + "' -- " + e);
            return null;
        }
    }

    return settings;
}