summaryrefslogtreecommitdiffstats
path: root/src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java
diff options
context:
space:
mode:
authorStephen Bird <sbird@cyngn.com>2016-03-31 15:03:11 -0700
committerErica Chang <echang@cyngn.com>2016-04-26 22:38:42 -0700
commitecc708d3c1417b60f316a0387d17f2cf4c67c2b1 (patch)
treefefb202fcf37bb15e301a821b206e02cf0a0e16e /src-ambient/com/android/phone/common/ambient/utils/PluginUtils.java
parent33beb0a0b887dbfa9797f7fa97f3cd715bb71a74 (diff)
downloadandroid_packages_apps_PhoneCommon-ecc708d3c1417b60f316a0387d17f2cf4c67c2b1.tar.gz
android_packages_apps_PhoneCommon-ecc708d3c1417b60f316a0387d17f2cf4c67c2b1.tar.bz2
android_packages_apps_PhoneCommon-ecc708d3c1417b60f316a0387d17f2cf4c67c2b1.zip
[1/4] Refactor CallMethodHelper
Change-Id: I3b24eedffddbf0960023dc2f1429038e5353de2f
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;
+ }
+ }
+
+}