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

The following examples show how to use org.chromium.base.Log#i() . 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: LegacyLinker.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieve the base load address of all shared RELRO sections.
 * This also enforces the creation of shared RELRO sections in
 * prepareLibraryLoad(), which can later be retrieved with getSharedRelros().
 *
 * @return a common, random base load address, or 0 if RELRO sharing is
 * disabled.
 */
@Override
public long getBaseLoadAddress() {
    synchronized (mLock) {
        ensureInitializedLocked();
        if (!mInBrowserProcess) {
            Log.w(TAG, "Shared RELRO sections are disabled in this process!");
            return 0;
        }

        setupBaseLoadAddressLocked();
        if (DEBUG) {
            Log.i(TAG, String.format(
                    Locale.US, "getBaseLoadAddress() returns 0x%x",
                    mBaseLoadAddress));
        }
        return mBaseLoadAddress;
    }
}
 
Example 2
Source File: LogcatExtractionCallable.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public Boolean call() {
    Log.i(TAG, "Trying to extract logcat for minidump");
    try {
        // Step 1: Extract a single logcat file.
        File logcatFile = getElidedLogcat();

        // Step 2: Make copies of logcat file for each  minidump then invoke
        // MinidumpPreparationService on each file pair.
        int len = mMinidumpFilenames.length;
        CrashFileManager fileManager = new CrashFileManager(mContext.getCacheDir());
        for (int i = 0; i < len; i++) {
            // Output crash dump file path to logcat so non-browser crashes appear too.
            Log.i(TAG, "Output crash dump:");
            Log.i(TAG, fileManager.getCrashFile(mMinidumpFilenames[i]).getAbsolutePath());
            processMinidump(logcatFile, mMinidumpFilenames[i], fileManager, i == len - 1);
        }
        return true;
    } catch (IOException | InterruptedException e) {
        Log.w(TAG, e.toString());
        return false;
    }
}
 
Example 3
Source File: BackgroundSyncLauncher.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if the Background Sync Manager should be automatically disabled on startup.
 * This is currently only the case if Play Services is not up to date, since any sync attempts
 * which fail cannot be reregistered. Better to wait until Play Services is updated before
 * attempting them.
 *
 * @param context The application context.
 */
@CalledByNative
private static boolean shouldDisableBackgroundSync(Context context) {
    // Check to see if Play Services is up to date, and disable GCM if not.
    // This will not automatically set {@link sGCMEnabled} to true, in case it has been
    // disabled in tests.
    if (sGCMEnabled) {
        boolean isAvailable = true;
        if (!canUseGooglePlayServices(context)) {
            setGCMEnabled(false);
            Log.i(TAG, "Disabling Background Sync because Play Services is not up to date.");
            isAvailable = false;
        }
        RecordHistogram.recordBooleanHistogram(
                "BackgroundSync.LaunchTask.PlayServicesAvailable", isAvailable);
    }
    return !sGCMEnabled;
}
 
Example 4
Source File: BindingManagerImpl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
void onSentToBackground(final boolean onTesting) {
    if (mConnections.isEmpty()) return;
    mDelayedClearer = new Runnable() {
        @Override
        public void run() {
            Log.i(TAG, "Release moderate connections: %d", mConnections.size());
            if (!onTesting) {
                RecordHistogram.recordCountHistogram(
                        "Android.ModerateBindingCount", mConnections.size());
            }
            removeAllConnections();
        }
    };
    LauncherThread.postDelayed(mDelayedClearer, MODERATE_BINDING_POOL_CLEARER_DELAY_MILLIS);
}
 
Example 5
Source File: ImeAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * See {@link View#dispatchKeyEvent(KeyEvent)}
 */
public boolean dispatchKeyEvent(KeyEvent event) {
    if (DEBUG_LOGS) {
        Log.i(TAG, "dispatchKeyEvent: action [%d], keycode [%d]", event.getAction(),
                event.getKeyCode());
    }
    if (mInputConnection != null) return mInputConnection.sendKeyEventOnUiThread(event);
    return sendKeyEvent(event);
}
 
Example 6
Source File: AutocompleteEditText.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Validates the selection and clears the autocomplete span if needed.  The autocomplete text
 * will be deleted if the selection occurs entirely before the autocomplete region.
 *
 * @param selStart The start of the selection.
 * @param selEnd The end of the selection.
 * @return Whether the autocomplete span was removed as a result of this validation.
 */
private boolean validateSelection(int selStart, int selEnd) {
    int spanStart = getText().getSpanStart(mAutocompleteSpan);
    int spanEnd = getText().getSpanEnd(mAutocompleteSpan);

    if (DEBUG) {
        Log.i(TAG, "validateSelection -- selStart: %d, selEnd: %d, spanStart: %d, spanEnd: %d",
                selStart, selEnd, spanStart, spanEnd);
    }

    if (spanStart >= 0 && (spanStart != selStart || spanEnd != selEnd)) {
        CharSequence previousAutocompleteText = mAutocompleteSpan.mAutocompleteText;

        // On selection changes, the autocomplete text has been accepted by the user or needs
        // to be deleted below.
        mAutocompleteSpan.clearSpan();

        // The autocomplete text will be deleted any time the selection occurs entirely before
        // the start of the autocomplete text.  This is required because certain keyboards will
        // insert characters temporarily when starting a key entry gesture (whether it be
        // swyping a word or long pressing to get a special character).  When this temporary
        // character appears, Chrome may decide to append some autocomplete, but the keyboard
        // will then remove this temporary character only while leaving the autocomplete text
        // alone.  See crbug/273763 for more details.
        if (selEnd <= spanStart
                && TextUtils.equals(previousAutocompleteText,
                           getText().subSequence(spanStart, getText().length()))) {
            getText().delete(spanStart, getText().length());
        }
        return true;
    }
    return false;
}
 
Example 7
Source File: InputMethodManagerWrapper.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @see android.view.inputmethod.InputMethodManager#updateCursorAnchorInfo(View,
 * CursorAnchorInfo)
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void updateCursorAnchorInfo(View view, CursorAnchorInfo cursorAnchorInfo) {
    if (DEBUG_LOGS) Log.i(TAG, "updateCursorAnchorInfo");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getInputMethodManager().updateCursorAnchorInfo(view, cursorAnchorInfo);
    }
}
 
Example 8
Source File: ThreadedInputConnection.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @see InputConnection#beginBatchEdit()
 */
@Override
public boolean beginBatchEdit() {
    assertOnImeThread();
    if (DEBUG_LOGS) Log.i(TAG, "beginBatchEdit [%b]", (mNumNestedBatchEdits == 0));
    assertOnImeThread();
    mNumNestedBatchEdits++;
    return true;
}
 
Example 9
Source File: ImeAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Call this when view's focus has changed.
 * @param gainFocus True if we're gaining focus.
 * @param hideKeyboardOnBlur True if we should hide soft keyboard when losing focus.
 */
public void onViewFocusChanged(boolean gainFocus, boolean hideKeyboardOnBlur) {
    if (DEBUG_LOGS) Log.i(TAG, "onViewFocusChanged: gainFocus [%b]", gainFocus);
    if (!gainFocus && hideKeyboardOnBlur) resetAndHideKeyboard();
    if (mInputConnectionFactory != null) {
        mInputConnectionFactory.onViewFocusChanged(gainFocus);
    }
}
 
Example 10
Source File: MinidumpUploadService.java    From delion with Apache License 2.0 5 votes vote down vote up
private void handleFindAndUploadAllCrashes() {
    CrashFileManager fileManager = new CrashFileManager(getApplicationContext().getCacheDir());
    File[] minidumps = fileManager.getAllMinidumpFiles();
    File logfile = fileManager.getCrashUploadLogFile();
    Log.i(TAG, "Attempting to upload accumulated crash dumps.");
    for (File minidump : minidumps) {
        Intent uploadIntent = createUploadIntent(getApplicationContext(), minidump, logfile);
        startService(uploadIntent);
    }
}
 
Example 11
Source File: ThreadedInputConnection.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @see InputConnection#setSelection(int, int)
 */
@Override
public boolean setSelection(final int start, final int end) {
    if (DEBUG_LOGS) Log.i(TAG, "setSelection [%d %d]", start, end);
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            mImeAdapter.setEditableSelectionOffsets(start, end);
        }
    });
    return true;
}
 
Example 12
Source File: ChromeBluetoothDevice.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onServicesDiscovered(final int status) {
    Log.i(TAG, "onServicesDiscovered status:%d==%s", status,
            status == android.bluetooth.BluetoothGatt.GATT_SUCCESS ? "OK" : "Error");
    Wrappers.ThreadUtilsWrapper.getInstance().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (mNativeBluetoothDeviceAndroid != 0) {
                // When the device disconnects it deletes
                // mBluetoothGatt, so we need to check it's not null.
                if (mBluetoothGatt == null) {
                    RecordHistogram.recordSparseSlowlyHistogram(
                            "Bluetooth.Web.Android.onServicesDiscovered.Status."
                                    + "Disconnected",
                            status);
                    return;
                }
                RecordHistogram.recordSparseSlowlyHistogram(
                        "Bluetooth.Web.Android.onServicesDiscovered.Status.Connected",
                        status);

                // TODO(crbug.com/576906): Update or replace existing GATT objects if they
                //                         change after initial discovery.
                for (Wrappers.BluetoothGattServiceWrapper service :
                        mBluetoothGatt.getServices()) {
                    // Create an adapter unique service ID. getInstanceId only differs
                    // between service instances with the same UUID on this device.
                    String serviceInstanceId = getAddress() + "/"
                            + service.getUuid().toString() + "," + service.getInstanceId();
                    nativeCreateGattRemoteService(
                            mNativeBluetoothDeviceAndroid, serviceInstanceId, service);
                }
                nativeOnGattServicesDiscovered(mNativeBluetoothDeviceAndroid);
            }
        }
    });
}
 
Example 13
Source File: ThreadedInputConnection.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void updateStateOnUiThread(String text, final int selectionStart, final int selectionEnd,
        final int compositionStart, final int compositionEnd, boolean singleLine,
        final boolean replyToRequest) {
    ImeUtils.checkOnUiThread();

    mCachedTextInputState = new TextInputState(text, new Range(selectionStart, selectionEnd),
            new Range(compositionStart, compositionEnd), singleLine, replyToRequest);
    if (DEBUG_LOGS) Log.i(TAG, "updateState: %s", mCachedTextInputState);

    addToQueueOnUiThread(mCachedTextInputState);
    if (!replyToRequest) {
        mHandler.post(mProcessPendingInputStatesRunnable);
    }
}
 
Example 14
Source File: OmahaClient.java    From delion with Apache License 2.0 5 votes vote down vote up
private boolean generateAndPostRequest(long currentTimestamp, String sessionID) {
    ExponentialBackoffScheduler scheduler = getBackoffScheduler();
    try {
        // Generate the XML for the current request.
        long installAgeInDays = RequestGenerator.installAge(currentTimestamp,
                mTimestampOfInstall, mCurrentRequest.isSendInstallEvent());
        String version = getVersionNumberGetter().getCurrentlyUsedVersion(this);
        String xml = getRequestGenerator().generateXML(
                sessionID, version, installAgeInDays, mCurrentRequest);

        // Send the request to the server & wait for a response.
        String response = postRequest(currentTimestamp, xml);
        parseServerResponse(response);

        // If we've gotten this far, we've successfully sent a request.
        mCurrentRequest = null;
        mTimestampForNextPostAttempt = currentTimestamp + MS_POST_BASE_DELAY;
        scheduler.resetFailedAttempts();
        Log.i(TAG, "Request to Server Successful. Timestamp for next request:"
                + String.valueOf(mTimestampForNextPostAttempt));

        return true;
    } catch (RequestFailureException e) {
        // Set the alarm to try again later.
        Log.e(TAG, "Failed to contact server: ", e);
        Intent postIntent = createPostRequestIntent(this);
        mTimestampForNextPostAttempt = scheduler.createAlarm(postIntent);
        scheduler.increaseFailedAttempts();
        return false;
    }
}
 
Example 15
Source File: VariationsSeedFetcher.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void recordSeedFetchTime(long timeDeltaMillis) {
    Log.i(TAG, "Fetched first run seed in " + timeDeltaMillis + " ms");
    TimesHistogramSample histogram = new TimesHistogramSample(
            "Variations.FirstRun.SeedFetchTime", TimeUnit.MILLISECONDS);
    histogram.record(timeDeltaMillis);
}
 
Example 16
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private void recordBackPressedUma(String logMessage, @BackPressedResult int action) {
    Log.i(TAG, "Back pressed: " + logMessage);
    RecordHistogram.recordEnumeratedHistogram(
            "Android.Activity.ChromeTabbedActivity.SystemBackAction",
            action, BACK_PRESSED_COUNT);
}
 
Example 17
Source File: NearbySubscription.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void onConnectionSuspended(int cause) {
    Log.i(TAG, "Nearby connection suspended: " + cause);
}
 
Example 18
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
private void recordBackPressedUma(String logMessage, @BackPressedResult int action) {
    Log.i(TAG, "Back pressed: " + logMessage);
    RecordHistogram.recordEnumeratedHistogram(
            "Android.Activity.ChromeTabbedActivity.SystemBackAction",
            action, BACK_PRESSED_COUNT);
}
 
Example 19
Source File: InputMethodManagerWrapper.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @see android.view.inputmethod.InputMethodManager#restartInput(View)
 */
public void restartInput(View view) {
    if (DEBUG_LOGS) Log.i(TAG, "restartInput");
    getInputMethodManager().restartInput(view);
}
 
Example 20
Source File: ChromiumMultiDexInstaller.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 *  Installs secondary dexes if possible/necessary.
 *
 *  Isolated processes (e.g. renderer processes) can't load secondary dex files on
 *  K and below, so we don't even try in that case.
 *
 *  In release builds of app apks (as opposed to test apks), this is a no-op because:
 *    - multidex isn't necessary in release builds because we run proguard there and
 *      thus aren't threatening to hit the dex limit; and
 *    - calling MultiDex.install, even in the absence of secondary dexes, causes a
 *      significant regression in start-up time (crbug.com/525695).
 *
 *  @param context The application context.
 */
@VisibleForTesting
public static void install(Context context) {
    // TODO(jbudorick): Back out this version check once support for K & below works.
    // http://crbug.com/512357
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            && !shouldInstallMultiDex(context)) {
        Log.i(TAG, "Skipping multidex installation: not needed for process.");
    } else {
        MultiDex.install(context);
        Log.i(TAG, "Completed multidex installation.");
    }
}