Loading packages/SystemUI/src/com/android/systemui/plugins/PluginDependencyProvider.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -34,17 +34,21 @@ public class PluginDependencyProvider extends DependencyProvider { } } public <T> void allowPluginDependency(Class<T> cls, T obj) { public <T> void allowPluginDependency(Class<T> cls, T obj) { synchronized (mDependencies) { mDependencies.put(cls, obj); mDependencies.put(cls, obj); } } } @Override @Override <T> T get(Plugin p, Class<T> cls) { <T> T get(Plugin p, Class<T> cls) { if (!mManager.dependsOn(p, cls)) { if (!mManager.dependsOn(p, cls)) { throw new IllegalArgumentException(p.getClass() + " does not depend on " + cls); throw new IllegalArgumentException(p.getClass() + " does not depend on " + cls); } } synchronized (mDependencies) { if (!mDependencies.containsKey(cls)) { if (!mDependencies.containsKey(cls)) { throw new IllegalArgumentException("Unknown dependency " + cls); throw new IllegalArgumentException("Unknown dependency " + cls); } } return (T) mDependencies.get(cls); return (T) mDependencies.get(cls); } } } } } Loading
packages/SystemUI/src/com/android/systemui/plugins/PluginDependencyProvider.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -34,17 +34,21 @@ public class PluginDependencyProvider extends DependencyProvider { } } public <T> void allowPluginDependency(Class<T> cls, T obj) { public <T> void allowPluginDependency(Class<T> cls, T obj) { synchronized (mDependencies) { mDependencies.put(cls, obj); mDependencies.put(cls, obj); } } } @Override @Override <T> T get(Plugin p, Class<T> cls) { <T> T get(Plugin p, Class<T> cls) { if (!mManager.dependsOn(p, cls)) { if (!mManager.dependsOn(p, cls)) { throw new IllegalArgumentException(p.getClass() + " does not depend on " + cls); throw new IllegalArgumentException(p.getClass() + " does not depend on " + cls); } } synchronized (mDependencies) { if (!mDependencies.containsKey(cls)) { if (!mDependencies.containsKey(cls)) { throw new IllegalArgumentException("Unknown dependency " + cls); throw new IllegalArgumentException("Unknown dependency " + cls); } } return (T) mDependencies.get(cls); return (T) mDependencies.get(cls); } } } } }