android 11系统源码在compatibilityinfo.java判断当前是否返回桌面方法
时间: 2023-07-16 20:15:35 浏览: 114
Android 11系统源码中判断当前是否返回桌面的方法是在CompatibilityInfo.java中的isScalingRequired方法中实现的。具体代码如下:
```java
public boolean isScalingRequired() {
// If the device is capable of running apps in screen zoom mode, we need to ensure
// compatibility by scaling non-resizable apps if they request a density that doesn't match
// the display's density.
// Note: We only perform this scaling for non-resizable apps because resizable apps are
// required to handle configuration changes and support multiple densities natively.
final boolean isScreenZoomEnabled = Settings.System.getInt(
mContext.getContentResolver(), SCREEN_ZOOM_SETTING, 0 /* default */) != 0;
final boolean isAppResizable = ActivityTaskManager.supportsMultiWindow(mContext)
&& mDisplayInfo.isFixedRotationAllowed();
return isScreenZoomEnabled && !isAppResizable && !mSupportsScreen;
}
```
该方法主要用于判断当前设备是否开启了屏幕缩放模式(Screen Zoom),如果开启则需要对非可调整大小应用进行缩放以确保兼容性。如果应用程序支持多窗口和旋转,则不需要进行缩放。
阅读全文