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

Commit bbf29cfd authored by Ajay Panicker's avatar Ajay Panicker Committed by android-build-merger
Browse files

Don\'t use SMS database until after the phone is unlocked

am: db8d8ae5

Change-Id: I3b20b1e552c41f356c53b2a235d4835e223db373
parents 9c74aa88 db8d8ae5
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserManager;
import android.provider.Telephony;
import android.provider.Telephony.Mms;
import android.provider.Telephony.MmsSms;
@@ -1180,9 +1181,10 @@ public class BluetoothMapContentObserver {

    private void initMsgList() throws RemoteException {
        if (V) Log.d(TAG, "initMsgList");
        UserManager manager = UserManager.get(mContext);
        if (manager == null || manager.isUserUnlocked()) return;

        if (mEnableSmsMms) {

            HashMap<Long, Msg> msgListSms = new HashMap<Long, Msg>();

            Cursor c = mResolver.query(Sms.CONTENT_URI,
@@ -3342,6 +3344,8 @@ public class BluetoothMapContentObserver {
    private void resendPendingMessages() {
        /* Send pending messages in outbox */
        String where = "type = " + Sms.MESSAGE_TYPE_OUTBOX;
        UserManager manager = UserManager.get(mContext);
        if (manager == null || !manager.isUserUnlocked()) return;
        Cursor c = mResolver.query(Sms.CONTENT_URI, SMS_PROJECTION, where, null,
                null);
        try {
+33 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.ParcelUuid;
import android.os.RemoteException;
import android.os.UserManager;
import android.text.format.DateUtils;
import android.util.Log;

@@ -397,6 +398,11 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
        return ResponseCodes.OBEX_HTTP_OK;
    }

    private boolean isUserUnlocked() {
        UserManager manager = UserManager.get(mContext);
        return (manager == null || manager.isUserUnlocked());
    }

    @Override
    public int onPut(final Operation op) {
        if (D) Log.d(TAG, "onPut(): enter");
@@ -432,6 +438,10 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                    Log.d(TAG,"TYPE_SET_NOTIFICATION_FILTER: NotificationFilter: "
                            + appParams.getNotificationFilter());
                }
                if (!isUserUnlocked()) {
                    Log.e(TAG, "Storage locked, " + type + " failed");
                    return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
                }
                mObserver.setNotificationFilter(appParams.getNotificationFilter());
                return ResponseCodes.OBEX_HTTP_OK;
            } else if (type.equals(TYPE_SET_MESSAGE_STATUS)) {
@@ -441,6 +451,10 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                            + ", StatusValue: " + appParams.getStatusValue()
                            + ", ExtentedData: " + "" ); // TODO:   appParams.getExtendedImData());
                }
                if (!isUserUnlocked()) {
                    Log.e(TAG, "Storage locked, " + type + " failed");
                    return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
                }
                return setMessageStatus(name, appParams);
            } else if (type.equals(TYPE_MESSAGE)) {
                if(V) {
@@ -448,6 +462,10 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                            + ", retry: " + appParams.getRetry()
                            + ", charset: " + appParams.getCharset());
                }
                if (!isUserUnlocked()) {
                    Log.e(TAG, "Storage locked, " + type + " failed");
                    return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
                }
                return pushMessage(op, name, appParams, mMessageVersion);
            } else if (type.equals(TYPE_SET_OWNER_STATUS)) {
                if(V) {
@@ -881,6 +899,10 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                    Log.d(TAG,"FilterConvoId = " + ((tmpLongLong == null) ? "" :
                        Long.toHexString(tmpLongLong.getLeastSignificantBits()) ) );
                }
                if (!isUserUnlocked()) {
                    Log.e(TAG, "Storage locked, " +  type + " failed");
                    return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
                }
                // Block until all packets have been send.
                return sendMessageListingRsp(op, appParams, name);

@@ -895,6 +917,10 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                    Log.d(TAG,"FilterReadStatus = " + appParams.getFilterReadStatus());
                    Log.d(TAG,"FilterRecipient = " + appParams.getFilterRecipient());
                }
                if (!isUserUnlocked()) {
                    Log.e(TAG, "Storage locked, " + type + " failed");
                    return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
                }
                // Block until all packets have been send.
                return sendConvoListingRsp(op, appParams,name);
            } else if (type.equals(TYPE_GET_MAS_INSTANCE_INFORMATION)) {
@@ -912,6 +938,10 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                            ", Charset = " + appParams.getCharset() +
                            ", FractionRequest = " + appParams.getFractionRequest());
                }
                if (!isUserUnlocked()) {
                    Log.e(TAG, "Storage locked, " + type + " failed");
                    return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
                }
                // Block until all packets have been send.
                return sendGetMessageRsp(op, name, appParams, mMessageVersion);
            } else {