List of usage examples for android.util Log DEBUG
int DEBUG
To view the source code for android.util Log DEBUG.
Click Source Link
From source file:com.google.android.marvin.mytalkback.ProcessorFocusAndSingleTap.java
private boolean followScrollEvent(AccessibilityNodeInfoCompat source, boolean isMovingForward, boolean wasScrollAction) { AccessibilityNodeInfoCompat root = null; AccessibilityNodeInfoCompat focused = null; try {/* w ww . j a v a 2 s . c o m*/ // First, see if we've already placed accessibility focus. root = AccessibilityServiceCompatUtils.getRootInActiveWindow(mService); if (root == null) { return false; } focused = root.findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY); if (focused != null) { // If a node already has focus, ensure it should still have // focus. Return immediately if it's correctly focused and this // event is not the result a scroll action OR we successfully // refocus the node. if (AccessibilityNodeInfoUtils.shouldFocusNode(mService, focused) && (!wasScrollAction || mCursorController.refocus())) { return true; } LogUtils.log(this, Log.DEBUG, "Clear focus from %s", focused); focused.performAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } // Try focusing the appropriate child node. if (tryFocusingChild(source, isMovingForward)) { return true; } // Finally, try focusing the scrollable node itself. if (tryFocusing(source)) { return true; } return false; } finally { AccessibilityNodeInfoUtils.recycleNodes(root, focused); } }
From source file:de.tubs.ibr.dtn.service.DaemonService.java
@Override public void onStart(Intent intent, int startId) { /*// w w w . j a va 2 s . c o m * If no explicit intent is given start as ACTION_STARTUP. When this * service crashes, Android restarts it without an Intent. Thus * ACTION_STARTUP is executed! */ if (intent == null || intent.getAction() == null) { Log.d(TAG, "intent == null or intent.getAction() == null -> default to ACTION_STARTUP"); intent = new Intent(ACTION_STARTUP); } String action = intent.getAction(); if (Log.isLoggable(TAG, Log.DEBUG)) Log.d(TAG, "Received start id " + startId + ": " + intent); if (Log.isLoggable(TAG, Log.DEBUG)) Log.d(TAG, "Intent Action: " + action); Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); }
From source file:com.cloudzilla.fb.FacebookServiceProxy.java
private com.facebook.AccessToken getAccessToken() { String accessTokenString = null; List<String> permissions = null; List<String> declinedPermissions = null; String applicationId = null;/*from w w w. j av a 2s .c o m*/ String userId = null; Date expirationTime = null; Date lastRefreshTime = null; try { int resultCode = mFacebookService.isOnFacebook(FACEBOOK_SERVICE_API_VERSION); if (resultCode == 0) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "You are on Facebook"); } accessTokenString = mFacebookService.getAccessToken(); permissions = mFacebookService.getPermissions(); applicationId = mFacebookService.getApplicationId(); userId = mFacebookService.getUserId(); expirationTime = new Date(mFacebookService.getAccessTokenExpirationTimeInMs()); lastRefreshTime = new Date(mFacebookService.getAccessTokenLastRefreshTimeInMs()); } else { Log.e(TAG, "You are not on Facebook: " + resultCode); } } catch (RemoteException e) { Log.e(TAG, "Failed to invoke FacebookService", e); } if (accessTokenString == null || permissions == null || applicationId == null || userId == null) { Log.e(TAG, "Some session information is missing"); return null; } com.facebook.AccessTokenSource accessTokenSource = com.facebook.AccessTokenSource.WEB_VIEW; com.facebook.AccessToken accessToken = new com.facebook.AccessToken(accessTokenString, applicationId, userId, permissions, declinedPermissions, accessTokenSource, expirationTime, lastRefreshTime); return accessToken; }
From source file:com.radicaldynamic.groupinform.services.DatabaseService.java
private void openRemoteDb(String db) throws DbUnavailableException { final String tt = t + "openRemoteDb(): "; try {//ww w.j av a 2 s . c o m if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "opening database " + db); mRemoteDbConnector = new InformCouchDbConnector("db_" + db, mRemoteDbInstance); /* * This should trigger any 401:Unauthorized errors when connecting to a remote DB * (better to know about them now then to experience a crash later because we didn't trap something) */ mRemoteDbConnector.getDbInfo(); } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "while opening DB " + db + ": " + e.toString()); e.printStackTrace(); throw new DbUnavailableException(); } }
From source file:com.googlecode.eyesfree.brailleback.BrailleIME.java
void switchAwayFromThisIme() { LogUtils.log(this, Log.DEBUG, "Switching to last IME"); mInputMethodManager.switchToNextInputMethod(getWindow().getWindow().getAttributes().token, false); }
From source file:de.madvertise.android.sdk.MadView.java
/** * Handles the refresh timer/*from w w w .j a v a 2 s .c o m*/ * @param starting */ private void refreshAdTimer(boolean starting) { synchronized (this) { if (starting) { if (adTimer == null) { adTimer = new Timer(); adTimer.schedule(new TimerTask() { public void run() { MadUtil.logMessage(null, Log.DEBUG, "Refreshing ad ..."); requestNewAd(); } }, (long) 0, (long) secondsToRefreshAd * 1000); } } else { if (adTimer != null) { MadUtil.logMessage(null, Log.DEBUG, "Stopping refresh timer ..."); adTimer.cancel(); adTimer = null; } } } }
From source file:de.madvertise.android.sdk.MadvertiseView.java
/** * Starts a background thread to fetch a new ad. Method is called from the * refresh timer task//from w w w . j av a 2 s. c o m */ private void requestNewAd(final boolean isTimerRequest) { if (!mFetchAdsEnabled) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Fetching ads is disabled"); return; } MadvertiseUtil.logMessage(null, Log.DEBUG, "Trying to fetch a new ad"); mRequestThread = new Thread(new Runnable() { public void run() { // read all parameters, that we need for the request // get site token from manifest xml file String siteToken = MadvertiseUtil.getToken(getContext().getApplicationContext(), mCallbackListener); if (siteToken == null) { siteToken = ""; MadvertiseUtil.logMessage(null, Log.DEBUG, "Cannot show ads, since the appID ist null"); } else { MadvertiseUtil.logMessage(null, Log.DEBUG, "appID = " + siteToken); } // create post request HttpPost postRequest = new HttpPost(MadvertiseUtil.MAD_SERVER + "/site/" + siteToken); postRequest.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); // new ad response version, that supports rich media postRequest.addHeader("Accept", "application/vnd.madad+json; version=3"); List<NameValuePair> parameterList = new ArrayList<NameValuePair>(); parameterList.add(new BasicNameValuePair("ua", MadvertiseUtil.getUA())); parameterList.add(new BasicNameValuePair("app", "true")); parameterList.add(new BasicNameValuePair("debug", Boolean.toString(mTestMode))); parameterList .add(new BasicNameValuePair("ip", MadvertiseUtil.getLocalIpAddress(mCallbackListener))); parameterList.add(new BasicNameValuePair("format", "json")); parameterList.add(new BasicNameValuePair("requester", "android_sdk")); parameterList.add(new BasicNameValuePair("version", "3.1.3")); parameterList.add(new BasicNameValuePair("banner_type", mBannerType)); parameterList.add(new BasicNameValuePair("deliver_only_text", Boolean.toString(mDeliverOnlyText))); if (sAge != null && !sAge.equals("")) { parameterList.add(new BasicNameValuePair("age", sAge)); } parameterList.add(new BasicNameValuePair("mraid", Boolean.toString(mIsMraid))); if (sGender != null && !sGender.equals("")) { parameterList.add(new BasicNameValuePair("gender", sGender)); } final Display display = ((WindowManager) getContext().getApplicationContext() .getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); String orientation; if (display.getWidth() > display.getHeight()) { orientation = "landscape"; } else { orientation = "portrait"; } parameterList.add(new BasicNameValuePair("device_height", Integer.toString(display.getHeight()))); parameterList.add(new BasicNameValuePair("device_width", Integer.toString(display.getWidth()))); // When the View is first created, the parent does not exist // when this call is made. Hence, we assume that the parent // size is equal the screen size for the first call. if (mParentWidth == 0 && mParentHeight == 0) { mParentWidth = display.getWidth(); mParentHeight = display.getHeight(); } parameterList.add(new BasicNameValuePair("parent_height", Integer.toString(mParentHeight))); parameterList.add(new BasicNameValuePair("parent_width", Integer.toString(mParentWidth))); parameterList.add(new BasicNameValuePair("device_orientation", orientation)); MadvertiseUtil.refreshCoordinates(getContext().getApplicationContext()); if (MadvertiseUtil.getLocation() != null) { parameterList.add(new BasicNameValuePair("lat", Double.toString(MadvertiseUtil.getLocation().getLatitude()))); parameterList.add(new BasicNameValuePair("lng", Double.toString(MadvertiseUtil.getLocation().getLongitude()))); } parameterList.add(new BasicNameValuePair("app_name", MadvertiseUtil.getApplicationName(getContext().getApplicationContext()))); parameterList.add(new BasicNameValuePair("app_version", MadvertiseUtil.getApplicationVersion(getContext().getApplicationContext()))); parameterList.add(new BasicNameValuePair("udid_md5", MadvertiseUtil.getHashedAndroidID(getContext(), MadvertiseUtil.HashType.MD5))); parameterList.add(new BasicNameValuePair("udid_sha1", MadvertiseUtil.getHashedAndroidID(getContext(), MadvertiseUtil.HashType.SHA1))); parameterList.add(new BasicNameValuePair("mac_md5", MadvertiseUtil.getHashedMacAddress(getContext(), MadvertiseUtil.HashType.MD5))); parameterList.add(new BasicNameValuePair("mac_sha1", MadvertiseUtil.getHashedMacAddress(getContext(), MadvertiseUtil.HashType.SHA1))); UrlEncodedFormEntity urlEncodedEntity = null; try { urlEncodedEntity = new UrlEncodedFormEntity(parameterList); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } postRequest.setEntity(urlEncodedEntity); MadvertiseUtil.logMessage(null, Log.DEBUG, "Post request created"); MadvertiseUtil.logMessage(null, Log.DEBUG, "Uri : " + postRequest.getURI().toASCIIString()); MadvertiseUtil.logMessage(null, Log.DEBUG, "All headers : " + MadvertiseUtil.getAllHeadersAsString(postRequest.getAllHeaders())); MadvertiseUtil.logMessage(null, Log.DEBUG, "All request parameters :" + MadvertiseUtil.printRequestParameters(parameterList)); synchronized (this) { // send blocking request to ad server HttpClient httpClient = new DefaultHttpClient(); HttpResponse httpResponse = null; InputStream inputStream = null; JSONObject json = null; try { HttpParams clientParams = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(clientParams, MadvertiseUtil.CONNECTION_TIMEOUT); HttpConnectionParams.setSoTimeout(clientParams, MadvertiseUtil.CONNECTION_TIMEOUT); MadvertiseUtil.logMessage(null, Log.DEBUG, "Sending request"); httpResponse = httpClient.execute(postRequest); MadvertiseUtil.logMessage(null, Log.DEBUG, "Response Code => " + httpResponse.getStatusLine().getStatusCode()); String message = ""; if (httpResponse.getLastHeader("X-Madvertise-Debug") != null) { message = httpResponse.getLastHeader("X-Madvertise-Debug").toString(); } if (mTestMode) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Madvertise Debug Response: " + message); } int responseCode = httpResponse.getStatusLine().getStatusCode(); HttpEntity entity = httpResponse.getEntity(); if (responseCode == 200 && entity != null) { inputStream = entity.getContent(); String resultString = MadvertiseUtil.convertStreamToString(inputStream); MadvertiseUtil.logMessage(null, Log.DEBUG, "Response => " + resultString); json = new JSONObject(resultString); // create ad mCurrentAd = new MadvertiseAd(getContext().getApplicationContext(), json, mCallbackListener); calculateBannerDimensions(); mHandler.post(mUpdateResults); } else { if (mCallbackListener != null) { mCallbackListener.onIllegalHttpStatusCode(responseCode, message); } } } catch (ClientProtocolException e) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Error in HTTP request / protocol", e); if (mCallbackListener != null) { mCallbackListener.onError(e); } } catch (IOException e) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Could not receive a http response on an ad request", e); if (mCallbackListener != null) { mCallbackListener.onError(e); } } catch (JSONException e) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Could not parse json object", e); if (mCallbackListener != null) { mCallbackListener.onError(e); } } catch (Exception e) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Could not receive a http response on an ad request", e); if (mCallbackListener != null) { mCallbackListener.onError(e); } } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { if (mCallbackListener != null) { mCallbackListener.onError(e); } } } } } } }, "MadvertiseRequestThread"); mRequestThread.start(); }
From source file:de.madvertise.android.sdk.MadView.java
/** * Returns the MD5 hash for a string./*from w ww .j a v a 2s.c om*/ * * @param input * @return md5 hash */ private String getMD5Hash(String input) { MessageDigest messageDigest = null; try { messageDigest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); MadUtil.logMessage(null, Log.DEBUG, "Could not create hash value"); return ""; } messageDigest.update(input.getBytes()); String temp = null; byte[] digest = messageDigest.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < digest.length; i++) { temp = Integer.toHexString(0xFF & digest[i]); if (temp.length() < 2) { temp = "0" + temp; } hexString.append(temp); } return hexString.toString(); }
From source file:org.thoughtland.xlocation.Util.java
public static Method getMethod(Class<?> clazz, String name, Object[] args) { Util.log(null, Log.DEBUG, "Looking for " + name); for (Method m : clazz.getDeclaredMethods()) { Util.log(null, Log.DEBUG, "Got method " + clazz.getSimpleName() + "." + m.getName() + "( " + TextUtils.join(", ", m.getParameterTypes()) + " )"); if (m.getName().equals(name)) { Util.log(null, Log.DEBUG, " names match!"); if (args == null) return m; Class<?>[] params = m.getParameterTypes(); if (params.length == args.length) { Util.log(null, Log.DEBUG, " params length match!"); boolean matches = true; for (int i = 0; i < params.length; i++) { if (args[i] != null && !params[i].isInstance(args[i])) { Util.log(null, Log.DEBUG, " param[" + i + "] " + args[i].getClass().getName() + " does not match type " + params[i].getSimpleName()); matches = false; break; }/* w w w .j a va 2s . com*/ } if (matches) { Util.log(null, Log.DEBUG, "Found match for " + name); return m; } } } } return null; }
From source file:com.kevin.percentsupportextends.PercentLayoutHelper.java
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)) { Log.d(TAG, "should handle measured state too small " + view + " " + params); }// w w w . jav a 2 s . c o m 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)) { Log.d(TAG, "should trigger second measure pass: " + needsSecondMeasure); } return needsSecondMeasure; }