Java Code Examples for org.chromium.base.Log#v()

The following examples show how to use org.chromium.base.Log#v() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectivityTask.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the current task by calling the appropriate method on the
 * {@link ConnectivityChecker}.
 * The result will be put in {@link #mResult} when it comes back from the network stack.
 */
public void start(Profile profile, int timeoutMs) {
    Log.v(TAG, "Starting task for " + mType);
    switch (mType) {
        case CHROME_HTTP:
            ConnectivityChecker.checkConnectivityChromeNetworkStack(
                    profile, false, timeoutMs, this);
            break;
        case CHROME_HTTPS:
            ConnectivityChecker.checkConnectivityChromeNetworkStack(
                    profile, true, timeoutMs, this);
            break;
        case SYSTEM_HTTP:
            ConnectivityChecker.checkConnectivitySystemNetworkStack(false, timeoutMs, this);
            break;
        case SYSTEM_HTTPS:
            ConnectivityChecker.checkConnectivitySystemNetworkStack(true, timeoutMs, this);
            break;
        default:
            Log.e(TAG, "Failed to recognize type " + mType);
    }
}
 
Example 2
Source File: ConnectivityTask.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the current task by calling the appropriate method on the
 * {@link ConnectivityChecker}.
 * The result will be put in {@link #mResult} when it comes back from the network stack.
 */
public void start(Profile profile, int timeoutMs) {
    Log.v(TAG, "Starting task for " + mType);
    switch (mType) {
        case CHROME_HTTP:
            ConnectivityChecker.checkConnectivityChromeNetworkStack(
                    profile, false, timeoutMs, this);
            break;
        case CHROME_HTTPS:
            ConnectivityChecker.checkConnectivityChromeNetworkStack(
                    profile, true, timeoutMs, this);
            break;
        case SYSTEM_HTTP:
            ConnectivityChecker.checkConnectivitySystemNetworkStack(false, timeoutMs, this);
            break;
        case SYSTEM_HTTPS:
            ConnectivityChecker.checkConnectivitySystemNetworkStack(true, timeoutMs, this);
            break;
        default:
            Log.e(TAG, "Failed to recognize type " + mType);
    }
}
 
Example 3
Source File: ExternalAuthUtils.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Same as {@link #canUseGooglePlayServices(Context, UserRecoverableErrorHandler)}.
 * @param context The current context.
 * @param errorHandler How to handle user-recoverable errors; must be non-null.
 * @return the result code specifying Google Play Services availability.
 */
public int canUseGooglePlayServicesResultCode(
        final Context context, final UserRecoverableErrorHandler errorHandler) {
    final int resultCode = checkGooglePlayServicesAvailable(context);
    recordConnectionResult(resultCode);
    if (resultCode != ConnectionResult.SUCCESS) {
        // resultCode is some kind of error.
        Log.v(TAG, "Unable to use Google Play Services: %s", describeError(resultCode));

        if (isUserRecoverableError(resultCode)) {
            Runnable errorHandlerTask = new Runnable() {
                @Override
                public void run() {
                    errorHandler.handleError(context, resultCode);
                }
            };
            ThreadUtils.runOnUiThread(errorHandlerTask);
        }
    }
    return resultCode;
}
 
Example 4
Source File: PrecacheController.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Schedules a one-off task to finish precaching the resources that were
 * still outstanding when the last task was interrupted. Interrupting such
 * a one-off task will result in scheduling a new one.
 * @param context The application context.
 */
private static void schedulePrecacheCompletionTask(Context context) {
    Log.v(TAG, "scheduling a precache completion task");
    OneoffTask task = new OneoffTask.Builder()
                              .setExecutionWindow(COMPLETION_TASK_MIN_DELAY_SECONDS,
                                      COMPLETION_TASK_MAX_DELAY_SECONDS)
                              .setPersisted(true)
                              .setRequiredNetwork(OneoffTask.NETWORK_STATE_UNMETERED)
                              .setRequiresCharging(ChromeVersionInfo.isStableBuild())
                              .setService(ChromeBackgroundService.class)
                              .setTag(CONTINUATION_TASK_TAG)
                              .setUpdateCurrent(true)
                              .build();
    if (sTaskScheduler.scheduleTask(context, task)) {
        PrecacheUMA.record(PrecacheUMA.Event.ONEOFF_TASK_SCHEDULE);
    } else {
        PrecacheUMA.record(PrecacheUMA.Event.ONEOFF_TASK_SCHEDULE_FAIL);
    }
}
 
Example 5
Source File: ChromeBluetoothAdapter.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onScanResult(int callbackType, Wrappers.ScanResultWrapper result) {
    Log.v(TAG, "onScanResult %d %s %s", callbackType, result.getDevice().getAddress(),
            result.getDevice().getName());

    String[] uuid_strings;
    List<ParcelUuid> uuids = result.getScanRecord_getServiceUuids();

    if (uuids == null) {
        uuid_strings = new String[] {};
    } else {
        uuid_strings = new String[uuids.size()];
        for (int i = 0; i < uuids.size(); i++) {
            uuid_strings[i] = uuids.get(i).toString();
        }
    }

    nativeCreateOrUpdateDeviceOnScan(mNativeBluetoothAdapterAndroid,
            result.getDevice().getAddress(), result.getDevice(), result.getRssi(),
            uuid_strings, result.getScanRecord_getTxPowerLevel());
}
 
Example 6
Source File: PrecacheController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/** Begins a precache session. */
@VisibleForTesting
void startPrecaching() {
    Log.v(TAG, "precache session has started");

    mHandler.postDelayed(mTimeoutRunnable, MAX_PRECACHE_DURATION_SECONDS * 1000);
    PrecacheUMA.record(PrecacheUMA.Event.PRECACHE_SESSION_STARTED);

    // In certain cases, the PrecacheLauncher will skip precaching entirely and call
    // finishPrecaching() before this call to mPrecacheLauncher.start() returns, so the call to
    // mPrecacheLauncher.start() must happen after acquiring the wake lock to ensure that the
    // wake lock is released properly.
    mPrecacheLauncher.start();
}
 
Example 7
Source File: PrecacheController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Registers a BroadcastReceiver to detect when conditions become wrong
 * for precaching.
 */
private void registerDeviceStateReceiver() {
    Log.v(TAG, "registered device state receiver");
    IntentFilter filter = new IntentFilter();
    if (ChromeVersionInfo.isStableBuild()) {
        // Power requirement for precache is only for stable channel.
        filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
    }
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    mAppContext.registerReceiver(mDeviceStateReceiver, filter);
}
 
Example 8
Source File: ConnectivityTask.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onResult(int result) {
    ThreadUtils.assertOnUiThread();
    Log.v(TAG, "Got result for " + getHumanReadableType(mType) + ": result = "
                    + getHumanReadableResult(result));
    mResult.put(mType, result);
    if (isDone()) postCallbackResult();
}
 
Example 9
Source File: PrecacheController.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Registers a BroadcastReceiver to detect when conditions become wrong
 * for precaching.
 */
private void registerDeviceStateReceiver() {
    Log.v(TAG, "registered device state receiver");
    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    mAppContext.registerReceiver(mDeviceStateReceiver, filter);
}
 
Example 10
Source File: PrecacheController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Registers a BroadcastReceiver to detect when conditions become wrong
 * for precaching.
 */
private void registerDeviceStateReceiver() {
    Log.v(TAG, "registered device state receiver");
    IntentFilter filter = new IntentFilter();
    if (ChromeVersionInfo.isStableBuild()) {
        // Power requirement for precache is only for stable channel.
        filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
    }
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    mAppContext.registerReceiver(mDeviceStateReceiver, filter);
}
 
Example 11
Source File: ChromeBluetoothRemoteGattDescriptor.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private ChromeBluetoothRemoteGattDescriptor(long nativeBluetoothRemoteGattDescriptorAndroid,
        Wrappers.BluetoothGattDescriptorWrapper descriptorWrapper,
        ChromeBluetoothDevice chromeDevice) {
    mNativeBluetoothRemoteGattDescriptorAndroid = nativeBluetoothRemoteGattDescriptorAndroid;
    mDescriptor = descriptorWrapper;
    mChromeDevice = chromeDevice;

    mChromeDevice.mWrapperToChromeDescriptorsMap.put(descriptorWrapper, this);

    Log.v(TAG, "ChromeBluetoothRemoteGattDescriptor created.");
}
 
Example 12
Source File: PrecacheController.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    Log.v(TAG, "conditions changed: precaching(%s), powered(%s), unmetered(%s)",
            isPrecaching(), mDeviceState.isPowerConnected(context),
            mDeviceState.isUnmeteredNetworkAvailable(context));
    if (isPrecaching() && (!mDeviceState.isPowerConnected(context)
            || !mDeviceState.isUnmeteredNetworkAvailable(context))) {
        recordFailureReasons(context);
        cancelPrecaching(!mDeviceState.isPowerConnected(context)
                ? PrecacheUMA.Event.PRECACHE_CANCEL_NO_POWER
                : PrecacheUMA.Event.PRECACHE_CANCEL_NO_UNMETERED_NETWORK);
    }
}
 
Example 13
Source File: PrecacheController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Sets whether or not precaching is enabled. If precaching is enabled, a
 * periodic precaching task will be scheduled to run. If disabled, any
 * running precache session will be stopped, and all tasks canceled.
 */
public static void setIsPrecachingEnabled(Context context, boolean enabled) {
    boolean cancelRequired = !enabled && PrecacheController.hasInstance();
    Context appContext = context.getApplicationContext();

    SharedPreferences sharedPreferences = ContextUtils.getAppSharedPreferences();
    if (sharedPreferences.getBoolean(PREF_IS_PRECACHING_ENABLED, !enabled) == enabled) {
        return;
    }

    Log.v(TAG, "setting precache enabled to %s", enabled);
    sharedPreferences.edit().putBoolean(PREF_IS_PRECACHING_ENABLED, enabled).apply();

    if (enabled) {
        if (!schedulePeriodicPrecacheTask(appContext)) {
            // Clear the preference, for the task to be scheduled next time.
            sharedPreferences.edit().putBoolean(PREF_IS_PRECACHING_ENABLED, false).apply();
            PrecacheUMA.record(PrecacheUMA.Event.PERIODIC_TASK_SCHEDULE_STARTUP_FAIL);
        } else {
            PrecacheUMA.record(PrecacheUMA.Event.PERIODIC_TASK_SCHEDULE_STARTUP);
        }
    } else {
        // If precaching, stop.
        cancelPeriodicPrecacheTask(appContext);
        cancelPrecacheCompletionTask(appContext);
    }
    if (cancelRequired) {
        sInstance.cancelPrecaching(PrecacheUMA.Event.PRECACHE_CANCEL_DISABLED_PREF);
    }
}
 
Example 14
Source File: ChromeUsbInterface.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private ChromeUsbInterface(UsbInterface iface) {
    mInterface = iface;
    Log.v(TAG, "ChromeUsbInterface created.");
}
 
Example 15
Source File: PrecacheController.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
protected void onPrecacheCompleted(boolean tryAgainSoon) {
    Log.v(TAG, "precache session completed");
    handlePrecacheCompleted(tryAgainSoon);
}
 
Example 16
Source File: PrecacheController.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void run() {
    Log.v(TAG, "precache session timed out");
    cancelPrecaching(PrecacheUMA.Event.PRECACHE_SESSION_TIMEOUT);
}
 
Example 17
Source File: PrecacheController.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private static void cancelPrecacheCompletionTask(Context context) {
    Log.v(TAG, "canceling a precache completion task");
    sTaskScheduler.cancelTask(context, CONTINUATION_TASK_TAG);
}
 
Example 18
Source File: PrecacheController.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private static void cancelPeriodicPrecacheTask(Context context) {
    Log.v(TAG, "canceling a periodic precache task");
    sTaskScheduler.cancelTask(context, PERIODIC_TASK_TAG);
}
 
Example 19
Source File: ChromeUsbEndpoint.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private ChromeUsbEndpoint(UsbEndpoint endpoint) {
    mEndpoint = endpoint;
    Log.v(TAG, "ChromeUsbEndpoint created.");
}
 
Example 20
Source File: PrecacheController.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void run() {
    Log.v(TAG, "precache session timed out");
    cancelPrecaching(PrecacheUMA.Event.PRECACHE_SESSION_TIMEOUT);
}