Merge "Added @Nullable to ContentCaptureContext.getLocusId()"
diff --git a/api/current.txt b/api/current.txt
index 2fb9a00..3e7d626 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -25699,14 +25699,14 @@
public static class MediaPlayer2.DrmEventCallback {
ctor public MediaPlayer2.DrmEventCallback();
method public void onDrmConfig(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaDrm);
- method public android.media.MediaPlayer2.DrmPreparationInfo onDrmInfo(android.media.MediaPlayer2, android.media.DataSourceDesc, android.media.MediaPlayer2.DrmInfo);
- method public byte[] onDrmKeyRequest(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaDrm.KeyRequest);
+ method @Nullable public android.media.MediaPlayer2.DrmPreparationInfo onDrmInfo(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaPlayer2.DrmInfo);
+ method @NonNull public byte[] onDrmKeyRequest(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaDrm.KeyRequest);
method public void onDrmPrepared(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, int, @Nullable byte[]);
}
public static final class MediaPlayer2.DrmInfo {
- method public java.util.Map<java.util.UUID,byte[]> getPssh();
- method public java.util.List<java.util.UUID> getSupportedSchemes();
+ method @NonNull public java.util.Map<java.util.UUID,byte[]> getPssh();
+ method @NonNull public java.util.List<java.util.UUID> getSupportedSchemes();
}
public static final class MediaPlayer2.DrmPreparationInfo {
@@ -25714,13 +25714,13 @@
public static final class MediaPlayer2.DrmPreparationInfo.Builder {
ctor public MediaPlayer2.DrmPreparationInfo.Builder();
- method public android.media.MediaPlayer2.DrmPreparationInfo build();
- method public android.media.MediaPlayer2.DrmPreparationInfo.Builder setInitData(@Nullable byte[]);
- method public android.media.MediaPlayer2.DrmPreparationInfo.Builder setKeySetId(@Nullable byte[]);
- method public android.media.MediaPlayer2.DrmPreparationInfo.Builder setKeyType(int);
- method public android.media.MediaPlayer2.DrmPreparationInfo.Builder setMimeType(@Nullable String);
- method public android.media.MediaPlayer2.DrmPreparationInfo.Builder setOptionalParameters(@Nullable java.util.Map<java.lang.String,java.lang.String>);
- method public android.media.MediaPlayer2.DrmPreparationInfo.Builder setUuid(@NonNull java.util.UUID);
+ method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo build();
+ method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setInitData(@Nullable byte[]);
+ method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setKeySetId(@Nullable byte[]);
+ method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setKeyType(int);
+ method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setMimeType(@Nullable String);
+ method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setOptionalParameters(@Nullable java.util.Map<java.lang.String,java.lang.String>);
+ method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setUuid(@NonNull java.util.UUID);
}
public static class MediaPlayer2.EventCallback {
@@ -25751,7 +25751,7 @@
}
public static final class MediaPlayer2.NoDrmSchemeException extends android.media.MediaDrmException {
- ctor public MediaPlayer2.NoDrmSchemeException(String);
+ ctor public MediaPlayer2.NoDrmSchemeException(@Nullable String);
}
public static class MediaPlayer2.TrackInfo {
@@ -45062,7 +45062,6 @@
method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean removeSubscriptionsFromGroup(@NonNull int[]);
- method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setMetered(boolean, int);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunistic(boolean, int);
method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String setSubscriptionGroup(@NonNull int[]);
method public void setSubscriptionOverrideCongested(int, boolean, long);
@@ -51957,6 +51956,7 @@
method @NonNull public android.view.WindowInsets consumeStableInsets();
method @NonNull public android.view.WindowInsets consumeSystemWindowInsets();
method @Nullable public android.view.DisplayCutout getDisplayCutout();
+ method @NonNull public android.graphics.Insets getMandatorySystemGestureInsets();
method public int getStableInsetBottom();
method public int getStableInsetLeft();
method public int getStableInsetRight();
@@ -51968,6 +51968,7 @@
method public int getSystemWindowInsetRight();
method public int getSystemWindowInsetTop();
method @NonNull public android.graphics.Insets getSystemWindowInsets();
+ method @NonNull public android.graphics.Insets getTappableElementInsets();
method public boolean hasInsets();
method public boolean hasStableInsets();
method public boolean hasSystemWindowInsets();
@@ -51983,9 +51984,11 @@
ctor public WindowInsets.Builder(@NonNull android.view.WindowInsets);
method @NonNull public android.view.WindowInsets build();
method @NonNull public android.view.WindowInsets.Builder setDisplayCutout(@Nullable android.view.DisplayCutout);
+ method @NonNull public android.view.WindowInsets.Builder setMandatorySystemGestureInsets(@NonNull android.graphics.Insets);
method @NonNull public android.view.WindowInsets.Builder setStableInsets(@NonNull android.graphics.Insets);
method @NonNull public android.view.WindowInsets.Builder setSystemGestureInsets(@NonNull android.graphics.Insets);
method @NonNull public android.view.WindowInsets.Builder setSystemWindowInsets(@NonNull android.graphics.Insets);
+ method @NonNull public android.view.WindowInsets.Builder setTappableElementInsets(@NonNull android.graphics.Insets);
}
public interface WindowManager extends android.view.ViewManager {
diff --git a/api/system-current.txt b/api/system-current.txt
index d1a3055..8c78b21 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5880,6 +5880,7 @@
field public static final String NAMESPACE_RUNTIME = "runtime";
field public static final String NAMESPACE_RUNTIME_NATIVE = "runtime_native";
field public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
+ field public static final String NAMESPACE_SCHEDULER = "scheduler";
field public static final String NAMESPACE_SYSTEMUI = "systemui";
field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
}
@@ -5908,11 +5909,6 @@
method @Nullable public String getString(@NonNull String, @Nullable String);
}
- public static interface DeviceConfig.Scheduler {
- field public static final String ENABLE_FAST_METRICS_COLLECTION = "enable_fast_metrics_collection";
- field public static final String NAMESPACE = "scheduler";
- }
-
public static interface DeviceConfig.Storage {
field public static final String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
field public static final String NAMESPACE = "storage";
@@ -6055,6 +6051,7 @@
field public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS = "android.settings.ACCESSIBILITY_DETAILS_SETTINGS";
field public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
field public static final String ACTION_LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS = "android.settings.LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS";
+ field public static final String ACTION_MANAGE_DOMAIN_URLS = "android.settings.MANAGE_DOMAIN_URLS";
field public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
field public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
}
diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java
index 3ecb587..bcd43a2 100644
--- a/core/java/android/app/KeyguardManager.java
+++ b/core/java/android/app/KeyguardManager.java
@@ -440,7 +440,7 @@
*/
public boolean isKeyguardSecure() {
try {
- return mWM.isKeyguardSecure();
+ return mWM.isKeyguardSecure(mContext.getUserId());
} catch (RemoteException ex) {
return false;
}
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index cc73786..7bd0fe2 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -216,6 +216,15 @@
public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
/**
+ * Namespace for system scheduler related features. These features will be applied
+ * immediately upon change.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String NAMESPACE_SCHEDULER = "scheduler";
+
+ /**
* Namespace for System UI related features.
*
* @hide
@@ -302,25 +311,6 @@
String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
}
- /**
- * Namespace for system scheduler related features. These features will be applied
- * immediately upon change.
- *
- * @hide
- */
- @SystemApi
- public interface Scheduler {
- String NAMESPACE = "scheduler";
-
- /**
- * Flag for enabling fast metrics collection in system scheduler.
- * A flag value of '' or '0' means the fast metrics collection is not
- * enabled. Otherwise fast metrics collection is enabled and flag value
- * is the order id.
- */
- String ENABLE_FAST_METRICS_COLLECTION = "enable_fast_metrics_collection";
- }
-
private static final Object sLock = new Object();
@GuardedBy("sLock")
private static ArrayMap<OnPropertyChangedListener, Pair<String, Executor>> sSingleListeners =
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 313384d..dd38373 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1696,6 +1696,19 @@
public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE =
"android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
+ /**
+ * Activity Action: Show screen that let user manage how Android handles URL resolution.
+ * <p>
+ * Input: Nothing.
+ * <p>
+ * Output: Nothing
+ *
+ * @hide
+ */
+ @SystemApi
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_MANAGE_DOMAIN_URLS = "android.settings.MANAGE_DOMAIN_URLS";
+
// End of Intent actions for Settings
/**
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index e32c4e1..9ee6585 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -129,7 +129,7 @@
@UnsupportedAppUsage
boolean isKeyguardLocked();
@UnsupportedAppUsage
- boolean isKeyguardSecure();
+ boolean isKeyguardSecure(int userId);
void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message);
// Requires INTERACT_ACROSS_USERS_FULL permission
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java
index 2d7e179..6129b38 100644
--- a/core/java/android/view/InsetsState.java
+++ b/core/java/android/view/InsetsState.java
@@ -145,7 +145,14 @@
// TODO: set system gesture insets based on actual system gesture area.
typeInsetsMap[Type.indexOf(Type.systemGestures())] = Insets.of(legacyContentInsets);
- typeMaxInsetsMap[Type.indexOf(Type.systemGestures())] = Insets.of(legacyContentInsets);
+ typeInsetsMap[Type.indexOf(Type.mandatorySystemGestures())] =
+ Insets.of(legacyContentInsets);
+ typeInsetsMap[Type.indexOf(Type.tappableElement())] = Insets.of(legacyContentInsets);
+
+ typeMaxInsetsMap[Type.indexOf(Type.systemGestures())] = Insets.of(legacyStableInsets);
+ typeMaxInsetsMap[Type.indexOf(Type.mandatorySystemGestures())] =
+ Insets.of(legacyStableInsets);
+ typeMaxInsetsMap[Type.indexOf(Type.tappableElement())] = Insets.of(legacyStableInsets);
}
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
InsetsSource source = mSources.get(type);
diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java
index f1a992c..aac0e34 100644
--- a/core/java/android/view/WindowInsets.java
+++ b/core/java/android/view/WindowInsets.java
@@ -20,14 +20,18 @@
import static android.view.WindowInsets.Type.FIRST;
import static android.view.WindowInsets.Type.IME;
import static android.view.WindowInsets.Type.LAST;
+import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES;
import static android.view.WindowInsets.Type.SIDE_BARS;
import static android.view.WindowInsets.Type.SIZE;
import static android.view.WindowInsets.Type.SYSTEM_GESTURES;
+import static android.view.WindowInsets.Type.TAPPABLE_ELEMENT;
import static android.view.WindowInsets.Type.TOP_BAR;
import static android.view.WindowInsets.Type.all;
import static android.view.WindowInsets.Type.compatSystemInsets;
import static android.view.WindowInsets.Type.indexOf;
+import static android.view.WindowInsets.Type.mandatorySystemGestures;
import static android.view.WindowInsets.Type.systemGestures;
+import static android.view.WindowInsets.Type.tappableElement;
import android.annotation.IntDef;
import android.annotation.IntRange;
@@ -223,6 +227,8 @@
assignCompatInsets(typeInsetMap, insets);
// TODO: set system gesture insets based on actual system gesture area.
typeInsetMap[indexOf(systemGestures())] = Insets.of(insets);
+ typeInsetMap[indexOf(mandatorySystemGestures())] = Insets.of(insets);
+ typeInsetMap[indexOf(tappableElement())] = Insets.of(insets);
return typeInsetMap;
}
@@ -639,15 +645,22 @@
* priority and may consume some or all touch input, e.g. due to the a system bar
* occupying it, or it being reserved for touch-only gestures.
*
+ * <p>An app can declare priority over system gestures with
+ * {@link View#setSystemGestureExclusionRects} outside of the
+ * {@link #getMandatorySystemGestureInsets() mandatory system gesture insets}.
+ *
* <p>Simple taps are guaranteed to reach the window even within the system gesture insets,
- * as long as they are outside the {@link #getSystemWindowInsets() system window insets}.
+ * as long as they are outside the {@link #getTappableElementInsets() system window insets}.
*
* <p>When {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} is requested, an inset will be returned
* even when the system gestures are inactive due to
* {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN} or
* {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.
*
- * <p>This inset does not affect the result of {@link #isConsumed()} and cannot be consumed.
+ * <p>This inset is consumed together with the {@link #getSystemWindowInsets()
+ * system window insets} by {@link #consumeSystemWindowInsets()}.
+ *
+ * @see #getMandatorySystemGestureInsets
*/
@NonNull
public Insets getSystemGestureInsets() {
@@ -655,6 +668,60 @@
}
/**
+ * Returns the mandatory system gesture insets.
+ *
+ * <p>The mandatory system gesture insets represent the area of a window where mandatory system
+ * gestures have priority and may consume some or all touch input, e.g. due to the a system bar
+ * occupying it, or it being reserved for touch-only gestures.
+ *
+ * <p>In contrast to {@link #getSystemGestureInsets regular system gestures}, <b>mandatory</b>
+ * system gestures cannot be overriden by {@link View#setSystemGestureExclusionRects}.
+ *
+ * <p>Simple taps are guaranteed to reach the window even within the system gesture insets,
+ * as long as they are outside the {@link #getTappableElementInsets() system window insets}.
+ *
+ * <p>When {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} is requested, an inset will be returned
+ * even when the system gestures are inactive due to
+ * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN} or
+ * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.
+ *
+ * <p>This inset is consumed together with the {@link #getSystemWindowInsets()
+ * system window insets} by {@link #consumeSystemWindowInsets()}.
+ *
+ * @see #getSystemGestureInsets
+ */
+ @NonNull
+ public Insets getMandatorySystemGestureInsets() {
+ return getInsets(mTypeInsetsMap, MANDATORY_SYSTEM_GESTURES);
+ }
+
+ /**
+ * Returns the tappable element insets.
+ *
+ * <p>The tappable element insets represent how much tappable elements <b>must at least</b> be
+ * inset to remain both tappable and visually unobstructed by persistent system windows.
+ *
+ * <p>This may be smaller than {@link #getSystemWindowInsets()} if the system window is
+ * largely transparent and lets through simple taps (but not necessarily more complex gestures).
+ *
+ * <p>Note that generally, tappable elements <strong>should</strong> be aligned with the
+ * {@link #getSystemWindowInsets() system window insets} instead to avoid overlapping with the
+ * system bars.
+ *
+ * <p>When {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} is requested, an inset will be returned
+ * even when the area covered by the inset would be tappable due to
+ * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN} or
+ * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.
+ *
+ * <p>This inset is consumed together with the {@link #getSystemWindowInsets()
+ * system window insets} by {@link #consumeSystemWindowInsets()}.
+ */
+ @NonNull
+ public Insets getTappableElementInsets() {
+ return getInsets(mTypeInsetsMap, TAPPABLE_ELEMENT);
+ }
+
+ /**
* Returns a copy of this WindowInsets with the stable insets fully consumed.
*
* @return A modified copy of this WindowInsets
@@ -895,6 +962,41 @@
}
/**
+ * Sets mandatory system gesture insets in pixels.
+ *
+ * <p>The mandatory system gesture insets represent the area of a window where mandatory
+ * system gestures have priority and may consume some or all touch input, e.g. due to the a
+ * system bar occupying it, or it being reserved for touch-only gestures.
+ *
+ * <p>In contrast to {@link #setSystemGestureInsets regular system gestures},
+ * <b>mandatory</b> system gestures cannot be overriden by
+ * {@link View#setSystemGestureExclusionRects}.
+ *
+ * @see #getMandatorySystemGestureInsets()
+ * @return itself
+ */
+ @NonNull
+ public Builder setMandatorySystemGestureInsets(@NonNull Insets insets) {
+ WindowInsets.setInsets(mTypeInsetsMap, MANDATORY_SYSTEM_GESTURES, insets);
+ return this;
+ }
+
+ /**
+ * Sets tappable element insets in pixels.
+ *
+ * <p>The tappable element insets represent how much tappable elements <b>must at least</b>
+ * be inset to remain both tappable and visually unobstructed by persistent system windows.
+ *
+ * @see #getTappableElementInsets()
+ * @return itself
+ */
+ @NonNull
+ public Builder setTappableElementInsets(@NonNull Insets insets) {
+ WindowInsets.setInsets(mTypeInsetsMap, TAPPABLE_ELEMENT, insets);
+ return this;
+ }
+
+ /**
* Sets the insets of a specific window type in pixels.
*
* <p>The insets represents the area of a a window that is partially or fully obscured by
@@ -1041,16 +1143,18 @@
*/
public static final class Type {
- static final int FIRST = 0x1;
+ static final int FIRST = 1 << 0;
static final int TOP_BAR = FIRST;
- static final int IME = 0x2;
- static final int SIDE_BARS = 0x4;
+ static final int IME = 1 << 1;
+ static final int SIDE_BARS = 1 << 2;
- static final int SYSTEM_GESTURES = 0x8;
+ static final int SYSTEM_GESTURES = 1 << 3;
+ static final int MANDATORY_SYSTEM_GESTURES = 1 << 4;
+ static final int TAPPABLE_ELEMENT = 1 << 5;
- static final int LAST = 0x10;
- static final int SIZE = 5;
+ static final int LAST = 1 << 6;
+ static final int SIZE = 7;
static final int WINDOW_DECOR = LAST;
static int indexOf(@InsetType int type) {
@@ -1063,8 +1167,12 @@
return 2;
case SYSTEM_GESTURES:
return 3;
- case WINDOW_DECOR:
+ case MANDATORY_SYSTEM_GESTURES:
return 4;
+ case TAPPABLE_ELEMENT:
+ return 5;
+ case WINDOW_DECOR:
+ return 6;
default:
throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST,"
+ " type=" + type);
@@ -1076,7 +1184,8 @@
/** @hide */
@Retention(RetentionPolicy.SOURCE)
- @IntDef(flag = true, value = { TOP_BAR, IME, SIDE_BARS, WINDOW_DECOR, SYSTEM_GESTURES })
+ @IntDef(flag = true, value = { TOP_BAR, IME, SIDE_BARS, WINDOW_DECOR, SYSTEM_GESTURES,
+ MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT})
public @interface InsetType {
}
@@ -1131,6 +1240,20 @@
}
/**
+ * @see #getMandatorySystemGestureInsets
+ */
+ public static @InsetType int mandatorySystemGestures() {
+ return MANDATORY_SYSTEM_GESTURES;
+ }
+
+ /**
+ * @see #getTappableElementInsets
+ */
+ public static @InsetType int tappableElement() {
+ return TAPPABLE_ELEMENT;
+ }
+
+ /**
* @return All system bars. Includes {@link #topBar()} as well as {@link #sideBars()}, but
* not {@link #ime()}.
*/
diff --git a/media/apex/java/android/media/MediaPlayer2.java b/media/apex/java/android/media/MediaPlayer2.java
index 5cd3621..fbe184b 100644
--- a/media/apex/java/android/media/MediaPlayer2.java
+++ b/media/apex/java/android/media/MediaPlayer2.java
@@ -3463,7 +3463,7 @@
* @param uuid of selected crypto scheme
* @return this
*/
- public Builder setUuid(@NonNull UUID uuid) {
+ public @NonNull Builder setUuid(@NonNull UUID uuid) {
this.mUUID = uuid;
return this;
}
@@ -3480,7 +3480,7 @@
* @param keySetId identifier of a persisted offline key
* @return this
*/
- public Builder setKeySetId(@Nullable byte[] keySetId) {
+ public @NonNull Builder setKeySetId(@Nullable byte[] keySetId) {
this.mKeySetId = keySetId;
return this;
}
@@ -3494,7 +3494,7 @@
* @param initData container-specific DRM initialization data
* @return this
*/
- public Builder setInitData(@Nullable byte[] initData) {
+ public @NonNull Builder setInitData(@Nullable byte[] initData) {
this.mInitData = initData;
return this;
}
@@ -3505,7 +3505,7 @@
* @param mimeType mime type to the content
* @return this
*/
- public Builder setMimeType(@Nullable String mimeType) {
+ public @NonNull Builder setMimeType(@Nullable String mimeType) {
this.mMimeType = mimeType;
return this;
}
@@ -3519,7 +3519,7 @@
* @param keyType type of the key request
* @return this
*/
- public Builder setKeyType(@MediaPlayer2.MediaDrmKeyType int keyType) {
+ public @NonNull Builder setKeyType(@MediaPlayer2.MediaDrmKeyType int keyType) {
this.mKeyType = keyType;
return this;
}
@@ -3531,7 +3531,8 @@
* @param optionalParameters optional parameters to be included in a key request
* @return this
*/
- public Builder setOptionalParameters(@Nullable Map<String, String> optionalParameters) {
+ public @NonNull Builder setOptionalParameters(
+ @Nullable Map<String, String> optionalParameters) {
this.mOptionalParameters = optionalParameters;
return this;
}
@@ -3540,7 +3541,7 @@
* @return an immutable {@link MediaPlayer2.DrmPreparationInfo} representing the
* settings of this builder
*/
- public MediaPlayer2.DrmPreparationInfo build() {
+ public @NonNull MediaPlayer2.DrmPreparationInfo build() {
return new MediaPlayer2.DrmPreparationInfo(mUUID, mKeySetId, mInitData, mMimeType,
mKeyType, mOptionalParameters);
}
@@ -3597,7 +3598,8 @@
* @return a {@link DrmPreparationInfo} object to initialize DRM playback, or null to skip
* DRM initialization
*/
- public DrmPreparationInfo onDrmInfo(MediaPlayer2 mp, DataSourceDesc dsd, DrmInfo drmInfo) {
+ public @Nullable DrmPreparationInfo onDrmInfo(@NonNull MediaPlayer2 mp,
+ @NonNull DataSourceDesc dsd, @NonNull DrmInfo drmInfo) {
return null;
}
@@ -3630,11 +3632,13 @@
* @param request a {@link MediaDrm.KeyRequest} prepared using the
* {@link DrmPreparationInfo} returned from
* {@link #onDrmInfo(MediaPlayer2, DataSourceDesc, DrmInfo)}
- * @return the response to {@code request} (from license server)
+ * @return the response to {@code request} (from license server); returning {@code null} or
+ * throwing an {@link RuntimeException} from this callback would trigger an
+ * {@link EventCallback#onError}.
*/
- public byte[] onDrmKeyRequest(@NonNull MediaPlayer2 mp, @NonNull DataSourceDesc dsd,
- @NonNull MediaDrm.KeyRequest request) {
- return null;
+ public @NonNull byte[] onDrmKeyRequest(@NonNull MediaPlayer2 mp,
+ @NonNull DataSourceDesc dsd, @NonNull MediaDrm.KeyRequest request) {
+ return new byte[0];
}
/**
@@ -4144,7 +4148,7 @@
/**
* Returns the PSSH info of the data source for each supported DRM scheme.
*/
- public Map<UUID, byte[]> getPssh() {
+ public @NonNull Map<UUID, byte[]> getPssh() {
return mMapPssh;
}
@@ -4153,7 +4157,7 @@
* It effectively identifies the subset of the source's DRM schemes which
* are supported by the device too.
*/
- public List<UUID> getSupportedSchemes() {
+ public @NonNull List<UUID> getSupportedSchemes() {
return Arrays.asList(mSupportedSchemes);
}
@@ -4276,7 +4280,7 @@
* Extends MediaDrm.MediaDrmException
*/
public static final class NoDrmSchemeException extends MediaDrmException {
- public NoDrmSchemeException(String detailMessage) {
+ public NoDrmSchemeException(@Nullable String detailMessage) {
super(detailMessage);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
index d06feed..2db7306 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
@@ -61,7 +61,9 @@
@Override
public void onDestroy() {
- mPluginManager.removePluginListener(this);
+ if (mPluginManager != null) {
+ mPluginManager.removePluginListener(this);
+ }
super.onDestroy();
mDozeMachine = null;
}
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 7fab2b96..6ef5b54 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -102,6 +102,7 @@
import com.android.server.location.GeofenceProxy;
import com.android.server.location.GnssBatchingProvider;
import com.android.server.location.GnssLocationProvider;
+import com.android.server.location.GnssMeasurementCorrectionsProvider;
import com.android.server.location.GnssMeasurementsProvider;
import com.android.server.location.GnssNavigationMessageProvider;
import com.android.server.location.GnssStatusListenerHelper;
@@ -195,6 +196,7 @@
private PassiveProvider mPassiveProvider; // track passive provider for special cases
private LocationBlacklist mBlacklist;
private GnssMeasurementsProvider mGnssMeasurementsProvider;
+ private GnssMeasurementCorrectionsProvider mGnssMeasurementCorrectionsProvider;
private GnssNavigationMessageProvider mGnssNavigationMessageProvider;
@GuardedBy("mLock")
private String mLocationControllerExtraPackage;
@@ -309,9 +311,13 @@
AppOpsManager.WATCH_FOREGROUND_CHANGES,
new AppOpsManager.OnOpChangedInternalListener() {
public void onOpChanged(int op, String packageName) {
- synchronized (mLock) {
- onAppOpChangedLocked();
- }
+ // onOpChanged invoked on ui thread, move to our thread to reduce risk of
+ // blocking ui thread
+ mHandler.post(() -> {
+ synchronized (mLock) {
+ onAppOpChangedLocked();
+ }
+ });
}
});
mPackageManager.addOnPermissionsChangeListener(
@@ -757,6 +763,8 @@
mGnssStatusProvider = gnssProvider.getGnssStatusProvider();
mNetInitiatedListener = gnssProvider.getNetInitiatedListener();
mGnssMeasurementsProvider = gnssProvider.getGnssMeasurementsProvider();
+ mGnssMeasurementCorrectionsProvider =
+ gnssProvider.getGnssMeasurementCorrectionsProvider();
mGnssNavigationMessageProvider = gnssProvider.getGnssNavigationMessageProvider();
mGpsGeofenceProxy = gnssProvider.getGpsGeofenceProxy();
}
@@ -2921,22 +2929,28 @@
mContext.enforceCallingPermission(
android.Manifest.permission.LOCATION_HARDWARE,
"Location Hardware permission not granted to inject GNSS measurement corrections.");
- if (!hasGnssPermissions(packageName) || mGnssMeasurementsProvider == null) {
+ if (!hasGnssPermissions(packageName)) {
Slog.e(TAG, "Can not inject GNSS corrections due to no permission.");
- } else {
- mGnssMeasurementsProvider.injectGnssMeasurementCorrections(measurementCorrections);
+ return;
}
+ if (mGnssMeasurementCorrectionsProvider == null) {
+ Slog.e(TAG, "Can not inject GNSS corrections. GNSS measurement corrections provider "
+ + "not available.");
+ return;
+ }
+ mGnssMeasurementCorrectionsProvider.injectGnssMeasurementCorrections(
+ measurementCorrections);
}
@Override
public int getGnssCapabilities(String packageName) {
mContext.enforceCallingPermission(
android.Manifest.permission.LOCATION_HARDWARE,
- "Location Hardware permission not granted to obrain GNSS chipset capabilities.");
- if (!hasGnssPermissions(packageName) || mGnssMeasurementsProvider == null) {
+ "Location Hardware permission not granted to obtain GNSS chipset capabilities.");
+ if (!hasGnssPermissions(packageName) || mGnssMeasurementCorrectionsProvider == null) {
return -1;
}
- return mGnssMeasurementsProvider.getGnssCapabilities();
+ return mGnssMeasurementCorrectionsProvider.getCapabilities();
}
@Override
diff --git a/services/core/java/com/android/server/am/AssistDataRequester.java b/services/core/java/com/android/server/am/AssistDataRequester.java
index 09df7e20..d8d6528 100644
--- a/services/core/java/com/android/server/am/AssistDataRequester.java
+++ b/services/core/java/com/android/server/am/AssistDataRequester.java
@@ -24,6 +24,7 @@
import android.app.ActivityTaskManager;
import android.app.AppOpsManager;
+import android.app.IActivityTaskManager;
import android.app.IAssistDataReceiver;
import android.content.Context;
import android.graphics.Bitmap;
@@ -33,6 +34,7 @@
import android.view.IWindowManager;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import java.io.PrintWriter;
@@ -50,6 +52,8 @@
public static final String KEY_RECEIVER_EXTRA_INDEX = "index";
private IWindowManager mWindowManager;
+ @VisibleForTesting
+ public IActivityTaskManager mActivityTaskManager;
private Context mContext;
private AppOpsManager mAppOpsManager;
@@ -128,6 +132,7 @@
mCallbacks = callbacks;
mCallbacksLock = callbacksLock;
mWindowManager = windowManager;
+ mActivityTaskManager = ActivityTaskManager.getService();
mContext = context;
mAppOpsManager = appOpsManager;
mRequestStructureAppOps = requestStructureAppOps;
@@ -195,8 +200,7 @@
// Ensure that the current activity supports assist data
boolean isAssistDataAllowed = false;
try {
- isAssistDataAllowed =
- ActivityTaskManager.getService().isAssistDataAllowedOnCurrentActivity();
+ isAssistDataAllowed = mActivityTaskManager.isAssistDataAllowedOnCurrentActivity();
} catch (RemoteException e) {
// Should never happen
}
@@ -222,9 +226,9 @@
receiverExtras.putInt(KEY_RECEIVER_EXTRA_INDEX, i);
receiverExtras.putInt(KEY_RECEIVER_EXTRA_COUNT, numActivities);
boolean result = requestAutofillData
- ? ActivityTaskManager.getService().requestAutofillData(this,
+ ? mActivityTaskManager.requestAutofillData(this,
receiverExtras, topActivity, 0 /* flags */)
- : ActivityTaskManager.getService().requestAssistContextExtras(
+ : mActivityTaskManager.requestAssistContextExtras(
ASSIST_CONTEXT_FULL, this, receiverExtras, topActivity,
/* focused= */ i == 0, /* newSessionId= */ i == 0);
if (result) {
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 029c3fb..07c9cca 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -389,14 +389,14 @@
* Step from {@link UserState#STATE_RUNNING_LOCKED} to
* {@link UserState#STATE_RUNNING_UNLOCKING}.
*/
- private void finishUserUnlocking(final UserState uss) {
+ private boolean finishUserUnlocking(final UserState uss) {
final int userId = uss.mHandle.getIdentifier();
// Only keep marching forward if user is actually unlocked
- if (!StorageManager.isUserKeyUnlocked(userId)) return;
+ if (!StorageManager.isUserKeyUnlocked(userId)) return false;
synchronized (mLock) {
// Do not proceed if unexpected state or a stale user
if (mStartedUsers.get(userId) != uss || uss.state != STATE_RUNNING_LOCKED) {
- return;
+ return false;
}
}
uss.mUnlockProgress.start();
@@ -427,6 +427,7 @@
mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0, uss)
.sendToTarget();
});
+ return true;
}
/**
@@ -1209,7 +1210,10 @@
return false;
}
- finishUserUnlocking(uss);
+ if (!finishUserUnlocking(uss)) {
+ notifyFinished(userId, listener);
+ return false;
+ }
// We just unlocked a user, so let's now attempt to unlock any
// managed profiles under that user.
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index c173d66..8249999 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -166,9 +166,15 @@
private static final int GPS_CAPABILITY_MSA = 0x0000004;
private static final int GPS_CAPABILITY_SINGLE_SHOT = 0x0000008;
private static final int GPS_CAPABILITY_ON_DEMAND_TIME = 0x0000010;
- private static final int GPS_CAPABILITY_GEOFENCING = 0x0000020;
+
+ // The following three capability flags are removed in IGnssCallback.hal@2.0 and their values
+ // are marked reserved and not reused in 2.0 to avoid confusion with prior versions.
+ public static final int GPS_CAPABILITY_GEOFENCING = 0x0000020;
public static final int GPS_CAPABILITY_MEASUREMENTS = 0x0000040;
- private static final int GPS_CAPABILITY_NAV_MESSAGES = 0x0000080;
+ public static final int GPS_CAPABILITY_NAV_MESSAGES = 0x0000080;
+
+ private static final int GPS_CAPABILITY_LOW_POWER_MODE = 0x0000100;
+ private static final int GPS_CAPABILITY_SATELLITE_BLACKLIST = 0x0000200;
// The AGPS SUPL mode
private static final int AGPS_SUPL_MODE_MSA = 0x02;
@@ -333,7 +339,7 @@
private boolean mStarted;
// capabilities of the GPS engine
- private int mEngineCapabilities;
+ private volatile int mEngineCapabilities;
// true if XTRA is supported
private boolean mSupportsXtra;
@@ -372,6 +378,7 @@
private final LocationExtras mLocationExtras = new LocationExtras();
private final GnssStatusListenerHelper mGnssStatusListenerHelper;
private final GnssMeasurementsProvider mGnssMeasurementsProvider;
+ private final GnssMeasurementCorrectionsProvider mGnssMeasurementCorrectionsProvider;
private final GnssNavigationMessageProvider mGnssNavigationMessageProvider;
private final LocationChangeListener mNetworkLocationListener = new NetworkLocationListener();
private final LocationChangeListener mFusedLocationListener = new FusedLocationListener();
@@ -437,6 +444,10 @@
return mGnssMeasurementsProvider;
}
+ public GnssMeasurementCorrectionsProvider getGnssMeasurementCorrectionsProvider() {
+ return mGnssMeasurementCorrectionsProvider;
+ }
+
public GnssNavigationMessageProvider getGnssNavigationMessageProvider() {
return mGnssNavigationMessageProvider;
}
@@ -627,6 +638,8 @@
}
};
+ mGnssMeasurementCorrectionsProvider = new GnssMeasurementCorrectionsProvider(mHandler);
+
mGnssNavigationMessageProvider = new GnssNavigationMessageProvider(mContext, mHandler) {
@Override
protected boolean isGpsEnabled() {
@@ -1258,6 +1271,10 @@
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, now + mFixInterval, mWakeupIntent);
}
+ public int getGnssCapabilities() {
+ return mEngineCapabilities;
+ }
+
private boolean hasCapability(int capability) {
return ((mEngineCapabilities & capability) != 0);
}
@@ -1467,22 +1484,27 @@
}
@NativeEntryPoint
- private void setEngineCapabilities(final int capabilities) {
+ private void setEngineCapabilities(final int capabilities, boolean hasSubHalCapabilityFlags) {
// send to handler thread for fast native return, and in-order handling
- mHandler.post(
- () -> {
- mEngineCapabilities = capabilities;
+ mHandler.post(() -> {
+ mEngineCapabilities = capabilities;
- if (hasCapability(GPS_CAPABILITY_ON_DEMAND_TIME)) {
- mNtpTimeHelper.enablePeriodicTimeInjection();
- requestUtcTime();
- }
+ if (hasCapability(GPS_CAPABILITY_ON_DEMAND_TIME)) {
+ mNtpTimeHelper.enablePeriodicTimeInjection();
+ requestUtcTime();
+ }
- mGnssMeasurementsProvider.onCapabilitiesUpdated(capabilities);
- mGnssNavigationMessageProvider.onCapabilitiesUpdated(
- hasCapability(GPS_CAPABILITY_NAV_MESSAGES));
- restartRequests();
- });
+ mGnssMeasurementsProvider.onCapabilitiesUpdated(capabilities, hasSubHalCapabilityFlags);
+ mGnssNavigationMessageProvider.onCapabilitiesUpdated(capabilities,
+ hasSubHalCapabilityFlags);
+ restartRequests();
+ });
+ }
+
+ @NativeEntryPoint
+ private void setMeasurementCorrectionsCapabilities(final int capabilities) {
+ mHandler.post(() -> mGnssMeasurementCorrectionsProvider.onCapabilitiesUpdated(
+ capabilities));
}
private void restartRequests() {
@@ -2122,7 +2144,23 @@
if (hasCapability(GPS_CAPABILITY_GEOFENCING)) s.append("GEOFENCING ");
if (hasCapability(GPS_CAPABILITY_MEASUREMENTS)) s.append("MEASUREMENTS ");
if (hasCapability(GPS_CAPABILITY_NAV_MESSAGES)) s.append("NAV_MESSAGES ");
+ if (hasCapability(GPS_CAPABILITY_LOW_POWER_MODE)) s.append("LOW_POWER_MODE ");
+ if (hasCapability(GPS_CAPABILITY_SATELLITE_BLACKLIST)) s.append("SATELLITE_BLACKLIST ");
s.append(")\n");
+ if (mGnssGeofenceProvider.isHardwareGeofenceSupported()) {
+ s.append(" hasSubHal=GEOFENCING\n");
+ }
+ if (mGnssMeasurementsProvider.isAvailableInPlatform()) {
+ s.append(" hasSubHal=MEASUREMENTS\n");
+ }
+ if (mGnssNavigationMessageProvider.isAvailableInPlatform()) {
+ s.append(" hasSubHal=NAV_MESSAGES\n");
+ }
+ if (mGnssMeasurementCorrectionsProvider.isAvailableInPlatform()) {
+ s.append(" hasSubHal=MEASUREMENT_CORRECTIONS [");
+ s.append(mGnssMeasurementCorrectionsProvider.toStringCapabilities());
+ s.append("]\n");
+ }
s.append(mGnssMetrics.dumpGnssMetricsAsText());
s.append(" native internal state: ").append(native_get_internal_state());
s.append("\n");
diff --git a/services/core/java/com/android/server/location/GnssMeasurementCorrectionsProvider.java b/services/core/java/com/android/server/location/GnssMeasurementCorrectionsProvider.java
new file mode 100644
index 0000000..2162787
--- /dev/null
+++ b/services/core/java/com/android/server/location/GnssMeasurementCorrectionsProvider.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.location;
+
+import android.location.GnssMeasurementCorrections;
+import android.os.Handler;
+import android.util.Log;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+/**
+ * Manages GNSS measurement corrections.
+ *
+ * <p>Implements the framework side of the GNSS HAL interfaces {@code IMeasurementCorrections.hal}
+ * and {@code IMeasurementCorrectionsCallback.hal).
+ *
+ * @hide
+ */
+public class GnssMeasurementCorrectionsProvider {
+ private static final String TAG = "GnssMeasurementCorrectionsProvider";
+
+ // These must match with the Capabilities enum in IMeasurementCorrectionsCallback.hal.
+ private static final int CAPABILITY_LOS_SATS = 0x0000001;
+ private static final int CAPABILITY_EXCESS_PATH_LENGTH = 0x0000002;
+ private static final int CAPABILITY_REFLECTING_PLANE = 0x0000004;
+
+ private static final int INVALID_CAPABILITIES = 1 << 31;
+
+ private final Handler mHandler;
+ private final GnssMeasurementCorrectionsProviderNative mNative;
+ private volatile int mCapabilities = INVALID_CAPABILITIES;
+
+ GnssMeasurementCorrectionsProvider(Handler handler) {
+ this(handler, new GnssMeasurementCorrectionsProviderNative());
+ }
+
+ @VisibleForTesting
+ GnssMeasurementCorrectionsProvider(Handler handler,
+ GnssMeasurementCorrectionsProviderNative aNative) {
+ mHandler = handler;
+ mNative = aNative;
+ }
+
+ /**
+ * Returns {@code true} if the GNSS HAL implementation supports measurement corrections.
+ */
+ public boolean isAvailableInPlatform() {
+ return mNative.isMeasurementCorrectionsSupported();
+ }
+
+ /**
+ * Injects GNSS measurement corrections into the GNSS chipset.
+ *
+ * @param measurementCorrections a {@link GnssMeasurementCorrections} object with the GNSS
+ * measurement corrections to be injected into the GNSS chipset.
+ */
+ public void injectGnssMeasurementCorrections(
+ GnssMeasurementCorrections measurementCorrections) {
+ if (!isCapabilitiesReceived()) {
+ Log.w(TAG, "Failed to inject GNSS measurement corrections. Capabilities "
+ + "not received yet.");
+ return;
+ }
+ mHandler.post(() -> {
+ if (!mNative.injectGnssMeasurementCorrections(measurementCorrections)) {
+ Log.e(TAG, "Failure in injecting GNSS corrections.");
+ }
+ });
+ }
+
+ /** Handle measurement corrections capabilities update from the GNSS HAL implementation. */
+ void onCapabilitiesUpdated(int capabilities) {
+ if (hasCapability(capabilities, CAPABILITY_LOS_SATS) || hasCapability(capabilities,
+ CAPABILITY_EXCESS_PATH_LENGTH)) {
+ mCapabilities = capabilities;
+ } else {
+ Log.e(TAG, "Failed to set capabilities. Received capabilities 0x"
+ + Integer.toHexString(capabilities) + " does not contain the mandatory "
+ + "LOS_SATS or the EXCESS_PATH_LENGTH capability.");
+ }
+ }
+
+ /**
+ * Returns the measurement corrections specific capabilities of the GNSS HAL implementation.
+ */
+ public int getCapabilities() {
+ return mCapabilities;
+ }
+
+ /**
+ * Returns the string representation of the GNSS measurement capabilities.
+ */
+ String toStringCapabilities() {
+ final int capabilities = getCapabilities();
+ StringBuilder s = new StringBuilder();
+ s.append("mCapabilities=0x").append(Integer.toHexString(capabilities));
+ s.append(" ( ");
+ if (hasCapability(capabilities, CAPABILITY_LOS_SATS)) {
+ s.append("LOS_SATS ");
+ }
+ if (hasCapability(capabilities, CAPABILITY_EXCESS_PATH_LENGTH)) {
+ s.append("EXCESS_PATH_LENGTH ");
+ }
+ if (hasCapability(capabilities, CAPABILITY_REFLECTING_PLANE)) {
+ s.append("REFLECTING_PLANE ");
+ }
+ s.append(")");
+ return s.toString();
+ }
+
+ private boolean isCapabilitiesReceived() {
+ return mCapabilities != INVALID_CAPABILITIES;
+ }
+
+ private static boolean hasCapability(int halCapabilities, int capability) {
+ return (halCapabilities & capability) != 0;
+ }
+
+ @VisibleForTesting
+ static class GnssMeasurementCorrectionsProviderNative {
+ public boolean isMeasurementCorrectionsSupported() {
+ return native_is_measurement_corrections_supported();
+ }
+
+ public boolean injectGnssMeasurementCorrections(
+ GnssMeasurementCorrections measurementCorrections) {
+ return native_inject_gnss_measurement_corrections(measurementCorrections);
+ }
+ }
+
+ private static native boolean native_is_measurement_corrections_supported();
+
+ private static native boolean native_inject_gnss_measurement_corrections(
+ GnssMeasurementCorrections measurementCorrections);
+}
diff --git a/services/core/java/com/android/server/location/GnssMeasurementsProvider.java b/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
index 1fc7192..844735a 100644
--- a/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
+++ b/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
@@ -11,13 +11,12 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License
+ * limitations under the License.
*/
package com.android.server.location;
import android.content.Context;
-import android.location.GnssMeasurementCorrections;
import android.location.GnssMeasurementsEvent;
import android.location.IGnssMeasurementsListener;
import android.os.Handler;
@@ -42,7 +41,6 @@
private boolean mIsCollectionStarted;
private boolean mEnableFullTracking;
- private int mGnssEngineCapabilities;
protected GnssMeasurementsProvider(Context context, Handler handler) {
this(context, handler, new GnssMeasurementProviderNative());
@@ -87,21 +85,6 @@
}
}
- /**
- * Injects GNSS measurement corrections into the GNSS chipset.
- *
- * @param measurementCorrections a {@link GnssMeasurementCorrections} object with the GNSS
- * measurement corrections to be injected into the GNSS chipset.
- */
- public void injectGnssMeasurementCorrections(
- GnssMeasurementCorrections measurementCorrections) {
- mHandler.post(() -> {
- if (!mNative.injectGnssMeasurementCorrections(measurementCorrections)) {
- Log.e(TAG, "Failure in injecting GNSS corrections.");
- }
- });
- }
-
@Override
protected void unregisterFromService() {
boolean stopped = mNative.stopMeasurementCollection();
@@ -121,20 +104,20 @@
});
}
- /** Updates the framework about the capabilities of the GNSS chipset */
- public void onCapabilitiesUpdated(int capabilities) {
- mGnssEngineCapabilities = capabilities;
- boolean isGnssMeasurementsSupported =
- (capabilities & GnssLocationProvider.GPS_CAPABILITY_MEASUREMENTS) != 0;
+ /** Handle GNSS capabilities update from the GNSS HAL implementation. */
+ public void onCapabilitiesUpdated(int capabilities, boolean hasSubHalCapabilityFlags) {
+ // The IGnssCallback.hal@2.0 removed sub-HAL capability flags from the Capabilities enum
+ // and instead uses the sub-HAL non-null handle returned from IGnss.hal@2.0 to indicate
+ // support. Therefore, the 'hasSubHalCapabilityFlags' parameter is needed to tell if the
+ // 'capabilities' parameter includes the sub-HAL capability flags or not. Old HALs
+ // which explicitly set the sub-HAL capability bits must continue to work.
+ final boolean isGnssMeasurementsSupported = hasSubHalCapabilityFlags
+ ? (capabilities & GnssLocationProvider.GPS_CAPABILITY_MEASUREMENTS) != 0
+ : mNative.isMeasurementSupported();
setSupported(isGnssMeasurementsSupported);
updateResult();
}
- /** Obtains the GNSS engine capabilities. */
- public int getGnssCapabilities() {
- return mGnssEngineCapabilities;
- }
-
public void onGpsEnabledChanged() {
tryUpdateRegistrationWithService();
updateResult();
@@ -195,11 +178,6 @@
public boolean stopMeasurementCollection() {
return native_stop_measurement_collection();
}
-
- public boolean injectGnssMeasurementCorrections(
- GnssMeasurementCorrections measurementCorrections) {
- return native_inject_gnss_measurement_corrections(measurementCorrections);
- }
}
private static native boolean native_is_measurement_supported();
@@ -207,7 +185,4 @@
private static native boolean native_start_measurement_collection(boolean enableFullTracking);
private static native boolean native_stop_measurement_collection();
-
- private static native boolean native_inject_gnss_measurement_corrections(
- GnssMeasurementCorrections measurementCorrections);
}
diff --git a/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java b/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
index 80a3f9b..7e8b599 100644
--- a/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
+++ b/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
@@ -11,7 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License
+ * limitations under the License.
*/
package com.android.server.location;
@@ -51,7 +51,6 @@
mNative = aNative;
}
- // TODO(b/37460011): Use this with death recovery logic.
void resumeIfStarted() {
if (DEBUG) {
Log.d(TAG, "resumeIfStarted");
@@ -92,7 +91,16 @@
);
}
- public void onCapabilitiesUpdated(boolean isGnssNavigationMessageSupported) {
+ /** Handle GNSS capabilities update from the GNSS HAL implementation */
+ public void onCapabilitiesUpdated(int capabilities, boolean hasSubHalCapabilityFlags) {
+ // The IGnssCallback.hal@2.0 removed sub-HAL capability flags from the Capabilities enum
+ // and instead uses the sub-HAL non-null handle returned from IGnss.hal@2.0 to indicate
+ // support. Therefore, the 'hasSubHalCapabilityFlags' parameter is needed to tell if the
+ // 'capabilities' parameter includes the sub-HAL capability flags or not. Old HALs
+ // which explicitly set the sub-HAL capability bits must continue to work.
+ final boolean isGnssNavigationMessageSupported = hasSubHalCapabilityFlags
+ ? (capabilities & GnssLocationProvider.GPS_CAPABILITY_NAV_MESSAGES) != 0
+ : mNative.isNavigationMessageSupported();
setSupported(isGnssNavigationMessageSupported);
updateResult();
}
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index aced1a2..459de1a 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -2693,6 +2693,7 @@
// seinfo - seinfo label for the app (assigned at install time)
// gids - supplementary gids this app launches with
// profileableFromShellFlag - 0 or 1 if the package is profileable from shell.
+ // longVersionCode - integer version of the package.
//
// NOTE: We prefer not to expose all ApplicationInfo flags for now.
//
@@ -2720,6 +2721,8 @@
}
sb.append(" ");
sb.append(ai.isProfileableByShell() ? "1" : "0");
+ sb.append(" ");
+ sb.append(String.valueOf(ai.longVersionCode));
sb.append("\n");
writer.append(sb);
}
diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java
index 8c8b05f..72a1a2f 100644
--- a/services/core/java/com/android/server/wm/KeyguardController.java
+++ b/services/core/java/com/android/server/wm/KeyguardController.java
@@ -269,7 +269,8 @@
* @return True if we may show an activity while Keyguard is occluded, false otherwise.
*/
boolean canShowWhileOccluded(boolean dismissKeyguard, boolean showWhenLocked) {
- return showWhenLocked || dismissKeyguard && !mWindowManager.isKeyguardSecure();
+ return showWhenLocked || dismissKeyguard
+ && !mWindowManager.isKeyguardSecure(mService.getCurrentUserId());
}
private void visibilitiesUpdated() {
@@ -317,7 +318,7 @@
// We only allow dismissing Keyguard via the flag when Keyguard is secure for legacy
// reasons, because that's how apps used to dismiss Keyguard in the secure case. In the
// insecure case, we actually show it on top of the lockscreen. See #canShowWhileOccluded.
- if (!mWindowManager.isKeyguardSecure()) {
+ if (!mWindowManager.isKeyguardSecure(mService.getCurrentUserId())) {
return;
}
@@ -345,7 +346,8 @@
* @return true if Keyguard can be currently dismissed without entering credentials.
*/
boolean canDismissKeyguard() {
- return mWindowManager.isKeyguardTrusted() || !mWindowManager.isKeyguardSecure();
+ return mWindowManager.isKeyguardTrusted()
+ || !mWindowManager.isKeyguardSecure(mService.getCurrentUserId());
}
private int resolveOccludeTransit() {
@@ -487,7 +489,8 @@
}
if (lastDismissActivity != mDismissingKeyguardActivity && !mOccluded
&& mDismissingKeyguardActivity != null
- && controller.mWindowManager.isKeyguardSecure()) {
+ && controller.mWindowManager.isKeyguardSecure(
+ controller.mService.getCurrentUserId())) {
mRequestDismissKeyguard = true;
}
}
diff --git a/services/core/java/com/android/server/wm/LockTaskController.java b/services/core/java/com/android/server/wm/LockTaskController.java
index e6e6275..2411e00 100644
--- a/services/core/java/com/android/server/wm/LockTaskController.java
+++ b/services/core/java/com/android/server/wm/LockTaskController.java
@@ -762,7 +762,7 @@
} else {
// If keyguard is not secure and it is locked, dismiss the keyguard before
// disabling it, which avoids the platform to think the keyguard is still on.
- if (mWindowManager.isKeyguardLocked() && !mWindowManager.isKeyguardSecure()) {
+ if (mWindowManager.isKeyguardLocked() && !mWindowManager.isKeyguardSecure(userId)) {
mPendingDisableFromDismiss = userId;
mWindowManager.dismissKeyguard(new IKeyguardDismissCallback.Stub() {
@Override
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index a6c9257..4a9d798f 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2868,8 +2868,13 @@
}
@Override
- public boolean isKeyguardSecure() {
- int userId = UserHandle.getCallingUserId();
+ public boolean isKeyguardSecure(int userId) {
+ if (userId != UserHandle.getCallingUserId()
+ && !checkCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS,
+ "isKeyguardSecure")) {
+ throw new SecurityException("Requires INTERACT_ACROSS_USERS permission");
+ }
+
long origId = Binder.clearCallingIdentity();
try {
return mPolicy.isKeyguardSecure(userId);
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 050a079..00b815a 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -109,6 +109,7 @@
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
+ "android.hardware.gnss.measurement_corrections@1.0",
"android.hardware.gnss.visibility_control@1.0",
"android.hardware.input.classifier@1.0",
"android.hardware.ir@1.0",
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index caba3af..a4955f0 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -71,6 +71,7 @@
static jmethodID method_reportNavigationMessages;
static jmethodID method_reportLocationBatch;
static jmethodID method_reportGnssServiceDied;
+static jmethodID method_setMeasurementCorrectionsCapabilities;
static jmethodID method_correctionsGetLatitudeDegrees;
static jmethodID method_correctionsGetLongitudeDegrees;
static jmethodID method_correctionsGetAltitudeMeters;
@@ -158,10 +159,9 @@
using IAGnssCallback_V1_0 = android::hardware::gnss::V1_0::IAGnssCallback;
using IAGnssCallback_V2_0 = android::hardware::gnss::V2_0::IAGnssCallback;
-using IMeasurementCorrections =
- android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections;
-using GnssSingleSatCorrectionFlags =
- android::hardware::gnss::measurement_corrections::V1_0::GnssSingleSatCorrectionFlags;
+using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections;
+using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback;
+using android::hardware::gnss::measurement_corrections::V1_0::GnssSingleSatCorrectionFlags;
using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback;
@@ -201,7 +201,6 @@
sp<IGnssMeasurement_V2_0> gnssMeasurementIface_V2_0 = nullptr;
sp<IGnssNavigationMessage> gnssNavigationMessageIface = nullptr;
sp<IMeasurementCorrections> gnssCorrectionsIface = nullptr;
-
sp<IGnssVisibilityControl> gnssVisibilityControlIface = nullptr;
#define WAKE_LOCK_NAME "GPS"
@@ -572,7 +571,9 @@
template <class T>
Return<void> gnssLocationCbImpl(const T& location);
- // TODO(b/73306084): Reconsider allocation cost vs threadsafety on these statics
+ Return<void> gnssSetCapabilitesCbImpl(uint32_t capabilities, bool hasSubHalCapabilityFlags);
+
+ // TODO: Reconsider allocation cost vs threadsafety on these statics
static const char* sNmeaString;
static size_t sNmeaStringLength;
};
@@ -694,16 +695,29 @@
}
Return<void> GnssCallback::gnssSetCapabilitesCb(uint32_t capabilities) {
- ALOGD("%s: %du\n", __func__, capabilities);
-
- JNIEnv* env = getJniEnv();
- env->CallVoidMethod(mCallbacksObj, method_setEngineCapabilities, capabilities);
- checkAndClearExceptionFromCallback(env, __FUNCTION__);
- return Void();
+ return GnssCallback::gnssSetCapabilitesCbImpl(capabilities,
+ /* hasSubHalCapabilityFlags = */ true);
}
Return<void> GnssCallback::gnssSetCapabilitiesCb_2_0(uint32_t capabilities) {
- return GnssCallback::gnssSetCapabilitesCb(capabilities);
+ return GnssCallback::gnssSetCapabilitesCbImpl(capabilities,
+ /* hasSubHalCapabilityFlags = */ false);
+}
+
+Return <void> GnssCallback::gnssSetCapabilitesCbImpl(uint32_t capabilities,
+ bool hasSubHalCapabilityFlags) {
+ // The IGnssCallback.hal@2.0 removed sub-HAL capability flags from the Capabilities enum
+ // and instead uses the sub-HAL non-null handle returned from IGnss.hal@2.0 to indicate
+ // support. Therefore, the 'hasSubHalCapabilityFlags' parameter is needed to tell if the
+ // 'capabilities' parameter includes the sub-HAL capability flags or not. Old HALs
+ // which explicitly set the sub-HAL capability bits must continue to work.
+ ALOGD("%s: capabilities=%du, hasSubHalCapabilityFlags=%d\n", __func__, capabilities,
+ hasSubHalCapabilityFlags);
+ JNIEnv* env = getJniEnv();
+ env->CallVoidMethod(mCallbacksObj, method_setEngineCapabilities, capabilities,
+ boolToJbool(hasSubHalCapabilityFlags));
+ checkAndClearExceptionFromCallback(env, __FUNCTION__);
+ return Void();
}
Return<void> GnssCallback::gnssAcquireWakelockCb() {
@@ -1153,6 +1167,22 @@
}
/*
+ * MeasurementCorrectionsCallback implements callback methods of interface
+ * IMeasurementCorrectionsCallback.hal.
+ */
+struct MeasurementCorrectionsCallback : public IMeasurementCorrectionsCallback {
+ Return<void> setCapabilitiesCb(uint32_t capabilities) override;
+};
+
+Return<void> MeasurementCorrectionsCallback::setCapabilitiesCb(uint32_t capabilities) {
+ ALOGD("%s: %du\n", __func__, capabilities);
+ JNIEnv* env = getJniEnv();
+ env->CallVoidMethod(mCallbacksObj, method_setMeasurementCorrectionsCapabilities, capabilities);
+ checkAndClearExceptionFromCallback(env, __FUNCTION__);
+ return Void();
+}
+
+/*
* GnssNiCallback implements callback methods required by the IGnssNi interface.
*/
struct GnssNiCallback : public IGnssNiCallback {
@@ -1434,7 +1464,7 @@
method_reportSvStatus = env->GetMethodID(clazz, "reportSvStatus", "(I[I[F[F[F[F)V");
method_reportAGpsStatus = env->GetMethodID(clazz, "reportAGpsStatus", "(II[B)V");
method_reportNmea = env->GetMethodID(clazz, "reportNmea", "(J)V");
- method_setEngineCapabilities = env->GetMethodID(clazz, "setEngineCapabilities", "(I)V");
+ method_setEngineCapabilities = env->GetMethodID(clazz, "setEngineCapabilities", "(IZ)V");
method_setGnssYearOfHardware = env->GetMethodID(clazz, "setGnssYearOfHardware", "(I)V");
method_setGnssHardwareModelName = env->GetMethodID(clazz, "setGnssHardwareModelName",
"(Ljava/lang/String;)V");
@@ -1474,6 +1504,9 @@
"(Ljava/lang/String;BLjava/lang/String;BLjava/lang/String;BZZ)V");
method_isInEmergencySession = env->GetMethodID(clazz, "isInEmergencySession", "()Z");
+ method_setMeasurementCorrectionsCapabilities = env->GetMethodID(clazz,
+ "setMeasurementCorrectionsCapabilities", "(I)V");
+
jclass measCorrClass = env->FindClass("android/location/GnssMeasurementCorrections");
method_correctionsGetLatitudeDegrees = env->GetMethodID(
measCorrClass,"getLatitudeDegrees", "()D");
@@ -1591,7 +1624,7 @@
}
if (gnssHal_V2_0 != nullptr) {
- // TODO(b/119638366): getExtensionGnssMeasurement_1_1 from gnssHal_V2_0
+ // TODO: getExtensionGnssMeasurement_1_1 from gnssHal_V2_0
auto gnssMeasurement = gnssHal_V2_0->getExtensionGnssMeasurement_2_0();
if (!gnssMeasurement.isOk()) {
ALOGD("Unable to get a handle to GnssMeasurement_V2_0");
@@ -1795,6 +1828,12 @@
gnssVisibilityControlIface->setCallback(gnssVisibilityControlCbIface);
}
+ if (gnssCorrectionsIface != nullptr) {
+ sp<IMeasurementCorrectionsCallback> gnssCorrectionsIfaceCbIface =
+ new MeasurementCorrectionsCallback();
+ gnssCorrectionsIface->setCallback(gnssCorrectionsIfaceCbIface);
+ }
+
return JNI_TRUE;
}
@@ -2154,7 +2193,7 @@
jobject /* obj */) {
jstring result = nullptr;
/*
- * TODO(b/33089503) : Create a jobject to represent GnssDebug.
+ * TODO: Create a jobject to represent GnssDebug.
*/
std::stringstream internalState;
@@ -2380,13 +2419,25 @@
return boolToJbool(result.isOk());
}
-static jboolean android_location_GnssMeasurementsProvider_inject_gnss_measurement_corrections(
+static jboolean
+ android_location_GnssMeasurementCorrectionsProvider_is_measurement_corrections_supported(
+ JNIEnv* env, jclass clazz) {
+ if (gnssCorrectionsIface != nullptr) {
+ return JNI_TRUE;
+ }
+
+ return JNI_FALSE;
+}
+
+static jboolean
+ android_location_GnssMeasurementCorrectionsProvider_inject_gnss_measurement_corrections(
JNIEnv* env,
jobject obj /* clazz*/,
jobject correctionsObj) {
if (gnssCorrectionsIface == nullptr) {
- ALOGW("Trying to inject GNSS corrections on a chipset that does not support them.");
+ ALOGW("Trying to inject GNSS measurement corrections on a chipset that does not"
+ " support them.");
return JNI_FALSE;
}
@@ -2882,18 +2933,25 @@
static const JNINativeMethod sMeasurementMethods[] = {
/* name, signature, funcPtr */
{"native_is_measurement_supported", "()Z",
- reinterpret_cast<void*>(
- android_location_GnssMeasurementsProvider_is_measurement_supported)},
+ reinterpret_cast<void*>(
+ android_location_GnssMeasurementsProvider_is_measurement_supported)},
{"native_start_measurement_collection", "(Z)Z",
- reinterpret_cast<void*>(
- android_location_GnssMeasurementsProvider_start_measurement_collection)},
+ reinterpret_cast<void*>(
+ android_location_GnssMeasurementsProvider_start_measurement_collection)},
{"native_stop_measurement_collection", "()Z",
- reinterpret_cast<void*>(
- android_location_GnssMeasurementsProvider_stop_measurement_collection)},
+ reinterpret_cast<void*>(
+ android_location_GnssMeasurementsProvider_stop_measurement_collection)},
+};
+
+static const JNINativeMethod sMeasurementCorrectionsMethods[] = {
+ /* name, signature, funcPtr */
+ {"native_is_measurement_corrections_supported", "()Z",
+ reinterpret_cast<void*>(
+ android_location_GnssMeasurementCorrectionsProvider_is_measurement_corrections_supported)},
{"native_inject_gnss_measurement_corrections",
- "(Landroid/location/GnssMeasurementCorrections;)Z",
- reinterpret_cast<void*>(
- android_location_GnssMeasurementsProvider_inject_gnss_measurement_corrections)},
+ "(Landroid/location/GnssMeasurementCorrections;)Z",
+ reinterpret_cast<void*>(
+ android_location_GnssMeasurementCorrectionsProvider_inject_gnss_measurement_corrections)},
};
static const JNINativeMethod sNavigationMessageMethods[] = {
@@ -2992,6 +3050,11 @@
NELEM(sMeasurementMethods));
jniRegisterNativeMethods(
env,
+ "com/android/server/location/GnssMeasurementCorrectionsProvider",
+ sMeasurementCorrectionsMethods,
+ NELEM(sMeasurementCorrectionsMethods));
+ jniRegisterNativeMethods(
+ env,
"com/android/server/location/GnssNavigationMessageProvider",
sNavigationMessageMethods,
NELEM(sNavigationMessageMethods));
diff --git a/services/tests/wmtests/src/com/android/server/wm/AssistDataRequesterTest.java b/services/tests/wmtests/src/com/android/server/wm/AssistDataRequesterTest.java
index 1e02a12..329af95 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AssistDataRequesterTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AssistDataRequesterTest.java
@@ -38,9 +38,7 @@
import static org.mockito.ArgumentMatchers.eq;
import android.app.AppOpsManager;
-import android.app.IActivityManager;
import android.app.IActivityTaskManager;
-import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
@@ -50,7 +48,6 @@
import android.util.Log;
import android.view.IWindowManager;
-import androidx.test.filters.FlakyTest;
import androidx.test.filters.MediumTest;
import com.android.server.am.AssistDataRequester;
@@ -88,12 +85,10 @@
private static final int TEST_UID = 0;
private static final String TEST_PACKAGE = "";
- private Context mContext;
private AssistDataRequester mDataRequester;
private Callbacks mCallbacks;
private Object mCallbacksLock;
private Handler mHandler;
- private IActivityManager mAm;
private IActivityTaskManager mAtm;
private IWindowManager mWm;
private AppOpsManager mAppOpsManager;
@@ -109,7 +104,6 @@
@Before
public void setUp() throws Exception {
- mAm = mock(IActivityManager.class);
mAtm = mock(IActivityTaskManager.class);
mWm = mock(IWindowManager.class);
mAppOpsManager = mock(AppOpsManager.class);
@@ -118,7 +112,7 @@
mCallbacks = new Callbacks();
mDataRequester = new AssistDataRequester(mContext, mWm, mAppOpsManager, mCallbacks,
mCallbacksLock, OP_ASSIST_STRUCTURE, OP_ASSIST_SCREENSHOT);
-
+ mDataRequester.mActivityTaskManager = mAtm;
// Gate the continuation of the assist data callbacks until we are ready within the tests
mGate = new CountDownLatch(1);
doAnswer(invocation -> {
@@ -155,7 +149,6 @@
.checkOpNoThrow(eq(OP_ASSIST_SCREENSHOT), anyInt(), anyString());
}
- @FlakyTest(bugId = 124088319)
@Test
public void testRequestData() throws Exception {
setupMocks(CURRENT_ACTIVITY_ASSIST_ALLOWED, CALLER_ASSIST_STRUCTURE_ALLOWED,
@@ -176,7 +169,6 @@
assertReceivedDataCount(0, 0, 0, 0);
}
- @FlakyTest(bugId = 124088319)
@Test
public void testCurrentAppDisallow_expectNullCallbacks() throws Exception {
setupMocks(!CURRENT_ACTIVITY_ASSIST_ALLOWED, CALLER_ASSIST_STRUCTURE_ALLOWED,
@@ -187,7 +179,6 @@
assertReceivedDataCount(0, 1, 0, 1);
}
- @FlakyTest(bugId = 124088319)
@Test
public void testProcessPendingData() throws Exception {
setupMocks(CURRENT_ACTIVITY_ASSIST_ALLOWED, CALLER_ASSIST_STRUCTURE_ALLOWED,
@@ -245,7 +236,6 @@
assertReceivedDataCount(0, 1, 0, 1);
}
- @FlakyTest(bugId = 124088319)
@Test
public void testDisallowAssistContextExtras_expectNullDataCallbacks() throws Exception {
setupMocks(CURRENT_ACTIVITY_ASSIST_ALLOWED, CALLER_ASSIST_STRUCTURE_ALLOWED,
@@ -259,7 +249,6 @@
assertReceivedDataCount(0, 1, 0, 1);
}
- @FlakyTest(bugId = 124088319)
@Test
public void testNoFetchScreenshots_expectNoScreenshotCallbacks() throws Exception {
setupMocks(CURRENT_ACTIVITY_ASSIST_ALLOWED, CALLER_ASSIST_STRUCTURE_ALLOWED,
@@ -270,7 +259,6 @@
assertReceivedDataCount(5, 5, 0, 0);
}
- @FlakyTest(bugId = 124088319)
@Test
public void testDisallowAssistScreenshot_expectNullScreenshotCallback() throws Exception {
setupMocks(CURRENT_ACTIVITY_ASSIST_ALLOWED, CALLER_ASSIST_STRUCTURE_ALLOWED,
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index 245f5b3..ac11940 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -161,11 +161,6 @@
private String mGroupUUID;
/**
- * A property in opportunistic subscription to indicate whether it is metered or not.
- */
- private boolean mIsMetered;
-
- /**
* Whether group of the subscription is disabled.
* This is only useful if it's a grouped opportunistic subscription. In this case, if all
* primary (non-opportunistic) subscriptions in the group are deactivated (unplugged pSIM
@@ -197,7 +192,7 @@
@Nullable UiccAccessRule[] accessRules, String cardString) {
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString,
- false, null, true, TelephonyManager.UNKNOWN_CARRIER_ID,
+ false, null, TelephonyManager.UNKNOWN_CARRIER_ID,
SubscriptionManager.PROFILE_CLASS_DEFAULT);
}
@@ -208,10 +203,10 @@
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules, String cardString, boolean isOpportunistic,
- @Nullable String groupUUID, boolean isMetered, int carrierId, int profileClass) {
+ @Nullable String groupUUID, int carrierId, int profileClass) {
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, -1,
- isOpportunistic, groupUUID, isMetered, false, carrierId, profileClass,
+ isOpportunistic, groupUUID, false, carrierId, profileClass,
SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
}
@@ -222,7 +217,7 @@
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules, String cardString, int cardId,
- boolean isOpportunistic, @Nullable String groupUUID, boolean isMetered,
+ boolean isOpportunistic, @Nullable String groupUUID,
boolean isGroupDisabled, int carrierId, int profileClass, int subType) {
this.mId = id;
this.mIccId = iccId;
@@ -243,7 +238,6 @@
this.mCardId = cardId;
this.mIsOpportunistic = isOpportunistic;
this.mGroupUUID = groupUUID;
- this.mIsMetered = isMetered;
this.mIsGroupDisabled = isGroupDisabled;
this.mCarrierId = carrierId;
this.mProfileClass = profileClass;
@@ -472,18 +466,6 @@
}
/**
- * Used in opportunistic subscription ({@link #isOpportunistic()}) to indicate whether it's
- * metered or not.This is one of the factors when deciding to switch to the subscription.
- * (a non-metered subscription, for example, would likely be preferred over a metered one).
- *
- * @return whether subscription is metered.
- * @hide
- */
- public boolean isMetered() {
- return mIsMetered;
- }
-
- /**
* @return the profile class of this subscription.
* @hide
*/
@@ -624,7 +606,6 @@
int cardId = source.readInt();
boolean isOpportunistic = source.readBoolean();
String groupUUID = source.readString();
- boolean isMetered = source.readBoolean();
boolean isGroupDisabled = source.readBoolean();
int carrierid = source.readInt();
int profileClass = source.readInt();
@@ -633,7 +614,7 @@
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
isEmbedded, accessRules, cardString, cardId, isOpportunistic, groupUUID,
- isMetered, isGroupDisabled, carrierid, profileClass, subType);
+ isGroupDisabled, carrierid, profileClass, subType);
}
@Override
@@ -663,7 +644,6 @@
dest.writeInt(mCardId);
dest.writeBoolean(mIsOpportunistic);
dest.writeString(mGroupUUID);
- dest.writeBoolean(mIsMetered);
dest.writeBoolean(mIsGroupDisabled);
dest.writeInt(mCarrierId);
dest.writeInt(mProfileClass);
@@ -703,7 +683,7 @@
+ " accessRules " + Arrays.toString(mAccessRules)
+ " cardString=" + cardStringToPrint + " cardId=" + mCardId
+ " isOpportunistic " + mIsOpportunistic + " mGroupUUID=" + mGroupUUID
- + " isMetered=" + mIsMetered + " mIsGroupDisabled=" + mIsGroupDisabled
+ + " mIsGroupDisabled=" + mIsGroupDisabled
+ " profileClass=" + mProfileClass
+ " subscriptionType=" + mSubscriptionType + "}";
}
@@ -711,7 +691,7 @@
@Override
public int hashCode() {
return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
- mIsOpportunistic, mGroupUUID, mIsMetered, mIccId, mNumber, mMcc, mMnc,
+ mIsOpportunistic, mGroupUUID, mIccId, mNumber, mMcc, mMnc,
mCountryIso, mCardString, mCardId, mDisplayName, mCarrierName, mAccessRules,
mIsGroupDisabled, mCarrierId, mProfileClass);
}
@@ -737,7 +717,6 @@
&& mIsOpportunistic == toCompare.mIsOpportunistic
&& mIsGroupDisabled == toCompare.mIsGroupDisabled
&& mCarrierId == toCompare.mCarrierId
- && mIsMetered == toCompare.mIsMetered
&& Objects.equals(mGroupUUID, toCompare.mGroupUUID)
&& Objects.equals(mIccId, toCompare.mIccId)
&& Objects.equals(mNumber, toCompare.mNumber)
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 3707aa4..c4c5983 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2853,29 +2853,6 @@
}
/**
- * Set if a subscription is metered or not. Similar to Wi-Fi, metered means
- * user may be charged more if more data is used.
- *
- * By default all Cellular networks are considered metered. System or carrier privileged apps
- * can set a subscription un-metered which will be considered when system switches data between
- * primary subscription and opportunistic subscription.
- *
- * Caller will either have {@link android.Manifest.permission#MODIFY_PHONE_STATE} or carrier
- * privilege permission of the subscription.
- *
- * @param isMetered whether it’s a metered subscription.
- * @param subId the unique SubscriptionInfo index in database
- * @return {@code true} if the operation is succeed, {@code false} otherwise.
- */
- @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
- @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
- public boolean setMetered(boolean isMetered, int subId) {
- if (VDBG) logd("[setIsMetered]+ isMetered:" + isMetered + " subId:" + subId);
- return setSubscriptionPropertyHelper(subId, "setIsMetered",
- (iSub)-> iSub.setMetered(isMetered, subId, mContext.getOpPackageName())) == 1;
- }
-
- /**
* Whether a subscription is visible to API caller. If it's a bundled opportunistic
* subscription, it should be hidden anywhere in Settings, dialer, status bar etc.
* Exception is if caller owns carrier privilege, in which case they will
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index 79e0aa1..3bbf7a4 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -205,15 +205,6 @@
String setSubscriptionGroup(in int[] subIdList, String callingPackage);
/**
- * Set whether a subscription is metered
- *
- * @param isMetered whether it’s a metered subscription.
- * @param subId the unique SubscriptionInfo index in database
- * @return the number of records updated
- */
- int setMetered(boolean isMetered, int subId, String callingPackage);
-
- /**
* Set which subscription is preferred for cellular data. It's
* designed to overwrite default data subscription temporarily.
*
diff --git a/tools/aapt2/cmd/Dump.h b/tools/aapt2/cmd/Dump.h
index 5cf056e..7ded9bc 100644
--- a/tools/aapt2/cmd/Dump.h
+++ b/tools/aapt2/cmd/Dump.h
@@ -32,6 +32,7 @@
public:
explicit DumpApkCommand(const std::string&& name, text::Printer* printer, IDiagnostics* diag)
: Command(name), printer_(printer), diag_(diag) {
+ SetDescription("Dump information about an APK or APC.");
}
text::Printer* GetPrinter() {