Loading core/java/android/app/ContextImpl.java +7 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.content.res.CompatibilityInfo; import android.content.res.Resources; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; Loading Loading @@ -78,6 +79,7 @@ import android.content.ClipboardManager; import android.util.AndroidRuntimeException; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.Display; import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityManager; import android.view.inputmethod.InputMethodManager; Loading Loading @@ -423,7 +425,11 @@ class ContextImpl extends Context { registerService(WINDOW_SERVICE, new ServiceFetcher() { public Object getService(ContextImpl ctx) { return WindowManagerImpl.getDefault(); RuntimeException e = new RuntimeException("foo"); e.fillInStackTrace(); Log.i(TAG, "Getting window manager", e); CompatibilityInfo ci = ctx.mResources.getCompatibilityInfo(); return WindowManagerImpl.getDefault(ci); }}); } Loading core/java/android/app/Instrumentation.java +1 −1 Original line number Diff line number Diff line Loading @@ -1045,7 +1045,7 @@ public class Instrumentation { } } activity.onCreate(icicle); activity.performCreate(icicle); if (mActivityMonitors != null) { synchronized (mSync) { Loading core/java/android/content/res/CompatibilityInfo.java +11 −8 Original line number Diff line number Diff line Loading @@ -125,14 +125,16 @@ public class CompatibilityInfo implements Parcelable { if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) { compatFlags |= XLARGE_SCREENS | EXPANDABLE; } if (!forceCompat) { if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) { compatFlags |= EXPANDABLE; } if (forceCompat) { // If we are forcing compatibility mode, then ignore an app that // just says it is resizable for screens. We'll only have it fill // the screen if it explicitly says it supports the screen size we // are running in. if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) { compatFlags |= EXPANDABLE; } compatFlags &= ~EXPANDABLE; } boolean supportsScreen = false; Loading @@ -155,12 +157,10 @@ public class CompatibilityInfo implements Parcelable { break; } if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) == 0) { if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) != 0) { if ((compatFlags&EXPANDABLE) != 0) { supportsScreen = true; } if ((compatFlags&EXPANDABLE) == 0 && (appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) == 0) { } else if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) == 0) { compatFlags |= ALWAYS_COMPAT; } } Loading Loading @@ -382,6 +382,9 @@ public class CompatibilityInfo implements Parcelable { // This is a larger screen device and the app is not // compatible with large screens, so diddle it. CompatibilityInfo.updateCompatibleScreenFrame(inoutDm, null, inoutDm); } else { inoutDm.widthPixels = inoutDm.realWidthPixels; inoutDm.heightPixels = inoutDm.realHeightPixels; } if (isScalingRequired()) { Loading core/java/android/content/res/Configuration.java +3 −2 Original line number Diff line number Diff line Loading @@ -316,10 +316,11 @@ public final class Configuration implements Parcelable, Comparable<Configuration StringBuilder sb = new StringBuilder(128); sb.append("{"); sb.append(fontScale); sb.append("x imsi="); sb.append(" "); sb.append(mcc); sb.append("/"); sb.append("mcc"); sb.append(mnc); sb.append("mnc"); if (locale != null) { sb.append(" "); sb.append(locale); Loading core/java/android/content/res/Resources.java +9 −19 Original line number Diff line number Diff line Loading @@ -115,7 +115,6 @@ public class Resources { private NativePluralRules mPluralRule; private CompatibilityInfo mCompatibilityInfo; private Display mDefaultDisplay; private static final LongSparseArray<Object> EMPTY_ARRAY = new LongSparseArray<Object>(0) { @Override Loading Loading @@ -1426,6 +1425,15 @@ public class Resources { } if (metrics != null) { mMetrics.setTo(metrics); // NOTE: We should re-arrange this code to create a Display // with the CompatibilityInfo that is used everywhere we deal // with the display in relation to this app, rather than // doing the conversion here. This impl should be okay because // we make sure to return a compatible display in the places // where there are public APIs to retrieve the display... but // it would be cleaner and more maintainble to just be // consistently dealing with a compatible display everywhere in // the framework. mCompatibilityInfo.applyToDisplayMetrics(mMetrics); } mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale; Loading Loading @@ -2121,24 +2129,6 @@ public class Resources { + Integer.toHexString(id)); } /** * Returns the display adjusted for the Resources' metrics. * @hide */ public Display getDefaultDisplay(Display defaultDisplay) { if (mDefaultDisplay == null) { if (!mCompatibilityInfo.isScalingRequired() && mCompatibilityInfo.supportsScreen()) { // the app supports the display. just use the default one. mDefaultDisplay = defaultDisplay; } else { // display needs adjustment. mDefaultDisplay = Display.createMetricsBasedDisplay( defaultDisplay.getDisplayId(), mMetrics); } } return mDefaultDisplay; } private TypedArray getCachedStyledAttributes(int len) { synchronized (mTmpValue) { TypedArray attrs = mCachedStyledAttributes; Loading Loading
core/java/android/app/ContextImpl.java +7 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.content.res.CompatibilityInfo; import android.content.res.Resources; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; Loading Loading @@ -78,6 +79,7 @@ import android.content.ClipboardManager; import android.util.AndroidRuntimeException; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.Display; import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityManager; import android.view.inputmethod.InputMethodManager; Loading Loading @@ -423,7 +425,11 @@ class ContextImpl extends Context { registerService(WINDOW_SERVICE, new ServiceFetcher() { public Object getService(ContextImpl ctx) { return WindowManagerImpl.getDefault(); RuntimeException e = new RuntimeException("foo"); e.fillInStackTrace(); Log.i(TAG, "Getting window manager", e); CompatibilityInfo ci = ctx.mResources.getCompatibilityInfo(); return WindowManagerImpl.getDefault(ci); }}); } Loading
core/java/android/app/Instrumentation.java +1 −1 Original line number Diff line number Diff line Loading @@ -1045,7 +1045,7 @@ public class Instrumentation { } } activity.onCreate(icicle); activity.performCreate(icicle); if (mActivityMonitors != null) { synchronized (mSync) { Loading
core/java/android/content/res/CompatibilityInfo.java +11 −8 Original line number Diff line number Diff line Loading @@ -125,14 +125,16 @@ public class CompatibilityInfo implements Parcelable { if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) { compatFlags |= XLARGE_SCREENS | EXPANDABLE; } if (!forceCompat) { if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) { compatFlags |= EXPANDABLE; } if (forceCompat) { // If we are forcing compatibility mode, then ignore an app that // just says it is resizable for screens. We'll only have it fill // the screen if it explicitly says it supports the screen size we // are running in. if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) { compatFlags |= EXPANDABLE; } compatFlags &= ~EXPANDABLE; } boolean supportsScreen = false; Loading @@ -155,12 +157,10 @@ public class CompatibilityInfo implements Parcelable { break; } if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) == 0) { if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) != 0) { if ((compatFlags&EXPANDABLE) != 0) { supportsScreen = true; } if ((compatFlags&EXPANDABLE) == 0 && (appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) == 0) { } else if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) == 0) { compatFlags |= ALWAYS_COMPAT; } } Loading Loading @@ -382,6 +382,9 @@ public class CompatibilityInfo implements Parcelable { // This is a larger screen device and the app is not // compatible with large screens, so diddle it. CompatibilityInfo.updateCompatibleScreenFrame(inoutDm, null, inoutDm); } else { inoutDm.widthPixels = inoutDm.realWidthPixels; inoutDm.heightPixels = inoutDm.realHeightPixels; } if (isScalingRequired()) { Loading
core/java/android/content/res/Configuration.java +3 −2 Original line number Diff line number Diff line Loading @@ -316,10 +316,11 @@ public final class Configuration implements Parcelable, Comparable<Configuration StringBuilder sb = new StringBuilder(128); sb.append("{"); sb.append(fontScale); sb.append("x imsi="); sb.append(" "); sb.append(mcc); sb.append("/"); sb.append("mcc"); sb.append(mnc); sb.append("mnc"); if (locale != null) { sb.append(" "); sb.append(locale); Loading
core/java/android/content/res/Resources.java +9 −19 Original line number Diff line number Diff line Loading @@ -115,7 +115,6 @@ public class Resources { private NativePluralRules mPluralRule; private CompatibilityInfo mCompatibilityInfo; private Display mDefaultDisplay; private static final LongSparseArray<Object> EMPTY_ARRAY = new LongSparseArray<Object>(0) { @Override Loading Loading @@ -1426,6 +1425,15 @@ public class Resources { } if (metrics != null) { mMetrics.setTo(metrics); // NOTE: We should re-arrange this code to create a Display // with the CompatibilityInfo that is used everywhere we deal // with the display in relation to this app, rather than // doing the conversion here. This impl should be okay because // we make sure to return a compatible display in the places // where there are public APIs to retrieve the display... but // it would be cleaner and more maintainble to just be // consistently dealing with a compatible display everywhere in // the framework. mCompatibilityInfo.applyToDisplayMetrics(mMetrics); } mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale; Loading Loading @@ -2121,24 +2129,6 @@ public class Resources { + Integer.toHexString(id)); } /** * Returns the display adjusted for the Resources' metrics. * @hide */ public Display getDefaultDisplay(Display defaultDisplay) { if (mDefaultDisplay == null) { if (!mCompatibilityInfo.isScalingRequired() && mCompatibilityInfo.supportsScreen()) { // the app supports the display. just use the default one. mDefaultDisplay = defaultDisplay; } else { // display needs adjustment. mDefaultDisplay = Display.createMetricsBasedDisplay( defaultDisplay.getDisplayId(), mMetrics); } } return mDefaultDisplay; } private TypedArray getCachedStyledAttributes(int len) { synchronized (mTmpValue) { TypedArray attrs = mCachedStyledAttributes; Loading