Example usage for android.util Log VERBOSE

List of usage examples for android.util Log VERBOSE

Introduction

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

Prototype

int VERBOSE

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

Click Source Link

Document

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

Usage

From source file:com.android.providers.contacts.ContactsSyncAdapter.java

private void getServerPhotos(SyncContext context, String feedUrl, int maxDownloads, GDataSyncData syncData,
        SyncResult syncResult) {// w w  w .j  a va 2  s.com
    final ContentResolver cr = getContext().getContentResolver();
    Cursor cursor = cr.query(Photos.CONTENT_URI,
            new String[] { Photos._SYNC_ID, Photos._SYNC_VERSION, Photos.PERSON_ID, Photos.DOWNLOAD_REQUIRED,
                    Photos._ID },
            "" + "_sync_account=? AND download_required != 0", new String[] { getAccount() }, null);
    try {
        int numFetched = 0;
        while (cursor.moveToNext()) {
            if (numFetched >= maxDownloads) {
                break;
            }
            String photoSyncId = cursor.getString(0);
            String photoVersion = cursor.getString(1);
            long person = cursor.getLong(2);
            String photoUrl = feedUrl + "/" + photoSyncId;
            long photoId = cursor.getLong(4);

            try {
                context.setStatusText("Downloading photo " + photoSyncId);
                ++numFetched;
                ++mPhotoDownloads;
                InputStream inputStream = mContactsClient.getMediaEntryAsStream(photoUrl, getAuthToken());
                savePhoto(person, inputStream, photoVersion);
                syncResult.stats.numUpdates++;
            } catch (IOException e) {
                if (Log.isLoggable(TAG, Log.VERBOSE)) {
                    Log.d(TAG, "error downloading " + photoUrl, e);
                }
                syncResult.stats.numIoExceptions++;
                return;
            } catch (HttpException e) {
                switch (e.getStatusCode()) {
                case HttpException.SC_UNAUTHORIZED:
                    if (Config.LOGD) {
                        Log.d(TAG, "not authorized to download " + photoUrl, e);
                    }
                    syncResult.stats.numAuthExceptions++;
                    return;
                case HttpException.SC_FORBIDDEN:
                case HttpException.SC_NOT_FOUND:
                    final String exceptionMessage = e.getMessage();
                    if (Config.LOGD) {
                        Log.d(TAG, "unable to download photo " + photoUrl + ", " + exceptionMessage
                                + ", ignoring");
                    }
                    ContentValues values = new ContentValues();
                    values.put(Photos.SYNC_ERROR, exceptionMessage);
                    Uri photoUri = Uri.withAppendedPath(ContentUris.withAppendedId(People.CONTENT_URI, photoId),
                            Photos.CONTENT_DIRECTORY);
                    cr.update(photoUri, values, null /* where */, null /* where args */);
                    break;
                default:
                    if (Config.LOGD) {
                        Log.d(TAG, "error downloading " + photoUrl, e);
                    }
                    syncResult.stats.numIoExceptions++;
                    return;
                }
            }
        }
        final boolean hasMoreToSync = numFetched < cursor.getCount();
        GDataSyncData.FeedData feedData = new GDataSyncData.FeedData(0 /* no update time */, numFetched,
                hasMoreToSync, null /* no lastId */, 0 /* no feed index */);
        syncData.feedData.put(feedUrl, feedData);
    } finally {
        cursor.close();
    }
}

From source file:com.google.android.dialer.provider.DialerProvider.java

private Cursor handleFilter(String[] projection, String filter, int limitInt, Location lastLocation) {
    if (Log.isLoggable("DialerProvider", Log.VERBOSE)) {
        Log.v("DialerProvider", "handleFilter(" + filter + ")");
    }//  w  ww.ja v a  2  s. co  m

    if (filter != null) {
        JSONArray response = null;

        try {
            filter = URLDecoder.decode(filter, "UTF-8");
            ContentResolver resolver = getContext().getContentResolver();

            int minQueryLen = com.google.android.gsf.Gservices.getInt(resolver,
                    "dialer_nearby_places_min_query_len", 2);
            int maxQueryLen = com.google.android.gsf.Gservices.getInt(resolver,
                    "dialer_nearby_places_max_query_len", 50);
            int radius = com.google.android.gsf.Gservices.getInt(resolver,
                    "dialer_nearby_places_directory_radius_meters", 1000);

            int length = filter.length();
            if (length >= minQueryLen) {
                if (length > maxQueryLen) {
                    filter = filter.substring(0, maxQueryLen);
                }

                Uri.Builder builder = Uri
                        .parse(rewriteUrl("https://www.google.com/complete/search?gs_ri=dialer")).buildUpon()
                        .appendQueryParameter("q", filter).appendQueryParameter("hl",
                                getContext().getResources().getConfiguration().locale.getLanguage());

                builder = builder
                        .appendQueryParameter("sll",
                                String.format("%f,%f", lastLocation.getLatitude(), lastLocation.getLongitude()))
                        .appendQueryParameter("radius", Integer.toString(radius))
                        .appendQueryParameter("gs_gbg", getRandomNoiseString());

                response = getSuggestResponseInJsonArrayFormat(builder.build());

                if (Log.isLoggable("DialerProvider", Log.VERBOSE)) {
                    Log.v("DialerProvider", "Results: " + response);
                }

                Cursor cur = buildResultCursor(projection, response, limitInt);
                if (Log.isLoggable("DialerProvider", Log.VERBOSE)) {
                    Log.v("DialerProvider", "handleFilter(" + filter + "): " + cur.getCount() + " matches");
                }

                return cur;
            }
        } catch (UnsupportedEncodingException e) {
            // TODO: Something should probably go here
        } catch (IOException e) {
            Log.e("DialerProvider", "Failed to execute query", e);
        } catch (JSONException e) {
            Log.e("DialerProvider", "Invalid response to query: " + response, e);
        }
    }

    return null;
}

From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java

/**
 * Outputs the node tree from the current node using dfs preorder
 * traversal.//from  w ww  .ja  va 2  s  .c  o m
 */
private void printNodes() {
    HashSet<AccessibilityNodeInfo> seen = new HashSet<AccessibilityNodeInfo>();
    if (mCurrentNode == null) {
        LogUtils.log(this, Log.VERBOSE, "No current node");
        return;
    }
    LogUtils.log(this, Log.VERBOSE, "Printing nodes");
    printNodeTree(AccessibilityNodeInfo.obtain(mCurrentNode), "", seen);
    for (AccessibilityNodeInfo node : seen) {
        node.recycle();
    }
}

From source file:com.dh.perfectoffer.event.framework.net.network.NetworkConnectionImpl.java

private static void logResBodyAndHeader(HttpURLConnection connection, String body) {
    if (L.canLog(Log.VERBOSE)) {
        L.v(TAG, "Response body: ");

        int pos = 0;
        int bodyLength = body.length();
        while (pos < bodyLength) {
            L.v(TAG, body.substring(pos, Math.min(bodyLength - 1, pos + 200)));
            pos = pos + 200;//www  .  j  a v a  2 s.com
        }

        L.v(TAG, "Response Header: ");
        Map<String, List<String>> headerFields = connection.getHeaderFields();
        for (Entry<String, List<String>> en : headerFields.entrySet()) {
            L.v(TAG, "key=" + en.getKey() + ",value=" + en.getValue());
        }
    }
}

From source file:com.android.utils.AccessibilityNodeInfoUtils.java

private static boolean isSpeakingNode(AccessibilityNodeInfoCompat node,
        Map<AccessibilityNodeInfoCompat, Boolean> speakingNodeCache,
        Set<AccessibilityNodeInfoCompat> visitedNodes) {
    if (speakingNodeCache != null && speakingNodeCache.containsKey(node)) {
        return speakingNodeCache.get(node);
    }/*from  w ww .j  a va 2s  .  co m*/

    boolean result = false;
    if (hasText(node)) {
        LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Speaking, has text");
        result = true;
    } else if (node.isCheckable()) { // Special case for check boxes.
        LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Speaking, is checkable");
        result = true;
    } else if (WebInterfaceUtils.hasLegacyWebContent(node)) { // Special case for web content.
        LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Speaking, has web content");
        result = true;
    } else if (hasNonActionableSpeakingChildren(node, speakingNodeCache, visitedNodes)) {
        // Special case for containers with non-focusable content.
        LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
                "Speaking, has non-actionable speaking children");
        result = true;
    }

    if (speakingNodeCache != null) {
        speakingNodeCache.put(node, result);
    }

    return result;
}

From source file:com.dh.superxz_bottom.framework.net.network.NetworkConnectionImpl.java

private static void logResBodyAndHeader(HttpURLConnection connection, String body) {
    if (L.canLog(Log.VERBOSE)) {
        L.v(TAG, "Response body: ");

        int pos = 0;
        int bodyLength = body.length();
        while (pos < bodyLength) {
            L.v(TAG, body.substring(pos, Math.min(bodyLength - 1, pos + 200)));
            pos = pos + 200;/*from w  ww  . j  av a2s . co  m*/
        }

        L.v(TAG, "Response Header: ");
        Map<String, List<String>> headerFields = connection.getHeaderFields();
        for (Map.Entry<String, List<String>> en : headerFields.entrySet()) {
            L.v(TAG, "key=" + en.getKey() + ",value=" + en.getValue());
        }
    }
}

From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java

private void printNodeTree(AccessibilityNodeInfo node, String indent, HashSet<AccessibilityNodeInfo> seen) {
    if (node == null) {
        return;//from   ww  w .  j a  v a2 s. c  o  m
    }
    if (!seen.add(node)) {
        LogUtils.log(this, Log.VERBOSE, "Cycle: %d", node.hashCode());
        return;
    }
    // Include the hash code as a "poor man's" id, knowing that it
    // might not always be unique.
    LogUtils.log(this, Log.VERBOSE, "%s(%d)%s", indent, node.hashCode(), formatNode(node));
    int childCount = node.getChildCount();
    String childIndent = indent + "  ";
    for (int i = 0; i < childCount; ++i) {
        AccessibilityNodeInfo child = node.getChild(i);
        if (child == null) {
            LogUtils.log(this, Log.VERBOSE, "%sCouldn't get child %d", indent, i);
            continue;
        }
        printNodeTree(child, childIndent, seen);
    }
}

From source file:com.moez.QKSMS.model.MediaModelFactory.java

private static MediaModel getGenericMediaModel(Context context, String tag, String src, SMILMediaElement sme,
        PduPart part, RegionModel regionModel) throws IOException, MmsException {
    byte[] bytes = part.getContentType();
    if (bytes == null) {
        throw new IllegalArgumentException("Content-Type of the part may not be null.");
    }/* ww  w.ja v a2 s.  com*/

    String contentType = new String(bytes);
    MediaModel media;

    switch (tag) {
    case SmilHelper.ELEMENT_TAG_TEXT:
        media = new TextModel(context, contentType, src, part.getCharset(), part.getData(), regionModel);
        break;
    case SmilHelper.ELEMENT_TAG_IMAGE:
        media = new ImageModel(context, contentType, src, part.getDataUri(), regionModel);
        break;
    case SmilHelper.ELEMENT_TAG_VIDEO:
        media = new VideoModel(context, contentType, src, part.getDataUri(), regionModel);
        break;
    case SmilHelper.ELEMENT_TAG_AUDIO:
        media = new AudioModel(context, contentType, src, part.getDataUri());
        break;
    case SmilHelper.ELEMENT_TAG_REF:
        if (ContentType.isTextType(contentType)) {
            media = new TextModel(context, contentType, src, part.getCharset(), part.getData(), regionModel);
        } else if (ContentType.isImageType(contentType)) {
            media = new ImageModel(context, contentType, src, part.getDataUri(), regionModel);
        } else if (ContentType.isVideoType(contentType)) {
            media = new VideoModel(context, contentType, src, part.getDataUri(), regionModel);
        } else if (ContentType.isAudioType(contentType)) {
            media = new AudioModel(context, contentType, src, part.getDataUri());
        } else {
            Log.d(TAG, "[MediaModelFactory] getGenericMediaModel Unsupported Content-Type: " + contentType);
            media = createEmptyTextModel(context, regionModel);
        }
        break;
    default:
        throw new IllegalArgumentException("Unsupported TAG: " + tag);
    }

    // Set 'begin' property.
    int begin = 0;
    TimeList tl = sme.getBegin();
    if ((tl != null) && (tl.getLength() > 0)) {
        // We only support a single begin value.
        Time t = tl.item(0);
        begin = (int) (t.getResolvedOffset() * 1000);
    }
    media.setBegin(begin);

    // Set 'duration' property.
    int duration = (int) (sme.getDur() * 1000);
    if (duration <= 0) {
        tl = sme.getEnd();
        if ((tl != null) && (tl.getLength() > 0)) {
            // We only support a single end value.
            Time t = tl.item(0);
            if (t.getTimeType() != Time.SMIL_TIME_INDEFINITE) {
                duration = (int) (t.getResolvedOffset() * 1000) - begin;

                if (duration == 0 && (media instanceof AudioModel || media instanceof VideoModel)) {
                    duration = MmsConfig.getMinimumSlideElementDuration();
                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
                        Log.v(TAG, "[MediaModelFactory] compute new duration for " + tag + ", duration="
                                + duration);
                    }
                }
            }
        }
    }

    media.setDuration(duration);

    if (!MmsConfig.getSlideDurationEnabled()) {
        /**
         * Because The slide duration is not supported by mmsc,
         * the device has to set fill type as FILL_FREEZE.
         * If not, the media will disappear while rotating the screen
         * in the slide show play view.
         */
        media.setFill(SMILMediaElement.FILL_FREEZE);
    } else {
        // Set 'fill' property.
        media.setFill(sme.getFill());
    }
    return media;
}

From source file:com.googlecode.eyesfree.brailleback.BrailleIME.java

private boolean sendAndroidKeyInternal(int keyCode) {
    LogUtils.log(this, Log.VERBOSE, "sendAndroidKey: %d", keyCode);
    InputConnection ic = getCurrentInputConnection();
    if (ic == null) {
        return false;
    }// w  w w .ja v a2 s . c  om
    long eventTime = SystemClock.uptimeMillis();
    if (!ic.sendKeyEvent(new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_DOWN, keyCode, 0 /*repeat*/))) {
        return false;
    }
    return ic.sendKeyEvent(new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_UP, keyCode, 0 /*repeat*/));
}

From source file:com.android.utils.AccessibilityNodeInfoUtils.java

private static boolean hasNonActionableSpeakingChildren(AccessibilityNodeInfoCompat node,
        Map<AccessibilityNodeInfoCompat, Boolean> speakingNodeCache,
        Set<AccessibilityNodeInfoCompat> visitedNodes) {
    final int childCount = node.getChildCount();

    AccessibilityNodeInfoCompat child;/*from   w  w  w . j  a va 2s  .  co m*/

    // Has non-actionable, speaking children?
    for (int i = 0; i < childCount; i++) {
        child = node.getChild(i);

        if (child == null) {
            LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Child %d is null, skipping it", i);
            continue;
        }

        if (!visitedNodes.add(child)) {
            child.recycle();
            return false;
        }

        // Ignore invisible nodes.
        if (!isVisible(child)) {
            LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Child %d is invisible, skipping it",
                    i);
            continue;
        }

        // Ignore focusable nodes.
        if (isAccessibilityFocusableInternal(child, speakingNodeCache, visitedNodes)) {
            LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Child %d is focusable, skipping it",
                    i);
            continue;
        }

        // Recursively check non-focusable child nodes.
        if (isSpeakingNode(child, speakingNodeCache, visitedNodes)) {
            LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
                    "Does have actionable speaking children (child %d)", i);
            return true;
        }
    }

    LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE,
            "Does not have non-actionable speaking children");
    return false;
}