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

Commit 4cb12e77 authored by Taesu Lee's avatar Taesu Lee Committed by android-build-merger
Browse files

Merge "Remove unused init(Phone) and some cleanup in SubscriptionController"

am: aad2daac

Change-Id: I402abe14060bab08987294d7e5877e57e5409b48
parents b0db5e64 aad2daac
Loading
Loading
Loading
Loading
+10 −46
Original line number Diff line number Diff line
@@ -81,8 +81,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

/**
 * SubscriptionController to provide an inter-process communication to
 * access Sms in Icc.
 * Implementation of the ISub interface.
 *
 * Any setters which take subId, slotIndex or phoneId as a parameter will throw an exception if the
 * parameter equals the corresponding INVALID_XXX_ID or DEFAULT_XXX_ID.
@@ -163,17 +162,6 @@ public class SubscriptionController extends ISub.Stub {
            SubscriptionManager.DISPLAY_NAME,
            SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES));

    public static SubscriptionController init(Phone phone) {
        synchronized (SubscriptionController.class) {
            if (sInstance == null) {
                sInstance = new SubscriptionController(phone);
            } else {
                Log.wtf(LOG_TAG, "init() called multiple times!  sInstance = " + sInstance);
            }
            return sInstance;
        }
    }

    public static SubscriptionController init(Context c) {
        synchronized (SubscriptionController.class) {
            if (sInstance == null) {
@@ -187,8 +175,7 @@ public class SubscriptionController extends ISub.Stub {

    @UnsupportedAppUsage
    public static SubscriptionController getInstance() {
        if (sInstance == null)
        {
        if (sInstance == null) {
           Log.wtf(LOG_TAG, "getInstance null");
        }

@@ -201,7 +188,6 @@ public class SubscriptionController extends ISub.Stub {
    }

    protected void internalInit(Context c) {

        mContext = c;
        mTelephonyManager = TelephonyManager.from(mContext);

@@ -257,22 +243,6 @@ public class SubscriptionController extends ISub.Stub {
        mContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, null, null);
    }

    private SubscriptionController(Phone phone) {
        mContext = phone.getContext();
        mAppOps = mContext.getSystemService(AppOpsManager.class);

        if(ServiceManager.getService("isub") == null) {
                ServiceManager.addService("isub", this);
        }

        migrateImsSettings();

        // clear SLOT_INDEX for all subs
        clearSlotIndexForSubInfoRecords();

        if (DBG) logdl("[SubscriptionController] init by Phone");
    }

    @UnsupportedAppUsage
    private void enforceModifyPhoneState(String message) {
        mContext.enforceCallingOrSelfPermission(
@@ -447,10 +417,8 @@ public class SubscriptionController extends ISub.Stub {
            if (cursor != null) {
                while (cursor.moveToNext()) {
                    SubscriptionInfo subInfo = getSubInfoRecord(cursor);
                    if (subInfo != null)
                    {
                        if (subList == null)
                        {
                    if (subInfo != null) {
                        if (subList == null) {
                            subList = new ArrayList<SubscriptionInfo>();
                        }
                        subList.add(subInfo);
@@ -2121,10 +2089,6 @@ public class SubscriptionController extends ISub.Stub {
        mLocalLog.log(msg);
    }

    private static void slogd(String msg) {
        Rlog.d(LOG_TAG, msg);
    }

    @UnsupportedAppUsage
    private void logd(String msg) {
        Rlog.d(LOG_TAG, msg);
@@ -2254,7 +2218,7 @@ public class SubscriptionController extends ISub.Stub {
        int subId = Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION,
                SubscriptionManager.INVALID_SUBSCRIPTION_ID);
        if (VDBG) slogd("[getDefaultVoiceSubId] subId=" + subId);
        if (VDBG) logd("[getDefaultVoiceSubId] subId=" + subId);
        return subId;
    }

@@ -2647,7 +2611,7 @@ public class SubscriptionController extends ISub.Stub {
                value.put(propKey, Integer.parseInt(propValue));
                break;
            default:
                if (DBG) slogd("Invalid column name");
                if (DBG) logd("Invalid column name");
                break;
        }

@@ -2735,16 +2699,16 @@ public class SubscriptionController extends ISub.Stub {
        return resultValue;
    }

    private static void printStackTrace(String msg) {
    private void printStackTrace(String msg) {
        RuntimeException re = new RuntimeException();
        slogd("StackTrace - " + msg);
        logd("StackTrace - " + msg);
        StackTraceElement[] st = re.getStackTrace();
        boolean first = true;
        for (StackTraceElement ste : st) {
            if (first) {
                first = false;
            } else {
                slogd(ste.toString());
                logd(ste.toString());
            }
        }
    }
+0 −3
Original line number Diff line number Diff line
@@ -44,9 +44,6 @@ public class SubscriptionControllerMock extends SubscriptionController {
    final ITelephonyRegistry.Stub mTelephonyRegistry;
    final int[][] mSlotIndexToSubId;

    public static SubscriptionController init(Phone phone) {
        throw new RuntimeException("not implemented");
    }
    public static SubscriptionController init(Context c) {
        throw new RuntimeException("not implemented");
    }