From e86a40efc096bf03ed611347a67fc2fc5088a5db Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Fri, 29 Apr 2016 14:00:01 +0200 Subject: Make internal variables non-static. Change-Id: I2eae08deb7b0c6dcd94b0a4b652366faae933319 --- .../common/ambient/AmbientDataSubscription.java | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java b/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java index b199a5e..97eff2f 100644 --- a/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java +++ b/src-ambient/com/android/phone/common/ambient/AmbientDataSubscription.java @@ -50,14 +50,14 @@ public abstract class AmbientDataSubscription { // Holder for plugin object private HashMap mPluginInfo; - private static boolean sDataHasBeenBroadcastPreviously = false; + private boolean mDataHasBeenBroadcastPreviously = false; // A list of our registered clients, who all register with the CallMethodReceiver - private static final HashMap sRegisteredClients = new HashMap<>(); + private final HashMap mRegisteredClients = new HashMap<>(); // A map of our components and if they have have enabled IInterface listeners. This is to keep // track of if listeners should be added or removed. - private static final HashMap sEnabledListeners = new HashMap<>(); + private final HashMap mEnabledListeners = new HashMap<>(); // Wait up to 60 seconds for data to return. Mimicks what PluginBinderManager does. private static final long TIMEOUT_MILLISECONDS = 60000L; @@ -72,7 +72,7 @@ public abstract class AmbientDataSubscription { if (installedPlugins.isEmpty()) { // We want to tell our subscribers that we have no plugins to worry about broadcast(); - sDataHasBeenBroadcastPreviously = true; + mDataHasBeenBroadcastPreviously = true; } else { for (ComponentName cn : installedPlugins) { ArrayList apiCallbacks = new ArrayList<>(); @@ -154,21 +154,21 @@ public abstract class AmbientDataSubscription { protected abstract M getNewModObject(ComponentName componentName); private void enablePluginListeners(ComponentName cn) { - if (!sEnabledListeners.containsKey(cn) || !sEnabledListeners.get(cn)) { + if (!mEnabledListeners.containsKey(cn) || !mEnabledListeners.get(cn)) { M plugin = getPluginIfExists(cn); if (plugin != null) { enableListeners(plugin); - sEnabledListeners.put(cn, true); + mEnabledListeners.put(cn, true); } } } private void disablePluginListeners(ComponentName cn) { - if (sEnabledListeners.containsKey(cn) && sEnabledListeners.get(cn)) { + if (mEnabledListeners.containsKey(cn) && mEnabledListeners.get(cn)) { M plugin = getPluginIfExists(cn); disableListeners(plugin); - sEnabledListeners.put(cn, false); + mEnabledListeners.put(cn, false); } } @@ -180,7 +180,7 @@ public abstract class AmbientDataSubscription { @Override public void run() { if (DEBUG) Log.d(TAG, "broadcast"); - for (PluginChanged client : sRegisteredClients.values()) { + for (PluginChanged client : mRegisteredClients.values()) { client.onChanged(mPluginInfo); } } @@ -196,9 +196,9 @@ public abstract class AmbientDataSubscription { * @return boolean isempty */ public boolean subscribe(String id, PluginChanged cmr) { - sRegisteredClients.put(id, cmr); + mRegisteredClients.put(id, cmr); if (DEBUG) Log.v("TAG", "subscribed: " + id); - return sDataHasBeenBroadcastPreviously; + return mDataHasBeenBroadcastPreviously; } /** @@ -207,8 +207,8 @@ public abstract class AmbientDataSubscription { * @param id of the client to remove */ public void unsubscribe(String id) { - sRegisteredClients.remove(id); - if (sRegisteredClients.isEmpty()) { + mRegisteredClients.remove(id); + if (mRegisteredClients.isEmpty()) { for (ComponentName cn : mPluginInfo.keySet()) { disablePluginListeners(cn); } @@ -280,8 +280,8 @@ public abstract class AmbientDataSubscription { onRefreshRequested(); } - public static boolean infoReady() { - return sDataHasBeenBroadcastPreviously; + public boolean infoReady() { + return mDataHasBeenBroadcastPreviously; } private void maybeBroadcastToSubscribers(ArrayList apiCallbacks) { @@ -310,7 +310,7 @@ public abstract class AmbientDataSubscription { // if it's just a critical broadcast to prevent extra work from our subscribers // once our long running calls are broadcast then this will be true. if (!critical) { - sDataHasBeenBroadcastPreviously = true; + mDataHasBeenBroadcastPreviously = true; } } } -- cgit v1.2.3