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

Commit c770c4b7 authored by Matt Garnes's avatar Matt Garnes
Browse files

Merge CAF branch 'caf/LA.BR.1.2.1_rb2.17' into caf/cm-12.0.

parents 712c7979 46c9856d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony;

import android.telecom.ConferenceParticipant;

import java.util.ArrayList;
import java.util.List;

@@ -130,6 +132,15 @@ public abstract class Call {
        return null;
    }

    /**
     * getConferenceParticipants
     * @return List of conference participants. Expected to be overwritten
     *         by subclasses.
     */
    public List<ConferenceParticipant> getConferenceParticipants() {
        return null;
    }

    /**
     * isIdle
     *
+5 −0
Original line number Diff line number Diff line
@@ -62,6 +62,11 @@ public class CommandException extends RuntimeException {
        mError = e;
    }

    public CommandException(Error e, String errString) {
        super(errString);
        mError = e;
    }

    public static CommandException
    fromRilErrno(int ril_errno) {
        switch(ril_errno) {
+16 −0
Original line number Diff line number Diff line
@@ -289,6 +289,22 @@ public abstract class Connection {
        }
    }

    /**
     * Get the details of conference participants. Expected to be
     * overwritten by the Connection subclasses.
     */
    public List<ConferenceParticipant> getConferenceParticipants() {
        Call c;

        c = getCall();

        if (c == null) {
            return null;
        } else {
            return c.getConferenceParticipants();
        }
    }

    /**
     * isAlive()
     *
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ public abstract class IccPhoneBookInterfaceManager {
                        } else {
                            if(DBG) logd("Cannot load ADN records");
                            if (mRecords != null) {
                                mRecords.clear();
                                mRecords = null;
                            }
                        }
                        notifyPending(ar);
+71 −1
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.util.BlacklistUtils;
import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.util.HexDump;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
@@ -92,6 +93,16 @@ public abstract class InboundSmsHandler extends StateMachine {
    protected static final boolean DBG = true;
    private static final boolean VDBG = false;  // STOPSHIP if true, logs user data

    /** Firewall */
    private static final Uri FIREWALL_PROVIDER_URI = Uri.parse("content://com.android.firewall");
    private static final String EXTRA_NUMBER = "phonenumber";
    private static final String IS_FORBIDDEN = "isForbidden";
    private static final String BLOCK_RECORD_NUMBER = "number";
    private static final String BLOCK_RECORD_CONTENT = "content";
    private static final String SMS_BLOCK_RECORD_INTENT
            = "com.android.firewall.ADD_SMS_BLOCK_RECORD";
    private static final String MMS_BLOCK_RECORD_INTENT
            = "com.android.firewall.ADD_MMS_BLOCK_RECORD";
    /** Query projection for checking for duplicate message segments. */
    private static final String[] PDU_PROJECTION = {
            "pdu"
@@ -819,8 +830,13 @@ public abstract class InboundSmsHandler extends StateMachine {

        intent.putExtra("pdus", pdus);
        intent.putExtra("format", tracker.getFormat());
        if (isBlockedByFirewall(intent)) {
            // send firewall block mms intent
            sendBlockRecordBroadcast(mContext, intent, true, resultReceiver);
        } else {
            dispatchIntent(intent, android.Manifest.permission.RECEIVE_SMS,
                AppOpsManager.OP_RECEIVE_SMS, resultReceiver, UserHandle.OWNER);
        }
        return true;
    }

@@ -1114,6 +1130,60 @@ public abstract class InboundSmsHandler extends StateMachine {
        }
    }

    /**
     * send block record broadcast to firewall apk which handler the blocked record
     * @param context bradcast context
     * @param intent is sms intent
     * @param isSms judge it is a sms or mms
     * @param receiver which handler this broadcast at last
     */
    public void sendBlockRecordBroadcast(Context context, Intent intent,
            boolean isSms, BroadcastReceiver receiver) {
        final SmsMessage[] messages = Telephony.Sms.Intents.getMessagesFromIntent(intent);
        if (messages != null) {
            Intent sendIntent ;
            if (isSms) {
                sendIntent = new Intent(SMS_BLOCK_RECORD_INTENT);
            } else {
                sendIntent = new Intent(MMS_BLOCK_RECORD_INTENT);
            }

            sendIntent.putExtra(BLOCK_RECORD_NUMBER, messages[0].getDisplayOriginatingAddress());
            sendIntent.putExtra(BLOCK_RECORD_CONTENT, buildMessageBodyFromPdus(messages));
            dispatchIntent(sendIntent, android.Manifest.permission.RECEIVE_SMS,
                    AppOpsManager.OP_RECEIVE_SMS, receiver, UserHandle.ALL);
        }
    }

    /**
     * get the mms address from intent and search it in firewall databases
      * @param intent is sms intent
     * @return this mms address is saved in firewall databases
     */
    public boolean isBlockedByFirewall(Intent intent) {
        final SmsMessage[] messages = Telephony.Sms.Intents.getMessagesFromIntent(intent);
        String number = null;
        if (messages == null || messages.length < 1) {
            loge("Failed to parse SMS pdu");
            return false;
        }
        number = messages[0].getDisplayOriginatingAddress();
        boolean isForbidden = false;
        // Add to check the firewall when firewall provider is built.
        final ContentResolver cr = mContext.getContentResolver();
        if (cr.acquireProvider(FIREWALL_PROVIDER_URI) != null && null != number) {
            Bundle extras = new Bundle();
            extras.putString(EXTRA_NUMBER, number);
            extras.putLong(PhoneConstants.SUBSCRIPTION_KEY, mPhone.getSubId());
            extras = cr.call(FIREWALL_PROVIDER_URI, IS_FORBIDDEN, null, extras);
            if (extras != null) {
                isForbidden = extras.getBoolean(IS_FORBIDDEN);
            }
        }
        log("isForbidden = "+isForbidden );
        return isForbidden;
    }

    /**
     * Log with debug level.
     * @param s the string to log
Loading