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

Commit 3d55f7b4 authored by Taesu Lee's avatar Taesu Lee Committed by android-build-merger
Browse files

Merge "Cleanup log for IccSmsInterfaceManager and SmsPermissions" am: ab72005d am: d3e04011

am: ab7e4a5b

Change-Id: I55e47f8dd6b4bcb913ee2900f17db90d79c506db
parents 1c366f9a ab7e4a5b
Loading
Loading
Loading
Loading
+30 −23
Original line number Diff line number Diff line
@@ -127,7 +127,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;
                        }
@@ -148,7 +148,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();
@@ -195,7 +195,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;
        }
@@ -277,7 +277,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;
@@ -318,7 +318,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;
@@ -345,7 +345,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;
            }
@@ -356,7 +356,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;
@@ -611,7 +611,7 @@ public class IccSmsInterfaceManager {
                        try {
                            receivedIntent.send(result);
                        } catch (PendingIntent.CanceledException e) {
                            Rlog.d(LOG_TAG, "receivedIntent cancelled.");
                            loge("receivedIntent cancelled.");
                        }
                    }
                }
@@ -840,7 +840,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;
@@ -864,7 +864,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;
@@ -1120,7 +1120,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");
            }
        }

@@ -1140,7 +1140,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");
            }
        }

@@ -1161,7 +1161,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");
            }
        }

@@ -1181,7 +1181,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");
            }
        }

@@ -1190,7 +1190,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
@@ -1216,13 +1224,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;
        }
@@ -1243,20 +1251,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;
        }
@@ -1328,7 +1335,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();
@@ -1359,7 +1366,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);
    }
}