diff options
129 files changed, 2377 insertions, 895 deletions
diff --git a/Android.bp b/Android.bp index 3ecb5a9340d2..9411eeca834c 100644 --- a/Android.bp +++ b/Android.bp @@ -340,6 +340,7 @@ java_library { "android.hardware.cas-V1.2-java", "android.hardware.contexthub-V1.0-java", "android.hardware.gnss-V1.0-java", + "android.hardware.gnss-V2.1-java", "android.hardware.health-V1.0-java-constants", "android.hardware.radio-V1.0-java", "android.hardware.radio-V1.1-java", diff --git a/apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java b/apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java index 47af7c0a5ed9..00d9efbb1fcd 100644 --- a/apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java +++ b/apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java @@ -323,6 +323,28 @@ public class BlobStoreManager { } /** + * Opens a file descriptor to read the blob content already written into this session. + * + * @return a {@link ParcelFileDescriptor} for reading from the blob file. + * + * @throws IOException when there is an I/O error while opening the file to read. + * @throws SecurityException when the caller is not the owner of the session. + * @throws IllegalStateException when the caller tries to read the file after it is + * abandoned (using {@link #abandon()}) + * or closed (using {@link #close()}). + */ + public @NonNull ParcelFileDescriptor openRead() throws IOException { + try { + return mSession.openRead(); + } catch (ParcelableException e) { + e.maybeRethrow(IOException.class); + throw new RuntimeException(e); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Gets the size of the blob file that was written to the session so far. * * @return the size of the blob file so far. diff --git a/apex/blobstore/framework/java/android/app/blob/IBlobStoreSession.aidl b/apex/blobstore/framework/java/android/app/blob/IBlobStoreSession.aidl index 4ae919bfedab..4035b96938d9 100644 --- a/apex/blobstore/framework/java/android/app/blob/IBlobStoreSession.aidl +++ b/apex/blobstore/framework/java/android/app/blob/IBlobStoreSession.aidl @@ -21,6 +21,7 @@ import android.os.ParcelFileDescriptor; /** {@hide} */ interface IBlobStoreSession { ParcelFileDescriptor openWrite(long offsetBytes, long lengthBytes); + ParcelFileDescriptor openRead(); void allowPackageAccess(in String packageName, in byte[] certificate); void allowSameSignatureAccess(); diff --git a/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java b/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java index 29092b327fc7..612fd89ebbe0 100644 --- a/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java +++ b/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java @@ -17,6 +17,7 @@ package com.android.server.blob; import static android.app.blob.BlobStoreManager.COMMIT_RESULT_ERROR; import static android.system.OsConstants.O_CREAT; +import static android.system.OsConstants.O_RDONLY; import static android.system.OsConstants.O_RDWR; import static android.system.OsConstants.SEEK_SET; @@ -187,6 +188,40 @@ public class BlobStoreSession extends IBlobStoreSession.Stub { } @Override + @NonNull + public ParcelFileDescriptor openRead() { + assertCallerIsOwner(); + synchronized (mSessionLock) { + if (mState != STATE_OPENED) { + throw new IllegalStateException("Not allowed to read in state: " + + stateToString(mState)); + } + + try { + return openReadLocked(); + } catch (IOException e) { + throw ExceptionUtils.wrap(e); + } + } + } + + @GuardedBy("mSessionLock") + @NonNull + private ParcelFileDescriptor openReadLocked() throws IOException { + FileDescriptor fd = null; + try { + final File sessionFile = getSessionFile(); + if (sessionFile == null) { + throw new IllegalStateException("Couldn't get the file for this session"); + } + fd = Os.open(sessionFile.getPath(), O_RDONLY, 0); + } catch (ErrnoException e) { + e.rethrowAsIOException(); + } + return createRevocableFdLocked(fd); + } + + @Override @BytesLong public long getSize() { return 0; diff --git a/api/current.txt b/api/current.txt index 16dee4b58da6..c05034744ac8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -333,6 +333,9 @@ package android { field public static final int autoUrlDetect = 16843404; // 0x101028c field public static final int autoVerify = 16844014; // 0x10104ee field public static final int autofillHints = 16844118; // 0x1010556 + field public static final int autofillInlineSuggestionChip = 16844307; // 0x1010613 + field public static final int autofillInlineSuggestionSubtitle = 16844309; // 0x1010615 + field public static final int autofillInlineSuggestionTitle = 16844308; // 0x1010614 field public static final int autofilledHighlight = 16844136; // 0x1010568 field public static final int background = 16842964; // 0x10100d4 field public static final int backgroundDimAmount = 16842802; // 0x1010032 @@ -2253,6 +2256,7 @@ package android { field public static final int ThemeOverlay_Material_Dialog = 16974550; // 0x10302d6 field public static final int ThemeOverlay_Material_Dialog_Alert = 16974551; // 0x10302d7 field public static final int ThemeOverlay_Material_Light = 16974410; // 0x103024a + field public static final int Theme_AutofillInlineSuggestion = 16974565; // 0x10302e5 field public static final int Theme_Black = 16973832; // 0x1030008 field public static final int Theme_Black_NoTitleBar = 16973833; // 0x1030009 field public static final int Theme_Black_NoTitleBar_Fullscreen = 16973834; // 0x103000a @@ -7543,6 +7547,7 @@ package android.app.blob { method public boolean isPackageAccessAllowed(@NonNull String, @NonNull byte[]) throws java.io.IOException; method public boolean isPublicAccessAllowed() throws java.io.IOException; method public boolean isSameSignatureAccessAllowed() throws java.io.IOException; + method @NonNull public android.os.ParcelFileDescriptor openRead() throws java.io.IOException; method @NonNull public android.os.ParcelFileDescriptor openWrite(long, long) throws java.io.IOException; } @@ -17259,6 +17264,8 @@ package android.hardware.camera2 { method public void onCameraAccessPrioritiesChanged(); method public void onCameraAvailable(@NonNull String); method public void onCameraUnavailable(@NonNull String); + method public void onPhysicalCameraAvailable(@NonNull String, @NonNull String); + method public void onPhysicalCameraUnavailable(@NonNull String, @NonNull String); } public abstract static class CameraManager.TorchCallback { @@ -23390,6 +23397,9 @@ package android.location { method public long getFullBiasNanos(); method public int getHardwareClockDiscontinuityCount(); method public int getLeapSecond(); + method @FloatRange(from=0.0) public double getReferenceCarrierFrequencyHzForIsb(); + method @NonNull public String getReferenceCodeTypeForIsb(); + method public int getReferenceConstellationTypeForIsb(); method public long getTimeNanos(); method @FloatRange(from=0.0f) public double getTimeUncertaintyNanos(); method public boolean hasBiasNanos(); @@ -23400,6 +23410,9 @@ package android.location { method public boolean hasElapsedRealtimeUncertaintyNanos(); method public boolean hasFullBiasNanos(); method public boolean hasLeapSecond(); + method public boolean hasReferenceCarrierFrequencyHzForIsb(); + method public boolean hasReferenceCodeTypeForIsb(); + method public boolean hasReferenceConstellationTypeForIsb(); method public boolean hasTimeUncertaintyNanos(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR; @@ -23424,6 +23437,10 @@ package android.location { method public double getPseudorangeRateUncertaintyMetersPerSecond(); method public long getReceivedSvTimeNanos(); method public long getReceivedSvTimeUncertaintyNanos(); + method public double getReceiverInterSignalBiasNanos(); + method @FloatRange(from=0.0) public double getReceiverInterSignalBiasUncertaintyNanos(); + method public double getSatelliteInterSignalBiasNanos(); + method @FloatRange(from=0.0) public double getSatelliteInterSignalBiasUncertaintyNanos(); method public double getSnrInDb(); method public int getState(); method public int getSvid(); @@ -23435,6 +23452,10 @@ package android.location { method @Deprecated public boolean hasCarrierPhase(); method @Deprecated public boolean hasCarrierPhaseUncertainty(); method public boolean hasCodeType(); + method public boolean hasReceiverInterSignalBiasNanos(); + method public boolean hasReceiverInterSignalBiasUncertaintyNanos(); + method public boolean hasSatelliteInterSignalBiasNanos(); + method public boolean hasSatelliteInterSignalBiasUncertaintyNanos(); method public boolean hasSnrInDb(); method public void writeToParcel(android.os.Parcel, int); field public static final int ADR_STATE_CYCLE_SLIP = 4; // 0x4 @@ -27634,6 +27655,8 @@ package android.media.audiofx { field public static final int CONTENT_TYPE_VOICE = 3; // 0x3 field public static final String EFFECT_AUXILIARY = "Auxiliary"; field public static final String EFFECT_INSERT = "Insert"; + field public static final String EFFECT_POST_PROCESSING = "Post Processing"; + field public static final String EFFECT_PRE_PROCESSING = "Pre Processing"; field public static final java.util.UUID EFFECT_TYPE_AEC; field public static final java.util.UUID EFFECT_TYPE_AGC; field public static final java.util.UUID EFFECT_TYPE_BASS_BOOST; @@ -47714,10 +47737,10 @@ package android.telephony.euicc { field public static final int ERROR_CERTIFICATE_ERROR = 10012; // 0x271c field public static final int ERROR_CONNECTION_ERROR = 10014; // 0x271e field public static final int ERROR_DISALLOWED_BY_PPR = 10010; // 0x271a - field public static final int ERROR_EUICC_GSMA_INSTALL_ERROR = 10009; // 0x2719 field public static final int ERROR_EUICC_INSUFFICIENT_MEMORY = 10004; // 0x2714 field public static final int ERROR_EUICC_MISSING = 10006; // 0x2716 field public static final int ERROR_INCOMPATIBLE_CARRIER = 10003; // 0x2713 + field public static final int ERROR_INSTALL_PROFILE = 10009; // 0x2719 field public static final int ERROR_INVALID_ACTIVATION_CODE = 10001; // 0x2711 field public static final int ERROR_INVALID_CONFIRMATION_CODE = 10002; // 0x2712 field public static final int ERROR_INVALID_RESPONSE = 10015; // 0x271f @@ -52617,6 +52640,7 @@ package android.view { method public android.graphics.Canvas lockHardwareCanvas(); method public void readFromParcel(android.os.Parcel); method public void release(); + method public void setFrameRate(@FloatRange(from=0.0) float); method @Deprecated public void unlockCanvas(android.graphics.Canvas); method public void unlockCanvasAndPost(android.graphics.Canvas); method public void writeToParcel(android.os.Parcel, int); @@ -52660,6 +52684,7 @@ package android.view { method @NonNull public android.view.SurfaceControl.Transaction reparent(@NonNull android.view.SurfaceControl, @Nullable android.view.SurfaceControl); method @NonNull public android.view.SurfaceControl.Transaction setAlpha(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0, to=1.0) float); method @NonNull public android.view.SurfaceControl.Transaction setBufferSize(@NonNull android.view.SurfaceControl, @IntRange(from=0) int, @IntRange(from=0) int); + method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float); method @NonNull public android.view.SurfaceControl.Transaction setGeometry(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, int); method @NonNull public android.view.SurfaceControl.Transaction setLayer(@NonNull android.view.SurfaceControl, @IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) int); method @NonNull public android.view.SurfaceControl.Transaction setVisibility(@NonNull android.view.SurfaceControl, boolean); diff --git a/api/system-current.txt b/api/system-current.txt index a2f363f0d947..a90909c8d7fb 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -250,6 +250,7 @@ package android { public static final class R.attr { field public static final int allowClearUserDataOnFailedRestore = 16844288; // 0x1010600 + field public static final int isAutofillInlineSuggestionTheme = 16844310; // 0x1010616 field public static final int isVrOnly = 16844152; // 0x1010578 field public static final int minExtensionVersion = 16844306; // 0x1010612 field public static final int requiredSystemPropertyName = 16844133; // 0x1010565 @@ -2063,6 +2064,21 @@ package android.content.pm { method @NonNull public final int getType(); } + public final class InstallationFile implements android.os.Parcelable { + ctor public InstallationFile(@NonNull String, long, @Nullable byte[]); + method public int describeContents(); + method public int getFileType(); + method @Nullable public byte[] getMetadata(); + method @NonNull public String getName(); + method public long getSize(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstallationFile> CREATOR; + field public static final int FILE_TYPE_APK = 0; // 0x0 + field public static final int FILE_TYPE_LIB = 1; // 0x1 + field public static final int FILE_TYPE_OBB = 2; // 0x2 + field public static final int FILE_TYPE_UNKNOWN = -1; // 0xffffffff + } + public final class InstantAppInfo implements android.os.Parcelable { ctor public InstantAppInfo(android.content.pm.ApplicationInfo, String[], String[]); ctor public InstantAppInfo(String, CharSequence, String[], String[]); @@ -2153,11 +2169,16 @@ package android.content.pm { field public static final int DATA_LOADER_TYPE_NONE = 0; // 0x0 field public static final int DATA_LOADER_TYPE_STREAMING = 1; // 0x1 field public static final String EXTRA_DATA_LOADER_TYPE = "android.content.pm.extra.DATA_LOADER_TYPE"; + field public static final int LOCATION_DATA_APP = 0; // 0x0 + field public static final int LOCATION_MEDIA_DATA = 2; // 0x2 + field public static final int LOCATION_MEDIA_OBB = 1; // 0x1 } public static class PackageInstaller.Session implements java.io.Closeable { - method public void addFile(@NonNull String, long, @NonNull byte[]); + method public void addFile(int, @NonNull String, long, @NonNull byte[], @Nullable byte[]); method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void commitTransferred(@NonNull android.content.IntentSender); + method @Nullable public android.content.pm.DataLoaderParams getDataLoaderParams(); + method public void removeFile(int, @NonNull String); } public static class PackageInstaller.SessionInfo implements android.os.Parcelable { @@ -8321,22 +8342,22 @@ package android.os { method @NonNull public android.os.BatterySaverPolicyConfig.Builder setLocationMode(int); } - public class BatteryStatsManager { + public final class BatteryStatsManager { method @NonNull @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public android.os.connectivity.CellularBatteryStats getCellularBatteryStats(); method @NonNull @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public android.os.connectivity.WifiBatteryStats getWifiBatteryStats(); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteFullWifiLockAcquiredFromSource(@NonNull android.os.WorkSource); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteFullWifiLockReleasedFromSource(@NonNull android.os.WorkSource); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiBatchedScanStartedFromSource(@NonNull android.os.WorkSource, @IntRange(from=0) int); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiBatchedScanStoppedFromSource(@NonNull android.os.WorkSource); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiMulticastDisabled(int); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiMulticastEnabled(int); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiOff(); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiOn(); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiRssiChanged(@IntRange(from=0xffffff81, to=0) int); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiScanStartedFromSource(@NonNull android.os.WorkSource); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiScanStoppedFromSource(@NonNull android.os.WorkSource); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiState(int, @Nullable String); - method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void noteWifiSupplicantStateChanged(int, boolean); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportFullWifiLockAcquiredFromSource(@NonNull android.os.WorkSource); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportFullWifiLockReleasedFromSource(@NonNull android.os.WorkSource); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiBatchedScanStartedFromSource(@NonNull android.os.WorkSource, @IntRange(from=0) int); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiBatchedScanStoppedFromSource(@NonNull android.os.WorkSource); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiMulticastDisabled(int); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiMulticastEnabled(int); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiOff(); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiOn(); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiRssiChanged(@IntRange(from=0xffffff81, to=0) int); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiScanStartedFromSource(@NonNull android.os.WorkSource); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiScanStoppedFromSource(@NonNull android.os.WorkSource); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiState(int, @Nullable String); + method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void reportWifiSupplicantStateChanged(int, boolean); field public static final int WIFI_STATE_OFF = 0; // 0x0 field public static final int WIFI_STATE_OFF_SCANNING = 1; // 0x1 field public static final int WIFI_STATE_ON_CONNECTED_P2P = 5; // 0x5 @@ -8780,16 +8801,13 @@ package android.os { method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getEuiccCardControllerServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getEuiccControllerService(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getIccPhoneBookServiceRegisterer(); - method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getNetworkPolicyServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getOpportunisticNetworkServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getPackageManagerServiceRegisterer(); - method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getPermissionManagerServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getPhoneSubServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getSmsServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getSubscriptionServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getTelephonyImsServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getTelephonyRcsMessageServiceRegisterer(); - method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getTelephonyRegistryServiceRegisterer(); method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getTelephonyServiceRegisterer(); } @@ -9010,12 +9028,12 @@ package android.os.connectivity { public final class WifiBatteryStats implements android.os.Parcelable { method public int describeContents(); + method public long getAppScanRequestCount(); method public long getEnergyConsumedMaMillis(); method public long getIdleTimeMillis(); method public long getKernelActiveTimeMillis(); method public long getLoggingDurationMillis(); method public long getMonitoredRailChargeConsumedMaMillis(); - method public long getNumAppScanRequest(); method public long getNumBytesRx(); method public long getNumBytesTx(); method public long getNumPacketsRx(); @@ -9714,6 +9732,7 @@ package android.provider { field public static final String HPLMNS = "hplmns"; field public static final String ICC_ID = "icc_id"; field public static final String IMSI = "imsi"; + field public static final String IMS_RCS_UCE_ENABLED = "ims_rcs_uce_enabled"; field public static final String ISO_COUNTRY_CODE = "iso_country_code"; field public static final String IS_EMBEDDED = "is_embedded"; field public static final String IS_OPPORTUNISTIC = "is_opportunistic"; @@ -10126,6 +10145,16 @@ package android.service.dataloader { public abstract class DataLoaderService extends android.app.Service { ctor public DataLoaderService(); + method @Nullable public android.service.dataloader.DataLoaderService.DataLoader onCreateDataLoader(); + } + + public static interface DataLoaderService.DataLoader { + method public boolean onCreate(@NonNull android.content.pm.DataLoaderParams, @NonNull android.service.dataloader.DataLoaderService.FileSystemConnector); + method public boolean onPrepareImage(@NonNull java.util.Collection<android.content.pm.InstallationFile>, @NonNull java.util.Collection<java.lang.String>); + } + + public static final class DataLoaderService.FileSystemConnector { + method public void writeData(@NonNull String, long, long, @NonNull android.os.ParcelFileDescriptor) throws java.io.IOException; } } @@ -11551,7 +11580,7 @@ package android.telephony { } public final class ModemActivityInfo implements android.os.Parcelable { - ctor public ModemActivityInfo(long, int, int, @Nullable int[], int); + ctor public ModemActivityInfo(long, int, int, @NonNull int[], int); method public int describeContents(); method public int getIdleTimeMillis(); method public int getReceiveTimeMillis(); @@ -12290,6 +12319,7 @@ package android.telephony { public class TelephonyRegistryManager { method public void addOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener, @NonNull java.util.concurrent.Executor); method public void addOnSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener, @NonNull java.util.concurrent.Executor); + method public void listenForSubscriber(int, @NonNull String, @NonNull String, @NonNull android.telephony.PhoneStateListener, int, boolean); method public void notifyActiveDataSubIdChanged(int); method public void notifyBarringInfoChanged(int, int, @NonNull android.telephony.BarringInfo); method public void notifyCallForwardingChanged(int, boolean); @@ -12306,6 +12336,9 @@ package android.telephony { method public void notifyEmergencyNumberList(int, int); method public void notifyImsDisconnectCause(int, @NonNull android.telephony.ims.ImsReasonInfo); method public void notifyMessageWaitingChanged(int, int, boolean); + method public void notifyOpportunisticSubscriptionInfoChanged(); + method public void notifyOutgoingEmergencyCall(int, int, @NonNull android.telephony.emergency.EmergencyNumber); + method public void notifyOutgoingEmergencySms(int, int, @NonNull android.telephony.emergency.EmergencyNumber); method public void notifyPhoneCapabilityChanged(@NonNull android.telephony.PhoneCapability); method public void notifyPreciseCallState(int, int, int, int, int); method public void notifyPreciseDataConnectionFailed(int, int, int, @Nullable String, int); @@ -12314,6 +12347,7 @@ package android.telephony { method public void notifyServiceStateChanged(int, int, @NonNull android.telephony.ServiceState); method public void notifySignalStrengthChanged(int, int, @NonNull android.telephony.SignalStrength); method public void notifySrvccStateChanged(int, int); + method public void notifySubscriptionInfoChanged(); method public void notifyUserMobileDataStateChanged(int, int, boolean); method public void notifyVoiceActivationStateChanged(int, int, int); method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener); @@ -12619,6 +12653,11 @@ package android.telephony.euicc { method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent); method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent); method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public int getOtaStatus(); + method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public java.util.List<java.lang.String> getSupportedCountries(); + method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public java.util.List<java.lang.String> getUnsupportedCountries(); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public boolean isSupportedCountry(@NonNull String); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void setSupportedCountries(@NonNull java.util.List<java.lang.String>); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void setUnsupportedCountries(@NonNull java.util.List<java.lang.String>); field public static final String ACTION_DELETE_SUBSCRIPTION_PRIVILEGED = "android.telephony.euicc.action.DELETE_SUBSCRIPTION_PRIVILEGED"; field @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public static final String ACTION_OTA_STATUS_CHANGED = "android.telephony.euicc.action.OTA_STATUS_CHANGED"; field public static final String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION"; @@ -13313,6 +13352,29 @@ package android.telephony.ims { method @NonNull public android.telephony.ims.RcsContactUceCapability build(); } + public class RcsUceAdapter { + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException; + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean) throws android.telephony.ims.ImsException; + field public static final int ERROR_ALREADY_IN_QUEUE = 13; // 0xd + field public static final int ERROR_FORBIDDEN = 6; // 0x6 + field public static final int ERROR_GENERIC_FAILURE = 1; // 0x1 + field public static final int ERROR_INSUFFICIENT_MEMORY = 11; // 0xb + field public static final int ERROR_LOST_NETWORK = 12; // 0xc + field public static final int ERROR_NOT_AUTHORIZED = 5; // 0x5 + field public static final int ERROR_NOT_AVAILABLE = 3; // 0x3 + field public static final int ERROR_NOT_ENABLED = 2; // 0x2 + field public static final int ERROR_NOT_FOUND = 7; // 0x7 + field public static final int ERROR_NOT_REGISTERED = 4; // 0x4 + field public static final int ERROR_REQUEST_TIMEOUT = 10; // 0xa + field public static final int ERROR_REQUEST_TOO_LARGE = 8; // 0x8 + field public static final int PUBLISH_STATE_200_OK = 1; // 0x1 + field public static final int PUBLISH_STATE_NOT_PUBLISHED = 2; // 0x2 + field public static final int PUBLISH_STATE_OTHER_ERROR = 6; // 0x6 + field public static final int PUBLISH_STATE_RCS_PROVISION_ERROR = 4; // 0x4 + field public static final int PUBLISH_STATE_REQUEST_TIMEOUT = 5; // 0x5 + field public static final int PUBLISH_STATE_VOLTE_PROVISION_ERROR = 3; // 0x3 + } + } package android.telephony.ims.feature { @@ -14244,3 +14306,4 @@ package android.webkit { } } + diff --git a/api/test-current.txt b/api/test-current.txt index e2407d65ef5c..c18e788610d5 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -1187,6 +1187,9 @@ package android.location { method public void resetElapsedRealtimeUncertaintyNanos(); method public void resetFullBiasNanos(); method public void resetLeapSecond(); + method public void resetReferenceCarrierFrequencyHzForIsb(); + method public void resetReferenceCodeTypeForIsb(); + method public void resetReferenceConstellationTypeForIsb(); method public void resetTimeUncertaintyNanos(); method public void set(android.location.GnssClock); method public void setBiasNanos(double); @@ -1198,6 +1201,9 @@ package android.location { method public void setFullBiasNanos(long); method public void setHardwareClockDiscontinuityCount(int); method public void setLeapSecond(int); + method public void setReferenceCarrierFrequencyHzForIsb(@FloatRange(from=0.0) double); + method public void setReferenceCodeTypeForIsb(@NonNull String); + method public void setReferenceConstellationTypeForIsb(int); method public void setTimeNanos(long); method public void setTimeUncertaintyNanos(@FloatRange(from=0.0f) double); } @@ -1212,6 +1218,10 @@ package android.location { method @Deprecated public void resetCarrierPhase(); method @Deprecated public void resetCarrierPhaseUncertainty(); method public void resetCodeType(); + method public void resetReceiverInterSignalBiasNanos(); + method public void resetReceiverInterSignalBiasUncertaintyNanos(); + method public void resetSatelliteInterSignalBiasNanos(); + method public void resetSatelliteInterSignalBiasUncertaintyNanos(); method public void resetSnrInDb(); method public void set(android.location.GnssMeasurement); method public void setAccumulatedDeltaRangeMeters(double); @@ -1231,6 +1241,10 @@ package android.location { method public void setPseudorangeRateUncertaintyMetersPerSecond(double); method public void setReceivedSvTimeNanos(long); method public void setReceivedSvTimeUncertaintyNanos(long); + method public void setReceiverInterSignalBiasNanos(double); + method public void setReceiverInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double); + method public void setSatelliteInterSignalBiasNanos(double); + method public void setSatelliteInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double); method public void setSnrInDb(double); method public void setState(int); method public void setSvid(int); @@ -3483,6 +3497,7 @@ package android.telephony { public class TelephonyRegistryManager { method public void addOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener, @NonNull java.util.concurrent.Executor); method public void addOnSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener, @NonNull java.util.concurrent.Executor); + method public void listenForSubscriber(int, @NonNull String, @NonNull String, @NonNull android.telephony.PhoneStateListener, int, boolean); method public void notifyActiveDataSubIdChanged(int); method public void notifyBarringInfoChanged(int, int, @NonNull android.telephony.BarringInfo); method public void notifyCallForwardingChanged(int, boolean); @@ -3499,6 +3514,8 @@ package android.telephony { method public void notifyEmergencyNumberList(int, int); method public void notifyImsDisconnectCause(int, @NonNull android.telephony.ims.ImsReasonInfo); method public void notifyMessageWaitingChanged(int, int, boolean); + method public void notifyOutgoingEmergencyCall(int, int, @NonNull android.telephony.emergency.EmergencyNumber); + method public void notifyOutgoingEmergencySms(int, int, @NonNull android.telephony.emergency.EmergencyNumber); method public void notifyPhoneCapabilityChanged(@NonNull android.telephony.PhoneCapability); method public void notifyPreciseCallState(int, int, int, int, int); method public void notifyPreciseDataConnectionFailed(int, int, int, @Nullable String, int); @@ -4100,6 +4117,29 @@ package android.telephony.ims { method public void onProvisioningStringChanged(int, @NonNull String); } + public class RcsUceAdapter { + method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException; + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean) throws android.telephony.ims.ImsException; + field public static final int ERROR_ALREADY_IN_QUEUE = 13; // 0xd + field public static final int ERROR_FORBIDDEN = 6; // 0x6 + field public static final int ERROR_GENERIC_FAILURE = 1; // 0x1 + field public static final int ERROR_INSUFFICIENT_MEMORY = 11; // 0xb + field public static final int ERROR_LOST_NETWORK = 12; // 0xc + field public static final int ERROR_NOT_AUTHORIZED = 5; // 0x5 + field public static final int ERROR_NOT_AVAILABLE = 3; // 0x3 + field public static final int ERROR_NOT_ENABLED = 2; // 0x2 + field public static final int ERROR_NOT_FOUND = 7; // 0x7 + field public static final int ERROR_NOT_REGISTERED = 4; // 0x4 + field public static final int ERROR_REQUEST_TIMEOUT = 10; // 0xa + field public static final int ERROR_REQUEST_TOO_LARGE = 8; // 0x8 + field public static final int PUBLISH_STATE_200_OK = 1; // 0x1 + field public static final int PUBLISH_STATE_NOT_PUBLISHED = 2; // 0x2 + field public static final int PUBLISH_STATE_OTHER_ERROR = 6; // 0x6 + field public static final int PUBLISH_STATE_RCS_PROVISION_ERROR = 4; // 0x4 + field public static final int PUBLISH_STATE_REQUEST_TIMEOUT = 5; // 0x5 + field public static final int PUBLISH_STATE_VOLTE_PROVISION_ERROR = 3; // 0x3 + } + } package android.telephony.ims.feature { diff --git a/api/test-lint-baseline.txt b/api/test-lint-baseline.txt index 54f7f68d96cb..a9c18363d8b0 100644 --- a/api/test-lint-baseline.txt +++ b/api/test-lint-baseline.txt @@ -406,7 +406,13 @@ GetterSetterNames: android.location.GnssClock#setElapsedRealtimeUncertaintyNanos GetterSetterNames: android.location.GnssClock#setFullBiasNanos(long): GetterSetterNames: android.location.GnssClock#setLeapSecond(int): - + +GetterSetterNames: android.location.GnssClock#setReferenceConstellationTypeForIsb(int): + +GetterSetterNames: android.location.GnssClock#setReferenceCarrierFrequencyHzForIsb(double): + +GetterSetterNames: android.location.GnssClock#setReferenceCodeTypeForIsb(String): + GetterSetterNames: android.location.GnssClock#setTimeUncertaintyNanos(double): GetterSetterNames: android.location.GnssMeasurement#setBasebandCn0DbHz(double): @@ -414,7 +420,15 @@ GetterSetterNames: android.location.GnssMeasurement#setBasebandCn0DbHz(double): GetterSetterNames: android.location.GnssMeasurement#setCarrierFrequencyHz(float): GetterSetterNames: android.location.GnssMeasurement#setCodeType(String): - + +GetterSetterNames: android.location.GnssMeasurement#setReceiverInterSignalBiasNanos(double): + +GetterSetterNames: android.location.GnssMeasurement#setReceiverInterSignalBiasUncertaintyNanos(double): + +GetterSetterNames: android.location.GnssMeasurement#setSatelliteInterSignalBiasNanos(double): + +GetterSetterNames: android.location.GnssMeasurement#setSatelliteInterSignalBiasUncertaintyNanos(double): + GetterSetterNames: android.location.GnssMeasurement#setSnrInDb(double): GetterSetterNames: android.location.LocationRequest#isLocationSettingsIgnored(): diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index d05ac189c834..d9b3a6c05c2a 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -1724,6 +1724,7 @@ message WatchdogRollbackOccurred { REASON_EXPLICIT_HEALTH_CHECK = 2; REASON_APP_CRASH = 3; REASON_APP_NOT_RESPONDING = 4; + REASON_NATIVE_CRASH_DURING_BOOT = 5; } optional RollbackReasonType rollback_reason = 4; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index aeeabb7c1726..fa9dd274488f 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -8260,6 +8260,11 @@ public class DevicePolicyManager { * actual package file remain. This function can be called by a device owner, profile owner, or * by a delegate given the {@link #DELEGATION_PACKAGE_ACCESS} scope via * {@link #setDelegatedScopes}. + * <p> + * This method can be called on the {@link DevicePolicyManager} instance, returned by + * {@link #getParentProfileInstance(ComponentName)}, where the caller must be the profile owner + * of an organization-owned managed profile and the package must be a system package. If called + * on the parent instance, then the package is hidden or unhidden in the personal profile. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with, or * {@code null} if the caller is a package access delegate. @@ -8267,17 +8272,20 @@ public class DevicePolicyManager { * @param hidden {@code true} if the package should be hidden, {@code false} if it should be * unhidden. * @return boolean Whether the hidden setting of the package was successfully updated. - * @throws SecurityException if {@code admin} is not a device or profile owner. + * @throws SecurityException if {@code admin} is not a device or profile owner or if called on + * the parent profile and the {@code admin} is not a profile owner of an + * organization-owned managed profile. + * @throws IllegalArgumentException if called on the parent profile and the package provided + * is not a system package. * @see #setDelegatedScopes * @see #DELEGATION_PACKAGE_ACCESS */ public boolean setApplicationHidden(@NonNull ComponentName admin, String packageName, boolean hidden) { - throwIfParentInstance("setApplicationHidden"); if (mService != null) { try { return mService.setApplicationHidden(admin, mContext.getPackageName(), packageName, - hidden); + hidden, mParentInstance); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -8289,20 +8297,30 @@ public class DevicePolicyManager { * Determine if a package is hidden. This function can be called by a device owner, profile * owner, or by a delegate given the {@link #DELEGATION_PACKAGE_ACCESS} scope via * {@link #setDelegatedScopes}. + * <p> + * This method can be called on the {@link DevicePolicyManager} instance, returned by + * {@link #getParentProfileInstance(ComponentName)}, where the caller must be the profile owner + * of an organization-owned managed profile and the package must be a system package. If called + * on the parent instance, this will determine whether the package is hidden or unhidden in the + * personal profile. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with, or * {@code null} if the caller is a package access delegate. * @param packageName The name of the package to retrieve the hidden status of. * @return boolean {@code true} if the package is hidden, {@code false} otherwise. - * @throws SecurityException if {@code admin} is not a device or profile owner. + * @throws SecurityException if {@code admin} is not a device or profile owner or if called on + * the parent profile and the {@code admin} is not a profile owner of an + * organization-owned managed profile. + * @throws IllegalArgumentException if called on the parent profile and the package provided + * is not a system package. * @see #setDelegatedScopes * @see #DELEGATION_PACKAGE_ACCESS */ public boolean isApplicationHidden(@NonNull ComponentName admin, String packageName) { - throwIfParentInstance("isApplicationHidden"); if (mService != null) { try { - return mService.isApplicationHidden(admin, mContext.getPackageName(), packageName); + return mService.isApplicationHidden(admin, mContext.getPackageName(), packageName, + mParentInstance); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -9091,7 +9109,8 @@ public class DevicePolicyManager { } /** - * Called by device owners to set a local system update policy. When a new policy is set, + * Called by device owners or profile owners of an organization-owned managed profile to to set + * a local system update policy. When a new policy is set, * {@link #ACTION_SYSTEM_UPDATE_POLICY_CHANGED} is broadcasted. * <p> * If the supplied system update policy has freeze periods set but the freeze periods do not @@ -9109,7 +9128,8 @@ public class DevicePolicyManager { * components in the device owner package can set system update policies and the most * recent policy takes effect. * @param policy the new policy, or {@code null} to clear the current policy. - * @throws SecurityException if {@code admin} is not a device owner. + * @throws SecurityException if {@code admin} is not a device owner or a profile owner of an + * organization-owned managed profile. * @throws IllegalArgumentException if the policy type or maintenance window is not valid. * @throws SystemUpdatePolicy.ValidationFailedException if the policy's freeze period does not * meet the requirement. @@ -11194,7 +11214,8 @@ public class DevicePolicyManager { } /** - * Called by device owner to install a system update from the given file. The device will be + * Called by device owner or profile owner of an organization-owned managed profile to install + * a system update from the given file. The device will be * rebooted in order to finish installing the update. Note that if the device is rebooted, this * doesn't necessarily mean that the update has been applied successfully. The caller should * additionally check the system version with {@link android.os.Build#FINGERPRINT} or {@link diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index b9ffc4e214a6..3d6bf9db5535 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -233,8 +233,8 @@ interface IDevicePolicyManager { boolean isNotificationListenerServicePermitted(in String packageName, int userId); Intent createAdminSupportIntent(in String restriction); - boolean setApplicationHidden(in ComponentName admin, in String callerPackage, in String packageName, boolean hidden); - boolean isApplicationHidden(in ComponentName admin, in String callerPackage, in String packageName); + boolean setApplicationHidden(in ComponentName admin, in String callerPackage, in String packageName, boolean hidden, boolean parent); + boolean isApplicationHidden(in ComponentName admin, in String callerPackage, in String packageName, boolean parent); UserHandle createAndManageUser(in ComponentName who, in String name, in ComponentName profileOwner, in PersistableBundle adminExtras, in int flags); boolean removeUser(in ComponentName who, in UserHandle userHandle); diff --git a/core/java/android/content/pm/IPackageInstallerSession.aidl b/core/java/android/content/pm/IPackageInstallerSession.aidl index e86bb250c033..fc20263fe00a 100644 --- a/core/java/android/content/pm/IPackageInstallerSession.aidl +++ b/core/java/android/content/pm/IPackageInstallerSession.aidl @@ -16,6 +16,7 @@ package android.content.pm; +import android.content.pm.DataLoaderParamsParcel; import android.content.pm.IPackageInstallObserver2; import android.content.IntentSender; import android.os.ParcelFileDescriptor; @@ -39,8 +40,9 @@ interface IPackageInstallerSession { void transfer(in String packageName); void abandon(); - void addFile(String name, long lengthBytes, in byte[] metadata); - void removeFile(String name); + DataLoaderParamsParcel getDataLoaderParams(); + void addFile(int location, String name, long lengthBytes, in byte[] metadata, in byte[] signature); + void removeFile(int location, String name); boolean isMultiPackage(); int[] getChildSessionIds(); diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index b3d8eb51e324..93126b8002ad 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -230,7 +230,7 @@ interface IPackageManager { * @param versionedPackage The package to delete. * @param observer a callback to use to notify when the package deletion in finished. * @param userId the id of the user for whom to delete the package - * @param flags - possible values: {@link #DONT_DELETE_DATA} + * @param flags - possible values: {@link #DELETE_KEEP_DATA} */ void deletePackageVersioned(in VersionedPackage versionedPackage, IPackageDeleteObserver2 observer, int userId, int flags); diff --git a/core/java/android/content/pm/InstallationFile.java b/core/java/android/content/pm/InstallationFile.java index ac5fd1e41075..111ad32d1e41 100644 --- a/core/java/android/content/pm/InstallationFile.java +++ b/core/java/android/content/pm/InstallationFile.java @@ -19,6 +19,7 @@ package android.content.pm; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -31,12 +32,14 @@ import java.lang.annotation.RetentionPolicy; * * @hide */ +@SystemApi public final class InstallationFile implements Parcelable { public static final int FILE_TYPE_UNKNOWN = -1; public static final int FILE_TYPE_APK = 0; public static final int FILE_TYPE_LIB = 1; public static final int FILE_TYPE_OBB = 2; + /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"FILE_TYPE_"}, value = { FILE_TYPE_APK, diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java index fbcb2ddf4cad..b1b9454aeddd 100644 --- a/core/java/android/content/pm/PackageInstaller.java +++ b/core/java/android/content/pm/PackageInstaller.java @@ -365,6 +365,41 @@ public class PackageInstaller { @SystemApi public static final int DATA_LOADER_TYPE_INCREMENTAL = DataLoaderType.INCREMENTAL; + /** + * Target location for the file in installation session is /data/app/<packageName>-<id>. + * This is the intended location for APKs. + * Requires permission to install packages. + * {@hide} + */ + @SystemApi + public static final int LOCATION_DATA_APP = 0; + + /** + * Target location for the file in installation session is + * /data/media/<userid>/Android/obb/<packageName>. This is the intended location for OBBs. + * {@hide} + */ + @SystemApi + public static final int LOCATION_MEDIA_OBB = 1; + + /** + * Target location for the file in installation session is + * /data/media/<userid>/Android/data/<packageName>. + * This is the intended location for application data. + * Can only be used by an app itself running under specific user. + * {@hide} + */ + @SystemApi + public static final int LOCATION_MEDIA_DATA = 2; + + /** @hide */ + @IntDef(prefix = { "LOCATION_" }, value = { + LOCATION_DATA_APP, + LOCATION_MEDIA_OBB, + LOCATION_MEDIA_DATA}) + @Retention(RetentionPolicy.SOURCE) + public @interface FileLocation{} + private final IPackageInstaller mInstaller; private final int mUserId; private final String mInstallerPackageName; @@ -1071,10 +1106,33 @@ public class PackageInstaller { } } + /** + * @return data loader params or null if the session is not using one. + * + * WARNING: This is a system API to aid internal development. + * Use at your own risk. It will change or be removed without warning. + * {@hide} + */ + @SystemApi + public @Nullable DataLoaderParams getDataLoaderParams() { + try { + DataLoaderParamsParcel data = mSession.getDataLoaderParams(); + if (data == null) { + return null; + } + return new DataLoaderParams(data); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } /** * Adds a file to session. On commit this file will be pulled from dataLoader. * + * @param location target location for the file. Possible values: + * {@link #LOCATION_DATA_APP}, + * {@link #LOCATION_MEDIA_OBB}, + * {@link #LOCATION_MEDIA_DATA}. * @param name arbitrary, unique name of your choosing to identify the * APK being written. You can open a file again for * additional writes (such as after a reboot) by using the @@ -1084,6 +1142,8 @@ public class PackageInstaller { * The system may clear various caches as needed to allocate * this space. * @param metadata additional info use by dataLoader to pull data for the file. + * @param signature additional file signature, e.g. + * <a href="https://source.android.com/security/apksigning/v4.html">APK Signature Scheme v4</a> * @throws SecurityException if called after the session has been * sealed or abandoned * @throws IllegalStateException if called for non-callback session @@ -1093,9 +1153,10 @@ public class PackageInstaller { * {@hide} */ @SystemApi - public void addFile(@NonNull String name, long lengthBytes, @NonNull byte[] metadata) { + public void addFile(@FileLocation int location, @NonNull String name, long lengthBytes, + @NonNull byte[] metadata, @Nullable byte[] signature) { try { - mSession.addFile(name, lengthBytes, metadata); + mSession.addFile(location, name, lengthBytes, metadata, signature); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1104,15 +1165,20 @@ public class PackageInstaller { /** * Removes a file. * + * @param location target location for the file. Possible values: + * {@link #LOCATION_DATA_APP}, + * {@link #LOCATION_MEDIA_OBB}, + * {@link #LOCATION_MEDIA_DATA}. * @param name name of a file, e.g. split. * @throws SecurityException if called after the session has been * sealed or abandoned * @throws IllegalStateException if called for non-callback session * {@hide} */ - public void removeFile(@NonNull String name) { + @SystemApi + public void removeFile(@FileLocation int location, @NonNull String name) { try { - mSession.removeFile(name); + mSession.removeFile(location, name); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index a2d425be214c..205617022aa1 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -369,7 +369,7 @@ public abstract class PackageManager { * Flag parameter to retrieve some information about all applications (even * uninstalled ones) which have data directories. This state could have * resulted if applications have been deleted with flag - * {@code DONT_DELETE_DATA} with a possibility of being replaced or + * {@code DELETE_KEEP_DATA} with a possibility of being replaced or * reinstalled in future. * <p> * Note: this flag may cause less information about currently installed @@ -3534,7 +3534,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). * @throws NameNotFoundException if a package with the given name cannot be * found on the system. */ @@ -3560,7 +3560,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). * @throws NameNotFoundException if a package with the given name cannot be * found on the system. */ @@ -3581,7 +3581,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). * @throws NameNotFoundException if a package with the given name cannot be * found on the system. * @hide @@ -3828,7 +3828,7 @@ public abstract class PackageManager { * the application information is retrieved from the list of * uninstalled applications (which includes installed applications * as well as applications with data directory i.e. applications - * which had been deleted with {@code DONT_DELETE_DATA} flag set). + * which had been deleted with {@code DELETE_KEEP_DATA} flag set). * @throws NameNotFoundException if a package with the given name cannot be * found on the system. */ @@ -3855,7 +3855,7 @@ public abstract class PackageManager { * the application information is retrieved from the list of * uninstalled applications (which includes installed applications * as well as applications with data directory i.e. applications - * which had been deleted with {@code DONT_DELETE_DATA} flag set). + * which had been deleted with {@code DELETE_KEEP_DATA} flag set). * @throws NameNotFoundException if a package with the given name cannot be * found on the system. * @hide @@ -3978,7 +3978,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). */ @NonNull public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags); @@ -3996,7 +3996,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). */ @NonNull public abstract List<PackageInfo> getPackagesHoldingPermissions( @@ -4015,7 +4015,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). * @hide */ @NonNull @@ -4561,7 +4561,7 @@ public abstract class PackageManager { /** * Return a List of all application packages that are installed for the * current user. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all - * applications including those deleted with {@code DONT_DELETE_DATA} + * applications including those deleted with {@code DELETE_KEEP_DATA} * (partially installed apps with data directory) will be returned. * * @param flags Additional option flags to modify the data returned. @@ -4572,7 +4572,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). */ @NonNull public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags); @@ -4581,7 +4581,7 @@ public abstract class PackageManager { * Return a List of all application packages that are installed on the * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been * set, a list of all applications including those deleted with - * {@code DONT_DELETE_DATA} (partially installed apps with data directory) + * {@code DELETE_KEEP_DATA} (partially installed apps with data directory) * will be returned. * * @param flags Additional option flags to modify the data returned. @@ -4594,7 +4594,7 @@ public abstract class PackageManager { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). * @hide */ @NonNull diff --git a/core/java/android/hardware/CameraStatus.java b/core/java/android/hardware/CameraStatus.java index 08b5b776c94e..29802cb33c38 100644 --- a/core/java/android/hardware/CameraStatus.java +++ b/core/java/android/hardware/CameraStatus.java @@ -30,6 +30,7 @@ import android.os.Parcelable; public class CameraStatus implements Parcelable { public String cameraId; public int status; + public String[] unavailablePhysicalCameras; @Override public int describeContents() { @@ -40,11 +41,13 @@ public class CameraStatus implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeString(cameraId); out.writeInt(status); + out.writeStringArray(unavailablePhysicalCameras); } public void readFromParcel(Parcel in) { cameraId = in.readString(); status = in.readInt(); + unavailablePhysicalCameras = in.readStringArray(); } public static final @android.annotation.NonNull Parcelable.Creator<CameraStatus> CREATOR = diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java index 9b58578e3811..55025f0411f9 100644 --- a/core/java/android/hardware/camera2/CameraManager.java +++ b/core/java/android/hardware/camera2/CameraManager.java @@ -718,6 +718,52 @@ public final class CameraManager { public void onCameraAccessPrioritiesChanged() { // default empty implementation } + + /** + * A physical camera has become available for use again. + * + * <p>By default, all of the physical cameras of a logical multi-camera are + * available, so {@link #onPhysicalCameraAvailable} is not called for any of the physical + * cameras of a logical multi-camera, when {@link #onCameraAvailable} for the logical + * multi-camera is invoked. However, if some specific physical cameras are unavailable + * to begin with, {@link #onPhysicalCameraUnavailable} may be invoked after + * {@link #onCameraAvailable}.</p> + * + * <p>The default implementation of this method does nothing.</p> + * + * @param cameraId The unique identifier of the logical multi-camera. + * @param physicalCameraId The unique identifier of the physical camera. + * + * @see #onCameraAvailable + * @see #onPhysicalCameraUnavailable + */ + public void onPhysicalCameraAvailable(@NonNull String cameraId, + @NonNull String physicalCameraId) { + // default empty implementation + } + + /** + * A previously-available physical camera has become unavailable for use. + * + * <p>By default, all of the physical cameras of a logical multi-camera are + * available, so {@link #onPhysicalCameraAvailable} is not called for any of the physical + * cameras of a logical multi-camera, when {@link #onCameraAvailable} for the logical + * multi-camera is invoked. If some specific physical cameras are unavailable + * to begin with, {@link #onPhysicalCameraUnavailable} may be invoked after + * {@link #onCameraAvailable}.</p> + * + * <p>The default implementation of this method does nothing.</p> + * + * @param cameraId The unique identifier of the logical multi-camera. + * @param physicalCameraId The unique identifier of the physical camera. + * + * @see #onCameraAvailable + * @see #onPhysicalCameraAvailable + */ + public void onPhysicalCameraUnavailable(@NonNull String cameraId, + @NonNull String physicalCameraId) { + // default empty implementation + } } /** @@ -914,6 +960,9 @@ public final class CameraManager { private final ScheduledExecutorService mScheduler = Executors.newScheduledThreadPool(1); // Camera ID -> Status map private final ArrayMap<String, Integer> mDeviceStatus = new ArrayMap<String, Integer>(); + // Camera ID -> (physical camera ID -> Status map) + private final ArrayMap<String, ArrayList<String>> mUnavailablePhysicalDevices = + new ArrayMap<String, ArrayList<String>>(); // Registered availablility callbacks and their executors private final ArrayMap<AvailabilityCallback, Executor> mCallbackMap = @@ -1003,6 +1052,14 @@ public final class CameraManager { CameraStatus[] cameraStatuses = cameraService.addListener(this); for (CameraStatus c : cameraStatuses) { onStatusChangedLocked(c.status, c.cameraId); + + if (c.unavailablePhysicalCameras != null) { + for (String unavailPhysicalCamera : c.unavailablePhysicalCameras) { + onPhysicalCameraStatusChangedLocked( + ICameraServiceListener.STATUS_NOT_PRESENT, + c.cameraId, unavailPhysicalCamera); + } + } } mCameraService = cameraService; } catch(ServiceSpecificException e) { @@ -1086,6 +1143,10 @@ public final class CameraManager { public void onStatusChanged(int status, String id) throws RemoteException { } @Override + public void onPhysicalCameraStatusChanged(int status, + String id, String physicalId) throws RemoteException { + } + @Override public void onTorchStatusChanged(int status, String id) throws RemoteException { } @Override @@ -1236,7 +1297,7 @@ public final class CameraManager { } private void postSingleUpdate(final AvailabilityCallback callback, final Executor executor, - final String id, final int status) { + final String id, final String physicalId, final int status) { if (isAvailable(status)) { final long ident = Binder.clearCallingIdentity(); try { @@ -1244,7 +1305,11 @@ public final class CameraManager { new Runnable() { @Override public void run() { - callback.onCameraAvailable(id); + if (physicalId == null) { + callback.onCameraAvailable(id); + } else { + callback.onPhysicalCameraAvailable(id, physicalId); + } } }); } finally { @@ -1257,7 +1322,11 @@ public final class CameraManager { new Runnable() { @Override public void run() { - callback.onCameraUnavailable(id); + if (physicalId == null) { + callback.onCameraUnavailable(id); + } else { + callback.onPhysicalCameraUnavailable(id, physicalId); + } } }); } finally { @@ -1304,7 +1373,16 @@ public final class CameraManager { for (int i = 0; i < mDeviceStatus.size(); i++) { String id = mDeviceStatus.keyAt(i); Integer status = mDeviceStatus.valueAt(i); - postSingleUpdate(callback, executor, id, status); + postSingleUpdate(callback, executor, id, null /*physicalId*/, status); + + // Send the NOT_PRESENT state for unavailable physical cameras + if (isAvailable(status) && mUnavailablePhysicalDevices.containsKey(id)) { + ArrayList<String> unavailableIds = mUnavailablePhysicalDevices.get(id); + for (String unavailableId : unavailableIds) { + postSingleUpdate(callback, executor, id, unavailableId, + ICameraServiceListener.STATUS_NOT_PRESENT); + } + } } } @@ -1323,8 +1401,12 @@ public final class CameraManager { Integer oldStatus; if (status == ICameraServiceListener.STATUS_NOT_PRESENT) { oldStatus = mDeviceStatus.remove(id); + mUnavailablePhysicalDevices.remove(id); } else { oldStatus = mDeviceStatus.put(id, status); + if (oldStatus == null) { + mUnavailablePhysicalDevices.put(id, new ArrayList<String>()); + } } if (oldStatus != null && oldStatus == status) { @@ -1366,10 +1448,62 @@ public final class CameraManager { Executor executor = mCallbackMap.valueAt(i); final AvailabilityCallback callback = mCallbackMap.keyAt(i); - postSingleUpdate(callback, executor, id, status); + postSingleUpdate(callback, executor, id, null /*physicalId*/, status); } } // onStatusChangedLocked + private void onPhysicalCameraStatusChangedLocked(int status, + String id, String physicalId) { + if (DEBUG) { + Log.v(TAG, + String.format("Camera id %s physical camera id %s has status " + + "changed to 0x%x", id, physicalId, status)); + } + + if (!validStatus(status)) { + Log.e(TAG, String.format( + "Ignoring invalid device %s physical device %s status 0x%x", id, + physicalId, status)); + return; + } + + //TODO: Do we need to treat this as error? + if (!mDeviceStatus.containsKey(id) || !isAvailable(mDeviceStatus.get(id)) + || !mUnavailablePhysicalDevices.containsKey(id)) { + Log.e(TAG, String.format("Camera %s is not available. Ignore physical camera " + + "status change", id)); + return; + } + + ArrayList<String> unavailablePhysicalDevices = mUnavailablePhysicalDevices.get(id); + if (!isAvailable(status) + && !unavailablePhysicalDevices.contains(physicalId)) { + unavailablePhysicalDevices.add(physicalId); + } else if (isAvailable(status) + && unavailablePhysicalDevices.contains(physicalId)) { + unavailablePhysicalDevices.remove(physicalId); + } else { + if (DEBUG) { + Log.v(TAG, + String.format( + "Physical camera device status was previously available (%b), " + + " and is now again available (%b)" + + "so no new client visible update will be sent", + !unavailablePhysicalDevices.contains(physicalId), + isAvailable(status))); + } + return; + } + + final int callbackCount = mCallbackMap.size(); + for (int i = 0; i < callbackCount; i++) { + Executor executor = mCallbackMap.valueAt(i); + final AvailabilityCallback callback = mCallbackMap.keyAt(i); + + postSingleUpdate(callback, executor, id, physicalId, status); + } + } // onPhysicalCameraStatusChangedLocked + private void updateTorchCallbackLocked(TorchCallback callback, Executor executor) { for (int i = 0; i < mTorchStatus.size(); i++) { String id = mTorchStatus.keyAt(i); @@ -1478,6 +1612,14 @@ public final class CameraManager { } @Override + public void onPhysicalCameraStatusChanged(int status, String cameraId, + String physicalCameraId) throws RemoteException { + synchronized (mLock) { + onPhysicalCameraStatusChangedLocked(status, cameraId, physicalCameraId); + } + } + + @Override public void onTorchStatusChanged(int status, String cameraId) throws RemoteException { synchronized (mLock) { onTorchStatusChangedLocked(status, cameraId); diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index 89dac2aef68f..4dd3a30e046c 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -865,14 +865,20 @@ public abstract class CameraMetadata<TKey> { * <p>The camera device is a logical camera backed by two or more physical cameras.</p> * <p>In API level 28, the physical cameras must also be exposed to the application via * {@link android.hardware.camera2.CameraManager#getCameraIdList }.</p> - * <p>Starting from API level 29, some or all physical cameras may not be independently - * exposed to the application, in which case the physical camera IDs will not be - * available in {@link android.hardware.camera2.CameraManager#getCameraIdList }. But the + * <p>Starting from API level 29:</p> + * <ul> + * <li>Some or all physical cameras may not be independently exposed to the application, + * in which case the physical camera IDs will not be available in + * {@link android.hardware.camera2.CameraManager#getCameraIdList }. But the * application can still query the physical cameras' characteristics by calling - * {@link android.hardware.camera2.CameraManager#getCameraCharacteristics }. Additionally, - * if a physical camera is hidden from camera ID list, the mandatory stream combinations - * for that physical camera must be supported through the logical camera using physical - * streams.</p> + * {@link android.hardware.camera2.CameraManager#getCameraCharacteristics }.</li> + * <li>If a physical camera is hidden from camera ID list, the mandatory stream + * combinations for that physical camera must be supported through the logical camera + * using physical streams. One exception is that in API level 30, a physical camera + * may become unavailable via + * {@link CameraManager.AvailabilityCallback#onPhysicalCameraUnavailable } + * callback.</li> + * </ul> * <p>Combinations of logical and physical streams, or physical streams from different * physical cameras are not guaranteed. However, if the camera device supports * {@link CameraDevice#isSessionConfigurationSupported }, diff --git a/core/java/android/hardware/location/ContextHubInfo.java b/core/java/android/hardware/location/ContextHubInfo.java index a11f2e9e8373..6d56d2d45922 100644 --- a/core/java/android/hardware/location/ContextHubInfo.java +++ b/core/java/android/hardware/location/ContextHubInfo.java @@ -21,6 +21,7 @@ import android.annotation.SystemApi; import android.hardware.contexthub.V1_0.ContextHub; import android.os.Parcel; import android.os.Parcelable; +import android.util.proto.ProtoOutputStream; import java.util.Arrays; @@ -270,6 +271,30 @@ public class ContextHubInfo implements Parcelable { return retVal; } + /** + * Dump the internal state as a ContextHubInfoProto to the given ProtoOutputStream. + * + * If the output belongs to a sub message, the caller is responsible for wrapping this function + * between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}. + * + * @hide + */ + public void dump(ProtoOutputStream proto) { + proto.write(ContextHubInfoProto.ID, mId); + proto.write(ContextHubInfoProto.NAME, mName); + proto.write(ContextHubInfoProto.VENDOR, mVendor); + proto.write(ContextHubInfoProto.TOOLCHAIN, mToolchain); + proto.write(ContextHubInfoProto.PLATFORM_VERSION, mPlatformVersion); + proto.write(ContextHubInfoProto.STATIC_SW_VERSION, getStaticSwVersion()); + proto.write(ContextHubInfoProto.TOOLCHAIN_VERSION, mToolchainVersion); + proto.write(ContextHubInfoProto.CHRE_PLATFORM_ID, mChrePlatformId); + proto.write(ContextHubInfoProto.PEAK_MIPS, mPeakMips); + proto.write(ContextHubInfoProto.STOPPED_POWER_DRAW_MW, mStoppedPowerDrawMw); + proto.write(ContextHubInfoProto.SLEEP_POWER_DRAW_MW, mSleepPowerDrawMw); + proto.write(ContextHubInfoProto.PEAK_POWER_DRAW_MW, mPeakPowerDrawMw); + proto.write(ContextHubInfoProto.MAX_PACKET_LENGTH_BYTES, mMaxPacketLengthBytes); + } + @Override public boolean equals(@Nullable Object object) { if (object == this) { diff --git a/core/java/android/os/BatteryStatsManager.java b/core/java/android/os/BatteryStatsManager.java index 0545666ca743..f2e16b46422f 100644 --- a/core/java/android/os/BatteryStatsManager.java +++ b/core/java/android/os/BatteryStatsManager.java @@ -42,7 +42,7 @@ import java.lang.annotation.RetentionPolicy; */ @SystemApi @SystemService(Context.BATTERY_STATS_SERVICE) -public class BatteryStatsManager { +public final class BatteryStatsManager { /** * Wifi states. * @@ -166,7 +166,7 @@ public class BatteryStatsManager { * @param newRssi The new RSSI value. */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiRssiChanged(@IntRange(from = -127, to = 0) int newRssi) { + public void reportWifiRssiChanged(@IntRange(from = -127, to = 0) int newRssi) { try { mBatteryStats.noteWifiRssiChanged(newRssi); } catch (RemoteException e) { @@ -178,7 +178,7 @@ public class BatteryStatsManager { * Indicates that wifi was toggled on. */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiOn() { + public void reportWifiOn() { try { mBatteryStats.noteWifiOn(); } catch (RemoteException e) { @@ -190,7 +190,7 @@ public class BatteryStatsManager { * Indicates that wifi was toggled off. */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiOff() { + public void reportWifiOff() { try { mBatteryStats.noteWifiOff(); } catch (RemoteException e) { @@ -205,7 +205,7 @@ public class BatteryStatsManager { * @param accessPoint SSID of the network if wifi is connected to STA, else null. */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiState(@WifiState int newWifiState, + public void reportWifiState(@WifiState int newWifiState, @Nullable String accessPoint) { try { mBatteryStats.noteWifiState(newWifiState, accessPoint); @@ -220,7 +220,7 @@ public class BatteryStatsManager { * @param ws Worksource (to be used for battery blaming). */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiScanStartedFromSource(@NonNull WorkSource ws) { + public void reportWifiScanStartedFromSource(@NonNull WorkSource ws) { try { mBatteryStats.noteWifiScanStartedFromSource(ws); } catch (RemoteException e) { @@ -234,7 +234,7 @@ public class BatteryStatsManager { * @param ws Worksource (to be used for battery blaming). */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiScanStoppedFromSource(@NonNull WorkSource ws) { + public void reportWifiScanStoppedFromSource(@NonNull WorkSource ws) { try { mBatteryStats.noteWifiScanStoppedFromSource(ws); } catch (RemoteException e) { @@ -249,7 +249,7 @@ public class BatteryStatsManager { * @param csph Channels scanned per hour. */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiBatchedScanStartedFromSource(@NonNull WorkSource ws, + public void reportWifiBatchedScanStartedFromSource(@NonNull WorkSource ws, @IntRange(from = 0) int csph) { try { mBatteryStats.noteWifiBatchedScanStartedFromSource(ws, csph); @@ -264,7 +264,7 @@ public class BatteryStatsManager { * @param ws Worksource (to be used for battery blaming). */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiBatchedScanStoppedFromSource(@NonNull WorkSource ws) { + public void reportWifiBatchedScanStoppedFromSource(@NonNull WorkSource ws) { try { mBatteryStats.noteWifiBatchedScanStoppedFromSource(ws); } catch (RemoteException e) { @@ -308,7 +308,7 @@ public class BatteryStatsManager { * @param ws Worksource (to be used for battery blaming). */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteFullWifiLockAcquiredFromSource(@NonNull WorkSource ws) { + public void reportFullWifiLockAcquiredFromSource(@NonNull WorkSource ws) { try { mBatteryStats.noteFullWifiLockAcquiredFromSource(ws); } catch (RemoteException e) { @@ -322,7 +322,7 @@ public class BatteryStatsManager { * @param ws Worksource (to be used for battery blaming). */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteFullWifiLockReleasedFromSource(@NonNull WorkSource ws) { + public void reportFullWifiLockReleasedFromSource(@NonNull WorkSource ws) { try { mBatteryStats.noteFullWifiLockReleasedFromSource(ws); } catch (RemoteException e) { @@ -338,7 +338,7 @@ public class BatteryStatsManager { * authentication failure. */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiSupplicantStateChanged(@WifiSupplState int newSupplState, + public void reportWifiSupplicantStateChanged(@WifiSupplState int newSupplState, boolean failedAuth) { try { mBatteryStats.noteWifiSupplicantStateChanged(newSupplState, failedAuth); @@ -353,7 +353,7 @@ public class BatteryStatsManager { * @param uid UID of the app that acquired the wifi lock (to be used for battery blaming). */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiMulticastEnabled(int uid) { + public void reportWifiMulticastEnabled(int uid) { try { mBatteryStats.noteWifiMulticastEnabled(uid); } catch (RemoteException e) { @@ -367,7 +367,7 @@ public class BatteryStatsManager { * @param uid UID of the app that released the wifi lock (to be used for battery blaming). */ @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) - public void noteWifiMulticastDisabled(int uid) { + public void reportWifiMulticastDisabled(int uid) { try { mBatteryStats.noteWifiMulticastDisabled(uid); } catch (RemoteException e) { diff --git a/core/java/android/os/TelephonyServiceManager.java b/core/java/android/os/TelephonyServiceManager.java index 4f5f3d69b6f3..c93eba6523f0 100644 --- a/core/java/android/os/TelephonyServiceManager.java +++ b/core/java/android/os/TelephonyServiceManager.java @@ -119,14 +119,6 @@ public class TelephonyServiceManager { } /** - * Returns {@link ServiceRegisterer} for the telephony registry service. - */ - @NonNull - public ServiceRegisterer getTelephonyRegistryServiceRegisterer() { - return new ServiceRegisterer("telephony.registry"); - } - - /** * Returns {@link ServiceRegisterer} for the telephony IMS service. */ @NonNull @@ -151,14 +143,6 @@ public class TelephonyServiceManager { } /** - * Returns {@link ServiceRegisterer} for the network policy service. - */ - @NonNull - public ServiceRegisterer getNetworkPolicyServiceRegisterer() { - return new ServiceRegisterer(Context.NETWORK_POLICY_SERVICE); - } - - /** * Returns {@link ServiceRegisterer} for the phone sub service. */ @NonNull @@ -198,6 +182,9 @@ public class TelephonyServiceManager { return new ServiceRegisterer("econtroller"); } + /** + * Returns {@link ServiceRegisterer} for the eUICC card controller service. + */ @NonNull public ServiceRegisterer getEuiccCardControllerServiceRegisterer() { return new ServiceRegisterer("euicc_card_controller"); @@ -212,14 +199,6 @@ public class TelephonyServiceManager { } /** - * Returns {@link ServiceRegisterer} for the permission manager service. - */ - @NonNull - public ServiceRegisterer getPermissionManagerServiceRegisterer() { - return new ServiceRegisterer("permissionmgr"); - } - - /** * Returns {@link ServiceRegisterer} for the ICC phone book service. */ @NonNull diff --git a/core/java/android/os/connectivity/WifiBatteryStats.java b/core/java/android/os/connectivity/WifiBatteryStats.java index 895d837a359e..3c30f6343405 100644 --- a/core/java/android/os/connectivity/WifiBatteryStats.java +++ b/core/java/android/os/connectivity/WifiBatteryStats.java @@ -15,11 +15,13 @@ */ package android.os.connectivity; +import static android.os.BatteryStats.NUM_WIFI_SIGNAL_STRENGTH_BINS; +import static android.os.BatteryStatsManager.NUM_WIFI_STATES; +import static android.os.BatteryStatsManager.NUM_WIFI_SUPPL_STATES; + import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.os.BatteryStats; -import android.os.BatteryStatsManager; import android.os.Parcel; import android.os.Parcelable; @@ -33,31 +35,50 @@ import java.util.Objects; */ @SystemApi public final class WifiBatteryStats implements Parcelable { - private long mLoggingDurationMillis = 0; - private long mKernelActiveTimeMillis = 0; - private long mNumPacketsTx = 0; - private long mNumBytesTx = 0; - private long mNumPacketsRx = 0; - private long mNumBytesRx = 0; - private long mSleepTimeMillis = 0; - private long mScanTimeMillis = 0; - private long mIdleTimeMillis = 0; - private long mRxTimeMillis = 0; - private long mTxTimeMillis = 0; - private long mEnergyConsumedMaMillis = 0; - private long mNumAppScanRequest = 0; - private long[] mTimeInStateMillis = - new long[BatteryStatsManager.NUM_WIFI_STATES]; - private long[] mTimeInSupplicantStateMillis = - new long[BatteryStatsManager.NUM_WIFI_SUPPL_STATES]; - private long[] mTimeInRxSignalStrengthLevelMillis = - new long[BatteryStats.NUM_WIFI_SIGNAL_STRENGTH_BINS]; - private long mMonitoredRailChargeConsumedMaMillis = 0; + private final long mLoggingDurationMillis; + private final long mKernelActiveTimeMillis; + private final long mNumPacketsTx; + private final long mNumBytesTx; + private final long mNumPacketsRx; + private final long mNumBytesRx; + private final long mSleepTimeMillis; + private final long mScanTimeMillis; + private final long mIdleTimeMillis; + private final long mRxTimeMillis; + private final long mTxTimeMillis; + private final long mEnergyConsumedMaMillis; + private final long mAppScanRequestCount; + private final long[] mTimeInStateMillis; + private final long[] mTimeInSupplicantStateMillis; + private final long[] mTimeInRxSignalStrengthLevelMillis; + private final long mMonitoredRailChargeConsumedMaMillis; public static final @NonNull Parcelable.Creator<WifiBatteryStats> CREATOR = new Parcelable.Creator<WifiBatteryStats>() { public WifiBatteryStats createFromParcel(Parcel in) { - return new WifiBatteryStats(in); + long loggingDurationMillis = in.readLong(); + long kernelActiveTimeMillis = in.readLong(); + long numPacketsTx = in.readLong(); + long numBytesTx = in.readLong(); + long numPacketsRx = in.readLong(); + long numBytesRx = in.readLong(); + long sleepTimeMillis = in.readLong(); + long scanTimeMillis = in.readLong(); + long idleTimeMillis = in.readLong(); + long rxTimeMillis = in.readLong(); + long txTimeMillis = in.readLong(); + long energyConsumedMaMillis = in.readLong(); + long appScanRequestCount = in.readLong(); + long[] timeInStateMillis = in.createLongArray(); + long[] timeInRxSignalStrengthLevelMillis = in.createLongArray(); + long[] timeInSupplicantStateMillis = in.createLongArray(); + long monitoredRailChargeConsumedMaMillis = in.readLong(); + return new WifiBatteryStats(loggingDurationMillis, kernelActiveTimeMillis, + numPacketsTx, numBytesTx, numPacketsRx, numBytesRx, sleepTimeMillis, + scanTimeMillis, idleTimeMillis, rxTimeMillis, txTimeMillis, + energyConsumedMaMillis, appScanRequestCount, timeInStateMillis, + timeInRxSignalStrengthLevelMillis, timeInSupplicantStateMillis, + monitoredRailChargeConsumedMaMillis); } public WifiBatteryStats[] newArray(int size) { @@ -84,7 +105,7 @@ public final class WifiBatteryStats implements Parcelable { out.writeLong(mRxTimeMillis); out.writeLong(mTxTimeMillis); out.writeLong(mEnergyConsumedMaMillis); - out.writeLong(mNumAppScanRequest); + out.writeLong(mAppScanRequestCount); out.writeLongArray(mTimeInStateMillis); out.writeLongArray(mTimeInRxSignalStrengthLevelMillis); out.writeLongArray(mTimeInSupplicantStateMillis); @@ -108,7 +129,7 @@ public final class WifiBatteryStats implements Parcelable { && this.mRxTimeMillis == otherStats.mRxTimeMillis && this.mTxTimeMillis == otherStats.mTxTimeMillis && this.mEnergyConsumedMaMillis == otherStats.mEnergyConsumedMaMillis - && this.mNumAppScanRequest == otherStats.mNumAppScanRequest + && this.mAppScanRequestCount == otherStats.mAppScanRequestCount && Arrays.equals(this.mTimeInStateMillis, otherStats.mTimeInStateMillis) && Arrays.equals(this.mTimeInSupplicantStateMillis, otherStats.mTimeInSupplicantStateMillis) @@ -123,33 +144,42 @@ public final class WifiBatteryStats implements Parcelable { return Objects.hash(mLoggingDurationMillis, mKernelActiveTimeMillis, mNumPacketsTx, mNumBytesTx, mNumPacketsRx, mNumBytesRx, mSleepTimeMillis, mScanTimeMillis, mIdleTimeMillis, mRxTimeMillis, mTxTimeMillis, mEnergyConsumedMaMillis, - mNumAppScanRequest, Arrays.hashCode(mTimeInStateMillis), + mAppScanRequestCount, Arrays.hashCode(mTimeInStateMillis), Arrays.hashCode(mTimeInSupplicantStateMillis), Arrays.hashCode(mTimeInRxSignalStrengthLevelMillis), mMonitoredRailChargeConsumedMaMillis); } /** @hide **/ - public WifiBatteryStats() {} - - private void readFromParcel(Parcel in) { - mLoggingDurationMillis = in.readLong(); - mKernelActiveTimeMillis = in.readLong(); - mNumPacketsTx = in.readLong(); - mNumBytesTx = in.readLong(); - mNumPacketsRx = in.readLong(); - mNumBytesRx = in.readLong(); - mSleepTimeMillis = in.readLong(); - mScanTimeMillis = in.readLong(); - mIdleTimeMillis = in.readLong(); - mRxTimeMillis = in.readLong(); - mTxTimeMillis = in.readLong(); - mEnergyConsumedMaMillis = in.readLong(); - mNumAppScanRequest = in.readLong(); - in.readLongArray(mTimeInStateMillis); - in.readLongArray(mTimeInRxSignalStrengthLevelMillis); - in.readLongArray(mTimeInSupplicantStateMillis); - mMonitoredRailChargeConsumedMaMillis = in.readLong(); + public WifiBatteryStats(long loggingDurationMillis, long kernelActiveTimeMillis, + long numPacketsTx, long numBytesTx, long numPacketsRx, long numBytesRx, + long sleepTimeMillis, long scanTimeMillis, long idleTimeMillis, long rxTimeMillis, + long txTimeMillis, long energyConsumedMaMillis, long appScanRequestCount, + @NonNull long[] timeInStateMillis, @NonNull long [] timeInRxSignalStrengthLevelMillis, + @NonNull long[] timeInSupplicantStateMillis, long monitoredRailChargeConsumedMaMillis) { + mLoggingDurationMillis = loggingDurationMillis; + mKernelActiveTimeMillis = kernelActiveTimeMillis; + mNumPacketsTx = numPacketsTx; + mNumBytesTx = numBytesTx; + mNumPacketsRx = numPacketsRx; + mNumBytesRx = numBytesRx; + mSleepTimeMillis = sleepTimeMillis; + mScanTimeMillis = scanTimeMillis; + mIdleTimeMillis = idleTimeMillis; + mRxTimeMillis = rxTimeMillis; + mTxTimeMillis = txTimeMillis; + mEnergyConsumedMaMillis = energyConsumedMaMillis; + mAppScanRequestCount = appScanRequestCount; + mTimeInStateMillis = Arrays.copyOfRange( + timeInStateMillis, 0, + Math.min(timeInStateMillis.length, NUM_WIFI_STATES)); + mTimeInRxSignalStrengthLevelMillis = Arrays.copyOfRange( + timeInRxSignalStrengthLevelMillis, 0, + Math.min(timeInRxSignalStrengthLevelMillis.length, NUM_WIFI_SIGNAL_STRENGTH_BINS)); + mTimeInSupplicantStateMillis = Arrays.copyOfRange( + timeInSupplicantStateMillis, 0, + Math.min(timeInSupplicantStateMillis.length, NUM_WIFI_SUPPL_STATES)); + mMonitoredRailChargeConsumedMaMillis = monitoredRailChargeConsumedMaMillis; } /** @@ -182,7 +212,7 @@ public final class WifiBatteryStats implements Parcelable { } /** - * Returns the number of packets received over wifi within + * Returns the number of bytes transmitted over wifi within * {@link #getLoggingDurationMillis()}. * * @return Number of packets received. @@ -192,7 +222,7 @@ public final class WifiBatteryStats implements Parcelable { } /** - * Returns the number of bytes transmitted over wifi within + * Returns the number of packets received over wifi within * {@link #getLoggingDurationMillis()}. * * @return Number of bytes transmitted. @@ -262,7 +292,7 @@ public final class WifiBatteryStats implements Parcelable { } /** - * Returns an estimation of energy consumed by wifi chip within + * Returns an estimation of energy consumed in millis by wifi chip within * {@link #getLoggingDurationMillis()}. * * @return Energy consumed in millis. @@ -276,8 +306,8 @@ public final class WifiBatteryStats implements Parcelable { * * @return Number of app scans. */ - public long getNumAppScanRequest() { - return mNumAppScanRequest; + public long getAppScanRequestCount() { + return mAppScanRequestCount; } /** @@ -288,113 +318,4 @@ public final class WifiBatteryStats implements Parcelable { public long getMonitoredRailChargeConsumedMaMillis() { return mMonitoredRailChargeConsumedMaMillis; } - - /** @hide */ - public void setLoggingDurationMillis(long t) { - mLoggingDurationMillis = t; - return; - } - - /** @hide */ - public void setKernelActiveTimeMillis(long t) { - mKernelActiveTimeMillis = t; - return; - } - - /** @hide */ - public void setNumPacketsTx(long n) { - mNumPacketsTx = n; - return; - } - - /** @hide */ - public void setNumBytesTx(long b) { - mNumBytesTx = b; - return; - } - - /** @hide */ - public void setNumPacketsRx(long n) { - mNumPacketsRx = n; - return; - } - - /** @hide */ - public void setNumBytesRx(long b) { - mNumBytesRx = b; - return; - } - - /** @hide */ - public void setSleepTimeMillis(long t) { - mSleepTimeMillis = t; - return; - } - - /** @hide */ - public void setScanTimeMillis(long t) { - mScanTimeMillis = t; - return; - } - - /** @hide */ - public void setIdleTimeMillis(long t) { - mIdleTimeMillis = t; - return; - } - - /** @hide */ - public void setRxTimeMillis(long t) { - mRxTimeMillis = t; - return; - } - - /** @hide */ - public void setTxTimeMillis(long t) { - mTxTimeMillis = t; - return; - } - - /** @hide */ - public void setEnergyConsumedMaMillis(long e) { - mEnergyConsumedMaMillis = e; - return; - } - - /** @hide */ - public void setNumAppScanRequest(long n) { - mNumAppScanRequest = n; - return; - } - - /** @hide */ - public void setTimeInStateMillis(long[] t) { - mTimeInStateMillis = Arrays.copyOfRange(t, 0, - Math.min(t.length, BatteryStatsManager.NUM_WIFI_STATES)); - return; - } - - /** @hide */ - public void setTimeInRxSignalStrengthLevelMillis(long[] t) { - mTimeInRxSignalStrengthLevelMillis = Arrays.copyOfRange(t, 0, - Math.min(t.length, BatteryStats.NUM_WIFI_SIGNAL_STRENGTH_BINS)); - return; - } - - /** @hide */ - public void setTimeInSupplicantStateMillis(long[] t) { - mTimeInSupplicantStateMillis = Arrays.copyOfRange( - t, 0, Math.min(t.length, BatteryStatsManager.NUM_WIFI_SUPPL_STATES)); - return; - } - - /** @hide */ - public void setMonitoredRailChargeConsumedMaMillis(long monitoredRailEnergyConsumedMaMillis) { - mMonitoredRailChargeConsumedMaMillis = monitoredRailEnergyConsumedMaMillis; - return; - } - - private WifiBatteryStats(Parcel in) { - readFromParcel(in); - } } diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 453728137d9a..f25cdf1b8c98 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -37,7 +37,6 @@ import android.database.sqlite.SqliteWrapper; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.Parcel; import android.telephony.CarrierConfigManager; import android.telephony.Rlog; import android.telephony.ServiceState; @@ -4559,32 +4558,6 @@ public final class Telephony { } /** - * Used to insert a ServiceState into the ServiceStateProvider as a ContentValues instance. - * - * @param state the ServiceState to convert into ContentValues - * @return the convertedContentValues instance - * @hide - */ - public static ContentValues getContentValuesForServiceState(ServiceState state) { - ContentValues values = new ContentValues(); - final Parcel p = Parcel.obtain(); - state.writeToParcel(p, 0); - // Turn the parcel to byte array. Safe to do this because the content values were never - // written into a persistent storage. ServiceStateProvider keeps values in the memory. - values.put(SERVICE_STATE, p.marshall()); - return values; - } - - /** - * The current service state. - * - * This is the entire {@link ServiceState} object in byte array. - * - * @hide - */ - public static final String SERVICE_STATE = "service_state"; - - /** * An integer value indicating the current voice service state. * <p> * Valid values: {@link ServiceState#STATE_IN_SERVICE}, @@ -4596,53 +4569,6 @@ public final class Telephony { public static final String VOICE_REG_STATE = "voice_reg_state"; /** - * An integer value indicating the current data service state. - * <p> - * Valid values: {@link ServiceState#STATE_IN_SERVICE}, - * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY}, - * {@link ServiceState#STATE_POWER_OFF}. - * <p> - * This is the same as {@link ServiceState#getDataRegState()}. - * @hide - */ - public static final String DATA_REG_STATE = "data_reg_state"; - - /** - * An integer value indicating the current voice roaming type. - * <p> - * This is the same as {@link ServiceState#getVoiceRoamingType()}. - * @hide - */ - public static final String VOICE_ROAMING_TYPE = "voice_roaming_type"; - - /** - * An integer value indicating the current data roaming type. - * <p> - * This is the same as {@link ServiceState#getDataRoamingType()}. - * @hide - */ - public static final String DATA_ROAMING_TYPE = "data_roaming_type"; - - /** - * The current registered voice network operator name in long alphanumeric format. - * <p> - * This is the same as {@link ServiceState#getOperatorAlphaLong()}. - * @hide - */ - public static final String VOICE_OPERATOR_ALPHA_LONG = "voice_operator_alpha_long"; - - /** - * The current registered operator name in short alphanumeric format. - * <p> - * In GSM/UMTS, short format can be up to 8 characters long. The current registered voice - * network operator name in long alphanumeric format. - * <p> - * This is the same as {@link ServiceState#getOperatorAlphaShort()}. - * @hide - */ - public static final String VOICE_OPERATOR_ALPHA_SHORT = "voice_operator_alpha_short"; - - /** * The current registered operator numeric id. * <p> * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit @@ -4653,125 +4579,11 @@ public final class Telephony { public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric"; /** - * The current registered data network operator name in long alphanumeric format. - * <p> - * This is the same as {@link ServiceState#getOperatorAlphaLong()}. - * @hide - */ - public static final String DATA_OPERATOR_ALPHA_LONG = "data_operator_alpha_long"; - - /** - * The current registered data network operator name in short alphanumeric format. - * <p> - * This is the same as {@link ServiceState#getOperatorAlphaShort()}. - * @hide - */ - public static final String DATA_OPERATOR_ALPHA_SHORT = "data_operator_alpha_short"; - - /** - * The current registered data network operator numeric id. - * <p> - * This is the same as {@link ServiceState#getOperatorNumeric()}. - * @hide - */ - public static final String DATA_OPERATOR_NUMERIC = "data_operator_numeric"; - - /** * The current network selection mode. * <p> * This is the same as {@link ServiceState#getIsManualSelection()}. */ public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection"; - - /** - * This is the same as {@link ServiceState#getRilVoiceRadioTechnology()}. - * @hide - */ - public static final String RIL_VOICE_RADIO_TECHNOLOGY = "ril_voice_radio_technology"; - - /** - * This is the same as {@link ServiceState#getRilDataRadioTechnology()}. - * @hide - */ - public static final String RIL_DATA_RADIO_TECHNOLOGY = "ril_data_radio_technology"; - - /** - * This is the same as {@link ServiceState#getCssIndicator()}. - * @hide - */ - public static final String CSS_INDICATOR = "css_indicator"; - - /** - * This is the same as {@link ServiceState#getCdmaNetworkId()}. - * @hide - */ - public static final String NETWORK_ID = "network_id"; - - /** - * This is the same as {@link ServiceState#getCdmaSystemId()}. - * @hide - */ - public static final String SYSTEM_ID = "system_id"; - - /** - * This is the same as {@link ServiceState#getCdmaRoamingIndicator()}. - * @hide - */ - public static final String CDMA_ROAMING_INDICATOR = "cdma_roaming_indicator"; - - /** - * This is the same as {@link ServiceState#getCdmaDefaultRoamingIndicator()}. - * @hide - */ - public static final String CDMA_DEFAULT_ROAMING_INDICATOR = - "cdma_default_roaming_indicator"; - - /** - * This is the same as {@link ServiceState#getCdmaEriIconIndex()}. - * @hide - */ - public static final String CDMA_ERI_ICON_INDEX = "cdma_eri_icon_index"; - - /** - * This is the same as {@link ServiceState#getCdmaEriIconMode()}. - * @hide - */ - public static final String CDMA_ERI_ICON_MODE = "cdma_eri_icon_mode"; - - /** - * This is the same as {@link ServiceState#isEmergencyOnly()}. - * @hide - */ - public static final String IS_EMERGENCY_ONLY = "is_emergency_only"; - - /** - * This is the same as {@link ServiceState#getDataRoamingFromRegistration()}. - * @hide - */ - public static final String IS_DATA_ROAMING_FROM_REGISTRATION = - "is_data_roaming_from_registration"; - - /** - * This is the same as {@link ServiceState#isUsingCarrierAggregation()}. - * @hide - */ - public static final String IS_USING_CARRIER_AGGREGATION = "is_using_carrier_aggregation"; - - /** - * The current registered raw data network operator name in long alphanumeric format. - * <p> - * This is the same as {@link ServiceState#getOperatorAlphaLongRaw()}. - * @hide - */ - public static final String OPERATOR_ALPHA_LONG_RAW = "operator_alpha_long_raw"; - - /** - * The current registered raw data network operator name in short alphanumeric format. - * <p> - * This is the same as {@link ServiceState#getOperatorAlphaShortRaw()}. - * @hide - */ - public static final String OPERATOR_ALPHA_SHORT_RAW = "operator_alpha_short_raw"; } /** @@ -5299,6 +5111,12 @@ public final class Telephony { public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled"; /** + * Determines if the user has enabled IMS RCS User Capability Exchange (UCE) for this + * subscription. + */ + public static final String IMS_RCS_UCE_ENABLED = "ims_rcs_uce_enabled"; + + /** * TelephonyProvider column name for whether a subscription is opportunistic, that is, * whether the network it connects to is limited in functionality or coverage. * For example, CBRS. diff --git a/core/java/android/service/dataloader/DataLoaderService.java b/core/java/android/service/dataloader/DataLoaderService.java index 75f252e23f79..c21577842199 100644 --- a/core/java/android/service/dataloader/DataLoaderService.java +++ b/core/java/android/service/dataloader/DataLoaderService.java @@ -58,6 +58,7 @@ public abstract class DataLoaderService extends Service { * Managed DataLoader interface. Each instance corresponds to a single installation session. * @hide */ + @SystemApi public interface DataLoader { /** * A virtual constructor. @@ -78,8 +79,8 @@ public abstract class DataLoaderService extends Service { * @param removedFiles list of files removed in this installation session. * @return false if unable to create and populate all addedFiles. */ - boolean onPrepareImage(Collection<InstallationFile> addedFiles, - Collection<String> removedFiles); + boolean onPrepareImage(@NonNull Collection<InstallationFile> addedFiles, + @NonNull Collection<String> removedFiles); } /** @@ -88,6 +89,7 @@ public abstract class DataLoaderService extends Service { * @return An instance of a DataLoader. * @hide */ + @SystemApi public @Nullable DataLoader onCreateDataLoader() { return null; } @@ -188,6 +190,7 @@ public abstract class DataLoaderService extends Service { * * @hide */ + @SystemApi public static final class FileSystemConnector { /** * Create a wrapper for a native instance. @@ -211,8 +214,8 @@ public abstract class DataLoaderService extends Service { * @throws IOException if trouble opening the file for writing, such as lack of disk space * or unavailable media. */ - public void writeData(String name, long offsetBytes, long lengthBytes, - ParcelFileDescriptor incomingFd) throws IOException { + public void writeData(@NonNull String name, long offsetBytes, long lengthBytes, + @NonNull ParcelFileDescriptor incomingFd) throws IOException { try { nativeWriteData(mNativeInstance, name, offsetBytes, lengthBytes, incomingFd); } catch (RuntimeException e) { diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java index 57375919e6cd..6787c46c046e 100644 --- a/core/java/android/telephony/TelephonyRegistryManager.java +++ b/core/java/android/telephony/TelephonyRegistryManager.java @@ -36,6 +36,7 @@ import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.Annotation.SrvccState; import android.telephony.data.ApnSetting; +import android.telephony.emergency.EmergencyNumber; import android.telephony.ims.ImsReasonInfo; import android.util.Log; @@ -198,6 +199,25 @@ public class TelephonyRegistryManager { } /** + * Listen for incoming subscriptions + * @param subId Subscription ID + * @param pkg Package name + * @param featureId Feature ID + * @param listener Listener providing callback + * @param events Events + * @param notifyNow Whether to notify instantly + */ + public void listenForSubscriber(int subId, @NonNull String pkg, @NonNull String featureId, + @NonNull PhoneStateListener listener, int events, boolean notifyNow) { + try { + sRegistry.listenForSubscriber( + subId, pkg, featureId, listener.callback, events, notifyNow); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Informs the system of an intentional upcoming carrier network change by a carrier app. * This call only used to allow the system to provide alternative UI while telephony is * performing an action that may result in intentional, temporary network lack of connectivity. @@ -258,6 +278,32 @@ public class TelephonyRegistryManager { } /** + * Notify {@link SubscriptionInfo} change. + * @hide + */ + @SystemApi + public void notifySubscriptionInfoChanged() { + try { + sRegistry.notifySubscriptionInfoChanged(); + } catch (RemoteException ex) { + // system server crash + } + } + + /** + * Notify opportunistic {@link SubscriptionInfo} change. + * @hide + */ + @SystemApi + public void notifyOpportunisticSubscriptionInfoChanged() { + try { + sRegistry.notifyOpportunisticSubscriptionInfoChanged(); + } catch (RemoteException ex) { + // system server crash + } + } + + /** * Notify {@link ServiceState} update on certain subscription. * * @param subId for which the service state changed. @@ -394,6 +440,36 @@ public class TelephonyRegistryManager { } /** + * Notify outgoing emergency call. + * @param phoneId Sender phone ID. + * @param subId Sender subscription ID. + * @param emergencyNumber Emergency number. + */ + public void notifyOutgoingEmergencyCall(int phoneId, int subId, + @NonNull EmergencyNumber emergencyNumber) { + try { + sRegistry.notifyOutgoingEmergencyCall(phoneId, subId, emergencyNumber); + } catch (RemoteException ex) { + // system process is dead + } + } + + /** + * Notify outgoing emergency SMS. + * @param phoneId Sender phone ID. + * @param subId Sender subscription ID. + * @param emergencyNumber Emergency number. + */ + public void notifyOutgoingEmergencySms(int phoneId, int subId, + @NonNull EmergencyNumber emergencyNumber) { + try { + sRegistry.notifyOutgoingEmergencySms(phoneId, subId, emergencyNumber); + } catch (RemoteException ex) { + // system process is dead + } + } + + /** * Notify radio power state changed on certain subscription. * * @param subId for which radio power state changed. diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index 7707ad163b85..a6b7c33de3d9 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -16,6 +16,7 @@ package android.view; +import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.NonNull; import android.compat.annotation.UnsupportedAppUsage; @@ -88,6 +89,8 @@ public class Surface implements Parcelable { private static native int nativeSetSharedBufferModeEnabled(long nativeObject, boolean enabled); private static native int nativeSetAutoRefreshEnabled(long nativeObject, boolean enabled); + private static native int nativeSetFrameRate(long nativeObject, float frameRate); + public static final @android.annotation.NonNull Parcelable.Creator<Surface> CREATOR = new Parcelable.Creator<Surface>() { @Override @@ -841,6 +844,34 @@ public class Surface implements Parcelable { } /** + * Sets the intended frame rate for this surface. + * + * On devices that are capable of running the display at different refresh rates, the + * system may choose a display refresh rate to better match this surface's frame + * rate. Usage of this API won't introduce frame rate throttling, or affect other + * aspects of the application's frame production pipeline. However, because the system + * may change the display refresh rate, calls to this function may result in changes + * to Choreographer callback timings, and changes to the time interval at which the + * system releases buffers back to the application. + * + * Note that this only has an effect for surfaces presented on the display. If this + * surface is consumed by something other than the system compositor, e.g. a media + * codec, this call has no effect. + * + * @param frameRate The intended frame rate of this surface. 0 is a special value that + * indicates the app will accept the system's choice for the display frame rate, which + * is the default behavior if this function isn't called. The frameRate param does + * *not* need to be a valid refresh rate for this device's display - e.g., it's fine + * to pass 30fps to a device that can only run the display at 60fps. + */ + public void setFrameRate(@FloatRange(from = 0.0) float frameRate) { + int error = nativeSetFrameRate(mNativeObject, frameRate); + if (error != 0) { + throw new RuntimeException("Failed to set frame rate on Surface"); + } + } + + /** * Exception thrown when a Canvas couldn't be locked with {@link Surface#lockCanvas}, or * when a SurfaceTexture could not successfully be allocated. */ diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index bcc9e41b8ab0..f7b87cce7338 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -211,6 +211,9 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetGlobalShadowSettings(@Size(4) float[] ambientColor, @Size(4) float[] spotColor, float lightPosY, float lightPosZ, float lightRadius); + private static native void nativeSetFrameRate( + long transactionObj, long nativeObject, float frameRate); + private final CloseGuard mCloseGuard = CloseGuard.get(); private String mName; /** @@ -2787,6 +2790,33 @@ public final class SurfaceControl implements Parcelable { } /** + * Sets the intended frame rate for the surface {@link SurfaceControl}. + * + * On devices that are capable of running the display at different refresh rates, the system + * may choose a display refresh rate to better match this surface's frame rate. Usage of + * this API won't directly affect the application's frame production pipeline. However, + * because the system may change the display refresh rate, calls to this function may result + * in changes to Choreographer callback timings, and changes to the time interval at which + * the system releases buffers back to the application. + * + * @param sc The SurfaceControl to specify the frame rate of. + * @param frameRate The intended frame rate for this surface. 0 is a special value that + * indicates the app will accept the system's choice for the display frame + * rate, which is the default behavior if this function isn't called. The + * frameRate param does *not* need to be a valid refresh rate for this + * device's display - e.g., it's fine to pass 30fps to a device that can + * only run the display at 60fps. + * @return This transaction object. + */ + @NonNull + public Transaction setFrameRate( + @NonNull SurfaceControl sc, @FloatRange(from = 0.0) float frameRate) { + checkPreconditions(sc); + nativeSetFrameRate(mNativeObject, sc.mNativeObject, frameRate); + return this; + } + + /** * Merge the other transaction into this transaction, clearing the * other transaction as if it had been applied. * diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index b3548b8c82f8..580c1f00d788 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -12644,7 +12644,6 @@ public class BatteryStatsImpl extends BatteryStats { /*@hide */ public WifiBatteryStats getWifiBatteryStats() { - WifiBatteryStats s = new WifiBatteryStats(); final int which = STATS_SINCE_CHARGED; final long rawRealTime = SystemClock.elapsedRealtime() * 1000; final ControllerActivityCounter counter = getWifiControllerActivity(); @@ -12675,24 +12674,16 @@ public class BatteryStatsImpl extends BatteryStats { for (int i=0; i<NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) { timeSignalStrengthTimeMs[i] = getWifiSignalStrengthTime(i, rawRealTime, which) / 1000; } - s.setLoggingDurationMillis(computeBatteryRealtime(rawRealTime, which) / 1000); - s.setKernelActiveTimeMillis(getWifiActiveTime(rawRealTime, which) / 1000); - s.setNumPacketsTx(getNetworkActivityPackets(NETWORK_WIFI_TX_DATA, which)); - s.setNumBytesTx(getNetworkActivityBytes(NETWORK_WIFI_TX_DATA, which)); - s.setNumPacketsRx(getNetworkActivityPackets(NETWORK_WIFI_RX_DATA, which)); - s.setNumBytesRx(getNetworkActivityBytes(NETWORK_WIFI_RX_DATA, which)); - s.setSleepTimeMillis(sleepTimeMs); - s.setIdleTimeMillis(idleTimeMs); - s.setRxTimeMillis(rxTimeMs); - s.setTxTimeMillis(txTimeMs); - s.setScanTimeMillis(scanTimeMs); - s.setEnergyConsumedMaMillis(energyConsumedMaMs); - s.setNumAppScanRequest(numAppScanRequest); - s.setTimeInStateMillis(timeInStateMs); - s.setTimeInSupplicantStateMillis(timeInSupplStateMs); - s.setTimeInRxSignalStrengthLevelMillis(timeSignalStrengthTimeMs); - s.setMonitoredRailChargeConsumedMaMillis(monitoredRailChargeConsumedMaMs); - return s; + return new WifiBatteryStats( + computeBatteryRealtime(rawRealTime, which) / 1000, + getWifiActiveTime(rawRealTime, which) / 1000, + getNetworkActivityPackets(NETWORK_WIFI_TX_DATA, which), + getNetworkActivityBytes(NETWORK_WIFI_TX_DATA, which), + getNetworkActivityPackets(NETWORK_WIFI_RX_DATA, which), + getNetworkActivityBytes(NETWORK_WIFI_RX_DATA, which), + sleepTimeMs, scanTimeMs, idleTimeMs, rxTimeMs, txTimeMs, energyConsumedMaMs, + numAppScanRequest, timeInStateMs, timeSignalStrengthTimeMs, timeInSupplStateMs, + monitoredRailChargeConsumedMaMs); } /*@hide */ diff --git a/core/jni/android_media_AudioEffectDescriptor.cpp b/core/jni/android_media_AudioEffectDescriptor.cpp index 5175a05c4c3b..37d8114052b8 100644 --- a/core/jni/android_media_AudioEffectDescriptor.cpp +++ b/core/jni/android_media_AudioEffectDescriptor.cpp @@ -39,17 +39,21 @@ jint convertAudioEffectDescriptorFromNative(JNIEnv* env, jobject* jDescriptor, jstring jImplementor; char str[EFFECT_STRING_LEN_MAX]; - if ((nDescriptor->flags & EFFECT_FLAG_TYPE_MASK) - == EFFECT_FLAG_TYPE_AUXILIARY) { - jConnect = env->NewStringUTF("Auxiliary"); - } else if ((nDescriptor->flags & EFFECT_FLAG_TYPE_MASK) - == EFFECT_FLAG_TYPE_INSERT) { - jConnect = env->NewStringUTF("Insert"); - } else if ((nDescriptor->flags & EFFECT_FLAG_TYPE_MASK) - == EFFECT_FLAG_TYPE_PRE_PROC) { - jConnect = env->NewStringUTF("Pre Processing"); - } else { - return (jint) AUDIO_JAVA_BAD_VALUE; + switch (nDescriptor->flags & EFFECT_FLAG_TYPE_MASK) { + case EFFECT_FLAG_TYPE_AUXILIARY: + jConnect = env->NewStringUTF("Auxiliary"); + break; + case EFFECT_FLAG_TYPE_INSERT: + jConnect = env->NewStringUTF("Insert"); + break; + case EFFECT_FLAG_TYPE_PRE_PROC: + jConnect = env->NewStringUTF("Pre Processing"); + break; + case EFFECT_FLAG_TYPE_POST_PROC: + jConnect = env->NewStringUTF("Post Processing"); + break; + default: + return (jint)AUDIO_JAVA_BAD_VALUE; } AudioEffect::guidToString(&nDescriptor->type, str, EFFECT_STRING_LEN_MAX); diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index 01b5920755fa..b01083bba643 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -413,6 +413,12 @@ static jint nativeSetAutoRefreshEnabled(JNIEnv* env, jclass clazz, jlong nativeO return anw->perform(surface, NATIVE_WINDOW_SET_AUTO_REFRESH, int(enabled)); } +static jint nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat frameRate) { + Surface* surface = reinterpret_cast<Surface*>(nativeObject); + ANativeWindow* anw = static_cast<ANativeWindow*>(surface); + return anw->perform(surface, NATIVE_WINDOW_SET_FRAME_RATE, float(frameRate)); +} + // ---------------------------------------------------------------------------- static const JNINativeMethod gSurfaceMethods[] = { @@ -447,6 +453,7 @@ static const JNINativeMethod gSurfaceMethods[] = { (void*)nativeAttachAndQueueBufferWithColorSpace}, {"nativeSetSharedBufferModeEnabled", "(JZ)I", (void*)nativeSetSharedBufferModeEnabled}, {"nativeSetAutoRefreshEnabled", "(JZ)I", (void*)nativeSetAutoRefreshEnabled}, + {"nativeSetFrameRate", "(JF)I", (void*)nativeSetFrameRate}, }; int register_android_view_Surface(JNIEnv* env) diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index e0f9571472da..2b9d45431582 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -584,6 +584,14 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb transaction->setShadowRadius(ctrl, shadowRadius); } +static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, + jfloat frameRate) { + auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); + + const auto ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); + transaction->setFrameRate(ctrl, frameRate); +} + static jlongArray nativeGetPhysicalDisplayIds(JNIEnv* env, jclass clazz) { const auto displayIds = SurfaceComposerClient::getPhysicalDisplayIds(); jlongArray array = env->NewLongArray(displayIds.size()); @@ -1383,6 +1391,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetLayerStack }, {"nativeSetShadowRadius", "(JJF)V", (void*)nativeSetShadowRadius }, + {"nativeSetFrameRate", "(JJF)V", + (void*)nativeSetFrameRate }, {"nativeGetPhysicalDisplayIds", "()[J", (void*)nativeGetPhysicalDisplayIds }, {"nativeGetPhysicalDisplayToken", "(J)Landroid/os/IBinder;", diff --git a/core/proto/android/hardware/location/context_hub_info.proto b/core/proto/android/hardware/location/context_hub_info.proto new file mode 100644 index 000000000000..de5cd55fafaf --- /dev/null +++ b/core/proto/android/hardware/location/context_hub_info.proto @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2020 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. + */ + +syntax = "proto2"; +package android.hardware.location; + +import "frameworks/base/core/proto/android/privacy.proto"; + +option java_multiple_files = true; + +message ContextHubInfoProto { + option (android.msg_privacy).dest = DEST_AUTOMATIC; + // Context hub unique identifier + optional int32 id = 1; + // A name for the hub + optional string name = 2; + // A name for the vendor + optional string vendor = 3; + // Description of the tool chain + optional string toolchain = 4; + optional int32 platform_version = 5; + optional int32 static_sw_version = 6; + optional int32 toolchain_version = 7; + // The CHRE platform ID as defined in chre/version.h + optional int64 chre_platform_id = 8; + // Peak MIPS that this hub can deliver + optional float peak_mips = 9; + // Power draw in stopped state in milli watts + optional float stopped_power_draw_mw = 10; + // Power draw in sleep state in milli watts + optional float sleep_power_draw_mw = 11; + // Peak power draw in milli watts + optional float peak_power_draw_mw = 12; + // The maximum number of bytes that can be sent per message to the hub + optional int32 max_packet_length_bytes = 13; +} diff --git a/core/proto/android/os/incident.proto b/core/proto/android/os/incident.proto index d08cbed5909d..8adcc9ed905d 100644 --- a/core/proto/android/os/incident.proto +++ b/core/proto/android/os/incident.proto @@ -36,6 +36,7 @@ import "frameworks/base/core/proto/android/server/activitymanagerservice.proto"; import "frameworks/base/core/proto/android/server/alarmmanagerservice.proto"; import "frameworks/base/core/proto/android/server/fingerprint.proto"; import "frameworks/base/core/proto/android/server/jobscheduler.proto"; +import "frameworks/base/core/proto/android/server/location/context_hub.proto"; import "frameworks/base/core/proto/android/server/powermanagerservice.proto"; import "frameworks/base/core/proto/android/server/rolemanagerservice.proto"; import "frameworks/base/core/proto/android/server/windowmanagerservice.proto"; @@ -486,6 +487,11 @@ message IncidentProto { (section).args = "connmetrics --proto" ]; + optional com.android.server.location.ContextHubServiceProto context_hub = 3051 [ + (section).type = SECTION_DUMPSYS, + (section).args = "contexthub --proto" + ]; + // Reserved for OEMs. extensions 50000 to 100000; } diff --git a/core/proto/android/server/location/context_hub.proto b/core/proto/android/server/location/context_hub.proto new file mode 100644 index 000000000000..c87f79193ee3 --- /dev/null +++ b/core/proto/android/server/location/context_hub.proto @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2020 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. + */ + +syntax = "proto2"; +package com.android.server.location; + +import "frameworks/base/core/proto/android/hardware/location/context_hub_info.proto"; +import "frameworks/base/core/proto/android/privacy.proto"; + +option java_multiple_files = true; + +message ContextHubServiceProto { + option (.android.msg_privacy).dest = DEST_AUTOMATIC; + + repeated .android.hardware.location.ContextHubInfoProto context_hub_info = 1; + optional ClientManagerProto client_manager = 2; +} + +message ClientManagerProto { + option (.android.msg_privacy).dest = DEST_AUTOMATIC; + + message RegistrationRecord { + option (.android.msg_privacy).dest = DEST_AUTOMATIC; + + optional int64 timestamp_ms = 1; + optional int32 action = 2; + // ClientBroker endpoint id, contexthub id and package name + optional string broker = 3; + } + + repeated ClientBrokerProto client_brokers = 1; + repeated RegistrationRecord registration_records = 2; +} + +message ClientBrokerProto { + option (.android.msg_privacy).dest = DEST_AUTOMATIC; + + optional int32 endpoint_id = 1; + optional int32 attached_context_hub_id = 2; + optional string package = 3; + optional int64 nano_app_id = 4; + optional bool pending_intent_request_valid = 5; + optional bool has_pending_intent = 6; + optional bool pending_intent_cancelled = 7; + optional bool registered = 8; + +} diff --git a/core/res/res/layout/autofill_inline_suggestion.xml b/core/res/res/layout/autofill_inline_suggestion.xml index f7ac1642f6b7..27faea4b00de 100644 --- a/core/res/res/layout/autofill_inline_suggestion.xml +++ b/core/res/res/layout/autofill_inline_suggestion.xml @@ -16,19 +16,20 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" + style="?android:attr/autofillInlineSuggestionChip" android:layout_width="wrap_content" - android:layout_height="56dp" - android:background="@color/white" - android:orientation="horizontal" - android:paddingStart="12dp" - android:paddingEnd="12dp"> + android:layout_height="wrap_content" + android:gravity="center" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:orientation="horizontal"> <ImageView android:id="@+id/autofill_inline_suggestion_start_icon" - android:layout_width="24dp" - android:layout_height="24dp" + android:layout_width="wrap_content" + android:layout_height="match_parent" android:layout_gravity="center" + android:scaleType="fitCenter" android:contentDescription="autofill_inline_suggestion_start_icon" /> <LinearLayout @@ -36,32 +37,33 @@ android:layout_height="match_parent" android:layout_gravity="center" android:layout_weight="1" - android:layout_marginStart="12dp" - android:layout_marginEnd="12dp" + android:paddingStart="4dp" + android:paddingEnd="4dp" android:orientation="vertical" - android:gravity="center_vertical"> + android:gravity="center"> <TextView + style="?android:attr/autofillInlineSuggestionTitle" android:id="@+id/autofill_inline_suggestion_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" - android:maxLines="1" - tools:text="username1"/> + android:maxLines="1"/> <TextView + style="?android:attr/autofillInlineSuggestionSubtitle" android:id="@+id/autofill_inline_suggestion_subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" - android:maxLines="1" - tools:text="inline fill service"/> + android:maxLines="1"/> </LinearLayout> <ImageView android:id="@+id/autofill_inline_suggestion_end_icon" - android:layout_width="24dp" - android:layout_height="24dp" + android:layout_width="wrap_content" + android:layout_height="match_parent" android:layout_gravity="center" + android:scaleType="fitCenter" android:contentDescription="autofill_inline_suggestion_end_icon" /> </LinearLayout> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 940e9f1ef88b..c9c47b92f782 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -9197,4 +9197,12 @@ </declare-styleable> <attr name="autoSizePresetSizes" /> + + <declare-styleable name="AutofillInlineSuggestion"> + <!-- @hide @SystemApi --> + <attr name="isAutofillInlineSuggestionTheme" format="boolean" /> + <attr name="autofillInlineSuggestionChip" format="reference" /> + <attr name="autofillInlineSuggestionTitle" format="reference" /> + <attr name="autofillInlineSuggestionSubtitle" format="reference" /> + </declare-styleable> </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 42127e77317f..686bb555350e 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2685,6 +2685,11 @@ <!-- The amount to scale fullscreen snapshots for Overview and snapshot starting windows. --> <item name="config_fullTaskSnapshotScale" format="float" type="dimen">1.0</item> + <!-- The amount to scale reduced scale snapshots for Overview and snapshot starting windows. + Reduced scale snapshots are loaded before full screen snapshots to improve load times and + minimize the chance the user will see an empty task card. --> + <item name="config_reducedTaskSnapshotScale" format="float" type="dimen">0.5</item> + <!-- Feature flag to store TaskSnapshot in 16 bit pixel format to save memory. --> <bool name="config_use16BitTaskSnapshotPixelFormat">false</bool> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 36dbcbd53977..d43c9fdb794a 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -3012,12 +3012,18 @@ <public name="sdkVersion" /> <!-- @hide @SystemApi --> <public name="minExtensionVersion" /> + <public name="autofillInlineSuggestionChip" /> + <public name="autofillInlineSuggestionTitle" /> + <public name="autofillInlineSuggestionSubtitle" /> + <!-- @hide @SystemApi --> + <public name="isAutofillInlineSuggestionTheme" /> </public-group> <public-group type="drawable" first-id="0x010800b5"> </public-group> <public-group type="style" first-id="0x010302e5"> + <public name="Theme.AutofillInlineSuggestion" /> </public-group> <public-group type="id" first-id="0x0102004a"> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index bcce1f05f0dd..751eca036ba6 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -1482,6 +1482,22 @@ please see styles_device_defaults.xml. <item name="android:windowExitAnimation">@anim/slide_out_down</item> </style> + <!-- The style for the Autofill inline suggestion chip. --> + <!-- @hide --> + <style name="AutofillInlineSuggestionChip"> + <item name="background">@drawable/autofill_dataset_picker_background</item> + </style> + + <!-- @hide --> + <style name="AutofillInlineSuggestionTitle"> + <item name="android:textAppearance">@style/TextAppearance</item> + </style> + + <!-- @hide --> + <style name="AutofillInlineSuggestionSubtitle"> + <item name="android:textAppearance">@style/TextAppearance.Small</item> + </style> + <!-- The style for the container of media actions in a notification. --> <!-- @hide --> <style name="NotificationMediaActionContainer"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index ea8ca9aa1c49..d437318a3296 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -360,6 +360,7 @@ <java-symbol type="bool" name="config_enableNewAutoSelectNetworkUI"/> <java-symbol type="bool" name="config_disableUsbPermissionDialogs"/> <java-symbol type="dimen" name="config_fullTaskSnapshotScale" /> + <java-symbol type="dimen" name="config_reducedTaskSnapshotScale" /> <java-symbol type="bool" name="config_use16BitTaskSnapshotPixelFormat" /> <java-symbol type="bool" name="config_hasRecents" /> <java-symbol type="string" name="config_recentsComponentName" /> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index ad38f3d57c23..5e6dd8294776 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -893,4 +893,11 @@ please see themes_device_defaults.xml. <item name="windowActivityTransitions">false</item> </style> + <!-- Theme for the Autofill inline suggestion on IME --> + <style name="Theme.AutofillInlineSuggestion" parent="Theme.DeviceDefault"> + <item name="isAutofillInlineSuggestionTheme">true</item> + <item name="autofillInlineSuggestionChip">@style/AutofillInlineSuggestionChip</item> + <item name="autofillInlineSuggestionTitle">@style/AutofillInlineSuggestionTitle</item> + <item name="autofillInlineSuggestionSubtitle">@style/AutofillInlineSuggestionSubtitle</item> + </style> </resources> diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h index 52305b8244a6..ebc622bae302 100644 --- a/libs/input/PointerController.h +++ b/libs/input/PointerController.h @@ -100,6 +100,7 @@ public: virtual int32_t getDisplayId() const; virtual void fade(Transition transition); virtual void unfade(Transition transition); + virtual void setDisplayViewport(const DisplayViewport& viewport); virtual void setPresentation(Presentation presentation); virtual void setSpots(const PointerCoords* spotCoords, @@ -108,7 +109,6 @@ public: void updatePointerIcon(int32_t iconId); void setCustomPointerIcon(const SpriteIcon& icon); - void setDisplayViewport(const DisplayViewport& viewport); void setInactivityTimeout(InactivityTimeout inactivityTimeout); void reloadPointerResources(); diff --git a/location/java/android/location/GnssClock.java b/location/java/android/location/GnssClock.java index 8a7878b46e89..ed4bf1b2d53e 100644 --- a/location/java/android/location/GnssClock.java +++ b/location/java/android/location/GnssClock.java @@ -17,6 +17,7 @@ package android.location; import android.annotation.FloatRange; +import android.annotation.NonNull; import android.annotation.TestApi; import android.os.Parcel; import android.os.Parcelable; @@ -39,6 +40,9 @@ public final class GnssClock implements Parcelable { private static final int HAS_DRIFT_UNCERTAINTY = (1<<6); private static final int HAS_ELAPSED_REALTIME_NANOS = (1 << 7); private static final int HAS_ELAPSED_REALTIME_UNCERTAINTY_NANOS = (1 << 8); + private static final int HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB = (1 << 9); + private static final int HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB = (1 << 10); + private static final int HAS_REFERENCE_CODE_TYPE_FOR_ISB = (1 << 11); // End enumerations in sync with gps.h @@ -54,6 +58,9 @@ public final class GnssClock implements Parcelable { private int mHardwareClockDiscontinuityCount; private long mElapsedRealtimeNanos; private double mElapsedRealtimeUncertaintyNanos; + private int mReferenceConstellationTypeForIsb; + private double mReferenceCarrierFrequencyHzForIsb; + private String mReferenceCodeTypeForIsb; /** * @hide @@ -81,6 +88,9 @@ public final class GnssClock implements Parcelable { mHardwareClockDiscontinuityCount = clock.mHardwareClockDiscontinuityCount; mElapsedRealtimeNanos = clock.mElapsedRealtimeNanos; mElapsedRealtimeUncertaintyNanos = clock.mElapsedRealtimeUncertaintyNanos; + mReferenceConstellationTypeForIsb = clock.mReferenceConstellationTypeForIsb; + mReferenceCarrierFrequencyHzForIsb = clock.mReferenceCarrierFrequencyHzForIsb; + mReferenceCodeTypeForIsb = clock.mReferenceCodeTypeForIsb; } /** @@ -196,7 +206,6 @@ public final class GnssClock implements Parcelable { @TestApi public void resetTimeUncertaintyNanos() { resetFlag(HAS_TIME_UNCERTAINTY); - mTimeUncertaintyNanos = Double.NaN; } /** @@ -286,7 +295,6 @@ public final class GnssClock implements Parcelable { @TestApi public void resetBiasNanos() { resetFlag(HAS_BIAS); - mBiasNanos = Double.NaN; } /** @@ -327,7 +335,6 @@ public final class GnssClock implements Parcelable { @TestApi public void resetBiasUncertaintyNanos() { resetFlag(HAS_BIAS_UNCERTAINTY); - mBiasUncertaintyNanos = Double.NaN; } /** @@ -371,7 +378,6 @@ public final class GnssClock implements Parcelable { @TestApi public void resetDriftNanosPerSecond() { resetFlag(HAS_DRIFT); - mDriftNanosPerSecond = Double.NaN; } /** @@ -411,7 +417,6 @@ public final class GnssClock implements Parcelable { @TestApi public void resetDriftUncertaintyNanosPerSecond() { resetFlag(HAS_DRIFT_UNCERTAINTY); - mDriftUncertaintyNanosPerSecond = Double.NaN; } /** @@ -495,7 +500,128 @@ public final class GnssClock implements Parcelable { @TestApi public void resetElapsedRealtimeUncertaintyNanos() { resetFlag(HAS_ELAPSED_REALTIME_UNCERTAINTY_NANOS); - mElapsedRealtimeUncertaintyNanos = Double.NaN; + } + + /** + * Returns {@code true} if {@link #getReferenceConstellationTypeForIsb()} is available, + * {@code false} otherwise. + */ + public boolean hasReferenceConstellationTypeForIsb() { + return isFlagSet(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB); + } + + /** + * Returns the reference constellation type for inter-signal bias. + * + * <p>The value is only available if {@link #hasReferenceConstellationTypeForIsb()} is + * {@code true}. + * + * <p>The return value is one of those constants with {@code CONSTELLATION_} prefix in + * {@link GnssStatus}. + */ + @GnssStatus.ConstellationType + public int getReferenceConstellationTypeForIsb() { + return mReferenceConstellationTypeForIsb; + } + + /** + * Sets the reference constellation type for inter-signal bias. + * @hide + */ + @TestApi + public void setReferenceConstellationTypeForIsb(@GnssStatus.ConstellationType int value) { + setFlag(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB); + mReferenceConstellationTypeForIsb = value; + } + + /** + * Resets the reference constellation type for inter-signal bias. + * @hide + */ + @TestApi + public void resetReferenceConstellationTypeForIsb() { + resetFlag(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB); + mReferenceConstellationTypeForIsb = GnssStatus.CONSTELLATION_UNKNOWN; + } + + /** + * Returns {@code true} if {@link #getReferenceCarrierFrequencyHzForIsb()} is available, {@code + * false} otherwise. + */ + public boolean hasReferenceCarrierFrequencyHzForIsb() { + return isFlagSet(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB); + } + + /** + * Returns the reference carrier frequency in Hz for inter-signal bias. + * + * <p>The value is only available if {@link #hasReferenceCarrierFrequencyHzForIsb()} is + * {@code true}. + */ + @FloatRange(from = 0.0) + public double getReferenceCarrierFrequencyHzForIsb() { + return mReferenceCarrierFrequencyHzForIsb; + } + + /** + * Sets the reference carrier frequency in Hz for inter-signal bias. + * @hide + */ + @TestApi + public void setReferenceCarrierFrequencyHzForIsb(@FloatRange(from = 0.0) double value) { + setFlag(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB); + mReferenceCarrierFrequencyHzForIsb = value; + } + + /** + * Resets the reference carrier frequency in Hz for inter-signal bias. + * @hide + */ + @TestApi + public void resetReferenceCarrierFrequencyHzForIsb() { + resetFlag(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB); + } + + /** + * Returns {@code true} if {@link #getReferenceCodeTypeForIsb()} is available, {@code + * false} otherwise. + */ + public boolean hasReferenceCodeTypeForIsb() { + return isFlagSet(HAS_REFERENCE_CODE_TYPE_FOR_ISB); + } + + /** + * Returns the reference code type for inter-signal bias. + * + * <p>The value is only available if {@link #hasReferenceCodeTypeForIsb()} is + * {@code true}. + * + * <p>The return value is one of those constants defined in + * {@link GnssMeasurement#getCodeType()}. + */ + @NonNull + public String getReferenceCodeTypeForIsb() { + return mReferenceCodeTypeForIsb; + } + + /** + * Sets the reference code type for inter-signal bias. + * @hide + */ + @TestApi + public void setReferenceCodeTypeForIsb(@NonNull String codeType) { + setFlag(HAS_REFERENCE_CODE_TYPE_FOR_ISB); + mReferenceCodeTypeForIsb = codeType; + } + + /** + * Resets the reference code type for inter-signal bias. + * @hide + */ + @TestApi + public void resetReferenceCodeTypeForIsb() { + resetFlag(HAS_REFERENCE_CODE_TYPE_FOR_ISB); + mReferenceCodeTypeForIsb = "UNKNOWN"; } /** @@ -543,6 +669,9 @@ public final class GnssClock implements Parcelable { gpsClock.mHardwareClockDiscontinuityCount = parcel.readInt(); gpsClock.mElapsedRealtimeNanos = parcel.readLong(); gpsClock.mElapsedRealtimeUncertaintyNanos = parcel.readDouble(); + gpsClock.mReferenceConstellationTypeForIsb = parcel.readInt(); + gpsClock.mReferenceCarrierFrequencyHzForIsb = parcel.readDouble(); + gpsClock.mReferenceCodeTypeForIsb = parcel.readString(); return gpsClock; } @@ -567,6 +696,9 @@ public final class GnssClock implements Parcelable { parcel.writeInt(mHardwareClockDiscontinuityCount); parcel.writeLong(mElapsedRealtimeNanos); parcel.writeDouble(mElapsedRealtimeUncertaintyNanos); + parcel.writeInt(mReferenceConstellationTypeForIsb); + parcel.writeDouble(mReferenceCarrierFrequencyHzForIsb); + parcel.writeString(mReferenceCodeTypeForIsb); } @Override @@ -580,7 +712,9 @@ public final class GnssClock implements Parcelable { final String formatWithUncertainty = " %-15s = %-25s %-26s = %s\n"; StringBuilder builder = new StringBuilder("GnssClock:\n"); - builder.append(String.format(format, "LeapSecond", hasLeapSecond() ? mLeapSecond : null)); + if (hasLeapSecond()) { + builder.append(String.format(format, "LeapSecond", mLeapSecond)); + } builder.append(String.format( formatWithUncertainty, @@ -589,39 +723,57 @@ public final class GnssClock implements Parcelable { "TimeUncertaintyNanos", hasTimeUncertaintyNanos() ? mTimeUncertaintyNanos : null)); - builder.append(String.format( - format, - "FullBiasNanos", - hasFullBiasNanos() ? mFullBiasNanos : null)); + if (hasFullBiasNanos()) { + builder.append(String.format(format, "FullBiasNanos", mFullBiasNanos)); + } - builder.append(String.format( - formatWithUncertainty, - "BiasNanos", - hasBiasNanos() ? mBiasNanos : null, - "BiasUncertaintyNanos", - hasBiasUncertaintyNanos() ? mBiasUncertaintyNanos : null)); + if (hasBiasNanos() || hasBiasUncertaintyNanos()) { + builder.append(String.format( + formatWithUncertainty, + "BiasNanos", + hasBiasNanos() ? mBiasNanos : null, + "BiasUncertaintyNanos", + hasBiasUncertaintyNanos() ? mBiasUncertaintyNanos : null)); + } - builder.append(String.format( - formatWithUncertainty, - "DriftNanosPerSecond", - hasDriftNanosPerSecond() ? mDriftNanosPerSecond : null, - "DriftUncertaintyNanosPerSecond", - hasDriftUncertaintyNanosPerSecond() ? mDriftUncertaintyNanosPerSecond : null)); + if (hasDriftNanosPerSecond() || hasDriftUncertaintyNanosPerSecond()) { + builder.append(String.format( + formatWithUncertainty, + "DriftNanosPerSecond", + hasDriftNanosPerSecond() ? mDriftNanosPerSecond : null, + "DriftUncertaintyNanosPerSecond", + hasDriftUncertaintyNanosPerSecond() ? mDriftUncertaintyNanosPerSecond : null)); + } builder.append(String.format( format, "HardwareClockDiscontinuityCount", mHardwareClockDiscontinuityCount)); - builder.append(String.format( - format, - "ElapsedRealtimeNanos", - hasElapsedRealtimeNanos() ? mElapsedRealtimeNanos : null)); + if (hasElapsedRealtimeNanos() || hasElapsedRealtimeUncertaintyNanos()) { + builder.append(String.format( + formatWithUncertainty, + "ElapsedRealtimeNanos", + hasElapsedRealtimeNanos() ? mElapsedRealtimeNanos : null, + "ElapsedRealtimeUncertaintyNanos", + hasElapsedRealtimeUncertaintyNanos() ? mElapsedRealtimeUncertaintyNanos + : null)); + } - builder.append(String.format( - format, - "ElapsedRealtimeUncertaintyNanos", - hasElapsedRealtimeUncertaintyNanos() ? mElapsedRealtimeUncertaintyNanos : null)); + if (hasReferenceConstellationTypeForIsb()) { + builder.append(String.format(format, "ReferenceConstellationTypeForIsb", + mReferenceConstellationTypeForIsb)); + } + + if (hasReferenceCarrierFrequencyHzForIsb()) { + builder.append(String.format(format, "ReferenceCarrierFrequencyHzForIsb", + mReferenceCarrierFrequencyHzForIsb)); + } + + if (hasReferenceCodeTypeForIsb()) { + builder.append( + String.format(format, "ReferenceCodeTypeForIsb", mReferenceCodeTypeForIsb)); + } return builder.toString(); } @@ -639,6 +791,9 @@ public final class GnssClock implements Parcelable { setHardwareClockDiscontinuityCount(Integer.MIN_VALUE); resetElapsedRealtimeNanos(); resetElapsedRealtimeUncertaintyNanos(); + resetReferenceConstellationTypeForIsb(); + resetReferenceCarrierFrequencyHzForIsb(); + resetReferenceCodeTypeForIsb(); } private void setFlag(int flag) { diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java index 3eeb3a2051e9..83a8995bee13 100644 --- a/location/java/android/location/GnssMeasurement.java +++ b/location/java/android/location/GnssMeasurement.java @@ -16,11 +16,21 @@ package android.location; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_AUTOMATIC_GAIN_CONTROL; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_CYCLES; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_FREQUENCY; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_PHASE; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_PHASE_UNCERTAINTY; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_RECEIVER_ISB; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_RECEIVER_ISB_UNCERTAINTY; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_SATELLITE_ISB; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_SATELLITE_ISB_UNCERTAINTY; +import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_SNR; + import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.TestApi; -import android.hardware.gnss.V1_0.IGnssMeasurementCallback.GnssMeasurementFlags; import android.os.Parcel; import android.os.Parcelable; @@ -53,19 +63,14 @@ public final class GnssMeasurement implements Parcelable { private double mSnrInDb; private double mAutomaticGainControlLevelInDb; @NonNull private String mCodeType; + private double mReceiverInterSignalBiasNanos; + private double mReceiverInterSignalBiasUncertaintyNanos; + private double mSatelliteInterSignalBiasNanos; + private double mSatelliteInterSignalBiasUncertaintyNanos; // The following enumerations must be in sync with the values declared in GNSS HAL. private static final int HAS_NO_FLAGS = 0; - private static final int HAS_SNR = GnssMeasurementFlags.HAS_SNR; - private static final int HAS_CARRIER_FREQUENCY = GnssMeasurementFlags.HAS_CARRIER_FREQUENCY; - private static final int HAS_CARRIER_CYCLES = GnssMeasurementFlags.HAS_CARRIER_CYCLES; - private static final int HAS_CARRIER_PHASE = GnssMeasurementFlags.HAS_CARRIER_PHASE; - private static final int HAS_CARRIER_PHASE_UNCERTAINTY = - GnssMeasurementFlags.HAS_CARRIER_PHASE_UNCERTAINTY; - private static final int HAS_AUTOMATIC_GAIN_CONTROL = - GnssMeasurementFlags.HAS_AUTOMATIC_GAIN_CONTROL; - private static final int HAS_CODE_TYPE = (1 << 14); private static final int HAS_BASEBAND_CN0 = (1 << 15); @@ -263,6 +268,12 @@ public final class GnssMeasurement implements Parcelable { mSnrInDb = measurement.mSnrInDb; mAutomaticGainControlLevelInDb = measurement.mAutomaticGainControlLevelInDb; mCodeType = measurement.mCodeType; + mReceiverInterSignalBiasNanos = measurement.mReceiverInterSignalBiasNanos; + mReceiverInterSignalBiasUncertaintyNanos = + measurement.mReceiverInterSignalBiasUncertaintyNanos; + mSatelliteInterSignalBiasNanos = measurement.mSatelliteInterSignalBiasNanos; + mSatelliteInterSignalBiasUncertaintyNanos = + measurement.mSatelliteInterSignalBiasUncertaintyNanos; } /** @@ -838,7 +849,6 @@ public final class GnssMeasurement implements Parcelable { @TestApi public void resetBasebandCn0DbHz() { resetFlag(HAS_BASEBAND_CN0); - mBasebandCn0DbHz = Double.NaN; } /** @@ -1169,7 +1179,6 @@ public final class GnssMeasurement implements Parcelable { @Deprecated public void resetCarrierPhase() { resetFlag(HAS_CARRIER_PHASE); - mCarrierPhase = Double.NaN; } /** @@ -1224,7 +1233,6 @@ public final class GnssMeasurement implements Parcelable { @Deprecated public void resetCarrierPhaseUncertainty() { resetFlag(HAS_CARRIER_PHASE_UNCERTAINTY); - mCarrierPhaseUncertainty = Double.NaN; } /** @@ -1295,7 +1303,6 @@ public final class GnssMeasurement implements Parcelable { @TestApi public void resetSnrInDb() { resetFlag(HAS_SNR); - mSnrInDb = Double.NaN; } /** @@ -1343,7 +1350,6 @@ public final class GnssMeasurement implements Parcelable { @TestApi public void resetAutomaticGainControlLevel() { resetFlag(HAS_AUTOMATIC_GAIN_CONTROL); - mAutomaticGainControlLevelInDb = Double.NaN; } /** @@ -1428,7 +1434,200 @@ public final class GnssMeasurement implements Parcelable { mCodeType = "UNKNOWN"; } - public static final @android.annotation.NonNull Creator<GnssMeasurement> CREATOR = new Creator<GnssMeasurement>() { + /** + * Returns {@code true} if {@link #getReceiverInterSignalBiasNanos()} is available, + * {@code false} otherwise. + */ + public boolean hasReceiverInterSignalBiasNanos() { + return isFlagSet(HAS_RECEIVER_ISB); + } + + /** + * Gets the GNSS measurement's receiver inter-signal bias in nanoseconds with sub-nanosecond + * accuracy. + * + * <p>This value is the estimated receiver-side inter-system (different from the + * constellation in {@link GnssClock#getReferenceConstellationTypeForIsb()} bias and + * inter-frequency (different from the carrier frequency in + * {@link GnssClock#getReferenceCarrierFrequencyHzForIsb()}) bias. The reported receiver + * inter-signal bias must include signal delays caused by: + * + * <ul> + * <li>Receiver inter-constellation bias</li> + * <li>Receiver inter-frequency bias</li> + * <li>Receiver inter-code bias</li> + * </ul> + * + * <p>The value does not include the inter-frequency Ionospheric bias. + * + * <p>The value is only available if {@link #hasReceiverInterSignalBiasNanos()} is {@code true}. + */ + public double getReceiverInterSignalBiasNanos() { + return mReceiverInterSignalBiasNanos; + } + + /** + * Sets the GNSS measurement's receiver inter-signal bias in nanoseconds. + * + * @hide + */ + @TestApi + public void setReceiverInterSignalBiasNanos(double receiverInterSignalBiasNanos) { + setFlag(HAS_RECEIVER_ISB); + mReceiverInterSignalBiasNanos = receiverInterSignalBiasNanos; + } + + /** + * Resets the GNSS measurement's receiver inter-signal bias in nanoseconds. + * + * @hide + */ + @TestApi + public void resetReceiverInterSignalBiasNanos() { + resetFlag(HAS_RECEIVER_ISB); + } + + /** + * Returns {@code true} if {@link #getReceiverInterSignalBiasUncertaintyNanos()} is available, + * {@code false} otherwise. + */ + public boolean hasReceiverInterSignalBiasUncertaintyNanos() { + return isFlagSet(HAS_RECEIVER_ISB_UNCERTAINTY); + } + + /** + * Gets the GNSS measurement's receiver inter-signal bias uncertainty (1 sigma) in + * nanoseconds with sub-nanosecond accuracy. + * + * <p>The value is only available if {@link #hasReceiverInterSignalBiasUncertaintyNanos()} is + * {@code true}. + */ + @FloatRange(from = 0.0) + public double getReceiverInterSignalBiasUncertaintyNanos() { + return mReceiverInterSignalBiasUncertaintyNanos; + } + + /** + * Sets the GNSS measurement's receiver inter-signal bias uncertainty (1 sigma) in nanoseconds. + * + * @hide + */ + @TestApi + public void setReceiverInterSignalBiasUncertaintyNanos(@FloatRange(from = 0.0) + double receiverInterSignalBiasUncertaintyNanos) { + setFlag(HAS_RECEIVER_ISB_UNCERTAINTY); + mReceiverInterSignalBiasUncertaintyNanos = receiverInterSignalBiasUncertaintyNanos; + } + + /** + * Resets the GNSS measurement's receiver inter-signal bias uncertainty (1 sigma) in + * nanoseconds. + * + * @hide + */ + @TestApi + public void resetReceiverInterSignalBiasUncertaintyNanos() { + resetFlag(HAS_RECEIVER_ISB_UNCERTAINTY); + } + + /** + * Returns {@code true} if {@link #getSatelliteInterSignalBiasNanos()} is available, + * {@code false} otherwise. + */ + public boolean hasSatelliteInterSignalBiasNanos() { + return isFlagSet(HAS_SATELLITE_ISB); + } + + /** + * Gets the GNSS measurement's satellite inter-signal bias in nanoseconds with sub-nanosecond + * accuracy. + * + * <p>This value is the satellite-and-control-segment-side inter-system (different from the + * constellation in {@link GnssClock#getReferenceConstellationTypeForIsb()}) bias and + * inter-frequency (different from the carrier frequency in + * {@link GnssClock#getReferenceCarrierFrequencyHzForIsb()}) bias, including: + * + * <ul> + * <li>Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPT-UTC Time Offset (TauGps), + * BDS-GLO Time Offset (BGTO))</li> + * <li>Group delay (e.g., Total Group Delay (TGD))</li> + * <li>Satellite inter-signal bias, which includes satellite inter-frequency bias (GLO only), + * and satellite inter-code bias (e.g., Differential Code Bias (DCB)).</li> + * </ul> + * + * <p>The value is only available if {@link #hasSatelliteInterSignalBiasNanos()} is {@code + * true}. + */ + public double getSatelliteInterSignalBiasNanos() { + return mSatelliteInterSignalBiasNanos; + } + + /** + * Sets the GNSS measurement's satellite inter-signal bias in nanoseconds. + * + * @hide + */ + @TestApi + public void setSatelliteInterSignalBiasNanos(double satelliteInterSignalBiasNanos) { + setFlag(HAS_SATELLITE_ISB); + mSatelliteInterSignalBiasNanos = satelliteInterSignalBiasNanos; + } + + /** + * Resets the GNSS measurement's satellite inter-signal bias in nanoseconds. + * + * @hide + */ + @TestApi + public void resetSatelliteInterSignalBiasNanos() { + resetFlag(HAS_SATELLITE_ISB); + } + + /** + * Returns {@code true} if {@link #getSatelliteInterSignalBiasUncertaintyNanos()} is available, + * {@code false} otherwise. + */ + public boolean hasSatelliteInterSignalBiasUncertaintyNanos() { + return isFlagSet(HAS_SATELLITE_ISB_UNCERTAINTY); + } + + /** + * Gets the GNSS measurement's satellite inter-signal bias uncertainty (1 sigma) in + * nanoseconds with sub-nanosecond accuracy. + * + * <p>The value is only available if {@link #hasSatelliteInterSignalBiasUncertaintyNanos()} is + * {@code true}. + */ + @FloatRange(from = 0.0) + public double getSatelliteInterSignalBiasUncertaintyNanos() { + return mSatelliteInterSignalBiasUncertaintyNanos; + } + + /** + * Sets the GNSS measurement's satellite inter-signal bias uncertainty (1 sigma) in nanoseconds. + * + * @hide + */ + @TestApi + public void setSatelliteInterSignalBiasUncertaintyNanos(@FloatRange(from = 0.0) + double satelliteInterSignalBiasUncertaintyNanos) { + setFlag(HAS_SATELLITE_ISB_UNCERTAINTY); + mSatelliteInterSignalBiasUncertaintyNanos = satelliteInterSignalBiasUncertaintyNanos; + } + + /** + * Resets the GNSS measurement's satellite inter-signal bias uncertainty (1 sigma) in + * nanoseconds. + * + * @hide + */ + @TestApi + public void resetSatelliteInterSignalBiasUncertaintyNanos() { + resetFlag(HAS_SATELLITE_ISB_UNCERTAINTY); + } + + + public static final @NonNull Creator<GnssMeasurement> CREATOR = new Creator<GnssMeasurement>() { @Override public GnssMeasurement createFromParcel(Parcel parcel) { GnssMeasurement gnssMeasurement = new GnssMeasurement(); @@ -1455,6 +1654,10 @@ public final class GnssMeasurement implements Parcelable { gnssMeasurement.mAutomaticGainControlLevelInDb = parcel.readDouble(); gnssMeasurement.mCodeType = parcel.readString(); gnssMeasurement.mBasebandCn0DbHz = parcel.readDouble(); + gnssMeasurement.mReceiverInterSignalBiasNanos = parcel.readDouble(); + gnssMeasurement.mReceiverInterSignalBiasUncertaintyNanos = parcel.readDouble(); + gnssMeasurement.mSatelliteInterSignalBiasNanos = parcel.readDouble(); + gnssMeasurement.mSatelliteInterSignalBiasUncertaintyNanos = parcel.readDouble(); return gnssMeasurement; } @@ -1489,6 +1692,10 @@ public final class GnssMeasurement implements Parcelable { parcel.writeDouble(mAutomaticGainControlLevelInDb); parcel.writeString(mCodeType); parcel.writeDouble(mBasebandCn0DbHz); + parcel.writeDouble(mReceiverInterSignalBiasNanos); + parcel.writeDouble(mReceiverInterSignalBiasUncertaintyNanos); + parcel.writeDouble(mSatelliteInterSignalBiasNanos); + parcel.writeDouble(mSatelliteInterSignalBiasUncertaintyNanos); } @Override @@ -1517,8 +1724,9 @@ public final class GnssMeasurement implements Parcelable { builder.append(String.format(format, "Cn0DbHz", mCn0DbHz)); - builder.append(String.format(format, "BasebandCn0DbHz", - hasBasebandCn0DbHz() ? mBasebandCn0DbHz : null)); + if (hasBasebandCn0DbHz()) { + builder.append(String.format(format, "BasebandCn0DbHz", mBasebandCn0DbHz)); + } builder.append(String.format( formatWithUncertainty, @@ -1539,37 +1747,57 @@ public final class GnssMeasurement implements Parcelable { "AccumulatedDeltaRangeUncertaintyMeters", mAccumulatedDeltaRangeUncertaintyMeters)); - builder.append(String.format( - format, - "CarrierFrequencyHz", - hasCarrierFrequencyHz() ? mCarrierFrequencyHz : null)); + if (hasCarrierFrequencyHz()) { + builder.append(String.format(format, "CarrierFrequencyHz", mCarrierFrequencyHz)); + } - builder.append(String.format( - format, - "CarrierCycles", - hasCarrierCycles() ? mCarrierCycles : null)); + if (hasCarrierCycles()) { + builder.append(String.format(format, "CarrierCycles", mCarrierCycles)); + } - builder.append(String.format( - formatWithUncertainty, - "CarrierPhase", - hasCarrierPhase() ? mCarrierPhase : null, - "CarrierPhaseUncertainty", - hasCarrierPhaseUncertainty() ? mCarrierPhaseUncertainty : null)); + if (hasCarrierPhase() || hasCarrierPhaseUncertainty()) { + builder.append(String.format( + formatWithUncertainty, + "CarrierPhase", + hasCarrierPhase() ? mCarrierPhase : null, + "CarrierPhaseUncertainty", + hasCarrierPhaseUncertainty() ? mCarrierPhaseUncertainty : null)); + } builder.append(String.format(format, "MultipathIndicator", getMultipathIndicatorString())); - builder.append(String.format( - format, - "SnrInDb", - hasSnrInDb() ? mSnrInDb : null)); - builder.append(String.format( - format, - "AgcLevelDb", - hasAutomaticGainControlLevelDb() ? mAutomaticGainControlLevelInDb : null)); - builder.append(String.format( - format, - "CodeType", - hasCodeType() ? mCodeType : null)); + if (hasSnrInDb()) { + builder.append(String.format(format, "SnrInDb", mSnrInDb)); + } + + if (hasAutomaticGainControlLevelDb()) { + builder.append(String.format(format, "AgcLevelDb", mAutomaticGainControlLevelInDb)); + } + + if (hasCodeType()) { + builder.append(String.format(format, "CodeType", mCodeType)); + } + + if (hasReceiverInterSignalBiasNanos() || hasReceiverInterSignalBiasUncertaintyNanos()) { + builder.append(String.format( + formatWithUncertainty, + "ReceiverInterSignalBiasNs", + hasReceiverInterSignalBiasNanos() ? mReceiverInterSignalBiasNanos : null, + "ReceiverInterSignalBiasUncertaintyNs", + hasReceiverInterSignalBiasUncertaintyNanos() + ? mReceiverInterSignalBiasUncertaintyNanos : null)); + } + + if (hasSatelliteInterSignalBiasNanos() || hasSatelliteInterSignalBiasUncertaintyNanos()) { + builder.append(String.format( + formatWithUncertainty, + "SatelliteInterSignalBiasNs", + hasSatelliteInterSignalBiasNanos() ? mSatelliteInterSignalBiasNanos : null, + "SatelliteInterSignalBiasUncertaintyNs", + hasSatelliteInterSignalBiasUncertaintyNanos() + ? mSatelliteInterSignalBiasUncertaintyNanos + : null)); + } return builder.toString(); } @@ -1596,6 +1824,10 @@ public final class GnssMeasurement implements Parcelable { resetAutomaticGainControlLevel(); resetCodeType(); resetBasebandCn0DbHz(); + resetReceiverInterSignalBiasNanos(); + resetReceiverInterSignalBiasUncertaintyNanos(); + resetSatelliteInterSignalBiasNanos(); + resetSatelliteInterSignalBiasUncertaintyNanos(); } private void setFlag(int flag) { diff --git a/location/java/android/location/GnssStatus.java b/location/java/android/location/GnssStatus.java index 89a3bc070578..f17fa399dace 100644 --- a/location/java/android/location/GnssStatus.java +++ b/location/java/android/location/GnssStatus.java @@ -189,6 +189,7 @@ public final class GnssStatus { * <li>QZSS: 193-200</li> * <li>Galileo: 1-36</li> * <li>Beidou: 1-37</li> + * <li>IRNSS: 1-14</li> * </ul> * * @param satelliteIndex An index from zero to {@link #getSatelliteCount()} - 1 diff --git a/media/java/android/media/audiofx/AudioEffect.java b/media/java/android/media/audiofx/AudioEffect.java index cad5aa6aaa3c..c25a5333017b 100644 --- a/media/java/android/media/audiofx/AudioEffect.java +++ b/media/java/android/media/audiofx/AudioEffect.java @@ -356,10 +356,14 @@ public class AudioEffect { public static final String EFFECT_AUXILIARY = "Auxiliary"; /** * Effect connection mode is pre processing. - * The audio pre processing effects are attached to an audio input (AudioRecord). - * @hide + * The audio pre processing effects are attached to an audio input stream or device */ public static final String EFFECT_PRE_PROCESSING = "Pre Processing"; + /** + * Effect connection mode is post processing. + * The audio post processing effects are attached to an audio output stream or device + */ + public static final String EFFECT_POST_PROCESSING = "Post Processing"; // -------------------------------------------------------------------------- // Member variables diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java index f979fddd7bda..c529952843a1 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java @@ -311,6 +311,12 @@ public class CameraBinderTest extends AndroidTestCase { cameraId, status)); } @Override + public void onPhysicalCameraStatusChanged(int status, String cameraId, + String physicalCameraId) throws RemoteException { + Log.v(TAG, String.format("Camera %s : %s has status changed to 0x%x", + cameraId, physicalCameraId, status)); + } + @Override public void onCameraAccessPrioritiesChanged() { Log.v(TAG, "Camera access permission change"); } diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt index 203adfc749d2..97b861b390ad 100644 --- a/native/android/libandroid.map.txt +++ b/native/android/libandroid.map.txt @@ -240,6 +240,7 @@ LIBANDROID { ASurfaceTransaction_setColor; # introduced=29 ASurfaceTransaction_setDamageRegion; # introduced=29 ASurfaceTransaction_setDesiredPresentTime; # introduced=29 + ASurfaceTransaction_setFrameRate; # introduced=30 ASurfaceTransaction_setGeometry; # introduced=29 ASurfaceTransaction_setHdrMetadata_cta861_3; # introduced=29 ASurfaceTransaction_setHdrMetadata_smpte2086; # introduced=29 diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index b34b31ac8439..392c9f6404ba 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -545,3 +545,18 @@ void ASurfaceTransaction_setColor(ASurfaceTransaction* aSurfaceTransaction, transaction->setBackgroundColor(surfaceControl, color, alpha, static_cast<ui::Dataspace>(dataspace)); } + +void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* aSurfaceTransaction, + ASurfaceControl* aSurfaceControl, float frameRate) { + CHECK_NOT_NULL(aSurfaceTransaction); + CHECK_NOT_NULL(aSurfaceControl); + + sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl); + if (frameRate < 0) { + ALOGE("Failed to set frame ate - invalid frame rate"); + return; + } + + Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction); + transaction->setFrameRate(surfaceControl, frameRate); +} diff --git a/native/graphics/jni/imagedecoder.cpp b/native/graphics/jni/imagedecoder.cpp index 1c45ea6aaecc..79bcc15e1f0f 100644 --- a/native/graphics/jni/imagedecoder.cpp +++ b/native/graphics/jni/imagedecoder.cpp @@ -208,13 +208,6 @@ const char* AImageDecoderHeaderInfo_getMimeType(const AImageDecoderHeaderInfo* i return getMimeType(toDecoder(info)->mCodec->getEncodedFormat()); } -bool AImageDecoderHeaderInfo_isAnimated(const AImageDecoderHeaderInfo* info) { - if (!info) { - return false; - } - return toDecoder(info)->mCodec->codec()->getFrameCount() > 1; -} - int32_t AImageDecoderHeaderInfo_getDataSpace(const AImageDecoderHeaderInfo* info) { if (!info) { return ANDROID_IMAGE_DECODER_BAD_PARAMETER; @@ -247,8 +240,7 @@ static AndroidBitmapFormat getFormat(SkColorType colorType) { } } -AndroidBitmapFormat AImageDecoderHeaderInfo_getAndroidBitmapFormat( - const AImageDecoderHeaderInfo* info) { +int32_t AImageDecoderHeaderInfo_getAndroidBitmapFormat(const AImageDecoderHeaderInfo* info) { if (!info) { return ANDROID_BITMAP_FORMAT_NONE; } @@ -281,7 +273,7 @@ int AImageDecoder_setUnpremultipliedRequired(AImageDecoder* decoder, bool requir ? ANDROID_IMAGE_DECODER_SUCCESS : ANDROID_IMAGE_DECODER_INVALID_CONVERSION; } -int AImageDecoder_setTargetSize(AImageDecoder* decoder, int width, int height) { +int AImageDecoder_setTargetSize(AImageDecoder* decoder, int32_t width, int32_t height) { if (!decoder) { return ANDROID_IMAGE_DECODER_BAD_PARAMETER; } @@ -291,7 +283,7 @@ int AImageDecoder_setTargetSize(AImageDecoder* decoder, int width, int height) { } int AImageDecoder_computeSampledSize(const AImageDecoder* decoder, int sampleSize, - int* width, int* height) { + int32_t* width, int32_t* height) { if (!decoder || !width || !height || sampleSize < 1) { return ANDROID_IMAGE_DECODER_BAD_PARAMETER; } diff --git a/native/graphics/jni/libjnigraphics.map.txt b/native/graphics/jni/libjnigraphics.map.txt index 1b396b893f4e..01c14770bebd 100644 --- a/native/graphics/jni/libjnigraphics.map.txt +++ b/native/graphics/jni/libjnigraphics.map.txt @@ -17,7 +17,6 @@ LIBJNIGRAPHICS { AImageDecoderHeaderInfo_getHeight; # introduced=30 AImageDecoderHeaderInfo_getMimeType; # introduced=30 AImageDecoderHeaderInfo_getAlphaFlags; # introduced=30 - AImageDecoderHeaderInfo_isAnimated; # introduced=30 AImageDecoderHeaderInfo_getAndroidBitmapFormat; # introduced=30 AImageDecoderHeaderInfo_getDataSpace; # introduced=30 AndroidBitmap_getInfo; diff --git a/opengl/java/com/google/android/gles_jni/EGLImpl.java b/opengl/java/com/google/android/gles_jni/EGLImpl.java index f94f69f0fd3f..b4ea0a6132a5 100644 --- a/opengl/java/com/google/android/gles_jni/EGLImpl.java +++ b/opengl/java/com/google/android/gles_jni/EGLImpl.java @@ -16,13 +16,12 @@ package com.google.android.gles_jni; +import android.compat.annotation.UnsupportedAppUsage; import android.graphics.SurfaceTexture; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; -import dalvik.annotation.compat.UnsupportedAppUsage; - import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java index 2a8d07f03148..3c808a6ada48 100644 --- a/opengl/java/com/google/android/gles_jni/GLImpl.java +++ b/opengl/java/com/google/android/gles_jni/GLImpl.java @@ -20,14 +20,13 @@ package com.google.android.gles_jni; import android.app.AppGlobals; +import android.compat.annotation.UnsupportedAppUsage; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.os.Build; import android.os.UserHandle; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.nio.Buffer; import javax.microedition.khronos.opengles.GL10; diff --git a/packages/CarSystemUI/res/layout/super_notification_shade.xml b/packages/CarSystemUI/res/layout/super_notification_shade.xml index 3fe1ea331a07..cb65045533f8 100644 --- a/packages/CarSystemUI/res/layout/super_notification_shade.xml +++ b/packages/CarSystemUI/res/layout/super_notification_shade.xml @@ -59,24 +59,6 @@ sysui:ignoreRightInset="true" /> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="@dimen/status_bar_height" - android:orientation="vertical" - > - <FrameLayout - android:id="@+id/status_bar_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:visibility="gone" - /> - - <FrameLayout - android:id="@+id/car_top_navigation_bar_container" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - </LinearLayout> - <include layout="@layout/brightness_mirror"/> <ViewStub android:id="@+id/fullscreen_user_switcher_stub" diff --git a/packages/CarSystemUI/res/layout/super_status_bar.xml b/packages/CarSystemUI/res/layout/super_status_bar.xml index c7b22f823ba4..d93f62f8809d 100644 --- a/packages/CarSystemUI/res/layout/super_status_bar.xml +++ b/packages/CarSystemUI/res/layout/super_status_bar.xml @@ -25,9 +25,22 @@ android:layout_height="match_parent" android:fitsSystemWindows="true"> - <FrameLayout - android:id="@+id/status_bar_container" + <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:orientation="vertical" + > + <FrameLayout + android:id="@+id/status_bar_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="gone" + /> + + <FrameLayout + android:id="@+id/car_top_navigation_bar_container" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + </LinearLayout> </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java index dc84935034bc..3a5201517af2 100644 --- a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java @@ -235,7 +235,7 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks private void buildNavBarWindows() { mTopNavigationBarWindow = mSuperStatusBarViewFactory - .getNotificationShadeWindowView() + .getStatusBarWindowView() .findViewById(R.id.car_top_navigation_bar_container); mBottomNavigationBarWindow = mCarNavigationBarController.getBottomWindow(); mLeftNavigationBarWindow = mCarNavigationBarController.getLeftWindow(); diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java index 2d7d59cc0022..4ebb1029ff04 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java @@ -199,8 +199,7 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt return; } if ((mWifiEntry.getSecurity() != WifiEntry.SECURITY_NONE) - && (mWifiEntry.getSecurity() != WifiEntry.SECURITY_OWE) - && (mWifiEntry.getSecurity() != WifiEntry.SECURITY_OWE_TRANSITION)) { + && (mWifiEntry.getSecurity() != WifiEntry.SECURITY_OWE)) { mFrictionSld.setState(STATE_SECURED); } else if (mWifiEntry.isMetered()) { mFrictionSld.setState(STATE_METERED); diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index f51cd83bb2d1..58a6c17e8239 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -92,7 +92,6 @@ import android.util.Log; import android.util.SparseBooleanArray; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.telephony.TelephonyIntents; import com.android.internal.widget.LockPatternUtils; import com.android.settingslib.WirelessUtils; import com.android.systemui.DejankUtils; @@ -1083,7 +1082,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab MSG_BATTERY_UPDATE, new BatteryStatus(status, level, plugged, health, maxChargingMicroWatt)); mHandler.sendMessage(msg); - } else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) { + } else if (Intent.ACTION_SIM_STATE_CHANGED.equals(action)) { SimData args = SimData.fromIntent(intent); // ACTION_SIM_STATE_CHANGED is rebroadcast after unlocking the device to // keep compatibility with apps that aren't direct boot aware. @@ -1122,7 +1121,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } mHandler.sendMessage( mHandler.obtainMessage(MSG_SERVICE_STATE_CHANGE, subId, 0, serviceState)); - } else if (TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED.equals(action)) { + } else if (TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED.equals(action)) { mHandler.sendEmptyMessage(MSG_SIM_SUBSCRIPTION_INFO_CHANGED); } else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED.equals( action)) { @@ -1273,7 +1272,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab static SimData fromIntent(Intent intent) { int state; - if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) { + if (!Intent.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) { throw new IllegalArgumentException("only handles intent ACTION_SIM_STATE_CHANGED"); } String stateExtra = intent.getStringExtra(Intent.EXTRA_SIM_STATE); @@ -1673,7 +1672,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab filter.addAction(Intent.ACTION_BATTERY_CHANGED); filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); - filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); + filter.addAction(Intent.ACTION_SIM_STATE_CHANGED); filter.addAction(Intent.ACTION_SERVICE_STATE); filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthCredentialPasswordView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthCredentialPasswordView.java index ccfd3a57811c..82c8a469a057 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthCredentialPasswordView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthCredentialPasswordView.java @@ -72,10 +72,10 @@ public class AuthCredentialPasswordView extends AuthCredentialView } // Wait a bit to focus the field so the focusable flag on the window is already set then. - post(() -> { + postDelayed(() -> { mPasswordField.requestFocus(); mImm.showSoftInput(mPasswordField, InputMethodManager.SHOW_IMPLICIT); - }); + }, 100); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java index e7055847f034..6e23777babd9 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java @@ -157,6 +157,7 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask PackageManager pm = c.getPackageManager(); ApplicationInfo appInfo; Drawable badgedIcon; + Drawable appIcon; try { appInfo = pm.getApplicationInfo( packageName, @@ -167,7 +168,7 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask if (appInfo != null) { info.appName = String.valueOf(pm.getApplicationLabel(appInfo)); } - Drawable appIcon = pm.getApplicationIcon(packageName); + appIcon = pm.getApplicationIcon(packageName); badgedIcon = pm.getUserBadgedIcon(appIcon, sbn.getUser()); } catch (PackageManager.NameNotFoundException exception) { // If we can't find package... don't think we should show the bubble. @@ -178,6 +179,11 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask // Badged bubble image Drawable bubbleDrawable = iconFactory.getBubbleDrawable(c, info.shortcutInfo, b.getEntry().getBubbleMetadata()); + if (bubbleDrawable == null) { + // Default to app icon + bubbleDrawable = appIcon; + } + BitmapInfo badgeBitmapInfo = iconFactory.getBadgeBitmap(badgedIcon); info.badgedBubbleImage = iconFactory.getBubbleBitmap(bubbleDrawable, badgeBitmapInfo).icon; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java index ac05c53c38dd..6839921e90a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java @@ -56,7 +56,7 @@ public class FeatureFlags { } public boolean isNewNotifPipelineEnabled() { - return getDeviceConfigFlag("notification.newpipeline.enabled", false); + return getDeviceConfigFlag("notification.newpipeline.enabled", true); } public boolean isNewNotifPipelineRenderingEnabled() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinator.java index da119c1502c6..854444fc8bb7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinator.java @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.collection.coordinator; import android.app.Notification; -import android.os.Handler; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.util.ArraySet; @@ -30,6 +29,8 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifLifetimeExtender; +import com.android.systemui.util.Assert; +import com.android.systemui.util.concurrency.DelayableExecutor; import java.util.HashMap; import java.util.Map; @@ -47,6 +48,8 @@ import javax.inject.Singleton; * frameworks/base/packages/SystemUI/src/com/android/systemui/ForegroundServiceController * frameworks/base/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener * frameworks/base/packages/SystemUI/src/com/android/systemui/ForegroundServiceLifetimeExtender + * + * TODO: AppOps stuff should be spun off into its own coordinator */ @Singleton public class ForegroundCoordinator implements Coordinator { @@ -54,7 +57,7 @@ public class ForegroundCoordinator implements Coordinator { private final ForegroundServiceController mForegroundServiceController; private final AppOpsController mAppOpsController; - private final Handler mMainHandler; + private final DelayableExecutor mMainExecutor; private NotifPipeline mNotifPipeline; @@ -62,10 +65,10 @@ public class ForegroundCoordinator implements Coordinator { public ForegroundCoordinator( ForegroundServiceController foregroundServiceController, AppOpsController appOpsController, - @Main Handler mainHandler) { + @Main DelayableExecutor mainExecutor) { mForegroundServiceController = foregroundServiceController; mAppOpsController = appOpsController; - mMainHandler = mainHandler; + mMainExecutor = mainExecutor; } @Override @@ -78,11 +81,11 @@ public class ForegroundCoordinator implements Coordinator { // listen for new notifications to add appOps mNotifPipeline.addCollectionListener(mNotifCollectionListener); - // when appOps change, update any relevant notifications to update appOps for - mAppOpsController.addCallback(ForegroundServiceController.APP_OPS, this::onAppOpsChanged); - // filter out foreground service notifications that aren't necessary anymore mNotifPipeline.addPreGroupFilter(mNotifFilter); + + // when appOps change, update any relevant notifications to update appOps for + mAppOpsController.addCallback(ForegroundServiceController.APP_OPS, this::onAppOpsChanged); } /** @@ -93,7 +96,8 @@ public class ForegroundCoordinator implements Coordinator { public boolean shouldFilterOut(NotificationEntry entry, long now) { StatusBarNotification sbn = entry.getSbn(); if (mForegroundServiceController.isDisclosureNotification(sbn) - && !mForegroundServiceController.isDisclosureNeededForUser(sbn.getUserId())) { + && !mForegroundServiceController.isDisclosureNeededForUser( + sbn.getUser().getIdentifier())) { return true; } @@ -102,7 +106,7 @@ public class ForegroundCoordinator implements Coordinator { Notification.EXTRA_FOREGROUND_APPS); if (apps != null && apps.length >= 1) { if (!mForegroundServiceController.isSystemAlertWarningNeeded( - sbn.getUserId(), apps[0])) { + sbn.getUser().getIdentifier(), apps[0])) { return true; } } @@ -119,7 +123,7 @@ public class ForegroundCoordinator implements Coordinator { new NotifLifetimeExtender() { private static final int MIN_FGS_TIME_MS = 5000; private OnEndLifetimeExtensionCallback mEndCallback; - private Map<String, Runnable> mEndRunnables = new HashMap<>(); + private Map<NotificationEntry, Runnable> mEndRunnables = new HashMap<>(); @Override public String getName() { @@ -142,16 +146,18 @@ public class ForegroundCoordinator implements Coordinator { final boolean extendLife = currTime - entry.getSbn().getPostTime() < MIN_FGS_TIME_MS; if (extendLife) { - if (!mEndRunnables.containsKey(entry.getKey())) { - final Runnable runnable = new Runnable() { - @Override - public void run() { - mEndCallback.onEndLifetimeExtension(mForegroundLifetimeExtender, entry); - } + if (!mEndRunnables.containsKey(entry)) { + final Runnable endExtensionRunnable = () -> { + mEndRunnables.remove(entry); + mEndCallback.onEndLifetimeExtension( + mForegroundLifetimeExtender, + entry); }; - mEndRunnables.put(entry.getKey(), runnable); - mMainHandler.postDelayed(runnable, + + final Runnable cancelRunnable = mMainExecutor.executeDelayed( + endExtensionRunnable, MIN_FGS_TIME_MS - (currTime - entry.getSbn().getPostTime())); + mEndRunnables.put(entry, cancelRunnable); } } @@ -160,9 +166,9 @@ public class ForegroundCoordinator implements Coordinator { @Override public void cancelLifetimeExtension(NotificationEntry entry) { - if (mEndRunnables.containsKey(entry.getKey())) { - Runnable endRunnable = mEndRunnables.remove(entry.getKey()); - mMainHandler.removeCallbacks(endRunnable); + Runnable cancelRunnable = mEndRunnables.remove(entry); + if (cancelRunnable != null) { + cancelRunnable.run(); } } }; @@ -184,25 +190,32 @@ public class ForegroundCoordinator implements Coordinator { private void tagForeground(NotificationEntry entry) { final StatusBarNotification sbn = entry.getSbn(); // note: requires that the ForegroundServiceController is updating their appOps first - ArraySet<Integer> activeOps = mForegroundServiceController.getAppOps(sbn.getUserId(), - sbn.getPackageName()); + ArraySet<Integer> activeOps = + mForegroundServiceController.getAppOps( + sbn.getUser().getIdentifier(), + sbn.getPackageName()); if (activeOps != null) { - synchronized (entry.mActiveAppOps) { - entry.mActiveAppOps.clear(); - entry.mActiveAppOps.addAll(activeOps); - } + entry.mActiveAppOps.clear(); + entry.mActiveAppOps.addAll(activeOps); } } }; + private void onAppOpsChanged(int code, int uid, String packageName, boolean active) { + mMainExecutor.execute(() -> handleAppOpsChanged(code, uid, packageName, active)); + } + /** * Update the appOp for the posted notification associated with the current foreground service + * * @param code code for appOp to add/remove * @param uid of user the notification is sent to * @param packageName package that created the notification * @param active whether the appOpCode is active or not */ - private void onAppOpsChanged(int code, int uid, String packageName, boolean active) { + private void handleAppOpsChanged(int code, int uid, String packageName, boolean active) { + Assert.isMainThread(); + int userId = UserHandle.getUserId(uid); // Update appOp if there's an associated posted notification: @@ -214,15 +227,13 @@ public class ForegroundCoordinator implements Coordinator { && uid == entry.getSbn().getUid() && packageName.equals(entry.getSbn().getPackageName())) { boolean changed; - synchronized (entry.mActiveAppOps) { - if (active) { - changed = entry.mActiveAppOps.add(code); - } else { - changed = entry.mActiveAppOps.remove(code); - } + if (active) { + changed = entry.mActiveAppOps.add(code); + } else { + changed = entry.mActiveAppOps.remove(code); } if (changed) { - mMainHandler.post(mNotifFilter::invalidateList); + mNotifFilter.invalidateList(); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index 7558022df96d..41d896856daa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -37,7 +37,6 @@ import android.telephony.TelephonyManager; import android.text.format.DateFormat; import android.util.Log; -import com.android.internal.telephony.TelephonyIntents; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.broadcast.BroadcastDispatcher; @@ -174,7 +173,7 @@ public class PhoneStatusBarPolicy filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION); filter.addAction(AudioManager.ACTION_HEADSET_PLUG); - filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); + filter.addAction(Intent.ACTION_SIM_STATE_CHANGED); filter.addAction(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED); filter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE); filter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE); @@ -614,7 +613,7 @@ public class PhoneStatusBarPolicy case AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION: updateVolumeZen(); break; - case TelephonyIntents.ACTION_SIM_STATE_CHANGED: + case Intent.ACTION_SIM_STATE_CHANGED: // Avoid rebroadcast because SysUI is direct boot aware. if (intent.getBooleanExtra(Intent.EXTRA_REBROADCAST_ON_UNLOCK, false)) { break; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 50052b8482f5..6dd113377ce7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -315,7 +315,7 @@ public class NetworkControllerImpl extends BroadcastReceiver filter.addAction(WifiManager.RSSI_CHANGED_ACTION); filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); - filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); + filter.addAction(Intent.ACTION_SIM_STATE_CHANGED); filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED); filter.addAction(TelephonyManager.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED); filter.addAction(Intent.ACTION_SERVICE_STATE); @@ -524,7 +524,7 @@ public class NetworkControllerImpl extends BroadcastReceiver mConfig = Config.readConfig(mContext); mReceiverHandler.post(this::handleConfigurationChanged); break; - case TelephonyIntents.ACTION_SIM_STATE_CHANGED: + case Intent.ACTION_SIM_STATE_CHANGED: // Avoid rebroadcast because SysUI is direct boot aware. if (intent.getBooleanExtra(Intent.EXTRA_REBROADCAST_ON_UNLOCK, false)) { break; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java index 6cc8dd908760..eb1af7c82324 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java @@ -16,20 +16,23 @@ package com.android.systemui.statusbar.notification.collection.coordinator; +import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.Notification; import android.os.Bundle; -import android.os.Handler; import android.os.UserHandle; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.testing.AndroidTestingRunner; +import android.testing.TestableLooper; +import android.util.ArraySet; import androidx.test.filters.SmallTest; @@ -41,36 +44,53 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifLifetimeExtender; +import com.android.systemui.util.Assert; +import com.android.systemui.util.concurrency.FakeExecutor; +import com.android.systemui.util.time.FakeSystemClock; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import java.util.List; + @SmallTest @RunWith(AndroidTestingRunner.class) +@TestableLooper.RunWithLooper public class ForegroundCoordinatorTest extends SysuiTestCase { private static final String TEST_PKG = "test_pkg"; private static final int NOTIF_USER_ID = 0; - @Mock private Handler mMainHandler; @Mock private ForegroundServiceController mForegroundServiceController; @Mock private AppOpsController mAppOpsController; @Mock private NotifPipeline mNotifPipeline; + @Captor private ArgumentCaptor<AppOpsController.Callback> mAppOpsCaptor; + private NotificationEntry mEntry; private Notification mNotification; private ForegroundCoordinator mForegroundCoordinator; private NotifFilter mForegroundFilter; + private AppOpsController.Callback mAppOpsCallback; private NotifLifetimeExtender mForegroundNotifLifetimeExtender; + private FakeSystemClock mClock = new FakeSystemClock(); + private FakeExecutor mExecutor = new FakeExecutor(mClock); + @Before public void setup() { MockitoAnnotations.initMocks(this); - mForegroundCoordinator = new ForegroundCoordinator( - mForegroundServiceController, mAppOpsController, mMainHandler); + Assert.sMainLooper = TestableLooper.get(this).getLooper(); + + mForegroundCoordinator = + new ForegroundCoordinator( + mForegroundServiceController, + mAppOpsController, + mExecutor); mNotification = new Notification(); mEntry = new NotificationEntryBuilder() @@ -86,9 +106,11 @@ public class ForegroundCoordinatorTest extends SysuiTestCase { verify(mNotifPipeline, times(1)).addPreGroupFilter(filterCaptor.capture()); verify(mNotifPipeline, times(1)).addNotificationLifetimeExtender( lifetimeExtenderCaptor.capture()); + verify(mAppOpsController).addCallback(any(int[].class), mAppOpsCaptor.capture()); mForegroundFilter = filterCaptor.getValue(); mForegroundNotifLifetimeExtender = lifetimeExtenderCaptor.getValue(); + mAppOpsCallback = mAppOpsCaptor.getValue(); } @Test @@ -183,4 +205,74 @@ public class ForegroundCoordinatorTest extends SysuiTestCase { assertFalse(mForegroundNotifLifetimeExtender .shouldExtendLifetime(mEntry, NotificationListenerService.REASON_CLICK)); } + + @Test + public void testAppOpsAreApplied() { + // GIVEN Three current notifications, two with the same key but from different users + NotificationEntry entry1 = new NotificationEntryBuilder() + .setUser(new UserHandle(NOTIF_USER_ID)) + .setPkg(TEST_PKG) + .setId(1) + .build(); + NotificationEntry entry2 = new NotificationEntryBuilder() + .setUser(new UserHandle(NOTIF_USER_ID)) + .setPkg(TEST_PKG) + .setId(2) + .build(); + NotificationEntry entry2Other = new NotificationEntryBuilder() + .setUser(new UserHandle(NOTIF_USER_ID + 1)) + .setPkg(TEST_PKG) + .setId(2) + .build(); + when(mNotifPipeline.getActiveNotifs()).thenReturn(List.of(entry1, entry2, entry2Other)); + + // GIVEN that entry2 is currently associated with a foreground service + when(mForegroundServiceController.getStandardLayoutKey(0, TEST_PKG)) + .thenReturn(entry2.getKey()); + + // WHEN a new app ops code comes in + mAppOpsCallback.onActiveStateChanged(47, NOTIF_USER_ID, TEST_PKG, true); + mExecutor.runAllReady(); + + // THEN entry2's app ops are updated, but no one else's are + assertEquals( + new ArraySet<>(), + entry1.mActiveAppOps); + assertEquals( + new ArraySet<>(List.of(47)), + entry2.mActiveAppOps); + assertEquals( + new ArraySet<>(), + entry2Other.mActiveAppOps); + } + + @Test + public void testAppOpsAreRemoved() { + // GIVEN One notification which is associated with app ops + NotificationEntry entry = new NotificationEntryBuilder() + .setUser(new UserHandle(NOTIF_USER_ID)) + .setPkg(TEST_PKG) + .setId(2) + .build(); + when(mNotifPipeline.getActiveNotifs()).thenReturn(List.of(entry)); + when(mForegroundServiceController.getStandardLayoutKey(0, TEST_PKG)) + .thenReturn(entry.getKey()); + + // GIVEN that the notification's app ops are already [47, 33] + mAppOpsCallback.onActiveStateChanged(47, NOTIF_USER_ID, TEST_PKG, true); + mAppOpsCallback.onActiveStateChanged(33, NOTIF_USER_ID, TEST_PKG, true); + mExecutor.runAllReady(); + assertEquals( + new ArraySet<>(List.of(47, 33)), + entry.mActiveAppOps); + + // WHEN one of the app ops is removed + mAppOpsCallback.onActiveStateChanged(47, NOTIF_USER_ID, TEST_PKG, false); + mExecutor.runAllReady(); + + // THEN the entry's active app ops are updated as well + assertEquals( + new ArraySet<>(List.of(33)), + entry.mActiveAppOps); + } } diff --git a/services/autofill/java/com/android/server/autofill/InlineSuggestionFactory.java b/services/autofill/java/com/android/server/autofill/InlineSuggestionFactory.java index 5e6f97e4f282..331eb3748715 100644 --- a/services/autofill/java/com/android/server/autofill/InlineSuggestionFactory.java +++ b/services/autofill/java/com/android/server/autofill/InlineSuggestionFactory.java @@ -20,7 +20,6 @@ import static com.android.server.autofill.Helper.sDebug; import android.annotation.NonNull; import android.annotation.Nullable; -import android.app.slice.Slice; import android.content.Context; import android.os.RemoteException; import android.service.autofill.Dataset; @@ -132,7 +131,7 @@ public final class InlineSuggestionFactory { } }; final InlineSuggestion inlineSuggestion = new InlineSuggestion(inlineSuggestionInfo, - createInlineContentProvider(inlinePresentation.getSlice(), inlineSuggestionUi, + createInlineContentProvider(inlinePresentation, inlineSuggestionUi, onClickListener)); return inlineSuggestion; } @@ -151,20 +150,22 @@ public final class InlineSuggestionFactory { client.fill(requestId, fieldIndex, dataset); }; final InlineSuggestion inlineSuggestion = new InlineSuggestion(inlineSuggestionInfo, - createInlineContentProvider(inlinePresentation.getSlice(), inlineSuggestionUi, + createInlineContentProvider(inlinePresentation, inlineSuggestionUi, onClickListener)); return inlineSuggestion; } private static IInlineContentProvider.Stub createInlineContentProvider( - @NonNull Slice slice, @NonNull InlineSuggestionUi inlineSuggestionUi, + @NonNull InlinePresentation inlinePresentation, + @NonNull InlineSuggestionUi inlineSuggestionUi, @Nullable View.OnClickListener onClickListener) { return new IInlineContentProvider.Stub() { @Override public void provideContent(int width, int height, IInlineContentCallback callback) { UiThread.getHandler().post(() -> { - SurfaceControl sc = inlineSuggestionUi.inflate(slice, width, height, + SurfaceControl sc = inlineSuggestionUi.inflate(inlinePresentation, width, + height, onClickListener); try { callback.onContent(sc); diff --git a/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionUi.java b/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionUi.java index 2460732d17dc..2adefeabfcc8 100644 --- a/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionUi.java +++ b/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionUi.java @@ -25,10 +25,17 @@ import android.annotation.Nullable; import android.app.slice.Slice; import android.app.slice.SliceItem; import android.content.Context; +import android.content.pm.PackageManager; +import android.content.res.Resources; +import android.content.res.TypedArray; import android.graphics.PixelFormat; import android.graphics.drawable.Icon; +import android.graphics.fonts.SystemFonts; import android.os.IBinder; +import android.service.autofill.InlinePresentation; +import android.text.TextUtils; import android.util.Log; +import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; @@ -41,6 +48,8 @@ import android.widget.TextView; import com.android.internal.R; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * This is a temporary inline suggestion UI inflater which will be replaced by the ExtServices @@ -54,6 +63,10 @@ public class InlineSuggestionUi { private static final String TAG = "InlineSuggestionUi"; + // The pattern to match the value can be obtained by calling {@code Resources#getResourceName + // (int)}. This name is a single string of the form "package:type/entry". + private static final Pattern RESOURCE_NAME_PATTERN = Pattern.compile("([^:]+):([^/]+)/(\\S+)"); + private final Context mContext; public InlineSuggestionUi(Context context) { @@ -65,28 +78,36 @@ public class InlineSuggestionUi { */ @MainThread @Nullable - public SurfaceControl inflate(@NonNull Slice slice, int width, int height, - @Nullable View.OnClickListener onClickListener) { + public SurfaceControl inflate(@NonNull InlinePresentation inlinePresentation, int width, + int height, @Nullable View.OnClickListener onClickListener) { Log.d(TAG, "Inflating the inline suggestion UI"); //TODO(b/137800469): Pass in inputToken from IME. final SurfaceControlViewHost wvr = new SurfaceControlViewHost(mContext, mContext.getDisplay(), (IBinder) null); final SurfaceControl sc = wvr.getSurfacePackage().getSurfaceControl(); - final ViewGroup suggestionView = (ViewGroup) renderSlice(slice); + + Context contextThemeWrapper = getContextThemeWrapper(mContext, + inlinePresentation.getInlinePresentationSpec().getStyle()); + if (contextThemeWrapper == null) { + contextThemeWrapper = getDefaultContextThemeWrapper(mContext); + } + final View suggestionView = renderSlice(inlinePresentation.getSlice(), + contextThemeWrapper); if (onClickListener != null) { suggestionView.setOnClickListener(onClickListener); } WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height, - WindowManager.LayoutParams.TYPE_APPLICATION, 0, PixelFormat.TRANSPARENT); + WindowManager.LayoutParams.TYPE_APPLICATION, 0, + PixelFormat.TRANSPARENT); wvr.addView(suggestionView, lp); return sc; } - private View renderSlice(Slice slice) { - final LayoutInflater inflater = LayoutInflater.from(mContext); + private static View renderSlice(Slice slice, Context context) { + final LayoutInflater inflater = LayoutInflater.from(context); final ViewGroup suggestionView = (ViewGroup) inflater.inflate(R.layout.autofill_inline_suggestion, null); @@ -137,4 +158,96 @@ public class InlineSuggestionUi { return suggestionView; } + + private Context getDefaultContextThemeWrapper(@NonNull Context context) { + Resources.Theme theme = context.getResources().newTheme(); + theme.applyStyle(android.R.style.Theme_AutofillInlineSuggestion, true); + return new ContextThemeWrapper(context, theme); + } + + /** + * Returns a context wrapping the theme in the provided {@code style}, or null if {@code + * style} doesn't pass validation. + */ + @Nullable + private static Context getContextThemeWrapper(@NonNull Context context, + @Nullable String style) { + if (style == null) { + return null; + } + Matcher matcher = RESOURCE_NAME_PATTERN.matcher(style); + if (!matcher.matches()) { + Log.d(TAG, "Can not parse the style=" + style); + return null; + } + String packageName = matcher.group(1); + String type = matcher.group(2); + String entry = matcher.group(3); + if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(type) || TextUtils.isEmpty(entry)) { + Log.d(TAG, "Can not proceed with empty field values in the style=" + style); + return null; + } + Resources resources = null; + try { + resources = context.getPackageManager().getResourcesForApplication( + packageName); + } catch (PackageManager.NameNotFoundException e) { + return null; + } + int resId = resources.getIdentifier(entry, type, packageName); + if (resId == Resources.ID_NULL) { + return null; + } + Resources.Theme theme = resources.newTheme(); + theme.applyStyle(resId, true); + if (!validateBaseTheme(theme, resId)) { + Log.d(TAG, "Provided theme is not a child of Theme.InlineSuggestion, ignoring it."); + return null; + } + if (!validateFontFamilyForTextViewStyles(theme)) { + Log.d(TAG, + "Provided theme specifies a font family that is not system font, ignoring it."); + return null; + } + return new ContextThemeWrapper(context, theme); + } + + private static boolean validateFontFamilyForTextViewStyles(Resources.Theme theme) { + return validateFontFamily(theme, android.R.attr.autofillInlineSuggestionTitle) + && validateFontFamily(theme, android.R.attr.autofillInlineSuggestionSubtitle); + } + + private static boolean validateFontFamily(Resources.Theme theme, int styleAttr) { + TypedArray ta = null; + try { + ta = theme.obtainStyledAttributes(null, new int[]{android.R.attr.fontFamily}, + styleAttr, + 0); + if (ta.getIndexCount() == 0) { + return true; + } + String fontFamily = ta.getString(ta.getIndex(0)); + return SystemFonts.getRawSystemFallbackMap().containsKey(fontFamily); + } finally { + if (ta != null) { + ta.recycle(); + } + } + } + + private static boolean validateBaseTheme(Resources.Theme theme, int styleAttr) { + TypedArray ta = null; + try { + ta = theme.obtainStyledAttributes(null, + new int[]{android.R.attr.isAutofillInlineSuggestionTheme}, styleAttr, 0); + if (ta.getIndexCount() == 0) { + return false; + } + return ta.getBoolean(ta.getIndex(0), false); + } finally { + if (ta != null) { + ta.recycle(); + } + } + } } diff --git a/services/core/java/android/content/pm/PackageManagerInternal.java b/services/core/java/android/content/pm/PackageManagerInternal.java index c3cc5dee0e14..994c3147d70c 100644 --- a/services/core/java/android/content/pm/PackageManagerInternal.java +++ b/services/core/java/android/content/pm/PackageManagerInternal.java @@ -170,7 +170,7 @@ public abstract class PackageManagerInternal { * Return a List of all application packages that are installed on the * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been * set, a list of all applications including those deleted with - * {@code DONT_DELETE_DATA} (partially installed apps with data directory) + * {@code DELETE_KEEP_DATA} (partially installed apps with data directory) * will be returned. * * @param flags Additional option flags to modify the data returned. @@ -184,7 +184,7 @@ public abstract class PackageManagerInternal { * information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been - * deleted with {@code DONT_DELETE_DATA} flag set). + * deleted with {@code DELETE_KEEP_DATA} flag set). */ public abstract List<ApplicationInfo> getInstalledApplications( @ApplicationInfoFlags int flags, @UserIdInt int userId, int callingUid); diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java index 003525c91c32..de0b6fcbd4ae 100644 --- a/services/core/java/com/android/server/LocationManagerService.java +++ b/services/core/java/com/android/server/LocationManagerService.java @@ -118,6 +118,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import java.util.Set; +import java.util.TreeMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; @@ -2886,10 +2887,12 @@ public class LocationManagerService extends ILocationManager.Stub { ipw.println("Historical Records by Provider:"); ipw.increaseIndent(); + TreeMap<PackageProviderKey, PackageStatistics> sorted = new TreeMap<>(); + sorted.putAll(mRequestStatistics.statistics); for (Map.Entry<PackageProviderKey, PackageStatistics> entry - : mRequestStatistics.statistics.entrySet()) { + : sorted.entrySet()) { PackageProviderKey key = entry.getKey(); - ipw.println(key.packageName + ": " + key.providerName + ": " + entry.getValue()); + ipw.println(key.providerName + ": " + key.packageName + ": " + entry.getValue()); } ipw.decreaseIndent(); diff --git a/services/core/java/com/android/server/incremental/IncrementalManagerShellCommand.java b/services/core/java/com/android/server/incremental/IncrementalManagerShellCommand.java index 5c18f5880146..5161a77e4ede 100644 --- a/services/core/java/com/android/server/incremental/IncrementalManagerShellCommand.java +++ b/services/core/java/com/android/server/incremental/IncrementalManagerShellCommand.java @@ -16,6 +16,10 @@ package com.android.server.incremental; +import static android.content.pm.InstallationFile.FILE_TYPE_OBB; +import static android.content.pm.PackageInstaller.LOCATION_DATA_APP; +import static android.content.pm.PackageInstaller.LOCATION_MEDIA_OBB; + import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -171,7 +175,9 @@ public final class IncrementalManagerShellCommand extends ShellCommand { session = packageInstaller.openSession(sessionId); for (int i = 0; i < numFiles; i++) { InstallationFile file = installationFiles.get(i); - session.addFile(file.getName(), file.getSize(), file.getMetadata()); + final int location = file.getFileType() == FILE_TYPE_OBB ? LOCATION_MEDIA_OBB + : LOCATION_DATA_APP; + session.addFile(location, file.getName(), file.getSize(), file.getMetadata(), null); } session.commit(localReceiver.getIntentSender()); final Intent result = localReceiver.getResult(); diff --git a/services/core/java/com/android/server/location/ContextHubClientBroker.java b/services/core/java/com/android/server/location/ContextHubClientBroker.java index 45d9bae23e26..bb96e985cf53 100644 --- a/services/core/java/com/android/server/location/ContextHubClientBroker.java +++ b/services/core/java/com/android/server/location/ContextHubClientBroker.java @@ -33,6 +33,7 @@ import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; +import android.util.proto.ProtoOutputStream; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Supplier; @@ -449,6 +450,28 @@ public class ContextHubClientBroker extends IContextHubClient.Stub } } + /** + * Dump debugging info as ClientBrokerProto + * + * If the output belongs to a sub message, the caller is responsible for wrapping this function + * between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}. + * + * @param proto the ProtoOutputStream to write to + */ + void dump(ProtoOutputStream proto) { + proto.write(ClientBrokerProto.ENDPOINT_ID, getHostEndPointId()); + proto.write(ClientBrokerProto.ATTACHED_CONTEXT_HUB_ID, getAttachedContextHubId()); + proto.write(ClientBrokerProto.PACKAGE, mPackage); + if (mPendingIntentRequest.isValid()) { + proto.write(ClientBrokerProto.PENDING_INTENT_REQUEST_VALID, true); + proto.write(ClientBrokerProto.NANO_APP_ID, mPendingIntentRequest.getNanoAppId()); + } + proto.write(ClientBrokerProto.HAS_PENDING_INTENT, mPendingIntentRequest.hasPendingIntent()); + proto.write(ClientBrokerProto.PENDING_INTENT_CANCELLED, isPendingIntentCancelled()); + proto.write(ClientBrokerProto.REGISTERED, mRegistered); + + } + @Override public String toString() { String out = "[ContextHubClient "; diff --git a/services/core/java/com/android/server/location/ContextHubClientManager.java b/services/core/java/com/android/server/location/ContextHubClientManager.java index 46db8dc5dd77..0f70bb8bc840 100644 --- a/services/core/java/com/android/server/location/ContextHubClientManager.java +++ b/services/core/java/com/android/server/location/ContextHubClientManager.java @@ -27,10 +27,13 @@ import android.hardware.location.IContextHubClientCallback; import android.hardware.location.NanoAppMessage; import android.os.RemoteException; import android.util.Log; +import android.util.proto.ProtoOutputStream; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.Calendar; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.Iterator; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -45,6 +48,11 @@ import java.util.function.Consumer; private static final String TAG = "ContextHubClientManager"; /* + * The DateFormat for printing RegistrationRecord. + */ + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd HH:mm:ss.SSS"); + + /* * The maximum host endpoint ID value that a client can be assigned. */ private static final int MAX_CLIENT_ID = 0x7fff; @@ -123,24 +131,24 @@ import java.util.function.Consumer; private class RegistrationRecord { private final String mBroker; private final int mAction; - private final String mDate; + private final long mTimestamp; RegistrationRecord(String broker, @Action int action) { mBroker = broker; mAction = action; - Calendar instance = Calendar.getInstance(); - mDate = String.format("%02d", instance.get(Calendar.MONTH) + 1) // Jan == 0 - + "/" + String.format("%02d", instance.get(Calendar.DAY_OF_MONTH)) - + " " + String.format("%02d", instance.get(Calendar.HOUR_OF_DAY)) - + ":" + String.format("%02d", instance.get(Calendar.MINUTE)) - + ":" + String.format("%02d", instance.get(Calendar.SECOND)) - + "." + String.format("%03d", instance.get(Calendar.MILLISECOND)); + mTimestamp = System.currentTimeMillis(); + } + + void dump(ProtoOutputStream proto) { + proto.write(ClientManagerProto.RegistrationRecord.TIMESTAMP_MS, mTimestamp); + proto.write(ClientManagerProto.RegistrationRecord.ACTION, mAction); + proto.write(ClientManagerProto.RegistrationRecord.BROKER, mBroker); } @Override public String toString() { String out = ""; - out += mDate + " "; + out += DATE_FORMAT.format(new Date(mTimestamp)) + " "; out += mAction == ACTION_REGISTERED ? "+ " : "- "; out += mBroker; if (mAction == ACTION_CANCELLED) { @@ -376,6 +384,28 @@ import java.util.function.Consumer; return null; } + /** + * Dump debugging info as ClientManagerProto + * + * If the output belongs to a sub message, the caller is responsible for wrapping this function + * between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}. + * + * @param proto the ProtoOutputStream to write to + */ + void dump(ProtoOutputStream proto) { + for (ContextHubClientBroker broker : mHostEndPointIdToClientMap.values()) { + long token = proto.start(ClientManagerProto.CLIENT_BROKERS); + broker.dump(proto); + proto.end(token); + } + Iterator<RegistrationRecord> it = mRegistrationRecordDeque.descendingIterator(); + while (it.hasNext()) { + long token = proto.start(ClientManagerProto.REGISTRATION_RECORDS); + it.next().dump(proto); + proto.end(token); + } + } + @Override public String toString() { String out = ""; diff --git a/services/core/java/com/android/server/location/ContextHubService.java b/services/core/java/com/android/server/location/ContextHubService.java index 787a8007920d..e79eddf247cb 100644 --- a/services/core/java/com/android/server/location/ContextHubService.java +++ b/services/core/java/com/android/server/location/ContextHubService.java @@ -43,6 +43,7 @@ import android.hardware.location.NanoAppState; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.util.Log; +import android.util.proto.ProtoOutputStream; import com.android.internal.util.DumpUtils; @@ -782,6 +783,13 @@ public class ContextHubService extends IContextHubService.Stub { protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; + for (String arg : args) { + if ("--proto".equals(arg)) { + dump(new ProtoOutputStream(fd)); + return; + } + } + pw.println("Dumping ContextHub Service"); pw.println(""); @@ -802,6 +810,20 @@ public class ContextHubService extends IContextHubService.Stub { // dump eventLog } + private void dump(ProtoOutputStream proto) { + mContextHubIdToInfoMap.values().forEach(hubInfo -> { + long token = proto.start(ContextHubServiceProto.CONTEXT_HUB_INFO); + hubInfo.dump(proto); + proto.end(token); + }); + + long token = proto.start(ContextHubServiceProto.CLIENT_MANAGER); + mClientManager.dump(proto); + proto.end(token); + + proto.flush(); + } + private void checkPermissions() { ContextHubServiceUtil.checkPermissions(mContext); } diff --git a/services/core/java/com/android/server/location/LocationRequestStatistics.java b/services/core/java/com/android/server/location/LocationRequestStatistics.java index 45c833498ac7..b191338970e9 100644 --- a/services/core/java/com/android/server/location/LocationRequestStatistics.java +++ b/services/core/java/com/android/server/location/LocationRequestStatistics.java @@ -92,7 +92,7 @@ public class LocationRequestStatistics { /** * A key that holds both package and provider names. */ - public static class PackageProviderKey { + public static class PackageProviderKey implements Comparable<PackageProviderKey> { /** * Name of package requesting location. */ @@ -108,6 +108,16 @@ public class LocationRequestStatistics { } @Override + public int compareTo(PackageProviderKey other) { + final int providerCompare = providerName.compareTo(other.providerName); + if (providerCompare != 0) { + return providerCompare; + } else { + return packageName.compareTo(other.packageName); + } + } + + @Override public boolean equals(Object other) { if (!(other instanceof PackageProviderKey)) { return false; @@ -211,7 +221,7 @@ public class LocationRequestStatistics { void dump(IndentingPrintWriter ipw, long systemElapsedOffsetMillis) { StringBuilder s = new StringBuilder(); long systemTimeMillis = systemElapsedOffsetMillis + mElapsedRealtimeMillis; - s.append("At ").append(TimeUtils.formatForLogging(systemTimeMillis)).append(": ") + s.append("At ").append(TimeUtils.logTimeOfDay(systemTimeMillis)).append(": ") .append(mIntervalMillis == REQUEST_ENDED_INTERVAL ? "- " : "+ ") .append(String.format("%7s", mProviderName)).append(" request from ") .append(mPackageName); diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java index 78e17192ed58..9dff7754c4f3 100644 --- a/services/core/java/com/android/server/pm/AppsFilter.java +++ b/services/core/java/com/android/server/pm/AppsFilter.java @@ -302,8 +302,9 @@ public class AppsFilter { * initiating uid. */ public void grantImplicitAccess(int callingUid, int targetUid) { - if (mImplicitlyQueryable.add(targetUid, callingUid) && DEBUG_LOGGING) { - Slog.wtf(TAG, "implicit access granted: " + callingUid + " -> " + targetUid); + if (targetUid != callingUid + && mImplicitlyQueryable.add(targetUid, callingUid) && DEBUG_LOGGING) { + Slog.wtf(TAG, "implicit access granted: " + targetUid + " -> " + callingUid); } } @@ -511,6 +512,10 @@ public class AppsFilter { } return true; } + if (targetPkg.isStaticSharedLibrary()) { + // not an app, this filtering takes place at a higher level + return false; + } final String targetName = targetPkg.getPackageName(); Trace.beginSection("getAppId"); final int callingAppId; diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java index 124bbf52561a..ef2873358cd4 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -18,6 +18,7 @@ package com.android.server.pm; import static android.content.pm.DataLoaderType.INCREMENTAL; import static android.content.pm.DataLoaderType.STREAMING; +import static android.content.pm.PackageInstaller.LOCATION_DATA_APP; import static android.content.pm.PackageManager.INSTALL_FAILED_ABORTED; import static android.content.pm.PackageManager.INSTALL_FAILED_BAD_SIGNATURE; import static android.content.pm.PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; @@ -60,6 +61,7 @@ import android.content.IntentSender; import android.content.pm.ApplicationInfo; import android.content.pm.DataLoaderManager; import android.content.pm.DataLoaderParams; +import android.content.pm.DataLoaderParamsParcel; import android.content.pm.FileSystemControlParcel; import android.content.pm.IDataLoader; import android.content.pm.IDataLoaderStatusListener; @@ -203,8 +205,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { private static final String ATTR_DATALOADER_PACKAGE_NAME = "dataLoaderPackageName"; private static final String ATTR_DATALOADER_CLASS_NAME = "dataLoaderClassName"; private static final String ATTR_DATALOADER_ARGUMENTS = "dataLoaderArguments"; + private static final String ATTR_LOCATION = "location"; private static final String ATTR_LENGTH_BYTES = "lengthBytes"; private static final String ATTR_METADATA = "metadata"; + private static final String ATTR_SIGNATURE = "signature"; private static final String PROPERTY_NAME_INHERIT_NATIVE = "pi.inherit_native_on_dont_kill"; private static final int[] EMPTY_CHILD_SESSION_ARRAY = {}; @@ -303,22 +307,27 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { private int mParentSessionId; static class FileInfo { + public final int location; public final String name; public final Long lengthBytes; public final byte[] metadata; + public final byte[] signature; - public static FileInfo added(String name, Long lengthBytes, byte[] metadata) { - return new FileInfo(name, lengthBytes, metadata); + public static FileInfo added(int location, String name, Long lengthBytes, byte[] metadata, + byte[] signature) { + return new FileInfo(location, name, lengthBytes, metadata, signature); } - public static FileInfo removed(String name) { - return new FileInfo(name, -1L, null); + public static FileInfo removed(int location, String name) { + return new FileInfo(location, name, -1L, null, null); } - FileInfo(String name, Long lengthBytes, byte[] metadata) { + FileInfo(int location, String name, Long lengthBytes, byte[] metadata, byte[] signature) { + this.location = location; this.name = name; this.lengthBytes = lengthBytes; this.metadata = metadata; + this.signature = signature; } } @@ -2326,11 +2335,23 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } @Override - public void addFile(String name, long lengthBytes, byte[] metadata) { + public DataLoaderParamsParcel getDataLoaderParams() { + return params.dataLoaderParams != null ? params.dataLoaderParams.getData() : null; + } + + @Override + public void addFile(int location, String name, long lengthBytes, byte[] metadata, + byte[] signature) { if (!isDataLoaderInstallation()) { throw new IllegalStateException( "Cannot add files to non-data loader installation session."); } + if (!isIncrementalInstallation()) { + if (location != LOCATION_DATA_APP) { + throw new IllegalArgumentException( + "Non-incremental installation only supports /data/app placement: " + name); + } + } // Use installer provided name for now; we always rename later if (!FileUtils.isValidExtFilename(name)) { throw new IllegalArgumentException("Invalid name: " + name); @@ -2339,12 +2360,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { synchronized (mLock) { assertCallerIsOwnerOrRootLocked(); assertPreparedAndNotSealedLocked("addFile"); - mFiles.add(FileInfo.added(name, lengthBytes, metadata)); + mFiles.add(FileInfo.added(location, name, lengthBytes, metadata, signature)); } } @Override - public void removeFile(String name) { + public void removeFile(int location, String name) { if (!isDataLoaderInstallation()) { throw new IllegalStateException( "Cannot add files to non-data loader installation session."); @@ -2357,7 +2378,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { assertCallerIsOwnerOrRootLocked(); assertPreparedAndNotSealedLocked("removeFile"); - mFiles.add(FileInfo.removed(getRemoveMarkerName(name))); + mFiles.add(FileInfo.removed(location, getRemoveMarkerName(name))); } } @@ -2892,9 +2913,11 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } for (FileInfo fileInfo : mFiles) { out.startTag(null, TAG_SESSION_FILE); + writeIntAttribute(out, ATTR_LOCATION, fileInfo.location); writeStringAttribute(out, ATTR_NAME, fileInfo.name); writeLongAttribute(out, ATTR_LENGTH_BYTES, fileInfo.lengthBytes); writeByteArrayAttribute(out, ATTR_METADATA, fileInfo.metadata); + writeByteArrayAttribute(out, ATTR_SIGNATURE, fileInfo.signature); out.endTag(null, TAG_SESSION_FILE); } } @@ -3025,9 +3048,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { childSessionIds.add(readIntAttribute(in, ATTR_SESSION_ID, SessionInfo.INVALID_ID)); } if (TAG_SESSION_FILE.equals(in.getName())) { - files.add(new FileInfo(readStringAttribute(in, ATTR_NAME), + files.add(new FileInfo( + readIntAttribute(in, ATTR_LOCATION, 0), + readStringAttribute(in, ATTR_NAME), readLongAttribute(in, ATTR_LENGTH_BYTES, -1), - readByteArrayAttribute(in, ATTR_METADATA))); + readByteArrayAttribute(in, ATTR_METADATA), + readByteArrayAttribute(in, ATTR_SIGNATURE))); } } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index afd9e0956048..ca4ae0277aaf 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -17699,7 +17699,7 @@ public class PackageManagerService extends IPackageManager.Stub } /* - * This method deletes the package from internal data structures. If the DONT_DELETE_DATA + * This method deletes the package from internal data structures. If the DELETE_KEEP_DATA * flag is not set, the data directory is removed as well. * make sure this flag is set for partially installed apps. If not its meaningless to * delete a partially installed application. diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java index 83840067ecc2..e7f6b8982b04 100644 --- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java +++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java @@ -16,6 +16,7 @@ package com.android.server.pm; +import static android.content.pm.PackageInstaller.LOCATION_DATA_APP; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK; @@ -2970,7 +2971,7 @@ class PackageManagerShellCommand extends ShellCommand { // 1. Single file from stdin. if (args.isEmpty() || STDIN_PATH.equals(args.get(0))) { String name = "base." + (isApex ? "apex" : "apk"); - session.addFile(name, sessionSizeBytes, STDIN_PATH_BYTES); + session.addFile(LOCATION_DATA_APP, name, sessionSizeBytes, STDIN_PATH_BYTES, null); return 0; } @@ -2994,7 +2995,7 @@ class PackageManagerShellCommand extends ShellCommand { return 1; } - session.addFile(name, sizeBytes, STDIN_PATH_BYTES); + session.addFile(LOCATION_DATA_APP, name, sizeBytes, STDIN_PATH_BYTES, null); continue; } @@ -3004,7 +3005,7 @@ class PackageManagerShellCommand extends ShellCommand { String name = new File(inPath).getName(); byte[] metadata = inPath.getBytes(StandardCharsets.UTF_8); - session.addFile(name, -1, metadata); + session.addFile(LOCATION_DATA_APP, name, -1, metadata, null); } return 0; } finally { diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommandDataLoader.java b/services/core/java/com/android/server/pm/PackageManagerShellCommandDataLoader.java index a814cb8942e2..281c44a61153 100644 --- a/services/core/java/com/android/server/pm/PackageManagerShellCommandDataLoader.java +++ b/services/core/java/com/android/server/pm/PackageManagerShellCommandDataLoader.java @@ -115,8 +115,8 @@ public class PackageManagerShellCommandDataLoader extends DataLoaderService { } @Override - public boolean onPrepareImage(Collection<InstallationFile> addedFiles, - Collection<String> removedFiles) { + public boolean onPrepareImage(@NonNull Collection<InstallationFile> addedFiles, + @NonNull Collection<String> removedFiles) { final int commandId = extractShellCommandId(mParams.getArguments()); if (commandId == INVALID_SHELL_COMMAND_ID) { return false; diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 36e97755ab8a..2115f7ccfe98 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -3433,6 +3433,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; + pw.print("mDefaultWallpaperComponent="); pw.println(mDefaultWallpaperComponent); + pw.print("mImageWallpaper="); pw.println(mImageWallpaper); + synchronized (mLock) { pw.println("System wallpaper state:"); for (int i = 0; i < mWallpaperMap.size(); i++) { diff --git a/services/core/java/com/android/server/wm/TaskSnapshotPersister.java b/services/core/java/com/android/server/wm/TaskSnapshotPersister.java index 38a7000803bd..828775a4b934 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotPersister.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotPersister.java @@ -52,7 +52,6 @@ class TaskSnapshotPersister { private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskSnapshotPersister" : TAG_WM; private static final String SNAPSHOTS_DIRNAME = "snapshots"; private static final String REDUCED_POSTFIX = "_reduced"; - private static final float REDUCED_SCALE = .5f; private static final float LOW_RAM_REDUCED_SCALE = .8f; static final boolean DISABLE_FULL_SIZED_BITMAPS = ActivityManager.isLowRamDeviceStatic(); private static final long DELAY_MS = 100; @@ -84,8 +83,13 @@ class TaskSnapshotPersister { TaskSnapshotPersister(WindowManagerService service, DirectoryResolver resolver) { mDirectoryResolver = resolver; - mReducedScale = ActivityManager.isLowRamDeviceStatic() - ? LOW_RAM_REDUCED_SCALE : REDUCED_SCALE; + + if (ActivityManager.isLowRamDeviceStatic()) { + mReducedScale = LOW_RAM_REDUCED_SCALE; + } else { + mReducedScale = service.mContext.getResources().getFloat( + com.android.internal.R.dimen.config_reducedTaskSnapshotScale); + } mUse16BitFormat = service.mContext.getResources().getBoolean( com.android.internal.R.bool.config_use16BitTaskSnapshotPixelFormat); } diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index c0891d739788..212a3a638634 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -312,7 +312,6 @@ private: void updateInactivityTimeoutLocked(); void handleInterceptActions(jint wmActions, nsecs_t when, uint32_t& policyFlags); void ensureSpriteControllerLocked(); - const DisplayViewport* findDisplayViewportLocked(int32_t displayId); int32_t getPointerDisplayId(); void updatePointerDisplayLocked(); static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName); @@ -390,16 +389,6 @@ bool NativeInputManager::checkAndClearExceptionFromCallback(JNIEnv* env, const c return false; } -const DisplayViewport* NativeInputManager::findDisplayViewportLocked(int32_t displayId) - REQUIRES(mLock) { - for (const DisplayViewport& v : mLocked.viewports) { - if (v.displayId == displayId) { - return &v; - } - } - return nullptr; -} - void NativeInputManager::setDisplayViewports(JNIEnv* env, jobjectArray viewportObjArray) { std::vector<DisplayViewport> viewports; @@ -547,6 +536,8 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon outConfig->setDisplayViewports(mLocked.viewports); + outConfig->defaultPointerDisplayId = mLocked.pointerDisplayId; + outConfig->disabledDevices = mLocked.disabledInputDevices; } // release lock } @@ -564,8 +555,6 @@ sp<PointerControllerInterface> NativeInputManager::obtainPointerController(int32 updateInactivityTimeoutLocked(); } - updatePointerDisplayLocked(); - return controller; } @@ -580,23 +569,6 @@ int32_t NativeInputManager::getPointerDisplayId() { return pointerDisplayId; } -void NativeInputManager::updatePointerDisplayLocked() REQUIRES(mLock) { - ATRACE_CALL(); - - sp<PointerController> controller = mLocked.pointerController.promote(); - if (controller != nullptr) { - const DisplayViewport* viewport = findDisplayViewportLocked(mLocked.pointerDisplayId); - if (viewport == nullptr) { - ALOGW("Can't find pointer display viewport, fallback to default display."); - viewport = findDisplayViewportLocked(ADISPLAY_ID_DEFAULT); - } - - if (viewport != nullptr) { - controller->setDisplayViewport(*viewport); - } - } -} - void NativeInputManager::ensureSpriteControllerLocked() REQUIRES(mLock) { if (mLocked.spriteController == nullptr) { JNIEnv* env = jniEnv(); diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp index 00436bb8ca70..08a759227526 100644 --- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp +++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp @@ -1208,6 +1208,22 @@ void GnssMeasurementCallback::translateSingleGnssMeasurement translateSingleGnssMeasurement(&(measurement_V2_1->v2_0), object); SET(BasebandCn0DbHz, measurement_V2_1->basebandCN0DbHz); + + if (measurement_V2_1->flags & GnssMeasurementFlags::HAS_RECEIVER_ISB) { + SET(ReceiverInterSignalBiasNs, measurement_V2_1->receiverInterSignalBiasNs); + } + + if (measurement_V2_1->flags & GnssMeasurementFlags::HAS_RECEIVER_ISB_UNCERTAINTY) { + SET(ReceiverInterSignalBiasUncertaintyNs, measurement_V2_1->receiverInterSignalBiasUncertaintyNs); + } + + if (measurement_V2_1->flags & GnssMeasurementFlags::HAS_SATELLITE_ISB) { + SET(SatelliteInterSignalBiasNs, measurement_V2_1->satelliteInterSignalBiasNs); + } + + if (measurement_V2_1->flags & GnssMeasurementFlags::HAS_SATELLITE_ISB_UNCERTAINTY) { + SET(SatelliteInterSignalBiasUncertaintyNs, measurement_V2_1->satelliteInterSignalBiasUncertaintyNs); + } } template<class T> @@ -1253,6 +1269,19 @@ void GnssMeasurementCallback::translateGnssClock( template<> void GnssMeasurementCallback::translateGnssClock( + JavaObject& object, const IGnssMeasurementCallback_V2_1::GnssClock& clock) { + JNIEnv* env = getJniEnv(); + SET(ReferenceConstellationTypeForIsb, + static_cast<int32_t>(clock.referenceSignalTypeForIsb.constellation)); + SET(ReferenceCarrierFrequencyHzForIsb, clock.referenceSignalTypeForIsb.carrierFrequencyHz); + SET(ReferenceCodeTypeForIsb, + env->NewStringUTF(clock.referenceSignalTypeForIsb.codeType.c_str())); + + translateGnssClock(object, clock.v1_0); +} + +template<> +void GnssMeasurementCallback::translateGnssClock( JavaObject& object, const IGnssMeasurementCallback_V2_0::GnssData& data) { auto elapsedRealtime = data.elapsedRealtime; uint16_t flags = static_cast<uint16_t>(elapsedRealtime.flags); @@ -1265,6 +1294,20 @@ void GnssMeasurementCallback::translateGnssClock( translateGnssClock(object, data.clock); } +template<> +void GnssMeasurementCallback::translateGnssClock( + JavaObject& object, const IGnssMeasurementCallback_V2_1::GnssData& data) { + auto elapsedRealtime = data.elapsedRealtime; + uint16_t flags = static_cast<uint16_t>(elapsedRealtime.flags); + if (flags & ElapsedRealtimeFlags::HAS_TIMESTAMP_NS) { + SET(ElapsedRealtimeNanos, static_cast<uint64_t>(elapsedRealtime.timestampNs)); + } + if (flags & ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS) { + SET(ElapsedRealtimeUncertaintyNanos, static_cast<double>(elapsedRealtime.timeUncertaintyNs)); + } + translateGnssClock(object, data.clock); +} + template<class T> jobjectArray GnssMeasurementCallback::translateAllGnssMeasurements(JNIEnv* env, const T* measurements, diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 0171582e9d86..b6953f6e3e36 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -10737,30 +10737,35 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public boolean setApplicationHidden(ComponentName who, String callerPackage, String packageName, - boolean hidden) { - int callingUserId = UserHandle.getCallingUserId(); - boolean result = false; + boolean hidden, boolean parent) { + final int userId = parent ? getProfileParentId(UserHandle.getCallingUserId()) + : UserHandle.getCallingUserId(); + boolean result; + synchronized (getLockObject()) { // Ensure the caller is a DO/PO or a package access delegate. enforceCanManageScope(who, callerPackage, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER, DELEGATION_PACKAGE_ACCESS); - long id = mInjector.binderClearCallingIdentity(); - try { - result = mIPackageManager - .setApplicationHiddenSettingAsUser(packageName, hidden, callingUserId); - } catch (RemoteException re) { - // shouldn't happen - Slog.e(LOG_TAG, "Failed to setApplicationHiddenSetting", re); - } finally { - mInjector.binderRestoreCallingIdentity(id); + if (parent) { + getActiveAdminForCallerLocked(who, + DeviceAdminInfo.USES_POLICY_ORGANIZATION_OWNED_PROFILE_OWNER, parent); + // Ensure the package provided is a system package, this is to ensure that this + // API cannot be used to leak if certain non-system package exists in the person + // profile. + mInjector.binderWithCleanCallingIdentity(() -> + enforcePackageIsSystemPackage(packageName, hidden, userId)); } + + result = mInjector.binderWithCleanCallingIdentity(() -> mIPackageManager + .setApplicationHiddenSettingAsUser(packageName, hidden, userId)); } final boolean isDelegate = (who == null); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_APPLICATION_HIDDEN) .setAdmin(callerPackage) .setBoolean(isDelegate) + .setBoolean(parent) .setStrings(packageName, hidden ? "hidden" : "not_hidden") .write(); return result; @@ -10768,24 +10773,40 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public boolean isApplicationHidden(ComponentName who, String callerPackage, - String packageName) { - int callingUserId = UserHandle.getCallingUserId(); + String packageName, boolean parent) { + final int userId = parent ? getProfileParentId(UserHandle.getCallingUserId()) + : UserHandle.getCallingUserId(); + synchronized (getLockObject()) { // Ensure the caller is a DO/PO or a package access delegate. enforceCanManageScope(who, callerPackage, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER, DELEGATION_PACKAGE_ACCESS); - long id = mInjector.binderClearCallingIdentity(); - try { - return mIPackageManager.getApplicationHiddenSettingAsUser( - packageName, callingUserId); - } catch (RemoteException re) { - // shouldn't happen - Slog.e(LOG_TAG, "Failed to getApplicationHiddenSettingAsUser", re); - } finally { - mInjector.binderRestoreCallingIdentity(id); + if (parent) { + getActiveAdminForCallerLocked(who, + DeviceAdminInfo.USES_POLICY_ORGANIZATION_OWNED_PROFILE_OWNER, parent); + // Ensure the package provided is a system package. + mInjector.binderWithCleanCallingIdentity(() -> + enforcePackageIsSystemPackage(packageName, false, userId)); } - return false; + + return mInjector.binderWithCleanCallingIdentity( + () -> mIPackageManager.getApplicationHiddenSettingAsUser(packageName, userId)); + } + } + + private void enforcePackageIsSystemPackage(String packageName, boolean hidden, int userId) + throws RemoteException { + int flags = PackageManager.MATCH_SYSTEM_ONLY; + // If the package is currently hidden then it is considered uninstalled and + // the MATCH_UNINSTALLED_PACKAGES flag has to be added. + if (!hidden) { + flags |= PackageManager.MATCH_UNINSTALLED_PACKAGES; + } + PackageInfo packageInfo = mIPackageManager.getPackageInfo(packageName, flags, userId); + if (packageInfo == null || !packageInfo.applicationInfo.isSystemApp()) { + throw new IllegalArgumentException( + "The provided package is not a system package"); } } @@ -12190,7 +12211,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { LocalDate.now()); } synchronized (getLockObject()) { - getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); + getActiveAdminForCallerLocked(who, + DeviceAdminInfo.USES_POLICY_ORGANIZATION_OWNED_PROFILE_OWNER); if (policy == null) { mOwners.clearSystemUpdatePolicy(); } else { @@ -12199,9 +12221,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } mOwners.writeDeviceOwner(); } - mContext.sendBroadcastAsUser( + mInjector.binderWithCleanCallingIdentity(() -> mContext.sendBroadcastAsUser( new Intent(DevicePolicyManager.ACTION_SYSTEM_UPDATE_POLICY_CHANGED), - UserHandle.SYSTEM); + UserHandle.SYSTEM)); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_SYSTEM_UPDATE_POLICY) .setAdmin(who) @@ -14863,7 +14885,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { .setAdmin(admin) .setBoolean(isDeviceAB()) .write(); - enforceDeviceOwner(admin); + enforceDeviceOwnerOrProfileOwnerOnOrganizationOwnedDevice(admin); mInjector.binderWithCleanCallingIdentity(() -> { UpdateInstaller updateInstaller; if (isDeviceAB()) { diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java index 8f1d0f7648f5..def5b617becd 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java @@ -2183,6 +2183,63 @@ public class DevicePolicyManagerTest extends DpmTestBase { assertThat(actualAccounts).containsExactlyElementsIn(expectedAccounts); } + public void testSetApplicationHiddenWithDO() throws Exception { + mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; + setupDeviceOwner(); + mContext.packageName = admin1.getPackageName(); + setUpPackageManagerForAdmin(admin1, mContext.binder.callingUid); + + String packageName = "com.google.android.test"; + + dpm.setApplicationHidden(admin1, packageName, true); + verify(getServices().ipackageManager).setApplicationHiddenSettingAsUser(packageName, + true, UserHandle.USER_SYSTEM); + + dpm.setApplicationHidden(admin1, packageName, false); + verify(getServices().ipackageManager).setApplicationHiddenSettingAsUser(packageName, + false, UserHandle.USER_SYSTEM); + + verify(getServices().ipackageManager, never()).getPackageInfo(packageName, + PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM); + verify(getServices().ipackageManager, never()).getPackageInfo(packageName, + PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_SYSTEM_ONLY, + UserHandle.USER_SYSTEM); + } + + public void testSetApplicationHiddenWithPOOfOrganizationOwnedDevice() throws Exception { + final int MANAGED_PROFILE_USER_ID = DpmMockContext.CALLER_USER_HANDLE; + final int MANAGED_PROFILE_ADMIN_UID = + UserHandle.getUid(MANAGED_PROFILE_USER_ID, DpmMockContext.SYSTEM_UID); + mContext.binder.callingUid = MANAGED_PROFILE_ADMIN_UID; + + addManagedProfile(admin1, MANAGED_PROFILE_ADMIN_UID, admin1); + configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); + mContext.packageName = admin1.getPackageName(); + setUpPackageManagerForAdmin(admin1, mContext.binder.callingUid); + + String packageName = "com.google.android.test"; + + PackageInfo packageInfo = new PackageInfo(); + packageInfo.applicationInfo = new ApplicationInfo(); + packageInfo.applicationInfo.flags = ApplicationInfo.FLAG_SYSTEM; + when(getServices().userManager.getProfileParent(MANAGED_PROFILE_USER_ID)) + .thenReturn(new UserInfo(UserHandle.USER_SYSTEM, "user system", 0)); + when(getServices().ipackageManager.getPackageInfo(packageName, + PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM)).thenReturn( + packageInfo); + when(getServices().ipackageManager.getPackageInfo(packageName, + PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_SYSTEM_ONLY, + UserHandle.USER_SYSTEM)).thenReturn(packageInfo); + + parentDpm.setApplicationHidden(admin1, packageName, true); + verify(getServices().ipackageManager).setApplicationHiddenSettingAsUser(packageName, + true, UserHandle.USER_SYSTEM); + + parentDpm.setApplicationHidden(admin1, packageName, false); + verify(getServices().ipackageManager).setApplicationHiddenSettingAsUser(packageName, + false, UserHandle.USER_SYSTEM); + } + public void testGetMacAddress() throws Exception { mContext.callerPermissions.add(permission.MANAGE_DEVICE_ADMINS); mContext.callerPermissions.add(permission.MANAGE_PROFILE_AND_DEVICE_OWNERS); diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index b8cd37860284..5119e5824f7f 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -369,7 +369,7 @@ public class UsageStatsService extends SystemService implements /** * Fetches a map (package_name:install_time) of installed packages for the given user. This * map contains all installed packages, including those packages which have been uninstalled - * with the DONT_DELETE_DATA flag. + * with the DELETE_KEEP_DATA flag. * This is a helper method which should only be called when the given user's usage stats service * is initialized; it performs a heavy query to package manager so do not call it otherwise. * <br/> diff --git a/telecomm/java/android/telecom/CallerInfoAsyncQuery.java b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java index 4a50e98e527e..4a81a8eea5cf 100644 --- a/telecomm/java/android/telecom/CallerInfoAsyncQuery.java +++ b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java @@ -17,6 +17,7 @@ package android.telecom; import android.app.ActivityManager; +import android.compat.annotation.UnsupportedAppUsage; import android.content.AsyncQueryHandler; import android.content.ContentResolver; import android.content.Context; @@ -35,8 +36,6 @@ import android.telephony.PhoneNumberUtils; import android.telephony.SubscriptionManager; import android.text.TextUtils; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.util.ArrayList; import java.util.List; diff --git a/telephony/OWNERS b/telephony/OWNERS index 58a7ea08da3f..628c48070314 100644 --- a/telephony/OWNERS +++ b/telephony/OWNERS @@ -1,18 +1,16 @@ set noparent -tgunn@google.com -breadley@google.com -hallliu@google.com -rgreenwalt@google.com -mpq@google.com amitmahajan@google.com +breadley@google.com fionaxu@google.com jackyu@google.com +hallliu@google.com +rgreenwalt@google.com +tgunn@google.com jminjie@google.com -satk@google.com shuoq@google.com refuhoo@google.com -paulye@google.com nazaninb@google.com sarahchin@google.com dbright@google.com +xiaotonj@google.com diff --git a/telephony/common/com/android/internal/telephony/SmsApplication.java b/telephony/common/com/android/internal/telephony/SmsApplication.java index ffb3cb151ae4..32f9d53e59f8 100644 --- a/telephony/common/com/android/internal/telephony/SmsApplication.java +++ b/telephony/common/com/android/internal/telephony/SmsApplication.java @@ -20,6 +20,7 @@ import android.Manifest.permission; import android.annotation.Nullable; import android.app.AppOpsManager; import android.app.role.RoleManager; +import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -40,7 +41,6 @@ import android.os.UserHandle; import android.provider.Telephony; import android.provider.Telephony.Sms.Intents; import android.telephony.PackageChangeReceiver; -import android.util.Log; import android.telephony.TelephonyManager; import android.util.Log; @@ -48,8 +48,6 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.util.Collection; import java.util.HashMap; import java.util.List; diff --git a/telephony/common/com/google/android/mms/ContentType.java b/telephony/common/com/google/android/mms/ContentType.java index 12e4b7e26e1e..4a971dd34c8f 100644 --- a/telephony/common/com/google/android/mms/ContentType.java +++ b/telephony/common/com/google/android/mms/ContentType.java @@ -17,7 +17,7 @@ package com.google.android.mms; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import java.util.ArrayList; diff --git a/telephony/common/com/google/android/mms/InvalidHeaderValueException.java b/telephony/common/com/google/android/mms/InvalidHeaderValueException.java index 2836c3075b3b..55087ff0fb1d 100644 --- a/telephony/common/com/google/android/mms/InvalidHeaderValueException.java +++ b/telephony/common/com/google/android/mms/InvalidHeaderValueException.java @@ -17,7 +17,7 @@ package com.google.android.mms; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; /** * Thrown when an invalid header value was set. diff --git a/telephony/common/com/google/android/mms/MmsException.java b/telephony/common/com/google/android/mms/MmsException.java index 5be33ed1fac9..24bceb37f590 100644 --- a/telephony/common/com/google/android/mms/MmsException.java +++ b/telephony/common/com/google/android/mms/MmsException.java @@ -17,7 +17,7 @@ package com.google.android.mms; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; /** * A generic exception that is thrown by the Mms client. diff --git a/telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java b/telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java index ae447d7a7417..8693385bb032 100644 --- a/telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java +++ b/telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/Base64.java b/telephony/common/com/google/android/mms/pdu/Base64.java index 483fa7f9842e..0d6a46a59fcc 100644 --- a/telephony/common/com/google/android/mms/pdu/Base64.java +++ b/telephony/common/com/google/android/mms/pdu/Base64.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; public class Base64 { /** diff --git a/telephony/common/com/google/android/mms/pdu/CharacterSets.java b/telephony/common/com/google/android/mms/pdu/CharacterSets.java index 27da35e2d928..5172b7b67f88 100644 --- a/telephony/common/com/google/android/mms/pdu/CharacterSets.java +++ b/telephony/common/com/google/android/mms/pdu/CharacterSets.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import java.io.UnsupportedEncodingException; import java.util.HashMap; diff --git a/telephony/common/com/google/android/mms/pdu/DeliveryInd.java b/telephony/common/com/google/android/mms/pdu/DeliveryInd.java index 7093ac63338c..8fb6a7545abf 100644 --- a/telephony/common/com/google/android/mms/pdu/DeliveryInd.java +++ b/telephony/common/com/google/android/mms/pdu/DeliveryInd.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java b/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java index 41662750842f..8c0380f77cdd 100644 --- a/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java +++ b/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java @@ -17,10 +17,9 @@ package com.google.android.mms.pdu; +import android.compat.annotation.UnsupportedAppUsage; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; diff --git a/telephony/common/com/google/android/mms/pdu/GenericPdu.java b/telephony/common/com/google/android/mms/pdu/GenericPdu.java index ebf16ac7e632..320b13ffed2b 100644 --- a/telephony/common/com/google/android/mms/pdu/GenericPdu.java +++ b/telephony/common/com/google/android/mms/pdu/GenericPdu.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java b/telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java index e108f7600baf..42a89c69e873 100644 --- a/telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java +++ b/telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/NotificationInd.java b/telephony/common/com/google/android/mms/pdu/NotificationInd.java index b561bd4ab3a7..ca4615c2e9fe 100644 --- a/telephony/common/com/google/android/mms/pdu/NotificationInd.java +++ b/telephony/common/com/google/android/mms/pdu/NotificationInd.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/NotifyRespInd.java b/telephony/common/com/google/android/mms/pdu/NotifyRespInd.java index 3c70f86a0890..ebd81afc0173 100644 --- a/telephony/common/com/google/android/mms/pdu/NotifyRespInd.java +++ b/telephony/common/com/google/android/mms/pdu/NotifyRespInd.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/PduBody.java b/telephony/common/com/google/android/mms/pdu/PduBody.java index 51914e4110b0..f7f285f653b9 100644 --- a/telephony/common/com/google/android/mms/pdu/PduBody.java +++ b/telephony/common/com/google/android/mms/pdu/PduBody.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import java.util.HashMap; import java.util.Map; diff --git a/telephony/common/com/google/android/mms/pdu/PduComposer.java b/telephony/common/com/google/android/mms/pdu/PduComposer.java index e24bf21a11b5..b8b212c493aa 100644 --- a/telephony/common/com/google/android/mms/pdu/PduComposer.java +++ b/telephony/common/com/google/android/mms/pdu/PduComposer.java @@ -17,12 +17,11 @@ package com.google.android.mms.pdu; +import android.compat.annotation.UnsupportedAppUsage; import android.content.ContentResolver; import android.content.Context; import android.text.TextUtils; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.IOException; diff --git a/telephony/common/com/google/android/mms/pdu/PduContentTypes.java b/telephony/common/com/google/android/mms/pdu/PduContentTypes.java index 8551b2f9b693..57141fedf1e0 100644 --- a/telephony/common/com/google/android/mms/pdu/PduContentTypes.java +++ b/telephony/common/com/google/android/mms/pdu/PduContentTypes.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; public class PduContentTypes { /** diff --git a/telephony/common/com/google/android/mms/pdu/PduHeaders.java b/telephony/common/com/google/android/mms/pdu/PduHeaders.java index b5244645fda1..3e6218480dc5 100644 --- a/telephony/common/com/google/android/mms/pdu/PduHeaders.java +++ b/telephony/common/com/google/android/mms/pdu/PduHeaders.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/PduParser.java b/telephony/common/com/google/android/mms/pdu/PduParser.java index f48399410723..5340245ae869 100755 --- a/telephony/common/com/google/android/mms/pdu/PduParser.java +++ b/telephony/common/com/google/android/mms/pdu/PduParser.java @@ -17,10 +17,9 @@ package com.google.android.mms.pdu; +import android.compat.annotation.UnsupportedAppUsage; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import com.google.android.mms.ContentType; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/PduPart.java b/telephony/common/com/google/android/mms/pdu/PduPart.java index 09b775118dc3..8dd976b2569f 100644 --- a/telephony/common/com/google/android/mms/pdu/PduPart.java +++ b/telephony/common/com/google/android/mms/pdu/PduPart.java @@ -17,10 +17,9 @@ package com.google.android.mms.pdu; +import android.compat.annotation.UnsupportedAppUsage; import android.net.Uri; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.util.HashMap; import java.util.Map; diff --git a/telephony/common/com/google/android/mms/pdu/PduPersister.java b/telephony/common/com/google/android/mms/pdu/PduPersister.java index 8efca0ea3909..fcd5b8ff57a8 100755 --- a/telephony/common/com/google/android/mms/pdu/PduPersister.java +++ b/telephony/common/com/google/android/mms/pdu/PduPersister.java @@ -17,6 +17,7 @@ package com.google.android.mms.pdu; +import android.compat.annotation.UnsupportedAppUsage; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; @@ -40,8 +41,6 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import com.google.android.mms.ContentType; import com.google.android.mms.InvalidHeaderValueException; import com.google.android.mms.MmsException; diff --git a/telephony/common/com/google/android/mms/pdu/QuotedPrintable.java b/telephony/common/com/google/android/mms/pdu/QuotedPrintable.java index 9d6535c72e90..4e1d7f5775ec 100644 --- a/telephony/common/com/google/android/mms/pdu/QuotedPrintable.java +++ b/telephony/common/com/google/android/mms/pdu/QuotedPrintable.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import java.io.ByteArrayOutputStream; diff --git a/telephony/common/com/google/android/mms/pdu/ReadOrigInd.java b/telephony/common/com/google/android/mms/pdu/ReadOrigInd.java index e38c62dde622..4ba3c71580e0 100644 --- a/telephony/common/com/google/android/mms/pdu/ReadOrigInd.java +++ b/telephony/common/com/google/android/mms/pdu/ReadOrigInd.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/ReadRecInd.java b/telephony/common/com/google/android/mms/pdu/ReadRecInd.java index 9696bc259d00..37ccfb9c9b9b 100644 --- a/telephony/common/com/google/android/mms/pdu/ReadRecInd.java +++ b/telephony/common/com/google/android/mms/pdu/ReadRecInd.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/RetrieveConf.java b/telephony/common/com/google/android/mms/pdu/RetrieveConf.java index 03755af4189c..260adfc093f2 100644 --- a/telephony/common/com/google/android/mms/pdu/RetrieveConf.java +++ b/telephony/common/com/google/android/mms/pdu/RetrieveConf.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/SendConf.java b/telephony/common/com/google/android/mms/pdu/SendConf.java index b85982791ada..779923801bfa 100644 --- a/telephony/common/com/google/android/mms/pdu/SendConf.java +++ b/telephony/common/com/google/android/mms/pdu/SendConf.java @@ -17,7 +17,7 @@ package com.google.android.mms.pdu; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.InvalidHeaderValueException; diff --git a/telephony/common/com/google/android/mms/pdu/SendReq.java b/telephony/common/com/google/android/mms/pdu/SendReq.java index c1b7f934c0f7..6e2f2da01791 100644 --- a/telephony/common/com/google/android/mms/pdu/SendReq.java +++ b/telephony/common/com/google/android/mms/pdu/SendReq.java @@ -17,10 +17,9 @@ package com.google.android.mms.pdu; +import android.compat.annotation.UnsupportedAppUsage; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import com.google.android.mms.InvalidHeaderValueException; public class SendReq extends MultimediaMessagePdu { diff --git a/telephony/common/com/google/android/mms/util/AbstractCache.java b/telephony/common/com/google/android/mms/util/AbstractCache.java index ab5d48a4ce3d..25862e73581e 100644 --- a/telephony/common/com/google/android/mms/util/AbstractCache.java +++ b/telephony/common/com/google/android/mms/util/AbstractCache.java @@ -17,10 +17,9 @@ package com.google.android.mms.util; +import android.compat.annotation.UnsupportedAppUsage; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.util.HashMap; public abstract class AbstractCache<K, V> { diff --git a/telephony/common/com/google/android/mms/util/DownloadDrmHelper.java b/telephony/common/com/google/android/mms/util/DownloadDrmHelper.java index 118de465a518..0f9390daa725 100644 --- a/telephony/common/com/google/android/mms/util/DownloadDrmHelper.java +++ b/telephony/common/com/google/android/mms/util/DownloadDrmHelper.java @@ -17,12 +17,11 @@ package com.google.android.mms.util; +import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.drm.DrmManagerClient; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - public class DownloadDrmHelper { private static final String TAG = "DownloadDrmHelper"; diff --git a/telephony/common/com/google/android/mms/util/DrmConvertSession.java b/telephony/common/com/google/android/mms/util/DrmConvertSession.java index 0e8ec91f4ef6..156c7ad8baac 100644 --- a/telephony/common/com/google/android/mms/util/DrmConvertSession.java +++ b/telephony/common/com/google/android/mms/util/DrmConvertSession.java @@ -16,14 +16,13 @@ */ package com.google.android.mms.util; +import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.drm.DrmConvertedStatus; import android.drm.DrmManagerClient; import android.provider.Downloads; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; diff --git a/telephony/common/com/google/android/mms/util/PduCache.java b/telephony/common/com/google/android/mms/util/PduCache.java index 94e38946f632..c380d6b3e30f 100644 --- a/telephony/common/com/google/android/mms/util/PduCache.java +++ b/telephony/common/com/google/android/mms/util/PduCache.java @@ -17,14 +17,13 @@ package com.google.android.mms.util; +import android.compat.annotation.UnsupportedAppUsage; import android.content.ContentUris; import android.content.UriMatcher; import android.net.Uri; import android.provider.Telephony.Mms; import android.util.Log; -import dalvik.annotation.compat.UnsupportedAppUsage; - import java.util.HashMap; import java.util.HashSet; diff --git a/telephony/common/com/google/android/mms/util/PduCacheEntry.java b/telephony/common/com/google/android/mms/util/PduCacheEntry.java index 1ecd1bf93e7f..a4a25d2471ff 100644 --- a/telephony/common/com/google/android/mms/util/PduCacheEntry.java +++ b/telephony/common/com/google/android/mms/util/PduCacheEntry.java @@ -17,7 +17,7 @@ package com.google.android.mms.util; -import dalvik.annotation.compat.UnsupportedAppUsage; +import android.compat.annotation.UnsupportedAppUsage; import com.google.android.mms.pdu.GenericPdu; diff --git a/telephony/common/com/google/android/mms/util/SqliteWrapper.java b/telephony/common/com/google/android/mms/util/SqliteWrapper.java index 2dd1dc11c2a9..31fe4d7683d6 100644 --- a/telephony/common/com/google/android/mms/util/SqliteWrapper.java +++ b/telephony/common/com/google/android/mms/util/SqliteWrapper.java @@ -18,6 +18,7 @@ package com.google.android.mms.util; import android.app.ActivityManager; +import android.compat.annotation.UnsupportedAppUsage; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; @@ -27,8 +28,6 @@ import android.net.Uri; import android.util.Log; import android.widget.Toast; -import dalvik.annotation.compat.UnsupportedAppUsage; - public final class SqliteWrapper { private static final String TAG = "SqliteWrapper"; private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE diff --git a/telephony/java/android/telephony/ModemActivityInfo.java b/telephony/java/android/telephony/ModemActivityInfo.java index aebe78031ba2..1ba21f29df11 100644 --- a/telephony/java/android/telephony/ModemActivityInfo.java +++ b/telephony/java/android/telephony/ModemActivityInfo.java @@ -17,7 +17,6 @@ package android.telephony; import android.annotation.NonNull; -import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -60,7 +59,7 @@ public final class ModemActivityInfo implements Parcelable { private int mRxTimeMs; public ModemActivityInfo(long timestamp, int sleepTimeMs, int idleTimeMs, - @Nullable int[] txTimeMs, int rxTimeMs) { + @NonNull int[] txTimeMs, int rxTimeMs) { mTimestamp = timestamp; mSleepTimeMs = sleepTimeMs; mIdleTimeMs = idleTimeMs; @@ -69,13 +68,10 @@ public final class ModemActivityInfo implements Parcelable { } /** helper API to populate tx power range for each bucket **/ - private void populateTransmitPowerRange(@Nullable int[] transmitPowerMs) { + private void populateTransmitPowerRange(@NonNull int[] transmitPowerMs) { int i = 0; - if (transmitPowerMs != null) { - for ( ; i < Math.min(transmitPowerMs.length, TX_POWER_LEVELS); i++) { - mTransmitPowerInfo.add(i, - new TransmitPower(TX_POWER_RANGES[i], transmitPowerMs[i])); - } + for ( ; i < Math.min(transmitPowerMs.length, TX_POWER_LEVELS); i++) { + mTransmitPowerInfo.add(i, new TransmitPower(TX_POWER_RANGES[i], transmitPowerMs[i])); } // Make sure that mTransmitPowerInfo is fully initialized. for ( ; i < TX_POWER_LEVELS; i++) { @@ -98,7 +94,7 @@ public final class ModemActivityInfo implements Parcelable { return 0; } - public static final @NonNull Parcelable.Creator<ModemActivityInfo> CREATOR = + public static final @android.annotation.NonNull Parcelable.Creator<ModemActivityInfo> CREATOR = new Parcelable.Creator<ModemActivityInfo>() { public ModemActivityInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); @@ -153,7 +149,7 @@ public final class ModemActivityInfo implements Parcelable { } /** @hide */ - public void setTransmitTimeMillis(@Nullable int[] txTimeMs) { + public void setTransmitTimeMillis(int[] txTimeMs) { populateTransmitPowerRange(txTimeMs); } diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 63a85fa2845c..247ffd7313b9 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -54,6 +54,7 @@ import android.os.Looper; import android.os.ParcelUuid; import android.os.Process; import android.os.RemoteException; +import android.os.ServiceManager; import android.provider.Telephony.SimInfo; import android.telephony.euicc.EuiccManager; import android.telephony.ims.ImsMmTelManager; @@ -677,6 +678,13 @@ public class SubscriptionManager { public static final String WFC_IMS_ROAMING_ENABLED = SimInfo.WFC_IMS_ROAMING_ENABLED; /** + * Determines if the user has enabled IMS RCS User Capability Exchange (UCE) for this + * subscription. + * @hide + */ + public static final String IMS_RCS_UCE_ENABLED = SimInfo.IMS_RCS_UCE_ENABLED; + + /** * TelephonyProvider column name for whether a subscription is opportunistic, that is, * whether the network it connects to is limited in functionality or coverage. * For example, CBRS. @@ -976,10 +984,7 @@ public class SubscriptionManager { private INetworkPolicyManager getINetworkPolicyManager() { if (mNetworkPolicy == null) { mNetworkPolicy = INetworkPolicyManager.Stub.asInterface( - TelephonyFrameworkInitializer - .getTelephonyServiceManager() - .getNetworkPolicyServiceRegisterer() - .get()); + ServiceManager.getService(Context.NETWORK_POLICY_SERVICE)); } return mNetworkPolicy; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 903be6f68282..1d89665c1670 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -99,7 +99,6 @@ import com.android.internal.telephony.IOns; import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ISetOpportunisticDataCallback; import com.android.internal.telephony.ITelephony; -import com.android.internal.telephony.ITelephonyRegistry; import com.android.internal.telephony.IUpdateAvailableNetworksCallback; import com.android.internal.telephony.OperatorInfo; import com.android.internal.telephony.PhoneConstants; @@ -5624,14 +5623,6 @@ public class TelephonyManager { .getTelephonyServiceManager().getTelephonyServiceRegisterer().get()); } - private ITelephonyRegistry getTelephonyRegistry() { - return ITelephonyRegistry.Stub.asInterface( - TelephonyFrameworkInitializer - .getTelephonyServiceManager() - .getTelephonyRegistryServiceRegisterer() - .get()); - } - private IOns getIOns() { return IOns.Stub.asInterface( TelephonyFrameworkInitializer @@ -5685,29 +5676,27 @@ public class TelephonyManager { */ public void listen(PhoneStateListener listener, int events) { if (mContext == null) return; - try { - boolean notifyNow = (getITelephony() != null); - ITelephonyRegistry registry = getTelephonyRegistry(); - if (registry != null) { - // subId from PhoneStateListener is deprecated Q on forward, use the subId from - // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q. - int subId = mSubId; - if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) { - // since mSubId in PhoneStateListener is deprecated from Q on forward, this is - // the only place to set mSubId and its for "informational" only. - // TODO: remove this once we completely get rid of mSubId in PhoneStateListener - listener.mSubId = (events == PhoneStateListener.LISTEN_NONE) - ? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId; - } else if (listener.mSubId != null) { - subId = listener.mSubId; - } - registry.listenForSubscriber(subId, getOpPackageName(), getFeatureId(), - listener.callback, events, notifyNow); - } else { - Rlog.w(TAG, "telephony registry not ready."); - } - } catch (RemoteException ex) { - // system process dead + boolean notifyNow = (getITelephony() != null); + TelephonyRegistryManager telephonyRegistry = + (TelephonyRegistryManager) + mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); + if (telephonyRegistry != null) { + // subId from PhoneStateListener is deprecated Q on forward, use the subId from + // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q. + int subId = mSubId; + if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) { + // since mSubId in PhoneStateListener is deprecated from Q on forward, this is + // the only place to set mSubId and its for "informational" only. + // TODO: remove this once we completely get rid of mSubId in PhoneStateListener + listener.mSubId = (events == PhoneStateListener.LISTEN_NONE) + ? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId; + } else if (listener.mSubId != null) { + subId = listener.mSubId; + } + telephonyRegistry.listenForSubscriber(subId, getOpPackageName(), getFeatureId(), + listener, events, notifyNow); + } else { + Rlog.w(TAG, "telephony registry not ready."); } } diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java index 27a70228a433..7488a1aec0e5 100644 --- a/telephony/java/android/telephony/euicc/EuiccManager.java +++ b/telephony/java/android/telephony/euicc/EuiccManager.java @@ -38,6 +38,9 @@ import com.android.internal.telephony.euicc.IEuiccController; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; /** * EuiccManager is the application interface to eUICCs, or eSIMs/embedded SIMs. @@ -254,27 +257,38 @@ public class EuiccManager { * the error is related to download.Since the OperationCode only uses at most one byte, the * maximum allowed quantity is 255(0xFF). * - * ErrorCode is the remaing three bytes of the result code, and it denotes what happened. + * ErrorCode is the remaining three bytes of the result code, and it denotes what happened. * e.g a combination of {@link #OPERATION_DOWNLOAD} and {@link #ERROR_TIME_OUT} will suggest the * download operation has timed out. The only exception here is * {@link #OPERATION_SMDX_SUBJECT_REASON_CODE}, where instead of ErrorCode, SubjectCode[5.2.6.1 * from GSMA (SGP.22 v2.2) and ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2) are encoded. @see * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE} and * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE} + * + * In the case where ErrorCode contains a value of 0, it means it's an unknown error. E.g Intent + * only contains {@link #OPERATION_DOWNLOAD} and ErrorCode is 0 implies this is an unknown + * Download error. + * + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE} + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE} + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE} + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE} */ public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DETAILED_CODE"; /** * Key for an extra set on {@link PendingIntent} result callbacks providing a - * OperationCode of {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}. + * OperationCode of {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}, + * value will be an int. */ public static final String EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_OPERATION_CODE"; /** * Key for an extra set on {@link PendingIntent} result callbacks providing a - * ErrorCode of {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}. + * ErrorCode of {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}, + * value will be an int. */ public static final String EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_ERROR_CODE"; @@ -283,6 +297,7 @@ public class EuiccManager { * Key for an extra set on {@link PendingIntent} result callbacks providing a * SubjectCode[5.2.6.1] from GSMA (SGP.22 v2.2) decoded from * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}. + * The value of this extra will be a String. */ public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE"; @@ -291,6 +306,7 @@ public class EuiccManager { * Key for an extra set on {@link PendingIntent} result callbacks providing a * ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2) decoded from * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}. + * The value of this extra will be a String. */ public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE"; @@ -665,7 +681,7 @@ public class EuiccManager { ERROR_EUICC_MISSING, ERROR_UNSUPPORTED_VERSION, ERROR_SIM_MISSING, - ERROR_EUICC_GSMA_INSTALL_ERROR, + ERROR_INSTALL_PROFILE, ERROR_DISALLOWED_BY_PPR, ERROR_ADDRESS_MISSING, ERROR_CERTIFICATE_ERROR, @@ -733,14 +749,14 @@ public class EuiccManager { public static final int ERROR_SIM_MISSING = 10008; /** - * Failure to load the profile onto the eUICC card. i.e + * Failure to load the profile onto the eUICC card. e.g * 1. iccid of the profile already exists on the eUICC. * 2. GSMA(.22 v2.2) Profile Install Result - installFailedDueToDataMismatch * 3. operation was interrupted * 4. SIMalliance error in PEStatus(SGP.22 v2.2 section 2.5.6.1) * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details */ - public static final int ERROR_EUICC_GSMA_INSTALL_ERROR = 10009; + public static final int ERROR_INSTALL_PROFILE = 10009; /** * Failed to load profile onto eUICC due to Profile Poicly Rules. @@ -1235,6 +1251,138 @@ public class EuiccManager { } /** + * Sets the supported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * <p>The supported country list will be replaced by {@code supportedCountries}. For how we + * determine whether a country is supported please check {@link #isSupportedCountry}. + * + * @param supportedCountries is a list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + public void setSupportedCountries(@NonNull List<String> supportedCountries) { + if (!isEnabled()) { + return; + } + try { + getIEuiccController().setSupportedCountries( + true /* isSupported */, + supportedCountries.stream() + .map(String::toUpperCase).collect(Collectors.toList())); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Sets the unsupported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * <p>The unsupported country list will be replaced by {@code unsupportedCountries}. For how we + * determine whether a country is supported please check {@link #isSupportedCountry}. + * + * @param unsupportedCountries is a list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + public void setUnsupportedCountries(@NonNull List<String> unsupportedCountries) { + if (!isEnabled()) { + return; + } + try { + getIEuiccController().setSupportedCountries( + false /* isSupported */, + unsupportedCountries.stream() + .map(String::toUpperCase).collect(Collectors.toList())); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Gets the supported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * @return list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + @NonNull + public List<String> getSupportedCountries() { + if (!isEnabled()) { + return Collections.emptyList(); + } + try { + return getIEuiccController().getSupportedCountries(true /* isSupported */); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Gets the unsupported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * @return list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + @NonNull + public List<String> getUnsupportedCountries() { + if (!isEnabled()) { + return Collections.emptyList(); + } + try { + return getIEuiccController().getSupportedCountries(false /* isSupported */); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Returns whether the given country supports eUICC. + * + * <p>Supported country list has a higher prority than unsupported country list. If the + * supported country list is not empty, {@code countryIso} will be considered as supported when + * it exists in the supported country list. Otherwise {@code countryIso} is not supported. If + * the supported country list is empty, {@code countryIso} will be considered as supported if it + * does not exist in the unsupported country list. Otherwise {@code countryIso} is not + * supported. If both supported and unsupported country lists are empty, then all countries are + * consider be supported. For how to set supported and unsupported country list, please check + * {@link #setSupportedCountries} and {@link #setUnsupportedCountries}. + * + * @param countryIso should be the ISO-3166 country code is provided in uppercase 2 character + * format. + * @return whether the given country supports eUICC or not. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + public boolean isSupportedCountry(@NonNull String countryIso) { + if (!isEnabled()) { + return false; + } + try { + return getIEuiccController().isSupportedCountry(countryIso.toUpperCase()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Refreshes the cardId if its uninitialized, and returns whether we should continue the * operation. * <p> diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java index 2e3f59a13670..72167761c88d 100644 --- a/telephony/java/android/telephony/ims/RcsUceAdapter.java +++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java @@ -21,6 +21,8 @@ import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.RequiresPermission; +import android.annotation.SystemApi; +import android.annotation.TestApi; import android.net.Uri; import android.os.Binder; import android.os.IBinder; @@ -28,6 +30,7 @@ import android.os.RemoteException; import android.telephony.TelephonyFrameworkInitializer; import android.telephony.ims.aidl.IImsRcsController; import android.telephony.ims.aidl.IRcsUceControllerCallback; +import android.telephony.ims.feature.RcsFeature; import android.util.Log; import java.lang.annotation.Retention; @@ -41,6 +44,8 @@ import java.util.concurrent.Executor; * @see ImsRcsManager#getUceAdapter() for information on creating an instance of this class. * @hide */ +@SystemApi +@TestApi public class RcsUceAdapter { private static final String TAG = "RcsUceAdapter"; @@ -169,6 +174,7 @@ public class RcsUceAdapter { * Provides a one-time callback for the response to a UCE request. After this callback is called * by the framework, the reference to this callback will be discarded on the service side. * @see #requestCapabilities(Executor, List, CapabilitiesCallback) + * @hide */ public static class CapabilitiesCallback { @@ -196,6 +202,7 @@ public class RcsUceAdapter { /** * Not to be instantiated directly, use * {@link ImsRcsManager#getUceAdapter()} to instantiate this manager class. + * @hide */ RcsUceAdapter(int subId) { mSubId = subId; @@ -219,6 +226,7 @@ public class RcsUceAdapter { * {@link RcsUceAdapter} is valid, but the ImsService associated with the subscription is not * available. This can happen if the ImsService has crashed, for example, or if the subscription * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. + * @hide */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void requestCapabilities(@CallbackExecutor Executor executor, @@ -281,6 +289,7 @@ public class RcsUceAdapter { * {@link RcsUceAdapter} is valid, but the ImsService associated with the subscription is not * available. This can happen if the ImsService has crashed, for example, or if the subscription * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. + * @hide */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public @PublishState int getUcePublishState() throws ImsException { @@ -305,7 +314,7 @@ public class RcsUceAdapter { * for the associated subscription. * * @return true if the user’s setting for UCE is enabled, false otherwise. If false, - * {@link ImsRcsManager#isCapable(int)} will return false for + * {@link ImsRcsManager#isCapable(int, int)} will return false for * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_OPTIONS_UCE} and * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_PRESENCE_UCE} * @see #setUceSettingEnabled(boolean) diff --git a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl index 7422863d862c..35e8a12e898a 100644 --- a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl +++ b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.Bundle; import android.telephony.euicc.DownloadableSubscription; import android.telephony.euicc.EuiccInfo; +import java.util.List; /** @hide */ interface IEuiccController { @@ -47,4 +48,7 @@ interface IEuiccController { oneway void eraseSubscriptionsWithOptions( int cardId, int options, in PendingIntent callbackIntent); oneway void retainSubscriptionsForFactoryReset(int cardId, in PendingIntent callbackIntent); + void setSupportedCountries(boolean isSupported, in List<String> countriesList); + List<String> getSupportedCountries(boolean isSupported); + boolean isSupportedCountry(String countryIso); } diff --git a/wifi/java/android/net/wifi/INetworkRequestMatchCallback.aidl b/wifi/java/android/net/wifi/INetworkRequestMatchCallback.aidl index 51d74f0fcfa9..d14ec57ea07a 100644 --- a/wifi/java/android/net/wifi/INetworkRequestMatchCallback.aidl +++ b/wifi/java/android/net/wifi/INetworkRequestMatchCallback.aidl @@ -17,6 +17,7 @@ package android.net.wifi; import android.net.wifi.INetworkRequestUserSelectionCallback; +import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; /** @@ -30,7 +31,7 @@ oneway interface INetworkRequestMatchCallback void onAbort(); - void onMatch(in List<android.net.wifi.ScanResult> scanResults); + void onMatch(in List<ScanResult> scanResults); void onUserSelectionConnectSuccess(in WifiConfiguration wificonfiguration); diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 62bb2db69f39..558de7c82d92 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -36,6 +36,7 @@ import android.net.wifi.ISuggestionConnectionStatusListener; import android.net.wifi.ITrafficStateCallback; import android.net.wifi.ITxPacketCountListener; import android.net.wifi.IWifiConnectedNetworkScorer; +import android.net.wifi.ScanResult; import android.net.wifi.SoftApConfiguration; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; @@ -60,9 +61,9 @@ interface IWifiManager ParceledListSlice getPrivilegedConfiguredNetworks(String packageName, String featureId); - Map getAllMatchingFqdnsForScanResults(in List<android.net.wifi.ScanResult> scanResult); + Map getAllMatchingFqdnsForScanResults(in List<ScanResult> scanResult); - Map getMatchingOsuProviders(in List<android.net.wifi.ScanResult> scanResult); + Map getMatchingOsuProviders(in List<ScanResult> scanResult); Map getMatchingPasspointConfigsForOsuProviders(in List<OsuProvider> osuProviders); @@ -98,7 +99,7 @@ interface IWifiManager boolean startScan(String packageName, String featureId); - List<android.net.wifi.ScanResult> getScanResults(String callingPackage, String callingFeatureId); + List<ScanResult> getScanResults(String callingPackage, String callingFeatureId); boolean disconnect(String packageName); @@ -255,7 +256,7 @@ interface IWifiManager int calculateSignalLevel(int rssi); - List<WifiConfiguration> getWifiConfigForMatchedNetworkSuggestionsSharedWithUser(in List<android.net.wifi.ScanResult> scanResults); + List<WifiConfiguration> getWifiConfigForMatchedNetworkSuggestionsSharedWithUser(in List<ScanResult> scanResults); boolean setWifiConnectedNetworkScorer(in IBinder binder, in IWifiConnectedNetworkScorer scorer); |