Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2a660ca authored by Taesu Lee's avatar Taesu Lee
Browse files

Cleanup log for IccSmsInterfaceManager and SmsPermissions



 - Use Rlog instead
 - Remove duplicate or wrong LOG_TAG
 - Use proper log level

Test: build

Change-Id: Iccabe24e6b0aa5eb84c331696a8fb69450fde8c5
Signed-off-by: default avatarTaesu Lee <taesu82.lee@samsung.com>
parent e843fc46
Loading
Loading
Loading
Loading
+30 −23
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class IccSmsInterfaceManager {
                            markMessagesAsRead((ArrayList<byte[]>) ar.result);
                        } else {
                            if (Rlog.isLoggable("SMS", Log.DEBUG)) {
                                log("Cannot load Sms records");
                                loge("Cannot load Sms records");
                            }
                            mSms = null;
                        }
@@ -147,7 +147,7 @@ public class IccSmsInterfaceManager {
                        if (ar.exception == null) {
                            mSmsc = (String) ar.result;
                        } else {
                            log("Cannot read SMSC");
                            loge("Cannot read SMSC");
                            mSmsc = null;
                        }
                        mLock.notifyAll();
@@ -194,7 +194,7 @@ public class IccSmsInterfaceManager {
            //shouldn't really happen, as messages are marked as read, only
            //after importing it from icc.
            if (Rlog.isLoggable("SMS", Log.DEBUG)) {
                log("markMessagesAsRead - aborting, no icc card present.");
                loge("markMessagesAsRead - aborting, no icc card present.");
            }
            return;
        }
@@ -276,7 +276,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to update by index");
                loge("interrupted while trying to update by index");
            }
        }
        return mSuccess;
@@ -317,7 +317,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to update by index");
                loge("interrupted while trying to update by index");
            }
        }
        return mSuccess;
@@ -344,7 +344,7 @@ public class IccSmsInterfaceManager {

            IccFileHandler fh = mPhone.getIccFileHandler();
            if (fh == null) {
                Rlog.e(LOG_TAG, "Cannot load Sms records. No icc card?");
                loge("Cannot load Sms records. No icc card?");
                mSms = null;
                return mSms;
            }
@@ -355,7 +355,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to load from the Icc");
                loge("interrupted while trying to load from the Icc");
            }
        }
        return mSms;
@@ -610,7 +610,7 @@ public class IccSmsInterfaceManager {
                        try {
                            receivedIntent.send(result);
                        } catch (PendingIntent.CanceledException e) {
                            Rlog.d(LOG_TAG, "receivedIntent cancelled.");
                            loge("receivedIntent cancelled.");
                        }
                    }
                }
@@ -839,7 +839,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to read SMSC");
                loge("interrupted while trying to read SMSC");
            }
        }
        return mSmsc;
@@ -863,7 +863,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to write SMSC");
                loge("interrupted while trying to write SMSC");
            }
        }
        return mSuccess;
@@ -1119,7 +1119,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to set cell broadcast config");
                loge("interrupted while trying to set cell broadcast config");
            }
        }

@@ -1139,7 +1139,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to set cell broadcast activation");
                loge("interrupted while trying to set cell broadcast activation");
            }
        }

@@ -1160,7 +1160,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to set cdma broadcast config");
                loge("interrupted while trying to set cdma broadcast config");
            }
        }

@@ -1180,7 +1180,7 @@ public class IccSmsInterfaceManager {
            try {
                mLock.wait();
            } catch (InterruptedException e) {
                log("interrupted while trying to set cdma broadcast activation");
                loge("interrupted while trying to set cdma broadcast activation");
            }
        }

@@ -1189,7 +1189,15 @@ public class IccSmsInterfaceManager {

    @UnsupportedAppUsage
    protected void log(String msg) {
        Log.d(LOG_TAG, "[IccSmsInterfaceManager] " + msg);
        Rlog.d(LOG_TAG, msg);
    }

    protected void loge(String msg) {
        Rlog.e(LOG_TAG, msg);
    }

    protected void loge(String msg, Throwable e) {
        Rlog.e(LOG_TAG, msg, e);
    }

    @UnsupportedAppUsage
@@ -1215,13 +1223,13 @@ public class IccSmsInterfaceManager {
        }
        final ContentResolver resolver = mContext.getContentResolver();
        if (!isFailedOrDraft(resolver, messageUri)) {
            Log.e(LOG_TAG, "[IccSmsInterfaceManager]sendStoredText: not FAILED or DRAFT message");
            loge("sendStoredText: not FAILED or DRAFT message");
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        final String[] textAndAddress = loadTextAndAddress(resolver, messageUri);
        if (textAndAddress == null) {
            Log.e(LOG_TAG, "[IccSmsInterfaceManager]sendStoredText: can not load text");
            loge("sendStoredText: can not load text");
            returnUnspecifiedFailure(sentIntent);
            return;
        }
@@ -1242,20 +1250,19 @@ public class IccSmsInterfaceManager {
        }
        final ContentResolver resolver = mContext.getContentResolver();
        if (!isFailedOrDraft(resolver, messageUri)) {
            Log.e(LOG_TAG, "[IccSmsInterfaceManager]sendStoredMultipartText: "
                    + "not FAILED or DRAFT message");
            loge("sendStoredMultipartText: not FAILED or DRAFT message");
            returnUnspecifiedFailure(sentIntents);
            return;
        }
        final String[] textAndAddress = loadTextAndAddress(resolver, messageUri);
        if (textAndAddress == null) {
            Log.e(LOG_TAG, "[IccSmsInterfaceManager]sendStoredMultipartText: can not load text");
            loge("sendStoredMultipartText: can not load text");
            returnUnspecifiedFailure(sentIntents);
            return;
        }
        final ArrayList<String> parts = SmsManager.getDefault().divideMessage(textAndAddress[0]);
        if (parts == null || parts.size() < 1) {
            Log.e(LOG_TAG, "[IccSmsInterfaceManager]sendStoredMultipartText: can not divide text");
            loge("sendStoredMultipartText: can not divide text");
            returnUnspecifiedFailure(sentIntents);
            return;
        }
@@ -1327,7 +1334,7 @@ public class IccSmsInterfaceManager {
                        || type == Telephony.Sms.MESSAGE_TYPE_FAILED;
            }
        } catch (SQLiteException e) {
            Log.e(LOG_TAG, "[IccSmsInterfaceManager]isFailedOrDraft: query message type failed", e);
            loge("isFailedOrDraft: query message type failed", e);
        } finally {
            if (cursor != null) {
                cursor.close();
@@ -1358,7 +1365,7 @@ public class IccSmsInterfaceManager {
                return new String[]{ cursor.getString(0), cursor.getString(1) };
            }
        } catch (SQLiteException e) {
            Log.e(LOG_TAG, "[IccSmsInterfaceManager]loadText: query message text failed", e);
            loge("loadText: query message text failed", e);
        } finally {
            if (cursor != null) {
                cursor.close();
+12 −4
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public class SmsPermissions {
            }
        } catch (PackageManager.NameNotFoundException e) {
            if (Rlog.isLoggable("SMS", Log.DEBUG)) {
                log("Cannot find configured carrier ims package");
                loge("Cannot find configured carrier ims package");
            }
        }

@@ -143,7 +143,7 @@ public class SmsPermissions {
                        .enforeceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege(
                                mContext, mPhone.getSubId(), message);
            } catch (SecurityException e) { // To avoid crashing applications
                Log.e(LOG_TAG, message + ": Neither " + callingPackage + " is the default SMS app"
                loge(message + ": Neither " + callingPackage + " is the default SMS app"
                        + " nor the caller has "
                        + android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
                        + ", or carrier privileges", e);
@@ -171,7 +171,7 @@ public class SmsPermissions {
                TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
                        mContext, mPhone.getSubId(), message);
            } catch (SecurityException e) { // To avoid crashing applications
                Log.e(LOG_TAG, message + ": Neither " + callingPackage + " is the default SMS app"
                loge(message + ": Neither " + callingPackage + " is the default SMS app"
                        + " nor the caller has " + android.Manifest.permission.MODIFY_PHONE_STATE
                        + ", or carrier privileges", e);
                return false;
@@ -188,6 +188,14 @@ public class SmsPermissions {

    @UnsupportedAppUsage
    protected void log(String msg) {
        Log.d(LOG_TAG, "[IccSmsInterfaceManager] " + msg);
        Rlog.d(LOG_TAG, msg);
    }

    protected void loge(String msg) {
        Rlog.e(LOG_TAG, msg);
    }

    protected void loge(String msg, Throwable e) {
        Rlog.e(LOG_TAG, msg, e);
    }
}