Merge "Ensure test provider turns real provider off"
diff --git a/Android.bp b/Android.bp
index c92b2da..c571fa0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -754,10 +754,6 @@
"android.hardware.radio-V1.2-java",
"android.hardware.radio-V1.3-java",
"android.hardware.radio-V1.4-java",
- "android.hardware.radio.config-V1.0-java",
- "android.hardware.radio.config-V1.1-java",
- "android.hardware.radio.config-V1.2-java",
- "android.hardware.radio.deprecated-V1.0-java",
"android.hardware.thermal-V1.0-java-constants",
"android.hardware.thermal-V1.0-java",
"android.hardware.thermal-V1.1-java",
@@ -772,7 +768,6 @@
"android.hardware.vibrator-V1.2-java",
"android.hardware.vibrator-V1.3-java",
"android.hardware.wifi-V1.0-java-constants",
- "networkstack-aidl-framework-java",
"devicepolicyprotosnano",
],
diff --git a/api/current.txt b/api/current.txt
index 28fd577..793bc2f 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -11051,6 +11051,7 @@
method public void dump(android.util.Printer, String);
method public static CharSequence getCategoryTitle(android.content.Context, int);
method public boolean isProfileableByShell();
+ method public boolean isResourceOverlay();
method public boolean isVirtualPreload();
method public CharSequence loadDescription(android.content.pm.PackageManager);
field public static final int CATEGORY_AUDIO = 1; // 0x1
@@ -22809,6 +22810,7 @@
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
field public static final int CONSTELLATION_GLONASS = 3; // 0x3
field public static final int CONSTELLATION_GPS = 1; // 0x1
+ field public static final int CONSTELLATION_IRNSS = 7; // 0x7
field public static final int CONSTELLATION_QZSS = 4; // 0x4
field public static final int CONSTELLATION_SBAS = 2; // 0x2
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
diff --git a/api/system-current.txt b/api/system-current.txt
index 01fadfc..9548a27 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -339,6 +339,7 @@
field public static final String OPSTR_GET_ACCOUNTS = "android:get_accounts";
field public static final String OPSTR_GPS = "android:gps";
field public static final String OPSTR_INSTANT_APP_START_FOREGROUND = "android:instant_app_start_foreground";
+ field public static final String OPSTR_LEGACY_STORAGE = "android:legacy_storage";
field public static final String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels";
field public static final String OPSTR_MUTE_MICROPHONE = "android:mute_microphone";
field public static final String OPSTR_NEIGHBORING_CELLS = "android:neighboring_cells";
@@ -1479,6 +1480,7 @@
}
public class OverlayManager {
+ method @Nullable public android.content.om.OverlayInfo getOverlayInfo(@NonNull String, @NonNull android.os.UserHandle);
method public java.util.List<android.content.om.OverlayInfo> getOverlayInfosForTarget(@Nullable String, int);
method public boolean setEnabled(@Nullable String, boolean, int);
method public boolean setEnabledExclusiveInCategory(@Nullable String, int);
@@ -1648,6 +1650,7 @@
field public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
field public static final String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock";
field public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 32; // 0x20
+ field public static final int FLAG_PERMISSION_HIDDEN = 1024; // 0x400
field public static final int FLAG_PERMISSION_POLICY_FIXED = 4; // 0x4
field public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 64; // 0x40
field public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 8; // 0x8
@@ -1718,7 +1721,7 @@
method public void onPermissionsChanged(int);
}
- @IntDef(prefix={"FLAG_PERMISSION_"}, value={android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET, android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE, android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface PackageManager.PermissionFlags {
+ @IntDef(prefix={"FLAG_PERMISSION_"}, value={android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET, android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE, android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED, android.content.pm.PackageManager.FLAG_PERMISSION_HIDDEN}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface PackageManager.PermissionFlags {
}
public class PermissionGroupInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
@@ -3067,6 +3070,19 @@
method public void onLocationBatch(java.util.List<android.location.Location>);
}
+ public final class GnssCapabilities {
+ method public boolean hasCapability(int);
+ field public static final int GEOFENCING = 2; // 0x2
+ field public static final int LOW_POWER_MODE = 0; // 0x0
+ field public static final int MEASUREMENTS = 3; // 0x3
+ field public static final int MEASUREMENT_CORRECTIONS = 5; // 0x5
+ field public static final int MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 7; // 0x7
+ field public static final int MEASUREMENT_CORRECTIONS_LOS_SATS = 6; // 0x6
+ field public static final int MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 8; // 0x8
+ field public static final int NAV_MESSAGES = 4; // 0x4
+ field public static final int SATELLITE_BLACKLIST = 1; // 0x1
+ }
+
public final class GnssMeasurementCorrections implements android.os.Parcelable {
method public int describeContents();
method @FloatRange(from=-1000.0F, to=10000.0f) public double getAltitudeMeters();
@@ -3374,7 +3390,7 @@
public class LocationManager {
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void flushGnssBatch();
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int getGnssBatchSize();
- method public int getGnssCapabilities();
+ method @Nullable public android.location.GnssCapabilities getGnssCapabilities();
method @Nullable public String getLocationControllerExtraPackage();
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void injectGnssMeasurementCorrections(@NonNull android.location.GnssMeasurementCorrections);
method public boolean isLocationControllerExtraPackageEnabled();
@@ -5885,6 +5901,7 @@
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_STORAGE = "storage";
field public static final String NAMESPACE_SYSTEMUI = "systemui";
field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
}
@@ -5913,11 +5930,6 @@
method @Nullable public String getString(@NonNull String, @Nullable String);
}
- public static interface DeviceConfig.Storage {
- field public static final String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
- field public static final String NAMESPACE = "storage";
- }
-
public static interface DeviceConfig.Telephony {
field public static final String NAMESPACE = "telephony";
field public static final String RAMPING_RINGER_DURATION = "ramping_ringer_duration";
@@ -6119,6 +6131,7 @@
field public static final String LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE = "location_permissions_upgrade_to_q_mode";
field public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = "lock_screen_allow_private_notifications";
field public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = "lock_screen_show_notifications";
+ field public static final String ODI_CAPTIONS_ENABLED = "odi_captions_enabled";
field public static final String THEME_CUSTOMIZATION_OVERLAY_PACKAGES = "theme_customization_overlay_packages";
field public static final String USER_SETUP_COMPLETE = "user_setup_complete";
field public static final int USER_SETUP_PERSONALIZATION_COMPLETE = 10; // 0xa
@@ -8577,7 +8590,7 @@
field public final java.util.HashMap<java.lang.String,android.os.Bundle> mParticipants;
}
- public class ImsException extends java.lang.Exception {
+ public final class ImsException extends java.lang.Exception {
ctor public ImsException(@Nullable String);
ctor public ImsException(@Nullable String, int);
ctor public ImsException(@Nullable String, int, @Nullable Throwable);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 18d0ec0..7e04469 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -60,14 +60,6 @@
}
-package android.content.pm {
-
- public static class PackageInstaller.SessionParams implements android.os.Parcelable {
- method @Deprecated public void setEnableRollback();
- }
-
-}
-
package android.location {
public class LocationManager {
diff --git a/api/test-current.txt b/api/test-current.txt
index 9e8b02a..3322943 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -134,16 +134,19 @@
method @RequiresPermission("android.permission.MANAGE_APPOPS") public void addHistoricalOps(@NonNull android.app.AppOpsManager.HistoricalOps);
method @RequiresPermission("android.permission.MANAGE_APPOPS") public void clearHistory();
method @RequiresPermission("android.permission.GET_APP_OPS_STATS") public void getHistoricalOps(@NonNull android.app.AppOpsManager.HistoricalOpsRequest, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.AppOpsManager.HistoricalOps>);
- method @RequiresPermission("android.permission.GET_APP_OPS_STATS") public void getHistoricalOpsFromDiskRaw(@NonNull android.app.AppOpsManager.HistoricalOpsRequest, @Nullable java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.AppOpsManager.HistoricalOps>);
+ method @RequiresPermission("android.permission.MANAGE_APPOPS") public void getHistoricalOpsFromDiskRaw(@NonNull android.app.AppOpsManager.HistoricalOpsRequest, @Nullable java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.AppOpsManager.HistoricalOps>);
method public static int getNumOps();
method public static String[] getOpStrs();
method public boolean isOperationActive(int, int, String);
method @RequiresPermission("android.permission.MANAGE_APPOPS") public void offsetHistory(long);
+ method public static int opToDefaultMode(@NonNull String);
method public static String opToPermission(int);
method public static int permissionToOpCode(String);
+ method @RequiresPermission("android.permission.MANAGE_APPOPS") public void reloadNonHistoricalState();
method @RequiresPermission("android.permission.MANAGE_APPOPS") public void resetHistoryParameters();
method @RequiresPermission("android.permission.MANAGE_APPOPS") public void setHistoryParameters(int, long, int);
method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(int, int, String, int);
+ method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(String, int, String, int);
method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setUidMode(String, int, int);
method public void startWatchingActive(@NonNull int[], @NonNull android.app.AppOpsManager.OnOpActiveChangedListener);
method public void stopWatchingActive(@NonNull android.app.AppOpsManager.OnOpActiveChangedListener);
@@ -169,6 +172,7 @@
field public static final String OPSTR_GET_ACCOUNTS = "android:get_accounts";
field public static final String OPSTR_GPS = "android:gps";
field public static final String OPSTR_INSTANT_APP_START_FOREGROUND = "android:instant_app_start_foreground";
+ field public static final String OPSTR_LEGACY_STORAGE = "android:legacy_storage";
field public static final String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels";
field public static final String OPSTR_MUTE_MICROPHONE = "android:mute_microphone";
field public static final String OPSTR_NEIGHBORING_CELLS = "android:neighboring_cells";
@@ -656,6 +660,7 @@
method @RequiresPermission(anyOf={"android.permission.GRANT_RUNTIME_PERMISSIONS", "android.permission.REVOKE_RUNTIME_PERMISSIONS"}) public abstract void updatePermissionFlags(String, String, int, int, @NonNull android.os.UserHandle);
field public static final String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
field public static final String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
+ field public static final int FLAG_PERMISSION_HIDDEN = 1024; // 0x400
field public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 64; // 0x40
field public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 8; // 0x8
field public static final int FLAG_PERMISSION_REVOKE_WHEN_REQUESTED = 128; // 0x80
diff --git a/cmds/idmap2/libidmap2/Idmap.cpp b/cmds/idmap2/libidmap2/Idmap.cpp
index 2a39c2f..9afdd437 100644
--- a/cmds/idmap2/libidmap2/Idmap.cpp
+++ b/cmds/idmap2/libidmap2/Idmap.cpp
@@ -436,7 +436,7 @@
continue;
}
- if (!enforce_overlayable) {
+ if (enforce_overlayable) {
Result<Unit> success =
CheckOverlayable(*target_pkg, *overlay_info, fulfilled_policies, target_resid);
if (!success) {
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 1066fc7..5ed4428 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -48,7 +48,6 @@
import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
-
import com.android.internal.annotations.Immutable;
import com.android.internal.app.IAppOpsActiveCallback;
import com.android.internal.app.IAppOpsCallback;
@@ -1098,6 +1097,8 @@
/** @hide Write media of image type. */
public static final String OPSTR_WRITE_MEDIA_IMAGES = "android:write_media_images";
/** @hide Has a legacy (non-isolated) view of storage. */
+ @TestApi
+ @SystemApi
public static final String OPSTR_LEGACY_STORAGE = "android:legacy_storage";
/** @hide Interact with accessibility. */
@SystemApi
@@ -2153,6 +2154,7 @@
*
* @hide
*/
+ @TestApi
@SystemApi
public static int opToDefaultMode(@NonNull String appOp) {
return opToDefaultMode(strOpToOp(appOp));
@@ -4465,7 +4467,7 @@
* @hide
*/
@TestApi
- @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS)
+ @RequiresPermission(Manifest.permission.MANAGE_APPOPS)
public void getHistoricalOpsFromDiskRaw(@NonNull HistoricalOpsRequest request,
@Nullable Executor executor, @NonNull Consumer<HistoricalOps> callback) {
Preconditions.checkNotNull(executor, "executor cannot be null");
@@ -4488,6 +4490,21 @@
}
/**
+ * Reloads the non historical state to allow testing the read/write path.
+ *
+ * @hide
+ */
+ @TestApi
+ @RequiresPermission(Manifest.permission.MANAGE_APPOPS)
+ public void reloadNonHistoricalState() {
+ try {
+ mService.reloadNonHistoricalState();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Sets given app op in the specified mode for app ops in the UID.
* This applies to all apps currently in the UID or installed in
* this UID in the future.
@@ -4570,6 +4587,7 @@
* be changed.
* @hide
*/
+ @TestApi
@SystemApi
@RequiresPermission(android.Manifest.permission.MANAGE_APP_OPS_MODES)
public void setMode(String op, int uid, String packageName, @Mode int mode) {
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index efd9990..93a9dac 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2438,7 +2438,7 @@
* Broadcast Action: A rollback has been committed.
*
* <p class="note">This is a protected intent that can only be sent
- * by the system.
+ * by the system. The receiver must hold MANAGE_ROLLBACK permission.
*
* @hide
*/
diff --git a/core/java/android/content/om/OverlayManager.java b/core/java/android/content/om/OverlayManager.java
index 8e72fa5..ceea043 100644
--- a/core/java/android/content/om/OverlayManager.java
+++ b/core/java/android/content/om/OverlayManager.java
@@ -16,12 +16,14 @@
package android.content.om;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.UserHandle;
import java.util.List;
@@ -96,6 +98,28 @@
}
/**
+ * Returns information about the overlay with the given package name for
+ * the specified user.
+ *
+ * @param packageName The name of the package.
+ * @param userHandle The user to get the OverlayInfos for.
+ * @return An OverlayInfo object; if no overlays exist with the
+ * requested package name, null is returned.
+ *
+ * @hide
+ */
+ @SystemApi
+ @Nullable
+ public OverlayInfo getOverlayInfo(@NonNull final String packageName,
+ @NonNull final UserHandle userHandle) {
+ try {
+ return mService.getOverlayInfo(packageName, userHandle.myUserId());
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Returns information about all overlays for the given target package for
* the specified user. The returned list is ordered according to the
* overlay priority with the highest priority at the end of the list.
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 706cbbf..068a93a 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -671,6 +671,14 @@
*/
public static final int PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE = 1 << 27;
+ /**
+ * Indicates whether this package is in fact a runtime resource overlay.
+ *
+ * @hide
+ */
+ public static final int PRIVATE_FLAG_IS_RESOURCE_OVERLAY = 1 << 28;
+
+
/** @hide */
@IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = {
PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE,
@@ -683,6 +691,7 @@
PRIVATE_FLAG_HAS_DOMAIN_URLS,
PRIVATE_FLAG_HIDDEN,
PRIVATE_FLAG_INSTANT,
+ PRIVATE_FLAG_IS_RESOURCE_OVERLAY,
PRIVATE_FLAG_ISOLATED_SPLIT_LOADING,
PRIVATE_FLAG_OEM,
PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE,
@@ -2023,6 +2032,14 @@
}
/**
+ * Returns true if the package has declared in its manifest that it is a
+ * runtime resource overlay.
+ */
+ public boolean isResourceOverlay() {
+ return (privateFlags & ApplicationInfo.PRIVATE_FLAG_IS_RESOURCE_OVERLAY) != 0;
+ }
+
+ /**
* @hide
*/
@Override protected ApplicationInfo getApplicationInfo() {
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index 33b9c72..3edd17a 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -1448,19 +1448,6 @@
}
/**
- * Request that rollbacks be enabled for the given upgrade.
- *
- * @removed
- * @deprecated use {@link #setEnableRollback(boolean)} instead.
- * @hide
- */
- @Deprecated
- @SystemApi
- public void setEnableRollback() {
- installFlags |= PackageManager.INSTALL_ENABLE_ROLLBACK;
- }
-
- /**
* Request that rollbacks be enabled or disabled for the given upgrade.
*
* @param enable set to {@code true} to enable, {@code false} to disable
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 2f99879..fa5247c 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3065,6 +3065,15 @@
public static final int FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED = 1 << 9;
/**
+ * Permission flag: The permission should not be shown in the UI.
+ *
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public static final int FLAG_PERMISSION_HIDDEN = 1 << 10;
+
+ /**
* Mask for all permission flags present in Android P
*
* @deprecated This constant does not contain useful information and should never have been
@@ -3082,7 +3091,7 @@
*
* @hide
*/
- public static final int MASK_PERMISSION_FLAGS_ALL = 0x3FF;
+ public static final int MASK_PERMISSION_FLAGS_ALL = 0x7FF;
/**
* Injected activity in app that forwards user to setting activity of that app.
@@ -3793,6 +3802,7 @@
FLAG_PERMISSION_GRANTED_BY_DEFAULT,
FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED,
FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED,
+ FLAG_PERMISSION_HIDDEN,
/*
FLAG_PERMISSION_REVOKE_WHEN_REQUESED
*/
@@ -6586,6 +6596,7 @@
case FLAG_PERMISSION_REVOKE_WHEN_REQUESTED: return "REVOKE_WHEN_REQUESTED";
case FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED: return "USER_SENSITIVE_WHEN_GRANTED";
case FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED: return "USER_SENSITIVE_WHEN_DENIED";
+ case FLAG_PERMISSION_HIDDEN: return "HIDDEN";
default: return Integer.toString(flag);
}
}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 9d0ece0..743a302 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2108,6 +2108,9 @@
return null;
}
+ pkg.applicationInfo.privateFlags |=
+ ApplicationInfo.PRIVATE_FLAG_IS_RESOURCE_OVERLAY;
+
XmlUtils.skipCurrentTag(parser);
} else if (tagName.equals(TAG_KEY_SETS)) {
diff --git a/core/java/android/content/pm/SharedLibraryInfo.java b/core/java/android/content/pm/SharedLibraryInfo.java
index 13c49a0..3488cc3 100644
--- a/core/java/android/content/pm/SharedLibraryInfo.java
+++ b/core/java/android/content/pm/SharedLibraryInfo.java
@@ -307,9 +307,9 @@
@Override
public String toString() {
- return "SharedLibraryInfo[name:" + mName + ", type:" + typeToString(mType)
+ return "SharedLibraryInfo{name:" + mName + ", type:" + typeToString(mType)
+ ", version:" + mVersion + (!getDependentPackages().isEmpty()
- ? " has dependents" : "");
+ ? " has dependents" : "") + "}";
}
@Override
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 7bd0fe2..7fc07b0 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -225,6 +225,14 @@
public static final String NAMESPACE_SCHEDULER = "scheduler";
/**
+ * Namespace for storage-related features.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String NAMESPACE_STORAGE = "storage";
+
+ /**
* Namespace for System UI related features.
*
* @hide
@@ -294,23 +302,6 @@
String RAMPING_RINGER_VIBRATION_DURATION = "ramping_ringer_vibration_duration";
}
- /**
- * Namespace for storage-related features.
- *
- * @hide
- */
- @SystemApi
- public interface Storage {
- String NAMESPACE = "storage";
-
- /**
- * If {@code 1}, enables the isolated storage feature. If {@code -1},
- * disables the isolated storage feature. If {@code 0}, uses the default
- * value from the build system.
- */
- String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
- }
-
private static final Object sLock = new Object();
@GuardedBy("sLock")
private static ArrayMap<OnPropertyChangedListener, Pair<String, Executor>> sSingleListeners =
diff --git a/core/java/android/provider/FontsContract.java b/core/java/android/provider/FontsContract.java
index e931826..8f772d4 100644
--- a/core/java/android/provider/FontsContract.java
+++ b/core/java/android/provider/FontsContract.java
@@ -34,7 +34,6 @@
import android.graphics.fonts.FontStyle;
import android.graphics.fonts.FontVariationAxis;
import android.net.Uri;
-import android.os.Build.VERSION_CODES;
import android.os.CancellationSignal;
import android.os.Handler;
import android.os.HandlerThread;
@@ -652,17 +651,12 @@
if (familyBuilder == null) {
familyBuilder = new FontFamily.Builder(font);
} else {
- try {
- familyBuilder.addFont(font);
- } catch (IllegalArgumentException e) {
- if (context.getApplicationInfo().targetSdkVersion <= VERSION_CODES.P) {
- // Surpress the IllegalArgumentException for keeping the backward
- // compatibility.
- continue;
- }
- throw e;
- }
+ familyBuilder.addFont(font);
}
+ } catch (IllegalArgumentException e) {
+ // To be a compatible behavior with API28 or before, catch IllegalArgumentExcetpion
+ // thrown by native code and returns null.
+ return null;
} catch (IOException e) {
continue;
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index b8174e6..63235a1 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -5607,6 +5607,7 @@
*
* @hide
*/
+ @SystemApi
public static final String ODI_CAPTIONS_ENABLED = "odi_captions_enabled";
private static final Validator ODI_CAPTIONS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
diff --git a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
index 34ced17..96b861b 100644
--- a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
+++ b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
@@ -427,7 +427,7 @@
mFocusedValue = focusedValue;
if (mCallback != null) {
try {
- if (mCallback.isCompleted()) {
+ if (!mCallback.isCompleted()) {
mCallback.cancel();
}
} catch (RemoteException e) {
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 8f1896d..8cb04cb 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -228,6 +228,9 @@
/** @hide */ public static final int FLAG_ADD_CLIENT_ENABLED = 0x1;
/** @hide */ public static final int FLAG_ADD_CLIENT_DEBUG = 0x2;
/** @hide */ public static final int FLAG_ADD_CLIENT_VERBOSE = 0x4;
+
+ /** @hide */ public static final int FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY = 0x1;
+
/** @hide */
public static final int DEFAULT_LOGGING_LEVEL = Build.IS_DEBUGGABLE
? AutofillManager.FLAG_ADD_CLIENT_DEBUG
@@ -307,8 +310,8 @@
/**
* Same as {@link #STATE_UNKNOWN}, but used on
- * {@link AutofillManagerClient#setSessionFinished(int)} when the session was finished because
- * the URL bar changed on client mode
+ * {@link AutofillManagerClient#setSessionFinished(int, List)} when the session was finished
+ * because the URL bar changed on client mode
*
* @hide
*/
@@ -316,8 +319,8 @@
/**
* Same as {@link #STATE_UNKNOWN}, but used on
- * {@link AutofillManagerClient#setSessionFinished(int)} when the session was finished because
- * the service failed to fullfil a request.
+ * {@link AutofillManagerClient#setSessionFinished(int, List)} when the session was finished
+ * because the service failed to fullfil a request.
*
* @hide
*/
@@ -436,7 +439,7 @@
* There is currently no session running.
* {@hide}
*/
- public static final int NO_SESSION = Integer.MIN_VALUE;
+ public static final int NO_SESSION = Integer.MAX_VALUE;
private final IAutoFillManager mService;
@@ -513,6 +516,10 @@
@Nullable
private final AutofillOptions mOptions;
+ /** When set, session is only used for augmented autofill requests. */
+ @GuardedBy("mLock")
+ private boolean mForAugmentedAutofillOnly;
+
/** @hide */
public interface AutofillClient {
/**
@@ -940,9 +947,8 @@
ensureServiceClientAddedIfNeededLocked();
if (!mEnabled) {
- if (sVerbose) {
- Log.v(TAG, "ignoring notifyViewEntered(" + id + "): disabled");
- }
+ if (sVerbose) Log.v(TAG, "ignoring notifyViewEntered(" + id + "): disabled");
+
if (mCallback != null) {
callback = mCallback;
}
@@ -1025,6 +1031,12 @@
private void notifyViewVisibilityChangedInternal(@NonNull View view, int virtualId,
boolean isVisible, boolean virtual) {
synchronized (mLock) {
+ if (mForAugmentedAutofillOnly) {
+ if (sVerbose) {
+ Log.v(TAG, "notifyViewVisibilityChanged(): ignoring on augmented only mode");
+ }
+ return;
+ }
if (mEnabled && isActiveLocked()) {
final AutofillId id = virtual ? getAutofillId(view, virtualId)
: view.getAutofillId();
@@ -1168,6 +1180,10 @@
AutofillValue value = null;
synchronized (mLock) {
+ if (mForAugmentedAutofillOnly) {
+ if (sVerbose) Log.v(TAG, "notifyValueChanged(): ignoring on augmented only mode");
+ return;
+ }
// If the session is gone some fields might still be highlighted, hence we have to
// remove the isAutofilled property even if no sessions are active.
if (mLastAutofilledData == null) {
@@ -1221,6 +1237,10 @@
return;
}
synchronized (mLock) {
+ if (mForAugmentedAutofillOnly) {
+ if (sVerbose) Log.v(TAG, "notifyValueChanged(): ignoring on augmented only mode");
+ return;
+ }
if (!mEnabled || !isActiveLocked()) {
if (sVerbose) {
Log.v(TAG, "notifyValueChanged(" + view.getAutofillId() + ":" + virtualId
@@ -1676,14 +1696,20 @@
if (client == null) return; // NOTE: getClient() already logged it..
final SyncResultReceiver receiver = new SyncResultReceiver(SYNC_CALLS_TIMEOUT_MS);
+ final ComponentName componentName = client.autofillClientGetComponentName();
mService.startSession(client.autofillClientGetActivityToken(),
mServiceClient.asBinder(), id, bounds, value, mContext.getUserId(),
- mCallback != null, flags, client.autofillClientGetComponentName(),
+ mCallback != null, flags, componentName,
isCompatibilityModeEnabledLocked(), receiver);
mSessionId = receiver.getIntResult();
if (mSessionId != NO_SESSION) {
mState = STATE_ACTIVE;
}
+ final int extraFlags = receiver.getOptionalExtraIntResult(0);
+ if ((extraFlags & FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY) != 0) {
+ if (sDebug) Log.d(TAG, "startSession(" + componentName + "): for augmented only");
+ mForAugmentedAutofillOnly = true;
+ }
client.autofillClientResetableStateAvailable();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -2400,6 +2426,9 @@
pw.print(pfx); pw.print("entered ids for augmented autofill: ");
pw.println(mEnteredForAugmentedAutofillIds);
}
+ if (mForAugmentedAutofillOnly) {
+ pw.print(pfx); pw.println("For Augmented Autofill Only");
+ }
pw.print(pfx); pw.print("save trigger id: "); pw.println(mSaveTriggerId);
pw.print(pfx); pw.print("save on finish(): "); pw.println(mSaveOnFinish);
if (mOptions != null) {
diff --git a/core/java/com/android/internal/app/IAppOpsService.aidl b/core/java/com/android/internal/app/IAppOpsService.aidl
index c4af4c7..1c90182 100644
--- a/core/java/com/android/internal/app/IAppOpsService.aidl
+++ b/core/java/com/android/internal/app/IAppOpsService.aidl
@@ -79,4 +79,6 @@
void stopWatchingNoted(IAppOpsNotedCallback callback);
int checkOperationRaw(int code, int uid, String packageName);
+
+ void reloadNonHistoricalState();
}
diff --git a/core/java/com/android/internal/util/SyncResultReceiver.java b/core/java/com/android/internal/util/SyncResultReceiver.java
index 9a346ac..60af511 100644
--- a/core/java/com/android/internal/util/SyncResultReceiver.java
+++ b/core/java/com/android/internal/util/SyncResultReceiver.java
@@ -96,6 +96,19 @@
return mBundle == null ? null : mBundle.getParcelable(EXTRA);
}
+ /**
+ * Gets the optional result from an operation that returns an extra {@code int} (besides the
+ * result code).
+ *
+ * @return value set in the bundle, or {@code defaultValue} when not set.
+ */
+ public int getOptionalExtraIntResult(int defaultValue) throws TimeoutException {
+ waitResult();
+ if (mBundle == null || !mBundle.containsKey(EXTRA)) return defaultValue;
+
+ return mBundle.getInt(EXTRA);
+ }
+
@Override
public void send(int resultCode, Bundle resultData) {
mResult = resultCode;
@@ -136,6 +149,18 @@
return bundle;
}
+ /**
+ * Creates a bundle for an {@code int} value so it can be retrieved by
+ * {@link #getParcelableResult()} - typically used to return an extra {@code int} (as the 1st
+ * is returned as the result code).
+ */
+ @NonNull
+ public static Bundle bundleFor(int value) {
+ final Bundle bundle = new Bundle();
+ bundle.putInt(EXTRA, value);
+ return bundle;
+ }
+
/** @hide */
public static final class TimeoutException extends RemoteException {
private TimeoutException(String msg) {
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index efc6ad0..5427147 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -819,8 +819,7 @@
android:permissionGroup="android.permission-group.UNDEFINED"
android:label="@string/permlab_sdcardRead"
android:description="@string/permdesc_sdcardRead"
- android:protectionLevel="dangerous"
- android:permissionFlags="removed" />
+ android:protectionLevel="dangerous" />
<!-- Allows an application to write to external storage.
<p class="note"><strong>Note:</strong> If <em>both</em> your <a
@@ -841,8 +840,7 @@
android:permissionGroup="android.permission-group.UNDEFINED"
android:label="@string/permlab_sdcardWrite"
android:description="@string/permdesc_sdcardWrite"
- android:protectionLevel="dangerous"
- android:permissionFlags="removed" />
+ android:protectionLevel="dangerous" />
<!-- Runtime permission controlling access to the user's shared aural media
collection. -->
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index 44d71e2..28d311e 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -202,17 +202,15 @@
<new-permission name="android.permission.ACCESS_BACKGROUND_LOCATION" />
</split-permission>
- <!-- Apps holding either the legacy READ or WRITE permissions will inherit
- the ability to <em>read</em> new typed permissions in the Q release; they
- won't gain the ability to <em>write</em> that content. -->
- <!-- STOPSHIP(b/112545973): change targetSdk to Q when SDK version finalised -->
+ <!-- STOPSHIP: change targetSdk to Q when SDK version finalised -->
+ <!-- Old apps might not understand the modern permission model, hence their view needs to be expanded -->
<split-permission name="android.permission.READ_EXTERNAL_STORAGE"
targetSdk="10000">
<new-permission name="android.permission.READ_MEDIA_AUDIO" />
<new-permission name="android.permission.READ_MEDIA_VIDEO" />
<new-permission name="android.permission.READ_MEDIA_IMAGES" />
</split-permission>
- <!-- STOPSHIP(b/112545973): change targetSdk to Q when SDK version finalised -->
+ <!-- STOPSHIP: change targetSdk to Q when SDK version finalised -->
<split-permission name="android.permission.WRITE_EXTERNAL_STORAGE"
targetSdk="10000">
<new-permission name="android.permission.READ_MEDIA_AUDIO" />
@@ -220,6 +218,20 @@
<new-permission name="android.permission.READ_MEDIA_IMAGES" />
</split-permission>
+ <!-- An app using the typed media permissions might be grandfathered and then uses the old storage model -->
+ <split-permission name="android.permission.READ_MEDIA_AUDIO">
+ <new-permission name="android.permission.READ_EXTERNAL_STORAGE" />
+ <new-permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ </split-permission>
+ <split-permission name="android.permission.READ_MEDIA_VIDEO">
+ <new-permission name="android.permission.READ_EXTERNAL_STORAGE" />
+ <new-permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ </split-permission>
+ <split-permission name="android.permission.READ_MEDIA_IMAGES">
+ <new-permission name="android.permission.READ_EXTERNAL_STORAGE" />
+ <new-permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ </split-permission>
+
<!-- This is a list of all the libraries available for application
code to link against. -->
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index 9995f1e..c8b361b 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -33,7 +33,6 @@
import android.graphics.fonts.FontVariationAxis;
import android.graphics.fonts.SystemFonts;
import android.os.Build;
-import android.os.Build.VERSION_CODES;
import android.os.ParcelFileDescriptor;
import android.provider.FontRequest;
import android.provider.FontsContract;
@@ -48,7 +47,6 @@
import com.android.internal.util.Preconditions;
import dalvik.annotation.optimization.CriticalNative;
-import dalvik.system.VMRuntime;
import libcore.util.NativeAllocationRegistry;
@@ -266,16 +264,7 @@
if (familyBuilder == null) {
familyBuilder = new FontFamily.Builder(fontBuilder.build());
} else {
- try {
- familyBuilder.addFont(fontBuilder.build());
- } catch (IllegalArgumentException e) {
- if (VMRuntime.getRuntime().getTargetSdkVersion() <= VERSION_CODES.P) {
- // Surpress the IllegalArgumentException for keeping the backward
- // compatibility.
- continue;
- }
- throw e;
- }
+ familyBuilder.addFont(fontBuilder.build());
}
}
if (familyBuilder == null) {
@@ -297,6 +286,10 @@
typeface = new Typeface.CustomFallbackBuilder(family)
.setStyle(bestFont.getStyle())
.build();
+ } catch (IllegalArgumentException e) {
+ // To be a compatible behavior with API28 or before, catch IllegalArgumentExcetpion
+ // thrown by native code and returns null.
+ return null;
} catch (IOException e) {
typeface = Typeface.DEFAULT;
}
diff --git a/location/java/android/location/GnssCapabilities.java b/location/java/android/location/GnssCapabilities.java
new file mode 100644
index 0000000..6a35920
--- /dev/null
+++ b/location/java/android/location/GnssCapabilities.java
@@ -0,0 +1,153 @@
+/*
+ * 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 android.location;
+
+import android.annotation.IntDef;
+import android.annotation.SystemApi;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * A container of supported GNSS chipset capabilities.
+ *
+ * @hide
+ */
+@SystemApi
+public final class GnssCapabilities {
+ /** The GNSS chipset supports low power mode. */
+ public static final int LOW_POWER_MODE = 0;
+
+ /** The GNSS chipset supports blacklisting satellites. */
+ public static final int SATELLITE_BLACKLIST = 1;
+
+ /** The GNSS chipset supports geofencing. */
+ public static final int GEOFENCING = 2;
+
+ /** The GNSS chipset supports measurements.*/
+ public static final int MEASUREMENTS = 3;
+
+ /** The GNSS chipset supports navigation messages. */
+ public static final int NAV_MESSAGES = 4;
+
+ /** The GNSS chipset supports measurement corrections. */
+ public static final int MEASUREMENT_CORRECTIONS = 5;
+
+ /** The GNSS chipset supports line-of-sight satellite identification measurement corrections. */
+ public static final int MEASUREMENT_CORRECTIONS_LOS_SATS = 6;
+
+ /** The GNSS chipset supports per satellite excess-path-length measurement corrections. */
+ public static final int MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 7;
+
+ /** The GNSS chipset supports reflecting planes measurement corrections. */
+ public static final int MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 8;
+
+ private static final int MIN_CAPABILITY = 0;
+ private static final int MAX_CAPABILITY = MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
+
+ /**
+ * GNSS capability.
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({
+ LOW_POWER_MODE,
+ SATELLITE_BLACKLIST,
+ GEOFENCING,
+ MEASUREMENTS,
+ NAV_MESSAGES,
+ MEASUREMENT_CORRECTIONS,
+ MEASUREMENT_CORRECTIONS_LOS_SATS,
+ MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH,
+ MEASUREMENT_CORRECTIONS_REFLECTING_PLANE
+ })
+ public @interface Capability {}
+
+ /**
+ * @hide
+ */
+ public static final long INVALID_CAPABILITIES = -1;
+
+ /** A bitmask of supported GNSS capabilities. */
+ private final long mGnssCapabilities;
+
+ static GnssCapabilities of(long gnssCapabilities) {
+ return new GnssCapabilities(gnssCapabilities);
+ }
+
+ private GnssCapabilities(long gnssCapabilities) {
+ mGnssCapabilities = gnssCapabilities;
+ }
+
+ /**
+ * Returns {@code true} if the {@code capability} is supported by the GNSS implementation.
+ */
+ public boolean hasCapability(@Capability int capability) {
+ return isValidCapability(capability) && (mGnssCapabilities & (1 << capability)) != 0;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("GnssCapabilities: (");
+ int capability = 0;
+ boolean addSeparator = false;
+ long gnssCapabilities = mGnssCapabilities;
+ while (gnssCapabilities != 0) {
+ if ((gnssCapabilities & 1) != 0) {
+ if (addSeparator) {
+ sb.append(' ');
+ } else {
+ addSeparator = true;
+ }
+ sb.append(toStringCapability(capability));
+ }
+ gnssCapabilities >>= 1;
+ ++capability;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ private boolean isValidCapability(@Capability int capability) {
+ return capability >= MIN_CAPABILITY && capability <= MAX_CAPABILITY;
+ }
+
+ private static String toStringCapability(@Capability int capability) {
+ switch (capability) {
+ case LOW_POWER_MODE:
+ return "LOW_POWER_MODE";
+ case SATELLITE_BLACKLIST:
+ return "SATELLITE_BLACKLIST";
+ case GEOFENCING:
+ return "GEOFENCING";
+ case MEASUREMENTS:
+ return "MEASUREMENTS";
+ case NAV_MESSAGES:
+ return "NAV_MESSAGES";
+ case MEASUREMENT_CORRECTIONS:
+ return "MEASUREMENT_CORRECTIONS";
+ case MEASUREMENT_CORRECTIONS_LOS_SATS:
+ return "MEASUREMENT_CORRECTIONS_LOS_SATS";
+ case MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH:
+ return "MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH";
+ case MEASUREMENT_CORRECTIONS_REFLECTING_PLANE:
+ return "MEASUREMENT_CORRECTIONS_REFLECTING_PLANE";
+ default:
+ return "Unknown(" + capability + ")";
+ }
+ }
+}
diff --git a/location/java/android/location/GnssMeasurementCallbackTransport.java b/location/java/android/location/GnssMeasurementCallbackTransport.java
index 1188b13b..8cb8c0b 100644
--- a/location/java/android/location/GnssMeasurementCallbackTransport.java
+++ b/location/java/android/location/GnssMeasurementCallbackTransport.java
@@ -63,7 +63,7 @@
measurementCorrections, getContext().getPackageName());
}
- protected int getGnssCapabilities() throws RemoteException {
+ protected long getGnssCapabilities() throws RemoteException {
return mLocationManager.getGnssCapabilities(getContext().getPackageName());
}
diff --git a/location/java/android/location/GnssStatus.java b/location/java/android/location/GnssStatus.java
index 60c7748..ce464b7 100644
--- a/location/java/android/location/GnssStatus.java
+++ b/location/java/android/location/GnssStatus.java
@@ -42,6 +42,8 @@
public static final int CONSTELLATION_BEIDOU = 5;
/** Constellation type constant for Galileo. */
public static final int CONSTELLATION_GALILEO = 6;
+ /** Constellation type constant for IRNSS. */
+ public static final int CONSTELLATION_IRNSS = 7;
/** @hide */
public static final int GNSS_SV_FLAGS_NONE = 0;
@@ -94,7 +96,7 @@
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef({CONSTELLATION_UNKNOWN, CONSTELLATION_GPS, CONSTELLATION_SBAS, CONSTELLATION_GLONASS,
- CONSTELLATION_QZSS, CONSTELLATION_BEIDOU, CONSTELLATION_GALILEO})
+ CONSTELLATION_QZSS, CONSTELLATION_BEIDOU, CONSTELLATION_GALILEO, CONSTELLATION_IRNSS})
public @interface ConstellationType {}
final int[] mSvidWithFlags;
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index c371c5f..a4582b7 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -66,7 +66,7 @@
boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener, in String packageName);
void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections,
in String packageName);
- int getGnssCapabilities(in String packageName);
+ long getGnssCapabilities(in String packageName);
void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener);
boolean addGnssNavigationMessageListener(
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 01f1798..edf304c 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -1986,15 +1986,19 @@
}
/**
- * Returns the integer capability flags of the GNSS chipset as defined in {@code
- * IGnssCallback.hal}
+ * Returns the supported capabilities of the GNSS chipset or {@code null} if there is an error
+ * in obtaining the capabilities.
*
* @hide
*/
@SystemApi
- public int getGnssCapabilities() {
+ public @Nullable GnssCapabilities getGnssCapabilities() {
try {
- return mGnssMeasurementCallbackTransport.getGnssCapabilities();
+ long gnssCapabilities = mGnssMeasurementCallbackTransport.getGnssCapabilities();
+ if (gnssCapabilities == GnssCapabilities.INVALID_CAPABILITIES) {
+ return null;
+ }
+ return GnssCapabilities.of(gnssCapabilities);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/packages/SettingsLib/EntityHeaderWidgets/res/values/styles.xml b/packages/SettingsLib/EntityHeaderWidgets/res/values/styles.xml
index 0eefd4b..7db6014 100644
--- a/packages/SettingsLib/EntityHeaderWidgets/res/values/styles.xml
+++ b/packages/SettingsLib/EntityHeaderWidgets/res/values/styles.xml
@@ -31,7 +31,7 @@
</style>
<style name="AppEntitiesHeader.Text.Summary"
- parent="@android:style/TextAppearance.Material.Body1">
+ parent="@*android:style/TextAppearance.DeviceDefault.Body1">
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:textSize">14sp</item>
</style>
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
index 081f8a0..bb8c8a6 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
@@ -1,7 +1,6 @@
package com.android.settingslib.bluetooth;
import android.bluetooth.BluetoothClass;
-import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -10,7 +9,6 @@
import androidx.annotation.DrawableRes;
import com.android.settingslib.R;
-import com.android.settingslib.graph.BluetoothDeviceLayerDrawable;
import java.util.List;
@@ -51,38 +49,29 @@
public static Pair<Drawable, String> getBtClassDrawableWithDescription(Context context,
CachedBluetoothDevice cachedDevice) {
- return getBtClassDrawableWithDescription(context, cachedDevice, 1 /* iconScale */);
- }
-
- public static Pair<Drawable, String> getBtClassDrawableWithDescription(Context context,
- CachedBluetoothDevice cachedDevice, float iconScale) {
BluetoothClass btClass = cachedDevice.getBtClass();
- final int level = cachedDevice.getBatteryLevel();
if (btClass != null) {
switch (btClass.getMajorDeviceClass()) {
case BluetoothClass.Device.Major.COMPUTER:
return new Pair<>(getBluetoothDrawable(context,
- com.android.internal.R.drawable.ic_bt_laptop, level, iconScale),
+ com.android.internal.R.drawable.ic_bt_laptop),
context.getString(R.string.bluetooth_talkback_computer));
case BluetoothClass.Device.Major.PHONE:
return new Pair<>(
getBluetoothDrawable(context,
- com.android.internal.R.drawable.ic_phone, level,
- iconScale),
+ com.android.internal.R.drawable.ic_phone),
context.getString(R.string.bluetooth_talkback_phone));
case BluetoothClass.Device.Major.PERIPHERAL:
return new Pair<>(
- getBluetoothDrawable(context, HidProfile.getHidClassDrawable(btClass),
- level, iconScale),
+ getBluetoothDrawable(context, HidProfile.getHidClassDrawable(btClass)),
context.getString(R.string.bluetooth_talkback_input_peripheral));
case BluetoothClass.Device.Major.IMAGING:
return new Pair<>(
getBluetoothDrawable(context,
- com.android.internal.R.drawable.ic_settings_print, level,
- iconScale),
+ com.android.internal.R.drawable.ic_settings_print),
context.getString(R.string.bluetooth_talkback_imaging));
default:
@@ -94,38 +83,33 @@
for (LocalBluetoothProfile profile : profiles) {
int resId = profile.getDrawableResource(btClass);
if (resId != 0) {
- return new Pair<>(getBluetoothDrawable(context, resId, level, iconScale), null);
+ return new Pair<>(getBluetoothDrawable(context, resId), null);
}
}
if (btClass != null) {
if (btClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) {
return new Pair<>(
getBluetoothDrawable(context,
- com.android.internal.R.drawable.ic_bt_headset_hfp, level,
- iconScale),
+ com.android.internal.R.drawable.ic_bt_headset_hfp),
context.getString(R.string.bluetooth_talkback_headset));
}
if (btClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
return new Pair<>(
getBluetoothDrawable(context,
- com.android.internal.R.drawable.ic_bt_headphones_a2dp, level,
- iconScale),
+ com.android.internal.R.drawable.ic_bt_headphones_a2dp),
context.getString(R.string.bluetooth_talkback_headphone));
}
}
return new Pair<>(
getBluetoothDrawable(context,
- com.android.internal.R.drawable.ic_settings_bluetooth, level, iconScale),
+ com.android.internal.R.drawable.ic_settings_bluetooth),
context.getString(R.string.bluetooth_talkback_bluetooth));
}
- public static Drawable getBluetoothDrawable(Context context, @DrawableRes int resId,
- int batteryLevel, float iconScale) {
- if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) {
- return BluetoothDeviceLayerDrawable.createLayerDrawable(context, resId, batteryLevel,
- iconScale);
- } else {
- return context.getDrawable(resId);
- }
+ /**
+ * Get bluetooth drawable by {@code resId}
+ */
+ public static Drawable getBluetoothDrawable(Context context, @DrawableRes int resId) {
+ return context.getDrawable(resId);
}
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java
index 7a71551..b713e08 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java
@@ -15,36 +15,55 @@
*/
package com.android.settingslib.bluetooth;
-import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
-import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothClass;
+import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.util.Pair;
-import com.android.settingslib.graph.BluetoothDeviceLayerDrawable;
-
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class BluetoothUtilsTest {
- @Test
- public void testGetBluetoothDrawable_noBatteryLevel_returnSimpleDrawable() {
- final Drawable drawable = BluetoothUtils.getBluetoothDrawable(
- RuntimeEnvironment.application, com.android.internal.R.drawable.ic_bt_laptop,
- BluetoothDevice.BATTERY_LEVEL_UNKNOWN, 1 /* iconScale */);
+ @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+ private CachedBluetoothDevice mCachedBluetoothDevice;
+ private Context mContext;
- assertThat(drawable).isNotInstanceOf(BluetoothDeviceLayerDrawable.class);
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
+ mContext = spy(RuntimeEnvironment.application);
}
@Test
- public void testGetBluetoothDrawable_hasBatteryLevel_returnLayerDrawable() {
- final Drawable drawable = BluetoothUtils.getBluetoothDrawable(
- RuntimeEnvironment.application, com.android.internal.R.drawable.ic_bt_laptop,
- 10 /* batteryLevel */, 1 /* iconScale */);
+ public void getBtClassDrawableWithDescription_typePhone_returnPhoneDrawable() {
+ when(mCachedBluetoothDevice.getBtClass().getMajorDeviceClass()).thenReturn(
+ BluetoothClass.Device.Major.PHONE);
+ final Pair<Drawable, String> pair = BluetoothUtils.getBtClassDrawableWithDescription(
+ mContext, mCachedBluetoothDevice);
- assertThat(drawable).isInstanceOf(BluetoothDeviceLayerDrawable.class);
+ verify(mContext).getDrawable(com.android.internal.R.drawable.ic_phone);
}
-}
+
+ @Test
+ public void getBtClassDrawableWithDescription_typeComputer_returnComputerDrawable() {
+ when(mCachedBluetoothDevice.getBtClass().getMajorDeviceClass()).thenReturn(
+ BluetoothClass.Device.Major.COMPUTER);
+ final Pair<Drawable, String> pair = BluetoothUtils.getBtClassDrawableWithDescription(
+ mContext, mCachedBluetoothDevice);
+
+ verify(mContext).getDrawable(com.android.internal.R.drawable.ic_bt_laptop);
+ }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index e8b346e..49beae6 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -94,6 +94,9 @@
private boolean mActivityViewReady = false;
private PendingIntent mBubbleIntent;
+ private boolean mKeyboardVisible;
+ private boolean mNeedsNewHeight;
+
private int mMinHeight;
private int mHeaderHeight;
private int mBubbleHeight;
@@ -227,21 +230,15 @@
true /* singleTaskInstance */);
addView(mActivityView);
- mActivityView.setOnApplyWindowInsetsListener((View view, WindowInsets insets) -> {
- ActivityView activityView = (ActivityView) view;
- // Here we assume that the position of the ActivityView on the screen
- // remains regardless of IME status. When we move ActivityView, the
- // forwardedInsets should be computed not against the current location
- // and size, but against the post-moved location and size.
- Point displaySize = new Point();
- view.getContext().getDisplay().getSize(displaySize);
- int[] windowLocation = view.getLocationOnScreen();
- final int windowBottom = windowLocation[1] + view.getHeight();
+ setOnApplyWindowInsetsListener((View view, WindowInsets insets) -> {
+ // Keep track of IME displaying because we should not make any adjustments that might
+ // cause a config change while the IME is displayed otherwise it'll loose focus.
final int keyboardHeight = insets.getSystemWindowInsetBottom()
- insets.getStableInsetBottom();
- final int insetsBottom = Math.max(0,
- windowBottom + keyboardHeight - displaySize.y);
- activityView.setForwardedInsets(Insets.of(0, 0, 0, insetsBottom));
+ mKeyboardVisible = keyboardHeight != 0;
+ if (!mKeyboardVisible && mNeedsNewHeight) {
+ updateHeight();
+ }
return view.onApplyWindowInsets(insets);
});
@@ -258,6 +255,34 @@
}
}
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mKeyboardVisible = false;
+ mNeedsNewHeight = false;
+ if (mActivityView != null) {
+ mActivityView.setForwardedInsets(Insets.of(0, 0, 0, 0));
+ }
+ }
+
+ /**
+ * Called by {@link BubbleStackView} when the insets for the expanded state should be updated.
+ * This should be done post-move and post-animation.
+ */
+ void updateInsets(WindowInsets insets) {
+ if (usingActivityView()) {
+ Point displaySize = new Point();
+ mActivityView.getContext().getDisplay().getSize(displaySize);
+ int[] windowLocation = mActivityView.getLocationOnScreen();
+ final int windowBottom = windowLocation[1] + mActivityView.getHeight();
+ final int keyboardHeight = insets.getSystemWindowInsetBottom()
+ - insets.getStableInsetBottom();
+ final int insetsBottom = Math.max(0,
+ windowBottom + keyboardHeight - displaySize.y);
+ mActivityView.setForwardedInsets(Insets.of(0, 0, 0, insetsBottom));
+ }
+ }
+
/**
* Creates a background with corners rounded based on how the view is configured to display
*/
@@ -448,9 +473,15 @@
int height = Math.min(desiredHeight, max);
height = Math.max(height, mMinHeight);
LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams();
- lp.height = height;
- mBubbleHeight = height;
- mActivityView.setLayoutParams(lp);
+ mNeedsNewHeight = lp.height != height;
+ if (!mKeyboardVisible) {
+ // If the keyboard is visible... don't adjust the height because that will cause
+ // a configuration change and the keyboard will be lost.
+ lp.height = height;
+ mBubbleHeight = height;
+ mActivityView.setLayoutParams(lp);
+ mNeedsNewHeight = false;
+ }
} else {
mBubbleHeight = mNotifRow != null ? mNotifRow.getIntrinsicHeight() : mMinHeight;
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 461e79c..580acb8 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -128,6 +128,7 @@
private Bubble mExpandedBubble;
private boolean mIsExpanded;
+ private boolean mImeVisible;
private BubbleTouchHandler mTouchHandler;
private BubbleController.BubbleExpandListener mExpandListener;
@@ -236,6 +237,28 @@
setClipChildren(false);
setFocusable(true);
mBubbleContainer.bringToFront();
+
+ setOnApplyWindowInsetsListener((View view, WindowInsets insets) -> {
+ final int keyboardHeight = insets.getSystemWindowInsetBottom()
+ - insets.getStableInsetBottom();
+ if (!mIsExpanded) {
+ return view.onApplyWindowInsets(insets);
+ }
+ mImeVisible = keyboardHeight != 0;
+
+ float newY = getYPositionForExpandedView();
+ if (newY < 0) {
+ // TODO: This means our expanded content is too big to fit on screen. Right now
+ // we'll let it translate off but we should be clipping it & pushing the header
+ // down so that it always remains visible.
+ }
+ mExpandedViewYAnim.animateToFinalPosition(newY);
+ mExpandedAnimationController.updateYPosition(
+ // Update the insets after we're done translating otherwise position
+ // calculation for them won't be correct.
+ () -> mExpandedBubble.expandedView.updateInsets(insets));
+ return view.onApplyWindowInsets(insets);
+ });
}
/**
@@ -646,15 +669,6 @@
}
}
- /**
- * The width of the collapsed stack of bubbles.
- */
- public int getStackWidth() {
- return mBubblePadding * (mBubbleContainer.getChildCount() - 1)
- + mBubbleSize + mBubbleContainer.getPaddingEnd()
- + mBubbleContainer.getPaddingStart();
- }
-
private void notifyExpansionChanged(NotificationEntry entry, boolean expanded) {
if (mExpandListener != null) {
mExpandListener.onBubbleExpandChanged(expanded, entry != null ? entry.key : null);
@@ -843,8 +857,13 @@
// calculation is correct)
mExpandedBubble.expandedView.updateView();
final float y = getYPositionForExpandedView();
- mExpandedViewContainer.setTranslationY(y);
- // Then update the view so that ActivityView knows we translated
+ if (!mExpandedViewYAnim.isRunning()) {
+ // We're not animating so set the value
+ mExpandedViewContainer.setTranslationY(y);
+ } else {
+ // We are animating so update the value
+ mExpandedViewYAnim.animateToFinalPosition(y);
+ }
mExpandedBubble.expandedView.updateView();
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
index 1f29883..40e08be 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
@@ -198,6 +198,19 @@
}
/**
+ * Animates the bubbles to {@link #getExpandedY()} position. Used in response to IME showing.
+ */
+ public void updateYPosition(Runnable after) {
+ if (mLayout == null) return;
+
+ for (int i = 0; i < mLayout.getChildCount(); i++) {
+ boolean isLast = i == mLayout.getChildCount() - 1;
+ mLayout.animateValueForChildAtIndex(DynamicAnimation.TRANSLATION_Y, i,
+ getExpandedY(), isLast ? after : null);
+ }
+ }
+
+ /**
* Animates the bubbles, starting at the given index, to the left or right by the given number
* of bubble widths. Passing zero for numBubbleWidths will animate the bubbles to their normal
* positions.
@@ -213,18 +226,25 @@
/** The Y value of the row of expanded bubbles. */
public float getExpandedY() {
- boolean showOnTop = mLayout != null
- && BubbleController.showBubblesAtTop(mLayout.getContext());
- final WindowInsets insets = mLayout != null ? mLayout.getRootWindowInsets() : null;
- if (showOnTop && insets != null) {
+ if (mLayout == null || mLayout.getRootWindowInsets() == null) {
+ return 0;
+ }
+ final boolean showOnTop = BubbleController.showBubblesAtTop(mLayout.getContext());
+ final WindowInsets insets = mLayout.getRootWindowInsets();
+ if (showOnTop) {
return mBubblePaddingPx + Math.max(
mStatusBarHeight,
insets.getDisplayCutout() != null
? insets.getDisplayCutout().getSafeInsetTop()
: 0);
} else {
- int bottomInset = insets != null ? insets.getSystemWindowInsetBottom() : 0;
- return mDisplaySize.y - mBubbleSizePx - (mPipDismissHeight - bottomInset);
+ int keyboardHeight = insets.getSystemWindowInsetBottom()
+ - insets.getStableInsetBottom();
+ float bottomInset = keyboardHeight > 0
+ ? keyboardHeight
+ : (mPipDismissHeight - insets.getStableInsetBottom());
+ // Stable insets are excluded from display size, so we must subtract it
+ return mDisplaySize.y - mBubbleSizePx - mBubblePaddingPx - bottomInset;
}
}
diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto
index c5c4b5a..78f22e0 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -7124,6 +7124,14 @@
// OS: Q
DIALOG_FACE_REMOVE = 1693;
+ // FIELD - Detailed reason in screen wake. One of WAKE_REASON_* in PowerManager.
+ // OS: Q
+ FIELD_SCREEN_WAKE_REASON = 1694;
+
+ // FIELD - Detailed reason in screen sleep. One of GO_TO_SLEEP_REASON_* in PowerManager.
+ // OS: Q
+ FIELD_SCREEN_SLEEP_REASON = 1695;
+
// ---- End Q Constants, all Q constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 6597312..c1c125d 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -569,6 +569,42 @@
}
}
+ // Called by Shell command
+ boolean isDefaultAugmentedServiceEnabled(@UserIdInt int userId) {
+ enforceCallingPermissionForManagement();
+
+ synchronized (mLock) {
+ final AutofillManagerServiceImpl service = getServiceForUserLocked(userId);
+ if (service != null) {
+ return service.mAugmentedAutofillResolver.isDefaultServiceEnabled(userId);
+ }
+ }
+ return false;
+ }
+
+ // Called by Shell command
+ boolean setDefaultAugmentedServiceEnabled(@UserIdInt int userId, boolean enabled) {
+ Slog.i(mTag, "setDefaultAugmentedServiceEnabled() for userId " + userId + ": " + enabled);
+ enforceCallingPermissionForManagement();
+
+ synchronized (mLock) {
+ final AutofillManagerServiceImpl service = getServiceForUserLocked(userId);
+ if (service != null) {
+ final boolean changed = service.mAugmentedAutofillResolver
+ .setDefaultServiceEnabled(userId, enabled);
+ if (changed) {
+ service.updateRemoteAugmentedAutofillService();
+ return true;
+ } else {
+ if (debug) {
+ Slog.d(TAG, "setDefaultAugmentedServiceEnabled(): already " + enabled);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
private void setLoggingLevelsLocked(boolean debug, boolean verbose) {
com.android.server.autofill.Helper.sDebug = debug;
android.view.autofill.Helper.sDebug = debug;
@@ -647,6 +683,14 @@
send(receiver, value ? 1 : 0);
}
+ private void send(@NonNull IResultReceiver receiver, int value1, int value2) {
+ try {
+ receiver.send(value1, SyncResultReceiver.bundleFor(value2));
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Error async reporting result to client: " + e);
+ }
+ }
+
@Nullable
@VisibleForTesting
static Map<String, String[]> getWhitelistedCompatModePackages(String setting) {
@@ -967,14 +1011,20 @@
// TODO(b/113281366): add a callback method on AM to be notified when a task is finished
// so we can clean up sessions kept alive
final int taskId = mAm.getTaskIdForActivity(activityToken, false);
- final int sessionId;
+ final long result;
synchronized (mLock) {
final AutofillManagerServiceImpl service = getServiceForUserLocked(userId);
- sessionId = service.startSessionLocked(activityToken, taskId, getCallingUid(),
+ result = service.startSessionLocked(activityToken, taskId, getCallingUid(),
appCallback, autofillId, bounds, value, hasCallback, componentName,
compatMode, mAllowInstantService, flags);
}
- send(receiver, sessionId);
+ final int sessionId = (int) result;
+ final int resultFlags = (int) (result >> 32);
+ if (resultFlags != 0) {
+ send(receiver, sessionId, resultFlags);
+ } else {
+ send(receiver, sessionId);
+ }
}
@Override
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 22e5865..720d319 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -18,6 +18,7 @@
import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
import static android.view.autofill.AutofillManager.ACTION_START_SESSION;
+import static android.view.autofill.AutofillManager.FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY;
import static android.view.autofill.AutofillManager.NO_SESSION;
import static com.android.server.autofill.Helper.sDebug;
@@ -53,6 +54,7 @@
import android.service.autofill.FieldClassification.Match;
import android.service.autofill.FillEventHistory;
import android.service.autofill.FillEventHistory.Event;
+import android.service.autofill.FillRequest;
import android.service.autofill.FillResponse;
import android.service.autofill.IAutoFillService;
import android.service.autofill.UserData;
@@ -156,6 +158,7 @@
/** When was {@link PruneTask} last executed? */
private long mLastPrune = 0;
+ // TODO(b/128911469): move to AutofillManagerService
/**
* Object used to set the name of the augmented autofill service.
*/
@@ -221,7 +224,7 @@
session.removeSelfLocked();
}
}
- sendStateToClients(false);
+ sendStateToClients(/* resetClient= */ false);
}
updateRemoteAugmentedAutofillService();
return enabledChanged;
@@ -278,8 +281,15 @@
}
}
+ /**
+ * Starts a new session.
+ *
+ * @return {@code long} whose right-most 32 bits represent the session id (which is always
+ * non-negative), and the left-most contains extra flags (currently either {@code 0} or
+ * {@link FillRequest#FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY}).
+ */
@GuardedBy("mLock")
- int startSessionLocked(@NonNull IBinder activityToken, int taskId, int uid,
+ long startSessionLocked(@NonNull IBinder activityToken, int taskId, int uid,
@NonNull IBinder appCallbackToken, @NonNull AutofillId autofillId,
@NonNull Rect virtualBounds, @Nullable AutofillValue value, boolean hasCallback,
@NonNull ComponentName componentName, boolean compatMode,
@@ -289,33 +299,48 @@
}
final String shortComponentName = componentName.toShortString();
+ boolean forAugmentedAutofillOnly = false;
if (isAutofillDisabledLocked(componentName)) {
- if (sDebug) {
- Slog.d(TAG, "startSession(" + shortComponentName
- + "): ignored because disabled by service");
- }
+ // Service disabled autofill; that means no session, unless the activity is whitelisted
+ // for augmented autofill
+ if (isWhitelistedForAugmentedAutofillLocked(componentName)) {
+ if (sDebug) {
+ Slog.d(TAG, "startSession(" + shortComponentName + "): disabled by service but "
+ + "whitelisted for augmented autofill");
+ }
+ forAugmentedAutofillOnly = true;
- final IAutoFillManagerClient client = IAutoFillManagerClient.Stub
- .asInterface(appCallbackToken);
- try {
- client.setSessionFinished(AutofillManager.STATE_DISABLED_BY_SERVICE,
- /* autofillableIds= */ null);
- } catch (RemoteException e) {
- Slog.w(TAG, "Could not notify " + shortComponentName + " that it's disabled: " + e);
- }
+ } else {
+ if (sDebug) {
+ Slog.d(TAG, "startSession(" + shortComponentName + "): ignored because "
+ + "disabled by service and not whitelisted for augmented autofill");
+ }
+ final IAutoFillManagerClient client = IAutoFillManagerClient.Stub
+ .asInterface(appCallbackToken);
+ try {
+ client.setSessionFinished(AutofillManager.STATE_DISABLED_BY_SERVICE,
+ /* autofillableIds= */ null);
+ } catch (RemoteException e) {
+ Slog.w(TAG,
+ "Could not notify " + shortComponentName + " that it's disabled: " + e);
+ }
- return NO_SESSION;
+ return NO_SESSION;
+ }
}
- if (sVerbose) Slog.v(TAG, "startSession(): token=" + activityToken + ", flags=" + flags);
+ if (sVerbose) {
+ Slog.v(TAG, "startSession(): token=" + activityToken + ", flags=" + flags
+ + ", forAugmentedAutofillOnly=" + forAugmentedAutofillOnly);
+ }
// Occasionally clean up abandoned sessions
pruneAbandonedSessionsLocked();
final Session newSession = createSessionByTokenLocked(activityToken, taskId, uid,
appCallbackToken, hasCallback, componentName, compatMode,
- bindInstantServiceAllowed, flags);
+ bindInstantServiceAllowed, forAugmentedAutofillOnly, flags);
if (newSession == null) {
return NO_SESSION;
}
@@ -324,12 +349,20 @@
"id=" + newSession.id + " uid=" + uid + " a=" + shortComponentName
+ " s=" + mInfo.getServiceInfo().packageName
+ " u=" + mUserId + " i=" + autofillId + " b=" + virtualBounds
- + " hc=" + hasCallback + " f=" + flags;
+ + " hc=" + hasCallback + " f=" + flags + " aa=" + forAugmentedAutofillOnly;
mMaster.logRequestLocked(historyItem);
newSession.updateLocked(autofillId, virtualBounds, value, ACTION_START_SESSION, flags);
- return newSession.id;
+ if (forAugmentedAutofillOnly) {
+ // Must embed the flag in the response, at the high-end side of the long.
+ // (session is always positive, so we don't have to worry about the signal bit)
+ final long extraFlags = ((long) FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY) << 32;
+ final long result = extraFlags | newSession.id;
+ return result;
+ } else {
+ return newSession.id;
+ }
}
/**
@@ -435,7 +468,7 @@
private Session createSessionByTokenLocked(@NonNull IBinder activityToken, int taskId, int uid,
@NonNull IBinder appCallbackToken, boolean hasCallback,
@NonNull ComponentName componentName, boolean compatMode,
- boolean bindInstantServiceAllowed, int flags) {
+ boolean bindInstantServiceAllowed, boolean forAugmentedAutofillOnly, int flags) {
// use random ids so that one app cannot know that another app creates sessions
int sessionId;
int tries = 0;
@@ -446,15 +479,17 @@
return null;
}
- sessionId = sRandom.nextInt();
- } while (sessionId == NO_SESSION || mSessions.indexOfKey(sessionId) >= 0);
+ sessionId = Math.abs(sRandom.nextInt());
+ } while (sessionId == 0 || sessionId == NO_SESSION
+ || mSessions.indexOfKey(sessionId) >= 0);
assertCallerLocked(componentName, compatMode);
final Session newSession = new Session(this, mUi, getContext(), mHandler, mUserId, mLock,
sessionId, taskId, uid, activityToken, appCallbackToken, hasCallback,
mUiLatencyHistory, mWtfHistory, mInfo.getServiceInfo().getComponentName(),
- componentName, compatMode, bindInstantServiceAllowed, flags);
+ componentName, compatMode, bindInstantServiceAllowed, forAugmentedAutofillOnly,
+ flags);
mSessions.put(newSession.id, newSession);
return newSession;
@@ -634,7 +669,7 @@
remoteFillServices.valueAt(i).destroy();
}
- sendStateToClients(true);
+ sendStateToClients(/* resetclient=*/ true);
if (mClients != null) {
mClients.kill();
mClients = null;
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java
index c562fb1..bbe37a5 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java
@@ -109,6 +109,13 @@
+ "implementation.");
pw.println(" To reset, call with just the USER_ID argument.");
pw.println("");
+ pw.println(" set default-augmented-service-enabled USER_ID [true|false]");
+ pw.println(" Enable / disable the default augmented autofill service for the user.");
+ pw.println("");
+ pw.println(" get default-augmented-service-enabled USER_ID");
+ pw.println(" Checks whether the default augmented autofill service is enabled for "
+ + "the user.");
+ pw.println("");
pw.println(" list sessions [--user USER_ID]");
pw.println(" Lists all pending sessions.");
pw.println("");
@@ -136,6 +143,8 @@
return getFullScreenMode(pw);
case "bind-instant-service-allowed":
return getBindInstantService(pw);
+ case "default-augmented-service-enabled":
+ return getDefaultAugmentedServiceEnabled(pw);
default:
pw.println("Invalid set: " + what);
return -1;
@@ -158,6 +167,8 @@
return setBindInstantService(pw);
case "temporary-augmented-service":
return setTemporaryAugmentedService(pw);
+ case "default-augmented-service-enabled":
+ return setDefaultAugmentedServiceEnabled(pw);
default:
pw.println("Invalid set: " + what);
return -1;
@@ -314,6 +325,23 @@
return 0;
}
+ private int getDefaultAugmentedServiceEnabled(PrintWriter pw) {
+ final int userId = getNextIntArgRequired();
+ final boolean enabled = mService.isDefaultAugmentedServiceEnabled(userId);
+ pw.println(enabled);
+ return 0;
+ }
+
+ private int setDefaultAugmentedServiceEnabled(PrintWriter pw) {
+ final int userId = getNextIntArgRequired();
+ final boolean enabled = Boolean.parseBoolean(getNextArgRequired());
+ final boolean changed = mService.setDefaultAugmentedServiceEnabled(userId, enabled);
+ if (!changed) {
+ pw.println("already " + enabled);
+ }
+ return 0;
+ }
+
private int requestDestroy(PrintWriter pw) {
if (!isNextArgSessions(pw)) {
return -1;
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index ea47033..f08bab3 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -138,7 +138,11 @@
private static AtomicInteger sIdCounter = new AtomicInteger();
- /** ID of the session */
+ /**
+ * ID of the session.
+ *
+ * <p>It's always a positive number, to make it easier to embed it in a long.
+ */
public final int id;
/** uid the session is for */
@@ -277,6 +281,13 @@
private ArraySet<AutofillId> mAugmentedAutofillableIds;
/**
+ * When {@code true}, the session was created only to handle Augmented Autofill requests (i.e.,
+ * the session would not have existed otherwsie).
+ */
+ @GuardedBy("mLock")
+ private boolean mForAugmentedAutofillOnly;
+
+ /**
* Receiver of assist data from the app's {@link Activity}.
*/
private final IAssistDataReceiver mAssistReceiver = new IAssistDataReceiver.Stub() {
@@ -538,11 +549,12 @@
*/
@GuardedBy("mLock")
private void requestNewFillResponseLocked(int flags) {
-
- if ((flags & FLAG_AUGMENTED_AUTOFILL_REQUEST) != 0) {
+ if (mForAugmentedAutofillOnly || (flags & FLAG_AUGMENTED_AUTOFILL_REQUEST) != 0) {
// TODO(b/122858578): log metrics
if (sVerbose) {
- Slog.v(TAG, "requestNewFillResponse(): triggering augmented autofill instead");
+ Slog.v(TAG, "requestNewFillResponse(): triggering augmented autofill instead "
+ + "(mForAugmentedAutofillOnly=" + mForAugmentedAutofillOnly
+ + ", flags=" + flags + ")");
}
triggerAugmentedAutofillLocked();
return;
@@ -564,8 +576,8 @@
mRequestLogs.put(requestId, log);
if (sVerbose) {
- Slog.v(TAG, "Requesting structure for request #" + ordinal + " ,requestId="
- + requestId + ", flags=" + flags);
+ Slog.v(TAG, "Requesting structure for request #" + ordinal + " ,requestId=" + requestId
+ + ", flags=" + flags);
}
// If the focus changes very quickly before the first request is returned each focus change
@@ -598,7 +610,10 @@
@NonNull IBinder client, boolean hasCallback, @NonNull LocalLog uiLatencyHistory,
@NonNull LocalLog wtfHistory, @NonNull ComponentName serviceComponentName,
@NonNull ComponentName componentName, boolean compatMode,
- boolean bindInstantServiceAllowed, int flags) {
+ boolean bindInstantServiceAllowed, boolean forAugmentedAutofillOnly, int flags) {
+ if (sessionId < 0) {
+ wtf(null, "Non-positive sessionId: %s", sessionId);
+ }
id = sessionId;
mFlags = flags;
this.taskId = taskId;
@@ -616,6 +631,7 @@
mWtfHistory = wtfHistory;
mComponentName = componentName;
mCompatMode = compatMode;
+ mForAugmentedAutofillOnly = forAugmentedAutofillOnly;
setClientLocked(client);
mMetricsLogger.write(newLogMaker(MetricsEvent.AUTOFILL_SESSION_STARTED)
@@ -727,14 +743,6 @@
final long disableDuration = response.getDisableDuration();
if (disableDuration > 0) {
final int flags = response.getFlags();
- if (sDebug) {
- final StringBuilder message = new StringBuilder("Service disabled autofill for ")
- .append(mComponentName)
- .append(": flags=").append(flags)
- .append(", duration=");
- TimeUtils.formatDuration(disableDuration, message);
- Slog.d(TAG, message.toString());
- }
if ((flags & FillResponse.FLAG_DISABLE_ACTIVITY_ONLY) != 0) {
mService.disableAutofillForActivity(mComponentName, disableDuration,
id, mCompatMode);
@@ -742,6 +750,23 @@
mService.disableAutofillForApp(mComponentName.getPackageName(), disableDuration,
id, mCompatMode);
}
+ // Although "standard" autofill is disabled, it might still trigger augmented autofill
+ if (triggerAugmentedAutofillLocked() != null) {
+ mForAugmentedAutofillOnly = true;
+ if (sDebug) {
+ Slog.d(TAG, "Service disabled autofill for " + mComponentName
+ + ", but session is kept for augmented autofill only");
+ }
+ return;
+ }
+ if (sDebug) {
+ final StringBuilder message = new StringBuilder("Service disabled autofill for ")
+ .append(mComponentName)
+ .append(": flags=").append(flags)
+ .append(", duration=");
+ TimeUtils.formatDuration(disableDuration, message);
+ Slog.d(TAG, message.toString());
+ }
sessionFinishedState = AutofillManager.STATE_DISABLED_BY_SERVICE;
}
@@ -3005,6 +3030,9 @@
pw.print(prefix); pw.print("mSaveOnAllViewsInvisible: "); pw.println(
mSaveOnAllViewsInvisible);
pw.print(prefix); pw.print("mSelectedDatasetIds: "); pw.println(mSelectedDatasetIds);
+ if (mForAugmentedAutofillOnly) {
+ pw.print(prefix); pw.println("For Augmented Autofill Only");
+ }
if (mAugmentedAutofillDestroyer != null) {
pw.print(prefix); pw.println("has mAugmentedAutofillDestroyer");
}
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java
index 86ad52d..fc9754a 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java
@@ -114,7 +114,7 @@
case "temporary-service":
return setTemporaryService(pw);
case "default-service-enabled":
- return setDefaultServiceEnabled();
+ return setDefaultServiceEnabled(pw);
default:
pw.println("Invalid set: " + what);
return -1;
@@ -159,10 +159,13 @@
return 0;
}
- private int setDefaultServiceEnabled() {
+ private int setDefaultServiceEnabled(PrintWriter pw) {
final int userId = getNextIntArgRequired();
- final boolean enabled = Boolean.parseBoolean(getNextArg());
- mService.setDefaultServiceEnabled(userId, enabled);
+ final boolean enabled = Boolean.parseBoolean(getNextArgRequired());
+ final boolean changed = mService.setDefaultServiceEnabled(userId, enabled);
+ if (!changed) {
+ pw.println("already " + enabled);
+ }
return 0;
}
diff --git a/services/core/java/com/android/server/DynamicAndroidService.java b/services/core/java/com/android/server/DynamicAndroidService.java
index 8488941..b02bfb1 100644
--- a/services/core/java/com/android/server/DynamicAndroidService.java
+++ b/services/core/java/com/android/server/DynamicAndroidService.java
@@ -25,6 +25,7 @@
import android.os.IDynamicAndroidService;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.util.Slog;
/**
@@ -34,6 +35,7 @@
public class DynamicAndroidService extends IDynamicAndroidService.Stub implements DeathRecipient {
private static final String TAG = "DynamicAndroidService";
private static final String NO_SERVICE_ERROR = "no gsiservice";
+ private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
private Context mContext;
private volatile IGsiService mGsiService;
@@ -66,12 +68,27 @@
private IGsiService getGsiService() throws RemoteException {
checkPermission();
- synchronized (this) {
- if (mGsiService == null) {
- mGsiService = connect(this);
- }
- return mGsiService;
+ if (!"running".equals(SystemProperties.get("init.svc.gsid"))) {
+ SystemProperties.set("ctl.start", "gsid");
}
+ for (int sleepMs = 64; sleepMs <= (GSID_ROUGH_TIMEOUT_MS << 1); sleepMs <<= 1) {
+ try {
+ Thread.sleep(sleepMs);
+ } catch (InterruptedException e) {
+ Slog.e(TAG, "Interrupted when waiting for GSID");
+ break;
+ }
+ if ("running".equals(SystemProperties.get("init.svc.gsid"))) {
+ synchronized (this) {
+ if (mGsiService == null) {
+ mGsiService = connect(this);
+ }
+ return mGsiService;
+ }
+ }
+ }
+ Slog.e(TAG, "Unable to start gsid");
+ return null;
}
private void checkPermission() {
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 083d8da..31010c9 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -2940,7 +2940,7 @@
}
@Override
- public int getGnssCapabilities(String packageName) {
+ public long getGnssCapabilities(String packageName) {
mContext.enforceCallingPermission(
android.Manifest.permission.LOCATION_HARDWARE,
"Location Hardware permission not granted to obtain GNSS chipset capabilities.");
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 19b0bf7..077920c 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -21,6 +21,9 @@
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.OP_LEGACY_STORAGE;
import static android.app.AppOpsManager.OP_REQUEST_INSTALL_PACKAGES;
+import static android.content.pm.PackageManager.FLAG_PERMISSION_HIDDEN;
+import static android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
+import static android.content.pm.PackageManager.GET_PERMISSIONS;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
@@ -74,6 +77,7 @@
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Binder;
+import android.os.Build;
import android.os.DropBoxManager;
import android.os.Environment;
import android.os.Environment.UserEnvironment;
@@ -208,6 +212,13 @@
private static final boolean ENABLE_LEGACY_GREYLIST = SystemProperties
.getBoolean(StorageManager.PROP_LEGACY_GREYLIST, true);
+ /**
+ * If {@code 1}, enables the isolated storage feature. If {@code -1},
+ * disables the isolated storage feature. If {@code 0}, uses the default
+ * value from the build system.
+ */
+ private static final String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
+
public static class Lifecycle extends SystemService {
private StorageManagerService mStorageManagerService;
@@ -294,6 +305,19 @@
private static final String ATTR_LAST_TRIM_MILLIS = "lastTrimMillis";
private static final String ATTR_LAST_BENCH_MILLIS = "lastBenchMillis";
+ private static final String[] LEGACY_STORAGE_PERMISSIONS = {
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE
+ };
+
+ private static final String[] ALL_STORAGE_PERMISSIONS = {
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ Manifest.permission.READ_MEDIA_AUDIO,
+ Manifest.permission.READ_MEDIA_VIDEO,
+ Manifest.permission.READ_MEDIA_IMAGES
+ };
+
private final AtomicFile mSettingsFile;
/**
@@ -797,7 +821,7 @@
}
});
// For now, simply clone property when it changes
- DeviceConfig.addOnPropertyChangedListener(DeviceConfig.Storage.NAMESPACE,
+ DeviceConfig.addOnPropertyChangedListener(DeviceConfig.NAMESPACE_STORAGE,
mContext.getMainExecutor(), (namespace, name, value) -> {
refreshIsolatedStorageSettings();
});
@@ -837,8 +861,7 @@
// Always copy value from newer DeviceConfig location
Settings.Global.putString(mResolver,
Settings.Global.ISOLATED_STORAGE_REMOTE,
- DeviceConfig.getProperty(DeviceConfig.Storage.NAMESPACE,
- DeviceConfig.Storage.ISOLATED_STORAGE_ENABLED));
+ DeviceConfig.getProperty(DeviceConfig.NAMESPACE_STORAGE, ISOLATED_STORAGE_ENABLED));
final int local = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.ISOLATED_STORAGE_LOCAL, 0);
@@ -1668,16 +1691,18 @@
synchronized (mLock) {
final boolean thisIsolatedStorage = StorageManager.hasIsolatedStorage();
- if (mLastIsolatedStorage == thisIsolatedStorage) {
- // Nothing changed since last boot; keep rolling forward
- return;
- } else if (thisIsolatedStorage) {
- // This boot enables isolated storage; apply legacy behavior
- applyLegacyStorage();
+ if (mLastIsolatedStorage != thisIsolatedStorage) {
+ if (thisIsolatedStorage) {
+ // This boot enables isolated storage; apply legacy behavior
+ applyLegacyStorage();
+ }
+
+ // Always remember the new state we just booted with
+ writeSettingsLocked();
}
- // Always remember the new state we just booted with
- writeSettingsLocked();
+ // Execute special logic to recover certain devices
+ recoverFrom128872367();
}
}
@@ -1685,23 +1710,27 @@
* If we're enabling isolated storage, we need to remember which existing
* apps have already been using shared storage, and grant them legacy access
* to keep them running smoothly.
+ *
+ * @see com.android.server.pm.permission.PermissionManagerService
+ * #applyLegacyStoragePermissionModel
*/
private void applyLegacyStorage() {
final AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class);
final UserManagerInternal um = LocalServices.getService(UserManagerInternal.class);
for (int userId : um.getUserIds()) {
+ final UserHandle user = UserHandle.of(userId);
final PackageManager pm;
try {
- pm = mContext.createPackageContextAsUser(mContext.getPackageName(),
- 0, UserHandle.of(userId)).getPackageManager();
+ pm = mContext.createPackageContextAsUser(mContext.getPackageName(), 0,
+ user).getPackageManager();
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
- final List<PackageInfo> pkgs = pm.getPackagesHoldingPermissions(new String[] {
- android.Manifest.permission.READ_EXTERNAL_STORAGE,
- android.Manifest.permission.WRITE_EXTERNAL_STORAGE
- }, MATCH_UNINSTALLED_PACKAGES | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE);
+ final List<PackageInfo> pkgs = pm.getPackagesHoldingPermissions(
+ LEGACY_STORAGE_PERMISSIONS,
+ MATCH_UNINSTALLED_PACKAGES | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE
+ | GET_PERMISSIONS);
for (PackageInfo pkg : pkgs) {
final int uid = pkg.applicationInfo.uid;
final String packageName = pkg.applicationInfo.packageName;
@@ -1714,8 +1743,28 @@
Log.d(TAG, "Found " + uid + " " + packageName
+ " with granted storage access, last accessed " + lastAccess);
if (lastAccess > 0) {
- appOps.setMode(AppOpsManager.OP_LEGACY_STORAGE,
- uid, packageName, AppOpsManager.MODE_ALLOWED);
+ appOps.setUidMode(AppOpsManager.OP_LEGACY_STORAGE, uid,
+ AppOpsManager.MODE_ALLOWED);
+
+ // Grandfather pre-Q app by granting all permissions and fixing them. The user
+ // needs to uninstall the app to revoke the permissions.
+ // TODO: Deal with shard Uids
+ if (pkg.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q) {
+ for (String perm : ALL_STORAGE_PERMISSIONS) {
+ if (ArrayUtils.contains(pkg.requestedPermissions, perm)) {
+ pm.grantRuntimePermission(packageName, perm, user);
+
+ int flags = FLAG_PERMISSION_SYSTEM_FIXED;
+ if (!ArrayUtils.contains(LEGACY_STORAGE_PERMISSIONS, perm)) {
+ flags |= FLAG_PERMISSION_HIDDEN;
+ }
+
+ pm.updatePermissionFlags(perm, packageName,
+ FLAG_PERMISSION_SYSTEM_FIXED | FLAG_PERMISSION_HIDDEN,
+ flags, user);
+ }
+ }
+ }
}
}
}
@@ -1734,6 +1783,69 @@
return maxTime;
}
+ /**
+ * In b/128872367 we lost all app-ops on devices in the wild. This logic
+ * attempts to detect and recover from this by granting
+ * {@link AppOpsManager#OP_LEGACY_STORAGE} to any apps installed before
+ * isolated storage was enabled.
+ */
+ private void recoverFrom128872367() {
+ // We're interested in packages that were installed or updated between
+ // 1/1/2014 and 12/17/2018
+ final long START_TIMESTAMP = 1388534400000L;
+ final long END_TIMESTAMP = 1545004800000L;
+
+ final PackageManager pm = mContext.getPackageManager();
+ final AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class);
+ final UserManagerInternal um = LocalServices.getService(UserManagerInternal.class);
+
+ boolean activeDuringWindow = false;
+ List<PackageInfo> pendingHolders = new ArrayList<>();
+
+ for (int userId : um.getUserIds()) {
+ final List<PackageInfo> pkgs = pm.getInstalledPackagesAsUser(MATCH_UNINSTALLED_PACKAGES
+ | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, userId);
+ for (PackageInfo pkg : pkgs) {
+ // Determine if any apps on this device had been installed or
+ // updated during the period where the feature was disabled
+ activeDuringWindow |= (pkg.firstInstallTime > START_TIMESTAMP
+ && pkg.firstInstallTime < END_TIMESTAMP);
+ activeDuringWindow |= (pkg.lastUpdateTime > START_TIMESTAMP
+ && pkg.lastUpdateTime < END_TIMESTAMP);
+
+ // This app should hold legacy op if they were installed before
+ // the cutoff; we only check the end boundary here so that
+ // include system apps, which are always installed on 1/1/2009.
+ final boolean shouldHold = (pkg.firstInstallTime < END_TIMESTAMP);
+ final boolean doesHold = (appOps.checkOpNoThrow(OP_LEGACY_STORAGE,
+ pkg.applicationInfo.uid,
+ pkg.applicationInfo.packageName) == MODE_ALLOWED);
+
+ if (doesHold) {
+ Slog.d(TAG, "Found " + pkg + " holding legacy op; skipping recovery");
+ return;
+ } else if (shouldHold) {
+ Slog.d(TAG, "Found " + pkg + " that should hold legacy op");
+ pendingHolders.add(pkg);
+ }
+ }
+ }
+
+ if (!activeDuringWindow) {
+ Slog.d(TAG, "No packages were active during the time window; skipping grants");
+ return;
+ }
+
+ // If we made it this far, nobody actually holds the legacy op, which
+ // means we probably lost the database, and we should grant the op to
+ // all the apps we identified.
+ for (PackageInfo pkg : pendingHolders) {
+ appOps.setMode(AppOpsManager.OP_LEGACY_STORAGE,
+ pkg.applicationInfo.uid,
+ pkg.applicationInfo.packageName, AppOpsManager.MODE_ALLOWED);
+ }
+ }
+
private void systemReady() {
LocalServices.getService(ActivityTaskManagerInternal.class)
.registerScreenObserver(this);
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 9c26526..10b67c1 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -1132,7 +1132,7 @@
.build();
Preconditions.checkNotNull(callback, "callback cannot be null");
- mContext.enforcePermission(android.Manifest.permission.GET_APP_OPS_STATS,
+ mContext.enforcePermission(Manifest.permission.MANAGE_APPOPS,
Binder.getCallingPid(), Binder.getCallingUid(), "getHistoricalOps");
final String[] opNamesArray = (opNames != null)
@@ -1144,6 +1144,14 @@
}
@Override
+ public void reloadNonHistoricalState() {
+ mContext.enforcePermission(Manifest.permission.MANAGE_APPOPS,
+ Binder.getCallingPid(), Binder.getCallingUid(), "reloadNonHistoricalState");
+ writeState();
+ readState();
+ }
+
+ @Override
public List<AppOpsManager.PackageOps> getUidOps(int uid, int[] ops) {
mContext.enforcePermission(android.Manifest.permission.GET_APP_OPS_STATS,
Binder.getCallingPid(), Binder.getCallingUid(), null);
@@ -2998,6 +3006,7 @@
final LongSparseArray keys = op.collectKeys();
if (keys == null || keys.size() <= 0) {
+ out.endTag(null, "op");
continue;
}
diff --git a/services/core/java/com/android/server/infra/AbstractMasterSystemService.java b/services/core/java/com/android/server/infra/AbstractMasterSystemService.java
index 3c27bf2..430203d 100644
--- a/services/core/java/com/android/server/infra/AbstractMasterSystemService.java
+++ b/services/core/java/com/android/server/infra/AbstractMasterSystemService.java
@@ -332,21 +332,31 @@
* with the test results.
*
* @throws SecurityException if caller is not allowed to manage this service's settings.
+ *
+ * @return whether the enabled state changed.
*/
- public final void setDefaultServiceEnabled(@UserIdInt int userId, boolean enabled) {
+ public final boolean setDefaultServiceEnabled(@UserIdInt int userId, boolean enabled) {
Slog.i(mTag, "setDefaultServiceEnabled() for userId " + userId + ": " + enabled);
enforceCallingPermissionForManagement();
synchronized (mLock) {
+ final boolean changed = mServiceNameResolver.setDefaultServiceEnabled(userId, enabled);
+ if (!changed) {
+ if (verbose) {
+ Slog.v(mTag, "setDefaultServiceEnabled(" + userId + "): already " + enabled);
+ }
+ return false;
+ }
+
final S oldService = peekServiceForUserLocked(userId);
if (oldService != null) {
oldService.removeSelfFromCacheLocked();
}
- mServiceNameResolver.setDefaultServiceEnabled(userId, enabled);
// Must update the service on cache so its initialization code is triggered
updateCachedServiceLocked(userId);
}
+ return true;
}
/**
diff --git a/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java b/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java
index 1b23794..d204813 100644
--- a/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java
+++ b/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java
@@ -174,23 +174,35 @@
}
@Override
- public void setDefaultServiceEnabled(int userId, boolean enabled) {
+ public boolean setDefaultServiceEnabled(int userId, boolean enabled) {
synchronized (mLock) {
+ final boolean currentlyEnabled = isDefaultServiceEnabledLocked(userId);
+ if (currentlyEnabled == enabled) {
+ Slog.i(TAG, "setDefaultServiceEnabled(" + userId + "): already " + enabled);
+ return false;
+ }
if (enabled) {
+ Slog.i(TAG, "disabling default service for user " + userId);
mDefaultServicesDisabled.removeAt(userId);
} else {
+ Slog.i(TAG, "enabling default service for user " + userId);
mDefaultServicesDisabled.put(userId, true);
}
}
+ return true;
}
@Override
public boolean isDefaultServiceEnabled(int userId) {
synchronized (mLock) {
- return !mDefaultServicesDisabled.get(userId);
+ return isDefaultServiceEnabledLocked(userId);
}
}
+ private boolean isDefaultServiceEnabledLocked(int userId) {
+ return !mDefaultServicesDisabled.get(userId);
+ }
+
@Override
public String toString() {
return "FrameworkResourcesServiceNamer[temps=" + mTemporaryServiceNames + "]";
diff --git a/services/core/java/com/android/server/infra/ServiceNameResolver.java b/services/core/java/com/android/server/infra/ServiceNameResolver.java
index 5b60413..8c348ebb 100644
--- a/services/core/java/com/android/server/infra/ServiceNameResolver.java
+++ b/services/core/java/com/android/server/infra/ServiceNameResolver.java
@@ -115,11 +115,13 @@
*
* @param userId user handle
* @param enabled whether the default service should be used when the temporary service is not
- * set
+ * set. If the service enabled state is already that value, the command is ignored and this
+ * method return {@code false}.
*
+ * @return whether the enabled state changed.
* @throws UnsupportedOperationException if not implemented.
*/
- default void setDefaultServiceEnabled(@UserIdInt int userId, boolean enabled) {
+ default boolean setDefaultServiceEnabled(@UserIdInt int userId, boolean enabled) {
throw new UnsupportedOperationException("changing default service not supported");
}
diff --git a/services/core/java/com/android/server/pm/PackageKeySetData.java b/services/core/java/com/android/server/pm/PackageKeySetData.java
index a9126c0..031b5ce 100644
--- a/services/core/java/com/android/server/pm/PackageKeySetData.java
+++ b/services/core/java/com/android/server/pm/PackageKeySetData.java
@@ -107,10 +107,7 @@
}
protected void removeAllDefinedKeySets() {
- final int aliasSize = mKeySetAliases.size();
- for (int i = 0; i < aliasSize; i++) {
- mKeySetAliases.removeAt(i);
- }
+ mKeySetAliases.erase();
}
protected boolean isUsingDefinedKeySets() {
diff --git a/services/core/java/com/android/server/pm/ShortcutPackage.java b/services/core/java/com/android/server/pm/ShortcutPackage.java
index eced165..9782648 100644
--- a/services/core/java/com/android/server/pm/ShortcutPackage.java
+++ b/services/core/java/com/android/server/pm/ShortcutPackage.java
@@ -99,6 +99,7 @@
private static final String ATTR_ICON_RES_ID = "icon-res";
private static final String ATTR_ICON_RES_NAME = "icon-resname";
private static final String ATTR_BITMAP_PATH = "bitmap-path";
+ private static final String ATTR_LOCUS_ID = "locus-id";
private static final String ATTR_PERSON_NAME = "name";
private static final String ATTR_PERSON_URI = "uri";
@@ -1473,6 +1474,10 @@
ShortcutService.writeAttr(out, ATTR_DISABLED_REASON, si.getDisabledReason());
ShortcutService.writeAttr(out, ATTR_TIMESTAMP,
si.getLastChangedTimestamp());
+ final LocusId locusId = si.getLocusId();
+ if (locusId != null) {
+ ShortcutService.writeAttr(out, ATTR_LOCUS_ID, si.getLocusId().getId());
+ }
if (forBackup) {
// Don't write icon information. Also drop the dynamic flag.
@@ -1612,6 +1617,7 @@
int iconResId;
String iconResName;
String bitmapPath;
+ final String locusIdString;
int backupVersionCode;
ArraySet<String> categories = null;
ArrayList<Person> persons = new ArrayList<>();
@@ -1638,6 +1644,7 @@
iconResId = (int) ShortcutService.parseLongAttribute(parser, ATTR_ICON_RES_ID);
iconResName = ShortcutService.parseStringAttribute(parser, ATTR_ICON_RES_NAME);
bitmapPath = ShortcutService.parseStringAttribute(parser, ATTR_BITMAP_PATH);
+ locusIdString = ShortcutService.parseStringAttribute(parser, ATTR_LOCUS_ID);
final int outerDepth = parser.getDepth();
int type;
@@ -1703,7 +1710,7 @@
flags |= ShortcutInfo.FLAG_SHADOW;
}
- LocusId locusId = null; // LocusId is not set on XML.
+ final LocusId locusId = locusIdString == null ? null : new LocusId(locusIdString);
return new ShortcutInfo(
userId, id, packageName, activityComponent, /* icon= */ null,
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index 897b885..e36ac23 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -17,14 +17,20 @@
package com.android.server.pm.permission;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.READ_MEDIA_AUDIO;
+import static android.Manifest.permission.READ_MEDIA_IMAGES;
+import static android.Manifest.permission.READ_MEDIA_VIDEO;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.MODE_ERRORED;
import static android.app.AppOpsManager.MODE_FOREGROUND;
+import static android.app.AppOpsManager.MODE_IGNORED;
+import static android.app.AppOpsManager.OP_LEGACY_STORAGE;
import static android.app.AppOpsManager.OP_NONE;
import static android.app.AppOpsManager.permissionToOp;
import static android.app.AppOpsManager.permissionToOpCode;
import static android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT;
+import static android.content.pm.PackageManager.FLAG_PERMISSION_HIDDEN;
import static android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED;
import static android.content.pm.PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED;
import static android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE;
@@ -1149,6 +1155,8 @@
updatedUserIds);
updatedUserIds = setInitialGrantForNewImplicitPermissionsLocked(origPermissions,
permissionsState, pkg, updatedUserIds);
+ updatedUserIds = applyLegacyStoragePermissionModel(origPermissions, permissionsState,
+ pkg, updatedUserIds);
setAppOpsLocked(permissionsState, pkg);
}
@@ -1468,6 +1476,179 @@
}
/**
+ * Pre-Q apps use READ/WRITE_EXTERNAL_STORAGE, post-Q apps use READ_MEDIA_AUDIO/VIDEO/IMAGES.
+ *
+ * <p>There is the special case of the grandfathered post-Q app that has all legacy and modern
+ * permissions system-fixed granted. The only way to remove these permissions is to uninstall
+ * the app.
+ *
+ * @param origPs The permission state of the package before the update
+ * @param ps The permissions state of the package
+ * @param pkg The package
+ * @param updatedUserIds The userIds we have already been updated before
+ *
+ * @return The userIds that have been updated
+ *
+ * @see com.android.server.StorageManagerService#applyLegacyStorage()
+ */
+ private @NonNull int[] applyLegacyStoragePermissionModel(@NonNull PermissionsState origPs,
+ @NonNull PermissionsState ps, @NonNull PackageParser.Package pkg,
+ @NonNull int[] updatedUserIds) {
+ AppOpsManagerInternal appOpsManager = LocalServices.getService(AppOpsManagerInternal.class);
+ int[] users = UserManagerService.getInstance().getUserIds();
+
+ boolean isQApp = pkg.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q;
+ boolean isPreMApp = pkg.applicationInfo.targetSdkVersion < Build.VERSION_CODES.M;
+ int appId = getAppId(pkg.applicationInfo.uid);
+
+ int numRequestedPerms = pkg.requestedPermissions.size();
+ for (int i = 0; i < numRequestedPerms; i++) {
+ String perm = pkg.requestedPermissions.get(i);
+
+ boolean isLegacyStoragePermission = false;
+ boolean isModernStoragePermission = false;
+ switch (perm) {
+ case READ_EXTERNAL_STORAGE:
+ case WRITE_EXTERNAL_STORAGE:
+ isLegacyStoragePermission = true;
+ break;
+ case READ_MEDIA_AUDIO:
+ case READ_MEDIA_VIDEO:
+ case READ_MEDIA_IMAGES:
+ isModernStoragePermission = true;
+ break;
+ default:
+ // 'perm' is not a storage permission, skip it
+ continue;
+ }
+
+ BasePermission bp = mSettings.getPermissionLocked(perm);
+
+ for (int userId : users) {
+ boolean useLegacyStoragePermissionModel;
+ if (isQApp) {
+ useLegacyStoragePermissionModel = appOpsManager.checkOperationUnchecked(
+ OP_LEGACY_STORAGE, getUid(userId, appId), pkg.packageName)
+ == MODE_ALLOWED;
+ } else {
+ useLegacyStoragePermissionModel = true;
+ }
+
+ int origCombinedLegacyFlags =
+ origPs.getPermissionFlags(READ_EXTERNAL_STORAGE, userId)
+ | origPs.getPermissionFlags(WRITE_EXTERNAL_STORAGE, userId);
+
+ int origCombinedModernFlags = origPs.getPermissionFlags(READ_MEDIA_AUDIO, userId)
+ | origPs.getPermissionFlags(READ_MEDIA_VIDEO, userId)
+ | origPs.getPermissionFlags(READ_MEDIA_IMAGES, userId);
+
+ boolean oldPermAreLegacyStorageModel =
+ (origCombinedLegacyFlags & FLAG_PERMISSION_HIDDEN) == 0;
+ boolean oldPermAreModernStorageModel =
+ (origCombinedModernFlags & FLAG_PERMISSION_HIDDEN) == 0;
+
+ if (oldPermAreLegacyStorageModel && oldPermAreModernStorageModel) {
+ // This only happens after an platform upgrade from before Q
+ oldPermAreModernStorageModel = false;
+ }
+
+ boolean shouldBeRestricted;
+ boolean shouldBeFixed;
+ boolean shouldBeGranted = false;
+ boolean shouldBeRevoked = false;
+ int userFlags = -1;
+ if (useLegacyStoragePermissionModel) {
+ shouldBeRestricted = isModernStoragePermission;
+ shouldBeFixed = isQApp || isModernStoragePermission;
+
+ if (shouldBeFixed) {
+ userFlags = 0;
+ shouldBeGranted = true;
+ shouldBeRevoked = false;
+ } else if (oldPermAreModernStorageModel) {
+ // Inherit grant state on permission model change
+ userFlags = origCombinedModernFlags;
+
+ shouldBeGranted = origPs.hasRuntimePermission(READ_MEDIA_AUDIO, userId)
+ || origPs.hasRuntimePermission(READ_MEDIA_VIDEO, userId)
+ || origPs.hasRuntimePermission(READ_MEDIA_IMAGES, userId);
+
+ shouldBeRevoked = !shouldBeGranted;
+ }
+ } else {
+ shouldBeRestricted = isLegacyStoragePermission;
+ shouldBeFixed = isLegacyStoragePermission;
+
+ if (shouldBeFixed) {
+ userFlags = 0;
+ shouldBeGranted = true;
+ shouldBeRevoked = false;
+ } else if (oldPermAreLegacyStorageModel) {
+ // Inherit grant state on permission model change
+ userFlags = origCombinedLegacyFlags;
+
+ shouldBeGranted = origPs.hasRuntimePermission(READ_EXTERNAL_STORAGE, userId)
+ || origPs.hasRuntimePermission(WRITE_EXTERNAL_STORAGE, userId);
+
+ if ((origCombinedLegacyFlags & FLAG_PERMISSION_REVOKE_ON_UPGRADE) != 0
+ && !isPreMApp) {
+ shouldBeGranted = false;
+ }
+
+ shouldBeRevoked = !shouldBeGranted;
+ }
+ }
+
+ // Granted permissions can never be user fixed
+ if (shouldBeGranted & userFlags != -1) {
+ userFlags &= ~FLAG_PERMISSION_USER_FIXED;
+ }
+
+ boolean changed = false;
+ synchronized (mLock) {
+ if (shouldBeGranted) {
+ if (isPreMApp) {
+ setAppOpMode(perm, pkg, userId, MODE_ALLOWED);
+ } else if (!ps.hasRuntimePermission(perm, userId)) {
+ ps.grantRuntimePermission(bp, userId);
+ changed = true;
+ }
+ }
+
+ if (shouldBeRevoked) {
+ if (isPreMApp) {
+ setAppOpMode(perm, pkg, userId, MODE_IGNORED);
+ } else if (ps.hasRuntimePermission(perm, userId)) {
+ ps.revokeRuntimePermission(bp, userId);
+ changed = true;
+ }
+ }
+
+ if (shouldBeFixed) {
+ changed |= ps.updatePermissionFlags(mSettings.getPermissionLocked(perm),
+ userId, FLAG_PERMISSION_SYSTEM_FIXED, FLAG_PERMISSION_SYSTEM_FIXED);
+ }
+
+ if (userFlags != -1) {
+ changed |= ps.updatePermissionFlags(mSettings.getPermissionLocked(perm),
+ userId, USER_PERMISSION_FLAGS, userFlags);
+ }
+
+ changed |= ps.updatePermissionFlags(mSettings.getPermissionLocked(perm), userId,
+ FLAG_PERMISSION_HIDDEN,
+ shouldBeRestricted ? FLAG_PERMISSION_HIDDEN : 0);
+ }
+
+ if (changed) {
+ updatedUserIds = ArrayUtils.appendInt(updatedUserIds, userId);
+ }
+ }
+ }
+
+ return updatedUserIds;
+ }
+
+ /**
* Fix app-op modes for runtime permissions.
*
* @param permsState The state of the permissions of the package
diff --git a/services/core/java/com/android/server/pm/permission/TEST_MAPPING b/services/core/java/com/android/server/pm/permission/TEST_MAPPING
index 2280d3f..c610ed0 100644
--- a/services/core/java/com/android/server/pm/permission/TEST_MAPPING
+++ b/services/core/java/com/android/server/pm/permission/TEST_MAPPING
@@ -19,6 +19,9 @@
},
{
"include-filter": "android.permission.cts.PermissionFlagsTest"
+ },
+ {
+ "include-filter": "android.permission.cts.DualStoragePermissionModelTest"
}
]
},
diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java
index 1a82858..b81d969 100644
--- a/services/core/java/com/android/server/power/Notifier.java
+++ b/services/core/java/com/android/server/power/Notifier.java
@@ -486,6 +486,8 @@
log.setType(MetricsEvent.TYPE_OPEN);
log.setSubtype(why);
log.setLatency(interactiveChangeLatency);
+ log.addTaggedData(
+ MetricsEvent.FIELD_SCREEN_WAKE_REASON, mInteractiveChangeReason);
MetricsLogger.action(log);
EventLogTags.writePowerScreenState(1, 0, 0, 0, interactiveChangeLatency);
mPolicy.finishedWakingUp(why);
@@ -513,6 +515,8 @@
log.setType(MetricsEvent.TYPE_CLOSE);
log.setSubtype(why);
log.setLatency(interactiveChangeLatency);
+ log.addTaggedData(
+ MetricsEvent.FIELD_SCREEN_SLEEP_REASON, mInteractiveChangeReason);
MetricsLogger.action(log);
EventLogTags.writePowerScreenState(0, why, 0, 0, interactiveChangeLatency);
mPolicy.finishedGoingToSleep(why);
diff --git a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
index 1e2dad9..d632749 100644
--- a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
+++ b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
@@ -44,6 +44,7 @@
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.provider.DeviceConfig;
import android.util.IntArray;
import android.util.Log;
@@ -455,11 +456,8 @@
Intent broadcast = new Intent(Intent.ACTION_ROLLBACK_COMMITTED);
- // TODO: This call emits the warning "Calling a method in the
- // system process without a qualified user". Fix that.
- // TODO: Limit this to receivers holding the
- // MANAGE_ROLLBACKS or TEST_MANAGE_ROLLBACKS permissions?
- mContext.sendBroadcast(broadcast);
+ mContext.sendBroadcastAsUser(broadcast, UserHandle.SYSTEM,
+ Manifest.permission.MANAGE_ROLLBACKS);
});
}
);
diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java
index f6326957..75e34fb 100644
--- a/services/core/java/com/android/server/wm/AppTransitionController.java
+++ b/services/core/java/com/android/server/wm/AppTransitionController.java
@@ -19,6 +19,7 @@
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE;
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
+import static android.view.WindowManager.TRANSIT_ACTIVITY_RELAUNCH;
import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE;
import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION;
@@ -638,6 +639,39 @@
return transit;
}
+ /**
+ * Identifies whether the current transition occurs within a single task or not. This is used
+ * to determine whether animations should be clipped to the task bounds instead of stack bounds.
+ */
+ @VisibleForTesting
+ boolean isTransitWithinTask(int transit, Task task) {
+ if (task == null
+ || !mDisplayContent.mChangingApps.isEmpty()) {
+ // if there is no task, then we can't constrain to the task.
+ // if anything is changing, it can animate outside its task.
+ return false;
+ }
+ if (!(transit == TRANSIT_ACTIVITY_OPEN
+ || transit == TRANSIT_ACTIVITY_CLOSE
+ || transit == TRANSIT_ACTIVITY_RELAUNCH)) {
+ // only activity-level transitions will be within-task.
+ return false;
+ }
+ // check that all components are in the task.
+ for (AppWindowToken activity : mDisplayContent.mOpeningApps) {
+ Task activityTask = activity.getTask();
+ if (activityTask != task) {
+ return false;
+ }
+ }
+ for (AppWindowToken activity : mDisplayContent.mClosingApps) {
+ if (activity.getTask() != task) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private boolean canBeWallpaperTarget(ArraySet<AppWindowToken> apps) {
for (int i = apps.size() - 1; i >= 0; i--) {
if (apps.valueAt(i).windowsCanBeWallpaperTarget()) {
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index ea3a7d5..3f29181 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -2705,16 +2705,21 @@
// If the animation needs to be cropped then an animation bounds layer is created as a child
// of the pinned stack or animation layer. The leash is then reparented to this new layer.
if (mNeedsAnimationBoundsLayer) {
- final TaskStack stack = getStack();
- if (stack == null) {
- return;
+ mTmpRect.setEmpty();
+ final Task task = getTask();
+ if (getDisplayContent().mAppTransitionController.isTransitWithinTask(
+ getTransit(), task)) {
+ task.getBounds(mTmpRect);
+ } else {
+ final TaskStack stack = getStack();
+ if (stack == null) {
+ return;
+ }
+ // Set clip rect to stack bounds.
+ stack.getBounds(mTmpRect);
}
mAnimationBoundsLayer = createAnimationBoundsLayer(t);
- // Set clip rect to stack bounds.
- mTmpRect.setEmpty();
- stack.getBounds(mTmpRect);
-
// Crop to stack bounds.
t.setWindowCrop(mAnimationBoundsLayer, mTmpRect);
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index a4955f0..a6e9fdd 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -119,7 +119,6 @@
using android::hardware::gnss::V1_0::IAGnssRilCallback;
using android::hardware::gnss::V1_0::IGnssBatching;
using android::hardware::gnss::V1_0::IGnssBatchingCallback;
-using android::hardware::gnss::V1_0::IGnssDebug;
using android::hardware::gnss::V1_0::IGnssGeofenceCallback;
using android::hardware::gnss::V1_0::IGnssGeofencing;
using android::hardware::gnss::V1_0::IGnssNavigationMessage;
@@ -143,9 +142,12 @@
using IGnss_V1_0 = android::hardware::gnss::V1_0::IGnss;
using IGnss_V1_1 = android::hardware::gnss::V1_1::IGnss;
using IGnss_V2_0 = android::hardware::gnss::V2_0::IGnss;
+using IGnssCallback_V1_0 = android::hardware::gnss::V1_0::IGnssCallback;
using IGnssConfiguration_V1_0 = android::hardware::gnss::V1_0::IGnssConfiguration;
using IGnssConfiguration_V1_1 = android::hardware::gnss::V1_1::IGnssConfiguration;
using IGnssConfiguration_V2_0 = android::hardware::gnss::V2_0::IGnssConfiguration;
+using IGnssDebug_V1_0 = android::hardware::gnss::V1_0::IGnssDebug;
+using IGnssDebug_V2_0 = android::hardware::gnss::V2_0::IGnssDebug;
using IGnssMeasurement_V1_0 = android::hardware::gnss::V1_0::IGnssMeasurement;
using IGnssMeasurement_V1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
using IGnssMeasurement_V2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
@@ -191,7 +193,8 @@
sp<IAGnss_V1_0> agnssIface = nullptr;
sp<IAGnss_V2_0> agnssIface_V2_0 = nullptr;
sp<IGnssBatching> gnssBatchingIface = nullptr;
-sp<IGnssDebug> gnssDebugIface = nullptr;
+sp<IGnssDebug_V1_0> gnssDebugIface = nullptr;
+sp<IGnssDebug_V2_0> gnssDebugIface_V2_0 = nullptr;
sp<IGnssConfiguration_V1_0> gnssConfigurationIface = nullptr;
sp<IGnssConfiguration_V1_1> gnssConfigurationIface_V1_1 = nullptr;
sp<IGnssConfiguration_V2_0> gnssConfigurationIface_V2_0 = nullptr;
@@ -548,7 +551,9 @@
struct GnssCallback : public IGnssCallback {
Return<void> gnssLocationCb(const GnssLocation_V1_0& location) override;
Return<void> gnssStatusCb(const IGnssCallback::GnssStatusValue status) override;
- Return<void> gnssSvStatusCb(const IGnssCallback::GnssSvStatus& svStatus) override;
+ Return<void> gnssSvStatusCb(const IGnssCallback_V1_0::GnssSvStatus& svStatus) override {
+ return gnssSvStatusCbImpl(svStatus);
+ }
Return<void> gnssNmeaCb(int64_t timestamp, const android::hardware::hidl_string& nmea) override;
Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override;
Return<void> gnssAcquireWakelockCb() override;
@@ -566,16 +571,47 @@
override;
Return<void> gnssSetCapabilitiesCb_2_0(uint32_t capabilities) override;
Return<void> gnssLocationCb_2_0(const GnssLocation_V2_0& location) override;
-
- // Templated implementation for gnnsLocationCb and gnnsLocationCb_2_0.
- template <class T>
- Return<void> gnssLocationCbImpl(const T& location);
+ Return<void> gnssSvStatusCb_2_0(const hidl_vec<IGnssCallback::GnssSvInfo>& svInfoList) override {
+ return gnssSvStatusCbImpl(svInfoList);
+ }
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;
+private:
+ template<class T>
+ Return<void> gnssLocationCbImpl(const T& location);
+
+ template<class T>
+ Return<void> gnssSvStatusCbImpl(const T& svStatus);
+
+ uint32_t getGnssSvInfoListSize(const IGnssCallback_V1_0::GnssSvStatus& svStatus) {
+ return svStatus.numSvs;
+ }
+
+ uint32_t getGnssSvInfoListSize(const hidl_vec<IGnssCallback::GnssSvInfo>& svInfoList) {
+ return svInfoList.size();
+ }
+
+ const IGnssCallback_V1_0::GnssSvInfo& getGnssSvInfoOfIndex(
+ const IGnssCallback_V1_0::GnssSvStatus& svStatus, size_t i) {
+ return svStatus.gnssSvList.data()[i];
+ }
+
+ const IGnssCallback_V1_0::GnssSvInfo& getGnssSvInfoOfIndex(
+ const hidl_vec<IGnssCallback::GnssSvInfo>& svInfoList, size_t i) {
+ return svInfoList[i].v1_0;
+ }
+
+ uint32_t getConstellationType(const IGnssCallback_V1_0::GnssSvStatus& svStatus, size_t i) {
+ return static_cast<uint32_t>(svStatus.gnssSvList.data()[i].constellation);
+ }
+
+ uint32_t getConstellationType(const hidl_vec<IGnssCallback::GnssSvInfo>& svInfoList, size_t i) {
+ return static_cast<uint32_t>(svInfoList[i].constellation);
+ }
};
Return<void> GnssCallback::gnssNameCb(const android::hardware::hidl_string& name) {
@@ -623,10 +659,11 @@
return Void();
}
-Return<void> GnssCallback::gnssSvStatusCb(const IGnssCallback::GnssSvStatus& svStatus) {
+template<class T>
+Return<void> GnssCallback::gnssSvStatusCbImpl(const T& svStatus) {
JNIEnv* env = getJniEnv();
- uint32_t listSize = svStatus.numSvs;
+ uint32_t listSize = getGnssSvInfoListSize(svStatus);
if (listSize > static_cast<uint32_t>(
android::hardware::gnss::V1_0::GnssMax::SVS_COUNT)) {
ALOGD("Too many satellites %u. Clamps to %u.", listSize,
@@ -655,9 +692,9 @@
CONSTELLATION_TYPE_SHIFT_WIDTH = 4
};
- const IGnssCallback::GnssSvInfo& info = svStatus.gnssSvList.data()[i];
+ const IGnssCallback_V1_0::GnssSvInfo& info = getGnssSvInfoOfIndex(svStatus, i);
svidWithFlags[i] = (info.svid << SVID_SHIFT_WIDTH) |
- (static_cast<uint32_t>(info.constellation) << CONSTELLATION_TYPE_SHIFT_WIDTH) |
+ (getConstellationType(svStatus, i) << CONSTELLATION_TYPE_SHIFT_WIDTH) |
static_cast<uint32_t>(info.svFlag);
cn0s[i] = info.cN0Dbhz;
elev[i] = info.elevationDegrees;
@@ -1079,6 +1116,9 @@
// Overwrite with v2_0.state since v2_0->v1_1->v1_0.state is deprecated.
SET(State, static_cast<int32_t>(measurement_V2_0->state));
+
+ // Overwrite with v2_0.constellation since v2_0->v1_1->v1_0.constellation is deprecated.
+ SET(ConstellationType, static_cast<int32_t>(measurement_V2_0->constellation));
}
jobject GnssMeasurementCallback::translateGnssClock(
@@ -1656,11 +1696,21 @@
}
}
- auto gnssDebug = gnssHal->getExtensionGnssDebug();
- if (!gnssDebug.isOk()) {
- ALOGD("Unable to get a handle to GnssDebug");
+ if (gnssHal_V2_0 != nullptr) {
+ auto gnssDebug = gnssHal_V2_0->getExtensionGnssDebug_2_0();
+ if (!gnssDebug.isOk()) {
+ ALOGD("Unable to get a handle to GnssDebug_V2_0");
+ } else {
+ gnssDebugIface_V2_0 = gnssDebug;
+ gnssDebugIface = gnssDebugIface_V2_0;
+ }
} else {
- gnssDebugIface = gnssDebug;
+ auto gnssDebug = gnssHal->getExtensionGnssDebug();
+ if (!gnssDebug.isOk()) {
+ ALOGD("Unable to get a handle to GnssDebug");
+ } else {
+ gnssDebugIface = gnssDebug;
+ }
}
auto gnssNi = gnssHal->getExtensionGnssNi();
@@ -2189,6 +2239,76 @@
gnssNiIface->respond(notifId, static_cast<IGnssNiCallback::GnssUserResponseType>(response));
}
+const IGnssDebug_V1_0::SatelliteData& getSatelliteData(const hidl_vec<IGnssDebug_V1_0::SatelliteData>& satelliteDataArray, size_t i) {
+ return satelliteDataArray[i];
+}
+
+const IGnssDebug_V1_0::SatelliteData& getSatelliteData(const hidl_vec<IGnssDebug_V2_0::SatelliteData>& satelliteDataArray, size_t i) {
+ return satelliteDataArray[i].v1_0;
+}
+
+template<class T>
+uint32_t getConstellationType(const hidl_vec<T>& satelliteDataArray, size_t i) {
+ return static_cast<uint32_t>(satelliteDataArray[i].constellation);
+}
+
+template<class T>
+static jstring parseDebugData(JNIEnv* env, std::stringstream& internalState, const T& data) {
+ internalState << "Gnss Location Data:: ";
+ if (!data.position.valid) {
+ internalState << "not valid";
+ } else {
+ internalState << "LatitudeDegrees: " << data.position.latitudeDegrees
+ << ", LongitudeDegrees: " << data.position.longitudeDegrees
+ << ", altitudeMeters: " << data.position.altitudeMeters
+ << ", speedMetersPerSecond: " << data.position.speedMetersPerSec
+ << ", bearingDegrees: " << data.position.bearingDegrees
+ << ", horizontalAccuracyMeters: "
+ << data.position.horizontalAccuracyMeters
+ << ", verticalAccuracyMeters: " << data.position.verticalAccuracyMeters
+ << ", speedAccuracyMetersPerSecond: "
+ << data.position.speedAccuracyMetersPerSecond
+ << ", bearingAccuracyDegrees: " << data.position.bearingAccuracyDegrees
+ << ", ageSeconds: " << data.position.ageSeconds;
+ }
+ internalState << std::endl;
+
+ internalState << "Gnss Time Data:: timeEstimate: " << data.time.timeEstimate
+ << ", timeUncertaintyNs: " << data.time.timeUncertaintyNs
+ << ", frequencyUncertaintyNsPerSec: "
+ << data.time.frequencyUncertaintyNsPerSec << std::endl;
+
+ if (data.satelliteDataArray.size() != 0) {
+ internalState << "Satellite Data for " << data.satelliteDataArray.size()
+ << " satellites:: " << std::endl;
+ }
+
+ internalState << "constell: 1=GPS, 2=SBAS, 3=GLO, 4=QZSS, 5=BDS, 6=GAL, 7=IRNSS; "
+ << "ephType: 0=Eph, 1=Alm, 2=Unk; "
+ << "ephSource: 0=Demod, 1=Supl, 2=Server, 3=Unk; "
+ << "ephHealth: 0=Good, 1=Bad, 2=Unk" << std::endl;
+ for (size_t i = 0; i < data.satelliteDataArray.size(); i++) {
+ IGnssDebug_V1_0::SatelliteData satelliteData =
+ getSatelliteData(data.satelliteDataArray, i);
+ internalState << "constell: "
+ << getConstellationType(data.satelliteDataArray, i)
+ << ", svid: " << std::setw(3) << satelliteData.svid
+ << ", serverPredAvail: "
+ << satelliteData.serverPredictionIsAvailable
+ << ", serverPredAgeSec: " << std::setw(7)
+ << satelliteData.serverPredictionAgeSeconds
+ << ", ephType: "
+ << static_cast<uint32_t>(satelliteData.ephemerisType)
+ << ", ephSource: "
+ << static_cast<uint32_t>(satelliteData.ephemerisSource)
+ << ", ephHealth: "
+ << static_cast<uint32_t>(satelliteData.ephemerisHealth)
+ << ", ephAgeSec: " << std::setw(7)
+ << satelliteData.ephemerisAgeSeconds << std::endl;
+ }
+ return (jstring) env->NewStringUTF(internalState.str().c_str());
+}
+
static jstring android_location_GnssLocationProvider_get_internal_state(JNIEnv* env,
jobject /* obj */) {
jstring result = nullptr;
@@ -2200,65 +2320,19 @@
if (gnssDebugIface == nullptr) {
internalState << "Gnss Debug Interface not available" << std::endl;
- } else {
- IGnssDebug::DebugData data;
- gnssDebugIface->getDebugData([&data](const IGnssDebug::DebugData& debugData) {
+ } else if (gnssDebugIface_V2_0 != nullptr) {
+ IGnssDebug_V2_0::DebugData data;
+ gnssDebugIface_V2_0->getDebugData_2_0([&data](const IGnssDebug_V2_0::DebugData& debugData) {
data = debugData;
});
-
- internalState << "Gnss Location Data:: ";
- if (!data.position.valid) {
- internalState << "not valid";
- } else {
- internalState << "LatitudeDegrees: " << data.position.latitudeDegrees
- << ", LongitudeDegrees: " << data.position.longitudeDegrees
- << ", altitudeMeters: " << data.position.altitudeMeters
- << ", speedMetersPerSecond: " << data.position.speedMetersPerSec
- << ", bearingDegrees: " << data.position.bearingDegrees
- << ", horizontalAccuracyMeters: "
- << data.position.horizontalAccuracyMeters
- << ", verticalAccuracyMeters: " << data.position.verticalAccuracyMeters
- << ", speedAccuracyMetersPerSecond: "
- << data.position.speedAccuracyMetersPerSecond
- << ", bearingAccuracyDegrees: " << data.position.bearingAccuracyDegrees
- << ", ageSeconds: " << data.position.ageSeconds;
- }
- internalState << std::endl;
-
- internalState << "Gnss Time Data:: timeEstimate: " << data.time.timeEstimate
- << ", timeUncertaintyNs: " << data.time.timeUncertaintyNs
- << ", frequencyUncertaintyNsPerSec: "
- << data.time.frequencyUncertaintyNsPerSec << std::endl;
-
- if (data.satelliteDataArray.size() != 0) {
- internalState << "Satellite Data for " << data.satelliteDataArray.size()
- << " satellites:: " << std::endl;
- }
-
- internalState << "constell: 1=GPS, 2=SBAS, 3=GLO, 4=QZSS, 5=BDS, 6=GAL; "
- << "ephType: 0=Eph, 1=Alm, 2=Unk; "
- << "ephSource: 0=Demod, 1=Supl, 2=Server, 3=Unk; "
- << "ephHealth: 0=Good, 1=Bad, 2=Unk" << std::endl;
- for (size_t i = 0; i < data.satelliteDataArray.size(); i++) {
- internalState << "constell: "
- << static_cast<uint32_t>(data.satelliteDataArray[i].constellation)
- << ", svid: " << std::setw(3) << data.satelliteDataArray[i].svid
- << ", serverPredAvail: "
- << data.satelliteDataArray[i].serverPredictionIsAvailable
- << ", serverPredAgeSec: " << std::setw(7)
- << data.satelliteDataArray[i].serverPredictionAgeSeconds
- << ", ephType: "
- << static_cast<uint32_t>(data.satelliteDataArray[i].ephemerisType)
- << ", ephSource: "
- << static_cast<uint32_t>(data.satelliteDataArray[i].ephemerisSource)
- << ", ephHealth: "
- << static_cast<uint32_t>(data.satelliteDataArray[i].ephemerisHealth)
- << ", ephAgeSec: " << std::setw(7)
- << data.satelliteDataArray[i].ephemerisAgeSeconds << std::endl;
- }
+ result = parseDebugData(env, internalState, data);
+ } else {
+ IGnssDebug_V1_0::DebugData data;
+ gnssDebugIface->getDebugData([&data](const IGnssDebug_V1_0::DebugData& debugData) {
+ data = debugData;
+ });
+ result = parseDebugData(env, internalState, data);
}
-
- result = env->NewStringUTF(internalState.str().c_str());
return result;
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
index cd095a5..fa1bcac 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
@@ -35,6 +35,7 @@
import android.app.Person;
import android.content.ComponentName;
import android.content.Intent;
+import android.content.LocusId;
import android.content.pm.ShortcutInfo;
import android.content.res.Resources;
import android.graphics.BitmapFactory;
@@ -895,6 +896,7 @@
.setIntent(makeIntent("action", ShortcutActivity.class, "key", "val"))
.setRank(123)
.setExtras(pb)
+ .setLocusId(new LocusId("1.2.3.4.5"))
.build();
sorig.setTimestamp(mInjectedCurrentTimeMillis);
@@ -906,6 +908,7 @@
.setPersons(list(makePerson("person1", "personKey1", "personUri1"),
makePerson("person2", "personKey2", "personUri2")).toArray(new Person[2]))
.setRank(456)
+ .setLocusId(new LocusId("6.7.8.9"))
.build();
sorig2.setTimestamp(mInjectedCurrentTimeMillis);
@@ -946,6 +949,7 @@
assertEquals("personUri", si.getPersons()[0].getUri());
assertEquals(0, si.getRank());
assertEquals(1, si.getExtras().getInt("k"));
+ assertEquals("1.2.3.4.5", si.getLocusId().getId());
assertEquals(ShortcutInfo.FLAG_DYNAMIC | ShortcutInfo.FLAG_HAS_ICON_FILE
| ShortcutInfo.FLAG_STRINGS_RESOLVED, si.getFlags());
@@ -959,6 +963,7 @@
assertEquals(1, si.getRank());
assertEquals(2, si.getPersons().length);
assertEquals("personUri2", si.getPersons()[1].getUri());
+ assertEquals("6.7.8.9", si.getLocusId().getId());
dumpUserFile(USER_10);
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
index 81133d1..9bd9930 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
@@ -17,12 +17,16 @@
package com.android.server.wm;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
import static android.view.WindowManager.TRANSIT_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_TASK_OPEN;
import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
import android.platform.test.annotations.Presubmit;
import android.view.WindowManager;
@@ -95,4 +99,24 @@
TRANSIT_TASK_CHANGE_WINDOWING_MODE));
}
}
+
+ @Test
+ public void testTransitWithinTask() {
+ synchronized (mWm.mGlobalLock) {
+ final AppWindowToken opening = createAppWindowToken(mDisplayContent,
+ WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD);
+ opening.setFillsParent(false);
+ final AppWindowToken closing = createAppWindowToken(mDisplayContent,
+ WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD);
+ closing.setFillsParent(false);
+ Task task = opening.getTask();
+ mDisplayContent.mOpeningApps.add(opening);
+ mDisplayContent.mClosingApps.add(closing);
+ assertFalse(mAppTransitionController.isTransitWithinTask(TRANSIT_ACTIVITY_OPEN, task));
+ closing.getTask().removeChild(closing);
+ task.addChild(closing, 0);
+ assertTrue(mAppTransitionController.isTransitWithinTask(TRANSIT_ACTIVITY_OPEN, task));
+ assertFalse(mAppTransitionController.isTransitWithinTask(TRANSIT_TASK_OPEN, task));
+ }
+ }
}
diff --git a/telephony/java/android/telephony/ims/ImsException.java b/telephony/java/android/telephony/ims/ImsException.java
index 02eddf6..8c686f7 100644
--- a/telephony/java/android/telephony/ims/ImsException.java
+++ b/telephony/java/android/telephony/ims/ImsException.java
@@ -31,7 +31,7 @@
* @hide
*/
@SystemApi
-public class ImsException extends Exception {
+public final class ImsException extends Exception {
/**
* The operation has failed due to an unknown or unspecified error.
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
index 771886f..52919df 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
@@ -84,7 +84,8 @@
RollbackTestUtils.adoptShellPermissionIdentity(
Manifest.permission.INSTALL_PACKAGES,
Manifest.permission.DELETE_PACKAGES,
- Manifest.permission.TEST_MANAGE_ROLLBACKS);
+ Manifest.permission.TEST_MANAGE_ROLLBACKS,
+ Manifest.permission.MANAGE_ROLLBACKS);
// Register a broadcast receiver for notification when the
// rollback has been committed.
diff --git a/tools/aapt2/Android.bp b/tools/aapt2/Android.bp
index 8bef221..aca2be1 100644
--- a/tools/aapt2/Android.bp
+++ b/tools/aapt2/Android.bp
@@ -198,3 +198,22 @@
static_libs: ["libaapt2"],
defaults: ["aapt2_defaults"],
}
+
+// ==========================================================
+// Dist the protos
+// ==========================================================
+genrule {
+ name: "aapt2-protos",
+ tools: [":soong_zip"],
+ srcs: [
+ "Configuration.proto",
+ "Resources.proto",
+ ],
+ out: ["aapt2-protos.zip"],
+ cmd: "mkdir $(genDir)/protos && " +
+ "cp $(in) $(genDir)/protos && " +
+ "$(location :soong_zip) -o $(out) -C $(genDir)/protos -D $(genDir)/protos",
+ dist: {
+ targets: ["sdk_repo"],
+ },
+}
diff --git a/tools/aapt2/link/TableMerger.cpp b/tools/aapt2/link/TableMerger.cpp
index e937517..a24e0d2f 100644
--- a/tools/aapt2/link/TableMerger.cpp
+++ b/tools/aapt2/link/TableMerger.cpp
@@ -58,7 +58,7 @@
// valid. This is because un-mangled references are mangled, then looked up at resolution
// time. Also, when linking, we convert references with no package name to use the compilation
// package name.
- error |= !DoMerge(src, table, package.get(), false /*mangle*/, overlay, allow_new);
+ error |= !DoMerge(src, package.get(), false /*mangle*/, overlay, allow_new);
}
}
return !error;
@@ -78,7 +78,7 @@
bool mangle = package_name != context_->GetCompilationPackage();
merged_packages_.insert(package->name);
- error |= !DoMerge(src, table, package.get(), mangle, false /*overlay*/, true /*allow_new*/);
+ error |= !DoMerge(src, package.get(), mangle, false /*overlay*/, true /*allow_new*/);
}
return !error;
}
@@ -213,9 +213,8 @@
return collision_result;
}
-bool TableMerger::DoMerge(const Source& src, ResourceTable* src_table,
- ResourceTablePackage* src_package, bool mangle_package, bool overlay,
- bool allow_new_resources) {
+bool TableMerger::DoMerge(const Source& src, ResourceTablePackage* src_package, bool mangle_package,
+ bool overlay, bool allow_new_resources) {
bool error = false;
for (auto& src_type : src_package->types) {
@@ -337,8 +336,7 @@
->FindOrCreateValue(file_desc.config, {})
->value = std::move(file_ref);
- return DoMerge(file->GetSource(), &table, pkg, false /*mangle*/, overlay /*overlay*/,
- true /*allow_new*/);
+ return DoMerge(file->GetSource(), pkg, false /*mangle*/, overlay /*overlay*/, true /*allow_new*/);
}
} // namespace aapt
diff --git a/tools/aapt2/link/TableMerger.h b/tools/aapt2/link/TableMerger.h
index 24c5e13..51305cf 100644
--- a/tools/aapt2/link/TableMerger.h
+++ b/tools/aapt2/link/TableMerger.h
@@ -85,8 +85,8 @@
bool MergeImpl(const Source& src, ResourceTable* src_table, bool overlay, bool allow_new);
- bool DoMerge(const Source& src, ResourceTable* src_table, ResourceTablePackage* src_package,
- bool mangle_package, bool overlay, bool allow_new_resources);
+ bool DoMerge(const Source& src, ResourceTablePackage* src_package, bool mangle_package,
+ bool overlay, bool allow_new_resources);
std::unique_ptr<FileReference> CloneAndMangleFile(const std::string& package,
const FileReference& value);