Merge "Remove interfaces for runtime and runtime_native namespaces."
This commit is contained in:
@@ -5867,6 +5867,8 @@ package android.provider {
|
||||
field public static final String NAMESPACE_INTELLIGENCE_ATTENTION = "intelligence_attention";
|
||||
field public static final String NAMESPACE_MEDIA_NATIVE = "media_native";
|
||||
field public static final String NAMESPACE_NETD_NATIVE = "netd_native";
|
||||
field public static final String NAMESPACE_RUNTIME = "runtime";
|
||||
field public static final String NAMESPACE_RUNTIME_NATIVE = "runtime_native";
|
||||
field public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
|
||||
field public static final String NAMESPACE_SYSTEMUI = "systemui";
|
||||
field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
|
||||
@@ -5909,15 +5911,6 @@ package android.provider {
|
||||
field public static final String ROLLBACK_LIFETIME_IN_MILLIS = "rollback_lifetime_in_millis";
|
||||
}
|
||||
|
||||
public static interface DeviceConfig.Runtime {
|
||||
field public static final String NAMESPACE = "runtime";
|
||||
field public static final String USE_PRECOMPILED_LAYOUT = "view.precompiled_layout_enabled";
|
||||
}
|
||||
|
||||
public static interface DeviceConfig.RuntimeNative {
|
||||
field public static final String NAMESPACE = "runtime_native";
|
||||
}
|
||||
|
||||
public static interface DeviceConfig.Scheduler {
|
||||
field public static final String ENABLE_FAST_METRICS_COLLECTION = "enable_fast_metrics_collection";
|
||||
field public static final String NAMESPACE = "scheduler";
|
||||
|
||||
@@ -21,12 +21,12 @@ import android.annotation.Nullable;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.net.LocalSocket;
|
||||
import android.net.LocalSocketAddress;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.os.Zygote;
|
||||
import com.android.internal.os.ZygoteConfig;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.DataInputStream;
|
||||
@@ -659,16 +659,13 @@ public class ZygoteProcess {
|
||||
private boolean fetchUsapPoolEnabledProp() {
|
||||
boolean origVal = mUsapPoolEnabled;
|
||||
|
||||
final String propertyString =
|
||||
Zygote.getConfigurationProperty(
|
||||
DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
|
||||
USAP_POOL_ENABLED_DEFAULT);
|
||||
final String propertyString = Zygote.getConfigurationProperty(
|
||||
ZygoteConfig.USAP_POOL_ENABLED, USAP_POOL_ENABLED_DEFAULT);
|
||||
|
||||
if (!propertyString.isEmpty()) {
|
||||
mUsapPoolEnabled =
|
||||
Zygote.getConfigurationPropertyBoolean(
|
||||
DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
|
||||
Boolean.parseBoolean(USAP_POOL_ENABLED_DEFAULT));
|
||||
mUsapPoolEnabled = Zygote.getConfigurationPropertyBoolean(
|
||||
ZygoteConfig.USAP_POOL_ENABLED,
|
||||
Boolean.parseBoolean(USAP_POOL_ENABLED_DEFAULT));
|
||||
}
|
||||
|
||||
if (origVal != mUsapPoolEnabled) {
|
||||
|
||||
@@ -154,6 +154,22 @@ public final class DeviceConfig {
|
||||
@SystemApi
|
||||
public static final String NAMESPACE_NETD_NATIVE = "netd_native";
|
||||
|
||||
/**
|
||||
* Namespace for all runtime related features.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final String NAMESPACE_RUNTIME = "runtime";
|
||||
|
||||
/**
|
||||
* Namespace for all runtime native related features.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final String NAMESPACE_RUNTIME_NATIVE = "runtime_native";
|
||||
|
||||
/**
|
||||
* Namespace for all runtime native boot related features. Boot in this case refers to the
|
||||
* fact that the properties only take affect after rebooting the device.
|
||||
@@ -179,63 +195,6 @@ public final class DeviceConfig {
|
||||
@SystemApi
|
||||
public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
|
||||
|
||||
/**
|
||||
* Namespace for all runtime related features.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public interface Runtime {
|
||||
String NAMESPACE = "runtime";
|
||||
|
||||
/**
|
||||
* Whether or not we use the precompiled layout.
|
||||
*/
|
||||
String USE_PRECOMPILED_LAYOUT = "view.precompiled_layout_enabled";
|
||||
}
|
||||
|
||||
/**
|
||||
* Namespace for all runtime native related features.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public interface RuntimeNative {
|
||||
String NAMESPACE = "runtime_native";
|
||||
|
||||
/**
|
||||
* Zygote flags. See {@link com.internal.os.Zygote}.
|
||||
*/
|
||||
|
||||
/**
|
||||
* If {@code true}, enables the unspecialized app process (USAP) pool feature.
|
||||
*
|
||||
* @hide for internal use only
|
||||
*/
|
||||
String USAP_POOL_ENABLED = "usap_pool_enabled";
|
||||
|
||||
/**
|
||||
* The maximum number of processes to keep in the USAP pool.
|
||||
*
|
||||
* @hide for internal use only
|
||||
*/
|
||||
String USAP_POOL_SIZE_MAX = "usap_pool_size_max";
|
||||
|
||||
/**
|
||||
* The minimum number of processes to keep in the USAP pool.
|
||||
*
|
||||
* @hide for internal use only
|
||||
*/
|
||||
String USAP_POOL_SIZE_MIN = "usap_pool_size_min";
|
||||
|
||||
/**
|
||||
* The threshold used to determine if the pool should be refilled.
|
||||
*
|
||||
* @hide for internal use only
|
||||
*/
|
||||
String USAP_POOL_REFILL_THRESHOLD = "usap_refill_threshold";
|
||||
}
|
||||
|
||||
/**
|
||||
* Privacy related properties definitions.
|
||||
*
|
||||
|
||||
@@ -83,6 +83,10 @@ public abstract class LayoutInflater {
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static final String COMPILED_VIEW_DEX_FILE_NAME = "/compiled_view.dex";
|
||||
/**
|
||||
* Whether or not we use the precompiled layout.
|
||||
*/
|
||||
private static final String USE_PRECOMPILED_LAYOUT = "view.precompiled_layout_enabled";
|
||||
|
||||
/** Empty stack trace used to avoid log spam in re-throw exceptions. */
|
||||
private static final StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0];
|
||||
@@ -416,15 +420,15 @@ public abstract class LayoutInflater {
|
||||
String usePrecompiledLayout = null;
|
||||
try {
|
||||
usePrecompiledLayout = DeviceConfig.getProperty(
|
||||
DeviceConfig.Runtime.NAMESPACE,
|
||||
DeviceConfig.Runtime.USE_PRECOMPILED_LAYOUT);
|
||||
DeviceConfig.NAMESPACE_RUNTIME,
|
||||
USE_PRECOMPILED_LAYOUT);
|
||||
} catch (Exception e) {
|
||||
// May be caused by permission errors reading the property (i.e. instant apps).
|
||||
}
|
||||
boolean enabled = false;
|
||||
if (TextUtils.isEmpty(usePrecompiledLayout)) {
|
||||
enabled = SystemProperties.getBoolean(
|
||||
DeviceConfig.Runtime.USE_PRECOMPILED_LAYOUT,
|
||||
USE_PRECOMPILED_LAYOUT,
|
||||
false);
|
||||
} else {
|
||||
enabled = Boolean.parseBoolean(usePrecompiledLayout);
|
||||
|
||||
@@ -412,7 +412,7 @@ public final class Zygote {
|
||||
return SystemProperties.get(
|
||||
String.join(".",
|
||||
"persist.device_config",
|
||||
DeviceConfig.RuntimeNative.NAMESPACE,
|
||||
DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
|
||||
propertyName),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -440,7 +440,7 @@ public final class Zygote {
|
||||
return SystemProperties.getBoolean(
|
||||
String.join(".",
|
||||
"persist.device_config",
|
||||
DeviceConfig.RuntimeNative.NAMESPACE,
|
||||
DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
|
||||
propertyName),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
37
core/java/com/android/internal/os/ZygoteConfig.java
Normal file
37
core/java/com/android/internal/os/ZygoteConfig.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.internal.os;
|
||||
|
||||
/**
|
||||
* Flag names for configuring the zygote.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class ZygoteConfig {
|
||||
|
||||
/** If {@code true}, enables the unspecialized app process (USAP) pool feature */
|
||||
public static final String USAP_POOL_ENABLED = "blastula_pool_enabled";
|
||||
|
||||
/** The threshold used to determine if the pool should be refilled */
|
||||
public static final String USAP_POOL_REFILL_THRESHOLD = "blastula_refill_threshold";
|
||||
|
||||
/** The maximum number of processes to keep in the USAP pool */
|
||||
public static final String USAP_POOL_SIZE_MAX = "blastula_pool_size_max";
|
||||
|
||||
/** The minimum number of processes to keep in the USAP pool */
|
||||
public static final String USAP_POOL_SIZE_MIN = "blastula_pool_size_min";
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import android.net.LocalServerSocket;
|
||||
import android.net.LocalSocket;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.StructPollfd;
|
||||
@@ -242,44 +241,33 @@ class ZygoteServer {
|
||||
|
||||
private void fetchUsapPoolPolicyProps() {
|
||||
if (mUsapPoolSupported) {
|
||||
final String usapPoolSizeMaxPropString =
|
||||
Zygote.getConfigurationProperty(
|
||||
DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MAX,
|
||||
USAP_POOL_SIZE_MAX_DEFAULT);
|
||||
final String usapPoolSizeMaxPropString = Zygote.getConfigurationProperty(
|
||||
ZygoteConfig.USAP_POOL_SIZE_MAX, USAP_POOL_SIZE_MAX_DEFAULT);
|
||||
|
||||
if (!usapPoolSizeMaxPropString.isEmpty()) {
|
||||
mUsapPoolSizeMax =
|
||||
Integer.min(
|
||||
Integer.parseInt(usapPoolSizeMaxPropString),
|
||||
USAP_POOL_SIZE_MAX_LIMIT);
|
||||
mUsapPoolSizeMax = Integer.min(Integer.parseInt(
|
||||
usapPoolSizeMaxPropString), USAP_POOL_SIZE_MAX_LIMIT);
|
||||
}
|
||||
|
||||
final String usapPoolSizeMinPropString =
|
||||
Zygote.getConfigurationProperty(
|
||||
DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MIN,
|
||||
USAP_POOL_SIZE_MIN_DEFAULT);
|
||||
final String usapPoolSizeMinPropString = Zygote.getConfigurationProperty(
|
||||
ZygoteConfig.USAP_POOL_SIZE_MIN, USAP_POOL_SIZE_MIN_DEFAULT);
|
||||
|
||||
if (!usapPoolSizeMinPropString.isEmpty()) {
|
||||
mUsapPoolSizeMin =
|
||||
Integer.max(
|
||||
Integer.parseInt(usapPoolSizeMinPropString),
|
||||
USAP_POOL_SIZE_MIN_LIMIT);
|
||||
mUsapPoolSizeMin = Integer.max(
|
||||
Integer.parseInt(usapPoolSizeMinPropString), USAP_POOL_SIZE_MIN_LIMIT);
|
||||
}
|
||||
|
||||
final String usapPoolRefillThresholdPropString =
|
||||
Zygote.getConfigurationProperty(
|
||||
DeviceConfig.RuntimeNative.USAP_POOL_REFILL_THRESHOLD,
|
||||
Integer.toString(mUsapPoolSizeMax / 2));
|
||||
final String usapPoolRefillThresholdPropString = Zygote.getConfigurationProperty(
|
||||
ZygoteConfig.USAP_POOL_REFILL_THRESHOLD,
|
||||
Integer.toString(mUsapPoolSizeMax / 2));
|
||||
|
||||
if (!usapPoolRefillThresholdPropString.isEmpty()) {
|
||||
mUsapPoolRefillThreshold =
|
||||
Integer.min(
|
||||
Integer.parseInt(usapPoolRefillThresholdPropString),
|
||||
mUsapPoolSizeMax);
|
||||
mUsapPoolRefillThreshold = Integer.min(
|
||||
Integer.parseInt(usapPoolRefillThresholdPropString),
|
||||
mUsapPoolSizeMax);
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
|
||||
if (mUsapPoolSizeMin >= mUsapPoolSizeMax) {
|
||||
Log.w(TAG, "The max size of the USAP pool must be greater than the minimum size."
|
||||
+ " Restoring default values.");
|
||||
|
||||
@@ -83,8 +83,8 @@ public class SettingsToPropertiesMapper {
|
||||
DeviceConfig.NAMESPACE_INPUT_NATIVE_BOOT,
|
||||
DeviceConfig.NAMESPACE_MEDIA_NATIVE,
|
||||
DeviceConfig.NAMESPACE_NETD_NATIVE,
|
||||
DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
|
||||
DeviceConfig.NAMESPACE_RUNTIME_NATIVE_BOOT,
|
||||
DeviceConfig.RuntimeNative.NAMESPACE,
|
||||
};
|
||||
|
||||
private final String[] mGlobalSettings;
|
||||
|
||||
Reference in New Issue
Block a user