From 967c10b10365f544b0aa81fa66fe79c0a35bed33 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Thu, 31 Mar 2022 21:15:01 -0700 Subject: SetDataEnabled indicate calling package Test: atest TelephonyManagerTest Bug: 226149142 Merged-In: I769437e9332f27c0990c37f60ad6d9db284e86cf Change-Id: I769437e9332f27c0990c37f60ad6d9db284e86cf --- telephony/java/android/telephony/TelephonyManager.java | 10 +++++----- telephony/java/com/android/internal/telephony/ITelephony.aidl | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index e5d56849933e..82949f29bf3b 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -10291,7 +10291,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.enableDataConnectivity(); + return telephony.enableDataConnectivity(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#enableDataConnectivity", e); } @@ -10305,7 +10305,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.disableDataConnectivity(); + return telephony.disableDataConnectivity(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#disableDataConnectivity", e); } @@ -11682,7 +11682,7 @@ public class TelephonyManager { Log.d(TAG, "factoryReset: subId=" + subId); ITelephony telephony = getITelephony(); if (telephony != null) { - telephony.factoryReset(subId); + telephony.factoryReset(subId, getOpPackageName()); } } catch (RemoteException e) { } @@ -11702,7 +11702,7 @@ public class TelephonyManager { Log.d(TAG, "resetSettings: subId=" + getSubId()); ITelephony telephony = getITelephony(); if (telephony != null) { - telephony.factoryReset(getSubId()); + telephony.factoryReset(getSubId(), getOpPackageName()); } } catch (RemoteException e) { } @@ -12942,7 +12942,7 @@ public class TelephonyManager { try { ITelephony service = getITelephony(); if (service != null) { - service.setDataEnabledForReason(subId, reason, enabled); + service.setDataEnabledForReason(subId, reason, enabled, getOpPackageName()); } else { throw new IllegalStateException("telephony service is null."); } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 2c1167f0b8b9..f5877d8fd20a 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -270,13 +270,13 @@ interface ITelephony { * Allow mobile data connections. */ @UnsupportedAppUsage - boolean enableDataConnectivity(); + boolean enableDataConnectivity(String callingPackage); /** * Disallow mobile data connections. */ @UnsupportedAppUsage - boolean disableDataConnectivity(); + boolean disableDataConnectivity(String callingPackage); /** * Report whether data connectivity is possible. @@ -959,8 +959,9 @@ interface ITelephony { * @param subId user preferred subId. * @param reason the reason the data enable change is taking place * @param enable true to turn on, else false + * @param callingPackage the package that changed the data enabled state */ - void setDataEnabledForReason(int subId, int reason, boolean enable); + void setDataEnabledForReason(int subId, int reason, boolean enable, String callingPackage); /** * Return whether data is enabled for certain reason @@ -1332,7 +1333,7 @@ interface ITelephony { */ PhoneAccountHandle getPhoneAccountHandleForSubscriptionId(int subscriptionId); - void factoryReset(int subId); + void factoryReset(int subId, String callingPackage); /** * Returns users's current locale based on the SIM. -- cgit v1.2.3-59-g8ed1b From 1780b1aecec5bcb865450d76a1cf4506d96ce6dc Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sat, 2 Apr 2022 20:53:50 -0700 Subject: Improved the network type to string Bug: 227781379 Test: atest DataNetworkControllerTest DataProfileManagerTest Merged-In: I6d09ade1650e226a965547e3f78e74f3f2ffec59 Change-Id: I6d09ade1650e226a965547e3f78e74f3f2ffec59 --- telephony/java/android/telephony/TelephonyManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 82949f29bf3b..87c337da8ccb 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3134,8 +3134,10 @@ public class TelephonyManager { return "LTE_CA"; case NETWORK_TYPE_NR: return "NR"; - default: + case NETWORK_TYPE_UNKNOWN: return "UNKNOWN"; + default: + return "UNKNOWN(" + type + ")"; } } -- cgit v1.2.3-59-g8ed1b