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

Commit 478fd74e authored by Hui Yu's avatar Hui Yu
Browse files

Mark BindServiceFlags.getValue() @hide.

Change BIND_EXTERNAL_SERVICE_LONG to 1L << 62 (from 1L << 63), do not
use the sign bit.

Bug: 271325720
Test: atest cts/tests/app/src/android/app/cts/ServiceTest.java#testBindServiceFlags
atest cts/tests/app/src/android/app/cts/ServiceTest.java
atest cts/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java

Change-Id: I8fb9be68493c9f4b631c0e33ad3089b03245770c
parent cfd25ee5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -10333,7 +10333,7 @@ package android.content {
    field public static final int BIND_AUTO_CREATE = 1; // 0x1
    field public static final int BIND_DEBUG_UNBIND = 2; // 0x2
    field public static final int BIND_EXTERNAL_SERVICE = -2147483648; // 0x80000000
    field public static final long BIND_EXTERNAL_SERVICE_LONG = -9223372036854775808L; // 0x8000000000000000L
    field public static final long BIND_EXTERNAL_SERVICE_LONG = 4611686018427387904L; // 0x4000000000000000L
    field public static final int BIND_IMPORTANT = 64; // 0x40
    field public static final int BIND_INCLUDE_CAPABILITIES = 4096; // 0x1000
    field public static final int BIND_NOT_FOREGROUND = 4; // 0x4
@@ -10441,7 +10441,6 @@ package android.content {
  }
  public static final class Context.BindServiceFlags {
    method public long getValue();
    method @NonNull public static android.content.Context.BindServiceFlags of(long);
  }
+6 −5
Original line number Diff line number Diff line
@@ -316,10 +316,12 @@ public abstract class Context {
            BIND_ALLOW_ACTIVITY_STARTS,
            BIND_INCLUDE_CAPABILITIES,
            BIND_SHARED_ISOLATED_PROCESS,
            // Intentionally not included, because it'd cause sign-extension.
            // Intentionally not include BIND_EXTERNAL_SERVICE, because it'd cause sign-extension.
            // This would allow Android Studio to show a warning, if someone tries to use
            // BIND_EXTERNAL_SERVICE BindServiceFlags.
            BIND_EXTERNAL_SERVICE_LONG
            BIND_EXTERNAL_SERVICE_LONG,
            // Make sure no flag uses the sign bit (most significant bit) of the long integer,
            // to avoid future confusion.
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface BindServiceFlagsLongBits {}
@@ -338,6 +340,7 @@ public abstract class Context {

        /**
         * @return Return flags in 64 bits long integer.
         * @hide
         */
        public long getValue() {
            return mValue;
@@ -678,13 +681,11 @@ public abstract class Context {
     */
    public static final int BIND_EXTERNAL_SERVICE = 0x80000000;


    /**
     * Works in the same way as {@link #BIND_EXTERNAL_SERVICE}, but it's defined as a (@code long)
     * value that is compatible to {@link BindServiceFlags}.
     */
    public static final long BIND_EXTERNAL_SERVICE_LONG = 0x8000_0000_0000_0000L;

    public static final long BIND_EXTERNAL_SERVICE_LONG = 1L << 62;

    /**
     * These bind flags reduce the strength of the binding such that we shouldn't