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

Commit e622af2a authored by Edgar Arriaga's avatar Edgar Arriaga Committed by Edgar Arriaga García
Browse files

Move system apps pinner default values to be config driven and ensure new devices inherit them

Test: dumpsys pinner
Test: atest FrameworksServicesTests_pinner_service:com.android.server.PinnerServiceTest
Flag: EXEMPT refactor
Bug: 340935152
Bug: 358273970

Change-Id: Icb068f5c079a4cbea3263a29255f0f76ba41c10d
parent 784188cf
Loading
Loading
Loading
Loading
+12 −4
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>

    <!-- 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
@@ -3469,6 +3469,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;