Loading core/java/android/app/BackgroundStartPrivileges.java +20 −1 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); } } core/tests/coretests/src/android/app/BackgroundStartPrivilegesTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -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); } } Loading
core/java/android/app/BackgroundStartPrivileges.java +20 −1 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); } }
core/tests/coretests/src/android/app/BackgroundStartPrivilegesTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -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); } }