Merge "Check app targetSdkVersion when check minWidth/Height for multi window" into sc-v2-dev
This commit is contained in:
@@ -22,6 +22,7 @@ import android.app.Activity;
|
|||||||
import android.app.compat.CompatChanges;
|
import android.app.compat.CompatChanges;
|
||||||
import android.compat.annotation.ChangeId;
|
import android.compat.annotation.ChangeId;
|
||||||
import android.compat.annotation.Disabled;
|
import android.compat.annotation.Disabled;
|
||||||
|
import android.compat.annotation.EnabledSince;
|
||||||
import android.compat.annotation.Overridable;
|
import android.compat.annotation.Overridable;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@@ -1040,6 +1041,14 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
|
|||||||
@TestApi
|
@TestApi
|
||||||
public static final float OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE = 16 / 9f;
|
public static final float OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE = 16 / 9f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares activity window layout min width/height with require space for multi window to
|
||||||
|
* determine if it can be put into multi window mode.
|
||||||
|
*/
|
||||||
|
@ChangeId
|
||||||
|
@EnabledSince(targetSdkVersion = Build.VERSION_CODES.S)
|
||||||
|
private static final long CHECK_MIN_WIDTH_HEIGHT_FOR_MULTI_WINDOW = 197654537L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert Java change bits to native.
|
* Convert Java change bits to native.
|
||||||
*
|
*
|
||||||
@@ -1480,6 +1489,17 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we should compare activity window layout min width/height with require space for
|
||||||
|
* multi window to determine if it can be put into multi window mode.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean shouldCheckMinWidthHeightForMultiWindow() {
|
||||||
|
return CompatChanges.isChangeEnabled(CHECK_MIN_WIDTH_HEIGHT_FOR_MULTI_WINDOW,
|
||||||
|
applicationInfo.packageName,
|
||||||
|
UserHandle.getUserHandleForUid(applicationInfo.uid));
|
||||||
|
}
|
||||||
|
|
||||||
public void dump(Printer pw, String prefix) {
|
public void dump(Printer pw, String prefix) {
|
||||||
dump(pw, prefix, DUMP_FLAG_ALL);
|
dump(pw, prefix, DUMP_FLAG_ALL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2801,7 +2801,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
final ActivityInfo.WindowLayout windowLayout = info.windowLayout;
|
final ActivityInfo.WindowLayout windowLayout = info.windowLayout;
|
||||||
return windowLayout == null
|
return windowLayout == null
|
||||||
|| tda.supportsActivityMinWidthHeightMultiWindow(windowLayout.minWidth,
|
|| tda.supportsActivityMinWidthHeightMultiWindow(windowLayout.minWidth,
|
||||||
windowLayout.minHeight);
|
windowLayout.minHeight, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import android.annotation.ColorInt;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.WindowConfiguration;
|
import android.app.WindowConfiguration;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.util.IntArray;
|
import android.util.IntArray;
|
||||||
@@ -1705,13 +1706,17 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
|||||||
* Whether we can show activity requesting the given min width/height in multi window below
|
* Whether we can show activity requesting the given min width/height in multi window below
|
||||||
* this {@link TaskDisplayArea}.
|
* this {@link TaskDisplayArea}.
|
||||||
*/
|
*/
|
||||||
boolean supportsActivityMinWidthHeightMultiWindow(int minWidth, int minHeight) {
|
boolean supportsActivityMinWidthHeightMultiWindow(int minWidth, int minHeight,
|
||||||
final int configRespectsActivityMinWidthHeightMultiWindow =
|
@Nullable ActivityInfo activityInfo) {
|
||||||
mAtmService.mRespectsActivityMinWidthHeightMultiWindow;
|
if (activityInfo != null && !activityInfo.shouldCheckMinWidthHeightForMultiWindow()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (minWidth <= 0 && minHeight <= 0) {
|
if (minWidth <= 0 && minHeight <= 0) {
|
||||||
// No request min width/height.
|
// No request min width/height.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
final int configRespectsActivityMinWidthHeightMultiWindow =
|
||||||
|
mAtmService.mRespectsActivityMinWidthHeightMultiWindow;
|
||||||
if (configRespectsActivityMinWidthHeightMultiWindow == -1) {
|
if (configRespectsActivityMinWidthHeightMultiWindow == -1) {
|
||||||
// Device override to ignore min width/height.
|
// Device override to ignore min width/height.
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1772,7 +1772,9 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tda.supportsActivityMinWidthHeightMultiWindow(mMinWidth, mMinHeight);
|
final ActivityRecord rootActivity = getTask().getRootActivity();
|
||||||
|
return tda.supportsActivityMinWidthHeightMultiWindow(mMinWidth, mMinHeight,
|
||||||
|
rootActivity != null ? rootActivity.info : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getTaskId() {
|
private int getTaskId() {
|
||||||
|
|||||||
Reference in New Issue
Block a user