diff options
Diffstat (limited to 'core/java/android/app')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 16 | ||||
-rw-r--r-- | core/java/android/app/ApplicationContext.java | 17 | ||||
-rw-r--r-- | core/java/android/app/LauncherActivity.java | 4 |
3 files changed, 29 insertions, 8 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 76b47f1..182843a 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -177,11 +177,17 @@ public final class ActivityThread { synchronized (mPackages) { // Resources is app scale dependent. ResourcesKey key = new ResourcesKey(resDir, compInfo.applicationScale); - //Log.w(TAG, "getTopLevelResources: " + resDir); + if (false) { + Log.w(TAG, "getTopLevelResources: " + resDir + " / " + + compInfo.applicationScale); + } WeakReference<Resources> wr = mActiveResources.get(key); Resources r = wr != null ? wr.get() : null; if (r != null && r.getAssets().isUpToDate()) { - //Log.w(TAG, "Returning cached resources " + r + " " + resDir); + if (false) { + Log.w(TAG, "Returning cached resources " + r + " " + resDir + + ": appScale=" + r.getCompatibilityInfo().applicationScale); + } return r; } @@ -198,7 +204,11 @@ public final class ActivityThread { //Log.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics); DisplayMetrics metrics = getDisplayMetricsLocked(false); r = new Resources(assets, metrics, getConfiguration(), compInfo); - //Log.i(TAG, "Created app resources " + r + ": " + r.getConfiguration()); + if (false) { + Log.i(TAG, "Created app resources " + resDir + " " + r + ": " + + r.getConfiguration() + " appScale=" + + r.getCompatibilityInfo().applicationScale); + } // XXX need to remove entries when weak references go away mActiveResources.put(key, new WeakReference<Resources>(r)); return r; diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java index afb2fe9..92929ea 100644 --- a/core/java/android/app/ApplicationContext.java +++ b/core/java/android/app/ApplicationContext.java @@ -541,7 +541,10 @@ class ApplicationContext extends Context { if (fd != null) { Bitmap bm = BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor()); if (bm != null) { - return new BitmapDrawable(bm); + // For now clear the density until we figure out how + // to deal with it for wallpapers. + bm.setDensity(0); + return new BitmapDrawable(getResources(), bm); } } } catch (RemoteException e) { @@ -1949,6 +1952,15 @@ class ApplicationContext extends Context { try { Resources r = getResourcesForApplication(appInfo); dr = r.getDrawable(resid); + if (false) { + RuntimeException e = new RuntimeException("here"); + e.fillInStackTrace(); + Log.w(TAG, "Getting drawable 0x" + Integer.toHexString(resid) + + " from package " + packageName + + ": app scale=" + r.getCompatibilityInfo().applicationScale + + ", caller scale=" + mContext.getResources().getCompatibilityInfo().applicationScale, + e); + } if (DEBUG_ICONS) Log.v(TAG, "Getting drawable 0x" + Integer.toHexString(resid) + " from " + r + ": " + dr); @@ -2036,10 +2048,9 @@ class ApplicationContext extends Context { if (app.packageName.equals("system")) { return mContext.mMainThread.getSystemContext().getResources(); } - ActivityThread.PackageInfo pi = mContext.mMainThread.getPackageInfoNoCheck(app); Resources r = mContext.mMainThread.getTopLevelResources( app.uid == Process.myUid() ? app.sourceDir - : app.publicSourceDir, pi); + : app.publicSourceDir, mContext.mPackageInfo); if (r != null) { return r; } diff --git a/core/java/android/app/LauncherActivity.java b/core/java/android/app/LauncherActivity.java index accdda9..d788c43 100644 --- a/core/java/android/app/LauncherActivity.java +++ b/core/java/android/app/LauncherActivity.java @@ -297,7 +297,7 @@ public abstract class LauncherActivity extends ListActivity { icon.setBounds(x, y, x + width, y + height); icon.draw(canvas); icon.setBounds(mOldBounds); - icon = new BitmapDrawable(thumb); + icon = new BitmapDrawable(getResources(), thumb); } else if (iconWidth < width && iconHeight < height) { final Bitmap.Config c = Bitmap.Config.ARGB_8888; final Bitmap thumb = Bitmap.createBitmap(mIconWidth, mIconHeight, c); @@ -309,7 +309,7 @@ public abstract class LauncherActivity extends ListActivity { icon.setBounds(x, y, x + iconWidth, y + iconHeight); icon.draw(canvas); icon.setBounds(mOldBounds); - icon = new BitmapDrawable(thumb); + icon = new BitmapDrawable(getResources(), thumb); } } |