Loading src/java/com/android/internal/telephony/PhoneSwitcher.java +18 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.os.Message; import android.os.Registrant; import android.os.RegistrantList; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.PhoneCapability; import android.telephony.PhoneStateListener; import android.telephony.PreciseCallState; Loading Loading @@ -854,6 +855,7 @@ public class PhoneSwitcher extends Handler { mPreferredDataSubId = subId; logDataSwitchEvent(TelephonyEvent.EventState.START, DataSwitch.Reason.CBRS); onEvaluate(REQUESTS_UNCHANGED, "preferredDataSubscriptionIdChanged"); notifyPreferredDataSubIdChanged(); registerDefaultNetworkChangeCallback(); } } Loading @@ -872,10 +874,22 @@ public class PhoneSwitcher extends Handler { // TODO b/123598154: rename preferredDataSub to opportunisticSubId. public void trySetPreferredSubscription(int subId, boolean needValidation, ISetOpportunisticDataCallback callback) { log("Try set preferred subscription to subId " + subId + (needValidation ? " with " : " without ") + "validation"); PhoneSwitcher.this.obtainMessage(EVENT_CHANGE_PREFERRED_SUBSCRIPTION, subId, needValidation ? 1 : 0, callback).sendToTarget(); } private void notifyPreferredDataSubIdChanged() { ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( "telephony.registry")); try { tr.notifyPreferredDataSubIdChanged(mPreferredDataSubId); } catch (RemoteException ex) { // Should never happen because TelephonyRegistry service should always be available. } } private boolean isCallActive(Phone phone) { if (phone == null) { return false; Loading @@ -890,6 +904,10 @@ public class PhoneSwitcher extends Handler { ? HAL_COMMAND_PREFERRED_DATA : HAL_COMMAND_ALLOW_DATA; } public int getPreferredDataSubscriptionId() { return mPreferredDataSubId; } private void log(String l) { Rlog.d(LOG_TAG, l); mLocalLog.log(l); Loading src/java/com/android/internal/telephony/SubscriptionController.java +4 −9 Original line number Diff line number Diff line Loading @@ -2706,17 +2706,12 @@ public class SubscriptionController extends ISub.Stub { @Override public int getPreferredDataSubscriptionId() { enforceReadPrivilegedPhoneState("getPreferredDataSubscriptionId"); return mPreferredDataSubId; } final long token = Binder.clearCallingIdentity(); private void notifyPreferredDataSubIdChanged() { ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( "telephony.registry")); try { if (DBG) logd("notifyPreferredDataSubIdChanged:"); tr.notifyPreferredDataSubIdChanged(mPreferredDataSubId); } catch (RemoteException ex) { // Should never happen because its always available. return PhoneSwitcher.getInstance().getPreferredDataSubscriptionId(); } finally { Binder.restoreCallingIdentity(token); } } Loading Loading
src/java/com/android/internal/telephony/PhoneSwitcher.java +18 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.os.Message; import android.os.Registrant; import android.os.RegistrantList; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.PhoneCapability; import android.telephony.PhoneStateListener; import android.telephony.PreciseCallState; Loading Loading @@ -854,6 +855,7 @@ public class PhoneSwitcher extends Handler { mPreferredDataSubId = subId; logDataSwitchEvent(TelephonyEvent.EventState.START, DataSwitch.Reason.CBRS); onEvaluate(REQUESTS_UNCHANGED, "preferredDataSubscriptionIdChanged"); notifyPreferredDataSubIdChanged(); registerDefaultNetworkChangeCallback(); } } Loading @@ -872,10 +874,22 @@ public class PhoneSwitcher extends Handler { // TODO b/123598154: rename preferredDataSub to opportunisticSubId. public void trySetPreferredSubscription(int subId, boolean needValidation, ISetOpportunisticDataCallback callback) { log("Try set preferred subscription to subId " + subId + (needValidation ? " with " : " without ") + "validation"); PhoneSwitcher.this.obtainMessage(EVENT_CHANGE_PREFERRED_SUBSCRIPTION, subId, needValidation ? 1 : 0, callback).sendToTarget(); } private void notifyPreferredDataSubIdChanged() { ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( "telephony.registry")); try { tr.notifyPreferredDataSubIdChanged(mPreferredDataSubId); } catch (RemoteException ex) { // Should never happen because TelephonyRegistry service should always be available. } } private boolean isCallActive(Phone phone) { if (phone == null) { return false; Loading @@ -890,6 +904,10 @@ public class PhoneSwitcher extends Handler { ? HAL_COMMAND_PREFERRED_DATA : HAL_COMMAND_ALLOW_DATA; } public int getPreferredDataSubscriptionId() { return mPreferredDataSubId; } private void log(String l) { Rlog.d(LOG_TAG, l); mLocalLog.log(l); Loading
src/java/com/android/internal/telephony/SubscriptionController.java +4 −9 Original line number Diff line number Diff line Loading @@ -2706,17 +2706,12 @@ public class SubscriptionController extends ISub.Stub { @Override public int getPreferredDataSubscriptionId() { enforceReadPrivilegedPhoneState("getPreferredDataSubscriptionId"); return mPreferredDataSubId; } final long token = Binder.clearCallingIdentity(); private void notifyPreferredDataSubIdChanged() { ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( "telephony.registry")); try { if (DBG) logd("notifyPreferredDataSubIdChanged:"); tr.notifyPreferredDataSubIdChanged(mPreferredDataSubId); } catch (RemoteException ex) { // Should never happen because its always available. return PhoneSwitcher.getInstance().getPreferredDataSubscriptionId(); } finally { Binder.restoreCallingIdentity(token); } } Loading