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:com.android.talkback.labeling.LabelProvider.java

/**
 * Queries for a label or multiple labels in the labels database.
 *
 * @param uri The URI representing the type of query to perform:
 *            {@code LABELS_CONTENT_URI} for a subset of all labels,
 *            {@code LABELS_ID_CONTENT_URI} for a specific label, or
 *            {@code PACKAGE_SUMMARY} for a label count per package.
 * @param projection The columns to return.
 * @param selection The WHERE clause for the query.
 * @param selectionArgs The arguments for the WHERE clause of the query.
 * @param sortOrder the ORDER BY clause for the query.
 * @return A cursor representing the data resulting from the query, or]
 *         {@code null} if the query failed to execute.
 *///  w w  w.  j  a  v a 2s .  c o  m
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    if (uri == null) {
        LogUtils.log(this, Log.WARN, NULL_URI_FORMAT_STRING);
        return null;
    }

    if (!UserManagerCompat.isUserUnlocked(getContext())) {
        return null;
    }

    final SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    queryBuilder.setTables(LabelsTable.TABLE_NAME);

    String groupBy = null;

    switch (sUriMatcher.match(uri)) {
    case LABELS:
        if (TextUtils.isEmpty(sortOrder)) {
            sortOrder = LabelsTable.KEY_ID;
        }
        break;
    case LABELS_ID:
        final String labelIdString = uri.getLastPathSegment();
        final int labelId;
        try {
            labelId = Integer.parseInt(labelIdString);
        } catch (NumberFormatException e) {
            LogUtils.log(this, Log.WARN, UNKNOWN_URI_FORMAT_STRING, uri);
            return null;
        }

        final String where = String.format(Locale.ROOT, "%s = %d", LabelsTable.KEY_ID, labelId);
        queryBuilder.appendWhere(where);
        break;
    case PACKAGE_SUMMARY:
        projection = new String[] { LabelsTable.KEY_PACKAGE_NAME, "COUNT(*)" };
        groupBy = LabelsTable.KEY_PACKAGE_NAME;
        sortOrder = LabelsTable.KEY_PACKAGE_NAME;
        break;
    default:
        LogUtils.log(this, Log.WARN, UNKNOWN_URI_FORMAT_STRING, uri);
        return null;
    }

    initializeDatabaseIfNull();

    return queryBuilder.query(mDatabase, projection, selection, selectionArgs, groupBy, null /* having */,
            sortOrder);
}

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

public static boolean isXposedEnabled() {
    // Will be hooked to return true
    log(null, Log.WARN, "XLocation not enabled");
    return false;
}

From source file:com.android.screenspeak.eventprocessor.ProcessorEventQueue.java

/**
 * Processes an <code>event</code> by asking the
 * {@link EventSpeechRuleProcessor} to match it against its rules and in
 * case an utterance is generated it is spoken. This method is responsible
 * for recycling of the processed event.
 *
 * @param event The event to process.//from  ww w .  j  ava 2s  .  c  o  m
 */
private void processAndRecycleEvent(AccessibilityEvent event) {
    if (event == null)
        return;
    LogUtils.log(this, Log.DEBUG, "Processing event: %s", event);

    final Utterance utterance = new Utterance();

    if (mEventSpeechRuleProcessor.processEvent(event, utterance)) {
        if (mTestingListener != null) {
            mTestingListener.onUtteranceQueued(utterance);
        }

        provideFeedbackForUtterance(computeQueuingMode(utterance, event), utterance);
    } else {
        // Failed to match event to a rule, so the utterance is empty.
        LogUtils.log(this, Log.WARN, "Failed to process event");
    }

    event.recycle();
}

From source file:com.radicaldynamic.groupinform.services.InformOnlineService.java

public boolean goOffline() {
    if (checkout()) {
        if (Collect.Log.INFO)
            Log.i(Collect.LOGTAG, t + "went offline at users request");
        Collect.getInstance().getInformOnlineState().setOfflineModeEnabled(true);
        return true;
    } else {//from   ww w.ja  v  a 2  s  .c  o  m
        if (Collect.Log.WARN)
            Log.w(Collect.LOGTAG, t + "unable to go offline at users request");
        return false;
    }
}

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

private static void upgrade(Context context) throws NameNotFoundException {
    // Get previous version number
    int userId = Util.getUserId(Process.myUid());
    Version currentVersion = new Version(Util.getSelfVersionName(context));
    Version storedVersion = new Version(
            PrivacyManager.getSetting(userId, PrivacyManager.cSettingVersion, "0.0"));
    boolean dangerous = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingDangerous, false);

    // Check if upgrade needed
    if (storedVersion.compareTo(new Version("0.0")) != 0 && currentVersion.compareTo(storedVersion) > 0) {
        Util.log(null, Log.WARN, "Starting upgrade from version " + storedVersion + " to version "
                + currentVersion + " dangerous=" + dangerous);

        // Upgrade packages
        int first = 0;
        String format = context.getString(R.string.msg_upgrading);
        List<ApplicationInfo> listApp = context.getPackageManager().getInstalledApplications(0);

        for (int i = 1; i <= listApp.size(); i++) {
            int uid = listApp.get(i - 1).uid;
            List<PRestriction> listRestriction = getUpgradeWork(storedVersion, uid, dangerous);
            PrivacyManager.setRestrictionList(listRestriction);

            // Reset on demand for system applications
            if (new ApplicationInfoEx(context, listApp.get(i - 1).uid).isSystem())
                if (storedVersion.compareTo(new Version("2.0.38")) < 0)
                    if (PrivacyManager.getSettingBool(listApp.get(i - 1).uid, PrivacyManager.cSettingOnDemand,
                            false)) {/*  w  ww  .j a va2s  .  c  o  m*/
                        Util.log(null, Log.WARN, "Disabling on demand for uid=" + listApp.get(i - 1).uid);
                        PrivacyManager.setSetting(listApp.get(i - 1).uid, PrivacyManager.cSettingOnDemand,
                                null);
                    }

            if (first == 0)
                if (listRestriction.size() > 0)
                    first = i;
            if (first > 0 && first < listApp.size())
                notifyProgress(context, Util.NOTIFY_UPGRADE, format,
                        100 * (i - first) / (listApp.size() - first));
        }
        if (first == 0)
            Util.log(null, Log.WARN,
                    "Nothing to upgrade from version " + storedVersion + " to " + currentVersion);

        // Remove legacy setting
        if (dangerous)
            PrivacyManager.setSetting(userId, PrivacyManager.cSettingDangerous, null);

        // Resolve quirk
        if (storedVersion.compareTo(new Version("2.99.28")) < 0)
            if (!PrivacyManager.getSettingBool(0, PrivacyManager.cSettingNoResolve, false)) {
                Util.log(null, Log.WARN, "Enabling quirk resolve");
                PrivacyManager.setSetting(0, PrivacyManager.cSettingResolve, Boolean.toString(true));
            }

        // Wipe template
        if (storedVersion.compareTo(new Version("2.0.34")) < 0)
            for (PSetting setting : PrivacyManager.getSettingList(0, null))
                if (Meta.cTypeTemplate.equals(setting.type)) {
                    Util.log(null, Log.WARN, "Deleting " + setting);
                    PrivacyManager.setSetting(setting.uid, setting.type, setting.name, null);
                }
    } else
        Util.log(null, Log.WARN, "No upgrade from version " + storedVersion + " to " + currentVersion);

    // Set new version number
    if (currentVersion.compareTo(storedVersion) > 0)
        PrivacyManager.setSetting(userId, PrivacyManager.cSettingVersion, currentVersion.toString());

    // Cleanup
    PrivacyManager.removeLegacySalt(userId);
}

From source file:com.facebook.SharedPreferencesTokenCache.java

/**
 * Persists all supported data types present in the passed in Bundle, to the
 * cache//from ww w.  j  av  a  2 s . co  m
 *
 * @param bundle
 *          The Bundle containing information to be cached
 */
public void save(Bundle bundle) {
    Validate.notNull(bundle, "bundle");

    SharedPreferences.Editor editor = cache.edit();

    for (String key : bundle.keySet()) {
        try {
            serializeKey(key, bundle, editor);
        } catch (JSONException e) {
            // Error in the bundle. Don't store a partial cache.
            Logger.log(LoggingBehaviors.CACHE, Log.WARN, TAG,
                    "Error processing value for key: '" + key + "' -- " + e);

            // Bypass the commit and just return. This cancels the entire edit transaction
            return;
        }
    }

    boolean successfulCommit = editor.commit();
    if (!successfulCommit) {
        Logger.log(LoggingBehaviors.CACHE, Log.WARN, TAG,
                "SharedPreferences.Editor.commit() was not successful");
    }
}

From source file:com.facebook.SharedPreferencesTokenCachingStrategy.java

/**
 * Persists all supported data types present in the passed in Bundle, to the
 * cache//from w  w  w . j  a v a 2s  .  co m
 *
 * @param bundle
 *          The Bundle containing information to be cached
 */
public void save(Bundle bundle) {
    Validate.notNull(bundle, "bundle");

    SharedPreferences.Editor editor = cache.edit();

    for (String key : bundle.keySet()) {
        try {
            serializeKey(key, bundle, editor);
        } catch (JSONException e) {
            // Error in the bundle. Don't store a partial cache.
            Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG,
                    "Error processing value for key: '" + key + "' -- " + e);

            // Bypass the commit and just return. This cancels the entire edit transaction
            return;
        }
    }
    editor.apply();
}

From source file:biz.bokhorst.xprivacy.Util.java

public static boolean isXposedEnabled() {
    // Will be hooked to return true
    log(null, Log.WARN, "XPrivacy not enabled");
    return false;
}

From source file:com.psiphon3.psiphonlibrary.UpgradeChecker.java

/**
 * Checks whether an upgrade check should be performed. False will be returned if there's already
 * an upgrade file downloaded.//from  w w w . j a v a2s  .  c o  m
 * May be called from any process or thread.
 * Side-effect: If an existing upgrade file is detected, the upgrade notification will be displayed.
 * Side-effect: Creates the UpgradeChecker alarm.
 * @param context the context
 * @return true if upgrade check is needed.
 */
public static boolean upgradeCheckNeeded(Context context) {
    Context appContext = context.getApplicationContext();

    // The main process will call this when it tries to connect, so we will use this opportunity
    // to make sure our alarm is created.
    createAlarm(appContext);

    // Don't re-download the upgrade package when a verified upgrade file is
    // awaiting application by the user. A previous upgrade download will have
    // completed and have been extracted to this verified upgrade file.
    // Without this check, tunnel-core won't know that the upgrade is already
    // downloaded, as the file name differs from UpgradeDownloadFilename, and
    // so the entire upgrade will be re-downloaded on each tunnel connect until
    // the user actually applies the upgrade.
    // As a result of this check, a user that delays applying an upgrade until
    // after a subsequent upgrade is released will first apply a stale upgrade
    // and then download the next upgrade.
    // Note: depends on getAvailableCompleteUpgradeFile deleting VerifiedUpgradeFile
    // after upgrade is complete. Otherwise, no further upgrades would download.
    // TODO: implement version tracking for the verified upgrade file so that
    // we can proceed with downloading a newer upgrade when an outdated upgrade exists
    // on disk.

    if (!allowedToSelfUpgrade(context)) {
        log(context, R.string.upgrade_checker_no_upgrading, MyLog.Sensitivity.NOT_SENSITIVE, Log.WARN);
        return false;
    }

    if (UpgradeManager.UpgradeInstaller.upgradeFileAvailable(appContext)) {
        log(context, R.string.upgrade_checker_upgrade_file_exists, MyLog.Sensitivity.NOT_SENSITIVE, Log.WARN);
        // We know there's an upgrade file available, so send an intent about it.
        Intent intent = new Intent(appContext, UpgradeChecker.class);
        intent.setAction(UPGRADE_FILE_AVAILABLE_INTENT_ACTION);
        appContext.sendBroadcast(intent);
        return false;
    }

    // Verify if 'Download upgrades on WiFi only' user preference is on
    // but current network is not WiFi
    final AppPreferences multiProcessPreferences = new AppPreferences(appContext);
    if (multiProcessPreferences.getBoolean(context.getString(R.string.downloadWifiOnlyPreference),
            PsiphonConstants.DOWNLOAD_WIFI_ONLY_PREFERENCE_DEFAULT) && !Utils.isOnWiFi(appContext)) {
        log(context, R.string.upgrade_checker_upgrade_wifi_only, MyLog.Sensitivity.NOT_SENSITIVE, Log.WARN);
        return false;
    }

    log(appContext, R.string.upgrade_checker_check_needed, MyLog.Sensitivity.NOT_SENSITIVE, Log.WARN);

    return true;
}

From source file:com.trk.aboutme.facebook.SharedPreferencesTokenCachingStrategy.java

/**
 * Persists all supported data types present in the passed in Bundle, to the
 * cache/*from  w ww.ja v  a2  s  . c o m*/
 *
 * @param bundle
 *          The Bundle containing information to be cached
 */
public void save(Bundle bundle) {
    Validate.notNull(bundle, "bundle");

    SharedPreferences.Editor editor = cache.edit();

    for (String key : bundle.keySet()) {
        try {
            serializeKey(key, bundle, editor);
        } catch (JSONException e) {
            // Error in the bundle. Don't store a partial cache.
            Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG,
                    "Error processing value for key: '" + key + "' -- " + e);

            // Bypass the commit and just return. This cancels the entire edit transaction
            return;
        }
    }

    boolean successfulCommit = editor.commit();
    if (!successfulCommit) {
        Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG,
                "SharedPreferences.Editor.commit() was not successful");
    }
}