Remove interfaces for runtime and runtime_native namespaces.
Per API council feedback, we are making changes to include only the
namespace in the system API defined in DeviceConfig.java. Strings which
define property names should be defined in code local to the feature
instead.
Bug: 126411407
Test: atest FrameworksCoreTests:DeviceConfigTest
Change-Id: I73157c127a246719afb37eca65cabf2e3d24b38a
diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java
index b6bc95d..6f0a1f2 100644
--- a/core/java/android/os/ZygoteProcess.java
+++ b/core/java/android/os/ZygoteProcess.java
@@ -21,12 +21,12 @@
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 @@
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) {
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 038d455..86f9946 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -155,6 +155,22 @@
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.
*
@@ -180,63 +196,6 @@
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.
*
* @hide
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index 2e27737..35cf129 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -83,6 +83,10 @@
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 @@
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);
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 3655748..992ddd8 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -412,7 +412,7 @@
return SystemProperties.get(
String.join(".",
"persist.device_config",
- DeviceConfig.RuntimeNative.NAMESPACE,
+ DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
propertyName),
defaultValue);
}
@@ -440,7 +440,7 @@
return SystemProperties.getBoolean(
String.join(".",
"persist.device_config",
- DeviceConfig.RuntimeNative.NAMESPACE,
+ DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
propertyName),
defaultValue);
}
diff --git a/core/java/com/android/internal/os/ZygoteConfig.java b/core/java/com/android/internal/os/ZygoteConfig.java
new file mode 100644
index 0000000..c8ff51e
--- /dev/null
+++ b/core/java/com/android/internal/os/ZygoteConfig.java
@@ -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";
+}
diff --git a/core/java/com/android/internal/os/ZygoteServer.java b/core/java/com/android/internal/os/ZygoteServer.java
index 7abfd85..3f3aba9 100644
--- a/core/java/com/android/internal/os/ZygoteServer.java
+++ b/core/java/com/android/internal/os/ZygoteServer.java
@@ -22,7 +22,6 @@
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 @@
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.");