summaryrefslogtreecommitdiffstats
path: root/src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java')
-rw-r--r--src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java b/src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java
new file mode 100644
index 0000000..471457b
--- /dev/null
+++ b/src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java
@@ -0,0 +1,26 @@
+package com.android.phone.common.ambient.utils;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.util.Log;
+
+/**
+ * Utilites for Plugins
+ */
+public class PluginUtils {
+
+ private static final String TAG = PluginUtils.class.getSimpleName();
+
+ public static Resources getPluginResources(Context context, ComponentName componentName) {
+ PackageManager packageManager = context.getPackageManager();
+ try {
+ return packageManager.getResourcesForApplication(componentName.getPackageName());
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(TAG, "Plugin isn't installed: " + componentName.flattenToShortString());
+ return null;
+ }
+ }
+
+}