[Settings] Apply proxy design to data usage
Enable proxy to subscription manager in data usage UI. Bug: 141833767 Test: manual make RunSettingsRoboTests -j ROBOTEST_FILTER=BillingCyclePreferenceTest make RunSettingsRoboTests -j ROBOTEST_FILTER=CellDataPreferenceTest make RunSettingsRoboTests -j ROBOTEST_FILTER=DataUsageListTest make RunSettingsRoboTests -j ROBOTEST_FILTER=DataUsageSummaryTest make RunSettingsRoboTests -j ROBOTEST_FILTER=DataUsageUtilsTest make RunSettingsRoboTests -j ROBOTEST_FILTER=MobileDataEnabledListenerTest Change-Id: Id119738dc16ece8767c088b9a0794997e4b0334f
This commit is contained in:
@@ -82,7 +82,6 @@ public class ProxySubscriptionManager extends SubscriptionManager.OnSubscription
|
||||
}
|
||||
};
|
||||
|
||||
mKeepCacheWhenOnStart = true;
|
||||
mSubsciptionsMonitor.start();
|
||||
}
|
||||
|
||||
@@ -90,7 +89,6 @@ public class ProxySubscriptionManager extends SubscriptionManager.OnSubscription
|
||||
private Context mContext;
|
||||
private ActiveSubsciptionsListener mSubsciptionsMonitor;
|
||||
private GlobalSettingsChangeListener mAirplaneModeMonitor;
|
||||
private boolean mKeepCacheWhenOnStart;
|
||||
|
||||
private List<OnActiveSubscriptionChangedListener> mActiveSubscriptionsListeners;
|
||||
|
||||
@@ -100,6 +98,12 @@ public class ProxySubscriptionManager extends SubscriptionManager.OnSubscription
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscriptionsChanged() {
|
||||
clearCache();
|
||||
notifyAllListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lifecycle for data within proxy
|
||||
*
|
||||
@@ -118,15 +122,11 @@ public class ProxySubscriptionManager extends SubscriptionManager.OnSubscription
|
||||
|
||||
@OnLifecycleEvent(ON_START)
|
||||
void onStart() {
|
||||
if (!mKeepCacheWhenOnStart) {
|
||||
mSubsciptionsMonitor.clearCache();
|
||||
}
|
||||
mSubsciptionsMonitor.start();
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(ON_STOP)
|
||||
void onStop() {
|
||||
mKeepCacheWhenOnStart = false;
|
||||
mSubsciptionsMonitor.stop();
|
||||
}
|
||||
|
||||
@@ -151,6 +151,15 @@ public class ProxySubscriptionManager extends SubscriptionManager.OnSubscription
|
||||
return mSubsciptionsMonitor.getSubscriptionManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current max. number active subscription info(s) been setup within device
|
||||
*
|
||||
* @return max. number of active subscription info(s)
|
||||
*/
|
||||
public int getActiveSubscriptionInfoCountMax() {
|
||||
return mSubsciptionsMonitor.getActiveSubscriptionInfoCountMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of active subscription info
|
||||
*
|
||||
@@ -183,6 +192,9 @@ public class ProxySubscriptionManager extends SubscriptionManager.OnSubscription
|
||||
* @param listener listener to active subscriptions change
|
||||
*/
|
||||
public void addActiveSubscriptionsListener(OnActiveSubscriptionChangedListener listener) {
|
||||
if (mActiveSubscriptionsListeners.contains(listener)) {
|
||||
return;
|
||||
}
|
||||
mActiveSubscriptionsListeners.add(listener);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user