Java Code Examples for org.chromium.base.Log#w()
The following examples show how to use
org.chromium.base.Log#w() .
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: CustomTabActivity.java From 365browser with Apache License 2.0 | 7 votes |
/** * Used to check whether an incoming intent can be handled by the * current {@link CustomTabContentHandler}. * @return Whether the active {@link CustomTabContentHandler} has handled the intent. */ public static boolean handleInActiveContentIfNeeded(Intent intent) { if (sActiveContentHandler == null) return false; if (sActiveContentHandler.shouldIgnoreIntent(intent)) { Log.w(TAG, "Incoming intent to Custom Tab was ignored."); return false; } CustomTabsSessionToken session = CustomTabsSessionToken.getSessionTokenFromIntent(intent); if (session == null || !session.equals(sActiveContentHandler.getSession())) return false; String url = IntentHandler.getUrlFromIntent(intent); if (TextUtils.isEmpty(url)) return false; sActiveContentHandler.loadUrlAndTrackFromTimestamp(new LoadUrlParams(url), IntentHandler.getTimestampFromIntent(intent)); return true; }
Example 2
Source File: BackgroundTaskJobService.java From 365browser with Apache License 2.0 | 6 votes |
@Override public boolean onStartJob(JobParameters params) { ThreadUtils.assertOnUiThread(); BackgroundTask backgroundTask = BackgroundTaskSchedulerJobService.getBackgroundTaskFromJobParameters(params); if (backgroundTask == null) { Log.w(TAG, "Failed to start task. Could not instantiate class."); return false; } mCurrentTasks.put(params.getJobId(), backgroundTask); TaskParameters taskParams = BackgroundTaskSchedulerJobService.getTaskParametersFromJobParameters(params); boolean taskNeedsBackgroundProcessing = backgroundTask.onStartTask(getApplicationContext(), taskParams, new TaskFinishedCallbackJobService(this, backgroundTask, params)); if (!taskNeedsBackgroundProcessing) mCurrentTasks.remove(params.getJobId()); return taskNeedsBackgroundProcessing; }
Example 3
Source File: SigninManager.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Starts the sign-in flow, and executes the callback when finished. * * If an activity is provided, it is considered an "interactive" sign-in and the user can be * prompted to confirm various aspects of sign-in using dialogs inside the activity. * The sign-in flow goes through the following steps: * * - Wait for AccountTrackerService to be seeded. * - If interactive, confirm the account change with the user. * - Wait for policy to be checked for the account. * - If interactive and the account is managed, warn the user. * - If managed, wait for the policy to be fetched. * - Complete sign-in with the native SigninManager and kick off token requests. * - Call the callback if provided. * * @param account The account to sign in to. * @param activity The activity used to launch UI prompts, or null for a forced signin. * @param callback Optional callback for when the sign-in process is finished. */ public void signIn( Account account, @Nullable Activity activity, @Nullable SignInCallback callback) { if (account == null) { Log.w(TAG, "Ignoring sign-in request due to null account."); if (callback != null) callback.onSignInAborted(); return; } if (mSignInState != null) { Log.w(TAG, "Ignoring sign-in request as another sign-in request is pending."); if (callback != null) callback.onSignInAborted(); return; } if (mFirstRunCheckIsPending) { Log.w(TAG, "Ignoring sign-in request until the First Run check completes."); if (callback != null) callback.onSignInAborted(); return; } mSignInState = new SignInState(account, activity, callback); notifySignInAllowedChanged(); progressSignInFlowSeedSystemAccounts(); }
Example 4
Source File: RemoteMediaPlayerController.java From 365browser with Apache License 2.0 | 6 votes |
private void showMediaRouteDialog(MediaStateListener player, MediaRouteController controller, Activity activity) { FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager(); if (fm == null) { throw new IllegalStateException("The activity must be a subclass of FragmentActivity"); } MediaRouteDialogFactory factory = new MediaRouteChooserDialogFactory(player, controller, activity); if (fm.findFragmentByTag( "android.support.v7.mediarouter:MediaRouteChooserDialogFragment") != null) { Log.w(TAG, "showDialog(): Route chooser dialog already showing!"); return; } MediaRouteChooserDialogFragment f = factory.onCreateChooserDialogFragment(); f.setRouteSelector(controller.buildMediaRouteSelector()); f.show(fm, "android.support.v7.mediarouter:MediaRouteChooserDialogFragment"); }
Example 5
Source File: InvalidationClientService.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void informRegistrationFailure( byte[] clientId, ObjectId objectId, boolean isTransient, String errorMessage) { Log.w(TAG, "Registration failure on " + objectId + " ; transient = " + isTransient + ": " + errorMessage); if (isTransient) { // Retry immediately on transient failures. The base AndroidListener will handle // exponential backoff if there are repeated failures. List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId); if (readRegistrationsFromPrefs().contains(objectId)) { register(clientId, objectIdAsList); } else { unregister(clientId, objectIdAsList); } } }
Example 6
Source File: MinidumpUploadService.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override protected void onHandleIntent(Intent intent) { if (intent == null) return; if (!intent.getBooleanExtra(FINISHED_LOGCAT_EXTRACTION_KEY, false)) { // The current intent was sent before a chance to gather some // logcat information. tryPopulateLogcat will re-send the // same action once it has a go at gather logcat. tryPopulateLogcat(intent); } else if (ACTION_FIND_LAST.equals(intent.getAction())) { handleFindAndUploadLastCrash(intent); } else if (ACTION_FIND_ALL.equals(intent.getAction())) { handleFindAndUploadAllCrashes(); } else if (ACTION_UPLOAD.equals(intent.getAction())) { handleUploadCrash(intent); } else if (ACTION_FORCE_UPLOAD.equals(intent.getAction())) { handleForceUploadCrash(intent); } else { Log.w(TAG, "Got unknown action from intent: " + intent.getAction()); } }
Example 7
Source File: SigninManager.java From delion with Apache License 2.0 | 6 votes |
/** * Continues the signin flow by checking if there is a policy that the account is subject to. */ private void progressSignInFlowCheckPolicy() { if (mSignInState == null) { Log.w(TAG, "Ignoring sign in progress request as no pending sign in."); return; } if (mSignInState.isActivityInvisible()) { abortSignIn(); return; } if (!nativeShouldLoadPolicyForUser(mSignInState.account.name)) { // Proceed with the sign-in flow without checking for policy if it can be determined // that this account can't have management enabled based on the username. finishSignIn(); return; } Log.d(TAG, "Checking if account has policy management enabled"); // This will call back to onPolicyCheckedBeforeSignIn. nativeCheckPolicyBeforeSignIn(mNativeSigninManagerAndroid, mSignInState.account.name); }
Example 8
Source File: ShortcutHelper.java From 365browser with Apache License 2.0 | 5 votes |
/** * Generates a generic icon to be used in the launcher. This is just a rounded rectangle with * a letter in the middle taken from the website's domain name. * * @param url URL of the shortcut. * @param red Red component of the dominant icon color. * @param green Green component of the dominant icon color. * @param blue Blue component of the dominant icon color. * @return Bitmap Either the touch-icon or the newly created favicon. */ @CalledByNative public static Bitmap generateHomeScreenIcon(String url, int red, int green, int blue) { Context context = ContextUtils.getApplicationContext(); ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); final int outerSize = am.getLauncherLargeIconSize(); final int iconDensity = am.getLauncherLargeIconDensity(); Bitmap bitmap = null; try { bitmap = Bitmap.createBitmap(outerSize, outerSize, Bitmap.Config.ARGB_8888); } catch (OutOfMemoryError e) { Log.w(TAG, "OutOfMemoryError while trying to draw bitmap on canvas."); return null; } Canvas canvas = new Canvas(bitmap); // Draw the drop shadow. int padding = (int) (GENERATED_ICON_PADDING_RATIO * outerSize); Rect outerBounds = new Rect(0, 0, outerSize, outerSize); Bitmap iconShadow = getBitmapFromResourceId(context, R.mipmap.shortcut_icon_shadow, iconDensity); Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); canvas.drawBitmap(iconShadow, null, outerBounds, paint); // Draw the rounded rectangle and letter. int innerSize = outerSize - 2 * padding; int cornerRadius = Math.round(ICON_CORNER_RADIUS_RATIO * outerSize); int fontSize = Math.round(GENERATED_ICON_FONT_SIZE_RATIO * outerSize); int color = Color.rgb(red, green, blue); RoundedIconGenerator generator = new RoundedIconGenerator( innerSize, innerSize, cornerRadius, color, fontSize); Bitmap icon = generator.generateIconForUrl(url); if (icon == null) return null; // Bookmark URL does not have a domain. canvas.drawBitmap(icon, padding, padding, null); return bitmap; }
Example 9
Source File: MediaResourceGetter.java From 365browser with Apache License 2.0 | 5 votes |
private List<String> canonicalize(List<String> paths) { List<String> result = new ArrayList<String>(paths.size()); try { for (String path : paths) { result.add(new File(path).getCanonicalPath()); } return result; } catch (IOException e) { // Canonicalization has failed. Assume malicious, give up. Log.w(TAG, "canonicalization of file path failed"); } return result; }
Example 10
Source File: BackgroundTaskScheduler.java From 365browser with Apache License 2.0 | 5 votes |
/** * Reschedules all the tasks currently scheduler through BackgroundTaskSheduler. * @param context the current context. */ public void reschedule(Context context) { Set<String> scheduledTasksClassNames = BackgroundTaskSchedulerPrefs.getScheduledTasks(); BackgroundTaskSchedulerPrefs.removeAllTasks(); for (String className : scheduledTasksClassNames) { BackgroundTask task = getBackgroundTaskFromClassName(className); if (task == null) { Log.w(TAG, "Cannot reschedule task for: " + className); continue; } task.reschedule(context); } }
Example 11
Source File: TabPersistentStore.java From 365browser with Apache License 2.0 | 5 votes |
@Override protected TabState doInBackground(Void... voids) { if (mDestroyed || isCancelled()) return null; try { return TabState.restoreTabState(getStateDirectory(), mTabToRestore.id); } catch (Exception e) { Log.w(TAG, "Unable to read state: " + e); return null; } }
Example 12
Source File: ExternalNavigationHandler.java From 365browser with Apache License 2.0 | 5 votes |
/** * Determines whether the URL needs to be sent as an intent to the system, * and sends it, if appropriate. * @return Whether the URL generated an intent, caused a navigation in * current tab, or wasn't handled at all. */ public OverrideUrlLoadingResult shouldOverrideUrlLoading(ExternalNavigationParams params) { if (DEBUG) Log.i(TAG, "shouldOverrideUrlLoading called on " + params.getUrl()); Intent intent; // Perform generic parsing of the URI to turn it into an Intent. try { intent = Intent.parseUri(params.getUrl(), Intent.URI_INTENT_SCHEME); } catch (Exception ex) { Log.w(TAG, "Bad URI %s", params.getUrl(), ex); return OverrideUrlLoadingResult.NO_OVERRIDE; } boolean hasBrowserFallbackUrl = false; String browserFallbackUrl = IntentUtils.safeGetStringExtra(intent, EXTRA_BROWSER_FALLBACK_URL); if (browserFallbackUrl != null && UrlUtilities.isValidForIntentFallbackNavigation(browserFallbackUrl)) { hasBrowserFallbackUrl = true; } else { browserFallbackUrl = null; } long time = SystemClock.elapsedRealtime(); OverrideUrlLoadingResult result = shouldOverrideUrlLoadingInternal( params, intent, hasBrowserFallbackUrl, browserFallbackUrl); RecordHistogram.recordTimesHistogram("Android.StrictMode.OverrideUrlLoadingTime", SystemClock.elapsedRealtime() - time, TimeUnit.MILLISECONDS); if (result == OverrideUrlLoadingResult.NO_OVERRIDE && hasBrowserFallbackUrl && (params.getRedirectHandler() == null // For instance, if this is a chained fallback URL, we ignore it. || !params.getRedirectHandler().shouldNotOverrideUrlLoading())) { return clobberCurrentTabWithFallbackUrl(browserFallbackUrl, params); } return result; }
Example 13
Source File: ThreadedInputConnectionProxyView.java From 365browser with Apache License 2.0 | 5 votes |
ThreadedInputConnectionProxyView( Context context, Handler imeThreadHandler, View containerView) { super(context); mImeThreadHandler = imeThreadHandler; mContainerView = containerView; setFocusable(true); setFocusableInTouchMode(true); setVisibility(View.VISIBLE); if (DEBUG_LOGS) Log.w(TAG, "constructor"); mFocused.set(mContainerView.hasFocus()); mWindowFocused.set(mContainerView.hasWindowFocus()); mWindowToken.set(mContainerView.getWindowToken()); mRootView.set(mContainerView.getRootView()); }
Example 14
Source File: InvalidationClientService.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void informError(ErrorInfo errorInfo) { Log.w(TAG, "Invalidation client error:" + errorInfo); if (!errorInfo.isTransient() && sIsClientStarted) { // It is important not to stop the client if it is already stopped. Otherwise, the // possibility exists to go into an infinite loop if the stop call itself triggers an // error (e.g., because no client actually exists). stopClient(); } }
Example 15
Source File: ThreadedInputConnectionProxyView.java From 365browser with Apache License 2.0 | 5 votes |
@Override public InputConnection onCreateInputConnection(final EditorInfo outAttrs) { if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection"); return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<InputConnection>() { @Override public InputConnection call() throws Exception { return mContainerView.onCreateInputConnection(outAttrs); } }); }
Example 16
Source File: ThreadedInputConnectionProxyView.java From 365browser with Apache License 2.0 | 4 votes |
@Override public IBinder getWindowToken() { if (DEBUG_LOGS) Log.w(TAG, "getWindowToken"); return mWindowToken.get(); }
Example 17
Source File: SigninHelper.java From delion with Apache License 2.0 | 4 votes |
@VisibleForTesting public static void updateAccountRenameData(Context context, AccountChangeEventChecker checker) { String curName = getLastKnownAccountName(context); // Skip the search if there is no signed in account. if (curName == null) return; String newName = curName; // This is the last read index of all the account change event. int eventIndex = ContextUtils.getAppSharedPreferences().getInt( ACCOUNT_RENAME_EVENT_INDEX_PREFS_KEY, 0); int newIndex = eventIndex; try { outerLoop: while (true) { List<String> nameChanges = checker.getAccountChangeEvents(context, newIndex, newName); for (String name : nameChanges) { if (name != null) { // We have found a rename event of the current account. // We need to check if that account is further renamed. newName = name; if (!accountExists( context, AccountManagerHelper.createAccountFromName(newName))) { newIndex = 0; // Start from the beginning of the new account. continue outerLoop; } break; } } // If there is no rename event pending. Update the last read index to avoid // re-reading them in the future. newIndex = nameChanges.size(); break; } } catch (Exception e) { Log.w(TAG, "Error while looking for rename events.", e); } if (!curName.equals(newName)) { ContextUtils.getAppSharedPreferences() .edit().putString(ACCOUNT_RENAMED_PREFS_KEY, newName).apply(); } if (newIndex != eventIndex) { ContextUtils.getAppSharedPreferences() .edit().putInt(ACCOUNT_RENAME_EVENT_INDEX_PREFS_KEY, newIndex).apply(); } }
Example 18
Source File: TabPersistentStore.java From AndroidChromium with Apache License 2.0 | 4 votes |
private void restoreTab( TabRestoreDetails tabToRestore, TabState tabState, boolean setAsActive) { // If we don't have enough information about the Tab, bail out. boolean isIncognito = isIncognitoTabBeingRestored(tabToRestore, tabState); if (tabState == null) { if (tabToRestore.isIncognito == null) { Log.w(TAG, "Failed to restore tab: not enough info about its type was available."); return; } else if (isIncognito) { Log.i(TAG, "Failed to restore Incognito tab: its TabState could not be restored."); return; } } TabModel model = mTabModelSelector.getModel(isIncognito); SparseIntArray restoredTabs = isIncognito ? mIncognitoTabsRestored : mNormalTabsRestored; int restoredIndex = 0; if (tabToRestore.fromMerge) { // Put any tabs being merged into this list at the end. restoredIndex = mTabModelSelector.getModel(isIncognito).getCount(); } else if (restoredTabs.size() > 0 && tabToRestore.originalIndex > restoredTabs.keyAt(restoredTabs.size() - 1)) { // If the tab's index is too large, restore it at the end of the list. restoredIndex = restoredTabs.size(); } else { // Otherwise try to find the tab we should restore before, if any. for (int i = 0; i < restoredTabs.size(); i++) { if (restoredTabs.keyAt(i) > tabToRestore.originalIndex) { Tab nextTabByIndex = TabModelUtils.getTabById(model, restoredTabs.valueAt(i)); restoredIndex = nextTabByIndex != null ? model.indexOf(nextTabByIndex) : -1; break; } } } int tabId = tabToRestore.id; if (tabState != null) { mTabCreatorManager.getTabCreator(isIncognito).createFrozenTab( tabState, tabToRestore.id, restoredIndex); } else { Log.w(TAG, "Failed to restore TabState; creating Tab with last known URL."); Tab fallbackTab = mTabCreatorManager.getTabCreator(isIncognito).createNewTab( new LoadUrlParams(tabToRestore.url), TabModel.TabLaunchType.FROM_RESTORE, null); tabId = fallbackTab.getId(); model.moveTab(tabId, restoredIndex); } // If the tab is being restored from a merge and its index is 0, then the model being // merged into doesn't contain any tabs. Select the first tab to avoid having no tab // selected. TODO(twellington): The first tab will always be selected. Instead, the tab that // was selected in the other model before the merge should be selected after the merge. if (setAsActive || (tabToRestore.fromMerge && restoredIndex == 0)) { boolean wasIncognitoTabModelSelected = mTabModelSelector.isIncognitoSelected(); int selectedModelTabCount = mTabModelSelector.getCurrentModel().getCount(); TabModelUtils.setIndex(model, TabModelUtils.getTabIndexById(model, tabId)); boolean isIncognitoTabModelSelected = mTabModelSelector.isIncognitoSelected(); // Setting the index will cause the tab's model to be selected. Set it back to the model // that was selected before setting the index if the index is being set during a merge // unless the previously selected model is empty (e.g. showing the empty background // view on tablets). if (tabToRestore.fromMerge && wasIncognitoTabModelSelected != isIncognitoTabModelSelected && selectedModelTabCount != 0) { mTabModelSelector.selectModel(wasIncognitoTabModelSelected); } } restoredTabs.put(tabToRestore.originalIndex, tabId); }
Example 19
Source File: ThreadedInputConnectionProxyView.java From 365browser with Apache License 2.0 | 4 votes |
@Override public boolean isFocused() { if (DEBUG_LOGS) Log.w(TAG, "isFocused"); return mFocused.get(); }
Example 20
Source File: HttpNegotiateAuthenticator.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void run(AccountManagerFuture<Account[]> future) { Account[] accounts; try { accounts = future.getResult(); } catch (OperationCanceledException | AuthenticatorException | IOException e) { Log.w(TAG, "ERR_UNEXPECTED: Error while attempting to retrieve accounts.", e); nativeSetResult(mRequestData.nativeResultObject, NetError.ERR_UNEXPECTED, null); return; } if (accounts.length == 0) { Log.w(TAG, "ERR_MISSING_AUTH_CREDENTIALS: No account provided for the kerberos " + "authentication. Please verify the configuration policies and " + "that the CONTACTS runtime permission is granted. "); nativeSetResult(mRequestData.nativeResultObject, NetError.ERR_MISSING_AUTH_CREDENTIALS, null); return; } if (accounts.length > 1) { Log.w(TAG, "ERR_MISSING_AUTH_CREDENTIALS: Found %d accounts eligible for the " + "kerberos authentication. Please fix the configuration by " + "providing a single account.", accounts.length); nativeSetResult(mRequestData.nativeResultObject, NetError.ERR_MISSING_AUTH_CREDENTIALS, null); return; } if (lacksPermission(ContextUtils.getApplicationContext(), "android.permission.USE_CREDENTIALS", true)) { // Protecting the AccountManager#getAuthToken call. // API < 23 Requires the USE_CREDENTIALS permission or throws an exception. // API >= 23 USE_CREDENTIALS permission is removed Log.e(TAG, "ERR_MISCONFIGURED_AUTH_ENVIRONMENT: USE_CREDENTIALS permission not " + "granted. Aborting authentication."); nativeSetResult(mRequestData.nativeResultObject, NetError.ERR_MISCONFIGURED_AUTH_ENVIRONMENT, null); return; } mRequestData.account = accounts[0]; mRequestData.accountManager.getAuthToken(mRequestData.account, mRequestData.authTokenType, mRequestData.options, true /* notifyAuthFailure */, new GetTokenCallback(mRequestData), new Handler(ThreadUtils.getUiThreadLooper())); }