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.googlecode.eyesfree.brailleback.DisplayManager.java

@Override
public void onInputEvent(BrailleInputEvent event) {
    keepAwake();//w w w  .ja  v  a 2  s  .c o m
    LogUtils.log(this, Log.VERBOSE, "InputEvent: %s", event);
    // We're called from within the handler thread, so we forward
    // the call only if we are going to invoke the user's callback.
    switch (event.getCommand()) {
    case BrailleInputEvent.CMD_NAV_PAN_LEFT:
        panLeft();
        break;
    case BrailleInputEvent.CMD_NAV_PAN_RIGHT:
        panRight();
        break;
    default:
        sendMappedEvent(event);
        break;
    }
}

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

private String rewriteUrl(String url) throws IOException {
    UrlRules.Rule rule = UrlRules.getRules(getContext().getContentResolver()).matchRule(url);
    String newUrl = rule.apply(url);

    if (newUrl == null) {
        Log.w("DialerProvider", "Blocked by " + rule.mName + ": " + url);
        throw new IOException("Blocked by rule: " + rule.mName);
    }/*from w  ww  .  j a  v  a 2 s .c  o  m*/

    if (Log.isLoggable("DialerProvider", Log.VERBOSE)) {
        Log.v("DialerProvider", "Rule " + rule.mName + ": " + url + " -> " + newUrl);
    }
    return newUrl;
}

From source file:com.googlecode.eyesfree.testing.BaseAccessibilityInstrumentationTestCase.java

/**
 * Attempts to obtain a null instance of {@link TestAccessibilityService}.
 * <p>//from w w w  .  j a va 2s  . c  o m
 * May block for up to {@link #OBTAIN_SERVICE_TIMEOUT} seconds, and may
 * return {@code null} if the service is not running.
 */
private boolean obtainNullTargetServiceSync() {
    boolean success = false;

    final long startTime = SystemClock.uptimeMillis();
    try {
        while (true) {
            final AccessibilityService service = getService();
            if (service == null) {
                break;
            }

            final long timeElapsed = (SystemClock.uptimeMillis() - startTime);
            final long timeLeft = (OBTAIN_SERVICE_TIMEOUT - timeElapsed);
            if (timeLeft <= 0) {
                break;
            }

            final long timeToWait = Math.min(OBTAIN_SERVICE_RETRY, timeLeft);
            Thread.sleep(timeToWait);
        }
    } catch (InterruptedException e) {
        // Do nothing.
    }

    LogUtils.log(this, Log.VERBOSE, "Took %d ms to obtain null service",
            (SystemClock.uptimeMillis() - startTime));

    return success;
}

From source file:com.digipom.manteresting.android.fragment.NailFragment.java

@Override
public void onDestroyView() {
    if (LoggerConfig.canLog(Log.VERBOSE)) {
        Log.d(TAG, "onDestroyView()");
    }//from   w  w  w. ja  v  a  2 s. co  m

    super.onDestroyView();

    // Make sure adapter's cursor has been released, otherwise we can get
    // exceptions as the old adapter still receives events.
    nailAdapter.swapCursor(null);

    serviceConnector.unbindService();
}

From source file:com.android.launcher3.Utilities.java

public static boolean isPropertyEnabled(String propertyName) {
    return Log.isLoggable(propertyName, Log.VERBOSE);
}

From source file:com.xorcode.andtweet.TweetListActivity.java

/**
 * Listener that checks for clicks on the main list view.
 * //from   w w  w.j a  v  a2  s  .co  m
 * @param adapterView
 * @param view
 * @param position
 * @param id
 */
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    if (MyLog.isLoggable(TAG, Log.VERBOSE)) {
        Log.v(TAG, "onItemClick, id=" + id);
    }
    if (id <= 0) {
        return;
    }
    Uri uri = ContentUris.withAppendedId(Tweets.CONTENT_URI, id);
    String action = getIntent().getAction();
    if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_GET_CONTENT.equals(action)) {
        if (MyLog.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "onItemClick, setData=" + uri);
        }
        setResult(RESULT_OK, new Intent().setData(uri));
    } else {
        if (MyLog.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "onItemClick, startActivity=" + uri);
        }
        startActivity(new Intent(Intent.ACTION_VIEW, uri));
    }
}

From source file:com.googlecode.eyesfree.testing.BaseAccessibilityInstrumentationTestCase.java

/**
 * Attempts to obtain an instance of {@link TestAccessibilityService}.
 * <p>//w w w  . jav  a  2  s  . co m
 * May block for up to {@link #OBTAIN_SERVICE_TIMEOUT} seconds, and may
 * return {@code null} if the service is not running.
 */
private boolean obtainTargetServiceSync() {
    boolean success = false;

    final long startTime = SystemClock.uptimeMillis();
    try {
        while (true) {
            final AccessibilityService service = getService();
            if (service != null) {
                break;
            }

            final long timeElapsed = (SystemClock.uptimeMillis() - startTime);
            final long timeLeft = (OBTAIN_SERVICE_TIMEOUT - timeElapsed);
            if (timeLeft <= 0) {
                break;
            }

            final long timeToWait = Math.min(OBTAIN_SERVICE_RETRY, timeLeft);
            Thread.sleep(timeToWait);
        }
    } catch (InterruptedException e) {
        // Do nothing.
    }

    LogUtils.log(this, Log.VERBOSE, "Took %d ms to obtain service", (SystemClock.uptimeMillis() - startTime));

    return success;
}

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

@Override
public Cursor query(Uri uri, final String[] projection, String selection, String[] selectionArgs,
        String sortOrder) {//  w  w  w  .j  a v a 2 s  .  co m
    if (Log.isLoggable("DialerProvider", 2)) {
        Log.v("DialerProvider", "query: " + uri);
    }

    switch (sURIMatcher.match(uri)) {
    case 0:
        Context context = getContext();
        if (!GoogleLocationSettingHelper.isGoogleLocationServicesEnabled(context)
                || !GoogleLocationSettingHelper.isSystemLocationSettingEnabled(context)) {
            if (Log.isLoggable("DialerProvider", Log.VERBOSE)) {
                Log.v("DialerProvider", "Location settings is disabled, ignoring query.");
            }
            return null;
        }

        final Location lastLocation = getLastLocation();
        if (lastLocation == null) {
            if (Log.isLoggable("DialerProvider", Log.VERBOSE)) {
                Log.v("DialerProvider", "No location available, ignoring query.");
            }
            return null;
        }

        final String filter = Uri.encode(uri.getLastPathSegment());
        String limit = uri.getQueryParameter("limit");

        try {
            final int limitInt;
            if (limit == null) {
                limitInt = -1;
            } else {
                limitInt = Integer.parseInt(limit);
            }

            return execute(new Callable<Cursor>() {
                @Override
                public Cursor call() {
                    return handleFilter(projection, filter, limitInt, lastLocation);
                }
            }, "FilterThread", 10000L, TimeUnit.MILLISECONDS);
        } catch (NumberFormatException e) {
            Log.e("DialerProvider", "query: invalid limit parameter: '" + limit + "'");
        }

        break;
    }

    // TODO: Is this acceptable?
    return null;
}

From source file:com.google.android.marvin.mytalkback.TalkBackService.java

@Override
protected boolean onGesture(int gestureId) {
    if (!isServiceActive()) {
        // Allow other services with touch exploration to handle gestures
        return false;
    }/*from   w  w  w .  ja v  a 2s .  c  om*/

    LogUtils.log(this, Log.VERBOSE, "Recognized gesture %s", gestureId);

    mFeedbackController.playAuditory(R.id.sounds_gesture_end);

    // Gestures always stop global speech on API 16. On API 17+ we silence
    // on TOUCH_INTERACTION_START.
    // TODO: Will this negatively affect something like Books?
    if (Build.VERSION.SDK_INT <= 16) {
        interruptAllFeedback();
    }

    mRadialMenuManager.dismissAll();

    boolean handled = true;
    boolean result = false;

    // Handle statically defined gestures.
    switch (gestureId) {
    case AccessibilityService.GESTURE_SWIPE_UP:
    case AccessibilityService.GESTURE_SWIPE_LEFT:
        result = mCursorController.previous(true /* shouldWrap */, true /* shouldScroll */);
        break;
    case AccessibilityService.GESTURE_SWIPE_DOWN:
    case AccessibilityService.GESTURE_SWIPE_RIGHT:
        result = mCursorController.next(true /* shouldWrap */, true /* shouldScroll */);
        break;
    case AccessibilityService.GESTURE_SWIPE_UP_AND_DOWN:
        // TODO(caseyburkhardt): Consider using existing custom gesture mechanism
        if (mVerticalGestureCycleGranularity) {
            result = mCursorController.previousGranularity();
        } else {
            result = mCursorController.jumpToTop();
        }
        break;
    case AccessibilityService.GESTURE_SWIPE_DOWN_AND_UP:
        if (mVerticalGestureCycleGranularity) {
            result = mCursorController.nextGranularity();
        } else {
            result = mCursorController.jumpToBottom();
        }
        break;
    case AccessibilityService.GESTURE_SWIPE_LEFT_AND_RIGHT:
        result = mCursorController.less();
        break;
    case AccessibilityService.GESTURE_SWIPE_RIGHT_AND_LEFT:
        result = mCursorController.more();
        break;
    default:
        handled = false;
    }

    if (handled) {
        if (!result) {
            mFeedbackController.playAuditory(R.id.sounds_complete);
        }
        return true;
    }

    // Handle user-definable gestures.
    switch (gestureId) {
    case AccessibilityService.GESTURE_SWIPE_DOWN_AND_LEFT:
        performCustomGesture(R.string.pref_shortcut_down_and_left_key,
                R.string.pref_shortcut_down_and_left_default);
        return true;
    case AccessibilityService.GESTURE_SWIPE_DOWN_AND_RIGHT:
        performCustomGesture(R.string.pref_shortcut_down_and_right_key,
                R.string.pref_shortcut_down_and_right_default);
        return true;
    case AccessibilityService.GESTURE_SWIPE_UP_AND_LEFT:
        performCustomGesture(R.string.pref_shortcut_up_and_left_key,
                R.string.pref_shortcut_up_and_left_default);
        return true;
    case AccessibilityService.GESTURE_SWIPE_UP_AND_RIGHT:
        performCustomGesture(R.string.pref_shortcut_up_and_right_key,
                R.string.pref_shortcut_up_and_right_default);
        return true;
    case AccessibilityService.GESTURE_SWIPE_RIGHT_AND_DOWN:
        performCustomGesture(R.string.pref_shortcut_right_and_down_key,
                R.string.pref_shortcut_right_and_down_default);
        return true;
    case AccessibilityService.GESTURE_SWIPE_RIGHT_AND_UP:
        performCustomGesture(R.string.pref_shortcut_right_and_up_key,
                R.string.pref_shortcut_right_and_up_default);
        return true;
    case AccessibilityService.GESTURE_SWIPE_LEFT_AND_DOWN:
        performCustomGesture(R.string.pref_shortcut_left_and_down_key,
                R.string.pref_shortcut_left_and_down_default);
        return true;
    case AccessibilityService.GESTURE_SWIPE_LEFT_AND_UP:
        performCustomGesture(R.string.pref_shortcut_left_and_up_key,
                R.string.pref_shortcut_left_and_up_default);
        return true;
    }

    // Never let the system handle gestures.
    return true;
}

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

protected void sendClientPhotos(SyncContext context, ContentProvider clientDiffs, Object syncInfo,
        SyncResult syncResult) {/*from   w  ww.j ava  2s.  c  o m*/
    Entry entry = new MediaEntry();

    GDataServiceClient client = getGDataServiceClient();
    String authToken = getAuthToken();
    ContentResolver cr = getContext().getContentResolver();
    final String account = getAccount();

    Cursor c = clientDiffs.query(Photos.CONTENT_URI, null /* all columns */, null /* no where */,
            null /* no where args */, null /* default sort order */);
    try {
        int personColumn = c.getColumnIndexOrThrow(Photos.PERSON_ID);
        int dataColumn = c.getColumnIndexOrThrow(Photos.DATA);
        int numRows = c.getCount();
        while (c.moveToNext()) {
            if (mSyncCanceled) {
                if (Config.LOGD)
                    Log.d(TAG, "stopping since the sync was canceled");
                break;
            }

            entry.clear();
            context.setStatusText("Updating, " + (numRows - 1) + " to go");

            cursorToBaseEntry(entry, account, c);
            String editUrl = entry.getEditUri();

            if (TextUtils.isEmpty(editUrl)) {
                if (Config.LOGD) {
                    Log.d(TAG, "skipping photo edit for unsynced contact");
                }
                continue;
            }

            // Send the request and receive the response
            InputStream inputStream = null;
            byte[] imageData = c.getBlob(dataColumn);
            if (imageData != null) {
                inputStream = new ByteArrayInputStream(imageData);
            }
            Uri photoUri = Uri.withAppendedPath(People.CONTENT_URI,
                    c.getString(personColumn) + "/" + Photos.CONTENT_DIRECTORY);
            try {
                if (inputStream != null) {
                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
                        Log.v(TAG, "Updating photo " + entry.toString());
                    }
                    ++mPhotoUploads;
                    client.updateMediaEntry(editUrl, inputStream, IMAGE_MIME_TYPE, authToken);
                } else {
                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
                        Log.v(TAG, "Deleting photo " + entry.toString());
                    }
                    client.deleteEntry(editUrl, authToken);
                }

                // Mark that this photo is no longer dirty. The next time we sync (which
                // should be soon), we will get the new version of the photo and whether
                // or not there is a new one to download (e.g. if we deleted our version
                // yet there is an evergreen version present).
                ContentValues values = new ContentValues();
                values.put(Photos.EXISTS_ON_SERVER, inputStream == null ? 0 : 1);
                values.put(Photos._SYNC_DIRTY, 0);
                if (cr.update(photoUri, values, null /* no where */, null /* no where args */) != 1) {
                    Log.e(TAG, "error updating photo " + photoUri + " with values " + values);
                    syncResult.stats.numParseExceptions++;
                } else {
                    syncResult.stats.numUpdates++;
                }
                continue;
            } catch (ParseException e) {
                Log.e(TAG, "parse error during update of " + ", skipping");
                syncResult.stats.numParseExceptions++;
            } catch (IOException e) {
                if (Config.LOGD) {
                    Log.d(TAG, "io error during update of " + entry.toString() + ", skipping");
                }
                syncResult.stats.numIoExceptions++;
            } catch (HttpException e) {
                switch (e.getStatusCode()) {
                case HttpException.SC_UNAUTHORIZED:
                    if (syncResult.stats.numAuthExceptions == 0) {
                        if (Config.LOGD) {
                            Log.d(TAG, "auth error during update of " + entry + ", skipping");
                        }
                    }
                    syncResult.stats.numAuthExceptions++;
                    try {
                        GoogleLoginServiceBlockingHelper.invalidateAuthToken(getContext(), authToken);
                    } catch (GoogleLoginServiceNotFoundException e1) {
                        if (Config.LOGD) {
                            Log.d(TAG, "could not invalidate auth token", e1);
                        }
                    }
                    return;

                case HttpException.SC_CONFLICT:
                    if (Config.LOGD) {
                        Log.d(TAG, "conflict detected during update of " + entry + ", skipping");
                    }
                    syncResult.stats.numConflictDetectedExceptions++;
                    break;
                case HttpException.SC_BAD_REQUEST:
                case HttpException.SC_FORBIDDEN:
                case HttpException.SC_NOT_FOUND:
                case HttpException.SC_INTERNAL_SERVER_ERROR:
                default:
                    if (Config.LOGD) {
                        Log.d(TAG, "error " + e.getMessage() + " during update of " + entry.toString()
                                + ", skipping");
                    }
                    syncResult.stats.numIoExceptions++;
                }
            }
        }
    } finally {
        c.close();
    }
}