Loading telephony/java/android/telephony/SubscriptionManager.java +39 −69 Original line number Diff line number Diff line Loading @@ -1051,24 +1051,9 @@ public class SubscriptionManager { */ public int setIconTint(int tint, int subId) { if (VDBG) logd("[setIconTint]+ tint:" + tint + " subId:" + subId); if (!isValidSubscriptionId(subId)) { logd("[setIconTint]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setIconTint(tint, subId); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setIconTint", (iSub)-> iSub.setIconTint(tint, subId) ); } /** Loading Loading @@ -1096,24 +1081,9 @@ public class SubscriptionManager { logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource); } if (!isValidSubscriptionId(subId)) { logd("[setDisplayName]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setDisplayNameUsingSrc(displayName, subId, nameSource); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setDisplayName", (iSub)-> iSub.setDisplayNameUsingSrc(displayName, subId, nameSource) ); } /** Loading @@ -1124,24 +1094,13 @@ public class SubscriptionManager { * @hide */ public int setDisplayNumber(String number, int subId) { if (number == null || !isValidSubscriptionId(subId)) { if (number == null) { logd("[setDisplayNumber]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setDisplayNumber(number, subId); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setDisplayNumber", (iSub)-> iSub.setDisplayNumber(number, subId) ); } /** Loading @@ -1153,23 +1112,9 @@ public class SubscriptionManager { */ public int setDataRoaming(int roaming, int subId) { if (VDBG) logd("[setDataRoaming]+ roaming:" + roaming + " subId:" + subId); if (roaming < 0 || !isValidSubscriptionId(subId)) { logd("[setDataRoaming]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setDataRoaming(roaming, subId); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setDataRoaming", (iSub)->iSub.setDataRoaming(roaming, subId) ); } /** Loading Loading @@ -1994,4 +1939,29 @@ public class SubscriptionManager { } return false; } private interface CallISubMethodHelper { int callMethod(ISub iSub) throws RemoteException; } private int setSubscriptionPropertyHelper(int subId, String methodName, CallISubMethodHelper helper) { if (!isValidSubscriptionId(subId)) { logd("[" + methodName + "]" + "- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = helper.callMethod(iSub); } } catch (RemoteException ex) { // ignore it } return result; } } Loading
telephony/java/android/telephony/SubscriptionManager.java +39 −69 Original line number Diff line number Diff line Loading @@ -1051,24 +1051,9 @@ public class SubscriptionManager { */ public int setIconTint(int tint, int subId) { if (VDBG) logd("[setIconTint]+ tint:" + tint + " subId:" + subId); if (!isValidSubscriptionId(subId)) { logd("[setIconTint]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setIconTint(tint, subId); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setIconTint", (iSub)-> iSub.setIconTint(tint, subId) ); } /** Loading Loading @@ -1096,24 +1081,9 @@ public class SubscriptionManager { logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource); } if (!isValidSubscriptionId(subId)) { logd("[setDisplayName]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setDisplayNameUsingSrc(displayName, subId, nameSource); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setDisplayName", (iSub)-> iSub.setDisplayNameUsingSrc(displayName, subId, nameSource) ); } /** Loading @@ -1124,24 +1094,13 @@ public class SubscriptionManager { * @hide */ public int setDisplayNumber(String number, int subId) { if (number == null || !isValidSubscriptionId(subId)) { if (number == null) { logd("[setDisplayNumber]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setDisplayNumber(number, subId); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setDisplayNumber", (iSub)-> iSub.setDisplayNumber(number, subId) ); } /** Loading @@ -1153,23 +1112,9 @@ public class SubscriptionManager { */ public int setDataRoaming(int roaming, int subId) { if (VDBG) logd("[setDataRoaming]+ roaming:" + roaming + " subId:" + subId); if (roaming < 0 || !isValidSubscriptionId(subId)) { logd("[setDataRoaming]- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.setDataRoaming(roaming, subId); } } catch (RemoteException ex) { // ignore it } return result; return setSubscriptionPropertyHelper(subId, "setDataRoaming", (iSub)->iSub.setDataRoaming(roaming, subId) ); } /** Loading Loading @@ -1994,4 +1939,29 @@ public class SubscriptionManager { } return false; } private interface CallISubMethodHelper { int callMethod(ISub iSub) throws RemoteException; } private int setSubscriptionPropertyHelper(int subId, String methodName, CallISubMethodHelper helper) { if (!isValidSubscriptionId(subId)) { logd("[" + methodName + "]" + "- fail"); return -1; } int result = 0; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = helper.callMethod(iSub); } } catch (RemoteException ex) { // ignore it } return result; } }