Android Go 低内存设备存在多种动画或者功能默认不启用
比如应用窗口化功能,
res/values-zh-rCN/strings.xml:4323:
<string msgid="3557117039415422481" name="disabled_feature_reason_slow_down_phone">"由于此功能会导致您的手机速度变慢,因此系统已关闭此功能"</string>
res/layout/manage_applications_apps_unsupported.xml:43:
android:text="@string/disabled_feature_reason_slow_down_phone"
src/com/android/settings/applications/manageapplications/ManageApplications.java:337:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (mListType == LIST_TYPE_OVERLAY && !Utils.isSystemAlertWindowEnabled(getContext())) {
mRootView = inflater.inflate(R.layout.manage_applications_apps_unsupported, null);
setHasOptionsMenu(false);
return mRootView;
}
......
查看packages/apps/Settings/src/com/android/settings/Utils.java
/**
* Returns true if SYSTEM_ALERT_WINDOW permission is available.
* Starting from Q, SYSTEM_ALERT_WINDOW is disabled on low ram phones.
*/
public static boolean isSystemAlertWindowEnabled(Context context) {
// SYSTEM_ALERT_WINDOW is disabled on on low ram devices starting from Q
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
return !(am.isLowRamDevice() && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q));
}
根据注释可知,从Android Q开始,SYSTEM_ALERT_WINDOW 系统弹窗在低内存设备时被禁止的
frameworks/base/core/java/android/app/ActivityManager.java
private static final boolean DEVELOPMENT_FORCE_LOW_RAM =
SystemProperties.getBoolean("debug.force_low_ram", false);
/**
* Returns true if this is a low-RAM device. Exactly whether a device is low-RAM
* is ultimately up to the device configuration, but currently it generally means
* something with 1GB or less of RAM. This is mostly intended to be used by apps
* to determine whether they should turn off certain features that require more RAM.
*/
public boolean isLowRamDevice() {
return isLowRamDeviceStatic();
}
/** @hide */
@UnsupportedAppUsage
public static boolean isLowRamDeviceStatic() {
return RoSystemProperties.CONFIG_LOW_RAM ||
(Build.IS_DEBUGGABLE && DEVELOPMENT_FORCE_LOW_RAM);
}
frameworks/base/core/java/com/android/internal/os/RoSystemProperties.java
public static final boolean CONFIG_LOW_RAM =
SystemProperties.getBoolean("ro.config.low_ram", false);
frameworks/base/core/java/android/os/Build.java
/**
* Returns true if we are running a debug build such as "user-debug" or "eng".
* @hide
*/
public static final boolean IS_DEBUGGABLE =
SystemProperties.getInt("ro.debuggable", 0) == 1;
以上时低内存版本时的相关属性SystemProperties设置