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

Commit 811dc3b4 authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Allow preloading of freefore multi window drawables.

Bug: 25081468
Change-Id: Ic6ec6050882e5362e1ab8734962d163fff04b53d
parent 95e6ad7b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1729,6 +1729,8 @@ public abstract class PackageManager {
     * {@link #hasSystemFeature}: The device supports freeform window management.
     * Windows have title bars and can be moved and resized.
     */
    // If this feature is present, you also need to set
    // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
            = "android.software.freeform_window_management";
+15 −4
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ public class ZygoteInit {
                long startTime = SystemClock.uptimeMillis();
                TypedArray ar = mResources.obtainTypedArray(
                        com.android.internal.R.array.preloaded_drawables);
                int N = preloadDrawables(runtime, ar);
                int N = preloadDrawables(ar);
                ar.recycle();
                Log.i(TAG, "...preloaded " + N + " resources in "
                        + (SystemClock.uptimeMillis()-startTime) + "ms.");
@@ -354,10 +354,21 @@ public class ZygoteInit {
                startTime = SystemClock.uptimeMillis();
                ar = mResources.obtainTypedArray(
                        com.android.internal.R.array.preloaded_color_state_lists);
                N = preloadColorStateLists(runtime, ar);
                N = preloadColorStateLists(ar);
                ar.recycle();
                Log.i(TAG, "...preloaded " + N + " resources in "
                        + (SystemClock.uptimeMillis()-startTime) + "ms.");

                if (mResources.getBoolean(
                        com.android.internal.R.bool.config_freeformWindowManagement)) {
                    startTime = SystemClock.uptimeMillis();
                    ar = mResources.obtainTypedArray(
                            com.android.internal.R.array.preloaded_freeform_multi_window_drawables);
                    N = preloadDrawables(ar);
                    ar.recycle();
                    Log.i(TAG, "...preloaded " + N + " resource in "
                            + (SystemClock.uptimeMillis() - startTime) + "ms.");
                }
            }
            mResources.finishPreloading();
        } catch (RuntimeException e) {
@@ -365,7 +376,7 @@ public class ZygoteInit {
        }
    }

    private static int preloadColorStateLists(VMRuntime runtime, TypedArray ar) {
    private static int preloadColorStateLists(TypedArray ar) {
        int N = ar.length();
        for (int i=0; i<N; i++) {
            int id = ar.getResourceId(i, 0);
@@ -385,7 +396,7 @@ public class ZygoteInit {
    }


    private static int preloadDrawables(VMRuntime runtime, TypedArray ar) {
    private static int preloadDrawables(TypedArray ar) {
        int N = ar.length();
        for (int i=0; i<N; i++) {
            int id = ar.getResourceId(i, 0);
+5 −0
Original line number Diff line number Diff line
@@ -364,6 +364,11 @@
       <item>@color/search_url_text_material_light</item>
    </array>

   <array name="preloaded_freeform_multi_window_drawables">
      <item>@drawable/decor_maximize_button_dark</item>
      <item>@drawable/decor_maximize_button_light</item>
   </array>

    <!-- Used in LocalePicker -->
    <string-array translatable="false" name="special_locale_codes">
        <!-- http://b/17150708 - ensure that the list of languages says "Arabic"
+7 −0
Original line number Diff line number Diff line
@@ -2377,4 +2377,11 @@
    <!-- The BT name of the keyboard packaged with the device. If this is defined, SystemUI will
         automatically try to pair with it when the device exits tablet mode. -->
    <string translatable="false" name="config_packagedKeyboardName"></string>

    <!-- The device supports freeform window management. Windows have title bars and can be moved
         and resized. If you set this to true, you also need to add
         PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT feature to your device specification.
         The duplication is necessary, because this information is used before the features are
         available to the system.-->
    <bool name="config_freeformWindowManagement">false</bool>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -311,6 +311,7 @@
  <java-symbol type="bool" name="config_wifi_enable_wifi_firmware_debugging" />
  <java-symbol type="bool" name="config_supportMicNearUltrasound" />
  <java-symbol type="bool" name="config_supportSpeakerNearUltrasound" />
  <java-symbol type="bool" name="config_freeformWindowManagement" />
  <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_threshold" />
  <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_factor" />
  <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_threshold" />
@@ -1122,6 +1123,7 @@
  <java-symbol type="array" name="networkAttributes" />
  <java-symbol type="array" name="preloaded_color_state_lists" />
  <java-symbol type="array" name="preloaded_drawables" />
  <java-symbol type="array" name="preloaded_freeform_multi_window_drawables" />
  <java-symbol type="array" name="sim_colors" />
  <java-symbol type="array" name="special_locale_codes" />
  <java-symbol type="array" name="special_locale_names" />