Merge "resolved conflicts for merge of 5c2e4d20 to master"
This commit is contained in:
committed by
Android (Google) Code Review
commit
98c6870e0e
@@ -179,9 +179,9 @@ package android {
|
||||
public static final class R.attr {
|
||||
ctor public R.attr();
|
||||
field public static final int absListViewStyle = 16842858; // 0x101006a
|
||||
field public static final int accessibilityEventTypes = 16843643; // 0x101037b
|
||||
field public static final int accessibilityFeedbackType = 16843645; // 0x101037d
|
||||
field public static final int accessibilityFlags = 16843647; // 0x101037f
|
||||
field public static final int accessibilityEventTypes = 16843645; // 0x101037d
|
||||
field public static final int accessibilityFeedbackType = 16843647; // 0x101037f
|
||||
field public static final int accessibilityFlags = 16843649; // 0x1010381
|
||||
field public static final int accountPreferences = 16843423; // 0x101029f
|
||||
field public static final int accountType = 16843407; // 0x101028f
|
||||
field public static final int action = 16842797; // 0x101002d
|
||||
@@ -201,7 +201,7 @@ package android {
|
||||
field public static final int actionModeCopyDrawable = 16843538; // 0x1010312
|
||||
field public static final int actionModeCutDrawable = 16843537; // 0x1010311
|
||||
field public static final int actionModePasteDrawable = 16843539; // 0x1010313
|
||||
field public static final int actionModeSelectAllDrawable = 16843641; // 0x1010379
|
||||
field public static final int actionModeSelectAllDrawable = 16843643; // 0x101037b
|
||||
field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6
|
||||
field public static final int actionViewClass = 16843516; // 0x10102fc
|
||||
field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
|
||||
@@ -273,7 +273,7 @@ package android {
|
||||
field public static final int cacheColorHint = 16843009; // 0x1010101
|
||||
field public static final int calendarViewShown = 16843596; // 0x101034c
|
||||
field public static final int calendarViewStyle = 16843613; // 0x101035d
|
||||
field public static final int canRetrieveWindowContent = 16843648; // 0x1010380
|
||||
field public static final int canRetrieveWindowContent = 16843650; // 0x1010382
|
||||
field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
|
||||
field public static final deprecated int capitalize = 16843113; // 0x1010169
|
||||
field public static final int centerBright = 16842956; // 0x10100cc
|
||||
@@ -306,10 +306,11 @@ package android {
|
||||
field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
|
||||
field public static final int colorForeground = 16842800; // 0x1010030
|
||||
field public static final int colorForegroundInverse = 16843270; // 0x1010206
|
||||
field public static final int columnCount = 16843633; // 0x1010371
|
||||
field public static final int columnCount = 16843635; // 0x1010373
|
||||
field public static final int columnDelay = 16843215; // 0x10101cf
|
||||
field public static final int columnOrderPreserved = 16843634; // 0x1010372
|
||||
field public static final int columnOrderPreserved = 16843636; // 0x1010374
|
||||
field public static final int columnWidth = 16843031; // 0x1010117
|
||||
field public static final int compatibleWidthLimitDp = 16843621; // 0x1010365
|
||||
field public static final int completionHint = 16843122; // 0x1010172
|
||||
field public static final int completionHintView = 16843123; // 0x1010173
|
||||
field public static final int completionThreshold = 16843124; // 0x1010174
|
||||
@@ -452,7 +453,7 @@ package android {
|
||||
field public static final int fromXScale = 16843202; // 0x10101c2
|
||||
field public static final int fromYDelta = 16843208; // 0x10101c8
|
||||
field public static final int fromYScale = 16843204; // 0x10101c4
|
||||
field public static final int fullBackupAgent = 16843629; // 0x101036d
|
||||
field public static final int fullBackupAgent = 16843631; // 0x101036f
|
||||
field public static final int fullBright = 16842954; // 0x10100ca
|
||||
field public static final int fullDark = 16842950; // 0x10100c6
|
||||
field public static final int functionalTest = 16842787; // 0x1010023
|
||||
@@ -483,7 +484,7 @@ package android {
|
||||
field public static final int hint = 16843088; // 0x1010150
|
||||
field public static final int homeAsUpIndicator = 16843531; // 0x101030b
|
||||
field public static final int homeLayout = 16843549; // 0x101031d
|
||||
field public static final int horizontalDirection = 16843628; // 0x101036c
|
||||
field public static final int horizontalDirection = 16843630; // 0x101036e
|
||||
field public static final int horizontalDivider = 16843053; // 0x101012d
|
||||
field public static final int horizontalGap = 16843327; // 0x101023f
|
||||
field public static final int horizontalScrollViewStyle = 16843603; // 0x1010353
|
||||
@@ -531,7 +532,7 @@ package android {
|
||||
field public static final int installLocation = 16843447; // 0x10102b7
|
||||
field public static final int interpolator = 16843073; // 0x1010141
|
||||
field public static final int isAlwaysSyncable = 16843571; // 0x1010333
|
||||
field public static final int isAuxiliary = 16843642; // 0x101037a
|
||||
field public static final int isAuxiliary = 16843644; // 0x101037c
|
||||
field public static final int isDefault = 16843297; // 0x1010221
|
||||
field public static final int isIndicator = 16843079; // 0x1010147
|
||||
field public static final int isModifier = 16843334; // 0x1010246
|
||||
@@ -583,8 +584,8 @@ package android {
|
||||
field public static final int layout_centerInParent = 16843151; // 0x101018f
|
||||
field public static final int layout_centerVertical = 16843153; // 0x1010191
|
||||
field public static final int layout_column = 16843084; // 0x101014c
|
||||
field public static final int layout_columnSpan = 16843639; // 0x1010377
|
||||
field public static final int layout_columnWeight = 16843640; // 0x1010378
|
||||
field public static final int layout_columnSpan = 16843641; // 0x1010379
|
||||
field public static final int layout_columnWeight = 16843642; // 0x101037a
|
||||
field public static final int layout_gravity = 16842931; // 0x10100b3
|
||||
field public static final int layout_height = 16842997; // 0x10100f5
|
||||
field public static final int layout_margin = 16842998; // 0x10100f6
|
||||
@@ -592,9 +593,9 @@ package android {
|
||||
field public static final int layout_marginLeft = 16842999; // 0x10100f7
|
||||
field public static final int layout_marginRight = 16843001; // 0x10100f9
|
||||
field public static final int layout_marginTop = 16843000; // 0x10100f8
|
||||
field public static final int layout_row = 16843636; // 0x1010374
|
||||
field public static final int layout_rowSpan = 16843637; // 0x1010375
|
||||
field public static final int layout_rowWeight = 16843638; // 0x1010376
|
||||
field public static final int layout_row = 16843638; // 0x1010376
|
||||
field public static final int layout_rowSpan = 16843639; // 0x1010377
|
||||
field public static final int layout_rowWeight = 16843640; // 0x1010378
|
||||
field public static final int layout_scale = 16843155; // 0x1010193
|
||||
field public static final int layout_span = 16843085; // 0x101014d
|
||||
field public static final int layout_toLeftOf = 16843138; // 0x1010182
|
||||
@@ -660,7 +661,7 @@ package android {
|
||||
field public static final int nextFocusUp = 16842979; // 0x10100e3
|
||||
field public static final int noHistory = 16843309; // 0x101022d
|
||||
field public static final int normalScreens = 16843397; // 0x1010285
|
||||
field public static final int notificationTimeout = 16843646; // 0x101037e
|
||||
field public static final int notificationTimeout = 16843648; // 0x1010380
|
||||
field public static final int numColumns = 16843032; // 0x1010118
|
||||
field public static final int numStars = 16843076; // 0x1010144
|
||||
field public static final deprecated int numeric = 16843109; // 0x1010165
|
||||
@@ -677,7 +678,7 @@ package android {
|
||||
field public static final int overScrollFooter = 16843459; // 0x10102c3
|
||||
field public static final int overScrollHeader = 16843458; // 0x10102c2
|
||||
field public static final int overScrollMode = 16843457; // 0x10102c1
|
||||
field public static final int packageNames = 16843644; // 0x101037c
|
||||
field public static final int packageNames = 16843646; // 0x101037e
|
||||
field public static final int padding = 16842965; // 0x10100d5
|
||||
field public static final int paddingBottom = 16842969; // 0x10100d9
|
||||
field public static final int paddingLeft = 16842966; // 0x10100d6
|
||||
@@ -755,6 +756,7 @@ package android {
|
||||
field public static final int reqNavigation = 16843306; // 0x101022a
|
||||
field public static final int reqTouchScreen = 16843303; // 0x1010227
|
||||
field public static final int required = 16843406; // 0x101028e
|
||||
field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
|
||||
field public static final int resizeMode = 16843619; // 0x1010363
|
||||
field public static final int resizeable = 16843405; // 0x101028d
|
||||
field public static final int resource = 16842789; // 0x1010025
|
||||
@@ -766,11 +768,11 @@ package android {
|
||||
field public static final int rotation = 16843558; // 0x1010326
|
||||
field public static final int rotationX = 16843559; // 0x1010327
|
||||
field public static final int rotationY = 16843560; // 0x1010328
|
||||
field public static final int rowCount = 16843631; // 0x101036f
|
||||
field public static final int rowCount = 16843633; // 0x1010371
|
||||
field public static final int rowDelay = 16843216; // 0x10101d0
|
||||
field public static final int rowEdgeFlags = 16843329; // 0x1010241
|
||||
field public static final int rowHeight = 16843058; // 0x1010132
|
||||
field public static final int rowOrderPreserved = 16843632; // 0x1010370
|
||||
field public static final int rowOrderPreserved = 16843634; // 0x1010372
|
||||
field public static final int saveEnabled = 16842983; // 0x10100e7
|
||||
field public static final int scaleGravity = 16843262; // 0x10101fe
|
||||
field public static final int scaleHeight = 16843261; // 0x10101fd
|
||||
@@ -857,14 +859,14 @@ package android {
|
||||
field public static final int state_active = 16842914; // 0x10100a2
|
||||
field public static final int state_checkable = 16842911; // 0x101009f
|
||||
field public static final int state_checked = 16842912; // 0x10100a0
|
||||
field public static final int state_drag_can_accept = 16843621; // 0x1010365
|
||||
field public static final int state_drag_hovered = 16843622; // 0x1010366
|
||||
field public static final int state_drag_can_accept = 16843623; // 0x1010367
|
||||
field public static final int state_drag_hovered = 16843624; // 0x1010368
|
||||
field public static final int state_empty = 16842921; // 0x10100a9
|
||||
field public static final int state_enabled = 16842910; // 0x101009e
|
||||
field public static final int state_expanded = 16842920; // 0x10100a8
|
||||
field public static final int state_first = 16842916; // 0x10100a4
|
||||
field public static final int state_focused = 16842908; // 0x101009c
|
||||
field public static final int state_hovered = 16843620; // 0x1010364
|
||||
field public static final int state_hovered = 16843622; // 0x1010366
|
||||
field public static final int state_last = 16842918; // 0x10100a6
|
||||
field public static final int state_long_pressable = 16843324; // 0x101023c
|
||||
field public static final int state_middle = 16842917; // 0x10100a5
|
||||
@@ -875,7 +877,7 @@ package android {
|
||||
field public static final int state_window_focused = 16842909; // 0x101009d
|
||||
field public static final int staticWallpaperPreview = 16843569; // 0x1010331
|
||||
field public static final int stepSize = 16843078; // 0x1010146
|
||||
field public static final int stopWithTask = 16843623; // 0x1010367
|
||||
field public static final int stopWithTask = 16843625; // 0x1010369
|
||||
field public static final int streamType = 16843273; // 0x1010209
|
||||
field public static final int stretchColumns = 16843081; // 0x1010149
|
||||
field public static final int stretchMode = 16843030; // 0x1010116
|
||||
@@ -883,7 +885,7 @@ package android {
|
||||
field public static final int subtitleTextStyle = 16843513; // 0x10102f9
|
||||
field public static final int suggestActionMsg = 16843228; // 0x10101dc
|
||||
field public static final int suggestActionMsgColumn = 16843229; // 0x10101dd
|
||||
field public static final int suggestionsEnabled = 16843630; // 0x101036e
|
||||
field public static final int suggestionsEnabled = 16843632; // 0x1010370
|
||||
field public static final int summary = 16843241; // 0x10101e9
|
||||
field public static final int summaryColumn = 16843426; // 0x10102a2
|
||||
field public static final int summaryOff = 16843248; // 0x10101f0
|
||||
@@ -951,9 +953,9 @@ package android {
|
||||
field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314
|
||||
field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f
|
||||
field public static final int textEditSidePasteWindowLayout = 16843614; // 0x101035e
|
||||
field public static final int textEditSuggestionItemLayout = 16843627; // 0x101036b
|
||||
field public static final int textEditSuggestionsBottomWindowLayout = 16843625; // 0x1010369
|
||||
field public static final int textEditSuggestionsTopWindowLayout = 16843626; // 0x101036a
|
||||
field public static final int textEditSuggestionItemLayout = 16843629; // 0x101036d
|
||||
field public static final int textEditSuggestionsBottomWindowLayout = 16843627; // 0x101036b
|
||||
field public static final int textEditSuggestionsTopWindowLayout = 16843628; // 0x101036c
|
||||
field public static final int textFilterEnabled = 16843007; // 0x10100ff
|
||||
field public static final int textIsSelectable = 16843542; // 0x1010316
|
||||
field public static final int textOff = 16843045; // 0x1010125
|
||||
@@ -965,7 +967,7 @@ package android {
|
||||
field public static final int textSelectHandleWindowStyle = 16843464; // 0x10102c8
|
||||
field public static final int textSize = 16842901; // 0x1010095
|
||||
field public static final int textStyle = 16842903; // 0x1010097
|
||||
field public static final int textSuggestionsWindowStyle = 16843624; // 0x1010368
|
||||
field public static final int textSuggestionsWindowStyle = 16843626; // 0x101036a
|
||||
field public static final int textViewStyle = 16842884; // 0x1010084
|
||||
field public static final int theme = 16842752; // 0x1010000
|
||||
field public static final int thickness = 16843360; // 0x1010260
|
||||
@@ -1001,7 +1003,7 @@ package android {
|
||||
field public static final int unfocusedMonthDateColor = 16843588; // 0x1010344
|
||||
field public static final int unselectedAlpha = 16843278; // 0x101020e
|
||||
field public static final int updatePeriodMillis = 16843344; // 0x1010250
|
||||
field public static final int useDefaultMargins = 16843635; // 0x1010373
|
||||
field public static final int useDefaultMargins = 16843637; // 0x1010375
|
||||
field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310
|
||||
field public static final int useLevel = 16843167; // 0x101019f
|
||||
field public static final int userVisible = 16843409; // 0x1010291
|
||||
@@ -5500,6 +5502,7 @@ package android.content.pm {
|
||||
field public static final int FLAG_VM_SAFE_MODE = 16384; // 0x4000
|
||||
field public java.lang.String backupAgentName;
|
||||
field public java.lang.String className;
|
||||
field public int compatibleWidthLimitDp;
|
||||
field public java.lang.String dataDir;
|
||||
field public int descriptionRes;
|
||||
field public boolean enabled;
|
||||
@@ -5509,6 +5512,7 @@ package android.content.pm {
|
||||
field public java.lang.String permission;
|
||||
field public java.lang.String processName;
|
||||
field public java.lang.String publicSourceDir;
|
||||
field public int requiresSmallestWidthDp;
|
||||
field public java.lang.String[] sharedLibraryFiles;
|
||||
field public java.lang.String sourceDir;
|
||||
field public int targetSdkVersion;
|
||||
|
||||
@@ -1534,7 +1534,7 @@ public final class ActivityThread {
|
||||
synchronized (this) {
|
||||
ContextImpl context = getSystemContext();
|
||||
context.init(new LoadedApk(this, "android", context, info,
|
||||
new CompatibilityInfo(info, 0, false)), null, this);
|
||||
new CompatibilityInfo(info, 0, 0, false)), null, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -329,6 +329,22 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
*/
|
||||
public int flags = 0;
|
||||
|
||||
/**
|
||||
* The required smallest screen width the application can run on. If 0,
|
||||
* nothing has been specified. Comes from
|
||||
* {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
|
||||
* android:requiresSmallestWidthDp} attribute of the <supports-screens> tag.
|
||||
*/
|
||||
public int requiresSmallestWidthDp = 0;
|
||||
|
||||
/**
|
||||
* The maximum smallest screen width the application is designed for. If 0,
|
||||
* nothing has been specified. Comes from
|
||||
* {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
|
||||
* android:compatibleWidthLimitDp} attribute of the <supports-screens> tag.
|
||||
*/
|
||||
public int compatibleWidthLimitDp = 0;
|
||||
|
||||
/**
|
||||
* Full path to the location of this package.
|
||||
*/
|
||||
@@ -410,6 +426,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
pw.println(prefix + "taskAffinity=" + taskAffinity);
|
||||
pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
|
||||
+ " theme=0x" + Integer.toHexString(theme));
|
||||
pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
|
||||
+ " compatibleWidthLimitDp=" + compatibleWidthLimitDp);
|
||||
pw.println(prefix + "sourceDir=" + sourceDir);
|
||||
if (sourceDir == null) {
|
||||
if (publicSourceDir != null) {
|
||||
@@ -469,6 +487,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
className = orig.className;
|
||||
theme = orig.theme;
|
||||
flags = orig.flags;
|
||||
requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
|
||||
compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
|
||||
sourceDir = orig.sourceDir;
|
||||
publicSourceDir = orig.publicSourceDir;
|
||||
nativeLibraryDir = orig.nativeLibraryDir;
|
||||
@@ -502,6 +522,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
dest.writeString(className);
|
||||
dest.writeInt(theme);
|
||||
dest.writeInt(flags);
|
||||
dest.writeInt(requiresSmallestWidthDp);
|
||||
dest.writeInt(compatibleWidthLimitDp);
|
||||
dest.writeString(sourceDir);
|
||||
dest.writeString(publicSourceDir);
|
||||
dest.writeString(nativeLibraryDir);
|
||||
@@ -536,6 +558,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
className = source.readString();
|
||||
theme = source.readInt();
|
||||
flags = source.readInt();
|
||||
requiresSmallestWidthDp = source.readInt();
|
||||
compatibleWidthLimitDp = source.readInt();
|
||||
sourceDir = source.readString();
|
||||
publicSourceDir = source.readString();
|
||||
nativeLibraryDir = source.readString();
|
||||
|
||||
@@ -993,6 +993,13 @@ public class PackageParser {
|
||||
sa = res.obtainAttributes(attrs,
|
||||
com.android.internal.R.styleable.AndroidManifestSupportsScreens);
|
||||
|
||||
pkg.applicationInfo.requiresSmallestWidthDp = sa.getInteger(
|
||||
com.android.internal.R.styleable.AndroidManifestSupportsScreens_requiresSmallestWidthDp,
|
||||
0);
|
||||
pkg.applicationInfo.compatibleWidthLimitDp = sa.getInteger(
|
||||
com.android.internal.R.styleable.AndroidManifestSupportsScreens_compatibleWidthLimitDp,
|
||||
0);
|
||||
|
||||
// This is a trick to get a boolean and still able to detect
|
||||
// if a value was actually set.
|
||||
supportsSmallScreens = sa.getInteger(
|
||||
|
||||
@@ -110,86 +110,112 @@ public class CompatibilityInfo implements Parcelable {
|
||||
*/
|
||||
public final float applicationInvertedScale;
|
||||
|
||||
public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, boolean forceCompat) {
|
||||
public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, int sw,
|
||||
boolean forceCompat) {
|
||||
int compatFlags = 0;
|
||||
|
||||
// We can't rely on the application always setting
|
||||
// FLAG_RESIZEABLE_FOR_SCREENS so will compute it based on various input.
|
||||
boolean anyResizeable = false;
|
||||
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
|
||||
compatFlags |= LARGE_SCREENS;
|
||||
anyResizeable = true;
|
||||
if (!forceCompat) {
|
||||
// If we aren't forcing the app into compatibility mode, then
|
||||
// assume if it supports large screens that we should allow it
|
||||
// to use the full space of an xlarge screen as well.
|
||||
compatFlags |= XLARGE_SCREENS | EXPANDABLE;
|
||||
if (appInfo.requiresSmallestWidthDp != 0 || appInfo.compatibleWidthLimitDp != 0) {
|
||||
// New style screen requirements spec.
|
||||
int required = appInfo.requiresSmallestWidthDp != 0
|
||||
? appInfo.requiresSmallestWidthDp
|
||||
: appInfo.compatibleWidthLimitDp;
|
||||
int compat = appInfo.compatibleWidthLimitDp != 0
|
||||
? appInfo.compatibleWidthLimitDp
|
||||
: appInfo.requiresSmallestWidthDp;
|
||||
if (compat < required) {
|
||||
compat = required;
|
||||
}
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) {
|
||||
anyResizeable = true;
|
||||
if (!forceCompat) {
|
||||
compatFlags |= XLARGE_SCREENS | EXPANDABLE;
|
||||
|
||||
if (compat >= sw) {
|
||||
compatFlags |= NEVER_COMPAT;
|
||||
} else if (forceCompat) {
|
||||
compatFlags |= NEEDS_SCREEN_COMPAT;
|
||||
}
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
|
||||
anyResizeable = true;
|
||||
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.
|
||||
compatFlags &= ~EXPANDABLE;
|
||||
}
|
||||
|
||||
boolean supportsScreen = false;
|
||||
switch (screenLayout&Configuration.SCREENLAYOUT_SIZE_MASK) {
|
||||
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
|
||||
if ((compatFlags&XLARGE_SCREENS) != 0) {
|
||||
supportsScreen = true;
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) {
|
||||
compatFlags |= NEVER_COMPAT;
|
||||
}
|
||||
break;
|
||||
case Configuration.SCREENLAYOUT_SIZE_LARGE:
|
||||
if ((compatFlags&LARGE_SCREENS) != 0) {
|
||||
supportsScreen = true;
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
|
||||
compatFlags |= NEVER_COMPAT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) != 0) {
|
||||
if ((compatFlags&EXPANDABLE) != 0) {
|
||||
supportsScreen = true;
|
||||
} else if (!anyResizeable) {
|
||||
compatFlags |= ALWAYS_COMPAT;
|
||||
}
|
||||
}
|
||||
|
||||
if (supportsScreen) {
|
||||
compatFlags &= ~NEEDS_SCREEN_COMPAT;
|
||||
} else {
|
||||
compatFlags |= NEEDS_SCREEN_COMPAT;
|
||||
}
|
||||
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) != 0) {
|
||||
// Modern apps always support densities.
|
||||
applicationDensity = DisplayMetrics.DENSITY_DEVICE;
|
||||
applicationScale = 1.0f;
|
||||
applicationInvertedScale = 1.0f;
|
||||
|
||||
} else {
|
||||
applicationDensity = DisplayMetrics.DENSITY_DEFAULT;
|
||||
applicationScale = DisplayMetrics.DENSITY_DEVICE
|
||||
/ (float) DisplayMetrics.DENSITY_DEFAULT;
|
||||
applicationInvertedScale = 1.0f / applicationScale;
|
||||
compatFlags |= SCALING_REQUIRED;
|
||||
// We can't rely on the application always setting
|
||||
// FLAG_RESIZEABLE_FOR_SCREENS so will compute it based on various input.
|
||||
boolean anyResizeable = false;
|
||||
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
|
||||
compatFlags |= LARGE_SCREENS;
|
||||
anyResizeable = true;
|
||||
if (!forceCompat) {
|
||||
// If we aren't forcing the app into compatibility mode, then
|
||||
// assume if it supports large screens that we should allow it
|
||||
// to use the full space of an xlarge screen as well.
|
||||
compatFlags |= XLARGE_SCREENS | EXPANDABLE;
|
||||
}
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) {
|
||||
anyResizeable = true;
|
||||
if (!forceCompat) {
|
||||
compatFlags |= XLARGE_SCREENS | EXPANDABLE;
|
||||
}
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
|
||||
anyResizeable = true;
|
||||
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.
|
||||
compatFlags &= ~EXPANDABLE;
|
||||
}
|
||||
|
||||
boolean supportsScreen = false;
|
||||
switch (screenLayout&Configuration.SCREENLAYOUT_SIZE_MASK) {
|
||||
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
|
||||
if ((compatFlags&XLARGE_SCREENS) != 0) {
|
||||
supportsScreen = true;
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) {
|
||||
compatFlags |= NEVER_COMPAT;
|
||||
}
|
||||
break;
|
||||
case Configuration.SCREENLAYOUT_SIZE_LARGE:
|
||||
if ((compatFlags&LARGE_SCREENS) != 0) {
|
||||
supportsScreen = true;
|
||||
}
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
|
||||
compatFlags |= NEVER_COMPAT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) != 0) {
|
||||
if ((compatFlags&EXPANDABLE) != 0) {
|
||||
supportsScreen = true;
|
||||
} else if (!anyResizeable) {
|
||||
compatFlags |= ALWAYS_COMPAT;
|
||||
}
|
||||
}
|
||||
|
||||
if (supportsScreen) {
|
||||
compatFlags &= ~NEEDS_SCREEN_COMPAT;
|
||||
} else {
|
||||
compatFlags |= NEEDS_SCREEN_COMPAT;
|
||||
}
|
||||
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) != 0) {
|
||||
applicationDensity = DisplayMetrics.DENSITY_DEVICE;
|
||||
applicationScale = 1.0f;
|
||||
applicationInvertedScale = 1.0f;
|
||||
} else {
|
||||
applicationDensity = DisplayMetrics.DENSITY_DEFAULT;
|
||||
applicationScale = DisplayMetrics.DENSITY_DEVICE
|
||||
/ (float) DisplayMetrics.DENSITY_DEFAULT;
|
||||
applicationInvertedScale = 1.0f / applicationScale;
|
||||
compatFlags |= SCALING_REQUIRED;
|
||||
}
|
||||
}
|
||||
|
||||
mCompatibilityFlags = compatFlags;
|
||||
|
||||
@@ -1019,6 +1019,30 @@
|
||||
<p>This appears as a child tag of the
|
||||
{@link #AndroidManifest manifest} tag. -->
|
||||
<declare-styleable name="AndroidManifestSupportsScreens" parent="AndroidManifest">
|
||||
<!-- Starting with {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2},
|
||||
this is the new way to specify the screens an application is
|
||||
compatible with. This attribute provides the required minimum
|
||||
"smallest screen width" (as per the -swNNNdp resource configuration)
|
||||
that the application can run on. For example, a typical phone
|
||||
screen is 320, a 7" tablet 600, and a 10" tablet 720. If the
|
||||
smallest screen width of the device is below the value supplied here,
|
||||
then the application is considered incompatible with that device.
|
||||
If not supplied, then any old smallScreens, normalScreens, largeScreens,
|
||||
or xlargeScreens attributes will be used instead. -->
|
||||
<attr name="requiresSmallestWidthDp" format="integer" />
|
||||
<!-- Starting with {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2},
|
||||
this is the new way to specify the screens an application is
|
||||
compatible with. This attribute provides the maximum
|
||||
"smallest screen width" (as per the -swNNNdp resource configuration)
|
||||
that the application is designed for. If this value is smaller than
|
||||
the "smallest screen width" of the device it is running on, the user
|
||||
will of offered to run it in a compatibility mode that emulates a
|
||||
smaller screen. Currently the compatibility mode only emulates
|
||||
phone screens, so it will not be used it the application provides
|
||||
a requiresSmallestWidthDp that is larger than 320. Typical values
|
||||
used with this attribute are 320 for a phone screen, 600 for a
|
||||
7" tablet, and 720 for a 10" tablet. -->
|
||||
<attr name="compatibleWidthLimitDp" format="integer" />
|
||||
<!-- Indicates whether the application supports smaller screen form-factors.
|
||||
A small screen is defined as one with a smaller aspect ratio than
|
||||
the traditional HVGA screen; that is, for a portrait screen, less
|
||||
|
||||
@@ -1643,11 +1643,18 @@
|
||||
<public type="mipmap" name="sym_def_app_icon" id="0x010d0000" />
|
||||
|
||||
<!-- ===============================================================
|
||||
Resources added in version 12 of the platform (Honeycomb / 3.1)
|
||||
Resources added in version 12 of the platform (Honeycomb MR 1 / 3.1)
|
||||
=============================================================== -->
|
||||
<eat-comment />
|
||||
<public type="attr" name="textCursorDrawable" id="0x01010362" />
|
||||
<public type="attr" name="resizeMode" />
|
||||
<public type="attr" name="resizeMode" id="0x01010363" />
|
||||
|
||||
<!-- ===============================================================
|
||||
Resources added in version 13 of the platform (Honeycomb MR 2)
|
||||
=============================================================== -->
|
||||
<eat-comment />
|
||||
<public type="attr" name="requiresSmallestWidthDp" id="0x01010364" />
|
||||
<public type="attr" name="compatibleWidthLimitDp" />
|
||||
|
||||
<!-- ===============================================================
|
||||
Resources added in version 13 of the platform (Ice Cream Sandwich)
|
||||
@@ -1694,5 +1701,4 @@
|
||||
<public type="attr" name="notificationTimeout" />
|
||||
<public type="attr" name="accessibilityFlags" />
|
||||
<public type="attr" name="canRetrieveWindowContent" />
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -119,13 +119,15 @@ public class CompatModePackages {
|
||||
|
||||
public CompatibilityInfo compatibilityInfoForPackageLocked(ApplicationInfo ai) {
|
||||
return new CompatibilityInfo(ai, mService.mConfiguration.screenLayout,
|
||||
mService.mConfiguration.smallestScreenWidthDp,
|
||||
(getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0);
|
||||
}
|
||||
|
||||
public int computeCompatModeLocked(ApplicationInfo ai) {
|
||||
boolean enabled = (getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0;
|
||||
CompatibilityInfo info = new CompatibilityInfo(ai,
|
||||
mService.mConfiguration.screenLayout, enabled);
|
||||
mService.mConfiguration.screenLayout,
|
||||
mService.mConfiguration.smallestScreenWidthDp, enabled);
|
||||
if (info.alwaysSupportsScreen()) {
|
||||
return ActivityManager.COMPAT_MODE_NEVER;
|
||||
}
|
||||
@@ -315,6 +317,7 @@ public class CompatModePackages {
|
||||
|
||||
final IPackageManager pm = AppGlobals.getPackageManager();
|
||||
final int screenLayout = mService.mConfiguration.screenLayout;
|
||||
final int smallestScreenWidthDp = mService.mConfiguration.smallestScreenWidthDp;
|
||||
final Iterator<Map.Entry<String, Integer>> it = pkgs.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Integer> entry = it.next();
|
||||
@@ -331,7 +334,8 @@ public class CompatModePackages {
|
||||
if (ai == null) {
|
||||
continue;
|
||||
}
|
||||
CompatibilityInfo info = new CompatibilityInfo(ai, screenLayout, false);
|
||||
CompatibilityInfo info = new CompatibilityInfo(ai, screenLayout,
|
||||
smallestScreenWidthDp, false);
|
||||
if (info.alwaysSupportsScreen()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ public class DpiTestActivity extends Activity {
|
||||
| ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS
|
||||
| ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES;
|
||||
app.getResources().setCompatibilityInfo(new CompatibilityInfo(ai,
|
||||
getResources().getConfiguration().screenLayout, false));
|
||||
getResources().getConfiguration().screenLayout,
|
||||
getResources().getConfiguration().smallestScreenWidthDp, false));
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
throw new RuntimeException("ouch", e);
|
||||
|
||||
Reference in New Issue
Block a user