summaryrefslogtreecommitdiffstats
path: root/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java
diff options
context:
space:
mode:
authorStephen Bird <sbird@cyngn.com>2016-06-13 12:27:39 -0700
committerStephen Bird <sbird@cyngn.com>2016-06-13 12:27:43 -0700
commit59574f3875747ebce0515bff9e0aa34c3725bc3b (patch)
tree755e8812af7160c3c3ebe1c9df2d5353cc2b809a /src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java
parent8e21a141a5bcd4a058c6ec0ede38c92866a698ba (diff)
downloadpackages_apps_PhoneCommon-59574f3875747ebce0515bff9e0aa34c3725bc3b.tar.gz
packages_apps_PhoneCommon-59574f3875747ebce0515bff9e0aa34c3725bc3b.tar.bz2
packages_apps_PhoneCommon-59574f3875747ebce0515bff9e0aa34c3725bc3b.zip
AmbientDataSubscription: Allow subscriptions to run different queries
If a plugin is disabled or enabled, let our subscriptions run different ambient queries. This is to address situations where extra work is done when the plugin is disabled. Change-Id: I8c95d58fa55761121481db4730e8d4ece2a2d14a Ticket: CD-682
Diffstat (limited to 'src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java')
-rw-r--r--src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java b/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java
index 4227239..2fee4cd 100644
--- a/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java
+++ b/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java
@@ -75,15 +75,25 @@ public abstract class AmbientDataSubscription<M> {
mDataHasBeenBroadcastPreviously = true;
} else {
for (ComponentName cn : installedPlugins) {
- ArrayList<TypedPendingResult> apiCallbacks = new ArrayList<>();
getPluginInfo().put(cn, getNewModObject(cn));
- requestedModInfo(apiCallbacks, cn);
- executeAll(apiCallbacks, cn);
+ getPluginStatus(cn);
}
}
}
};
+ public void getDisabledModInfo(ComponentName cn) {
+ ArrayList<TypedPendingResult> apiCallbacks = new ArrayList<>();
+ disabledModInfo(apiCallbacks, cn);
+ executeAll(apiCallbacks, cn);
+ }
+
+ public void getEnabledModInfo(ComponentName cn) {
+ ArrayList<TypedPendingResult> apiCallbacks = new ArrayList<>();
+ enabledModInfo(apiCallbacks, cn);
+ executeAll(apiCallbacks, cn);
+ }
+
public AmbientDataSubscription(Context context) {
mContext = context;
mClient = AmbientConnection.CLIENT.get(context);
@@ -115,14 +125,30 @@ public abstract class AmbientDataSubscription<M> {
/**
* Gets the required queries for all our plugins
*
+ * @param componentName ComponentName of the plugin we will be querying
+ */
+ protected abstract void getPluginStatus(ComponentName componentName);
+
+ /**
+ * Gets the enabled queries for all our plugins
+ *
* @param queries ArrayList for us to add TypedPendingResults to
* @param componentName ComponentName of the plugin we will be querying
*/
- protected abstract void requestedModInfo(ArrayList<TypedPendingResult> queries,
+ protected abstract void enabledModInfo(ArrayList<TypedPendingResult> queries,
ComponentName componentName);
/**
+ * Gets the disabled queries for all our plugins
+ *
+ * @param queries ArrayList for us to add TypedPendingResults to
+ * @param componentName ComponentName of the plugin we will be querying
+ */
+ protected abstract void disabledModInfo(ArrayList<TypedPendingResult> queries,
+ ComponentName componentName);
+
+ /**
* Action that takes place when a refresh is requested.
*/
protected abstract void onRefreshRequested();