Merge changes from topics "getActiveSubInfoCount", "multi_sim_setting_controller", "setIconTint", "sync_update"

* changes:
  Added setIconTint
  Added sync update database support
  Added getActiveSubInfoCount
  Migrated MultiSimSettingController
This commit is contained in:
Jack Yu
2022-12-06 15:06:57 +00:00
committed by Android (Google) Code Review
4 changed files with 22 additions and 15 deletions

View File

@@ -118,6 +118,11 @@
<bool name="config_using_subscription_manager_service">false</bool>
<java-symbol type="bool" name="config_using_subscription_manager_service" />
<!-- Whether asynchronously update the subscription database or not. Async mode increases
the performance, but sync mode reduces the chance of database/cache out-of-sync. -->
<bool name="config_subscription_database_async_update">true</bool>
<java-symbol type="bool" name="config_subscription_database_async_update" />
<!-- Boolean indicating whether the emergency numbers for a country, sourced from modem/config,
should be ignored if that country is 'locked' (i.e. ignore_modem_config set to true) in
Android Emergency DB. If this value is true, emergency numbers for a country, sourced from

View File

@@ -648,6 +648,15 @@ public class SubscriptionInfo implements Parcelable {
return mIsOpportunistic;
}
/**
* @return {@code true} if the subscription is from the actively used SIM.
*
* @hide
*/
public boolean isActive() {
return mSimSlotIndex >= 0 || mType == SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM;
}
/**
* Used in scenarios where different subscriptions are bundled as a group.
* It's typically a primary and an opportunistic subscription. (see {@link #isOpportunistic()})

View File

@@ -1766,8 +1766,7 @@ public class SubscriptionManager {
*
* <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
* or that the calling app has carrier privileges (see
* {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, only records accessible
* to the calling app are returned.
* {@link TelephonyManager#hasCarrierPrivileges}).
*
* @return Sorted list of the currently {@link SubscriptionInfo} records available on the device.
* <ul>
@@ -1785,7 +1784,6 @@ public class SubscriptionManager {
* </li>
* </ul>
*/
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
return getActiveSubscriptionInfoList(/* userVisibleonly */true);
@@ -1989,17 +1987,12 @@ public class SubscriptionManager {
}
/**
* Get the active subscription count.
*
* Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
* or that the calling app has carrier privileges (see
* {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, the count will include
* only those subscriptions accessible to the caller.
* @return The current number of active subscriptions.
*
* @return the current number of active subscriptions. There is no guarantee the value
* returned by this method will be the same as the length of the list returned by
* {@link #getActiveSubscriptionInfoList}.
* @see #getActiveSubscriptionInfoList()
*/
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public int getActiveSubscriptionInfoCount() {
int result = 0;
@@ -2139,7 +2132,7 @@ public class SubscriptionManager {
/**
* Set SIM icon tint color for subscription ID
* @param tint the RGB value of icon tint color of the SIM
* @param subId the unique Subscritpion ID in database
* @param subId the unique subscription ID in database
* @return the number of records updated
* @hide
*/
@@ -2147,7 +2140,7 @@ public class SubscriptionManager {
public int setIconTint(@ColorInt int tint, int subId) {
if (VDBG) logd("[setIconTint]+ tint:" + tint + " subId:" + subId);
return setSubscriptionPropertyHelper(subId, "setIconTint",
(iSub)-> iSub.setIconTint(tint, subId)
(iSub)-> iSub.setIconTint(subId, tint)
);
}

View File

@@ -135,11 +135,11 @@ interface ISub {
/**
* Set SIM icon tint color by simInfo index
* @param tint the icon tint color of the SIM
* @param subId the unique SubscriptionInfo index in database
* @param tint the icon tint color of the SIM
* @return the number of records updated
*/
int setIconTint(int tint, int subId);
int setIconTint(int subId, int tint);
/**
* Set display name by simInfo index with name source