mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-05-02 14:36:17 -04:00
Default disable exec spawning
Change the property too, so it takes effect next update. Since 16.0 lacks a toggle, this effectively disables the feature for it. Even devices with 4GB of RAM have usability severely impacted. Plus some other tweaks/churn Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
81d9923cda
commit
42c9d22de9
26 changed files with 84 additions and 94 deletions
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# Copyright (C) 2017 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.
|
||||
#
|
||||
|
||||
# Changes various properties to reduce memory usage
|
||||
|
||||
# Do not spin up a separate process, use an in-process APK.
|
||||
PRODUCT_PACKAGES += CellBroadcastAppPlatform
|
||||
PRODUCT_PACKAGES += CellBroadcastServiceModulePlatform
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# Copyright (C) 2017 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.
|
||||
#
|
||||
|
||||
# Changes various properties to reduce memory usage
|
||||
|
||||
# Do not spin up a separate process, use an in-process APK.
|
||||
PRODUCT_PACKAGES += InProcessNetworkStack
|
||||
PRODUCT_PACKAGES += com.android.tethering.inprocess
|
|
@ -18,7 +18,9 @@
|
|||
|
||||
# Set lowram options
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
sys.spawn.exec=false \
|
||||
persist.security.exec_spawn=false \
|
||||
persist.security.exec_spawn_new=false \
|
||||
ro.config.low_ram=true \
|
||||
ro.lmk.critical_upgrade=true \
|
||||
ro.lmk.upgrade_pressure=40 \
|
||||
|
@ -34,7 +36,9 @@ PRODUCT_PROPERTY_OVERRIDES += \
|
|||
pm.dexopt.downgrade_after_inactive_days=10
|
||||
|
||||
# Speed profile services and wifi-service to reduce RAM and storage.
|
||||
ifeq ($(findstring mako,$(TARGET_PRODUCT)),)
|
||||
PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := speed-profile
|
||||
endif
|
||||
|
||||
# Always preopt extracted APKs to prevent extracting out of the APK for gms
|
||||
# modules.
|
||||
|
@ -59,12 +63,6 @@ PRODUCT_PROPERTY_OVERRIDES += \
|
|||
# Do not generate libartd.
|
||||
PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD := false
|
||||
|
||||
# Do not spin up a separate process for the network stack on go devices, use an in-process APK.
|
||||
#PRODUCT_PACKAGES += InProcessNetworkStack
|
||||
#PRODUCT_PACKAGES += CellBroadcastAppPlatform
|
||||
#PRODUCT_PACKAGES += CellBroadcastServiceModulePlatform
|
||||
#PRODUCT_PACKAGES += com.android.tethering.inprocess
|
||||
|
||||
# Strip the local variable table and the local variable type table to reduce
|
||||
# the size of the system image. This has no bearing on stack traces, but will
|
||||
# leave less information available via JDWP.
|
||||
|
|
|
@ -152,7 +152,7 @@ index f537e3e2897b..7d51be259c20 100644
|
|||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ ExecInit.execApplication(parsedArgs.niceName, parsedArgs.targetSdkVersion,
|
||||
+ VMRuntime.getCurrentInstructionSet(), parsedArgs.remainingArgs);
|
||||
+
|
||||
|
|
|
@ -17,8 +17,8 @@ index 7d51be259c20..48a68d96e84c 100644
|
|||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true) && parsedArgs.runtimeFlags == 0) {
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false) && parsedArgs.runtimeFlags == 0) {
|
||||
ExecInit.execApplication(parsedArgs.niceName, parsedArgs.targetSdkVersion,
|
||||
VMRuntime.getCurrentInstructionSet(), parsedArgs.remainingArgs);
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ index 52d0adba0a05..96348aa30b87 100644
|
|||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
+ VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
+
|
||||
|
|
|
@ -17,8 +17,8 @@ index 96348aa30b87..a3051979e341 100644
|
|||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true) &&
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
|
||||
+ (parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
|
|
|
@ -88,7 +88,7 @@ index 0000000000..78f021210a
|
|||
+public class ExecSpawnPreferenceController extends AbstractPreferenceController
|
||||
+ implements PreferenceControllerMixin, OnResume, Preference.OnPreferenceChangeListener {
|
||||
+
|
||||
+ private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn";
|
||||
+ private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn_new";
|
||||
+ private static final String PREF_KEY_EXEC_SPAWN = "exec_spawn";
|
||||
+ private static final String PREF_KEY_SECURITY_CATEGORY = "security_category";
|
||||
+
|
||||
|
@ -128,7 +128,7 @@ index 0000000000..78f021210a
|
|||
+
|
||||
+ if (mIsAdmin) {
|
||||
+ mExecSpawn = (SwitchPreference) mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN);
|
||||
+ mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, true));
|
||||
+ mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, false));
|
||||
+ } else {
|
||||
+ mSecurityCategory.removePreference(mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN));
|
||||
+ }
|
||||
|
|
|
@ -145,7 +145,7 @@ index 790d7f7ab694..4f7fd039ccd7 100644
|
|||
OsConstants._LINUX_CAPABILITY_VERSION_3, 0);
|
||||
StructCapUserData[] data;
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
index e6a3029c5b2b..a702e84813fa 100644
|
||||
index e6a3029c5b2b..5e4518cffb9f 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
@@ -29,6 +29,7 @@ import android.net.Credentials;
|
||||
|
@ -160,7 +160,7 @@ index e6a3029c5b2b..a702e84813fa 100644
|
|||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
+ VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
+
|
||||
|
|
|
@ -78,11 +78,11 @@ index a7d9827855a2..aa874ad98a78 100644
|
|||
+ public static native void nativeHandleRuntimeFlags(int runtimeFlags);
|
||||
}
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
index 9b4664178530..4ae69677f1dd 100644
|
||||
index f31616fc88fb..f5044f9ecbb0 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
@@ -505,7 +505,7 @@ class ZygoteConnection {
|
||||
if (SystemProperties.getBoolean("sys.spawn.exec", true) &&
|
||||
if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
|
||||
(parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
- VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
|
|
|
@ -10,15 +10,15 @@ spawning when doing debugging.
|
|||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
index a702e84813fa..9b4664178530 100644
|
||||
index 5e4518cffb9f..f31616fc88fb 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
@@ -502,7 +502,8 @@ class ZygoteConnection {
|
||||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true) &&
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
|
||||
+ (parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
|
|
|
@ -43,7 +43,7 @@ index 06b3511ceb..75cc0b261d 100644
|
|||
android:title="@string/native_debug_title"
|
||||
diff --git a/src/com/android/settings/security/ExecSpawnPreferenceController.java b/src/com/android/settings/security/ExecSpawnPreferenceController.java
|
||||
new file mode 100644
|
||||
index 0000000000..78f021210a
|
||||
index 0000000000..98cc3c29e1
|
||||
--- /dev/null
|
||||
+++ b/src/com/android/settings/security/ExecSpawnPreferenceController.java
|
||||
@@ -0,0 +1,106 @@
|
||||
|
@ -88,7 +88,7 @@ index 0000000000..78f021210a
|
|||
+public class ExecSpawnPreferenceController extends AbstractPreferenceController
|
||||
+ implements PreferenceControllerMixin, OnResume, Preference.OnPreferenceChangeListener {
|
||||
+
|
||||
+ private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn";
|
||||
+ private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn_new";
|
||||
+ private static final String PREF_KEY_EXEC_SPAWN = "exec_spawn";
|
||||
+ private static final String PREF_KEY_SECURITY_CATEGORY = "security_category";
|
||||
+
|
||||
|
@ -128,7 +128,7 @@ index 0000000000..78f021210a
|
|||
+
|
||||
+ if (mIsAdmin) {
|
||||
+ mExecSpawn = (SwitchPreference) mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN);
|
||||
+ mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, true));
|
||||
+ mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, false));
|
||||
+ } else {
|
||||
+ mSecurityCategory.removePreference(mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN));
|
||||
+ }
|
||||
|
|
|
@ -161,7 +161,7 @@ index 993e4e7b4b3d..756547706f60 100644
|
|||
}
|
||||
|
||||
- if (parsedArgs.mInvokeWith != null || parsedArgs.mStartChildZygote
|
||||
+ if (parsedArgs.mInvokeWith != null || SystemProperties.getBoolean("sys.spawn.exec", true) || parsedArgs.mStartChildZygote
|
||||
+ if (parsedArgs.mInvokeWith != null || SystemProperties.getBoolean("sys.spawn.exec", false) || parsedArgs.mStartChildZygote
|
||||
|| !multipleOK || peer.getUid() != Process.SYSTEM_UID) {
|
||||
// Continue using old code for now. TODO: Handle these cases in the other path.
|
||||
pid = Zygote.forkAndSpecialize(parsedArgs.mUid, parsedArgs.mGid,
|
||||
|
@ -169,7 +169,7 @@ index 993e4e7b4b3d..756547706f60 100644
|
|||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
+ VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
+
|
||||
|
|
|
@ -82,7 +82,7 @@ index 27518dd4cdce..a8d9400c7992 100644
|
|||
--- a/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
@@ -539,7 +539,7 @@ class ZygoteConnection {
|
||||
if (SystemProperties.getBoolean("sys.spawn.exec", true) &&
|
||||
if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
|
||||
(parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
- VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
|
|
|
@ -17,8 +17,8 @@ index 756547706f60..27518dd4cdce 100644
|
|||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", true)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", true) &&
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
|
||||
+ (parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
|
|
|
@ -89,7 +89,7 @@ index 0000000000..78f021210a
|
|||
+public class ExecSpawnPreferenceController extends AbstractPreferenceController
|
||||
+ implements PreferenceControllerMixin, OnResume, Preference.OnPreferenceChangeListener {
|
||||
+
|
||||
+ private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn";
|
||||
+ private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn_new";
|
||||
+ private static final String PREF_KEY_EXEC_SPAWN = "exec_spawn";
|
||||
+ private static final String PREF_KEY_SECURITY_CATEGORY = "security_category";
|
||||
+
|
||||
|
@ -129,7 +129,7 @@ index 0000000000..78f021210a
|
|||
+
|
||||
+ if (mIsAdmin) {
|
||||
+ mExecSpawn = (SwitchPreference) mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN);
|
||||
+ mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, true));
|
||||
+ mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, false));
|
||||
+ } else {
|
||||
+ mSecurityCategory.removePreference(mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN));
|
||||
+ }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue