Loading src/java/com/android/internal/telephony/SubscriptionController.java +10 −46 Original line number Original line Diff line number Diff line Loading @@ -81,8 +81,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import java.util.stream.Collectors; /** /** * SubscriptionController to provide an inter-process communication to * Implementation of the ISub interface. * access Sms in Icc. * * * Any setters which take subId, slotIndex or phoneId as a parameter will throw an exception if the * 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. * parameter equals the corresponding INVALID_XXX_ID or DEFAULT_XXX_ID. Loading Loading @@ -163,17 +162,6 @@ public class SubscriptionController extends ISub.Stub { SubscriptionManager.DISPLAY_NAME, SubscriptionManager.DISPLAY_NAME, SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES)); 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) { public static SubscriptionController init(Context c) { synchronized (SubscriptionController.class) { synchronized (SubscriptionController.class) { if (sInstance == null) { if (sInstance == null) { Loading @@ -187,8 +175,7 @@ public class SubscriptionController extends ISub.Stub { @UnsupportedAppUsage @UnsupportedAppUsage public static SubscriptionController getInstance() { public static SubscriptionController getInstance() { if (sInstance == null) if (sInstance == null) { { Log.wtf(LOG_TAG, "getInstance null"); Log.wtf(LOG_TAG, "getInstance null"); } } Loading @@ -201,7 +188,6 @@ public class SubscriptionController extends ISub.Stub { } } protected void internalInit(Context c) { protected void internalInit(Context c) { mContext = c; mContext = c; mTelephonyManager = TelephonyManager.from(mContext); mTelephonyManager = TelephonyManager.from(mContext); Loading Loading @@ -257,22 +243,6 @@ public class SubscriptionController extends ISub.Stub { mContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, null, null); 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 @UnsupportedAppUsage private void enforceModifyPhoneState(String message) { private void enforceModifyPhoneState(String message) { mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( Loading Loading @@ -447,10 +417,8 @@ public class SubscriptionController extends ISub.Stub { if (cursor != null) { if (cursor != null) { while (cursor.moveToNext()) { while (cursor.moveToNext()) { SubscriptionInfo subInfo = getSubInfoRecord(cursor); SubscriptionInfo subInfo = getSubInfoRecord(cursor); if (subInfo != null) if (subInfo != null) { { if (subList == null) { if (subList == null) { subList = new ArrayList<SubscriptionInfo>(); subList = new ArrayList<SubscriptionInfo>(); } } subList.add(subInfo); subList.add(subInfo); Loading Loading @@ -2121,10 +2089,6 @@ public class SubscriptionController extends ISub.Stub { mLocalLog.log(msg); mLocalLog.log(msg); } } private static void slogd(String msg) { Rlog.d(LOG_TAG, msg); } @UnsupportedAppUsage @UnsupportedAppUsage private void logd(String msg) { private void logd(String msg) { Rlog.d(LOG_TAG, msg); Rlog.d(LOG_TAG, msg); Loading Loading @@ -2254,7 +2218,7 @@ public class SubscriptionController extends ISub.Stub { int subId = Settings.Global.getInt(mContext.getContentResolver(), int subId = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, SubscriptionManager.INVALID_SUBSCRIPTION_ID); SubscriptionManager.INVALID_SUBSCRIPTION_ID); if (VDBG) slogd("[getDefaultVoiceSubId] subId=" + subId); if (VDBG) logd("[getDefaultVoiceSubId] subId=" + subId); return subId; return subId; } } Loading Loading @@ -2647,7 +2611,7 @@ public class SubscriptionController extends ISub.Stub { value.put(propKey, Integer.parseInt(propValue)); value.put(propKey, Integer.parseInt(propValue)); break; break; default: default: if (DBG) slogd("Invalid column name"); if (DBG) logd("Invalid column name"); break; break; } } Loading Loading @@ -2735,16 +2699,16 @@ public class SubscriptionController extends ISub.Stub { return resultValue; return resultValue; } } private static void printStackTrace(String msg) { private void printStackTrace(String msg) { RuntimeException re = new RuntimeException(); RuntimeException re = new RuntimeException(); slogd("StackTrace - " + msg); logd("StackTrace - " + msg); StackTraceElement[] st = re.getStackTrace(); StackTraceElement[] st = re.getStackTrace(); boolean first = true; boolean first = true; for (StackTraceElement ste : st) { for (StackTraceElement ste : st) { if (first) { if (first) { first = false; first = false; } else { } else { slogd(ste.toString()); logd(ste.toString()); } } } } } } Loading tests/telephonytests/src/com/android/internal/telephony/mocks/SubscriptionControllerMock.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -44,9 +44,6 @@ public class SubscriptionControllerMock extends SubscriptionController { final ITelephonyRegistry.Stub mTelephonyRegistry; final ITelephonyRegistry.Stub mTelephonyRegistry; final int[][] mSlotIndexToSubId; final int[][] mSlotIndexToSubId; public static SubscriptionController init(Phone phone) { throw new RuntimeException("not implemented"); } public static SubscriptionController init(Context c) { public static SubscriptionController init(Context c) { throw new RuntimeException("not implemented"); throw new RuntimeException("not implemented"); } } Loading Loading
src/java/com/android/internal/telephony/SubscriptionController.java +10 −46 Original line number Original line Diff line number Diff line Loading @@ -81,8 +81,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import java.util.stream.Collectors; /** /** * SubscriptionController to provide an inter-process communication to * Implementation of the ISub interface. * access Sms in Icc. * * * Any setters which take subId, slotIndex or phoneId as a parameter will throw an exception if the * 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. * parameter equals the corresponding INVALID_XXX_ID or DEFAULT_XXX_ID. Loading Loading @@ -163,17 +162,6 @@ public class SubscriptionController extends ISub.Stub { SubscriptionManager.DISPLAY_NAME, SubscriptionManager.DISPLAY_NAME, SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES)); 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) { public static SubscriptionController init(Context c) { synchronized (SubscriptionController.class) { synchronized (SubscriptionController.class) { if (sInstance == null) { if (sInstance == null) { Loading @@ -187,8 +175,7 @@ public class SubscriptionController extends ISub.Stub { @UnsupportedAppUsage @UnsupportedAppUsage public static SubscriptionController getInstance() { public static SubscriptionController getInstance() { if (sInstance == null) if (sInstance == null) { { Log.wtf(LOG_TAG, "getInstance null"); Log.wtf(LOG_TAG, "getInstance null"); } } Loading @@ -201,7 +188,6 @@ public class SubscriptionController extends ISub.Stub { } } protected void internalInit(Context c) { protected void internalInit(Context c) { mContext = c; mContext = c; mTelephonyManager = TelephonyManager.from(mContext); mTelephonyManager = TelephonyManager.from(mContext); Loading Loading @@ -257,22 +243,6 @@ public class SubscriptionController extends ISub.Stub { mContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, null, null); 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 @UnsupportedAppUsage private void enforceModifyPhoneState(String message) { private void enforceModifyPhoneState(String message) { mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( Loading Loading @@ -447,10 +417,8 @@ public class SubscriptionController extends ISub.Stub { if (cursor != null) { if (cursor != null) { while (cursor.moveToNext()) { while (cursor.moveToNext()) { SubscriptionInfo subInfo = getSubInfoRecord(cursor); SubscriptionInfo subInfo = getSubInfoRecord(cursor); if (subInfo != null) if (subInfo != null) { { if (subList == null) { if (subList == null) { subList = new ArrayList<SubscriptionInfo>(); subList = new ArrayList<SubscriptionInfo>(); } } subList.add(subInfo); subList.add(subInfo); Loading Loading @@ -2121,10 +2089,6 @@ public class SubscriptionController extends ISub.Stub { mLocalLog.log(msg); mLocalLog.log(msg); } } private static void slogd(String msg) { Rlog.d(LOG_TAG, msg); } @UnsupportedAppUsage @UnsupportedAppUsage private void logd(String msg) { private void logd(String msg) { Rlog.d(LOG_TAG, msg); Rlog.d(LOG_TAG, msg); Loading Loading @@ -2254,7 +2218,7 @@ public class SubscriptionController extends ISub.Stub { int subId = Settings.Global.getInt(mContext.getContentResolver(), int subId = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, SubscriptionManager.INVALID_SUBSCRIPTION_ID); SubscriptionManager.INVALID_SUBSCRIPTION_ID); if (VDBG) slogd("[getDefaultVoiceSubId] subId=" + subId); if (VDBG) logd("[getDefaultVoiceSubId] subId=" + subId); return subId; return subId; } } Loading Loading @@ -2647,7 +2611,7 @@ public class SubscriptionController extends ISub.Stub { value.put(propKey, Integer.parseInt(propValue)); value.put(propKey, Integer.parseInt(propValue)); break; break; default: default: if (DBG) slogd("Invalid column name"); if (DBG) logd("Invalid column name"); break; break; } } Loading Loading @@ -2735,16 +2699,16 @@ public class SubscriptionController extends ISub.Stub { return resultValue; return resultValue; } } private static void printStackTrace(String msg) { private void printStackTrace(String msg) { RuntimeException re = new RuntimeException(); RuntimeException re = new RuntimeException(); slogd("StackTrace - " + msg); logd("StackTrace - " + msg); StackTraceElement[] st = re.getStackTrace(); StackTraceElement[] st = re.getStackTrace(); boolean first = true; boolean first = true; for (StackTraceElement ste : st) { for (StackTraceElement ste : st) { if (first) { if (first) { first = false; first = false; } else { } else { slogd(ste.toString()); logd(ste.toString()); } } } } } } Loading
tests/telephonytests/src/com/android/internal/telephony/mocks/SubscriptionControllerMock.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -44,9 +44,6 @@ public class SubscriptionControllerMock extends SubscriptionController { final ITelephonyRegistry.Stub mTelephonyRegistry; final ITelephonyRegistry.Stub mTelephonyRegistry; final int[][] mSlotIndexToSubId; final int[][] mSlotIndexToSubId; public static SubscriptionController init(Phone phone) { throw new RuntimeException("not implemented"); } public static SubscriptionController init(Context c) { public static SubscriptionController init(Context c) { throw new RuntimeException("not implemented"); throw new RuntimeException("not implemented"); } } Loading