1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-08 08:26:09 +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> { public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
UserLoginTask(String serverURI, String login, String password) { UserLoginTask(String serverURI, String login, String password) {
Log.d(TAG, "_serverURI = " + serverURI); Log.i(TAG, "_serverURI = " + serverURI);
_serverURI = Uri.parse(serverURI); _serverURI = Uri.parse(serverURI);
_login = login; _login = login;
_password = password; _password = password;

View File

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

View File

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

View File

@ -192,11 +192,11 @@ public class VirtualSettingsActivity extends PreferenceActivity {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object value) { public boolean onPreferenceChange(Preference preference, Object value) {
if (preference instanceof ListPreference) { 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); handleListPreference(preference.getKey(), value.toString(), (ListPreference) preference);
} else if (preference instanceof CheckBoxPreference) { } 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); handleCheckboxPreference(preference.getKey(), (Boolean) value);
} else { } else {
// For all other preferences, set the summary to the value's // 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() { v.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Log.d(TAG, "Clicked on phone " + l); Log.i(TAG, "Clicked on phone " + l);
} }
}); });
v.setOnLongClickListener(new View.OnLongClickListener() { v.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
Log.d(TAG, "Long clicked on phone " + l); Log.i(TAG, "Long clicked on phone " + l);
return false; return false;
} }
}); });

View File

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

View File

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

View File

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

View File

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

View File

@ -134,19 +134,19 @@ public class OCSMSOwnCloudClient {
try { try {
inboxSmsList = smsBoxes.getJSONArray("inbox"); inboxSmsList = smsBoxes.getJSONArray("inbox");
} catch (JSONException e) { } 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 { try {
sentSmsList = smsBoxes.getJSONArray("sent"); sentSmsList = smsBoxes.getJSONArray("sent");
} catch (JSONException e) { } 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 { try {
draftsSmsList = smsBoxes.getJSONArray("drafts"); draftsSmsList = smsBoxes.getJSONArray("drafts");
} catch (JSONException e) { } 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); SmsFetcher fetcher = new SmsFetcher(_context);
@ -162,7 +162,7 @@ public class OCSMSOwnCloudClient {
} }
if (smsList.length() == 0) { 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; return;
} }
@ -192,7 +192,7 @@ public class OCSMSOwnCloudClient {
// Push was OK, we can save the lastMessageDate which was saved to server // Push was OK, we can save the lastMessageDate which was saved to server
(new OCSMSSharedPrefs(_context)).setLastMessageDate(lastMsgDate); (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() { public GetMethod createGetVersionRequest() {
@ -296,7 +296,7 @@ public class OCSMSOwnCloudClient {
try { try {
status = _ocClient.executeMethod(req); 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 // Force loop exit
tryNb = OCSMSOwnCloudClient.maximumHttpReqTries; tryNb = OCSMSOwnCloudClient.maximumHttpReqTries;
@ -335,7 +335,7 @@ public class OCSMSOwnCloudClient {
Log.e(OCSMSOwnCloudClient.TAG, "Unable to parse server response", e); Log.e(OCSMSOwnCloudClient.TAG, "Unable to parse server response", e);
throw new OCSyncException(R.string.err_sync_http_request_resp, OCSyncErrorType.IO); 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 // Parse the response
try { try {

View File

@ -108,7 +108,7 @@ public class SmsFetcher {
} }
while (c.moveToNext()); 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) { if (c != null) {
@ -196,6 +196,12 @@ public class SmsFetcher {
} }
Cursor c = new SmsDataProvider(_context).queryMessagesSinceDate(mbURI, sinceDate); 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 // Reading mailbox
if ((c != null) && (c.getCount() > 0)) { if ((c != null) && (c.getCount() > 0)) {
@ -242,7 +248,7 @@ public class SmsFetcher {
} }
while (c.moveToNext()); 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) { if (c != null) {

View File

@ -50,7 +50,7 @@ public class SmsObserver extends ContentObserver implements ASyncSMSSync {
} }
super.onChange(selfChange); super.onChange(selfChange);
Log.d(SmsObserver.TAG, "onChange SmsObserver"); Log.i(SmsObserver.TAG, "onChange SmsObserver");
// No account, abort // No account, abort
Account[] myAccountList = AccountManager.get(_context). 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 // 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) { public Cursor queryNonExistingMessages(String mailBox, String existingIds) {
Log.d(SmsDataProvider.TAG, "queryNonExistingMessages !"); Log.i(SmsDataProvider.TAG, "queryNonExistingMessages !");
if (!existingIds.isEmpty()) { if (!existingIds.isEmpty()) {
return query(Uri.parse(mailBox), return query(Uri.parse(mailBox),
new String[] { "read", "date", "address", "seen", "body", "_id", "type", }, 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) { public Cursor queryMessagesSinceDate(String mailBox, Long sinceDate) {
Log.d(SmsDataProvider.TAG, "queryMessagesSinceDate !");
return query(Uri.parse(mailBox), return query(Uri.parse(mailBox),
new String[] { "read", "date", "address", "seen", "body", "_id", "type", }, new String[] { "read", "date", "address", "seen", "body", "_id", "type", },
"date > ?", new String[] { sinceDate.toString() }, null "date > ?", new String[] { sinceDate.toString() }, null
@ -102,7 +101,8 @@ public class SmsDataProvider extends ContentProvider {
selectionArgs = nSelectionArgs; 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) { if (bulkLimit > 0) {
@ -110,10 +110,10 @@ public class SmsDataProvider extends ContentProvider {
sortOrder = "_id "; sortOrder = "_id ";
sortOrder += " LIMIT " + bulkLimit.toString(); 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); return _context.getContentResolver().query(uri, projection, selection, selectionArgs, sortOrder);
} }

View File

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