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

Commit 86efdde1 authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Fixed cell broadcast configuration not sent when no sim is inserted" into oc-dr1-dev

am: efbe1208

Change-Id: I365c3f232b49c99a8087fa0a7995363fc3ddeaa9
parents 97b88798 efbe1208
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -16,9 +16,6 @@

package com.android.internal.telephony;

import java.util.ArrayList;
import java.util.Random;

import android.content.Context;
import android.content.Intent;
import android.os.AsyncResult;
@@ -31,13 +28,12 @@ import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.util.Log;

import com.android.internal.telephony.PhoneSwitcher;
import com.android.internal.telephony.uicc.UiccController;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;

public class ProxyController {
    static final String LOG_TAG = "ProxyController";
@@ -130,7 +126,7 @@ public class ProxyController {

        mUiccPhoneBookController = new UiccPhoneBookController(mPhones);
        mPhoneSubInfoController = new PhoneSubInfoController(mContext, mPhones);
        mUiccSmsController = new UiccSmsController(mPhones);
        mUiccSmsController = new UiccSmsController();
        mSetRadioAccessFamilyStatus = new int[mPhones.length];
        mNewRadioAccessFamily = new int[mPhones.length];
        mOldRadioAccessFamily = new int[mPhones.length];
+20 −58
Original line number Diff line number Diff line
@@ -42,16 +42,20 @@ import java.util.List;
public class UiccSmsController extends ISms.Stub {
    static final String LOG_TAG = "RIL_UiccSmsController";

    protected Phone[] mPhone;

    protected UiccSmsController(Phone[] phone){
        mPhone = phone;

    protected UiccSmsController() {
        if (ServiceManager.getService("isms") == null) {
            ServiceManager.addService("isms", this);
        }
    }

    private Phone getPhone(int subId) {
        Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
        if (phone == null) {
            phone = PhoneFactory.getDefaultPhone();
        }
        return phone;
    }

    @Override
    public boolean
    updateMessageOnIccEfForSubscriber(int subId, String callingPackage, int index, int status,
@@ -320,45 +324,26 @@ public class UiccSmsController extends ISms.Stub {
    }

    /**
     * get sms interface manager object based on subscription.
     **/
     * Get sms interface manager object based on subscription.
     * @return ICC SMS manager
     */
    private @Nullable IccSmsInterfaceManager getIccSmsInterfaceManager(int subId) {
        if (!isActiveSubId(subId)) {
            Rlog.e(LOG_TAG, "Subscription " + subId + " is inactive.");
            return null;
        }

        int phoneId = SubscriptionController.getInstance().getPhoneId(subId) ;
        //Fixme: for multi-subscription case
        if (!SubscriptionManager.isValidPhoneId(phoneId)
                || phoneId == SubscriptionManager.DEFAULT_PHONE_INDEX) {
            phoneId = 0;
        }

        try {
            return (IccSmsInterfaceManager)
                ((Phone)mPhone[(int)phoneId]).getIccSmsInterfaceManager();
        } catch (NullPointerException e) {
            Rlog.e(LOG_TAG, "Exception is :"+e.toString()+" For subscription :"+subId );
            e.printStackTrace();
            return null;
        } catch (ArrayIndexOutOfBoundsException e) {
            Rlog.e(LOG_TAG, "Exception is :"+e.toString()+" For subscription :"+subId );
            e.printStackTrace();
            return null;
        }
        return getPhone(subId).getIccSmsInterfaceManager();
    }

    /**
       Gets User preferred SMS subscription */
     * Get User preferred SMS subscription
     * @return User preferred SMS subscription
     */
    @Override
    public int getPreferredSmsSubscription() {
        return SubscriptionController.getInstance().getDefaultSmsSubId();
    }

    /**
     * Get SMS prompt property,  enabled or not
     **/
     * Get SMS prompt property enabled or not
     * @return True if SMS prompt is enabled.
     */
    @Override
    public boolean isSMSPromptEnabled() {
        return PhoneFactory.isSMSPromptEnabled();
@@ -394,30 +379,7 @@ public class UiccSmsController extends ISms.Stub {

    @Override
    public String createAppSpecificSmsToken(int subId, String callingPkg, PendingIntent intent) {
        if (!isActiveSubId(subId)) {
            Rlog.e(LOG_TAG, "Subscription " + subId + " is inactive.");
            return null;
        }

        int phoneId = SubscriptionController.getInstance().getPhoneId(subId);
        //Fixme: for multi-subscription case
        if (!SubscriptionManager.isValidPhoneId(phoneId)
                || phoneId == SubscriptionManager.DEFAULT_PHONE_INDEX) {
            phoneId = 0;
        }
        if (phoneId < 0 || phoneId >= mPhone.length || mPhone[phoneId] == null) {
            Rlog.e(LOG_TAG, "phoneId " + phoneId + " points to an invalid phone");
            return null;
        }
        AppSmsManager appSmsManager = mPhone[phoneId].getAppSmsManager();
        return appSmsManager.createAppSpecificSmsToken(callingPkg, intent);
    }

    /*
     * @return true if the subId is active.
     */
    private boolean isActiveSubId(int subId) {
        return SubscriptionController.getInstance().isActiveSubId(subId);
        return getPhone(subId).getAppSmsManager().createAppSpecificSmsToken(callingPkg, intent);
    }

    private void sendErrorInPendingIntent(@Nullable PendingIntent intent, int errorCode) {