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

Commit aa294630 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/29753252',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/29753252', 'googleplex-android-review.googlesource.com/30882111', 'googleplex-android-review.googlesource.com/31089761', 'googleplex-android-review.googlesource.com/31434165', 'googleplex-android-review.googlesource.com/31583040', 'googleplex-android-review.googlesource.com/31221230', 'googleplex-android-review.googlesource.com/31616632', 'googleplex-android-review.googlesource.com/32385125', 'googleplex-android-review.googlesource.com/32343661', 'googleplex-android-review.googlesource.com/32343678', 'googleplex-android-review.googlesource.com/32343679'] into 25Q1-release.

Change-Id: I663ac7408fd715e1e7906a9511c84e41949dcbb8
parents 54642d14 f9b0058a
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -23,12 +23,13 @@ import android.os.IBinder;
import com.android.internal.util.Preconditions;

import java.util.List;
import java.util.Objects;

/**
 * Privileges granted to a Process that allows it to execute starts from the background.
 * @hide
 */
public class BackgroundStartPrivileges {
public final class BackgroundStartPrivileges {
    /** No privileges. */
    public static final BackgroundStartPrivileges NONE = new BackgroundStartPrivileges(
            false, false, null);
@@ -190,4 +191,22 @@ public class BackgroundStartPrivileges {
                + ", originatingToken=" + mOriginatingToken
                + ']';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BackgroundStartPrivileges that = (BackgroundStartPrivileges) o;
        return mAllowsBackgroundActivityStarts == that.mAllowsBackgroundActivityStarts
                && mAllowsBackgroundForegroundServiceStarts
                == that.mAllowsBackgroundForegroundServiceStarts
                && Objects.equals(mOriginatingToken, that.mOriginatingToken);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mAllowsBackgroundActivityStarts,
                mAllowsBackgroundForegroundServiceStarts,
                mOriginatingToken);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -75,4 +75,16 @@ flag {
    bug: "362575865"
}

flag {
    name: "bal_strict_mode_grace_period"
    namespace: "responsible_apis"
    description: "Strict mode violation triggered by grace period usage"
    bug: "384807495"
}

flag {
    name: "bal_clear_allowlist_duration"
    namespace: "responsible_apis"
    description: "Clear the allowlist duration when clearAllowBgActivityStarts is called"
    bug: "322159724"
}
+11 −0
Original line number Diff line number Diff line
@@ -119,4 +119,15 @@ public class BackgroundStartPrivilegesTest {
                Arrays.asList(BSP_ALLOW_A, BSP_ALLOW_A, BSP_ALLOW_A, BSP_ALLOW_A)))
                .isEqualTo(BSP_ALLOW_A);
    }

    @Test
    public void backgroundStartPrivilege_equals_works() {
        assertThat(NONE).isEqualTo(NONE);
        assertThat(ALLOW_BAL).isEqualTo(ALLOW_BAL);
        assertThat(ALLOW_FGS).isEqualTo(ALLOW_FGS);
        assertThat(BSP_ALLOW_A).isEqualTo(BSP_ALLOW_A);
        assertThat(NONE).isNotEqualTo(ALLOW_BAL);
        assertThat(ALLOW_FGS).isNotEqualTo(ALLOW_BAL);
        assertThat(BSP_ALLOW_A).isNotEqualTo(BSP_ALLOW_B);
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server;
import static android.Manifest.permission.NETWORK_STACK;

import static com.android.net.module.util.PermissionUtils.enforceAnyPermissionOf;
import static com.android.net.module.util.PermissionUtils.enforceNetworkStackPermission;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -1020,6 +1021,8 @@ public class VpnManagerService extends IVpnManager.Stub {
    @Override
    @Nullable
    public byte[] getFromVpnProfileStore(@NonNull String name) {
        // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission
        enforceNetworkStackPermission(mContext);
        return mVpnProfileStore.get(name);
    }

@@ -1037,6 +1040,8 @@ public class VpnManagerService extends IVpnManager.Stub {
     */
    @Override
    public boolean putIntoVpnProfileStore(@NonNull String name, @NonNull byte[] blob) {
        // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission
        enforceNetworkStackPermission(mContext);
        return mVpnProfileStore.put(name, blob);
    }

@@ -1052,6 +1057,8 @@ public class VpnManagerService extends IVpnManager.Stub {
     */
    @Override
    public boolean removeFromVpnProfileStore(@NonNull String name) {
        // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission
        enforceNetworkStackPermission(mContext);
        return mVpnProfileStore.remove(name);
    }

@@ -1069,6 +1076,8 @@ public class VpnManagerService extends IVpnManager.Stub {
    @Override
    @NonNull
    public String[] listFromVpnProfileStore(@NonNull String prefix) {
        // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission
        enforceNetworkStackPermission(mContext);
        return mVpnProfileStore.list(prefix);
    }

+1 −2
Original line number Diff line number Diff line
@@ -316,8 +316,7 @@ class BroadcastController {
                return null;
            }
            if (callerApp.info.uid != SYSTEM_UID
                    && !callerApp.getPkgList().containsKey(callerPackage)
                    && !"android".equals(callerPackage)) {
                    && !callerApp.getPkgList().containsKey(callerPackage)) {
                throw new SecurityException("Given caller package " + callerPackage
                        + " is not running in process " + callerApp);
            }
Loading