List of usage examples for android.util Log isLoggable
public static native boolean isLoggable(String tag, int level);
From source file:com.samsung.android.remindme.SyncAdapter.java
public List<ModelJava.Alert> getLocallyChangedAlerts(ContentProviderClient provider, Account account, Date sinceDate) throws RemoteException { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Getting local alerts changed since " + Long.toString(sinceDate.getTime())); }/*from w w w.j a v a 2 s. c om*/ Cursor alertsCursor = provider.query(RemindMeContract.buildAlertListUri(account.name), PROJECTION, RemindMeContract.Alerts.MODIFIED_DATE + " > ?", new String[] { Long.toString(sinceDate.getTime()) }, null); List<ModelJava.Alert> locallyChangedAlerts = new ArrayList<ModelJava.Alert>(); while (alertsCursor.moveToNext()) { ContentValues values = new ContentValues(); DatabaseUtils.cursorRowToContentValues(alertsCursor, values); ModelJava.Alert changedAlert = new ModelJava.Alert(values); locallyChangedAlerts.add(changedAlert); } alertsCursor.close(); return locallyChangedAlerts; }
From source file:com.samsung.richnotification.RichNotification.java
@Override //On RichNotification Read in the gear public void onRead(UUID arg0) { if (mCallbackContext == null) return;//from w w w .j a v a 2 s . co m try { JSONObject eventMsg = new JSONObject(); eventMsg.put("returnType", RichNotificationHelper.RETURN_TYPE_NOTIFICATION_READ); eventMsg.put("returnValue", arg0.toString()); PluginResult sentResult = new PluginResult(PluginResult.Status.OK, eventMsg); sentResult.setKeepCallback(true); mCallbackContext.sendPluginResult(sentResult); } catch (JSONException jse) { if (Log.isLoggable(RICHNOTI, Log.DEBUG)) Log.d(TAG, "Gear input invalid"); return; } }
From source file:android.support.wear.widget.drawer.WearableDrawerLayout.java
/** * Peek the drawer.//from w w w. j ava 2 s . c o m * * @param gravity {@link Gravity#TOP} to peek the top drawer or {@link Gravity#BOTTOM} to peek * the bottom drawer. */ void peekDrawer(final int gravity) { if (!isLaidOut()) { // If this view is not laid out yet, postpone the peek until onLayout is called. if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "WearableDrawerLayout not laid out yet. Postponing peek."); } switch (gravity) { case Gravity.TOP: mShouldPeekTopDrawerAfterLayout = true; break; case Gravity.BOTTOM: mShouldPeekBottomDrawerAfterLayout = true; break; default: // fall out } return; } final WearableDrawerView drawerView = findDrawerWithGravity(gravity); maybePeekDrawer(drawerView); }
From source file:com.android.contacts.DynamicShortcuts.java
private void removeAllShortcuts() { mShortcutManager.removeAllDynamicShortcuts(); final List<ShortcutInfo> pinned = mShortcutManager.getPinnedShortcuts(); final List<String> ids = new ArrayList<>(pinned.size()); for (ShortcutInfo shortcut : pinned) { ids.add(shortcut.getId());/*from w ww . j av a2 s. com*/ } mShortcutManager.disableShortcuts(ids, mContext.getString(R.string.dynamic_shortcut_disabled_message)); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "DynamicShortcuts have been removed."); } }
From source file:com.android.contacts.DynamicShortcuts.java
public synchronized static void initialize(Context context) { if (Log.isLoggable(TAG, Log.DEBUG)) { final Flags flags = Flags.getInstance(); Log.d(TAG, "DyanmicShortcuts.initialize\nVERSION >= N_MR1? " + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) + "\nisJobScheduled? " + (CompatUtils.isLauncherShortcutCompatible() && isJobScheduled(context)) + "\nminDelay=" + flags.getInteger(Experiments.DYNAMIC_MIN_CONTENT_CHANGE_UPDATE_DELAY_MILLIS) + "\nmaxDelay=" + flags.getInteger(Experiments.DYNAMIC_MAX_CONTENT_CHANGE_UPDATE_DELAY_MILLIS)); }// w w w . j a va 2 s . com if (!CompatUtils.isLauncherShortcutCompatible()) return; final DynamicShortcuts shortcuts = new DynamicShortcuts(context); if (!shortcuts.hasRequiredPermissions()) { final IntentFilter filter = new IntentFilter(); filter.addAction(RequestPermissionsActivity.BROADCAST_PERMISSIONS_GRANTED); LocalBroadcastManager.getInstance(shortcuts.mContext).registerReceiver(new PermissionsGrantedReceiver(), filter); } else if (!isJobScheduled(context)) { // Update the shortcuts. If the job is already scheduled then either the app is being // launched to run the job in which case the shortcuts will get updated when it runs or // it has been launched for some other reason and the data we care about for shortcuts // hasn't changed. Because the job reschedules itself after completion this check // essentially means that this will run on each app launch that happens after a reboot. // Note: the task schedules the job after completing. new ShortcutUpdateTask(shortcuts).execute(); } }
From source file:de.tubs.ibr.dtn.service.DaemonService.java
/** * Initialize the daemon service This should be the first job of the service * after creation/* w w w. j av a 2 s . c om*/ */ private void initialize() { // initialize the basic daemon mDaemonProcess.initialize(); // restore registrations mSessionManager.initialize(); if (Log.isLoggable(TAG, Log.DEBUG)) Log.d(TAG, "DaemonService created"); // start daemon if enabled SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); // listen to preference changes prefs.registerOnSharedPreferenceChangeListener(_pref_listener); if (prefs.getBoolean(Preferences.KEY_ENABLED, true)) { // startup the daemon process final Intent intent = new Intent(this, DaemonService.class); intent.setAction(de.tubs.ibr.dtn.service.DaemonService.ACTION_STARTUP); startService(intent); } }
From source file:com.samsung.richnotification.RichNotification.java
@Override //On RichNotification Removed from the gear public void onRemoved(UUID arg0) { if (mCallbackContext == null) return;/* www . ja v a 2s .com*/ try { JSONObject eventMsg = new JSONObject(); eventMsg.put("returnType", RichNotificationHelper.RETURN_TYPE_NOTIFICATION_REMOVED); eventMsg.put("returnValue", arg0.toString()); PluginResult sentResult = new PluginResult(PluginResult.Status.OK, eventMsg); sentResult.setKeepCallback(true); mCallbackContext.sendPluginResult(sentResult); } catch (JSONException jse) { if (Log.isLoggable(RICHNOTI, Log.DEBUG)) Log.d(TAG, "Gear input invalid"); return; } }
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 w w.j av a 2s. c o m*/ if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "Rule " + rule.mName + ": " + url + " -> " + newUrl); } return newUrl; }
From source file:com.ntsync.android.sync.client.NetworkUtilities.java
private static String createUsername(Context context, String email) throws ServerException, NetworkErrorException, UnsupportedEncodingException { final HttpPost post = new HttpPost(CREATEUSERNAME_URI); if (Log.isLoggable(TAG, Log.INFO)) { Log.i(TAG, "createUsername with URI: " + post.getURI()); }//from ww w. ja va 2 s . co m List<BasicNameValuePair> values = new ArrayList<BasicNameValuePair>(); values.add(new BasicNameValuePair("email", email)); HttpEntity postEntity = new UrlEncodedFormEntity(values, SyncDataHelper.DEFAULT_CHARSET_NAME); post.setHeader(postEntity.getContentEncoding()); post.setEntity(postEntity); String username = null; byte[] content; try { final HttpResponse resp = getHttpClient(context).execute(post, createHttpContext(null, null)); content = getResponse(resp); } catch (IOException ex) { throw new NetworkErrorException(ex); } if (content != null && content.length > 0) { username = new String(content, SyncDataHelper.DEFAULT_CHARSET_NAME); } return username; }
From source file:KSView.PercentLayoutHelper.java
/** * Iterates over children and checks if any of them would like to get more space than it * received through the percentage dimension. * <p/>/*from w w w . java2s.co m*/ * If you are building a layout that supports percentage dimensions you are encouraged to take * advantage of this method. The developer should be able to specify that a child should be * remeasured by adding normal dimension attribute with {@code wrap_content} value. For example * he might specify child's attributes as {@code app:layout_widthPercent="60%p"} and * {@code android:layout_width="wrap_content"}. In this case if the child receives too little * space, it will be remeasured with width set to {@code WRAP_CONTENT}. * * @return True if the measure phase needs to be rerun because one of the children would like * to receive more space. */ public boolean handleMeasuredStateTooSmall() { boolean needsSecondMeasure = false; for (int i = 0, N = mHost.getChildCount(); i < N; i++) { View view = mHost.getChildAt(i); ViewGroup.LayoutParams params = view.getLayoutParams(); if (Log.isLoggable(TAG, Log.DEBUG)) { LogUtil.d(TAG, "should handle measured state too small " + view + " " + params); } if (params instanceof PercentLayoutParams) { PercentLayoutInfo info = ((PercentLayoutParams) params).getPercentLayoutInfo(); if (info != null) { if (shouldHandleMeasuredWidthTooSmall(view, info)) { needsSecondMeasure = true; params.width = ViewGroup.LayoutParams.WRAP_CONTENT; } if (shouldHandleMeasuredHeightTooSmall(view, info)) { needsSecondMeasure = true; params.height = ViewGroup.LayoutParams.WRAP_CONTENT; } } } } if (Log.isLoggable(TAG, Log.DEBUG)) { LogUtil.d(TAG, "should trigger second measure pass: " + needsSecondMeasure); } return needsSecondMeasure; }