summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-09-22 14:59:33 -0700
committerJohn Reck <jreck@google.com>2011-09-22 15:04:50 -0700
commit1b7d2b95670a6c94cb29e0f4b965cebdf6f65bda (patch)
treec4e2ec9381ddea4adee9e292724ca46905a81551 /src/com/android/browser
parent03583db8ecd24aaafad290bd205fc44fe06d1061 (diff)
downloadpackages_apps_Browser-1b7d2b95670a6c94cb29e0f4b965cebdf6f65bda.zip
packages_apps_Browser-1b7d2b95670a6c94cb29e0f4b965cebdf6f65bda.tar.gz
packages_apps_Browser-1b7d2b95670a6c94cb29e0f4b965cebdf6f65bda.tar.bz2
Fix Resources.getIdentifier usage
Bug: 5352337 Change-Id: If639cf6dec892f2952f8eb3fedbb267e4cc7c0ae
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/homepages/RequestHandler.java3
-rw-r--r--src/com/android/browser/homepages/Template.java4
-rw-r--r--src/com/android/browser/search/SearchEngineInfo.java5
3 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/browser/homepages/RequestHandler.java b/src/com/android/browser/homepages/RequestHandler.java
index 248bf53..e0a0eac 100644
--- a/src/com/android/browser/homepages/RequestHandler.java
+++ b/src/com/android/browser/homepages/RequestHandler.java
@@ -115,7 +115,8 @@ public class RequestHandler extends Thread {
void writeResource(String fileName) throws IOException {
Resources res = mContext.getResources();
- int id = res.getIdentifier(fileName, null, mContext.getPackageName());
+ String packageName = R.class.getPackage().getName();
+ int id = res.getIdentifier(fileName, null, packageName);
if (id != 0) {
InputStream in = res.openRawResource(id);
byte[] buf = new byte[4096];
diff --git a/src/com/android/browser/homepages/Template.java b/src/com/android/browser/homepages/Template.java
index c1a6b0e..e918b07 100644
--- a/src/com/android/browser/homepages/Template.java
+++ b/src/com/android/browser/homepages/Template.java
@@ -30,6 +30,8 @@ import android.content.res.Resources;
import android.database.Cursor;
import android.util.TypedValue;
+import com.android.browser.R;
+
public class Template {
private static HashMap<Integer, Template> sCachedTemplates = new HashMap<Integer, Template>();
@@ -234,7 +236,7 @@ public class Template {
private static String replaceConsts(Context context, String template) {
final Pattern pattern = Pattern.compile("<%@\\s*(\\w+/\\w+)\\s*%>");
final Resources res = context.getResources();
- final String packageName = context.getPackageName();
+ final String packageName = R.class.getPackage().getName();
Matcher m = pattern.matcher(template);
StringBuffer sb = new StringBuffer();
while (m.find()) {
diff --git a/src/com/android/browser/search/SearchEngineInfo.java b/src/com/android/browser/search/SearchEngineInfo.java
index af6fa70..ec304f6 100644
--- a/src/com/android/browser/search/SearchEngineInfo.java
+++ b/src/com/android/browser/search/SearchEngineInfo.java
@@ -21,6 +21,8 @@ import android.content.res.Resources.NotFoundException;
import android.text.TextUtils;
import android.util.Log;
+import com.android.browser.R;
+
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Locale;
@@ -61,7 +63,8 @@ public class SearchEngineInfo {
mName = name;
Resources res = context.getResources();
- int id_data = res.getIdentifier(name, "array", context.getPackageName());
+ String packageName = R.class.getPackage().getName();
+ int id_data = res.getIdentifier(name, "array", packageName);
if (id_data == 0) {
throw new IllegalArgumentException("No resources found for " + name);
}