summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2010-08-26 14:48:12 -0400
committerDerek Sollenberger <djsollen@google.com>2010-08-27 11:10:36 -0400
commitde2c49ef48de4e18e53fa1e6b13888a15965a1cc (patch)
treef3b0d4fdef3578a9d8d7591deddadf3cf5e94145 /core/java/android/webkit
parent231a0005654d23284ab58a2d9ea892b995988c34 (diff)
downloadframeworks_base-de2c49ef48de4e18e53fa1e6b13888a15965a1cc.zip
frameworks_base-de2c49ef48de4e18e53fa1e6b13888a15965a1cc.tar.gz
frameworks_base-de2c49ef48de4e18e53fa1e6b13888a15965a1cc.tar.bz2
Support pre-loading browser plugins on the system image.
The shared library from a pre-loaded plugin is in the /system/lib directory and not in the apps typical data directory. This change adjust the plugin loading to handle that difference and ensures that the right library is loaded. Change-Id: I4337089e40944e77adb6a95afb93cc1d5069511a http://b/2779728
Diffstat (limited to 'core/java/android/webkit')
-rw-r--r--core/java/android/webkit/PluginManager.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/core/java/android/webkit/PluginManager.java b/core/java/android/webkit/PluginManager.java
index cdcb662..e5eeb8c 100644
--- a/core/java/android/webkit/PluginManager.java
+++ b/core/java/android/webkit/PluginManager.java
@@ -21,9 +21,9 @@ import java.util.List;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
-import android.app.Service;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -59,7 +59,9 @@ public class PluginManager {
*/
public static final String PLUGIN_PERMISSION = "android.webkit.permission.PLUGIN";
- private static final String LOGTAG = "webkit";
+ private static final String LOGTAG = "PluginManager";
+
+ private static final String PLUGIN_SYSTEM_LIB = "/system/lib/plugins/";
private static final String PLUGIN_TYPE = "type";
private static final String TYPE_NATIVE = "native";
@@ -111,9 +113,8 @@ public class PluginManager {
ArrayList<String> directories = new ArrayList<String>();
PackageManager pm = mContext.getPackageManager();
- List<ResolveInfo> plugins = pm.queryIntentServices(new Intent(
- PLUGIN_ACTION), PackageManager.GET_SERVICES
- | PackageManager.GET_META_DATA);
+ List<ResolveInfo> plugins = pm.queryIntentServices(new Intent(PLUGIN_ACTION),
+ PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
synchronized(mPackageInfoCache) {
@@ -143,10 +144,19 @@ public class PluginManager {
continue;
}
- // check if their is a conflict in the lib directory names
+ /*
+ * find the location of the plugin's shared library. The default
+ * is to assume the app is either a user installed app or an
+ * updated system app. In both of these cases the library is
+ * stored in the app's data directory.
+ */
String directory = pkgInfo.applicationInfo.dataDir + "/lib";
- if (directories.contains(directory)) {
- continue;
+ final int appFlags = pkgInfo.applicationInfo.flags;
+ final int updatedSystemFlags = ApplicationInfo.FLAG_SYSTEM |
+ ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
+ // preloaded system app with no user updates
+ if ((appFlags & updatedSystemFlags) == ApplicationInfo.FLAG_SYSTEM) {
+ directory = PLUGIN_SYSTEM_LIB + pkgInfo.packageName;
}
// check if the plugin has the required permissions
@@ -236,7 +246,7 @@ public class PluginManager {
// must be synchronized to ensure the consistency of the cache
synchronized(mPackageInfoCache) {
for (PackageInfo pkgInfo : mPackageInfoCache) {
- if (pluginLib.startsWith(pkgInfo.applicationInfo.dataDir)) {
+ if (pluginLib.contains(pkgInfo.packageName)) {
return pkgInfo.packageName;
}
}