List of usage examples for android.util Log ERROR
int ERROR
To view the source code for android.util Log ERROR.
Click Source Link
From source file:com.google.android.marvin.screenspeak.ScreenSpeakService.java
/** * Registers listeners, sets service info, loads preferences. This should be called from * {@link #onServiceConnected} and when ScreenSpeak resumes from a suspended state. *//*from ww w . java 2s . co m*/ private void suspendInfrastructure() { if (!isServiceActive()) { if (LogUtils.LOG_LEVEL <= Log.ERROR) { Log.e(LOGTAG, "Attempted to suspend while already suspended"); } return; } mDimScreenController.makeScreenBright(); interruptAllFeedback(); setServiceState(SERVICE_STATE_SUSPENDED); // Some apps depend on these being set to false when ScreenSpeak is disabled. if (mSupportsTouchScreen) { requestTouchExploration(false); } if (SUPPORTS_WEB_SCRIPT_TOGGLE) { requestWebScripts(false); } mPrefs.unregisterOnSharedPreferenceChangeListener(mSharedPreferenceChangeListener); unregisterReceiver(mActiveReceiver); if (mCallStateMonitor != null) { mCallStateMonitor.stopMonitor(); } if (mRingerModeAndScreenMonitor != null) { unregisterReceiver(mRingerModeAndScreenMonitor); } if (mMenuManager != null) { mMenuManager.clearCache(); } if (mVolumeMonitor != null) { unregisterReceiver(mVolumeMonitor); mVolumeMonitor.releaseControl(); } if (mBatteryMonitor != null) { unregisterReceiver(mBatteryMonitor); } if (mPackageReceiver != null) { unregisterReceiver(mPackageReceiver); } if (mShakeDetector != null) { mShakeDetector.setEnabled(false); } // The tap detector is enabled through reloadPreferences if (mSideTapManager != null) { unregisterReceiver(mSideTapManager); mSideTapManager.onSuspendInfrastructure(); } // Disable the proxy activity for long-press search. final PackageManager packageManager = getPackageManager(); final ComponentName shortcutProxy = new ComponentName(this, ShortcutProxyActivity.class); packageManager.setComponentEnabledSetting(shortcutProxy, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); // Remove any pending notifications that shouldn't persist. final NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); nm.cancelAll(); }
From source file:com.android.talkback.controller.CursorControllerApp.java
private boolean navigateWrapAround(AccessibilityNodeInfoCompat root, @TraversalStrategy.SearchDirection int direction, TraversalStrategy traversalStrategy, int inputMode) { if (root == null) { return false; }//from w w w. jav a 2 s . co m AccessibilityNodeInfoCompat tempNode = null; AccessibilityNodeInfoCompat wrapNode = null; try { tempNode = traversalStrategy.focusInitial(root, direction); wrapNode = navigateSelfOrFrom(tempNode, direction, traversalStrategy); if (wrapNode == null) { if (LogUtils.LOG_LEVEL <= Log.ERROR) { Log.e(LOGTAG, "Failed to wrap navigation"); } return false; } if (setCursor(wrapNode)) { mService.getInputModeManager().setInputMode(inputMode); return true; } else { return false; } } finally { AccessibilityNodeInfoUtils.recycleNodes(tempNode, wrapNode); } }
From source file:com.irccloud.android.data.collection.NotificationsList.java
private void showMessageNotifications(String ticker) { SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(IRCCloudApplication.getInstance().getApplicationContext()); String text = ""; final List<Notification> notifications = getMessageNotifications(); int notify_type = Integer.parseInt(prefs.getString("notify_type", "1")); boolean notify = false; if (notify_type == 1 || (notify_type == 2 && NetworkConnection.getInstance().isVisible())) notify = true;//from w ww. j ava 2 s .c o m if (notifications.size() > 0 && notify) { int lastbid = notifications.get(0).bid; int count = 0; long[] eids = new long[notifications.size()]; ArrayList<Notification> messages = new ArrayList<>(notifications.size()); Notification last = notifications.get(0); boolean show = false; for (Notification n : notifications) { if (n.bid != lastbid) { if (show) { String title = last.chan; if (title == null || title.length() == 0) title = last.nick; if (title == null || title.length() == 0) title = last.network; Intent replyIntent = new Intent(RemoteInputService.ACTION_REPLY); replyIntent.putExtra("bid", last.bid); replyIntent.putExtra("cid", last.cid); replyIntent.putExtra("eids", eids); replyIntent.putExtra("network", last.network); replyIntent.putExtra("chan", last.chan); replyIntent.putExtra("buffer_type", last.buffer_type); replyIntent.putExtra("to", last.chan); String body; if (last.buffer_type.equals("channel")) { if (last.message_type.equals("buffer_me_msg")) body = "<b> " + ((last.nick != null) ? last.nick : getServerNick(last.cid)) + "</b> " + last.message; else body = "<b><" + ((last.nick != null) ? last.nick : getServerNick(last.cid)) + "></b> " + last.message; } else { if (last.message_type.equals("buffer_me_msg")) body = " " + ((last.nick != null) ? last.nick : getServerNick(last.cid)) + " " + last.message; else body = last.message; } ArrayList<String> lines = new ArrayList<>(Arrays.asList(text.split("<br/>"))); while (lines.size() > 3) lines.remove(0); try { Crashlytics.log(Log.DEBUG, "IRCCloud", "Posting notification for type " + last.message_type); NotificationManagerCompat .from(IRCCloudApplication.getInstance().getApplicationContext()) .notify(lastbid, buildNotification(ticker, last.cid, lastbid, eids, title, body, count, replyIntent, last.network, messages, null, AvatarsList.getInstance().getAvatar(last.cid, last.nick).getBitmap( false, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 64, IRCCloudApplication.getInstance() .getApplicationContext().getResources() .getDisplayMetrics()), false, Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP), AvatarsList.getInstance().getAvatar(last.cid, last.nick) .getBitmap(false, 400, false, false))); } catch (Exception e) { Crashlytics.logException(e); } } lastbid = n.bid; text = ""; count = 0; eids = new long[notifications.size()]; show = false; messages.clear(); } if (text.length() > 0) text += "<br/>"; if (n.buffer_type.equals("conversation") && n.message_type.equals("buffer_me_msg")) text += " " + n.message; else if (n.buffer_type.equals("conversation")) text += n.message; else if (n.message_type.equals("buffer_me_msg")) text += "<b> " + ((n.nick != null) ? n.nick : getServerNick(n.cid)) + "</b> " + n.message; else text += "<b>" + ((n.nick != null) ? n.nick : getServerNick(n.cid)) + "</b> " + n.message; if (!n.shown) { n.shown = true; show = true; if (n.nick != null && prefs.getBoolean("notify_sony", false)) { long time = System.currentTimeMillis(); long sourceId = NotificationUtil.getSourceId( IRCCloudApplication.getInstance().getApplicationContext(), SonyExtensionService.EXTENSION_SPECIFIC_ID); if (sourceId == NotificationUtil.INVALID_ID) { Crashlytics.log(Log.ERROR, "IRCCloud", "Sony LiveWare Manager not configured, disabling Sony notifications"); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("notify_sony", false); editor.commit(); } else { ContentValues eventValues = new ContentValues(); eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.EVENT_READ_STATUS, false); eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.DISPLAY_NAME, n.nick); if (n.buffer_type.equals("channel") && n.chan != null && n.chan.length() > 0) eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.TITLE, n.chan); else eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.TITLE, n.network); if (n.message_type.equals("buffer_me_msg")) eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.MESSAGE, " " + Html.fromHtml(n.message).toString()); else eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.MESSAGE, Html.fromHtml(n.message).toString()); eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.PERSONAL, 1); eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.PUBLISHED_TIME, time); eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.SOURCE_ID, sourceId); eventValues.put( com.sonyericsson.extras.liveware.aef.notification.Notification.EventColumns.FRIEND_KEY, String.valueOf(n.bid)); try { IRCCloudApplication.getInstance().getApplicationContext().getContentResolver() .insert(com.sonyericsson.extras.liveware.aef.notification.Notification.Event.URI, eventValues); } catch (IllegalArgumentException e) { Log.e("IRCCloud", "Failed to insert event", e); } catch (SecurityException e) { Log.e("IRCCloud", "Failed to insert event, is Live Ware Manager installed?", e); } catch (SQLException e) { Log.e("IRCCloud", "Failed to insert event", e); } } } if (prefs.getBoolean("notify_pebble", false) && n.nick != null) { String pebbleTitle = n.network + ":\n"; String pebbleBody = ""; if (n.buffer_type.equals("channel") && n.chan != null && n.chan.length() > 0) pebbleTitle = n.chan + ":\n"; if (n.message_type.equals("buffer_me_msg")) pebbleBody = " " + n.message; else pebbleBody = n.message; if (n.chan != null && n.nick != null && n.nick.length() > 0) notifyPebble(n.nick, pebbleTitle + Html.fromHtml(pebbleBody).toString()); else notifyPebble(n.network, pebbleTitle + Html.fromHtml(pebbleBody).toString()); } } messages.add(n); eids[count++] = n.eid; if (n.nick != null) last = n; } if (show) { String title = last.chan; if (title == null || title.length() == 0) title = last.network; Intent replyIntent = new Intent(RemoteInputService.ACTION_REPLY); replyIntent.putExtra("bid", last.bid); replyIntent.putExtra("cid", last.cid); replyIntent.putExtra("network", last.network); replyIntent.putExtra("eids", eids); replyIntent.putExtra("chan", last.chan); replyIntent.putExtra("buffer_type", last.buffer_type); replyIntent.putExtra("to", last.chan); String body = ""; if (last.buffer_type.equals("channel")) { if (last.message_type.equals("buffer_me_msg")) body = "<b> " + ((last.nick != null) ? last.nick : getServerNick(last.cid)) + "</b> " + last.message; else body = "<b><" + ((last.nick != null) ? last.nick : getServerNick(last.cid)) + "></b> " + last.message; } else { if (last.message_type.equals("buffer_me_msg")) body = " " + ((last.nick != null) ? last.nick : getServerNick(last.cid)) + " " + last.message; else body = last.message; } ArrayList<String> lines = new ArrayList<>(Arrays.asList(text.split("<br/>"))); while (lines.size() > 3) lines.remove(0); try { Crashlytics.log(Log.DEBUG, "IRCCloud", "Posting notification for type " + last.message_type); NotificationManagerCompat.from(IRCCloudApplication.getInstance().getApplicationContext()) .notify(last.bid, buildNotification(ticker, last.cid, last.bid, eids, title, body, count, replyIntent, last.network, messages, null, AvatarsList.getInstance().getAvatar(last.cid, last.nick).getBitmap(false, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 64, IRCCloudApplication.getInstance().getApplicationContext() .getResources().getDisplayMetrics()), false, Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP), AvatarsList.getInstance().getAvatar(last.cid, last.nick).getBitmap(false, 400, false, false))); } catch (Exception e) { Crashlytics.logException(e); } } TransactionManager.transact(IRCCloudDatabase.NAME, new Runnable() { @Override public void run() { for (Notification n : notifications) { n.save(); } } }); } }
From source file:com.google.android.marvin.screenspeak.ScreenSpeakService.java
/** * Attempts to change the state of touch exploration. * <p>/*from ww w. j a v a 2 s . c o m*/ * Should only be called if {@link #mSupportsTouchScreen} is true. * * @param requestedState {@code true} to request exploration. */ private void requestTouchExploration(boolean requestedState) { final AccessibilityServiceInfo info = getServiceInfo(); if (info == null) { if (LogUtils.LOG_LEVEL <= Log.ERROR) { Log.e(LOGTAG, "Failed to change touch exploration request state, service info was null"); } return; } final boolean currentState = ((info.flags & AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE) != 0); if (currentState == requestedState) { return; } if (requestedState) { info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE; } else { info.flags &= ~AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE; } setServiceInfo(info); }
From source file:com.google.android.marvin.screenspeak.ScreenSpeakService.java
/** * Attempts to change the state of web script injection. * <p>/*w w w .j a v a 2s.c om*/ * Should only be called if {@link #SUPPORTS_WEB_SCRIPT_TOGGLE} is true. * * @param requestedState {@code true} to request script injection, * {@code false} otherwise. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private void requestWebScripts(boolean requestedState) { final AccessibilityServiceInfo info = getServiceInfo(); if (info == null) { if (LogUtils.LOG_LEVEL <= Log.ERROR) { Log.e(LOGTAG, "Failed to change web script injection request state, service info " + "was null"); } return; } final boolean currentState = ((info.flags & AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY) != 0); if (currentState == requestedState) { return; } if (requestedState) { info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY; } else { info.flags &= ~AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY; } setServiceInfo(info); }
From source file:com.google.android.marvin.mytalkback.TalkBackService.java
/** * Attempts to change the state of touch exploration. * <p>/*from w w w .j a v a2 s .c o m*/ * Should only be called if {@link #SUPPORTS_TOUCH_PREF} is true. * * @param requestedState {@code true} to request exploration. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void requestTouchExploration(boolean requestedState) { final AccessibilityServiceInfo info = getServiceInfo(); if (info == null) { LogUtils.log(this, Log.ERROR, "Failed to change touch exploration request state, service info was null"); return; } final boolean currentState = ((info.flags & AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE) != 0); if (currentState == requestedState) { return; } if (requestedState) { info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE; } else { info.flags &= ~AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE; } setServiceInfo(info); }
From source file:com.android.utils.AccessibilityNodeInfoUtils.java
/** * Search focus that satisfied specified node filter from currentFocus to specified direction * according to OrderTraversal strategy//from w ww.j av a 2 s . c om * @param traversal - order traversal strategy * @param currentFocus - node that is starting point of focus search * @param direction - direction the target focus is searching to * @param filter - filters focused node candidate * @return node that could be focused next */ public static AccessibilityNodeInfoCompat searchFocus(TraversalStrategy traversal, AccessibilityNodeInfoCompat currentFocus, @TraversalStrategy.SearchDirection int direction, NodeFilter filter) { if (traversal == null || currentFocus == null) { return null; } if (filter == null) { filter = DEFAULT_FILTER; } AccessibilityNodeInfoCompat targetNode = AccessibilityNodeInfoCompat.obtain(currentFocus); Set<AccessibilityNodeInfoCompat> seenNodes = new HashSet<>(); try { do { seenNodes.add(targetNode); targetNode = traversal.findFocus(targetNode, direction); if (seenNodes.contains(targetNode)) { LogUtils.log(AccessibilityNodeInfoUtils.class, Log.ERROR, "Found duplicate during traversal: %s", targetNode.getInfo()); return null; } } while (targetNode != null && !filter.accept(targetNode)); } finally { AccessibilityNodeInfoUtils.recycleNodes(seenNodes); } return targetNode; }
From source file:com.google.android.marvin.talkback.TalkBackService.java
/** * Attempts to change the state of web script injection. * <p>/*from w ww .j a v a 2s . com*/ * Should only be called if {@link #SUPPORTS_WEB_SCRIPT_TOGGLE} is true. * * @param requestedState {@code true} to request script injection, * {@code false} otherwise. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private void requestWebScripts(boolean requestedState) { final AccessibilityServiceInfo info = getServiceInfo(); if (info == null) { LogUtils.log(this, Log.ERROR, "Failed to change web script injection request state, service info was null"); return; } final boolean currentState = ((info.flags & AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY) != 0); if (currentState == requestedState) { return; } if (requestedState) { info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY; } else { info.flags &= ~AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY; } setServiceInfo(info); }
From source file:com.irccloud.android.NetworkConnection.java
private synchronized void parse_object(IRCCloudJSONObject object) throws JSONException { cancel_idle_timer();//ww w.j a v a 2 s . c om //Log.d(TAG, "Backlog: " + backlog + " New event: " + object); if (!object.has("type")) { //Log.d(TAG, "Response: " + object); if (object.has("success") && !object.getBoolean("success") && object.has("message")) { Crashlytics.log(Log.ERROR, TAG, "Error: " + object); notifyHandlers(EVENT_FAILURE_MSG, object); } else if (object.has("success")) { notifyHandlers(EVENT_SUCCESS, object); } return; } String type = object.type(); if (type != null && type.length() > 0) { //notifyHandlers(EVENT_DEBUG, "Type: " + type + " BID: " + object.bid() + " EID: " + object.eid()); //Crashlytics.log("New event: " + type); //Log.d(TAG, "New event: " + type); Parser p = parserMap.get(type); if (p != null) { p.parse(object); } else if (!parserMap.containsKey(type)) { Crashlytics.log(Log.WARN, TAG, "Unhandled type: " + object.type()); //Log.w(TAG, "Unhandled type: " + object); } if (backlog || type.equals("backlog_complete")) { if ((object.bid() > -1 || type.equals("backlog_complete")) && !type.equals("makebuffer") && !type.equals("channel_init")) { currentcount++; if (object.bid() != currentBid) { currentBid = object.bid(); firstEid = object.eid(); currentcount = 0; } } if (numbuffers > 0 && currentcount < 100) { notifyHandlers(EVENT_PROGRESS, ((totalbuffers + ((float) currentcount / (float) 100)) / numbuffers) * 1000.0f); } } else if (accrued > 0) { notifyHandlers(EVENT_PROGRESS, ((float) currentcount++ / (float) accrued) * 1000.0f); } } if (!backlog && idle_interval > 0 && accrued < 1) schedule_idle_timer(); }