Java Code Examples for android.util.Log#w()
The following examples show how to use
android.util.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: BluetoothGattServer.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Remote client characteristic write request. * @hide */ @Override public void onCharacteristicWriteRequest(String address, int transId, int offset, int length, boolean isPrep, boolean needRsp, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onCharacteristicWriteRequest() - handle=" + handle); BluetoothDevice device = mAdapter.getRemoteDevice(address); BluetoothGattCharacteristic characteristic = getCharacteristicByHandle(handle); if (characteristic == null) { Log.w(TAG, "onCharacteristicWriteRequest() no char for handle " + handle); return; } try { mCallback.onCharacteristicWriteRequest(device, transId, characteristic, isPrep, needRsp, offset, value); } catch (Exception ex) { Log.w(TAG, "Unhandled exception in callback", ex); } }
Example 2
Source File: LogUtil.java From OXChart with Apache License 2.0 | 6 votes |
/**打印不同颜色日志*/ private static void logByType(String type, String tag, String content){ if(BuildConfig.DEBUG) { switch (type){ case "i": Log.i(tag, ""+(null==content?"":content)); break; case "d": Log.d(tag, ""+(null==content?"":content)); break; case "v": Log.v(tag, ""+(null==content?"":content)); break; case "w": Log.w(tag, ""+(null==content?"":content)); break; case "e": Log.e(tag, ""+(null==content?"":content)); break; } } }
Example 3
Source File: Recurrence.java From financisto with GNU General Public License v2.0 | 6 votes |
public DateRecurrenceIterator createIterator(Date now) { RRule rrule = createRRule(); try { Log.d("RRULE", "Creating iterator for "+rrule.toIcal()); if (now.before(startDate.getTime())) { now = startDate.getTime(); } Calendar c = Calendar.getInstance(); c.setTime(startDate.getTime()); //c.set(Calendar.HOUR_OF_DAY, startDate.get(Calendar.HOUR_OF_DAY)); //c.set(Calendar.MINUTE, startDate.get(Calendar.MINUTE)); //c.set(Calendar.SECOND, startDate.get(Calendar.SECOND)); c.set(Calendar.MILLISECOND, 0); return DateRecurrenceIterator.create(rrule, now, c.getTime()); } catch (ParseException e) { Log.w("RRULE", "Unable to create iterator for "+rrule.toIcal()); return DateRecurrenceIterator.empty(); } }
Example 4
Source File: DocumentsProvider.java From FireFiles with Apache License 2.0 | 6 votes |
/** * Implementation is provided by the parent class. Cannot be overriden. * * @see #getDocumentType(String) */ @Override public final String getType(Uri uri) { try { switch (mMatcher.match(uri)) { case MATCH_ROOT: return DocumentsContract.Root.MIME_TYPE_ITEM; case MATCH_DOCUMENT: case MATCH_DOCUMENT_TREE: enforceTree(uri); return getDocumentType(getDocumentId(uri)); default: return null; } } catch (FileNotFoundException e) { Log.w(TAG, "Failed during getType", e); return null; } }
Example 5
Source File: MediaAVRecorder.java From libcommon with Apache License 2.0 | 6 votes |
/** * ディスクの空き容量をチェックして足りなければtrueを返す * @return true: 空き容量が足りない */ @Override protected boolean check() { final Context context = requireContext(); final StorageInfo info; try { info = mOutputFile != null ? StorageUtils.getStorageInfo(context, mOutputFile) : null; if ((info != null) && (info.totalBytes != 0)) { return ((info.freeBytes/ (float)info.totalBytes) < FileUtils.FREE_RATIO) || (info.freeBytes < FileUtils.FREE_SIZE); } } catch (final IOException e) { Log.w(TAG, e); } return (context == null) || ((mOutputFile == null) && !FileUtils.checkFreeSpace(context, getConfig().maxDuration(), mStartTime, mSaveTreeId)); }
Example 6
Source File: KeyboardAccessibilityDelegate.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 6 votes |
/** * Receives hover events when touch exploration is turned on in SDK versions ICS and higher. * * @param event The hover event. * @return {@code true} if the event is handled. */ public boolean onHoverEvent(final MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_HOVER_ENTER: onHoverEnter(event); break; case MotionEvent.ACTION_HOVER_MOVE: onHoverMove(event); break; case MotionEvent.ACTION_HOVER_EXIT: onHoverExit(event); break; default: Log.w(getClass().getSimpleName(), "Unknown hover event: " + event); break; } return true; }
Example 7
Source File: MasterCipher.java From bcm-android with GNU General Public License v3.0 | 5 votes |
public byte[] encryptBytes(byte[] body) { try { Cipher cipher = getEncryptingCipher(masterSecret.getEncryptionKey()); Mac mac = getMac(masterSecret.getMacKey()); byte[] encryptedBody = getEncryptedBody(cipher, body); byte[] encryptedAndMacBody = getMacBody(mac, encryptedBody); return encryptedAndMacBody; } catch (GeneralSecurityException ge) { Log.w("bodycipher", ge); return null; } }
Example 8
Source File: BluetoothLeService.java From IoT-Firstep with GNU General Public License v3.0 | 5 votes |
public void writeCharacteristic(BluetoothGattCharacteristic characteristic) { if (mBluetoothAdapter == null || mBluetoothGatt == null) { Log.w(TAG, "BluetoothAdapter not initialized"); return; } mBluetoothGatt.writeCharacteristic(characteristic); }
Example 9
Source File: ValueAnimator.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * The amount of time, in milliseconds, to delay starting the animation after * {@link #start()} is called. Note that the start delay should always be non-negative. Any * negative start delay will be clamped to 0 on N and above. * * @param startDelay The amount of the delay, in milliseconds */ @Override public void setStartDelay(long startDelay) { // Clamp start delay to non-negative range. if (startDelay < 0) { Log.w(TAG, "Start delay should always be non-negative"); startDelay = 0; } mStartDelay = startDelay; }
Example 10
Source File: Config.java From ankihelper with GNU General Public License v3.0 | 5 votes |
/** * Set reading direction mode options for users. This method should be called before * {@link #setDirection(Direction)} as it has higher preference. * * @param allowedDirection reading direction mode options for users. Setting to * {@link AllowedDirection#VERTICAL_AND_HORIZONTAL} users will have * choice to select the reading direction at runtime. */ public Config setAllowedDirection(AllowedDirection allowedDirection) { this.allowedDirection = allowedDirection; if (allowedDirection == null) { this.allowedDirection = DEFAULT_ALLOWED_DIRECTION; direction = DEFAULT_DIRECTION; Log.w(LOG_TAG, "-> allowedDirection cannot be null, defaulting " + "allowedDirection to " + DEFAULT_ALLOWED_DIRECTION + " and direction to " + DEFAULT_DIRECTION); } else if (allowedDirection == AllowedDirection.ONLY_VERTICAL && direction != Direction.VERTICAL) { direction = Direction.VERTICAL; Log.w(LOG_TAG, "-> allowedDirection is " + allowedDirection + ", defaulting direction to " + direction); } else if (allowedDirection == AllowedDirection.ONLY_HORIZONTAL && direction != Direction.HORIZONTAL) { direction = Direction.HORIZONTAL; Log.w(LOG_TAG, "-> allowedDirection is " + allowedDirection + ", defaulting direction to " + direction); } return this; }
Example 11
Source File: LoaderManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
void doRetain() { if (DEBUG) Log.v(TAG, "Retaining in " + this); if (!mStarted) { RuntimeException e = new RuntimeException("here"); e.fillInStackTrace(); Log.w(TAG, "Called doRetain when not started: " + this, e); return; } mRetaining = true; mStarted = false; for (int i = mLoaders.size()-1; i >= 0; i--) { mLoaders.valueAt(i).retain(); } }
Example 12
Source File: SupplementalInfoRetriever.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
@Override public final Object doInBackground(Object... args) { try { retrieveSupplementalInfo(); } catch (IOException e) { Log.w(TAG, e); } return null; }
Example 13
Source File: AutoFocusManager.java From IDCardCamera with Apache License 2.0 | 5 votes |
public synchronized void stop() { stopped = true; if (useAutoFocus) { cancelOutstandingTask(); // Doesn't hurt to call this even if not focusing try { camera.cancelAutoFocus(); } catch (RuntimeException re) { // Have heard RuntimeException reported in Android 4.0.x+; // continue? Log.w(TAG, "Unexpected exception while cancelling focusing", re); } } }
Example 14
Source File: ResultHandler.java From ZXing-Standalone-library with Apache License 2.0 | 5 votes |
final void openURL(String url) { // Strangely, some Android browsers don't seem to register to handle HTTP:// or HTTPS://. // Lower-case these as it should always be OK to lower-case these schemes. if (url.startsWith("HTTP://")) { url = "http" + url.substring(4); } else if (url.startsWith("HTTPS://")) { url = "https" + url.substring(5); } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); try { launchIntent(intent); } catch (ActivityNotFoundException ignored) { Log.w(TAG, "Nothing available to handle " + intent); } }
Example 15
Source File: MusicControlModule.java From react-native-music-control with MIT License | 5 votes |
private Bitmap loadArtwork(String url, boolean local) { Bitmap bitmap = null; try { // If we are running the app in debug mode, the "local" image will be served from htt://localhost:8080, so we need to check for this case and load those images from URL if(local && !url.startsWith("http")) { // Gets the drawable from the RN's helper for local resources ResourceDrawableIdHelper helper = ResourceDrawableIdHelper.getInstance(); Drawable image = helper.getResourceDrawable(getReactApplicationContext(), url); if(image instanceof BitmapDrawable) { bitmap = ((BitmapDrawable)image).getBitmap(); } else { bitmap = BitmapFactory.decodeFile(url); } } else { // Open connection to the URL and decodes the image URLConnection con = new URL(url).openConnection(); con.connect(); InputStream input = con.getInputStream(); bitmap = BitmapFactory.decodeStream(input); input.close(); } } catch(IOException | IndexOutOfBoundsException ex) { Log.w(TAG, "Could not load the artwork", ex); } return bitmap; }
Example 16
Source File: IconHelper.java From FireFiles with Apache License 2.0 | 5 votes |
@Override protected Bitmap doInBackground(Uri... params) { if (isCancelled()) return null; final Context context = mIconThumb.getContext(); final ContentResolver resolver = context.getContentResolver(); ContentProviderClient client = null; Bitmap result = null; try { client = DocumentsApplication.acquireUnstableProviderOrThrow(resolver, mUri.getAuthority()); result = DocumentsContract.getDocumentThumbnail(resolver, mUri, mThumbSize, mSignal); if (null == result){ result = ImageUtils.getThumbnail(mPath, mimeType, mThumbSize.x, mThumbSize.y); } if (result != null) { final ThumbnailCache thumbs = DocumentsApplication.getThumbnailsCache(context, mThumbSize); thumbs.put(mUri, result); } } catch (Exception e) { if (!(e instanceof OperationCanceledException)) { Log.w(TAG, "Failed to load thumbnail for " + mUri + ": " + e); } CrashReportingManager.logException(e); } finally { ContentProviderClientCompat.releaseQuietly(client); } return result; }
Example 17
Source File: MessengerUtils.java From AndroidUtilCode with Apache License 2.0 | 5 votes |
@Override public void onServiceDisconnected(ComponentName name) { Log.w("MessengerUtils", "client service disconnected:" + name); mServer = null; if (!bind()) { Log.e("MessengerUtils", "client service rebind failed: " + name); } }
Example 18
Source File: MultiDex.java From atlas with Apache License 2.0 | 4 votes |
private static void install(ClassLoader loader, List<? extends File> additionalClassPathEntries, File optimizedDirectory) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, InvocationTargetException, NoSuchMethodException { /* The patched class loader is expected to be a descendant of * dalvik.system.BaseDexClassLoader. We modify its * dalvik.system.DexPathList pathList field to append additional DEX * file entries. */ Field pathListField = findField(loader, "pathList"); Object dexPathList = pathListField.get(loader); ArrayList<IOException> suppressedExceptions = new ArrayList<IOException>(); expandFieldArray(dexPathList, "dexElements", makeDexElements(dexPathList, new ArrayList<File>(additionalClassPathEntries), optimizedDirectory, suppressedExceptions)); if (suppressedExceptions.size() > 0) { for (IOException e : suppressedExceptions) { Log.w(TAG, "Exception in makeDexElement", e); } Field suppressedExceptionsField = findField(dexPathList, "dexElementsSuppressedExceptions"); IOException[] dexElementsSuppressedExceptions = (IOException[]) suppressedExceptionsField.get(dexPathList); if (dexElementsSuppressedExceptions == null) { dexElementsSuppressedExceptions = suppressedExceptions.toArray( new IOException[suppressedExceptions.size()]); } else { IOException[] combined = new IOException[suppressedExceptions.size() + dexElementsSuppressedExceptions.length]; suppressedExceptions.toArray(combined); System.arraycopy(dexElementsSuppressedExceptions, 0, combined, suppressedExceptions.size(), dexElementsSuppressedExceptions.length); dexElementsSuppressedExceptions = combined; } suppressedExceptionsField.set(dexPathList, dexElementsSuppressedExceptions); } }
Example 19
Source File: LogUtils.java From Hook with Apache License 2.0 | 4 votes |
public static void w(Throwable tr) { if (mDebuggable >= LEVEL_WARN) { Log.w(mTag, "", tr); } }
Example 20
Source File: GLSurfaceView.java From unity-ads-android with Apache License 2.0 | 4 votes |
public void destroySurface() { if (LOG_EGL) { Log.w("EglHelper", "destroySurface() tid=" + Thread.currentThread().getId()); } destroySurfaceImp(); }