Merge "Mark BindServiceFlags.getValue() @hide." into udc-dev
diff --git a/core/api/current.txt b/core/api/current.txt
index 53dcd75..a665bcd 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -10333,7 +10333,7 @@
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 @@
}
public static final class Context.BindServiceFlags {
- method public long getValue();
method @NonNull public static android.content.Context.BindServiceFlags of(long);
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index a412560..36f7ff5 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -316,10 +316,12 @@
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 @@
/**
* @return Return flags in 64 bits long integer.
+ * @hide
*/
public long getValue() {
return mValue;
@@ -678,13 +681,11 @@
*/
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