Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe3a348e authored by Chris Wailes's avatar Chris Wailes
Browse files

Addressed deferred CL feedback comments.

This CL addresses several bits of feedback from previous CLs:
* ZygoteState.mABIList => ZygoteState.mAbiList
* Adding appropriate whitespace
* Finalizing variables where appropriate
* TEMP_RETRY_FAILURE around write
* Zygote.getSystemProperty => Zygote.getConfigurationProperty

Test: m
Test: Treehugger
Change-Id: I5ae4c8dfc336c7511bee375a80966abb1ead275e
parent 01324d87
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class ZygoteProcess {
        final DataInputStream mZygoteInputStream;
        final BufferedWriter mZygoteOutputWriter;

        private final List<String> mABIList;
        private final List<String> mAbiList;

        private boolean mClosed;

@@ -162,7 +162,7 @@ public class ZygoteProcess {
            this.mZygoteSessionSocket = zygoteSessionSocket;
            this.mZygoteInputStream = zygoteInputStream;
            this.mZygoteOutputWriter = zygoteOutputWriter;
            this.mABIList = abiList;
            this.mAbiList = abiList;
        }

        /**
@@ -215,7 +215,7 @@ public class ZygoteProcess {
        }

        boolean matches(String abi) {
            return mABIList.contains(abi);
            return mAbiList.contains(abi);
        }

        public void close() {
@@ -374,7 +374,7 @@ public class ZygoteProcess {
        byte[] bytes = new byte[numBytes];
        inputStream.readFully(bytes);

        String rawList = new String(bytes, StandardCharsets.US_ASCII);
        final String rawList = new String(bytes, StandardCharsets.US_ASCII);

        return Arrays.asList(rawList.split(","));
    }
@@ -660,13 +660,13 @@ public class ZygoteProcess {
        boolean origVal = mUsapPoolEnabled;

        final String propertyString =
                Zygote.getSystemProperty(
                Zygote.getConfigurationProperty(
                        DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
                        USAP_POOL_ENABLED_DEFAULT);

        if (!propertyString.isEmpty()) {
            mUsapPoolEnabled =
                    Zygote.getSystemPropertyBoolean(
                    Zygote.getConfigurationPropertyBoolean(
                            DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
                            Boolean.parseBoolean(USAP_POOL_ENABLED_DEFAULT));
        }
+4 −2
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ public final class Zygote {
     * TODO (chriswailes): Cache the system property location in native code and then write a JNI
     *                     function to fetch it.
     */
    public static String getSystemProperty(String propertyName, String defaultValue) {
    public static String getConfigurationProperty(String propertyName, String defaultValue) {
        return SystemProperties.get(
                String.join(".",
                        "persist.device_config",
@@ -433,8 +433,10 @@ public final class Zygote {
     *
     * TODO (chriswailes): Cache the system property location in native code and then write a JNI
     *                     function to fetch it.
     * TODO (chriswailes): Move into ZygoteConfig.java once the necessary CL lands (go/ag/6580627)
     */
    public static boolean getSystemPropertyBoolean(String propertyName, Boolean defaultValue) {
    public static boolean getConfigurationPropertyBoolean(
            String propertyName, Boolean defaultValue) {
        return SystemProperties.getBoolean(
                String.join(".",
                        "persist.device_config",
+3 −3
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ class ZygoteServer {
    private void fetchUsapPoolPolicyProps() {
        if (mUsapPoolSupported) {
            final String usapPoolSizeMaxPropString =
                    Zygote.getSystemProperty(
                    Zygote.getConfigurationProperty(
                            DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MAX,
                            USAP_POOL_SIZE_MAX_DEFAULT);

@@ -255,7 +255,7 @@ class ZygoteServer {
            }

            final String usapPoolSizeMinPropString =
                    Zygote.getSystemProperty(
                    Zygote.getConfigurationProperty(
                            DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MIN,
                            USAP_POOL_SIZE_MIN_DEFAULT);

@@ -267,7 +267,7 @@ class ZygoteServer {
            }

            final String usapPoolRefillThresholdPropString =
                    Zygote.getSystemProperty(
                    Zygote.getConfigurationProperty(
                            DeviceConfig.RuntimeNative.USAP_POOL_REFILL_THRESHOLD,
                            Integer.toString(mUsapPoolSizeMax / 2));

+1 −1
Original line number Diff line number Diff line
@@ -352,7 +352,7 @@ static void SigChldHandler(int /*signal_number*/) {
  }

  if (usaps_removed > 0) {
    if (write(gUsapPoolEventFD, &usaps_removed, sizeof(usaps_removed)) == -1) {
    if (TEMP_FAILURE_RETRY(write(gUsapPoolEventFD, &usaps_removed, sizeof(usaps_removed))) == -1) {
      // If this write fails something went terribly wrong.  We will now kill
      // the zygote and let the system bring it back up.
      async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG,