Java Code Examples for android.util.Log
The following examples show how to use
android.util.Log. These examples are extracted from open source projects.
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 Project: android_external_MicroGUiTools Source File: PermissionCheckGroup.java License: Apache License 2.0 | 7 votes |
private void doPermissionCheck(Context context, ResultCollector collector, final String permission) { PackageManager pm = context.getPackageManager(); try { PermissionInfo info = pm.getPermissionInfo(permission, 0); PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null; CharSequence permLabel = info.loadLabel(pm); CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel; collector.addResult(context.getString(R.string.self_check_name_permission, permLabel), context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative, context.getString(R.string.self_check_resolution_permission, groupLabel), new SelfCheckGroup.CheckResolver() { @Override public void tryResolve(Fragment fragment) { fragment.requestPermissions(new String[]{permission}, 0); } }); } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, e); } }
Example 2
Source Project: UpdogFarmer Source File: SteamService.java License: GNU General Public License v3.0 | 7 votes |
/** * Resume farming/idling */ private void resumeFarming() { if (paused || waiting) { return; } if (farming) { Log.i(TAG, "Resume farming"); executor.execute(farmTask); } else if (currentGames.size() == 1) { Log.i(TAG, "Resume playing"); new Handler(Looper.getMainLooper()).post(() -> idleSingle(currentGames.get(0))); } else if (currentGames.size() > 1) { Log.i(TAG, "Resume playing (multiple)"); idleMultiple(currentGames); } }
Example 3
Source Project: 600SeriesAndroidUploader Source File: NightscoutUploadProcess.java License: MIT License | 6 votes |
private int deleteTreatments(Response<List<TreatmentsEndpoints.Treatment>> response) throws Exception { cheanupCheckCount++; int result = 0; if (response.isSuccessful()) { List<TreatmentsEndpoints.Treatment> list = response.body(); for (TreatmentsEndpoints.Treatment item : list) { cheanupDeleteCount++; Response<ResponseBody> responseBody = dataStore.isNightscoutUseQuery() ? treatmentsEndpoints.deleteID(item.getCreated_at(), item.get_id()).execute() : treatmentsEndpoints.deleteID(item.get_id()).execute(); if (responseBody.isSuccessful()) { Log.d(TAG, String.format("deleted treatment ID: %s with KEY: %s MAC: %s DATE: %s QUERY: %s", item.get_id(), item.getKey600(), item.getPumpMAC600(), item.getCreated_at(), dataStore.isNightscoutUseQuery())); } else { Log.d(TAG, "no DELETE response from nightscout site"); return -1; } result++; } } else return -1; return result; }
Example 4
Source Project: MobileInfo Source File: SimCardInfo.java License: Apache License 2.0 | 6 votes |
static JSONObject getMobSimInfo(Context context) { SimCardBean simCardBean = new SimCardBean(); try { simCardBean.setHaveCard(hasSimCard(context)); // SimCardUtils.SimCardInfo simCardInfo = SimCardUtils.instance().getmSimCardInfo(context.getApplicationContext()); // simCardBean.setSim1Imsi(simCardInfo.getSim1Imsi()); // simCardBean.setSim2Imsi(simCardInfo.getSim2Imsi()); // simCardBean.setOperator(getOperators(simCardInfo.getOperator(simSlotIndex))); // simCardBean.setSim1ImsiOperator(getOperators(simCardInfo.getSim1Imsi())); // simCardBean.setSim2ImsiOperator(getOperators(simCardInfo.getSim2Imsi())); MobCardUtils.mobGetCardInfo(context, simCardBean); } catch (Exception e) { Log.e(TAG, e.toString()); } return simCardBean.toJSONObject(); }
Example 5
Source Project: 600SeriesAndroidUploader Source File: MasterService.java License: MIT License | 6 votes |
private boolean checkUsbDevice() { if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_USB_HOST)) { Log.e(TAG, "Device does not support USB OTG"); statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR); UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_support); return false; } UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); if (usbManager == null) { Log.e(TAG, "USB connection error. mUsbManager == null"); statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR); UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_connection); return false; } if (UsbHidDriver.getUsbDevice(usbManager, MedtronicCnlService.USB_VID, MedtronicCnlService.USB_PID) == null) { Log.w(TAG, "USB connection error. Is the CNL plugged in?"); statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR); UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_connection); return false; } return true; }
Example 6
Source Project: SimpleBluetoothLeTerminal Source File: SerialSocket.java License: MIT License | 6 votes |
@Override public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { delegate.onDescriptorWrite(gatt, descriptor, status); if(canceled) return; if(descriptor.getCharacteristic() == readCharacteristic) { Log.d(TAG,"writing read characteristic descriptor finished, status="+status); if (status != BluetoothGatt.GATT_SUCCESS) { onSerialConnectError(new IOException("write descriptor failed")); } else { // onCharacteristicChanged with incoming data can happen after writeDescriptor(ENABLE_INDICATION/NOTIFICATION) // before confirmed by this method, so receive data can be shown before device is shown as 'Connected'. onSerialConnect(); connected = true; Log.d(TAG, "connected"); } } }
Example 7
Source Project: esp-idf-provisioning-android Source File: ESPDevice.java License: Apache License 2.0 | 6 votes |
private void getFullWiFiList() { Log.e(TAG, "Total count : " + totalCount + " and start index is : " + startIndex); if (totalCount < 4) { getWiFiScanList(0, totalCount); } else { int temp = totalCount - startIndex; if (temp > 0) { if (temp > 4) { getWiFiScanList(startIndex, 4); } else { getWiFiScanList(startIndex, temp); } } else { Log.d(TAG, "Nothing to do. Wifi list completed."); completeWifiList(); } } }
Example 8
Source Project: android_9.0.0_r45 Source File: WallpaperService.java License: Apache License 2.0 | 6 votes |
void reportVisibility() { if (!mDestroyed) { mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState(); boolean visible = mVisible && mDisplayState != Display.STATE_OFF; if (mReportedVisible != visible) { mReportedVisible = visible; if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible + "): " + this); if (visible) { // If becoming visible, in preview mode the surface // may have been destroyed so now we need to make // sure it is re-created. doOffsetsChanged(false); updateSurface(false, false, false); } onVisibilityChanged(visible); } } }
Example 9
Source Project: android_9.0.0_r45 Source File: BluetoothMapClient.java License: Apache License 2.0 | 6 votes |
/** * Returns true if the specified Bluetooth device is connected. * Returns false if not connected, or if this proxy object is not * currently connected to the Map service. */ public boolean isConnected(BluetoothDevice device) { if (VDBG) Log.d(TAG, "isConnected(" + device + ")"); final IBluetoothMapClient service = mService; if (service != null) { try { return service.isConnected(device); } catch (RemoteException e) { Log.e(TAG, e.toString()); } } else { Log.w(TAG, "Proxy not attached to service"); if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } return false; }
Example 10
Source Project: hayoou-wechat-export Source File: MomentStatActivity.java License: GNU General Public License v3.0 | 6 votes |
public void shareToTimeLine() { generateShareImage(); File file = new File(Config.EXT_DIR + "/share_image.jpg"); try { Intent intent = new Intent(); ComponentName comp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareToTimeLineUI"); intent.setComponent(comp); intent.setAction("android.intent.action.SEND"); intent.setType("image/*"); //intent.setFlags(0x3000001); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); startActivity(intent); } catch (Exception e) { Log.e("wechatmomentstat", "exception", e); } }
Example 11
Source Project: LPR Source File: FpsMeter.java License: Apache License 2.0 | 6 votes |
public void measure() { if (!mIsInitialized) { init(); mIsInitialized = true; } else { mFramesCounter++; if (mFramesCounter % STEP == 0) { long time = Core.getTickCount(); double fps = STEP * mFrequency / (time - mprevFrameTime); mprevFrameTime = time; if (mWidth != 0 && mHeight != 0) mStrfps = FPS_FORMAT.format(fps) + " [email protected]" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight); else mStrfps = FPS_FORMAT.format(fps) + " FPS"; Log.i(TAG, mStrfps); } } }
Example 12
Source Project: xDrip Source File: Forecast.java License: GNU General Public License v3.0 | 6 votes |
@Override public void setValues(double[] y, double[] x) { if (x.length != y.length) { throw new IllegalArgumentException(String.format("The numbers of y and x values must be equal (%d != %d)", y.length, x.length)); } double[][] xData = new double[x.length][]; for (int i = 0; i < x.length; i++) { // the implementation determines how to produce a vector of predictors from a single x xData[i] = xVector(x[i]); } if (logY()) { // in some models we are predicting ln y, so we replace each y with ln y y = Arrays.copyOf(y, y.length); // user might not be finished with the array we were given for (int i = 0; i < x.length; i++) { y[i] = Math.log(y[i]); } } final OLSMultipleLinearRegression ols = new OLSMultipleLinearRegression(); ols.setNoIntercept(true); // let the implementation include a constant in xVector if desired ols.newSampleData(y, xData); // provide the data to the model coef = MatrixUtils.createColumnRealMatrix(ols.estimateRegressionParameters()); // get our coefs last_error_rate = ols.estimateErrorVariance(); Log.d(TAG, getClass().getSimpleName() + " Forecast Error rate: errorvar:" + JoH.qs(last_error_rate, 4) + " regssionvar:" + JoH.qs(ols.estimateRegressandVariance(), 4) + " stderror:" + JoH.qs(ols.estimateRegressionStandardError(), 4)); }
Example 13
Source Project: android_9.0.0_r45 Source File: PlaybackActivityMonitor.java License: Apache License 2.0 | 6 votes |
void addDuck(@NonNull AudioPlaybackConfiguration apc, boolean skipRamp) { final int piid = new Integer(apc.getPlayerInterfaceId()); if (mDuckedPlayers.contains(piid)) { if (DEBUG) { Log.v(TAG, "player piid:" + piid + " already ducked"); } return; } try { sEventLogger.log((new DuckEvent(apc, skipRamp)).printLog(TAG)); apc.getPlayerProxy().applyVolumeShaper( DUCK_VSHAPE, skipRamp ? PLAY_SKIP_RAMP : PLAY_CREATE_IF_NEEDED); mDuckedPlayers.add(piid); } catch (Exception e) { Log.e(TAG, "Error ducking player piid:" + piid + " uid:" + mUid, e); } }
Example 14
Source Project: cythara Source File: AndroidFFMPEGLocator.java License: GNU General Public License v3.0 | 6 votes |
private String getFFMPEGFileName(CPUArchitecture architecture){ final String ffmpegFileName; switch (architecture){ case X86: ffmpegFileName = "x86_ffmpeg"; break; case ARMEABI_V7A: ffmpegFileName = "armeabi-v7a_ffmpeg"; break; case ARMEABI_V7A_NEON: ffmpegFileName = "armeabi-v7a-neon_ffmpeg"; break; default: ffmpegFileName = null; String message= "Could not determine your processor architecture correctly, no ffmpeg binary available."; Log.e(TAG,message); throw new Error(message); } return ffmpegFileName; }
Example 15
Source Project: BiliShare Source File: BaseQQShareHandler.java License: Apache License 2.0 | 6 votes |
/** * 必须在主线程分享 * * @param activity * @param params */ protected void doShareToQQ(final Activity activity, final Bundle params) { doOnMainThread(new Runnable() { @Override public void run() { Log.d(TAG, "real start share"); postProgressStart(); onShare(activity, mTencent, params, mUiListener); if (activity != null && !isMobileQQSupportShare(activity.getApplicationContext())) { Log.d(TAG, "qq has not install"); String msg = activity.getString(R.string.bili_share_sdk_not_install_qq); Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show(); if (getShareListener() != null) { getShareListener().onError(getShareMedia(), BiliShareStatusCode.ST_CODE_SHARE_ERROR_NOT_INSTALL, new ShareException(msg)); } } } }); }
Example 16
Source Project: android-unicode Source File: Utf7ImeService.java License: MIT License | 6 votes |
@Override public View onCreateInputView() { Log.d(TAG, "onCreateInputView()"); View mInputView = getLayoutInflater().inflate(R.layout.keyboard, null); if (mReceiver == null) { IntentFilter filter = new IntentFilter(IME_MESSAGE); filter.addAction(IME_CHARS); filter.addAction(IME_KEYCODE); filter.addAction(IME_EDITORCODE); mReceiver = new AdbReceiver(); registerReceiver(mReceiver, filter); } return mInputView; }
Example 17
Source Project: react-native-twilio-programmable-voice Source File: TwilioVoiceModule.java License: MIT License | 6 votes |
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(ACTION_INCOMING_CALL)) { if (BuildConfig.DEBUG) { Log.d(TAG, "VoiceBroadcastReceiver.onReceive ACTION_INCOMING_CALL. Intent "+ intent.getExtras()); } handleIncomingCallIntent(intent); } else if (action.equals(ACTION_MISSED_CALL)) { SharedPreferences sharedPref = getReactApplicationContext().getSharedPreferences(PREFERENCE_KEY, Context.MODE_PRIVATE); SharedPreferences.Editor sharedPrefEditor = sharedPref.edit(); sharedPrefEditor.remove(MISSED_CALLS_GROUP); sharedPrefEditor.commit(); } else { Log.e(TAG, "received broadcast unhandled action " + action); } }
Example 18
Source Project: android_9.0.0_r45 Source File: FragmentManager.java License: Apache License 2.0 | 5 votes |
/** * Marks a fragment as shown to be later animated in with * {@link #completeShowHideFragment(Fragment)}. * * @param fragment The fragment to be shown. */ public void showFragment(Fragment fragment) { if (DEBUG) Log.v(TAG, "show: " + fragment); if (fragment.mHidden) { fragment.mHidden = false; // Toggle hidden changed so that if a fragment goes through show/hide/show // it doesn't go through the animation. fragment.mHiddenChanged = !fragment.mHiddenChanged; } }
Example 19
Source Project: monkeyboard-radio-android Source File: RadioPlayerService.java License: GNU General Public License v3.0 | 5 votes |
@Override public void onAdjustVolume(int direction) { super.onAdjustVolume(direction); if (direction != 0) { setPlayerVolume(getPlayerVolume() + direction); Log.v(TAG, "Volume adjusted: " + getPlayerVolume()); notifyPlayerVolumeChanged(getPlayerVolume()); } }
Example 20
Source Project: polling-station-app Source File: TesseractOCRTest.java License: GNU Lesser General Public License v3.0 | 5 votes |
@Test public void testOCRInputPassport2() throws Exception { Bitmap mrzImage = BitmapFactory.decodeStream(InstrumentationRegistry.getInstrumentation().getTargetContext().getAssets().open(image2)); assertNotNull(mrzImage); double similarity = stringSimilarity(image2Result, tesseractOCR.ocr(mrzImage).getText()); Log.e(TAG, "Similarity passport2: " + similarity); assertTrue(similarity > MINIMUM_ACCURACY); }
Example 21
Source Project: IncDec Source File: IncDecImageButton.java License: Apache License 2.0 | 5 votes |
/** Rx Java **/ private void startIncrementObserver(){ _Incrementsubscriber=new DisposableSubscriber<Long>() { @Override public void onNext(Long aLong) { if(isLeftButtonLongPressed||isRightButtonLongPressed) { IncrementAction(); } else _Incrementsubscriber.dispose(); } @Override public void onError(Throwable t) { Log.i(TAG,t.getMessage()); } @Override public void onComplete() { } }; Flowable.interval(0,seconds, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe(_Incrementsubscriber); }
Example 22
Source Project: OpenYOLO-Android Source File: CredentialPickerActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(LOG_TAG, "Picker invoked by " + getCallingPackage()); setContentView(R.layout.credential_picker_layout); ButterKnife.bind(this); mCredentialView.setAdapter(new CredentialPickerAdapter(getCredentials())); mCredentialView.setLayoutManager(new LinearLayoutManager(this)); }
Example 23
Source Project: xDrip-plus Source File: JoH.java License: GNU General Public License v3.0 | 5 votes |
public static boolean refreshDeviceCache(String thisTAG, BluetoothGatt gatt){ try { final Method method = gatt.getClass().getMethod("refresh", new Class[0]); if (method != null) { return (Boolean) method.invoke(gatt, new Object[0]); } } catch (Exception e) { Log.e(thisTAG, "An exception occured while refreshing gatt device cache: "+e); } return false; }
Example 24
Source Project: x5webview-cordova-plugin Source File: X5WebViewEngine.java License: Apache License 2.0 | 5 votes |
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) { if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) { Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old."); // Bug being that Java Strings do not get converted to JS strings automatically. // This isn't hard to work-around on the JS side, but it's easier to just // use the prompt bridge instead. return; } X5ExposedJsApi exposedJsApi = new X5ExposedJsApi(bridge); webView.addJavascriptInterface(exposedJsApi, "_cordovaNative"); }
Example 25
Source Project: MobileInfo Source File: AudioBean.java License: Apache License 2.0 | 5 votes |
@Override protected JSONObject toJSONObject() { try { jsonObject.put(BaseData.Aduio.MAX_VOICE_CALL, maxVoiceCall); jsonObject.put(BaseData.Aduio.MIN_VOICE_CALL, minVoiceCall); jsonObject.put(BaseData.Aduio.CURRENT_VOICE_CALL, currentVoiceCall); jsonObject.put(BaseData.Aduio.MAX_SYSTEM, maxSystem); jsonObject.put(BaseData.Aduio.MIN_SYSTEM, minSystem); jsonObject.put(BaseData.Aduio.CURRENT_SYSTEM, currentSystem); jsonObject.put(BaseData.Aduio.MAX_RING, maxRing); jsonObject.put(BaseData.Aduio.MIN_RING, minRing); jsonObject.put(BaseData.Aduio.CURRENT_RING, currentRing); jsonObject.put(BaseData.Aduio.MAX_MUSIC, maxMusic); jsonObject.put(BaseData.Aduio.MIN_MUSIC, minMusic); jsonObject.put(BaseData.Aduio.CURRENT_MUSIC, currentMusic); jsonObject.put(BaseData.Aduio.MAX_ALARM, maxAlarm); jsonObject.put(BaseData.Aduio.MIN_ALARM, minAlarm); jsonObject.put(BaseData.Aduio.CURRENT_ALARM, currentAlarm); jsonObject.put(BaseData.Aduio.MAX_NOTIFICATIONS, maxNotifications); jsonObject.put(BaseData.Aduio.MIN_NOTIFICATIONS, minNotifications); jsonObject.put(BaseData.Aduio.CURRENT_NOTIFICATIONS, currentNotifications); jsonObject.put(BaseData.Aduio.MAX_ACCESSIBILITY, maxAccessibility); jsonObject.put(BaseData.Aduio.MIN_ACCESSIBILITY, minAccessibility); jsonObject.put(BaseData.Aduio.CURRENT_ACCESSIBILITY, currentAccessibility); jsonObject.put(BaseData.Aduio.MAX_DTMF, maxDTMF); jsonObject.put(BaseData.Aduio.MIN_DTMF, minDTMF); jsonObject.put(BaseData.Aduio.CURRENT_DTMF, currentDTMF); } catch (Exception e) { Log.e(TAG, e.toString()); } return super.toJSONObject(); }
Example 26
Source Project: Android-Bluetooth-Fingerprint Source File: BluetoothService.java License: Apache License 2.0 | 5 votes |
public ConnectThread(BluetoothDevice device) { mmDevice = device; BluetoothSocket tmp = null; // Get a BluetoothSocket for a connection with the // given BluetoothDevice try { tmp = device.createRfcommSocketToServiceRecord(MY_UUID); } catch (IOException e) { Log.e(TAG, "create() failed", e); } mmSocket = tmp; }
Example 27
Source Project: wear-os-samples Source File: InteractiveWatchFaceService.java License: Apache License 2.0 | 5 votes |
@Override public void onPeekCardPositionUpdate(Rect bounds) { super.onPeekCardPositionUpdate(bounds); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "onPeekCardPositionUpdate: " + bounds); } super.onPeekCardPositionUpdate(bounds); if (!bounds.equals(mCardBounds)) { mCardBounds.set(bounds); invalidate(); } }
Example 28
Source Project: letv Source File: ItemTouchHelper.java License: Apache License 2.0 | 5 votes |
public void startDrag(ViewHolder viewHolder) { if (!this.mCallback.hasDragFlag(this.mRecyclerView, viewHolder)) { Log.e(TAG, "Start drag has been called but swiping is not enabled"); } else if (viewHolder.itemView.getParent() != this.mRecyclerView) { Log.e(TAG, "Start drag has been called with a view holder which is not a child of the RecyclerView which is controlled by this ItemTouchHelper."); } else { obtainVelocityTracker(); this.mDy = 0.0f; this.mDx = 0.0f; select(viewHolder, 2); } }
Example 29
Source Project: Ezalor Source File: LogUtils.java License: Apache License 2.0 | 5 votes |
public static void logv(String tag, String msg) { if (disableAllLog()) { return; } Log.v(getCurrentAppTag() + POINT + tag, msg); saveLogIfNeeded(tag, msg, "V"); }
Example 30
Source Project: owt-client-android Source File: ConferenceClientObserver.java License: Apache License 2.0 | 5 votes |
@Override public void onParticipantJoined(Participant participant) { Log.d(TAG, "onParticipantJoined."); userJoinedTriggered = true; TestObserver participantObserver = new TestObserver(this.name, participant.id); participant.addObserver(participantObserver); participants.add(participant); participantObservers.put(participant.id, participantObserver); onResult(); }