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

Commit adf6bb84 authored by Edgar Arriaga García's avatar Edgar Arriaga García Committed by Android (Google) Code Review
Browse files

Merge changes from topic "ea-pinner-defaults" into main

* changes:
  Make home app be pinned by default
  Move system apps pinner default values to be config driven and ensure new devices inherit them
parents 9e2ae3c0 4aaca92a
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -4447,17 +4447,25 @@
    <string-array translatable="false" name="config_defaultPinnerServiceFiles">
    </string-array>

    <!-- True if camera app should be pinned via Pinner Service -->
    <!-- Note: This config is deprecated, use config_pinnerCameraPinBytes instead.
         True if camera app should be pinned via Pinner Service -->
    <bool name="config_pinnerCameraApp">false</bool>

    <!-- Bytes that the PinnerService will pin for Home app -->
    <integer name="config_pinnerHomePinBytes">0</integer>
    <!-- Default: 60 MB. Bytes that the PinnerService will pin for Home app -->
    <integer name="config_pinnerHomePinBytes">62914560</integer>

    <!-- True if assistant app should be pinned via Pinner Service -->
    <!-- Default: 80 MB. Bytes that the PinnerService will pin for Camera app -->
    <integer name="config_pinnerCameraPinBytes">83886080</integer>

    <!-- Note: This config is deprecated, use config_pinnerAssistantPinBytes instead.
         True if assistant app should be pinned via Pinner Service -->
    <bool name="config_pinnerAssistantApp">false</bool>

    <!-- Bytes that the PinnerService will pin for WebView -->
    <integer name="config_pinnerWebviewPinBytes">0</integer>
     <!-- Default: 60 MB. Bytes that the PinnerService will pin for Assistant -->
    <integer name="config_pinnerAssistantPinBytes">62914560</integer>

    <!-- Default: 20 MB. Bytes that the PinnerService will pin for WebView -->
    <integer name="config_pinnerWebviewPinBytes">20971520</integer>

    <!-- Maximum memory that PinnerService will pin for apps expressed
         as a percentage of total device memory [0,100].
+2 −0
Original line number Diff line number Diff line
@@ -3471,6 +3471,8 @@
  <java-symbol type="array" name="config_defaultPinnerServiceFiles" />
  <java-symbol type="bool" name="config_pinnerCameraApp" />
  <java-symbol type="integer" name="config_pinnerHomePinBytes" />
  <java-symbol type="integer" name="config_pinnerCameraPinBytes" />
  <java-symbol type="integer" name="config_pinnerAssistantPinBytes" />
  <java-symbol type="bool" name="config_pinnerAssistantApp" />
  <java-symbol type="integer" name="config_pinnerWebviewPinBytes" />
  <java-symbol type="integer" name="config_pinnerMaxPinnedMemoryPercentage" />
+12 −5
Original line number Diff line number Diff line
@@ -121,9 +121,6 @@ public final class PinnerService extends SystemService {
    private static boolean PROP_PIN_PINLIST =
            SystemProperties.getBoolean("pinner.use_pinlist", true);

    private static final int MAX_CAMERA_PIN_SIZE = 80 * (1 << 20); // 80MB max for camera app.
    private static final int MAX_ASSISTANT_PIN_SIZE = 60 * (1 << 20); // 60MB max for assistant app.

    public static final String ANON_REGION_STAT_NAME = "[anon]";

    private static final String SYSTEM_GROUP_NAME = "system";
@@ -179,8 +176,10 @@ public final class PinnerService extends SystemService {

    // Resource-configured pinner flags;
    private final boolean mConfiguredToPinCamera;
    private final int mConfiguredCameraPinBytes;
    private final int mConfiguredHomePinBytes;
    private final boolean mConfiguredToPinAssistant;
    private final int mConfiguredAssistantPinBytes;
    private final int mConfiguredWebviewPinBytes;

    // This is the percentage of total device memory that will be used to set the global quota.
@@ -250,6 +249,10 @@ public final class PinnerService extends SystemService {
        mDeviceConfigInterface = mInjector.getDeviceConfigInterface();
        mConfiguredToPinCamera = context.getResources().getBoolean(
                com.android.internal.R.bool.config_pinnerCameraApp);
        mConfiguredCameraPinBytes = context.getResources().getInteger(
                com.android.internal.R.integer.config_pinnerCameraPinBytes);
        mConfiguredAssistantPinBytes = context.getResources().getInteger(
                com.android.internal.R.integer.config_pinnerAssistantPinBytes);
        mConfiguredHomePinBytes = context.getResources().getInteger(
                com.android.internal.R.integer.config_pinnerHomePinBytes);
        mConfiguredToPinAssistant = context.getResources().getBoolean(
@@ -812,11 +815,11 @@ public final class PinnerService extends SystemService {
    private int getSizeLimitForKey(@AppKey int key) {
        switch (key) {
            case KEY_CAMERA:
                return MAX_CAMERA_PIN_SIZE;
                return mConfiguredCameraPinBytes;
            case KEY_HOME:
                return mConfiguredHomePinBytes;
            case KEY_ASSISTANT:
                return MAX_ASSISTANT_PIN_SIZE;
                return mConfiguredAssistantPinBytes;
            default:
                return 0;
        }
@@ -1303,6 +1306,10 @@ public final class PinnerService extends SystemService {
            pw.format("   Maximum Pinner quota: %d bytes (%.2f MB)\n", mConfiguredMaxPinnedMemory,
                    mConfiguredMaxPinnedMemory / bytesPerMB);
            pw.format("   Max Home App Pin Bytes (without deps): %d\n", mConfiguredHomePinBytes);
            pw.format("   Max Assistant App Pin Bytes (without deps): %d\n",
                    mConfiguredAssistantPinBytes);
            pw.format(
                    "   Max Camera App Pin Bytes (without deps): %d\n", mConfiguredCameraPinBytes);
            pw.format("\nPinned Files:\n");
            synchronized (PinnerService.this) {
                long totalSize = 0;