Merge "Make setMetered and setOpportunistic public."
This commit is contained in:
@@ -42962,6 +42962,8 @@ package android.telephony {
|
|||||||
method public void removeOnOpportunisticSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
|
method public void removeOnOpportunisticSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
|
||||||
method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
|
method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
|
||||||
method public boolean removeSubscriptionsFromGroup(int[]);
|
method public boolean removeSubscriptionsFromGroup(int[]);
|
||||||
|
method public boolean setMetered(boolean, int);
|
||||||
|
method public boolean setOpportunistic(boolean, int);
|
||||||
method public java.lang.String setSubscriptionGroup(int[]);
|
method public java.lang.String setSubscriptionGroup(int[]);
|
||||||
method public void setSubscriptionOverrideCongested(int, boolean, long);
|
method public void setSubscriptionOverrideCongested(int, boolean, long);
|
||||||
method public void setSubscriptionOverrideUnmetered(int, boolean, long);
|
method public void setSubscriptionOverrideUnmetered(int, boolean, long);
|
||||||
|
|||||||
@@ -2008,6 +2008,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
|
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((events & PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE) != 0) {
|
||||||
|
// It can have either READ_PHONE_STATE or READ_PRIVILEGED_PHONE_STATE.
|
||||||
|
TelephonyPermissions.checkReadPhoneState(mContext,
|
||||||
|
SubscriptionManager.INVALID_SUBSCRIPTION_ID, Binder.getCallingPid(),
|
||||||
|
Binder.getCallingUid(), callingPackage, "listen to "
|
||||||
|
+ "LISTEN_PREFERRED_DATA_SUBID_CHANGE");
|
||||||
|
}
|
||||||
|
|
||||||
if ((events & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) {
|
if ((events & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) {
|
||||||
mContext.enforceCallingOrSelfPermission(
|
mContext.enforceCallingOrSelfPermission(
|
||||||
|
|||||||
@@ -583,7 +583,6 @@ public class SubscriptionManager {
|
|||||||
* TelephonyProvider column name for whether a subscription is opportunistic, that is,
|
* TelephonyProvider column name for whether a subscription is opportunistic, that is,
|
||||||
* whether the network it connects to is limited in functionality or coverage.
|
* whether the network it connects to is limited in functionality or coverage.
|
||||||
* For example, CBRS.
|
* For example, CBRS.
|
||||||
* IS_EMBEDDED should always be true.
|
|
||||||
* <p>Type: INTEGER (int), 1 for opportunistic or 0 for non-opportunistic.
|
* <p>Type: INTEGER (int), 1 for opportunistic or 0 for non-opportunistic.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -2521,18 +2520,32 @@ public class SubscriptionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set opportunistic by simInfo index
|
* Set whether a subscription is opportunistic, that is, whether the network it connects
|
||||||
|
* to has limited coverage. For example, CBRS. Setting a subscription opportunistic has
|
||||||
|
* following impacts:
|
||||||
|
* 1) Even if it's active, it will be dormant most of the time. The modem will not try
|
||||||
|
* to scan or camp until it knows an available network is nearby to save power.
|
||||||
|
* 2) Telephony relies on system app or carrier input to notify nearby available networks.
|
||||||
|
* See {@link TelephonyManager#updateAvailableNetworks(List)} for more information.
|
||||||
|
* 3) In multi-SIM devices, when the network is nearby and camped, system may automatically
|
||||||
|
* switch internet data between it and default data subscription, based on carrier
|
||||||
|
* recommendation and its signal strength and metered-ness, etc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Caller will either have {@link android.Manifest.permission#MODIFY_PHONE_STATE} or carrier
|
||||||
|
* privilege permission of the subscription.
|
||||||
*
|
*
|
||||||
* @param opportunistic whether it’s opportunistic subscription.
|
* @param opportunistic whether it’s opportunistic subscription.
|
||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @return the number of records updated
|
* @return {@code true} if the operation is succeed, {@code false} otherwise.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public int setOpportunistic(boolean opportunistic, int subId) {
|
public boolean setOpportunistic(boolean opportunistic, int subId) {
|
||||||
if (VDBG) logd("[setOpportunistic]+ opportunistic:" + opportunistic + " subId:" + subId);
|
if (VDBG) logd("[setOpportunistic]+ opportunistic:" + opportunistic + " subId:" + subId);
|
||||||
return setSubscriptionPropertyHelper(subId, "setOpportunistic",
|
return setSubscriptionPropertyHelper(subId, "setOpportunistic",
|
||||||
(iSub)-> iSub.setOpportunistic(opportunistic, subId));
|
(iSub)-> iSub.setOpportunistic(
|
||||||
|
opportunistic, subId, mContext.getOpPackageName())) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2652,18 +2665,26 @@ public class SubscriptionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set metered by simInfo index
|
* Set if a subscription is metered or not. Similar to Wi-Fi, metered means
|
||||||
|
* user may be charged more if more data is used.
|
||||||
|
*
|
||||||
|
* By default all Cellular networks are considered metered. System or carrier privileged apps
|
||||||
|
* can set a subscription un-metered which will be considered when system switches data between
|
||||||
|
* primary subscription and opportunistic subscription.
|
||||||
|
*
|
||||||
|
* Caller will either have {@link android.Manifest.permission#MODIFY_PHONE_STATE} or carrier
|
||||||
|
* privilege permission of the subscription.
|
||||||
*
|
*
|
||||||
* @param isMetered whether it’s a metered subscription.
|
* @param isMetered whether it’s a metered subscription.
|
||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @return the number of records updated
|
* @return {@code true} if the operation is succeed, {@code false} otherwise.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public int setMetered(boolean isMetered, int subId) {
|
public boolean setMetered(boolean isMetered, int subId) {
|
||||||
if (VDBG) logd("[setIsMetered]+ isMetered:" + isMetered + " subId:" + subId);
|
if (VDBG) logd("[setIsMetered]+ isMetered:" + isMetered + " subId:" + subId);
|
||||||
return setSubscriptionPropertyHelper(subId, "setIsMetered",
|
return setSubscriptionPropertyHelper(subId, "setIsMetered",
|
||||||
(iSub)-> iSub.setMetered(isMetered, subId));
|
(iSub)-> iSub.setMetered(isMetered, subId, mContext.getOpPackageName())) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6734,8 +6734,8 @@ public class TelephonyManager {
|
|||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.getCarrierPrivilegeStatus(subId) ==
|
return telephony.getCarrierPrivilegeStatus(subId)
|
||||||
CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
== CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
|
Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ interface ISub {
|
|||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @return the number of records updated
|
* @return the number of records updated
|
||||||
*/
|
*/
|
||||||
int setOpportunistic(boolean opportunistic, int subId);
|
int setOpportunistic(boolean opportunistic, int subId, String callingPackage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inform SubscriptionManager that subscriptions in the list are bundled
|
* Inform SubscriptionManager that subscriptions in the list are bundled
|
||||||
@@ -190,7 +190,7 @@ interface ISub {
|
|||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @return the number of records updated
|
* @return the number of records updated
|
||||||
*/
|
*/
|
||||||
int setMetered(boolean isMetered, int subId);
|
int setMetered(boolean isMetered, int subId, String callingPackage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set which subscription is preferred for cellular data. It's
|
* Set which subscription is preferred for cellular data. It's
|
||||||
|
|||||||
Reference in New Issue
Block a user