1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-07 16:06:18 +00:00

set logging to info not debug

This commit is contained in:
Loic Blot 2016-10-07 09:08:43 +02:00
parent d598602cba
commit a4f016f069
14 changed files with 40 additions and 34 deletions

View File

@ -232,7 +232,7 @@ public class LoginActivity extends AppCompatActivity {
public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
UserLoginTask(String serverURI, String login, String password) {
Log.d(TAG, "_serverURI = " + serverURI);
Log.i(TAG, "_serverURI = " + serverURI);
_serverURI = Uri.parse(serverURI);
_login = login;
_password = password;

View File

@ -70,7 +70,7 @@ public class OCSMSSettingsActivity extends VirtualSettingsActivity {
"sync_3g".equals(key) || "sync_gprs".equals(key) ||
"sync_4g".equals(key) || "sync_others".equals(key)) {
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(VirtualSettingsActivity._context);
Log.d(OCSMSSettingsActivity.TAG,"OCSMSSettingsActivity.handleCheckboxPreference: set " + key + " to "
Log.i(OCSMSSettingsActivity.TAG,"OCSMSSettingsActivity.handleCheckboxPreference: set " + key + " to "
+ value.toString());
prefs.putBoolean(key, value);
}
@ -87,7 +87,7 @@ public class OCSMSSettingsActivity extends VirtualSettingsActivity {
.setSummary((index >= 0) ? preference.getEntries()[index]
: null);
Log.d(OCSMSSettingsActivity.TAG, "Modifying listPreference " + key);
Log.i(OCSMSSettingsActivity.TAG, "Modifying listPreference " + key);
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(VirtualSettingsActivity._context);

View File

@ -193,7 +193,7 @@ public class ContactListActivity extends AppCompatActivity implements ASyncConta
switch (requestCodeID) {
case REQUEST_CONTACTS:
for (int grantResult : grantResults) {
Log.d("OcSMS", Integer.toString(grantResult));
Log.i("OcSMS", Integer.toString(grantResult));
}
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
fetchContact(mFetchedContact);

View File

@ -192,11 +192,11 @@ public class VirtualSettingsActivity extends PreferenceActivity {
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
if (preference instanceof ListPreference) {
Log.d(TAG, "Changed list preference " + preference.toString() + " value " + value.toString());
Log.i(TAG, "Changed list preference " + preference.toString() + " value " + value.toString());
handleListPreference(preference.getKey(), value.toString(), (ListPreference) preference);
} else if (preference instanceof CheckBoxPreference) {
Log.d(TAG, "Changed checkbox preference " + preference.toString() + " value " + value.toString());
Log.i(TAG, "Changed checkbox preference " + preference.toString() + " value " + value.toString());
handleCheckboxPreference(preference.getKey(), (Boolean) value);
} else {
// For all other preferences, set the summary to the value's

View File

@ -37,13 +37,13 @@ public class RecoveryPhoneNumberListViewAdapter extends ArrayAdapter<String> {
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "Clicked on phone " + l);
Log.i(TAG, "Clicked on phone " + l);
}
});
v.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Log.d(TAG, "Long clicked on phone " + l);
Log.i(TAG, "Long clicked on phone " + l);
return false;
}
});

View File

@ -138,7 +138,7 @@ public class OwnCloudAuthenticator extends AbstractAccountAuthenticator {
try {
if(OwnCloudAuthenticator.isSuccess(status)) {
String response = get.getResponseBodyAsString();
Log.d(OwnCloudAuthenticator.TAG, "Successful response: " + response);
Log.i(OwnCloudAuthenticator.TAG, "Successful response: " + response);
// Parse the response
JSONObject respJSON = new JSONObject(response);
@ -148,7 +148,7 @@ public class OwnCloudAuthenticator extends AbstractAccountAuthenticator {
String displayName = respData.getString(OwnCloudAuthenticator.NODE_DISPLAY_NAME);
String email = respData.getString(OwnCloudAuthenticator.NODE_EMAIL);
Log.d(OwnCloudAuthenticator.TAG, "*** Parsed user information: " + id + " - " + displayName + " - " + email);
Log.i(OwnCloudAuthenticator.TAG, "*** Parsed user information: " + id + " - " + displayName + " - " + email);
} else {
String response = get.getResponseBodyAsString();

View File

@ -53,14 +53,14 @@ public class ConnectivityChanged extends BroadcastReceiver implements ASyncSMSSy
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(context);
if (!prefs.pushOnReceive()) {
Log.d(ConnectivityChanged.TAG,"ConnectivityChanges.onReceive: pushOnReceive is disabled");
Log.i(ConnectivityChanged.TAG,"ConnectivityChanges.onReceive: pushOnReceive is disabled");
return;
}
// If data is available and previous dataConnectionState was false, then we need to sync
if (cMon.isValid() && !ConnectivityChanged.dataConnectionAvailable) {
ConnectivityChanged.dataConnectionAvailable = true;
Log.d(ConnectivityChanged.TAG,"ConnectivityChanged.onReceive, data conn available");
Log.i(ConnectivityChanged.TAG,"ConnectivityChanged.onReceive, data conn available");
if (!PermissionChecker.checkPermission(context, Manifest.permission.READ_SMS,
PermissionID.REQUEST_SMS)) {
@ -72,14 +72,14 @@ public class ConnectivityChanged extends BroadcastReceiver implements ASyncSMSSy
// No data available and previous dataConnectionState was true
else if (ConnectivityChanged.dataConnectionAvailable && !cMon.isValid()) {
ConnectivityChanged.dataConnectionAvailable = false;
Log.d(ConnectivityChanged.TAG,"ConnectivityChanges.onReceive: data conn is off");
Log.i(ConnectivityChanged.TAG,"ConnectivityChanges.onReceive: data conn is off");
}
}
private void checkMessagesAndSend(Context context) {
// Get last message synced from preferences
Long lastMessageSynced = (new OCSMSSharedPrefs(context)).getLastMessageDate();
Log.d(ConnectivityChanged.TAG,"Synced Last:" + lastMessageSynced);
Log.i(ConnectivityChanged.TAG,"Synced Last:" + lastMessageSynced);
// Now fetch messages since last stored date
JSONArray smsList = new JSONArray();

View File

@ -31,7 +31,7 @@ public class IncomingSms extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (IncomingSms._mboxObserver == null) {
Log.d(IncomingSms.TAG,"_mboxObserver == null");
Log.i(IncomingSms.TAG,"_mboxObserver == null");
IncomingSms._mboxObserver = new SmsObserver(new Handler(), context);
context.getContentResolver().
registerContentObserver(Uri.parse("content://sms"), true, IncomingSms._mboxObserver);

View File

@ -40,7 +40,7 @@ public interface ASyncSMSSync {
@Override
protected Void doInBackground(Void... params) {
Log.d(ASyncSMSSync.TAG, "Starting background sync");
Log.i(ASyncSMSSync.TAG, "Starting background sync");
// Get ownCloud SMS account list
AccountManager _accountMgr = AccountManager.get(_context);
Account[] myAccountList = _accountMgr.getAccountsByType(_context.getString(R.string.account_type));
@ -63,7 +63,7 @@ public interface ASyncSMSSync {
}
}
OCSMSNotificationUI.cancel(_context);
Log.d(ASyncSMSSync.TAG, "Stopping background sync");
Log.i(ASyncSMSSync.TAG, "Stopping background sync");
return null;
}

View File

@ -134,19 +134,19 @@ public class OCSMSOwnCloudClient {
try {
inboxSmsList = smsBoxes.getJSONArray("inbox");
} catch (JSONException e) {
Log.d(OCSMSOwnCloudClient.TAG, "No inbox Sms received from server (doPushRequest, get SMS list)");
Log.i(OCSMSOwnCloudClient.TAG, "No inbox Sms received from server (doPushRequest, get SMS list)");
}
try {
sentSmsList = smsBoxes.getJSONArray("sent");
} catch (JSONException e) {
Log.d(OCSMSOwnCloudClient.TAG, "No sent Sms received from server (doPushRequest, get SMS list)");
Log.i(OCSMSOwnCloudClient.TAG, "No sent Sms received from server (doPushRequest, get SMS list)");
}
try {
draftsSmsList = smsBoxes.getJSONArray("drafts");
} catch (JSONException e) {
Log.d(OCSMSOwnCloudClient.TAG, "No drafts Sms received from server (doPushRequest, get SMS list)");
Log.i(OCSMSOwnCloudClient.TAG, "No drafts Sms received from server (doPushRequest, get SMS list)");
}
SmsFetcher fetcher = new SmsFetcher(_context);
@ -162,7 +162,7 @@ public class OCSMSOwnCloudClient {
}
if (smsList.length() == 0) {
Log.d(OCSMSOwnCloudClient.TAG, "No new SMS to sync, sync done");
Log.i(OCSMSOwnCloudClient.TAG, "No new SMS to sync, sync done");
return;
}
@ -192,7 +192,7 @@ public class OCSMSOwnCloudClient {
// Push was OK, we can save the lastMessageDate which was saved to server
(new OCSMSSharedPrefs(_context)).setLastMessageDate(lastMsgDate);
Log.d(OCSMSOwnCloudClient.TAG, "SMS Push request said: status " + pushStatus + " - " + pushMessage);
Log.i(OCSMSOwnCloudClient.TAG, "SMS Push request said: status " + pushStatus + " - " + pushMessage);
}
public GetMethod createGetVersionRequest() {
@ -296,7 +296,7 @@ public class OCSMSOwnCloudClient {
try {
status = _ocClient.executeMethod(req);
Log.d(OCSMSOwnCloudClient.TAG, "HTTP Request done at try " + tryNb);
Log.i(OCSMSOwnCloudClient.TAG, "HTTP Request done at try " + tryNb);
// Force loop exit
tryNb = OCSMSOwnCloudClient.maximumHttpReqTries;
@ -335,7 +335,7 @@ public class OCSMSOwnCloudClient {
Log.e(OCSMSOwnCloudClient.TAG, "Unable to parse server response", e);
throw new OCSyncException(R.string.err_sync_http_request_resp, OCSyncErrorType.IO);
}
//Log.d(TAG, "Successful response: " + response);
//Log.i(TAG, "Successful response: " + response);
// Parse the response
try {

View File

@ -108,7 +108,7 @@ public class SmsFetcher {
}
while (c.moveToNext());
Log.d(SmsFetcher.TAG, c.getCount() + " messages read from " + mbURI);
Log.i(SmsFetcher.TAG, c.getCount() + " messages read from " + mbURI);
}
if (c != null) {
@ -196,6 +196,12 @@ public class SmsFetcher {
}
Cursor c = new SmsDataProvider(_context).queryMessagesSinceDate(mbURI, sinceDate);
if (c != null) {
Log.i(SmsFetcher.TAG, "Retrieved " + c.getCount() + " messages.");
}
else {
Log.i(SmsFetcher.TAG, "No message retrieved.");
}
// Reading mailbox
if ((c != null) && (c.getCount() > 0)) {
@ -242,7 +248,7 @@ public class SmsFetcher {
}
while (c.moveToNext());
Log.d(SmsFetcher.TAG, c.getCount() + " messages read from " + mbURI);
Log.i(SmsFetcher.TAG, c.getCount() + " messages read from " + mbURI);
}
if (c != null) {

View File

@ -50,7 +50,7 @@ public class SmsObserver extends ContentObserver implements ASyncSMSSync {
}
super.onChange(selfChange);
Log.d(SmsObserver.TAG, "onChange SmsObserver");
Log.i(SmsObserver.TAG, "onChange SmsObserver");
// No account, abort
Account[] myAccountList = AccountManager.get(_context).

View File

@ -49,7 +49,7 @@ public class SmsDataProvider extends ContentProvider {
// NOTE: in APIv2 this call should be modified to use date instead of _id which is likely unique
public Cursor queryNonExistingMessages(String mailBox, String existingIds) {
Log.d(SmsDataProvider.TAG, "queryNonExistingMessages !");
Log.i(SmsDataProvider.TAG, "queryNonExistingMessages !");
if (!existingIds.isEmpty()) {
return query(Uri.parse(mailBox),
new String[] { "read", "date", "address", "seen", "body", "_id", "type", },
@ -61,7 +61,6 @@ public class SmsDataProvider extends ContentProvider {
}
public Cursor queryMessagesSinceDate(String mailBox, Long sinceDate) {
Log.d(SmsDataProvider.TAG, "queryMessagesSinceDate !");
return query(Uri.parse(mailBox),
new String[] { "read", "date", "address", "seen", "body", "_id", "type", },
"date > ?", new String[] { sinceDate.toString() }, null
@ -102,7 +101,8 @@ public class SmsDataProvider extends ContentProvider {
selectionArgs = nSelectionArgs;
}
Log.d(SmsDataProvider.TAG, "query: Minimum message length set to " + selectionArgs[0]);
Log.i(SmsDataProvider.TAG, "query: Minimum message length set to " + selectionArgs[0] +
". There is " + (selectionArgs.length - 1) + " other arg.");
}
if (bulkLimit > 0) {
@ -110,10 +110,10 @@ public class SmsDataProvider extends ContentProvider {
sortOrder = "_id ";
sortOrder += " LIMIT " + bulkLimit.toString();
Log.d(SmsDataProvider.TAG, "query: Bulk limit set to " + bulkLimit.toString());
Log.i(SmsDataProvider.TAG, "query: Bulk limit set to " + bulkLimit.toString());
}
Log.d(SmsDataProvider.TAG, "query: selection set to " + selection);
Log.i(SmsDataProvider.TAG, "query: selection set to " + selection);
return _context.getContentResolver().query(uri, projection, selection, selectionArgs, sortOrder);
}

View File

@ -63,7 +63,7 @@ public class SmsSyncAdapter extends AbstractThreadedSyncAdapter {
try {
// getServerAPI version
Log.d(SmsSyncAdapter.TAG, "Server API version: " + _client.getServerAPIVersion());
Log.i(SmsSyncAdapter.TAG, "Server API version: " + _client.getServerAPIVersion());
// and push datas
_client.doPushRequest(null);