diff options
116 files changed, 1670 insertions, 628 deletions
diff --git a/Android.bp b/Android.bp index 21054ddd89c6..6a85f62a5ae6 100644 --- a/Android.bp +++ b/Android.bp @@ -161,6 +161,7 @@ java_defaults { ":libcamera_client_framework_aidl", "core/java/android/hardware/IConsumerIrService.aidl", "core/java/android/hardware/ISerialManager.aidl", + "core/java/android/hardware/biometrics/IBiometricConfirmDeviceCredentialCallback.aidl", "core/java/android/hardware/biometrics/IBiometricEnabledOnKeyguardCallback.aidl", "core/java/android/hardware/biometrics/IBiometricService.aidl", "core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl", diff --git a/api/current.txt b/api/current.txt index bc634c63d2dd..f720e191d6d6 100644 --- a/api/current.txt +++ b/api/current.txt @@ -9515,7 +9515,7 @@ package android.content { method public static android.content.SyncAdapterType[] getSyncAdapterTypes(); method public static boolean getSyncAutomatically(android.accounts.Account, String); method @Nullable public final String getType(@NonNull android.net.Uri); - method @NonNull public final android.content.ContentResolver.TypeInfo getTypeInfo(@NonNull String); + method @NonNull public final android.content.ContentResolver.MimeTypeInfo getTypeInfo(@NonNull String); method @Nullable public final android.net.Uri insert(@RequiresPermission.Write @NonNull android.net.Uri, @Nullable android.content.ContentValues); method public static boolean isSyncActive(android.accounts.Account, String); method public static boolean isSyncPending(android.accounts.Account, String); @@ -9595,7 +9595,7 @@ package android.content { field public static final int SYNC_OBSERVER_TYPE_SETTINGS = 1; // 0x1 } - public static final class ContentResolver.TypeInfo { + public static final class ContentResolver.MimeTypeInfo { method @NonNull public CharSequence getContentDescription(); method @NonNull public android.graphics.drawable.Icon getIcon(); method @NonNull public CharSequence getLabel(); @@ -38537,6 +38537,7 @@ package android.provider { field public static final String ALBUM_ID = "album_id"; field public static final String ALBUM_KEY = "album_key"; field public static final String ARTIST = "artist"; + field public static final String ARTIST_ID = "artist_id"; field public static final String FIRST_YEAR = "minyear"; field public static final String LAST_YEAR = "maxyear"; field public static final String NUMBER_OF_SONGS = "numsongs"; @@ -44381,9 +44382,9 @@ package android.telephony { method public int getCid(); method public int getLac(); method @Deprecated public int getMcc(); - method public String getMccString(); + method @Nullable public String getMccString(); method @Deprecated public int getMnc(); - method public String getMncString(); + method @Nullable public String getMncString(); method @Nullable public String getMobileNetworkOperator(); method @Deprecated public int getPsc(); method public void writeToParcel(android.os.Parcel, int); @@ -44395,9 +44396,9 @@ package android.telephony { method public int getCi(); method public int getEarfcn(); method @Deprecated public int getMcc(); - method public String getMccString(); + method @Nullable public String getMccString(); method @Deprecated public int getMnc(); - method public String getMncString(); + method @Nullable public String getMncString(); method @Nullable public String getMobileNetworkOperator(); method public int getPci(); method public int getTac(); @@ -44420,8 +44421,8 @@ package android.telephony { method public int getCid(); method public int getCpid(); method public int getLac(); - method public String getMccString(); - method public String getMncString(); + method @Nullable public String getMccString(); + method @Nullable public String getMncString(); method @Nullable public String getMobileNetworkOperator(); method public int getUarfcn(); method public void writeToParcel(android.os.Parcel, int); @@ -44432,9 +44433,9 @@ package android.telephony { method public int getCid(); method public int getLac(); method @Deprecated public int getMcc(); - method public String getMccString(); + method @Nullable public String getMccString(); method @Deprecated public int getMnc(); - method public String getMncString(); + method @Nullable public String getMncString(); method @Nullable public String getMobileNetworkOperator(); method public int getPsc(); method public int getUarfcn(); @@ -44457,22 +44458,22 @@ package android.telephony { } public final class CellInfoCdma extends android.telephony.CellInfo implements android.os.Parcelable { - method public android.telephony.CellIdentityCdma getCellIdentity(); - method public android.telephony.CellSignalStrengthCdma getCellSignalStrength(); + method @NonNull public android.telephony.CellIdentityCdma getCellIdentity(); + method @NonNull public android.telephony.CellSignalStrengthCdma getCellSignalStrength(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoCdma> CREATOR; } public final class CellInfoGsm extends android.telephony.CellInfo implements android.os.Parcelable { - method public android.telephony.CellIdentityGsm getCellIdentity(); - method public android.telephony.CellSignalStrengthGsm getCellSignalStrength(); + method @NonNull public android.telephony.CellIdentityGsm getCellIdentity(); + method @NonNull public android.telephony.CellSignalStrengthGsm getCellSignalStrength(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoGsm> CREATOR; } public final class CellInfoLte extends android.telephony.CellInfo implements android.os.Parcelable { - method public android.telephony.CellIdentityLte getCellIdentity(); - method public android.telephony.CellSignalStrengthLte getCellSignalStrength(); + method @NonNull public android.telephony.CellIdentityLte getCellIdentity(); + method @NonNull public android.telephony.CellSignalStrengthLte getCellSignalStrength(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoLte> CREATOR; } @@ -44508,7 +44509,7 @@ package android.telephony { method public abstract boolean equals(Object); method public abstract int getAsuLevel(); method public abstract int getDbm(); - method public abstract int getLevel(); + method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public abstract int getLevel(); method public abstract int hashCode(); field public static final int SIGNAL_STRENGTH_GOOD = 3; // 0x3 field public static final int SIGNAL_STRENGTH_GREAT = 4; // 0x4 @@ -44528,7 +44529,7 @@ package android.telephony { method public int getEvdoEcio(); method public int getEvdoLevel(); method public int getEvdoSnr(); - method public int getLevel(); + method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthCdma> CREATOR; } @@ -44538,7 +44539,7 @@ package android.telephony { method public int getAsuLevel(); method public int getBitErrorRate(); method public int getDbm(); - method public int getLevel(); + method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel(); method public int getTimingAdvance(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthGsm> CREATOR; @@ -44549,7 +44550,7 @@ package android.telephony { method public int getAsuLevel(); method public int getCqi(); method public int getDbm(); - method public int getLevel(); + method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel(); method public int getRsrp(); method public int getRsrq(); method public int getRssi(); @@ -44566,7 +44567,7 @@ package android.telephony { method public int getCsiRsrq(); method public int getCsiSinr(); method public int getDbm(); - method public int getLevel(); + method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel(); method public int getSsRsrp(); method public int getSsRsrq(); method public int getSsSinr(); @@ -44578,7 +44579,7 @@ package android.telephony { method public int describeContents(); method public int getAsuLevel(); method public int getDbm(); - method public int getLevel(); + method @IntRange(from=0, to=4) public int getLevel(); method public int getRscp(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthTdscdma> CREATOR; @@ -44588,7 +44589,7 @@ package android.telephony { method public int describeContents(); method public int getAsuLevel(); method public int getDbm(); - method public int getLevel(); + method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthWcdma> CREATOR; } diff --git a/api/test-current.txt b/api/test-current.txt index f76881d19e93..7121a549176a 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -328,8 +328,14 @@ package android.app { } public class NotificationManager { + method public void allowAssistantCapability(String); + method public void disallowAssistantCapability(String); + method @NonNull public java.util.List<java.lang.String> getAllowedAssistantCapabilities(); + method @Nullable public android.content.ComponentName getAllowedNotificationAssistant(); method public android.content.ComponentName getEffectsSuppressor(); + method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName); method public boolean matchesCallFilter(android.os.Bundle); + method public void setNotificationAssistantAccessGranted(@Nullable android.content.ComponentName, boolean); } public final class PictureInPictureParams implements android.os.Parcelable { @@ -2454,10 +2460,49 @@ package android.service.contentcapture { package android.service.notification { + public final class Adjustment implements android.os.Parcelable { + ctor public Adjustment(String, String, android.os.Bundle, CharSequence, int); + ctor public Adjustment(@NonNull String, @NonNull String, @NonNull android.os.Bundle, @NonNull CharSequence, @NonNull android.os.UserHandle); + method public int describeContents(); + method @NonNull public CharSequence getExplanation(); + method @NonNull public String getKey(); + method @NonNull public String getPackage(); + method @NonNull public android.os.Bundle getSignals(); + method public int getUser(); + method @NonNull public android.os.UserHandle getUserHandle(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR; + field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions"; + field public static final String KEY_IMPORTANCE = "key_importance"; + field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria"; + field public static final String KEY_TEXT_REPLIES = "key_text_replies"; + field public static final String KEY_USER_SENTIMENT = "key_user_sentiment"; + } + @Deprecated public abstract class ConditionProviderService extends android.app.Service { method @Deprecated public boolean isBound(); } + public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService { + ctor public NotificationAssistantService(); + method public final void adjustNotification(@NonNull android.service.notification.Adjustment); + method public final void adjustNotifications(@NonNull java.util.List<android.service.notification.Adjustment>); + method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int); + method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent); + method public void onCapabilitiesChanged(); + method public void onNotificationDirectReplied(@NonNull String); + method @Nullable public abstract android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification); + method @Nullable public android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification, @NonNull android.app.NotificationChannel); + method public void onNotificationExpansionChanged(@NonNull String, boolean, boolean); + method public abstract void onNotificationSnoozedUntilContext(@NonNull android.service.notification.StatusBarNotification, @NonNull String); + method public void onNotificationsSeen(@NonNull java.util.List<java.lang.String>); + method public void onSuggestedReplySent(@NonNull String, @NonNull CharSequence, int); + method public final void unsnoozeNotification(@NonNull String); + field public static final String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService"; + field public static final int SOURCE_FROM_APP = 0; // 0x0 + field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1 + } + public abstract class NotificationListenerService extends android.app.Service { method public void onNotificationRemoved(@NonNull android.service.notification.StatusBarNotification, @NonNull android.service.notification.NotificationListenerService.RankingMap, @NonNull android.service.notification.NotificationStats, int); } diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 0bec21fcda90..d54aca89c50d 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -1169,6 +1169,7 @@ public class NotificationManager { * @hide */ @SystemApi + @TestApi public boolean isNotificationAssistantAccessGranted(@NonNull ComponentName assistant) { INotificationManager service = getService(); try { @@ -1204,6 +1205,7 @@ public class NotificationManager { * @hide */ @SystemApi + @TestApi public @NonNull @Adjustment.Keys List<String> getAllowedAssistantCapabilities() { INotificationManager service = getService(); try { @@ -1213,6 +1215,32 @@ public class NotificationManager { } } + /** + * @hide + */ + @TestApi + public void allowAssistantCapability(String capability) { + INotificationManager service = getService(); + try { + service.allowAssistantCapability(capability); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * @hide + */ + @TestApi + public void disallowAssistantCapability(String capability) { + INotificationManager service = getService(); + try { + service.disallowAssistantCapability(capability); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + /** @hide */ public boolean isNotificationPolicyAccessGrantedForPackage(String pkg) { INotificationManager service = getService(); @@ -1310,6 +1338,7 @@ public class NotificationManager { * @hide */ @SystemApi + @TestApi public void setNotificationAssistantAccessGranted(@Nullable ComponentName assistant, boolean granted) { INotificationManager service = getService(); @@ -1332,6 +1361,7 @@ public class NotificationManager { /** @hide */ @SystemApi + @TestApi public @Nullable ComponentName getAllowedNotificationAssistant() { INotificationManager service = getService(); try { diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 791c55196ecf..00f1e43c8493 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -3398,7 +3398,7 @@ public abstract class ContentResolver implements ContentInterface { * * @param mimeType Valid, concrete MIME type. */ - public final @NonNull TypeInfo getTypeInfo(@NonNull String mimeType) { + public final @NonNull MimeTypeInfo getTypeInfo(@NonNull String mimeType) { Objects.requireNonNull(mimeType); return MimeIconUtils.getTypeInfo(mimeType); } @@ -3407,13 +3407,13 @@ public abstract class ContentResolver implements ContentInterface { * Detailed description of a specific MIME type, including an icon and label * that describe the type. */ - public static final class TypeInfo { + public static final class MimeTypeInfo { private final Icon mIcon; private final CharSequence mLabel; private final CharSequence mContentDescription; /** {@hide} */ - public TypeInfo(@NonNull Icon icon, @NonNull CharSequence label, + public MimeTypeInfo(@NonNull Icon icon, @NonNull CharSequence label, @NonNull CharSequence contentDescription) { mIcon = Objects.requireNonNull(icon); mLabel = Objects.requireNonNull(label); diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 2b23e7a2a633..270aea851791 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -591,8 +591,6 @@ public class PackageParser { */ public interface Callback { boolean hasFeature(String feature); - String[] getOverlayPaths(String targetPackageName, String targetPath); - String[] getOverlayApks(String targetPackageName); } /** @@ -609,14 +607,6 @@ public class PackageParser { @Override public boolean hasFeature(String feature) { return mPm.hasSystemFeature(feature); } - - @Override public String[] getOverlayPaths(String targetPackageName, String targetPath) { - return null; - } - - @Override public String[] getOverlayApks(String targetPackageName) { - return null; - } } /** @@ -1168,19 +1158,7 @@ public class PackageParser { } final byte[] bytes = IoUtils.readFileAsByteArray(cacheFile.getAbsolutePath()); - Package p = fromCacheEntry(bytes); - if (mCallback != null) { - String[] overlayApks = mCallback.getOverlayApks(p.packageName); - if (overlayApks != null && overlayApks.length > 0) { - for (String overlayApk : overlayApks) { - // If a static RRO is updated, return null. - if (!isCacheUpToDate(new File(overlayApk), cacheFile)) { - return null; - } - } - } - } - return p; + return fromCacheEntry(bytes); } catch (Throwable e) { Slog.w(TAG, "Error reading package cache: ", e); @@ -1354,7 +1332,7 @@ public class PackageParser { final Resources res = new Resources(assets, mMetrics, null); final String[] outError = new String[1]; - final Package pkg = parseBaseApk(apkPath, res, parser, flags, outError); + final Package pkg = parseBaseApk(res, parser, flags, outError); if (pkg == null) { throw new PackageParserException(mParseError, apkPath + " (at " + parser.getPositionDescription() + "): " + outError[0]); @@ -1911,7 +1889,6 @@ public class PackageParser { * need to consider whether they should be supported by split APKs and child * packages. * - * @param apkPath The package apk file path * @param res The resources from which to resolve values * @param parser The manifest parser * @param flags Flags how to parse @@ -1921,8 +1898,7 @@ public class PackageParser { * @throws XmlPullParserException * @throws IOException */ - @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) - private Package parseBaseApk(String apkPath, Resources res, XmlResourceParser parser, int flags, + private Package parseBaseApk(Resources res, XmlResourceParser parser, int flags, String[] outError) throws XmlPullParserException, IOException { final String splitName; final String pkgName; @@ -1942,15 +1918,6 @@ public class PackageParser { return null; } - if (mCallback != null) { - String[] overlayPaths = mCallback.getOverlayPaths(pkgName, apkPath); - if (overlayPaths != null && overlayPaths.length > 0) { - for (String overlayPath : overlayPaths) { - res.getAssets().addOverlayPath(overlayPath); - } - } - } - final Package pkg = new Package(pkgName); TypedArray sa = res.obtainAttributes(parser, diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java index a696eeb6bcc7..6c497d47c645 100644 --- a/core/java/android/hardware/biometrics/BiometricManager.java +++ b/core/java/android/hardware/biometrics/BiometricManager.java @@ -207,5 +207,22 @@ public class BiometricManager { Slog.w(TAG, "onConfirmDeviceCredentialError(): Service not connected"); } } + + /** + * TODO(b/123378871): Remove when moved. + * @hide + */ + @RequiresPermission(USE_BIOMETRIC_INTERNAL) + public void registerCancellationCallback(IBiometricConfirmDeviceCredentialCallback callback) { + if (mService != null) { + try { + mService.registerCancellationCallback(callback); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } else { + Slog.w(TAG, "registerCancellationCallback(): Service not connected"); + } + } } diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java index 08035972a0db..1142a07bc66c 100644 --- a/core/java/android/hardware/biometrics/BiometricPrompt.java +++ b/core/java/android/hardware/biometrics/BiometricPrompt.java @@ -82,6 +82,11 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan * @hide */ public static final String KEY_ALLOW_DEVICE_CREDENTIAL = "allow_device_credential"; + /** + * @hide + */ + public static final String KEY_FROM_CONFIRM_DEVICE_CREDENTIAL + = "from_confirm_device_credential"; /** * Error/help message will show for this amount of time. @@ -271,6 +276,17 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan } /** + * TODO(123378871): Remove when moved. + * @return + * @hide + */ + @RequiresPermission(USE_BIOMETRIC_INTERNAL) + @NonNull public Builder setFromConfirmDeviceCredential() { + mBundle.putBoolean(KEY_FROM_CONFIRM_DEVICE_CREDENTIAL, true); + return this; + } + + /** * Creates a {@link BiometricPrompt}. * @return a {@link BiometricPrompt} * @throws IllegalArgumentException if any of the required fields are not set. @@ -494,7 +510,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan public void authenticateUser(@NonNull CancellationSignal cancel, @NonNull @CallbackExecutor Executor executor, @NonNull AuthenticationCallback callback, - int userId) { + int userId, + IBiometricConfirmDeviceCredentialCallback confirmDeviceCredentialCallback) { if (cancel == null) { throw new IllegalArgumentException("Must supply a cancellation signal"); } @@ -504,7 +521,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan if (callback == null) { throw new IllegalArgumentException("Must supply a callback"); } - authenticateInternal(null /* crypto */, cancel, executor, callback, userId); + authenticateInternal(null /* crypto */, cancel, executor, callback, userId, + confirmDeviceCredentialCallback); } /** @@ -555,7 +573,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan if (mBundle.getBoolean(KEY_ALLOW_DEVICE_CREDENTIAL)) { throw new IllegalArgumentException("Device credential not supported with crypto"); } - authenticateInternal(crypto, cancel, executor, callback, mContext.getUserId()); + authenticateInternal(crypto, cancel, executor, callback, mContext.getUserId(), + null /* confirmDeviceCredentialCallback */); } /** @@ -597,7 +616,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan if (callback == null) { throw new IllegalArgumentException("Must supply a callback"); } - authenticateInternal(null /* crypto */, cancel, executor, callback, mContext.getUserId()); + authenticateInternal(null /* crypto */, cancel, executor, callback, mContext.getUserId(), + null /* confirmDeviceCredentialCallback */); } private void cancelAuthentication() { @@ -614,7 +634,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan @NonNull CancellationSignal cancel, @NonNull @CallbackExecutor Executor executor, @NonNull AuthenticationCallback callback, - int userId) { + int userId, + IBiometricConfirmDeviceCredentialCallback confirmDeviceCredentialCallback) { try { if (cancel.isCanceled()) { Log.w(TAG, "Authentication already canceled"); @@ -629,7 +650,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan final long sessionId = crypto != null ? crypto.getOpId() : 0; if (BiometricManager.hasBiometrics(mContext)) { mService.authenticate(mToken, sessionId, userId, mBiometricServiceReceiver, - mContext.getOpPackageName(), mBundle); + mContext.getOpPackageName(), mBundle, confirmDeviceCredentialCallback); } else { mExecutor.execute(() -> { callback.onAuthenticationError(BiometricPrompt.BIOMETRIC_ERROR_HW_NOT_PRESENT, diff --git a/core/java/android/hardware/biometrics/IBiometricConfirmDeviceCredentialCallback.aidl b/core/java/android/hardware/biometrics/IBiometricConfirmDeviceCredentialCallback.aidl new file mode 100644 index 000000000000..8b35852efd31 --- /dev/null +++ b/core/java/android/hardware/biometrics/IBiometricConfirmDeviceCredentialCallback.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.biometrics; + +/** + * Communication channel between ConfirmDeviceCredential / ConfirmLock* and BiometricService. + * @hide + */ +interface IBiometricConfirmDeviceCredentialCallback { + // Invoked when authentication should be canceled. + oneway void cancel(); +}
\ No newline at end of file diff --git a/core/java/android/hardware/biometrics/IBiometricService.aidl b/core/java/android/hardware/biometrics/IBiometricService.aidl index 4971911eb87c..90d4921c3c18 100644 --- a/core/java/android/hardware/biometrics/IBiometricService.aidl +++ b/core/java/android/hardware/biometrics/IBiometricService.aidl @@ -17,6 +17,7 @@ package android.hardware.biometrics; import android.os.Bundle; +import android.hardware.biometrics.IBiometricConfirmDeviceCredentialCallback; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricServiceReceiver; @@ -30,8 +31,10 @@ import android.hardware.biometrics.IBiometricServiceReceiver; interface IBiometricService { // Requests authentication. The service choose the appropriate biometric to use, and show // the corresponding BiometricDialog. + // TODO(b/123378871): Remove callback when moved. void authenticate(IBinder token, long sessionId, int userId, - IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle); + IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle, + IBiometricConfirmDeviceCredentialCallback callback); // Cancel authentication for the given sessionId void cancelAuthentication(IBinder token, String opPackageName); @@ -59,4 +62,8 @@ interface IBiometricService { void onConfirmDeviceCredentialSuccess(); // TODO(b/123378871): Remove when moved. void onConfirmDeviceCredentialError(int error, String message); + // TODO(b/123378871): Remove when moved. + // When ConfirmLock* is invoked from BiometricPrompt, it needs to register a callback so that + // it can receive the cancellation signal. + void registerCancellationCallback(IBiometricConfirmDeviceCredentialCallback callback); } diff --git a/core/java/android/net/NetworkStack.java b/core/java/android/net/NetworkStack.java index dbb894f92f55..a46c410bd55e 100644 --- a/core/java/android/net/NetworkStack.java +++ b/core/java/android/net/NetworkStack.java @@ -15,9 +15,16 @@ */ package android.net; +import static android.Manifest.permission.NETWORK_STACK; +import static android.content.pm.PackageManager.PERMISSION_GRANTED; + +import android.annotation.NonNull; import android.annotation.SystemApi; import android.annotation.TestApi; +import android.content.Context; +import java.util.ArrayList; +import java.util.Arrays; /** * * Constants for client code communicating with the network stack service. @@ -37,4 +44,52 @@ public class NetworkStack { "android.permission.MAINLINE_NETWORK_STACK"; private NetworkStack() {} + + /** + * If the NetworkStack, MAINLINE_NETWORK_STACK are not allowed for a particular process, throw a + * {@link SecurityException}. + * + * @param context {@link android.content.Context} for the process. + * + * @hide + */ + public static void checkNetworkStackPermission(final @NonNull Context context) { + checkNetworkStackPermissionOr(context); + } + + /** + * If the NetworkStack, MAINLINE_NETWORK_STACK or other specified permissions are not allowed + * for a particular process, throw a {@link SecurityException}. + * + * @param context {@link android.content.Context} for the process. + * @param otherPermissions The set of permissions that could be the candidate permissions , or + * empty string if none of other permissions needed. + * @hide + */ + public static void checkNetworkStackPermissionOr(final @NonNull Context context, + final @NonNull String... otherPermissions) { + ArrayList<String> permissions = new ArrayList<String>(Arrays.asList(otherPermissions)); + permissions.add(NETWORK_STACK); + permissions.add(PERMISSION_MAINLINE_NETWORK_STACK); + enforceAnyPermissionOf(context, permissions.toArray(new String[0])); + } + + private static void enforceAnyPermissionOf(final @NonNull Context context, + final @NonNull String... permissions) { + if (!checkAnyPermissionOf(context, permissions)) { + throw new SecurityException("Requires one of the following permissions: " + + String.join(", ", permissions) + "."); + } + } + + private static boolean checkAnyPermissionOf(final @NonNull Context context, + final @NonNull String... permissions) { + for (String permission : permissions) { + if (context.checkCallingOrSelfPermission(permission) == PERMISSION_GRANTED) { + return true; + } + } + return false; + } + } diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index bda6ed19d3c1..0b1647d05ef4 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -2676,7 +2676,13 @@ public final class MediaStore { public static final String ALBUM = "album"; /** - * The artist whose songs appear on this album + * The ID of the artist whose songs appear on this album. + */ + @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true) + public static final String ARTIST_ID = "artist_id"; + + /** + * The name of the artist whose songs appear on this album. */ @Column(value = Cursor.FIELD_TYPE_STRING, readOnly = true) public static final String ARTIST = "artist"; diff --git a/core/java/android/service/notification/Adjustment.java b/core/java/android/service/notification/Adjustment.java index 8ba9a8357c65..e81ce7f85ac1 100644 --- a/core/java/android/service/notification/Adjustment.java +++ b/core/java/android/service/notification/Adjustment.java @@ -18,6 +18,7 @@ package android.service.notification; import android.annotation.NonNull; import android.annotation.StringDef; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.app.Notification; import android.os.Bundle; import android.os.Parcel; @@ -40,6 +41,7 @@ import java.lang.annotation.RetentionPolicy; * @hide */ @SystemApi +@TestApi public final class Adjustment implements Parcelable { private final String mPackage; private final String mKey; @@ -130,6 +132,7 @@ public final class Adjustment implements Parcelable { * @hide */ @SystemApi + @TestApi public Adjustment(String pkg, String key, Bundle signals, CharSequence explanation, int user) { mPackage = pkg; mKey = key; @@ -212,6 +215,7 @@ public final class Adjustment implements Parcelable { /** @hide */ @SystemApi + @TestApi public int getUser() { return mUser; } diff --git a/core/java/android/service/notification/INotificationListener.aidl b/core/java/android/service/notification/INotificationListener.aidl index 22104b5089cf..8bb5f97ca878 100644 --- a/core/java/android/service/notification/INotificationListener.aidl +++ b/core/java/android/service/notification/INotificationListener.aidl @@ -53,4 +53,5 @@ oneway interface INotificationListener void onNotificationDirectReply(String key); void onSuggestedReplySent(String key, in CharSequence reply, int source); void onActionClicked(String key, in Notification.Action action, int source); + void onCapabilitiesChanged(); } diff --git a/core/java/android/service/notification/NotificationAssistantService.java b/core/java/android/service/notification/NotificationAssistantService.java index b81725d99d2b..b4fd39701233 100644 --- a/core/java/android/service/notification/NotificationAssistantService.java +++ b/core/java/android/service/notification/NotificationAssistantService.java @@ -23,6 +23,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; @@ -65,6 +66,7 @@ import java.util.List; * @hide */ @SystemApi +@TestApi public abstract class NotificationAssistantService extends NotificationListenerService { private static final String TAG = "NotificationAssistants"; @@ -357,6 +359,11 @@ public abstract class NotificationAssistantService extends NotificationListenerS args.argi2 = source; mHandler.obtainMessage(MyHandler.MSG_ON_ACTION_INVOKED, args).sendToTarget(); } + + @Override + public void onCapabilitiesChanged() { + mHandler.obtainMessage(MyHandler.MSG_ON_CAPABILITIES_CHANGED).sendToTarget(); + } } private final class MyHandler extends Handler { @@ -367,6 +374,7 @@ public abstract class NotificationAssistantService extends NotificationListenerS public static final int MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT = 5; public static final int MSG_ON_SUGGESTED_REPLY_SENT = 6; public static final int MSG_ON_ACTION_INVOKED = 7; + public static final int MSG_ON_CAPABILITIES_CHANGED = 8; public MyHandler(Looper looper) { super(looper, null, false); @@ -448,6 +456,10 @@ public abstract class NotificationAssistantService extends NotificationListenerS onActionInvoked(key, action, source); break; } + case MSG_ON_CAPABILITIES_CHANGED: { + onCapabilitiesChanged(); + break; + } } } } diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 333868a2f08a..016f4aacef2a 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -1399,6 +1399,11 @@ public abstract class NotificationListenerService extends Service { } @Override + public void onCapabilitiesChanged() { + // no-op in the listener + } + + @Override public void onNotificationChannelModification(String pkgName, UserHandle user, NotificationChannel channel, @ChannelOrGroupModificationTypes int modificationType) { diff --git a/core/java/android/view/contentcapture/ContentCaptureCondition.java b/core/java/android/view/contentcapture/ContentCaptureCondition.java index cf171d738524..6f9d4d30909f 100644 --- a/core/java/android/view/contentcapture/ContentCaptureCondition.java +++ b/core/java/android/view/contentcapture/ContentCaptureCondition.java @@ -54,7 +54,9 @@ public final class ContentCaptureCondition implements Parcelable { * * @param locusId id of the condition, as defined by * {@link ContentCaptureContext#getLocusId()}. - * @param flags either {@link ContentCaptureCondition#FLAG_IS_REGEX} or {@code 0}. + * @param flags either {@link ContentCaptureCondition#FLAG_IS_REGEX} (to use a regular + * expression match) or {@code 0} (in which case the {@code LocusId} must be an exact match of + * the {@code LocusId} used in the {@link ContentCaptureContext}). */ public ContentCaptureCondition(@NonNull LocusId locusId, @Flags int flags) { this.mLocusId = Preconditions.checkNotNull(locusId); diff --git a/core/java/android/view/textclassifier/ConversationAction.java b/core/java/android/view/textclassifier/ConversationAction.java index f2d878a8bf54..b8cb7bed8712 100644 --- a/core/java/android/view/textclassifier/ConversationAction.java +++ b/core/java/android/view/textclassifier/ConversationAction.java @@ -200,13 +200,11 @@ public final class ConversationAction implements Parcelable { /** * Returns the extended data related to this conversation action. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } /** Builder class to construct {@link ConversationAction}. */ diff --git a/core/java/android/view/textclassifier/ConversationActions.java b/core/java/android/view/textclassifier/ConversationActions.java index dc7521296e9f..eddc672dc87f 100644 --- a/core/java/android/view/textclassifier/ConversationActions.java +++ b/core/java/android/view/textclassifier/ConversationActions.java @@ -214,13 +214,11 @@ public final class ConversationActions implements Parcelable { /** * Returns the extended data related to this conversation action. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } /** Builder class to construct a {@link Message} */ diff --git a/core/java/android/view/textclassifier/TextClassification.java b/core/java/android/view/textclassifier/TextClassification.java index 9ede8fbd176e..4c4cb55cd3a0 100644 --- a/core/java/android/view/textclassifier/TextClassification.java +++ b/core/java/android/view/textclassifier/TextClassification.java @@ -265,13 +265,11 @@ public final class TextClassification implements Parcelable { /** * Returns the extended data. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } @Override @@ -635,13 +633,11 @@ public final class TextClassification implements Parcelable { /** * Returns the extended data. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } /** diff --git a/core/java/android/view/textclassifier/TextLinks.java b/core/java/android/view/textclassifier/TextLinks.java index cde27a08fc79..c815f63b1708 100644 --- a/core/java/android/view/textclassifier/TextLinks.java +++ b/core/java/android/view/textclassifier/TextLinks.java @@ -125,13 +125,11 @@ public final class TextLinks implements Parcelable { /** * Returns the extended data. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } /** @@ -413,13 +411,11 @@ public final class TextLinks implements Parcelable { /** * Returns the extended data. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } /** diff --git a/core/java/android/view/textclassifier/TextSelection.java b/core/java/android/view/textclassifier/TextSelection.java index 52989397e473..e378e65aa29e 100644 --- a/core/java/android/view/textclassifier/TextSelection.java +++ b/core/java/android/view/textclassifier/TextSelection.java @@ -112,13 +112,11 @@ public final class TextSelection implements Parcelable { /** * Returns the extended data. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } @Override @@ -296,13 +294,11 @@ public final class TextSelection implements Parcelable { /** * Returns the extended data. * - * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should - * prefer to hold a reference to the returned bundle rather than frequently calling this - * method. + * <p><b>NOTE: </b>Do not modify this bundle. */ @NonNull public Bundle getExtras() { - return mExtras.deepCopy(); + return mExtras; } /** diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index 988fad2fb28e..51303f70f878 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -3055,6 +3055,7 @@ public class ChooserActivity extends ResolverActivity { private int mRadius = 0; private Path mPath = new Path(); private Paint mOverlayPaint = new Paint(0); + private Paint mRoundRectPaint = new Paint(0); private Paint mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private String mExtraImageCount = null; @@ -3078,6 +3079,11 @@ public class ChooserActivity extends ResolverActivity { mOverlayPaint.setColor(0x99000000); mOverlayPaint.setStyle(Paint.Style.FILL); + mRoundRectPaint.setColor(context.getResources().getColor(R.color.chooser_row_divider)); + mRoundRectPaint.setStyle(Paint.Style.STROKE); + mRoundRectPaint.setStrokeWidth(context.getResources() + .getDimensionPixelSize(R.dimen.chooser_preview_image_border)); + mTextPaint.setColor(Color.WHITE); mTextPaint.setTextSize(context.getResources() .getDimensionPixelSize(R.dimen.chooser_preview_image_font_size)); @@ -3087,8 +3093,8 @@ public class ChooserActivity extends ResolverActivity { private void updatePath(int width, int height) { mPath.reset(); - int imageWidth = width - getPaddingRight(); - int imageHeight = height - getPaddingBottom(); + int imageWidth = width - getPaddingRight() - getPaddingLeft(); + int imageHeight = height - getPaddingBottom() - getPaddingTop(); mPath.addRoundRect(getPaddingLeft(), getPaddingTop(), imageWidth, imageHeight, mRadius, mRadius, Path.Direction.CW); } @@ -3120,7 +3126,6 @@ public class ChooserActivity extends ResolverActivity { updatePath(width, height); } - @Override protected void onDraw(Canvas canvas) { if (mRadius != 0) { @@ -3129,8 +3134,12 @@ public class ChooserActivity extends ResolverActivity { super.onDraw(canvas); + int x = getPaddingLeft(); + int y = getPaddingRight(); + int width = getWidth() - getPaddingRight() - getPaddingLeft(); + int height = getHeight() - getPaddingBottom() - getPaddingTop(); if (mExtraImageCount != null) { - canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), mOverlayPaint); + canvas.drawRect(x, y, width, height, mOverlayPaint); int xPos = canvas.getWidth() / 2; int yPos = (int) ((canvas.getHeight() / 2.0f) @@ -3138,6 +3147,8 @@ public class ChooserActivity extends ResolverActivity { canvas.drawText(mExtraImageCount, xPos, yPos, mTextPaint); } + + canvas.drawRoundRect(x, y, width, height, mRadius, mRadius, mRoundRectPaint); } } } diff --git a/core/java/com/android/internal/util/MimeIconUtils.java b/core/java/com/android/internal/util/MimeIconUtils.java index 0b5fa6d4538a..8523b4ea9b43 100644 --- a/core/java/com/android/internal/util/MimeIconUtils.java +++ b/core/java/com/android/internal/util/MimeIconUtils.java @@ -18,7 +18,7 @@ package com.android.internal.util; import android.annotation.NonNull; import android.annotation.Nullable; -import android.content.ContentResolver.TypeInfo; +import android.content.ContentResolver.MimeTypeInfo; import android.content.res.Resources; import android.graphics.drawable.Icon; import android.text.TextUtils; @@ -34,9 +34,9 @@ import java.util.Objects; public class MimeIconUtils { @GuardedBy("sCache") - private static final ArrayMap<String, TypeInfo> sCache = new ArrayMap<>(); + private static final ArrayMap<String, MimeTypeInfo> sCache = new ArrayMap<>(); - private static TypeInfo buildTypeInfo(String mimeType, int iconId, + private static MimeTypeInfo buildTypeInfo(String mimeType, int iconId, int labelId, int extLabelId) { final Resources res = Resources.getSystem(); @@ -49,10 +49,10 @@ public class MimeIconUtils { label = res.getString(labelId); } - return new TypeInfo(Icon.createWithResource(res, iconId), label, label); + return new MimeTypeInfo(Icon.createWithResource(res, iconId), label, label); } - private static @Nullable TypeInfo buildTypeInfo(@NonNull String mimeType) { + private static @Nullable MimeTypeInfo buildTypeInfo(@NonNull String mimeType) { switch (mimeType) { case "inode/directory": case "vnd.android.document/directory": @@ -222,7 +222,7 @@ public class MimeIconUtils { } } - private static @Nullable TypeInfo buildGenericTypeInfo(@NonNull String mimeType) { + private static @Nullable MimeTypeInfo buildGenericTypeInfo(@NonNull String mimeType) { // Look for partial matches if (mimeType.startsWith("audio/")) { return buildTypeInfo(mimeType, R.drawable.ic_doc_audio, @@ -252,12 +252,12 @@ public class MimeIconUtils { R.string.mime_type_generic, R.string.mime_type_generic_ext); } - public static @NonNull TypeInfo getTypeInfo(@NonNull String mimeType) { + public static @NonNull MimeTypeInfo getTypeInfo(@NonNull String mimeType) { // Normalize MIME type mimeType = mimeType.toLowerCase(Locale.US); synchronized (sCache) { - TypeInfo res = sCache.get(mimeType); + MimeTypeInfo res = sCache.get(mimeType); if (res == null) { res = buildTypeInfo(mimeType); sCache.put(mimeType, res); diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index c646fefad9d6..02cbc2e578cf 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -724,6 +724,7 @@ <dimen name="chooser_edge_margin_thin">16dp</dimen> <dimen name="chooser_edge_margin_normal">24dp</dimen> <dimen name="chooser_preview_image_font_size">20sp</dimen> + <dimen name="chooser_preview_image_border">1dp</dimen> <dimen name="chooser_preview_width">-1px</dimen> <dimen name="resolver_icon_size">42dp</dimen> <dimen name="resolver_badge_size">18dp</dimen> diff --git a/core/res/res/values/dimens_car.xml b/core/res/res/values/dimens_car.xml index a43f7529c283..5c446d667015 100644 --- a/core/res/res/values/dimens_car.xml +++ b/core/res/res/values/dimens_car.xml @@ -121,6 +121,9 @@ <!-- Dialog button end margin --> <dimen name="button_end_margin">@*android:dimen/car_padding_4</dimen> + <!-- Dialog top padding when there is no title --> + <dimen name="dialog_no_title_padding_top">@*android:dimen/car_padding_4</dimen> + <!-- Dialog start margin for text view --> <dimen name="text_view_start_margin">@*android:dimen/car_keyline_1</dimen> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b87381364b1a..fb72da519f53 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2777,6 +2777,7 @@ <java-symbol type="dimen" name="chooser_edge_margin_normal" /> <java-symbol type="dimen" name="chooser_preview_image_font_size"/> <java-symbol type="dimen" name="chooser_preview_width" /> + <java-symbol type="dimen" name="chooser_preview_image_border"/> <java-symbol type="dimen" name="chooser_max_collapsed_height" /> <java-symbol type="layout" name="chooser_grid" /> <java-symbol type="layout" name="chooser_grid_preview_text" /> @@ -2790,6 +2791,7 @@ <java-symbol type="drawable" name="scroll_indicator_material" /> <java-symbol type="layout" name="chooser_row" /> + <java-symbol type="color" name="chooser_row_divider" /> <java-symbol type="layout" name="chooser_row_direct_share" /> <java-symbol type="bool" name="config_supportDoubleTapWake" /> <java-symbol type="drawable" name="ic_perm_device_info" /> diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index ed198e60902b..e4a93e740c4c 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -309,6 +309,7 @@ applications that come with the platform <permission name="android.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS"/> <permission name="android.permission.SET_WALLPAPER" /> <permission name="android.permission.SET_WALLPAPER_COMPONENT" /> + <permission name="android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE" /> </privapp-permissions> <privapp-permissions package="com.android.statementservice"> diff --git a/libs/hwui/utils/Color.cpp b/libs/hwui/utils/Color.cpp index d14116f7b555..39740bd46f9f 100644 --- a/libs/hwui/utils/Color.cpp +++ b/libs/hwui/utils/Color.cpp @@ -60,6 +60,9 @@ SkColorType PixelFormatToColorType(android::PixelFormat format) { } sk_sp<SkColorSpace> DataSpaceToColorSpace(android_dataspace dataspace) { + if (dataspace == HAL_DATASPACE_UNKNOWN) { + return SkColorSpace::MakeSRGB(); + } skcms_Matrix3x3 gamut; switch (dataspace & HAL_DATASPACE_STANDARD_MASK) { diff --git a/media/Android.bp b/media/Android.bp index 34801813ee87..8746046c220d 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -24,6 +24,10 @@ java_library { "mediaplayer2-protos", ], + permitted_packages: [ + "android.media", + ], + installable: true, // Make sure that the implementaion only relies on SDK or system APIs. diff --git a/media/apex/java/android/media/MediaPlayer2.java b/media/apex/java/android/media/MediaPlayer2.java index 87035da3d513..db33e8239175 100644 --- a/media/apex/java/android/media/MediaPlayer2.java +++ b/media/apex/java/android/media/MediaPlayer2.java @@ -31,6 +31,7 @@ import android.media.MediaDrm.KeyRequest; import android.media.MediaPlayer2.DrmInfo; import android.media.MediaPlayer2Proto.PlayerMessage; import android.media.MediaPlayer2Proto.Value; +import android.media.protobuf.InvalidProtocolBufferException; import android.net.Uri; import android.os.Handler; import android.os.HandlerThread; @@ -46,7 +47,6 @@ import android.view.Surface; import android.view.SurfaceHolder; import com.android.internal.annotations.GuardedBy; -import com.android.media.protobuf.InvalidProtocolBufferException; import java.io.ByteArrayOutputStream; import java.io.File; diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java index 325e227e6f93..790e189e9109 100644 --- a/media/java/android/media/AudioTrack.java +++ b/media/java/android/media/AudioTrack.java @@ -25,7 +25,6 @@ import android.annotation.Nullable; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.os.Binder; -import android.os.Build; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; @@ -1662,7 +1661,7 @@ public class AudioTrack extends PlayerBase * a better solution. * @hide */ - @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 112561552) + @UnsupportedAppUsage(trackingBug = 130237544) public int getLatency() { return native_get_latency(); } diff --git a/media/proto/jarjar-rules.txt b/media/proto/jarjar-rules.txt index bfb0b2782486..e73f86dddac1 100644 --- a/media/proto/jarjar-rules.txt +++ b/media/proto/jarjar-rules.txt @@ -1,2 +1,2 @@ -rule com.google.protobuf.** com.android.media.protobuf.@1 +rule com.google.protobuf.** android.media.protobuf.@1 diff --git a/packages/CaptivePortalLogin/AndroidManifest.xml b/packages/CaptivePortalLogin/AndroidManifest.xml index a5286364dc26..355bdd8dfc98 100644 --- a/packages/CaptivePortalLogin/AndroidManifest.xml +++ b/packages/CaptivePortalLogin/AndroidManifest.xml @@ -18,7 +18,7 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.captiveportallogin" - android:versionCode="200000000" + android:versionCode="210000000" android:versionName="Q-initial"> <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" /> diff --git a/packages/ExtServices/AndroidManifest.xml b/packages/ExtServices/AndroidManifest.xml index 45a59a32ec17..73bfd3010983 100644 --- a/packages/ExtServices/AndroidManifest.xml +++ b/packages/ExtServices/AndroidManifest.xml @@ -17,7 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" package="android.ext.services" - android:versionCode="200000000" + android:versionCode="210000000" android:versionName="1" coreApp="true"> diff --git a/packages/NetworkStack/AndroidManifest.xml b/packages/NetworkStack/AndroidManifest.xml index b4588e01dc79..ac05c44c1803 100644 --- a/packages/NetworkStack/AndroidManifest.xml +++ b/packages/NetworkStack/AndroidManifest.xml @@ -19,7 +19,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.networkstack" android:sharedUserId="android.uid.networkstack" - android:versionCode="200000000" + android:versionCode="210000000" android:versionName="29 system image" > diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java index bde1b25b914f..55ff591e3a1f 100644 --- a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java @@ -43,7 +43,6 @@ import android.content.pm.PackageUserState; import android.net.Uri; import android.os.Bundle; import android.os.Process; -import android.os.RemoteException; import android.os.UserManager; import android.provider.Settings; import android.util.Log; @@ -472,16 +471,6 @@ public class PackageInstallerActivity extends AlertActivity { mOriginatingUid, mOriginatingPackage); switch (appOpMode) { case AppOpsManager.MODE_DEFAULT: - try { - int result = mIpm.checkUidPermission( - Manifest.permission.REQUEST_INSTALL_PACKAGES, mOriginatingUid); - if (result == PackageManager.PERMISSION_GRANTED) { - initiateInstall(); - break; - } - } catch (RemoteException exc) { - Log.e(TAG, "Unable to talk to package manager"); - } mAppOpsManager.setMode(appOpCode, mOriginatingUid, mOriginatingPackage, AppOpsManager.MODE_ERRORED); // fall through diff --git a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java index 74057be8434b..ff40d8e00603 100644 --- a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java +++ b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java @@ -20,14 +20,12 @@ import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; -import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; -import android.graphics.drawable.Drawable; import android.location.SettingInjectorService; import android.os.Bundle; import android.os.Handler; @@ -37,9 +35,9 @@ import android.os.Messenger; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; +import android.util.ArrayMap; import android.util.ArraySet; import android.util.AttributeSet; -import android.util.IconDrawableFactory; import android.util.Log; import android.util.Xml; @@ -56,8 +54,8 @@ import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.HashSet; -import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -157,22 +155,8 @@ public class SettingsInjector { * Adds the InjectedSetting information to a Preference object */ private void populatePreference(Preference preference, InjectedSetting setting) { - final PackageManager pm = mContext.getPackageManager(); - Drawable appIcon = null; - try { - final PackageItemInfo itemInfo = new PackageItemInfo(); - itemInfo.icon = setting.iconId; - itemInfo.packageName = setting.packageName; - final ApplicationInfo appInfo = pm.getApplicationInfo(setting.packageName, - PackageManager.GET_META_DATA); - appIcon = IconDrawableFactory.newInstance(mContext) - .getBadgedIcon(itemInfo, appInfo, setting.mUserHandle.getIdentifier()); - } catch (PackageManager.NameNotFoundException e) { - Log.e(TAG, "Can't get ApplicationInfo for " + setting.packageName, e); - } preference.setTitle(setting.title); preference.setSummary(R.string.loading_injected_setting_summary); - preference.setIcon(appIcon); preference.setOnPreferenceClickListener(new ServiceSettingClickedListener(setting)); } @@ -182,13 +166,15 @@ public class SettingsInjector { * @param profileId Identifier of the user/profile to obtain the injected settings for or * UserHandle.USER_CURRENT for all profiles associated with current user. */ - public List<Preference> getInjectedSettings(Context prefContext, final int profileId) { + public Map<Integer, List<Preference>> getInjectedSettings(Context prefContext, + final int profileId) { final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); final List<UserHandle> profiles = um.getUserProfiles(); - ArrayList<Preference> prefs = new ArrayList<>(); + final ArrayMap<Integer, List<Preference>> result = new ArrayMap<>(); mSettings.clear(); for (UserHandle userHandle : profiles) { if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) { + final List<Preference> prefs = new ArrayList<>(); Iterable<InjectedSetting> settings = getSettings(userHandle); for (InjectedSetting setting : settings) { Preference preference = createPreference(prefContext, setting); @@ -196,12 +182,14 @@ public class SettingsInjector { prefs.add(preference); mSettings.add(new Setting(setting, preference)); } + if (!prefs.isEmpty()) { + result.put(userHandle.getIdentifier(), prefs); + } } } reloadStatusMessages(); - - return prefs; + return result; } /** @@ -303,28 +291,6 @@ public class SettingsInjector { } /** - * Checks wheteher there is any preference that other apps have injected. - * - * @param profileId Identifier of the user/profile to obtain the injected settings for or - * UserHandle.USER_CURRENT for all profiles associated with current user. - */ - public boolean hasInjectedSettings(final int profileId) { - final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); - final List<UserHandle> profiles = um.getUserProfiles(); - final int profileCount = profiles.size(); - for (int i = 0; i < profileCount; ++i) { - final UserHandle userHandle = profiles.get(i); - if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) { - Iterable<InjectedSetting> settings = getSettings(userHandle); - for (InjectedSetting setting : settings) { - return true; - } - } - } - return false; - } - - /** * Reloads the status messages for all the preference items. */ public void reloadStatusMessages() { diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 3a9a99385c28..314b74a69147 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -154,6 +154,7 @@ <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> <!-- Permission needed to rename bugreport notifications (so they're not shown as Shell) --> <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" /> + <uses-permission android:name="android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE" /> <!-- Permission needed to hold a wakelock in dumpstate.cpp (drop_root_user()) --> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Permission needed to enable/disable overlays --> diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java index 42600c157387..834f4fc75dce 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java @@ -117,6 +117,7 @@ public interface QSTile { public String expandedAccessibilityClassName; public SlashState slash; public boolean handlesLongClick = true; + public boolean showRippleEffect = true; public boolean copyTo(State other) { if (other == null) throw new IllegalArgumentException(); @@ -135,7 +136,8 @@ public interface QSTile { || !Objects.equals(other.isTransient, isTransient) || !Objects.equals(other.dualTarget, dualTarget) || !Objects.equals(other.slash, slash) - || !Objects.equals(other.handlesLongClick, handlesLongClick); + || !Objects.equals(other.handlesLongClick, handlesLongClick) + || !Objects.equals(other.showRippleEffect, showRippleEffect); other.icon = icon; other.iconSupplier = iconSupplier; other.label = label; @@ -149,6 +151,7 @@ public interface QSTile { other.isTransient = isTransient; other.slash = slash != null ? slash.copy() : null; other.handlesLongClick = handlesLongClick; + other.showRippleEffect = showRippleEffect; return changed; } diff --git a/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml b/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml new file mode 100644 index 000000000000..fe1bb265880c --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml @@ -0,0 +1,31 @@ +<!-- + Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:viewportWidth="22" + android:viewportHeight="17" + android:width="22dp" + android:height="17dp"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M1.22,8.49l0.43-4.96h4.33v1.17H2.67L2.44,7.41c0.41-0.29,0.85-0.43,1.33-0.43c0.77,0,1.38,0.3,1.83,0.9 s0.66,1.41,0.66,2.43c0,1.03-0.24,1.84-0.72,2.43s-1.14,0.88-1.98,0.88c-0.75,0-1.36-0.24-1.83-0.73s-0.74-1.16-0.81-2.02h1.13 c0.07,0.57,0.23,1,0.49,1.29c0.26,0.29,0.59,0.43,1.01,0.43c0.47,0,0.84-0.2,1.1-0.61c0.26-0.41,0.4-0.96,0.4-1.65 c0-0.65-0.14-1.18-0.43-1.59S3.96,8.11,3.47,8.11c-0.4,0-0.72,0.1-0.96,0.31L2.19,8.75L1.22,8.49z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M14.14,12.24l-0.22,0.27c-0.63,0.73-1.55,1.1-2.76,1.1c-1.08,0-1.92-0.36-2.53-1.07c-0.61-0.71-0.93-1.72-0.94-3.02V7.56 c0-1.39,0.28-2.44,0.84-3.13c0.56-0.7,1.39-1.04,2.51-1.04c0.95,0,1.69,0.26,2.23,0.79c0.54,0.53,0.83,1.28,0.89,2.26h-1.25 c-0.05-0.62-0.22-1.1-0.52-1.45c-0.29-0.35-0.74-0.52-1.34-0.52c-0.72,0-1.24,0.23-1.57,0.7C9.14,5.63,8.96,6.37,8.95,7.4v2.03 c0,1,0.19,1.77,0.57,2.31c0.38,0.54,0.93,0.8,1.65,0.8c0.67,0,1.19-0.16,1.54-0.49l0.18-0.17V9.59h-1.82V8.52h3.07V12.24z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M20.96,8.88h-3.52v3.53h4.1v1.07h-5.35V3.52h5.28V4.6h-4.03V7.8h3.52V8.88z" /> + +</vector> diff --git a/packages/SystemUI/res/drawable/ic_sysbar_back.xml b/packages/SystemUI/res/drawable/ic_sysbar_back.xml index 144884349c52..ee402622d52b 100644 --- a/packages/SystemUI/res/drawable/ic_sysbar_back.xml +++ b/packages/SystemUI/res/drawable/ic_sysbar_back.xml @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" + android:autoMirrored="true" android:viewportWidth="28" android:viewportHeight="28"> diff --git a/packages/SystemUI/res/drawable/ic_sysbar_back_quick_step.xml b/packages/SystemUI/res/drawable/ic_sysbar_back_quick_step.xml index 93b2f9c85bd1..442fafcebb84 100644 --- a/packages/SystemUI/res/drawable/ic_sysbar_back_quick_step.xml +++ b/packages/SystemUI/res/drawable/ic_sysbar_back_quick_step.xml @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" + android:autoMirrored="true" android:viewportWidth="28" android:viewportHeight="28"> <path diff --git a/packages/SystemUI/res/values-mcc310-mnc030/config.xml b/packages/SystemUI/res/values-mcc310-mnc030/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc030/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc310-mnc070/config.xml b/packages/SystemUI/res/values-mcc310-mnc070/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc070/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc310-mnc170/config.xml b/packages/SystemUI/res/values-mcc310-mnc170/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc170/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc310-mnc280/config.xml b/packages/SystemUI/res/values-mcc310-mnc280/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc280/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc310-mnc380/config.xml b/packages/SystemUI/res/values-mcc310-mnc380/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc380/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc310-mnc410/config.xml b/packages/SystemUI/res/values-mcc310-mnc410/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc410/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc310-mnc560/config.xml b/packages/SystemUI/res/values-mcc310-mnc560/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc560/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc310-mnc950/config.xml b/packages/SystemUI/res/values-mcc310-mnc950/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc310-mnc950/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values-mcc311-mnc180/config.xml b/packages/SystemUI/res/values-mcc311-mnc180/config.xml new file mode 100644 index 000000000000..26b9192e0cc3 --- /dev/null +++ b/packages/SystemUI/res/values-mcc311-mnc180/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2019, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- Enable 5 bar signal strength icon --> + <bool name="config_inflateSignalStrength">true</bool> +</resources> + diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index f47d4b5aac6d..e098bc5acd5c 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -424,6 +424,9 @@ <!-- Content description of the data connection type LTE+. [CHAR LIMIT=NONE] --> <string name="data_connection_lte_plus">LTE+</string> + <!-- Content description of the data connection type 5Ge. [CHAR LIMIT=NONE] --> + <string name="data_connection_5ge" translate="false">5Ge</string> + <!-- Content description of the data connection type 5G. [CHAR LIMIT=NONE] --> <string name="data_connection_5g" translate="false">5G</string> diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java index 4fe09a92a1de..665df777c1c1 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java @@ -26,16 +26,41 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; */ class Bubble { + private final String mKey; + private final BubbleExpandedView.OnBubbleBlockedListener mListener; + + private boolean mInflated; + public BubbleView iconView; public BubbleExpandedView expandedView; - public String key; public NotificationEntry entry; + Bubble(NotificationEntry e, BubbleExpandedView.OnBubbleBlockedListener listener) { + entry = e; + mKey = e.key; + mListener = listener; + } + + /** @deprecated use the other constructor to defer View creation. */ + @Deprecated Bubble(NotificationEntry e, LayoutInflater inflater, BubbleStackView stackView, BubbleExpandedView.OnBubbleBlockedListener listener) { - entry = e; - key = entry.key; + this(e, listener); + inflate(inflater, stackView); + } + + public String getKey() { + return mKey; + } + + boolean isInflated() { + return mInflated; + } + void inflate(LayoutInflater inflater, BubbleStackView stackView) { + if (mInflated) { + return; + } iconView = (BubbleView) inflater.inflate( R.layout.bubble_view, stackView, false /* attachToRoot */); iconView.setNotif(entry); @@ -44,12 +69,14 @@ class Bubble { R.layout.bubble_expanded_view, stackView, false /* attachToRoot */); expandedView.setEntry(entry, stackView); - expandedView.setOnBlockedListener(listener); + expandedView.setOnBlockedListener(mListener); + mInflated = true; } - public void setEntry(NotificationEntry entry) { - key = entry.key; - iconView.update(entry); - expandedView.update(entry); + void setEntry(NotificationEntry entry) { + if (mInflated) { + iconView.update(entry); + expandedView.update(entry); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 5acf3c24fd6a..418d052e1858 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -220,6 +220,26 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe mSurfaceSynchronizer = synchronizer; } + /** + * BubbleStackView is lazily created by this method the first time a Bubble is added. This + * method initializes the stack view and adds it to the StatusBar just above the scrim. + */ + private void ensureStackViewCreated() { + if (mStackView == null) { + mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer); + ViewGroup sbv = mStatusBarWindowController.getStatusBarView(); + // TODO(b/130237686): When you expand the shade on top of expanded bubble, there is no + // scrim between bubble and the shade + int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1; + sbv.addView(mStackView, bubblePosition, + new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); + if (mExpandListener != null) { + mStackView.setExpandListener(mExpandListener); + } + mStackView.setOnBlockedListener(this); + } + } + @Override public void onUiModeChanged() { if (mStackView != null) { @@ -325,27 +345,15 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe /** * Adds or updates a bubble associated with the provided notification entry. * - * @param notif the notification associated with this bubble. + * @param notif the notification associated with this bubble. */ void updateBubble(NotificationEntry notif) { if (mStackView != null && mBubbleData.getBubble(notif.key) != null) { // It's an update mStackView.updateBubble(notif); } else { - if (mStackView == null) { - mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer); - ViewGroup sbv = mStatusBarWindowController.getStatusBarView(); - // XXX: Bug when you expand the shade on top of expanded bubble, there is no scrim - // between bubble and the shade - int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1; - sbv.addView(mStackView, bubblePosition, - new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); - if (mExpandListener != null) { - mStackView.setExpandListener(mExpandListener); - } - mStackView.setOnBlockedListener(this); - } // It's new + ensureStackViewCreated(); mStackView.addBubble(notif); } if (shouldAutoExpand(notif)) { diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java index cf702870c4ff..fe3f9d192cd5 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java @@ -106,7 +106,7 @@ public class BubbleData { } public void addBubble(Bubble b) { - mBubbles.put(b.key, b); + mBubbles.put(b.getKey(), b); } @Nullable diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java index d1939d0fddb0..477e7d7ebf72 100644 --- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java +++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java @@ -85,9 +85,7 @@ class ImageProcessHelper { Bitmap bitmap = bitmaps[0]; if (bitmap != null) { int[] histogram = processHistogram(bitmap); - Float val = computePercentile85(bitmap, histogram); - bitmaps[0] = null; - return val; + return computePercentile85(bitmap, histogram); } Log.e(TAG, "Per85ComputeTask: Can't get bitmap"); return DEFAULT_PER85; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java index d40973bfdad7..a732a253f5a3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java @@ -40,7 +40,6 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.ImageView.ScaleType; import android.widget.Switch; import com.android.settingslib.Utils; @@ -63,6 +62,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { private boolean mTileState; private boolean mCollapsedView; private boolean mClicked; + private boolean mShowRippleEffect = true; private final ImageView mBg; private final int mColorActive; @@ -209,6 +209,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { mCircleColor = circleColor; } + mShowRippleEffect = state.showRippleEffect; setClickable(state.state != Tile.STATE_UNAVAILABLE); setLongClickable(state.handlesLongClick); mIcon.setIcon(state, allowAnimations); @@ -254,7 +255,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { @Override public void setClickable(boolean clickable) { super.setClickable(clickable); - setBackground(clickable ? mRipple : null); + setBackground(clickable && mShowRippleEffect ? mRipple : null); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java index c664a2090c04..d62f10d312d7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java @@ -16,6 +16,7 @@ package com.android.systemui.qs.tiles; import android.content.Intent; +import android.provider.Settings.Secure; import android.service.quicksettings.Tile; import android.widget.Switch; @@ -23,6 +24,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.R; import com.android.systemui.plugins.qs.QSTile.BooleanState; import com.android.systemui.qs.QSHost; +import com.android.systemui.qs.SecureSetting; import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.statusbar.policy.BatteryController; @@ -32,6 +34,7 @@ public class BatterySaverTile extends QSTileImpl<BooleanState> implements BatteryController.BatteryStateChangeCallback { private final BatteryController mBatteryController; + private final SecureSetting mSetting; private int mLevel; private boolean mPowerSave; @@ -45,6 +48,12 @@ public class BatterySaverTile extends QSTileImpl<BooleanState> implements super(host); mBatteryController = batteryController; mBatteryController.observe(getLifecycle(), this); + mSetting = new SecureSetting(mContext, mHandler, Secure.LOW_POWER_WARNING_ACKNOWLEDGED) { + @Override + protected void handleValueChanged(int value, boolean observedChange) { + handleRefreshState(null); + } + }; } @Override @@ -53,12 +62,19 @@ public class BatterySaverTile extends QSTileImpl<BooleanState> implements } @Override + protected void handleDestroy() { + super.handleDestroy(); + mSetting.setListening(false); + } + + @Override public int getMetricsCategory() { return MetricsEvent.QS_BATTERY_TILE; } @Override public void handleSetListening(boolean listening) { + mSetting.setListening(listening); } @Override @@ -88,6 +104,7 @@ public class BatterySaverTile extends QSTileImpl<BooleanState> implements state.contentDescription = state.label; state.value = mPowerSave; state.expandedAccessibilityClassName = Switch.class.getName(); + state.showRippleEffect = mSetting.getValue() == 0; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java index 34f3c606be62..33a2acfe9521 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java @@ -64,6 +64,7 @@ import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.system.ActivityManagerWrapper; +import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.TaskStackChangeListener; import java.io.PrintWriter; @@ -339,7 +340,7 @@ public class RecentsOnboarding { } public void onConnectedToLauncher() { - if (!ONBOARDING_ENABLED) { + if (!ONBOARDING_ENABLED || QuickStepContract.isGesturalMode(mContext)) { return; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index a87e50c50f51..3441591e03ff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -83,7 +83,7 @@ public class KeyguardIndicationController implements StateListener { private final int mSlowThreshold; private final int mFastThreshold; - private LockIcon mLockIcon; + private final LockIcon mLockIcon; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private String mRestingIndication; @@ -539,7 +539,6 @@ public class KeyguardIndicationController implements StateListener { protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { public static final int HIDE_DELAY_MS = 5000; - private int mLastSuccessiveErrorMessage = -1; @Override public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { @@ -577,20 +576,14 @@ public class KeyguardIndicationController implements StateListener { if (!updateMonitor.isUnlockingWithBiometricAllowed()) { return; } + animatePadlockError(); if (mStatusBarKeyguardViewManager.isBouncerShowing()) { mStatusBarKeyguardViewManager.showBouncerMessage(helpString, mInitialTextColorState); } else if (updateMonitor.isScreenOn()) { - mLockIcon.setTransientBiometricsError(true); showTransientIndication(helpString); hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); - mHandler.removeMessages(MSG_CLEAR_BIOMETRIC_MSG); - mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_BIOMETRIC_MSG), - TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); } - // Help messages indicate that there was actually a try since the last error, so those - // are not two successive error messages anymore. - mLastSuccessiveErrorMessage = -1; } @Override @@ -600,15 +593,9 @@ public class KeyguardIndicationController implements StateListener { if (shouldSuppressBiometricError(msgId, biometricSourceType, updateMonitor)) { return; } + animatePadlockError(); if (mStatusBarKeyguardViewManager.isBouncerShowing()) { - // When swiping up right after receiving a biometric error, the bouncer calls - // authenticate leading to the same message being shown again on the bouncer. - // We want to avoid this, as it may confuse the user when the message is too - // generic. - if (mLastSuccessiveErrorMessage != msgId) { - mStatusBarKeyguardViewManager.showBouncerMessage(errString, - mInitialTextColorState); - } + mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState); } else if (updateMonitor.isScreenOn()) { showTransientIndication(errString); // We want to keep this message around in case the screen was off @@ -616,7 +603,13 @@ public class KeyguardIndicationController implements StateListener { } else { mMessageToShowOnScreenOn = errString; } - mLastSuccessiveErrorMessage = msgId; + } + + private void animatePadlockError() { + mLockIcon.setTransientBiometricsError(true); + mHandler.removeMessages(MSG_CLEAR_BIOMETRIC_MSG); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_BIOMETRIC_MSG), + TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); } private boolean shouldSuppressBiometricError(int msgId, @@ -670,21 +663,19 @@ public class KeyguardIndicationController implements StateListener { @Override public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) { super.onBiometricAuthenticated(userId, biometricSourceType); - mLastSuccessiveErrorMessage = -1; mHandler.sendEmptyMessage(MSG_HIDE_TRANSIENT); } @Override - public void onBiometricAuthFailed(BiometricSourceType biometricSourceType) { - super.onBiometricAuthFailed(biometricSourceType); - mLastSuccessiveErrorMessage = -1; - } - - @Override public void onUserUnlocked() { if (mVisible) { updateIndication(false); } } + + @Override + public void onKeyguardBouncerChanged(boolean bouncer) { + mLockIcon.setBouncerVisible(bouncer); + } }; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java index 6ebd6b3f04cd..3cc4a7bfa1eb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java @@ -57,8 +57,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange private int mDensity; private boolean mPulsing; private boolean mDozing; + private boolean mBouncerVisible; private boolean mLastDozing; private boolean mLastPulsing; + private boolean mLastBouncerVisible; private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */); private float mDarkAmount; @@ -109,9 +111,9 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange int state = getState(); mIsFaceUnlockState = state == STATE_SCANNING_FACE; if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing - || mLastScreenOn != mScreenOn || force) { + || mLastScreenOn != mScreenOn || mLastBouncerVisible != mBouncerVisible || force) { int iconAnimRes = getAnimationResForTransition(mLastState, state, mLastPulsing, - mPulsing, mLastDozing, mDozing); + mPulsing, mLastDozing, mDozing, mBouncerVisible); boolean isAnim = iconAnimRes != -1; Drawable icon; @@ -159,6 +161,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange mLastScreenOn = mScreenOn; mLastDozing = mDozing; mLastPulsing = mPulsing; + mLastBouncerVisible = mBouncerVisible; } setVisibility(mDozing && !mPulsing ? GONE : VISIBLE); @@ -231,8 +234,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange } private static int getAnimationResForTransition(int oldState, int newState, - boolean wasPulsing, boolean pulsing, - boolean wasDozing, boolean dozing) { + boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing, + boolean bouncerVisible) { // Never animate when screen is off if (dozing && !pulsing) { @@ -249,7 +252,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange return com.android.internal.R.anim.lock_unlock; } else if (justLocked) { return com.android.internal.R.anim.lock_lock; - } else if (newState == STATE_SCANNING_FACE) { + } else if (newState == STATE_SCANNING_FACE && bouncerVisible) { return com.android.internal.R.anim.lock_scanning; } else if (!wasPulsing && pulsing && newState != STATE_LOCK_OPEN) { return com.android.internal.R.anim.lock_in; @@ -298,4 +301,15 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange int color = ColorUtils.blendARGB(Color.TRANSPARENT, Color.WHITE, mDarkAmount); drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); } + + /** + * If bouncer is visible or not. + */ + public void setBouncerVisible(boolean bouncerVisible) { + if (mBouncerVisible == bouncerVisible) { + return; + } + mBouncerVisible = bouncerVisible; + update(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index e2a63cc00d9e..835db6f532db 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -34,7 +34,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.pm.ParceledListSlice; import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Point; @@ -48,8 +47,6 @@ import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.view.Display; -import android.view.IPinnedStackController; -import android.view.IPinnedStackListener; import android.view.MotionEvent; import android.view.Surface; import android.view.View; @@ -237,45 +234,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav } }; - private final IPinnedStackListener.Stub mImeChangedListener = new IPinnedStackListener.Stub() { - @Override - public void onListenerRegistered(IPinnedStackController controller) { - } - - @Override - public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) { - post(() -> { - // TODO remove this and do below when mNavigationIconHints changes - if (imeVisible) { - getBackButton().setVisibility(VISIBLE); - reloadNavIcons(); - } else { - getImeSwitchButton().setVisibility(GONE); - } - mImeVisible = imeVisible; - updateWindowTouchable(); - }); - } - - @Override - public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight) { - } - - @Override - public void onMinimizedStateChanged(boolean isMinimized) { - } - - @Override - public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, - Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment, - int displayRotation) { - } - - @Override - public void onActionsChanged(ParceledListSlice actions) { - } - }; - private BroadcastReceiver mOverlaysChangedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -507,9 +465,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav final boolean useAltBack = (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; final boolean isRtl = mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; - float degrees = useAltBack - ? (isRtl ? 270 : -90) - : (isRtl ? 180 : 0); + float degrees = useAltBack ? (isRtl ? 90 : -90) : 0; if (drawable.getRotation() == degrees) { return; } @@ -559,10 +515,13 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav public void setNavigationIconHints(int hints) { if (hints == mNavigationIconHints) return; - final boolean backAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; - if ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0 && !backAlt) { - mTransitionListener.onBackAltCleared(); + final boolean newBackAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; + final boolean oldBackAlt = + (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; + if (newBackAlt != oldBackAlt) { + onImeVisibilityChanged(newBackAlt); } + if (DEBUG) { android.widget.Toast.makeText(getContext(), "Navigation icon hints = " + hints, @@ -572,6 +531,14 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav updateNavButtonIcons(); } + private void onImeVisibilityChanged(boolean visible) { + if (!visible) { + mTransitionListener.onBackAltCleared(); + } + mImeVisible = visible; + updateWindowTouchable(); + } + public void setDisabledFlags(int disabledFlags) { if (mDisabledFlags == disabledFlags) return; @@ -1114,14 +1081,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav filter.addDataScheme("package"); getContext().registerReceiver(mOverlaysChangedReceiver, filter); mEdgeBackGestureHandler.onNavBarAttached(); - - if (QuickStepContract.isGesturalMode(getContext())) { - try { - WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener); - } catch (RemoteException e) { - Log.e(TAG, "Failed to register pinned stack listener", e); - } - } updateWindowTouchable(); } @@ -1139,8 +1098,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav getContext().unregisterReceiver(mOverlaysChangedReceiver); mEdgeBackGestureHandler.onNavBarDetached(); - - WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener); } private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java index 03c89c60360f..dd0c3443f2ab 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java @@ -37,6 +37,7 @@ import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.util.FloatProperty; import android.view.ContextThemeWrapper; +import android.view.View; import com.android.settingslib.Utils; import com.android.systemui.R; @@ -79,9 +80,10 @@ public class KeyButtonDrawable extends Drawable { private final ShadowDrawableState mState; private AnimatedVectorDrawable mAnimatedDrawable; - public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor) { + public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor, + boolean horizontalFlip) { this(d, new ShadowDrawableState(lightColor, darkColor, - d instanceof AnimatedVectorDrawable)); + d instanceof AnimatedVectorDrawable, horizontalFlip)); } private KeyButtonDrawable(Drawable d, ShadowDrawableState state) { @@ -282,7 +284,12 @@ public class KeyButtonDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); setDrawableBounds(d); + canvas.save(); + if (mState.mHorizontalFlip) { + canvas.scale(-1f, 1f, width * 0.5f, height * 0.5f); + } d.draw(canvas); + canvas.restore(); if (mState.mIsHardwareBitmap) { bitmap = bitmap.copy(Bitmap.Config.HARDWARE, false); @@ -305,7 +312,12 @@ public class KeyButtonDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); setDrawableBounds(d); + canvas.save(); + if (mState.mHorizontalFlip) { + canvas.scale(-1f, 1f, width * 0.5f, height * 0.5f); + } d.draw(canvas); + canvas.restore(); // Draws the shadow from original drawable Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); @@ -357,6 +369,7 @@ public class KeyButtonDrawable extends Drawable { int mShadowColor; float mDarkIntensity; int mAlpha; + boolean mHorizontalFlip; boolean mIsHardwareBitmap; Bitmap mLastDrawnIcon; @@ -368,11 +381,12 @@ public class KeyButtonDrawable extends Drawable { final boolean mSupportsAnimation; public ShadowDrawableState(@ColorInt int lightColor, @ColorInt int darkColor, - boolean animated) { + boolean animated, boolean horizontalFlip) { mLightColor = lightColor; mDarkColor = darkColor; mSupportsAnimation = animated; mAlpha = 255; + mHorizontalFlip = horizontalFlip; } @Override @@ -400,7 +414,7 @@ public class KeyButtonDrawable extends Drawable { * @return KeyButtonDrawable */ public static KeyButtonDrawable create(@NonNull Context ctx, @DrawableRes int icon, - boolean hasShadow) { + boolean hasShadow) { final int dualToneDarkTheme = Utils.getThemeAttr(ctx, R.attr.darkIconTheme); final int dualToneLightTheme = Utils.getThemeAttr(ctx, R.attr.lightIconTheme); Context lightContext = new ContextThemeWrapper(ctx, dualToneLightTheme); @@ -409,7 +423,7 @@ public class KeyButtonDrawable extends Drawable { } public static KeyButtonDrawable create(Context lightContext, Context darkContext, - @DrawableRes int iconResId, boolean hasShadow) { + @DrawableRes int iconResId, boolean hasShadow) { return create(lightContext, Utils.getColorAttrDefaultColor(lightContext, R.attr.singleToneColor), Utils.getColorAttrDefaultColor(darkContext, R.attr.singleToneColor), @@ -418,10 +432,12 @@ public class KeyButtonDrawable extends Drawable { public static KeyButtonDrawable create(Context context, @ColorInt int lightColor, @ColorInt int darkColor, @DrawableRes int iconResId, boolean hasShadow) { - final KeyButtonDrawable drawable = new KeyButtonDrawable(context.getDrawable(iconResId), - lightColor, darkColor); + final Resources res = context.getResources(); + boolean isRtl = res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; + Drawable d = context.getDrawable(iconResId); + final KeyButtonDrawable drawable = new KeyButtonDrawable(d, lightColor, darkColor, + isRtl && d.isAutoMirrored()); if (hasShadow) { - final Resources res = context.getResources(); int offsetX = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_x); int offsetY = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_y); int radius = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_radius); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index c5996a1e1b00..8f135c80a1d0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -47,6 +47,8 @@ import com.android.systemui.statusbar.policy.NetworkControllerImpl.SubscriptionD import java.io.PrintWriter; import java.util.BitSet; import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class MobileSignalController extends SignalController< @@ -73,6 +75,9 @@ public class MobileSignalController extends SignalController< private SignalStrength mSignalStrength; private MobileIconGroup mDefaultIcons; private Config mConfig; + private boolean mInflateSignalStrengths = false; + // Some specific carriers have 5GE network which is special LTE CA network. + private static final int NETWORK_TYPE_LTE_CA_5GE = TelephonyManager.MAX_NETWORK_TYPE + 1; // TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't // need listener lists anymore. @@ -114,6 +119,7 @@ public class MobileSignalController extends SignalController< public void setConfiguration(Config config) { mConfig = config; + updateInflateSignalStrength(); mapIconSets(); updateTelephony(); } @@ -236,11 +242,19 @@ public class MobileSignalController extends SignalController< TelephonyIcons.LTE_PLUS); } } + mNetworkToIconLookup.put(NETWORK_TYPE_LTE_CA_5GE, + TelephonyIcons.LTE_CA_5G_E); mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_IWLAN, TelephonyIcons.WFC); } + private void updateInflateSignalStrength() { + mInflateSignalStrengths = SubscriptionManager.getResourcesForSubId(mContext, + mSubscriptionInfo.getSubscriptionId()) + .getBoolean(R.bool.config_inflateSignalStrength); + } + private int getNumLevels() { - if (mConfig.inflateSignalStrengths) { + if (mInflateSignalStrengths) { return SignalStrength.NUM_SIGNAL_STRENGTH_BINS + 1; } return SignalStrength.NUM_SIGNAL_STRENGTH_BINS; @@ -252,7 +266,7 @@ public class MobileSignalController extends SignalController< return SignalDrawable.getCarrierChangeState(getNumLevels()); } else if (mCurrentState.connected) { int level = mCurrentState.level; - if (mConfig.inflateSignalStrengths) { + if (mInflateSignalStrengths) { level++; } boolean dataDisabled = mCurrentState.userSetup @@ -381,6 +395,26 @@ public class MobileSignalController extends SignalController< } } + private boolean isCarrierSpecificDataIcon() { + if (mConfig.patternOfCarrierSpecificDataIcon == null + || mConfig.patternOfCarrierSpecificDataIcon.length() == 0) { + return false; + } + + Pattern stringPattern = Pattern.compile(mConfig.patternOfCarrierSpecificDataIcon); + String[] operatorNames = new String[]{mServiceState.getOperatorAlphaLongRaw(), + mServiceState.getOperatorAlphaShortRaw()}; + for (String opName : operatorNames) { + if (!TextUtils.isEmpty(opName)) { + Matcher matcher = stringPattern.matcher(opName); + if (matcher.find()) { + return true; + } + } + } + return false; + } + /** * Updates the network's name based on incoming spn and plmn. */ @@ -535,6 +569,7 @@ public class MobileSignalController extends SignalController< pw.println(" mSignalStrength=" + mSignalStrength + ","); pw.println(" mDataState=" + mDataState + ","); pw.println(" mDataNetType=" + mDataNetType + ","); + pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ","); } class MobilePhoneStateListener extends PhoneStateListener { @@ -559,12 +594,8 @@ public class MobileSignalController extends SignalController< + " dataState=" + state.getDataRegState()); } mServiceState = state; - if (state != null) { - mDataNetType = state.getDataNetworkType(); - if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE && mServiceState != null && - mServiceState.isUsingCarrierAggregation()) { - mDataNetType = TelephonyManager.NETWORK_TYPE_LTE_CA; - } + if (mServiceState != null) { + updateDataNetType(mServiceState.getDataNetworkType()); } updateTelephony(); } @@ -576,12 +607,19 @@ public class MobileSignalController extends SignalController< + " type=" + networkType); } mDataState = state; + updateDataNetType(networkType); + updateTelephony(); + } + + private void updateDataNetType(int networkType) { mDataNetType = networkType; - if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE && mServiceState != null && - mServiceState.isUsingCarrierAggregation()) { - mDataNetType = TelephonyManager.NETWORK_TYPE_LTE_CA; + if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE) { + if (isCarrierSpecificDataIcon()) { + mDataNetType = NETWORK_TYPE_LTE_CA_5GE; + } else if (mServiceState != null && mServiceState.isUsingCarrierAggregation()) { + mDataNetType = TelephonyManager.NETWORK_TYPE_LTE_CA; + } } - updateTelephony(); } @Override 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 d01430a97783..faf63c838259 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -55,6 +55,7 @@ import android.util.Log; import android.util.MathUtils; import android.util.SparseArray; +import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; @@ -108,16 +109,10 @@ public class NetworkControllerImpl extends BroadcastReceiver private final SubscriptionDefaults mSubDefaults; private final DataSaverController mDataSaverController; private final CurrentUserTracker mUserTracker; + private final Object mLock = new Object(); private Config mConfig; - private PhoneStateListener mPhoneStateListener = new PhoneStateListener() { - @Override - public void onActiveDataSubscriptionIdChanged(int subId) { - mActiveMobileDataSubscription = subId; - doUpdateMobileControllers(); - } - }; - + private PhoneStateListener mPhoneStateListener; private int mActiveMobileDataSubscription = SubscriptionManager.INVALID_SUBSCRIPTION_ID; // Subcontrollers. @@ -279,6 +274,14 @@ public class NetworkControllerImpl extends BroadcastReceiver // TODO: Move off of the deprecated CONNECTIVITY_ACTION broadcast and rely on callbacks // exclusively for status bar icons. mConnectivityManager.registerDefaultNetworkCallback(callback, mReceiverHandler); + // Register the listener on our bg looper + mPhoneStateListener = new PhoneStateListener(bgLooper) { + @Override + public void onActiveDataSubscriptionIdChanged(int subId) { + mActiveMobileDataSubscription = subId; + doUpdateMobileControllers(); + } + }; } public DataSaverController getDataSaverController() { @@ -600,7 +603,9 @@ public class NetworkControllerImpl extends BroadcastReceiver updateNoSims(); return; } - setCurrentSubscriptions(subscriptions); + synchronized (mLock) { + setCurrentSubscriptionsLocked(subscriptions); + } updateNoSims(); recalculateEmergency(); } @@ -628,8 +633,9 @@ public class NetworkControllerImpl extends BroadcastReceiver return false; } + @GuardedBy("mLock") @VisibleForTesting - void setCurrentSubscriptions(List<SubscriptionInfo> subscriptions) { + public void setCurrentSubscriptionsLocked(List<SubscriptionInfo> subscriptions) { Collections.sort(subscriptions, new Comparator<SubscriptionInfo>() { @Override public int compare(SubscriptionInfo lhs, SubscriptionInfo rhs) { @@ -1102,6 +1108,7 @@ public class NetworkControllerImpl extends BroadcastReceiver boolean hspaDataDistinguishable; boolean inflateSignalStrengths = false; boolean alwaysShowDataRatIcon = false; + public String patternOfCarrierSpecificDataIcon = ""; /** * Mapping from NR 5G status string to an integer. The NR 5G status string should match @@ -1140,6 +1147,8 @@ public class NetworkControllerImpl extends BroadcastReceiver CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL); config.hideLtePlus = b.getBoolean( CarrierConfigManager.KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL); + config.patternOfCarrierSpecificDataIcon = b.getString( + CarrierConfigManager.KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING); String nr5GIconConfiguration = b.getString(CarrierConfigManager.KEY_5G_ICON_CONFIGURATION_STRING); if (!TextUtils.isEmpty(nr5GIconConfiguration)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java index e151ca3e23f3..c22ff8ba594b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java @@ -35,6 +35,7 @@ class TelephonyIcons { static final int ICON_3G = R.drawable.ic_3g_mobiledata; static final int ICON_4G = R.drawable.ic_4g_mobiledata; static final int ICON_4G_PLUS = R.drawable.ic_4g_plus_mobiledata; + static final int ICON_5G_E = R.drawable.ic_5g_e_mobiledata; static final int ICON_1X = R.drawable.ic_1x_mobiledata; static final int ICON_5G = R.drawable.ic_5g_mobiledata; static final int ICON_5G_PLUS = R.drawable.ic_5g_plus_mobiledata; @@ -204,6 +205,19 @@ class TelephonyIcons { TelephonyIcons.ICON_LTE_PLUS, true); + static final MobileIconGroup LTE_CA_5G_E = new MobileIconGroup( + "5Ge", + null, + null, + AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH, + 0, 0, + 0, + 0, + AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0], + R.string.data_connection_5ge, + TelephonyIcons.ICON_5G_E, + true); + static final MobileIconGroup NR_5G = new MobileIconGroup( "5G", null, @@ -276,6 +290,7 @@ class TelephonyIcons { ICON_NAME_TO_ICON.put("h+", H_PLUS); ICON_NAME_TO_ICON.put("4g", FOUR_G); ICON_NAME_TO_ICON.put("4g+", FOUR_G_PLUS); + ICON_NAME_TO_ICON.put("5ge", LTE_CA_5G_E); ICON_NAME_TO_ICON.put("lte", LTE); ICON_NAME_TO_ICON.put("lte+", LTE_PLUS); ICON_NAME_TO_ICON.put("5g", NR_5G); diff --git a/packages/SystemUI/src/com/android/systemui/volume/Events.java b/packages/SystemUI/src/com/android/systemui/volume/Events.java index 2a84c5d4d44d..9bbfd224079c 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/Events.java +++ b/packages/SystemUI/src/com/android/systemui/volume/Events.java @@ -94,7 +94,6 @@ public class Events { public static final int DISMISS_STREAM_GONE = 7; public static final int DISMISS_REASON_OUTPUT_CHOOSER = 8; public static final int DISMISS_REASON_USB_OVERHEAD_ALARM_CHANGED = 9; - public static final int DISMISS_REASON_ODI_CAPTIONS_CLICKED = 10; public static final String[] DISMISS_REASONS = { "unknown", "touch_outside", @@ -105,8 +104,7 @@ public class Events { "done_clicked", "a11y_stream_changed", "output_chooser", - "usb_temperature_below_threshold", - "odi_captions_clicked" + "usb_temperature_below_threshold" }; public static final int SHOW_REASON_UNKNOWN = 0; diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 2094b36d8294..509537089bf8 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -30,7 +30,6 @@ import static android.view.View.GONE; import static android.view.View.VISIBLE; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; -import static com.android.systemui.volume.Events.DISMISS_REASON_ODI_CAPTIONS_CLICKED; import static com.android.systemui.volume.Events.DISMISS_REASON_SETTINGS_CLICKED; import android.animation.ObjectAnimator; @@ -519,7 +518,6 @@ public class VolumeDialogImpl implements VolumeDialog, mODICaptionsIcon.setOnConfirmedTapListener(() -> { onCaptionIconClicked(); Events.writeEvent(mContext, Events.EVENT_ODI_CAPTIONS_CLICK); - dismissH(DISMISS_REASON_ODI_CAPTIONS_CLICKED); }, mHandler); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java index e3c081ea2a67..c837c9ccea95 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java @@ -179,8 +179,10 @@ public class NavigationBarContextTest extends SysuiTestCase { final int unusedColor = 0; final Drawable d = mock(Drawable.class); final ContextualButton button = spy(mBtn0); - final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor)); - final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor)); + final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor, + false /* horizontalFlip */)); + final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor, + false /* horizontalFlip */)); kbd1.setDarkIntensity(TEST_DARK_INTENSITY); kbd2.setDarkIntensity(0f); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java index ac6544e129b4..0b53c486356f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java @@ -300,7 +300,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest { // We can only test whether unregister gets called if it thinks its in a listening // state. mNetworkController.mListening = true; - mNetworkController.setCurrentSubscriptions(subscriptions); + mNetworkController.setCurrentSubscriptionsLocked(subscriptions); for (int i = 0; i < testSubscriptions.length; i++) { if (i == indexToSkipController) { diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java index a3e7d3685100..54a3ecb22687 100644 --- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java @@ -166,6 +166,9 @@ public class CompanionDeviceManagerService extends SystemService implements Bind @Override public void onUnlockUser(int userHandle) { Set<Association> associations = readAllAssociations(userHandle); + if (associations == null || associations.isEmpty()) { + return; + } Set<String> companionAppPackages = new HashSet<>(); for (Association association : associations) { companionAppPackages.add(association.companionAppPackage); diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index d073bc60c766..4c3bb8c07728 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -1840,11 +1840,14 @@ public class AppOpsService extends IAppOpsService.Stub { } private boolean isPackageSuspendedForUser(String pkg, int uid) { + final long identity = Binder.clearCallingIdentity(); try { return AppGlobals.getPackageManager().isPackageSuspendedForUser( pkg, UserHandle.getUserId(uid)); } catch (RemoteException re) { throw new SecurityException("Could not talk to package manager service"); + } finally { + Binder.restoreCallingIdentity(identity); } } diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 3fc2d3712fed..39dae0b139ad 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -3368,8 +3368,14 @@ public class AudioService extends IAudioService.Stub .append(Binder.getCallingPid()).toString(); final boolean stateChanged = mDeviceBroker.setSpeakerphoneOn(on, eventSource); if (stateChanged) { - mContext.sendBroadcast(new Intent(AudioManager.ACTION_SPEAKERPHONE_STATE_CHANGED) - .setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY)); + final long ident = Binder.clearCallingIdentity(); + try { + mContext.sendBroadcastAsUser( + new Intent(AudioManager.ACTION_SPEAKERPHONE_STATE_CHANGED) + .setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY), UserHandle.ALL); + } finally { + Binder.restoreCallingIdentity(ident); + } } } diff --git a/services/core/java/com/android/server/biometrics/AuthenticationClient.java b/services/core/java/com/android/server/biometrics/AuthenticationClient.java index 7d4ac592a9df..f7278d2601c3 100644 --- a/services/core/java/com/android/server/biometrics/AuthenticationClient.java +++ b/services/core/java/com/android/server/biometrics/AuthenticationClient.java @@ -129,13 +129,16 @@ public abstract class AuthenticationClient extends ClientMonitor { boolean result = false; try { + if (DEBUG) Slog.v(getLogTag(), "onAuthenticated(" + authenticated + ")" + + ", ID:" + identifier.getBiometricId() + + ", Owner: " + getOwnerString() + + ", isBP: " + isBiometricPrompt() + + ", listener: " + listener + + ", requireConfirmation: " + mRequireConfirmation); + if (authenticated) { mAlreadyDone = true; - if (DEBUG) Slog.v(getLogTag(), "onAuthenticated(" + getOwnerString() - + ", ID:" + identifier.getBiometricId() - + ", isBP: " + isBiometricPrompt() - + ", listener: " + listener - + ", requireConfirmation: " + mRequireConfirmation); + if (listener != null) { vibrateSuccess(); } diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java index 843ecac14b62..153133a6c669 100644 --- a/services/core/java/com/android/server/biometrics/BiometricService.java +++ b/services/core/java/com/android/server/biometrics/BiometricService.java @@ -41,6 +41,7 @@ import android.hardware.biometrics.BiometricConstants; import android.hardware.biometrics.BiometricPrompt; import android.hardware.biometrics.BiometricSourceType; import android.hardware.biometrics.BiometricsProtoEnums; +import android.hardware.biometrics.IBiometricConfirmDeviceCredentialCallback; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricService; import android.hardware.biometrics.IBiometricServiceReceiver; @@ -85,6 +86,7 @@ import java.util.Random; public class BiometricService extends SystemService { private static final String TAG = "BiometricService"; + private static final boolean DEBUG = true; private static final int MSG_ON_TASK_STACK_CHANGED = 1; private static final int MSG_ON_AUTHENTICATION_SUCCEEDED = 2; @@ -96,6 +98,9 @@ public class BiometricService extends SystemService { private static final int MSG_ON_READY_FOR_AUTHENTICATION = 8; private static final int MSG_AUTHENTICATE = 9; private static final int MSG_CANCEL_AUTHENTICATION = 10; + private static final int MSG_ON_CONFIRM_DEVICE_CREDENTIAL_SUCCESS = 11; + private static final int MSG_ON_CONFIRM_DEVICE_CREDENTIAL_ERROR = 12; + private static final int MSG_REGISTER_CANCELLATION_CALLBACK = 13; private static final int[] FEATURE_ID = { TYPE_FINGERPRINT, @@ -128,8 +133,12 @@ public class BiometricService extends SystemService { * Authentication is successful, but we're waiting for the user to press "confirm" button. */ private static final int STATE_AUTH_PENDING_CONFIRM = 5; + /** + * Biometric authentication was canceled, but the device is now showing ConfirmDeviceCredential + */ + private static final int STATE_BIOMETRIC_AUTH_CANCELED_SHOWING_CDC = 6; - private final class AuthSession { + private final class AuthSession implements IBinder.DeathRecipient { // Map of Authenticator/Cookie pairs. We expect to receive the cookies back from // <Biometric>Services before we can start authenticating. Pairs that have been returned // are moved to mModalitiesMatched. @@ -164,10 +173,14 @@ public class BiometricService extends SystemService { // Timestamp when hardware authentication occurred private long mAuthenticatedTimeMs; + // TODO(b/123378871): Remove when moved. + private IBiometricConfirmDeviceCredentialCallback mConfirmDeviceCredentialCallback; + AuthSession(HashMap<Integer, Integer> modalities, IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle, int callingUid, int callingPid, int callingUserId, - int modality, boolean requireConfirmation) { + int modality, boolean requireConfirmation, + IBiometricConfirmDeviceCredentialCallback callback) { mModalitiesWaiting = modalities; mToken = token; mSessionId = sessionId; @@ -180,12 +193,25 @@ public class BiometricService extends SystemService { mCallingUserId = callingUserId; mModality = modality; mRequireConfirmation = requireConfirmation; + mConfirmDeviceCredentialCallback = callback; + + if (isFromConfirmDeviceCredential()) { + try { + token.linkToDeath(this, 0 /* flags */); + } catch (RemoteException e) { + Slog.e(TAG, "Unable to link to death", e); + } + } } boolean isCrypto() { return mSessionId != 0; } + boolean isFromConfirmDeviceCredential() { + return mBundle.getBoolean(BiometricPrompt.KEY_FROM_CONFIRM_DEVICE_CREDENTIAL, false); + } + boolean containsCookie(int cookie) { if (mModalitiesWaiting != null && mModalitiesWaiting.containsValue(cookie)) { return true; @@ -195,6 +221,25 @@ public class BiometricService extends SystemService { } return false; } + + // TODO(b/123378871): Remove when moved. + @Override + public void binderDied() { + mHandler.post(() -> { + Slog.e(TAG, "Binder died, killing ConfirmDeviceCredential"); + if (mConfirmDeviceCredentialCallback == null) { + Slog.e(TAG, "Callback is null"); + return; + } + + try { + mConfirmDeviceCredentialCallback.cancel(); + mConfirmDeviceCredentialCallback = null; + } catch (RemoteException e) { + Slog.e(TAG, "Unable to send cancel", e); + } + }); + } } private final class BiometricTaskStackListener extends TaskStackListener { @@ -234,6 +279,14 @@ public class BiometricService extends SystemService { private AuthSession mCurrentAuthSession; private AuthSession mPendingAuthSession; + // TODO(b/123378871): Remove when moved. + // When BiometricPrompt#setAllowDeviceCredentials is set to true, we need to store the + // client (app) receiver. BiometricService internally launches CDCA which invokes + // BiometricService to start authentication (normal path). When auth is success/rejected, + // CDCA will use an aidl method to poke BiometricService - the result will then be forwarded + // to this receiver. + private IBiometricServiceReceiver mConfirmDeviceCredentialReceiver; + private final Handler mHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { @@ -311,7 +364,8 @@ public class BiometricService extends SystemService { (Bundle) args.arg5 /* bundle */, args.argi2 /* callingUid */, args.argi3 /* callingPid */, - args.argi4 /* callingUserId */); + args.argi4 /* callingUserId */, + (IBiometricConfirmDeviceCredentialCallback) args.arg6 /* callback */); args.recycle(); break; } @@ -325,7 +379,28 @@ public class BiometricService extends SystemService { break; } + case MSG_ON_CONFIRM_DEVICE_CREDENTIAL_SUCCESS: { + handleOnConfirmDeviceCredentialSuccess(); + break; + } + + case MSG_ON_CONFIRM_DEVICE_CREDENTIAL_ERROR: { + SomeArgs args = (SomeArgs) msg.obj; + handleOnConfirmDeviceCredentialError( + args.argi1 /* error */, + (String) args.arg1 /* errorMsg */); + args.recycle(); + break; + } + + case MSG_REGISTER_CANCELLATION_CALLBACK: { + handleRegisterCancellationCallback( + (IBiometricConfirmDeviceCredentialCallback) msg.obj /* callback */); + break; + } + default: + Slog.e(TAG, "Unknown message: " + msg); break; } } @@ -533,14 +608,6 @@ public class BiometricService extends SystemService { * cancelAuthentication() can go to the right place. */ private final class BiometricServiceWrapper extends IBiometricService.Stub { - // TODO(b/123378871): Remove when moved. - // When BiometricPrompt#setAllowDeviceCredentials is set to true, we need to store the - // client (app) receiver. BiometricService internally launches CDCA which invokes - // BiometricService to start authentication (normal path). When auth is success/rejected, - // CDCA will use an aidl method to poke BiometricService - the result will then be forwarded - // to this receiver. - private IBiometricServiceReceiver mConfirmDeviceCredentialReceiver; - @Override // Binder call public void onReadyForAuthentication(int cookie, boolean requireConfirmation, int userId) { checkInternalPermission(); @@ -554,12 +621,18 @@ public class BiometricService extends SystemService { @Override // Binder call public void authenticate(IBinder token, long sessionId, int userId, - IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle) + IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle, + IBiometricConfirmDeviceCredentialCallback callback) throws RemoteException { final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); final int callingUserId = UserHandle.getCallingUserId(); + // TODO(b/123378871): Remove when moved. + if (callback != null) { + checkInternalPermission(); + } + // In the BiometricServiceBase, check do the AppOps and foreground check. if (userId == callingUserId) { // Check the USE_BIOMETRIC permission here. @@ -576,6 +649,12 @@ public class BiometricService extends SystemService { return; } + final boolean isFromConfirmDeviceCredential = + bundle.getBoolean(BiometricPrompt.KEY_FROM_CONFIRM_DEVICE_CREDENTIAL, false); + if (isFromConfirmDeviceCredential) { + checkInternalPermission(); + } + // Check the usage of this in system server. Need to remove this check if it becomes // a public API. final boolean useDefaultTitle = @@ -632,6 +711,7 @@ public class BiometricService extends SystemService { args.argi2 = callingUid; args.argi3 = callingPid; args.argi4 = callingUserId; + args.arg6 = callback; mHandler.obtainMessage(MSG_AUTHENTICATE, args).sendToTarget(); } @@ -639,35 +719,30 @@ public class BiometricService extends SystemService { @Override // Binder call public void onConfirmDeviceCredentialSuccess() { checkInternalPermission(); - mHandler.post(() -> { - if (mConfirmDeviceCredentialReceiver == null) { - Slog.w(TAG, "onCDCASuccess null!"); - return; - } - try { - mConfirmDeviceCredentialReceiver.onAuthenticationSucceeded(); - } catch (RemoteException e) { - Slog.e(TAG, "RemoteException", e); - } - mConfirmDeviceCredentialReceiver = null; - }); + + mHandler.sendEmptyMessage(MSG_ON_CONFIRM_DEVICE_CREDENTIAL_SUCCESS); } @Override // Binder call public void onConfirmDeviceCredentialError(int error, String message) { checkInternalPermission(); - mHandler.post(() -> { - if (mConfirmDeviceCredentialReceiver == null) { - Slog.w(TAG, "onCDCAError null! Error: " + error + " " + message); - return; - } - try { - mConfirmDeviceCredentialReceiver.onError(error, message); - } catch (RemoteException e) { - Slog.e(TAG, "RemoteException", e); - } - mConfirmDeviceCredentialReceiver = null; - }); + + SomeArgs args = SomeArgs.obtain(); + args.argi1 = error; + args.arg1 = message; + mHandler.obtainMessage(MSG_ON_CONFIRM_DEVICE_CREDENTIAL_ERROR, args).sendToTarget(); + } + + @Override // Binder call + public void registerCancellationCallback( + IBiometricConfirmDeviceCredentialCallback callback) { + // TODO(b/123378871): Remove when moved. + // This callback replaces the one stored in the current session. If the session is null + // we can ignore this, since it means ConfirmDeviceCredential was launched by something + // else (not BiometricPrompt) + checkInternalPermission(); + + mHandler.obtainMessage(MSG_REGISTER_CANCELLATION_CALLBACK, callback).sendToTarget(); } @Override // Binder call @@ -1104,6 +1179,52 @@ public class BiometricService extends SystemService { } } + private void handleOnConfirmDeviceCredentialSuccess() { + if (mConfirmDeviceCredentialReceiver == null) { + Slog.w(TAG, "onCDCASuccess null!"); + return; + } + try { + mActivityTaskManager.unregisterTaskStackListener(mTaskStackListener); + mConfirmDeviceCredentialReceiver.onAuthenticationSucceeded(); + if (mCurrentAuthSession != null) { + mCurrentAuthSession.mState = STATE_AUTH_IDLE; + mCurrentAuthSession = null; + } + } catch (RemoteException e) { + Slog.e(TAG, "RemoteException", e); + } + mConfirmDeviceCredentialReceiver = null; + } + + private void handleOnConfirmDeviceCredentialError(int error, String message) { + if (mConfirmDeviceCredentialReceiver == null) { + Slog.w(TAG, "onCDCAError null! Error: " + error + " " + message); + return; + } + try { + mActivityTaskManager.unregisterTaskStackListener(mTaskStackListener); + mConfirmDeviceCredentialReceiver.onError(error, message); + if (mCurrentAuthSession != null) { + mCurrentAuthSession.mState = STATE_AUTH_IDLE; + mCurrentAuthSession = null; + } + } catch (RemoteException e) { + Slog.e(TAG, "RemoteException", e); + } + mConfirmDeviceCredentialReceiver = null; + } + + private void handleRegisterCancellationCallback( + IBiometricConfirmDeviceCredentialCallback callback) { + if (mCurrentAuthSession == null) { + Slog.d(TAG, "Current auth session null"); + return; + } + Slog.d(TAG, "Updating cancel callback"); + mCurrentAuthSession.mConfirmDeviceCredentialCallback = callback; + } + private void handleOnError(int cookie, int error, String message) { Slog.d(TAG, "Error: " + error + " cookie: " + cookie); // Errors can either be from the current auth session or the pending auth session. @@ -1114,7 +1235,18 @@ public class BiometricService extends SystemService { // of their intended receivers. try { if (mCurrentAuthSession != null && mCurrentAuthSession.containsCookie(cookie)) { - if (mCurrentAuthSession.mState == STATE_AUTH_STARTED) { + + if (mCurrentAuthSession.isFromConfirmDeviceCredential()) { + // If we were invoked by ConfirmDeviceCredential, do not delete the current + // auth session since we still need to respond to cancel signal while + if (DEBUG) Slog.d(TAG, "From CDC, transition to CANCELED_SHOWING_CDC state"); + + // Send the error to ConfirmDeviceCredential so that it goes to Pin/Pattern/Pass + // screen + mCurrentAuthSession.mClientReceiver.onError(error, message); + mCurrentAuthSession.mState = STATE_BIOMETRIC_AUTH_CANCELED_SHOWING_CDC; + mStatusBarService.hideBiometricDialog(); + } else if (mCurrentAuthSession.mState == STATE_AUTH_STARTED) { mStatusBarService.onBiometricError(message); if (error == BiometricConstants.BIOMETRIC_ERROR_CANCELED) { mActivityTaskManager.unregisterTaskStackListener( @@ -1214,9 +1346,16 @@ public class BiometricService extends SystemService { KeyStore.getInstance().addAuthToken(mCurrentAuthSession.mTokenEscrow); mCurrentAuthSession.mClientReceiver.onAuthenticationSucceeded(); } - mActivityTaskManager.unregisterTaskStackListener(mTaskStackListener); - mCurrentAuthSession.mState = STATE_AUTH_IDLE; - mCurrentAuthSession = null; + + // Do not clean up yet if we are from ConfirmDeviceCredential. We should be in the + // STATE_BIOMETRIC_AUTH_CANCELED_SHOWING_CDC. The session should only be removed when + // ConfirmDeviceCredential is confirmed or canceled. + // TODO(b/123378871): Remove when moved + if (!mCurrentAuthSession.isFromConfirmDeviceCredential()) { + mActivityTaskManager.unregisterTaskStackListener(mTaskStackListener); + mCurrentAuthSession.mState = STATE_AUTH_IDLE; + mCurrentAuthSession = null; + } } catch (RemoteException e) { Slog.e(TAG, "Remote exception", e); } @@ -1235,7 +1374,8 @@ public class BiometricService extends SystemService { mCurrentAuthSession.mCallingUid, mCurrentAuthSession.mCallingPid, mCurrentAuthSession.mCallingUserId, - mCurrentAuthSession.mModality); + mCurrentAuthSession.mModality, + mCurrentAuthSession.mConfirmDeviceCredentialCallback); } private void handleOnReadyForAuthentication(int cookie, boolean requireConfirmation, @@ -1290,7 +1430,8 @@ public class BiometricService extends SystemService { private void handleAuthenticate(IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle, - int callingUid, int callingPid, int callingUserId) { + int callingUid, int callingPid, int callingUserId, + IBiometricConfirmDeviceCredentialCallback callback) { mHandler.post(() -> { final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId); @@ -1328,7 +1469,7 @@ public class BiometricService extends SystemService { // Start preparing for authentication. Authentication starts when // all modalities requested have invoked onReadyForAuthentication. authenticateInternal(token, sessionId, userId, receiver, opPackageName, bundle, - callingUid, callingPid, callingUserId, modality); + callingUid, callingPid, callingUserId, modality, callback); }); } @@ -1343,7 +1484,8 @@ public class BiometricService extends SystemService { */ private void authenticateInternal(IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle, - int callingUid, int callingPid, int callingUserId, int modality) { + int callingUid, int callingPid, int callingUserId, int modality, + IBiometricConfirmDeviceCredentialCallback callback) { try { boolean requireConfirmation = bundle.getBoolean( BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true /* default */); @@ -1363,7 +1505,7 @@ public class BiometricService extends SystemService { authenticators.put(modality, cookie); mPendingAuthSession = new AuthSession(authenticators, token, sessionId, userId, receiver, opPackageName, bundle, callingUid, callingPid, callingUserId, - modality, requireConfirmation); + modality, requireConfirmation, callback); mPendingAuthSession.mState = STATE_AUTH_CALLED; // No polymorphism :( if ((modality & TYPE_FINGERPRINT) != 0) { @@ -1390,10 +1532,23 @@ public class BiometricService extends SystemService { return; } - // We need to check the current authenticators state. If we're pending confirm - // or idle, we need to dismiss the dialog and send an ERROR_CANCELED to the client, - // since we won't be getting an onError from the driver. - if (mCurrentAuthSession != null && mCurrentAuthSession.mState != STATE_AUTH_STARTED) { + if (mCurrentAuthSession != null + && mCurrentAuthSession.mState == STATE_BIOMETRIC_AUTH_CANCELED_SHOWING_CDC) { + if (DEBUG) Slog.d(TAG, "Cancel received while ConfirmDeviceCredential showing"); + try { + mCurrentAuthSession.mConfirmDeviceCredentialCallback.cancel(); + } catch (RemoteException e) { + Slog.e(TAG, "Unable to cancel ConfirmDeviceCredential", e); + } + + // TODO(b/123378871): Remove when moved. Piggy back on this for now to clean up. + handleOnConfirmDeviceCredentialError(BiometricConstants.BIOMETRIC_ERROR_CANCELED, + getContext().getString(R.string.biometric_error_canceled)); + } else if (mCurrentAuthSession != null + && mCurrentAuthSession.mState != STATE_AUTH_STARTED) { + // We need to check the current authenticators state. If we're pending confirm + // or idle, we need to dismiss the dialog and send an ERROR_CANCELED to the client, + // since we won't be getting an onError from the driver. try { // Send error to client mCurrentAuthSession.mClientReceiver.onError( @@ -1409,11 +1564,22 @@ public class BiometricService extends SystemService { Slog.e(TAG, "Remote exception", e); } } else { - cancelInternal(token, opPackageName, true /* fromClient */); + boolean fromCDC = false; + if (mCurrentAuthSession != null) { + fromCDC = mCurrentAuthSession.mBundle.getBoolean( + BiometricPrompt.KEY_FROM_CONFIRM_DEVICE_CREDENTIAL, false); + } + + if (fromCDC) { + if (DEBUG) Slog.d(TAG, "Cancelling from CDC"); + cancelInternal(token, opPackageName, false /* fromClient */); + } else { + cancelInternal(token, opPackageName, true /* fromClient */); + } + } } - void cancelInternal(IBinder token, String opPackageName, boolean fromClient) { final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); diff --git a/services/core/java/com/android/server/display/color/DisplayTransformManager.java b/services/core/java/com/android/server/display/color/DisplayTransformManager.java index 026837f07356..d6aa2ba02f1f 100644 --- a/services/core/java/com/android/server/display/color/DisplayTransformManager.java +++ b/services/core/java/com/android/server/display/color/DisplayTransformManager.java @@ -28,6 +28,7 @@ import android.util.Slog; import android.util.SparseArray; import com.android.internal.annotations.GuardedBy; +import com.android.internal.annotations.VisibleForTesting; import java.util.Arrays; @@ -73,15 +74,27 @@ public class DisplayTransformManager { private static final int SURFACE_FLINGER_TRANSACTION_DISPLAY_COLOR = 1023; private static final int SURFACE_FLINGER_TRANSACTION_QUERY_COLOR_MANAGED = 1030; - private static final String PERSISTENT_PROPERTY_SATURATION = "persist.sys.sf.color_saturation"; - private static final String PERSISTENT_PROPERTY_DISPLAY_COLOR = "persist.sys.sf.native_mode"; + @VisibleForTesting + static final String PERSISTENT_PROPERTY_SATURATION = "persist.sys.sf.color_saturation"; + @VisibleForTesting + static final String PERSISTENT_PROPERTY_DISPLAY_COLOR = "persist.sys.sf.native_mode"; private static final float COLOR_SATURATION_NATURAL = 1.0f; private static final float COLOR_SATURATION_BOOSTED = 1.1f; + /** + * Display color modes defined by DisplayColorSetting in + * frameworks/native/services/surfaceflinger/SurfaceFlinger.h. + */ private static final int DISPLAY_COLOR_MANAGED = 0; private static final int DISPLAY_COLOR_UNMANAGED = 1; private static final int DISPLAY_COLOR_ENHANCED = 2; + /** + * Display color mode range reserved for vendor customizations by the RenderIntent definition in + * hardware/interfaces/graphics/common/1.1/types.hal. + */ + private static final int VENDOR_MODE_RANGE_MIN = 256; // 0x100 + private static final int VENDOR_MODE_RANGE_MAX = 511; // 0x1ff /** * Map of level -> color transformation matrix. @@ -257,7 +270,11 @@ public class DisplayTransformManager { } else if (colorMode == ColorDisplayManager.COLOR_MODE_AUTOMATIC) { applySaturation(COLOR_SATURATION_NATURAL); setDisplayColor(DISPLAY_COLOR_ENHANCED); + } else if (colorMode >= VENDOR_MODE_RANGE_MIN && colorMode <= VENDOR_MODE_RANGE_MAX) { + applySaturation(COLOR_SATURATION_NATURAL); + setDisplayColor(colorMode); } + setColorMatrix(LEVEL_COLOR_MATRIX_NIGHT_DISPLAY, nightDisplayMatrix); updateConfiguration(); diff --git a/services/core/java/com/android/server/gpu/GpuService.java b/services/core/java/com/android/server/gpu/GpuService.java index 647727f795da..0f73f379900b 100644 --- a/services/core/java/com/android/server/gpu/GpuService.java +++ b/services/core/java/com/android/server/gpu/GpuService.java @@ -36,6 +36,7 @@ import android.os.Build; import android.os.Handler; import android.os.SystemProperties; import android.os.UserHandle; +import android.provider.DeviceConfig; import android.provider.Settings; import android.util.Base64; import android.util.Slog; @@ -69,9 +70,11 @@ public class GpuService extends SystemService { private final String mDriverPackageName; private final PackageManager mPackageManager; private final Object mLock = new Object(); + private final Object mDeviceConfigLock = new Object(); private ContentResolver mContentResolver; private long mGameDriverVersionCode; private SettingsObserver mSettingsObserver; + private DeviceConfigListener mDeviceConfigListener; @GuardedBy("mLock") private Blacklists mBlacklists; @@ -101,10 +104,11 @@ public class GpuService extends SystemService { public void onBootPhase(int phase) { if (phase == PHASE_BOOT_COMPLETED) { mContentResolver = mContext.getContentResolver(); - mSettingsObserver = new SettingsObserver(); if (mDriverPackageName == null || mDriverPackageName.isEmpty()) { return; } + mSettingsObserver = new SettingsObserver(); + mDeviceConfigListener = new DeviceConfigListener(); fetchGameDriverPackageProperties(); processBlacklists(); setBlacklist(); @@ -134,6 +138,24 @@ public class GpuService extends SystemService { } } + private final class DeviceConfigListener implements DeviceConfig.OnPropertyChangedListener { + + DeviceConfigListener() { + super(); + DeviceConfig.addOnPropertyChangedListener(DeviceConfig.NAMESPACE_GAME_DRIVER, + mContext.getMainExecutor(), this); + } + @Override + public void onPropertyChanged(String namespace, String name, String value) { + synchronized (mDeviceConfigLock) { + if (Settings.Global.GAME_DRIVER_BLACKLISTS.equals(name)) { + parseBlacklists(value != null ? value : ""); + setBlacklist(); + } + } + } + } + private final class PackageReceiver extends BroadcastReceiver { @Override public void onReceive(@NonNull final Context context, @NonNull final Intent intent) { @@ -229,13 +251,17 @@ public class GpuService extends SystemService { } private void processBlacklists() { - // TODO(b/121350991) Switch to DeviceConfig with property listener. - String base64String = - Settings.Global.getString(mContentResolver, Settings.Global.GAME_DRIVER_BLACKLISTS); - if (base64String == null || base64String.isEmpty()) { - return; + String base64String = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_GAME_DRIVER, + Settings.Global.GAME_DRIVER_BLACKLISTS); + if (base64String == null) { + base64String = + Settings.Global.getString(mContentResolver, + Settings.Global.GAME_DRIVER_BLACKLISTS); } + parseBlacklists(base64String != null ? base64String : ""); + } + private void parseBlacklists(String base64String) { synchronized (mLock) { // Reset all blacklists mBlacklists = null; diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 6f1929fd464a..d360a6362464 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -4101,13 +4101,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // ---------------------------------------------------------------------- - boolean setInputMethodEnabledLocked(String id, boolean enabled) { - // Make sure this is a valid input method. - InputMethodInfo imm = mMethodMap.get(id); - if (imm == null) { - throw new IllegalArgumentException("Unknown id: " + mCurMethodId); - } - + /** + * Enable or disable the given IME by updating {@link Settings.Secure#ENABLED_INPUT_METHODS}. + * + * @param id ID of the IME is to be manipulated. It is OK to pass IME ID that is currently not + * recognized by the system. + * @param enabled {@code true} if {@code id} needs to be enabled. + * @return {@code true} if the IME was previously enabled. {@code false} otherwise. + */ + private boolean setInputMethodEnabledLocked(String id, boolean enabled) { List<Pair<String, ArrayList<String>>> enabledInputMethodsList = mSettings .getEnabledInputMethodsAndSubtypeListLocked(); @@ -4697,6 +4699,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (!userHasDebugPriv(mSettings.getCurrentUserId(), shellCommand)) { return ShellCommandResult.SUCCESS; } + // Make sure this is a valid input method. + if (enabled && !mMethodMap.containsKey(id)) { + final PrintWriter error = shellCommand.getErrPrintWriter(); + error.print("Unknown input method "); + error.print(id); + error.println(" cannot be enabled"); + return ShellCommandResult.SUCCESS; + } previouslyEnabled = setInputMethodEnabledLocked(id, enabled); } final PrintWriter pr = shellCommand.getOutPrintWriter(); diff --git a/services/core/java/com/android/server/media/MediaSessionServiceImpl.java b/services/core/java/com/android/server/media/MediaSessionServiceImpl.java index 0cabf1d35206..de36deafa4d7 100644 --- a/services/core/java/com/android/server/media/MediaSessionServiceImpl.java +++ b/services/core/java/com/android/server/media/MediaSessionServiceImpl.java @@ -1489,8 +1489,10 @@ public class MediaSessionServiceImpl extends MediaSessionService.ServiceImpl { final long token = Binder.clearCallingIdentity(); if (DEBUG_KEY_EVENT) { - Log.d(TAG, "dispatchVolumeKeyEvent, pkg=" + packageName + ", pid=" + pid + ", uid=" - + uid + ", asSystem=" + asSystemService + ", event=" + keyEvent); + Log.d(TAG, "dispatchVolumeKeyEvent, pkg=" + packageName + + ", opPkg=" + opPackageName + ", pid=" + pid + ", uid=" + uid + + ", asSystem=" + asSystemService + ", event=" + keyEvent + + ", stream=" + stream + ", musicOnly=" + musicOnly); } try { diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java index 15599111f6e5..f34ace55a72e 100644 --- a/services/core/java/com/android/server/net/NetworkStatsService.java +++ b/services/core/java/com/android/server/net/NetworkStatsService.java @@ -25,6 +25,7 @@ import static android.content.Intent.ACTION_USER_REMOVED; import static android.content.Intent.EXTRA_UID; import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED; import static android.net.ConnectivityManager.isNetworkTypeMobile; +import static android.net.NetworkStack.checkNetworkStackPermission; import static android.net.NetworkStats.DEFAULT_NETWORK_ALL; import static android.net.NetworkStats.IFACE_ALL; import static android.net.NetworkStats.INTERFACES_ALL; @@ -866,7 +867,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { VpnInfo[] vpnArray, NetworkState[] networkStates, String activeIface) { - mContext.enforceCallingOrSelfPermission(READ_NETWORK_USAGE_HISTORY, TAG); + checkNetworkStackPermission(mContext); assertBandwidthControlEnabled(); final long token = Binder.clearCallingIdentity(); diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index f2e56b589bd5..dec47a1082fc 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -29,6 +29,7 @@ import static android.app.NotificationManager.ACTION_NOTIFICATION_CHANNEL_GROUP_ import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_MIN; import static android.app.NotificationManager.IMPORTANCE_NONE; +import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECTS_UNSET; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE; @@ -2868,7 +2869,7 @@ public class NotificationManagerService extends SystemService { @Override public void allowAssistantCapability(String adjustmentType) { - checkCallerIsSystemOrShell(); + checkCallerIsSystemOrSystemUiOrShell(); mAssistants.allowAdjustmentType(adjustmentType); handleSavePolicyFile(); @@ -2876,7 +2877,7 @@ public class NotificationManagerService extends SystemService { @Override public void disallowAssistantCapability(String adjustmentType) { - checkCallerIsSystemOrShell(); + checkCallerIsSystemOrSystemUiOrShell(); mAssistants.disallowAdjustmentType(adjustmentType); handleSavePolicyFile(); @@ -3419,8 +3420,7 @@ public class NotificationManagerService extends SystemService { } @Override - public String addAutomaticZenRule(AutomaticZenRule automaticZenRule) - throws RemoteException { + public String addAutomaticZenRule(AutomaticZenRule automaticZenRule) { Preconditions.checkNotNull(automaticZenRule, "automaticZenRule is null"); Preconditions.checkNotNull(automaticZenRule.getName(), "Name is null"); if (automaticZenRule.getOwner() == null @@ -3429,6 +3429,11 @@ public class NotificationManagerService extends SystemService { "Rule must have a conditionproviderservice and/or configuration activity"); } Preconditions.checkNotNull(automaticZenRule.getConditionId(), "ConditionId is null"); + if (automaticZenRule.getZenPolicy() != null + && automaticZenRule.getInterruptionFilter() != INTERRUPTION_FILTER_PRIORITY) { + throw new IllegalArgumentException("ZenPolicy is only applicable to " + + "INTERRUPTION_FILTER_PRIORITY filters"); + } enforcePolicyAccess(Binder.getCallingUid(), "addAutomaticZenRule"); return mZenModeHelper.addAutomaticZenRule(automaticZenRule, @@ -3806,7 +3811,7 @@ public class NotificationManagerService extends SystemService { @Override public ComponentName getAllowedNotificationAssistantForUser(int userId) { - checkCallerIsSystem(); + checkCallerIsSystemOrSystemUiOrShell(); List<ComponentName> allowedComponents = mAssistants.getAllowedComponents(userId); if (allowedComponents.size() > 1) { throw new IllegalStateException( @@ -3889,7 +3894,7 @@ public class NotificationManagerService extends SystemService { @Override public void setNotificationAssistantAccessGrantedForUser(ComponentName assistant, int userId, boolean granted) { - checkCallerIsSystemOrShell(); + checkCallerIsSystemOrSystemUiOrShell(); mAssistants.setUserSet(userId, true); final long identity = Binder.clearCallingIdentity(); try { @@ -3924,10 +3929,6 @@ public class NotificationManagerService extends SystemService { } } if (!foundEnqueued) { - // adjustment arrived too late to apply to enqueued; apply to posted - // However, since the notification is now posted and may have alerted, - // ignore any importance related adjustments - adjustment.getSignals().remove(Adjustment.KEY_IMPORTANCE); applyAdjustmentFromAssistant(token, adjustment); } } @@ -4118,7 +4119,7 @@ public class NotificationManagerService extends SystemService { } return; } - if (mAllowedManagedServicePackages.test(assistant.getPackageName(), userId, + if (!granted || mAllowedManagedServicePackages.test(assistant.getPackageName(), userId, mAssistants.getRequiredPermission())) { mConditionProviders.setPackageOrComponentEnabled(assistant.flattenToString(), userId, false, granted); @@ -6990,6 +6991,16 @@ public class NotificationManagerService extends SystemService { throw new SecurityException("Disallowed call for uid " + Binder.getCallingUid()); } + private void checkCallerIsSystemOrSystemUiOrShell() { + if (Binder.getCallingUid() == Process.SHELL_UID) { + return; + } + if (isCallerSystemOrPhone()) { + return; + } + getContext().enforceCallingPermission(android.Manifest.permission.STATUS_BAR_SERVICE, null); + } + private void checkCallerIsSystemOrSameApp(String pkg) { if (isCallerSystemOrPhone()) { return; @@ -7297,7 +7308,7 @@ public class NotificationManagerService extends SystemService { @GuardedBy("mLock") private ArrayMap<Integer, Boolean> mUserSetMap = new ArrayMap<>(); - private List<String> mAllowedAdjustments = new ArrayList<>(); + private Set<String> mAllowedAdjustments = new ArraySet<>(); public NotificationAssistants(Context context, Object lock, UserProfiles up, IPackageManager pm) { @@ -7385,12 +7396,18 @@ public class NotificationManagerService extends SystemService { synchronized (mLock) { mAllowedAdjustments.add(type); } + for (final ManagedServiceInfo info : NotificationAssistants.this.getServices()) { + mHandler.post(() -> notifyCapabilitiesChanged(info)); + } } protected void disallowAdjustmentType(String type) { synchronized (mLock) { mAllowedAdjustments.remove(type); } + for (final ManagedServiceInfo info : NotificationAssistants.this.getServices()) { + mHandler.post(() -> notifyCapabilitiesChanged(info)); + } } protected List<String> getAllowedAssistantCapabilities() { @@ -7450,6 +7467,15 @@ public class NotificationManagerService extends SystemService { setUserSet(userId, userSet); } + private void notifyCapabilitiesChanged(final ManagedServiceInfo info) { + final INotificationListener assistant = (INotificationListener) info.service; + try { + assistant.onCapabilitiesChanged(); + } catch (RemoteException ex) { + Slog.e(TAG, "unable to notify assistant (capabilities): " + assistant, ex); + } + } + private void notifySeen(final ManagedServiceInfo info, final ArrayList<String> keys) { final INotificationListener assistant = (INotificationListener) info.service; diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 1ce9d827d80f..6c5abe49fe13 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -757,124 +757,9 @@ public class PackageManagerService extends IPackageManager.Stub @Override public final boolean hasFeature(String feature) { return PackageManagerService.this.hasSystemFeature(feature, 0); } - - final List<PackageParser.Package> getStaticOverlayPackages( - Collection<PackageParser.Package> allPackages, String targetPackageName) { - if ("android".equals(targetPackageName)) { - // Static RROs targeting to "android", ie framework-res.apk, are already applied by - // native AssetManager. - return null; - } - - List<PackageParser.Package> overlayPackages = null; - for (PackageParser.Package p : allPackages) { - if (targetPackageName.equals(p.mOverlayTarget) && p.mOverlayIsStatic) { - if (overlayPackages == null) { - overlayPackages = new ArrayList<>(); - } - overlayPackages.add(p); - } - } - if (overlayPackages != null) { - Comparator<PackageParser.Package> cmp = - Comparator.comparingInt(p -> p.mOverlayPriority); - overlayPackages.sort(cmp); - } - return overlayPackages; - } - - final String[] getStaticOverlayPaths(List<PackageParser.Package> overlayPackages, - String targetPath) { - if (overlayPackages == null || overlayPackages.isEmpty()) { - return null; - } - List<String> overlayPathList = null; - for (PackageParser.Package overlayPackage : overlayPackages) { - if (targetPath == null) { - if (overlayPathList == null) { - overlayPathList = new ArrayList<>(); - } - overlayPathList.add(overlayPackage.baseCodePath); - continue; - } - - try { - // Creates idmaps for system to parse correctly the Android manifest of the - // target package. - // - // OverlayManagerService will update each of them with a correct gid from its - // target package app id. - mInstaller.idmap(targetPath, overlayPackage.baseCodePath, - UserHandle.getSharedAppGid( - UserHandle.getUserGid(UserHandle.USER_SYSTEM))); - if (overlayPathList == null) { - overlayPathList = new ArrayList<>(); - } - overlayPathList.add(overlayPackage.baseCodePath); - } catch (InstallerException e) { - Slog.e(TAG, "Failed to generate idmap for " + targetPath + " and " + - overlayPackage.baseCodePath); - } - } - return overlayPathList == null ? null : overlayPathList.toArray(new String[0]); - } - - String[] getStaticOverlayPaths(String targetPackageName, String targetPath) { - List<PackageParser.Package> overlayPackages; - synchronized (mInstallLock) { - synchronized (mPackages) { - overlayPackages = getStaticOverlayPackages( - mPackages.values(), targetPackageName); - } - // It is safe to keep overlayPackages without holding mPackages because static overlay - // packages can't be uninstalled or disabled. - return getStaticOverlayPaths(overlayPackages, targetPath); - } - } - - @Override public final String[] getOverlayApks(String targetPackageName) { - return getStaticOverlayPaths(targetPackageName, null); - } - - @Override public final String[] getOverlayPaths(String targetPackageName, - String targetPath) { - return getStaticOverlayPaths(targetPackageName, targetPath); - } - } - - class ParallelPackageParserCallback extends PackageParserCallback { - List<PackageParser.Package> mOverlayPackages = null; - - void findStaticOverlayPackages() { - synchronized (mPackages) { - for (PackageParser.Package p : mPackages.values()) { - if (p.mOverlayIsStatic) { - if (mOverlayPackages == null) { - mOverlayPackages = new ArrayList<>(); - } - mOverlayPackages.add(p); - } - } - } - } - - @Override - synchronized String[] getStaticOverlayPaths(String targetPackageName, String targetPath) { - // We can trust mOverlayPackages without holding mPackages because package uninstall - // can't happen while running parallel parsing. - // And we can call mInstaller inside getStaticOverlayPaths without holding mInstallLock - // because mInstallLock is held before running parallel parsing. - // Moreover holding mPackages or mInstallLock on each parsing thread causes dead-lock. - return mOverlayPackages == null ? null : - getStaticOverlayPaths( - getStaticOverlayPackages(mOverlayPackages, targetPackageName), - targetPath); - } } final PackageParser.Callback mPackageParserCallback = new PackageParserCallback(); - final ParallelPackageParserCallback mParallelPackageParserCallback = - new ParallelPackageParserCallback(); // Currently known shared libraries. final ArrayMap<String, LongSparseArray<SharedLibraryInfo>> mSharedLibraries = new ArrayMap<>(); @@ -2558,8 +2443,6 @@ public class PackageManagerService extends IPackageManager.Stub | SCAN_AS_ODM, 0); - mParallelPackageParserCallback.findStaticOverlayPackages(); - // Find base frameworks (resource packages without code). scanDirTracedLI(frameworkDir, mDefParseFlags @@ -8782,7 +8665,7 @@ public class PackageManagerService extends IPackageManager.Stub } try (ParallelPackageParser parallelPackageParser = new ParallelPackageParser( mSeparateProcesses, mOnlyCore, mMetrics, mCacheDir, - mParallelPackageParserCallback)) { + mPackageParserCallback)) { // Submit files for parsing in parallel int fileCount = 0; for (File file : files) { @@ -24816,11 +24699,9 @@ public class PackageManagerService extends IPackageManager.Stub } if (mExternalSourcesPolicy != null) { int isTrusted = mExternalSourcesPolicy.getPackageTrustedToInstallApps(packageName, uid); - if (isTrusted != PackageManagerInternal.ExternalSourcesPolicy.USER_DEFAULT) { - return isTrusted == PackageManagerInternal.ExternalSourcesPolicy.USER_TRUSTED; - } + return isTrusted == PackageManagerInternal.ExternalSourcesPolicy.USER_TRUSTED; } - return checkUidPermission(appOpPermission, uid) == PERMISSION_GRANTED; + return false; } @Override diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java index 5df2f86d6ad7..b819aa5a5b18 100644 --- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java @@ -302,6 +302,7 @@ public final class DefaultPermissionGrantPolicy { } public void grantDefaultPermissions(int userId) { + removeSystemFixedStorage(userId); grantPermissionsToSysComponentsAndPrivApps(userId); grantDefaultSystemHandlerPermissions(userId); grantDefaultPermissionExceptions(userId); @@ -310,6 +311,46 @@ public final class DefaultPermissionGrantPolicy { } } + // STOPSHIP: This is meant to fix the devices messed up by storage permission model 2 and + // should be removed once all devices were updated + private void removeSystemFixedStorage(int userId) { + List<PackageInfo> packages = mContext.getPackageManager().getInstalledPackagesAsUser( + DEFAULT_PACKAGE_INFO_QUERY_FLAGS, userId); + + for (PackageInfo pkg : packages) { + if (pkg == null || pkg.requestedPermissions == null) { + continue; + } + + for (String permission : pkg.requestedPermissions) { + if (!(Manifest.permission.READ_EXTERNAL_STORAGE.equals(permission) + || Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permission))) { + continue; + } + + int flags = mContext.getPackageManager().getPermissionFlags(permission, + pkg.packageName, UserHandle.of(userId)); + if ((flags & PackageManager.FLAG_PERMISSION_SYSTEM_FIXED) == 0) { + continue; + } + + Log.v(TAG, "Removing system fixed " + pkg.packageName + "/" + permission); + mContext.getPackageManager().updatePermissionFlags(permission, pkg.packageName, + PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, 0, UserHandle.of(userId)); + + if (!doesPackageSupportRuntimePermissions(pkg) + || (flags & (PackageManager.FLAG_PERMISSION_USER_SET + | PackageManager.FLAG_PERMISSION_POLICY_FIXED)) != 0) { + continue; + } + + Log.v(TAG, "Revoking " + pkg.packageName + "/" + permission); + mContext.getPackageManager().revokeRuntimePermission(pkg.packageName, permission, + UserHandle.of(userId)); + } + } + } + private void grantRuntimePermissionsForSystemPackage(int userId, PackageInfo pkg) { Set<String> permissions = new ArraySet<>(); for (String permission : pkg.requestedPermissions) { diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index e08e1ff01348..e2253e7f83ce 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -693,13 +693,13 @@ final class ActivityRecord extends ConfigurationContainer { } } - void scheduleTopResumedActivityChanged(boolean onTop) { + boolean scheduleTopResumedActivityChanged(boolean onTop) { if (!attachedToProcess()) { if (DEBUG_STATES) { Slog.w(TAG, "Can't report activity position update - client not running" + ", activityRecord=" + this); } - return; + return false; } try { if (DEBUG_STATES) { @@ -710,7 +710,9 @@ final class ActivityRecord extends ConfigurationContainer { TopResumedActivityChangeItem.obtain(onTop)); } catch (RemoteException e) { // If process died, whatever. + return false; } + return true; } void updateMultiWindowMode() { @@ -3408,7 +3410,6 @@ final class ActivityRecord extends ConfigurationContainer { transaction.addCallback(callbackItem); transaction.setLifecycleStateRequest(lifecycleItem); mAtmService.getLifecycleManager().scheduleTransaction(transaction); - mStackSupervisor.updateTopResumedActivityIfNeeded(); // Note: don't need to call pauseIfSleepingLocked() here, because the caller will only // request resume if this activity is currently resumed, which implies we aren't // sleeping. diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index fad4dbd5613b..419f5be5bbc8 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -1500,7 +1500,6 @@ class ActivityStack extends ConfigurationContainer { + " callers=" + Debug.getCallers(5)); r.setState(RESUMED, "minimalResumeActivityLocked"); r.completeResumeLocked(); - mStackSupervisor.updateTopResumedActivityIfNeeded(); if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE, "Launch completed; removing icicle of " + r.icicle); } @@ -2571,7 +2570,6 @@ class ActivityStack extends ConfigurationContainer { // Protect against recursion. mInResumeTopActivity = true; result = resumeTopActivityInnerLocked(prev, options); - mStackSupervisor.updateTopResumedActivityIfNeeded(); // When resuming the top activity, it may be necessary to pause the top activity (for // example, returning to the lock screen. We suppress the normal pause logic in @@ -2606,6 +2604,7 @@ class ActivityStack extends ConfigurationContainer { if (DEBUG_STACK) Slog.d(TAG_STACK, "setResumedActivity stack:" + this + " + from: " + mResumedActivity + " to:" + r + " reason:" + reason); mResumedActivity = r; + mStackSupervisor.updateTopResumedActivityIfNeeded(); } @GuardedBy("mService") diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java index 53dc1df5a46a..afdbd73d520d 100644 --- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java @@ -853,7 +853,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // Schedule transaction. mService.getLifecycleManager().scheduleTransaction(clientTransaction); - updateTopResumedActivityIfNeeded(); if ((proc.mInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0 && mService.mHasHeavyWeightFeature) { @@ -2321,8 +2320,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // mTopResumedActivityWaitingForPrev == true at this point would mean that an activity // before the prevTopActivity one hasn't reported back yet. So server never sent the top // resumed state change message to prevTopActivity. - if (prevActivityReceivedTopState) { - prevTopActivity.scheduleTopResumedActivityChanged(false /* onTop */); + if (prevActivityReceivedTopState + && prevTopActivity.scheduleTopResumedActivityChanged(false /* onTop */)) { scheduleTopResumedStateLossTimeout(prevTopActivity); mTopResumedActivityWaitingForPrev = true; } diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml index fce7599d0b59..01f2f6b26415 100644 --- a/services/tests/servicestests/AndroidManifest.xml +++ b/services/tests/servicestests/AndroidManifest.xml @@ -68,6 +68,7 @@ <uses-permission android:name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS" /> <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" /> <uses-permission android:name="android.permission.WRITE_DEVICE_CONFIG" /> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> <!-- Uses API introduced in O (26) --> <uses-sdk android:minSdkVersion="1" diff --git a/services/tests/servicestests/src/com/android/server/display/color/DisplayTransformManagerTest.java b/services/tests/servicestests/src/com/android/server/display/color/DisplayTransformManagerTest.java new file mode 100644 index 000000000000..fc74c972ed83 --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/display/color/DisplayTransformManagerTest.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.display.color; + +import static com.android.server.display.color.DisplayTransformManager.LEVEL_COLOR_MATRIX_NIGHT_DISPLAY; +import static com.android.server.display.color.DisplayTransformManager.PERSISTENT_PROPERTY_DISPLAY_COLOR; +import static com.android.server.display.color.DisplayTransformManager.PERSISTENT_PROPERTY_SATURATION; + +import static com.google.common.truth.Truth.assertThat; + +import android.hardware.display.ColorDisplayManager; +import android.os.SystemProperties; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public class DisplayTransformManagerTest { + + private DisplayTransformManager mDtm; + private float[] mNightDisplayMatrix; + + @Before + public void setUp() { + mDtm = new DisplayTransformManager(); + mNightDisplayMatrix = mDtm.getColorMatrix(LEVEL_COLOR_MATRIX_NIGHT_DISPLAY); + + SystemProperties.set(PERSISTENT_PROPERTY_DISPLAY_COLOR, null); + SystemProperties.set(PERSISTENT_PROPERTY_SATURATION, null); + } + + @Test + public void setColorMode_natural() { + mDtm.setColorMode(ColorDisplayManager.COLOR_MODE_NATURAL, mNightDisplayMatrix); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_DISPLAY_COLOR, null)) + .isEqualTo("0" /* managed */); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_SATURATION, null)) + .isEqualTo("1.0" /* natural */); + } + + @Test + public void setColorMode_boosted() { + mDtm.setColorMode(ColorDisplayManager.COLOR_MODE_BOOSTED, mNightDisplayMatrix); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_DISPLAY_COLOR, null)) + .isEqualTo("0" /* managed */); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_SATURATION, null)) + .isEqualTo("1.1" /* boosted */); + } + + @Test + public void setColorMode_saturated() { + mDtm.setColorMode(ColorDisplayManager.COLOR_MODE_SATURATED, mNightDisplayMatrix); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_DISPLAY_COLOR, null)) + .isEqualTo("1" /* unmanaged */); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_SATURATION, null)) + .isEqualTo("1.0" /* natural */); + } + + @Test + public void setColorMode_automatic() { + mDtm.setColorMode(ColorDisplayManager.COLOR_MODE_AUTOMATIC, mNightDisplayMatrix); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_DISPLAY_COLOR, null)) + .isEqualTo("2" /* enhanced */); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_SATURATION, null)) + .isEqualTo("1.0" /* natural */); + } + + @Test + public void setColorMode_vendor() { + mDtm.setColorMode(0x100, mNightDisplayMatrix); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_DISPLAY_COLOR, null)) + .isEqualTo(Integer.toString(0x100) /* pass-through */); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_SATURATION, null)) + .isEqualTo("1.0" /* default */); + } + + @Test + public void setColorMode_outOfBounds() { + mDtm.setColorMode(0x50, mNightDisplayMatrix); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_DISPLAY_COLOR, null)) + .isEqualTo("" /* default */); + assertThat(SystemProperties.get(PERSISTENT_PROPERTY_SATURATION, null)) + .isEqualTo("" /* default */); + } +} diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index ca7a71ecad75..b0788253d0a7 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -71,8 +71,10 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import android.app.Activity; import android.app.ActivityManager; import android.app.AppOpsManager; +import android.app.AutomaticZenRule; import android.app.IActivityManager; import android.app.INotificationManager; import android.app.ITransientNotification; @@ -117,6 +119,7 @@ import android.service.notification.NotificationListenerService; import android.service.notification.NotificationStats; import android.service.notification.NotifyingApp; import android.service.notification.StatusBarNotification; +import android.service.notification.ZenPolicy; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableContext; @@ -2887,7 +2890,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test - public void testApplyEnqueuedAdjustmentFromAssistant_importance_onTime() throws Exception { + public void testApplyEnqueuedAdjustmentFromAssistant_importance() throws Exception { final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addEnqueuedNotification(r); NotificationManagerService.WorkerHandler handler = mock( @@ -2905,25 +2908,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test - public void testApplyEnqueuedAdjustmentFromAssistant_importance_tooLate() throws Exception { - final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); - mService.addNotification(r); - NotificationManagerService.WorkerHandler handler = mock( - NotificationManagerService.WorkerHandler.class); - mService.setHandler(handler); - when(mAssistants.isSameUser(eq(null), anyInt())).thenReturn(true); - - Bundle signals = new Bundle(); - signals.putInt(KEY_IMPORTANCE, IMPORTANCE_LOW); - Adjustment adjustment = new Adjustment( - r.sbn.getPackageName(), r.getKey(), signals, "", r.getUser().getIdentifier()); - mBinderService.applyEnqueuedAdjustmentFromAssistant(null, adjustment); - - assertEquals(IMPORTANCE_DEFAULT, r.getImportance()); - assertFalse(r.hasAdjustment(KEY_IMPORTANCE)); - } - - @Test public void testApplyEnqueuedAdjustmentFromAssistant_crossUser() throws Exception { final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addEnqueuedNotification(r); @@ -4967,6 +4951,29 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { assertEquals(USER_SENTIMENT_NEUTRAL, r.getUserSentiment()); } + public void testAutomaticZenRuleValidation_policyFilterAgreement() throws Exception { + ComponentName owner = mock(ComponentName.class); + ZenPolicy zenPolicy = new ZenPolicy.Builder().allowAlarms(true).build(); + boolean isEnabled = true; + AutomaticZenRule rule = new AutomaticZenRule("test", owner, owner, mock(Uri.class), + zenPolicy, NotificationManager.INTERRUPTION_FILTER_NONE, isEnabled); + + try { + mBinderService.addAutomaticZenRule(rule); + fail("Zen policy only aplies to priority only mode"); + } catch (IllegalArgumentException e) { + // yay + } + + rule = new AutomaticZenRule("test", owner, owner, mock(Uri.class), + zenPolicy, NotificationManager.INTERRUPTION_FILTER_PRIORITY, isEnabled); + mBinderService.addAutomaticZenRule(rule); + + rule = new AutomaticZenRule("test", owner, owner, mock(Uri.class), + null, NotificationManager.INTERRUPTION_FILTER_NONE, isEnabled); + mBinderService.addAutomaticZenRule(rule); + } + public void testAreNotificationsEnabledForPackage_crossUser() throws Exception { try { mBinderService.areNotificationsEnabledForPackage(mContext.getPackageName(), diff --git a/telecomm/java/android/telecom/CallRedirectionService.java b/telecomm/java/android/telecom/CallRedirectionService.java index 37fab09cd745..36c637723c0a 100644 --- a/telecomm/java/android/telecom/CallRedirectionService.java +++ b/telecomm/java/android/telecom/CallRedirectionService.java @@ -119,18 +119,18 @@ public abstract class CallRedirectionService extends Service { * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. The response corresponds to the * latest request via {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. * - * @param handle the new phone number to dial + * @param gatewayUri the gateway uri for call redirection. * @param targetPhoneAccount the {@link PhoneAccountHandle} to use when placing the call. * @param confirmFirst Telecom will ask users to confirm the redirection via a yes/no dialog * if the confirmFirst is true, and if the redirection request of this * response was sent with a true flag of allowInteractiveResponse via * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)} */ - public final void redirectCall(@NonNull Uri handle, + public final void redirectCall(@NonNull Uri gatewayUri, @NonNull PhoneAccountHandle targetPhoneAccount, boolean confirmFirst) { try { - mCallRedirectionAdapter.redirectCall(handle, targetPhoneAccount, confirmFirst); + mCallRedirectionAdapter.redirectCall(gatewayUri, targetPhoneAccount, confirmFirst); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java index 52e0ebd334b5..2d8a8cbae59f 100644 --- a/telephony/java/android/provider/Telephony.java +++ b/telephony/java/android/provider/Telephony.java @@ -4321,6 +4321,22 @@ public final class Telephony { * @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"; } /** diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 970bbf89b39e..9f6528bc4709 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1312,6 +1312,24 @@ public class CarrierConfigManager { "hide_lte_plus_data_icon_bool"; /** + * The string is used to filter redundant string from PLMN Network Name that's supplied by + * specific carrier. + * + * @hide + */ + public static final String KEY_OPERATOR_NAME_FILTER_PATTERN_STRING = + "operator_name_filter_pattern_string"; + + /** + * The string is used to compare with operator name. If it matches the pattern then show + * specific data icon. + * + * @hide + */ + public static final String KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING = + "show_carrier_data_icon_pattern_string"; + + /** * Boolean to decide whether to show precise call failed cause to user * @hide */ @@ -3152,6 +3170,8 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_SPN_DISPLAY_RULE_USE_ROAMING_FROM_SERVICE_STATE_BOOL, false); sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false); sDefaults.putBoolean(KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL, false); + sDefaults.putString(KEY_OPERATOR_NAME_FILTER_PATTERN_STRING, ""); + sDefaults.putString(KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING, ""); sDefaults.putBoolean(KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, true); sDefaults.putBoolean(KEY_LTE_ENABLED_BOOL, true); sDefaults.putBoolean(KEY_SUPPORT_TDSCDMA_BOOL, false); diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java index 374527749354..30875165867a 100644 --- a/telephony/java/android/telephony/CellIdentity.java +++ b/telephony/java/android/telephony/CellIdentity.java @@ -49,10 +49,10 @@ public abstract class CellIdentity implements Parcelable { // long alpha Operator Name String or Enhanced Operator Name String /** @hide */ - protected final String mAlphaLong; + protected String mAlphaLong; // short alpha Operator Name String or Enhanced Operator Name String /** @hide */ - protected final String mAlphaShort; + protected String mAlphaShort; /** @hide */ protected CellIdentity(String tag, int type, String mcc, String mnc, String alphal, @@ -145,6 +145,13 @@ public abstract class CellIdentity implements Parcelable { } /** + * @hide + */ + public void setOperatorAlphaLong(String alphaLong) { + mAlphaLong = alphaLong; + } + + /** * @return The short alpha tag associated with the current scan result (may be the operator * name string or extended operator name string). May be null if unknown. */ @@ -154,6 +161,13 @@ public abstract class CellIdentity implements Parcelable { } /** + * @hide + */ + public void setOperatorAlphaShort(String alphaShort) { + mAlphaShort = alphaShort; + } + + /** * @return a CellLocation object for this CellIdentity * @hide */ diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java index 5e44bf2e37a8..864540d91be3 100644 --- a/telephony/java/android/telephony/CellIdentityGsm.java +++ b/telephony/java/android/telephony/CellIdentityGsm.java @@ -166,6 +166,7 @@ public final class CellIdentityGsm extends CellIdentity { /** * @return Mobile Country Code in string format, null if unavailable. */ + @Nullable public String getMccString() { return mMccStr; } @@ -173,6 +174,7 @@ public final class CellIdentityGsm extends CellIdentity { /** * @return Mobile Network Code in string format, null if unavailable. */ + @Nullable public String getMncString() { return mMncStr; } diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index 2dd72d6ea69c..14503c7cdd4d 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -187,6 +187,7 @@ public final class CellIdentityLte extends CellIdentity { /** * @return Mobile Country Code in string format, null if unavailable. */ + @Nullable public String getMccString() { return mMccStr; } @@ -194,6 +195,7 @@ public final class CellIdentityLte extends CellIdentity { /** * @return Mobile Network Code in string format, null if unavailable. */ + @Nullable public String getMncString() { return mMncStr; } diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java index a591bd15f95f..937de706aec0 100644 --- a/telephony/java/android/telephony/CellIdentityTdscdma.java +++ b/telephony/java/android/telephony/CellIdentityTdscdma.java @@ -104,6 +104,7 @@ public final class CellIdentityTdscdma extends CellIdentity { * Get Mobile Country Code in string format * @return Mobile Country Code in string format, null if unknown */ + @Nullable public String getMccString() { return mMccStr; } @@ -112,6 +113,7 @@ public final class CellIdentityTdscdma extends CellIdentity { * Get Mobile Network Code in string format * @return Mobile Network Code in string format, null if unknown */ + @Nullable public String getMncString() { return mMncStr; } diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java index 674c40c2d36f..b4a2ead7fc3d 100644 --- a/telephony/java/android/telephony/CellIdentityWcdma.java +++ b/telephony/java/android/telephony/CellIdentityWcdma.java @@ -150,6 +150,7 @@ public final class CellIdentityWcdma extends CellIdentity { /** * @return Mobile Country Code in string version, null if unavailable. */ + @Nullable public String getMccString() { return mMccStr; } @@ -157,6 +158,7 @@ public final class CellIdentityWcdma extends CellIdentity { /** * @return Mobile Network Code in string version, null if unavailable. */ + @Nullable public String getMncString() { return mMncStr; } diff --git a/telephony/java/android/telephony/CellInfoCdma.java b/telephony/java/android/telephony/CellInfoCdma.java index a4570e41dc26..30b131faf51d 100644 --- a/telephony/java/android/telephony/CellInfoCdma.java +++ b/telephony/java/android/telephony/CellInfoCdma.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.NonNull; import android.annotation.UnsupportedAppUsage; import android.os.Build; import android.os.Parcel; @@ -76,18 +77,25 @@ public final class CellInfoCdma extends CellInfo implements Parcelable { new CellSignalStrengthCdma(cic.signalStrengthCdma, cic.signalStrengthEvdo); } + /** + * @return a {@link CellIdentityCdma} instance. + */ @Override - public CellIdentityCdma getCellIdentity() { + public @NonNull CellIdentityCdma getCellIdentity() { return mCellIdentityCdma; } + /** @hide */ @UnsupportedAppUsage public void setCellIdentity(CellIdentityCdma cid) { mCellIdentityCdma = cid; } + /** + * @return a {@link CellSignalStrengthCdma} instance. + */ @Override - public CellSignalStrengthCdma getCellSignalStrength() { + public @NonNull CellSignalStrengthCdma getCellSignalStrength() { return mCellSignalStrengthCdma; } diff --git a/telephony/java/android/telephony/CellInfoGsm.java b/telephony/java/android/telephony/CellInfoGsm.java index ce32bc1b9cb7..137f97eeee62 100644 --- a/telephony/java/android/telephony/CellInfoGsm.java +++ b/telephony/java/android/telephony/CellInfoGsm.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.NonNull; import android.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; @@ -71,17 +72,24 @@ public final class CellInfoGsm extends CellInfo implements Parcelable { mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm); } + /** + * @return a {@link CellIdentityGsm} instance. + */ @Override - public CellIdentityGsm getCellIdentity() { + public @NonNull CellIdentityGsm getCellIdentity() { return mCellIdentityGsm; } + /** @hide */ public void setCellIdentity(CellIdentityGsm cid) { mCellIdentityGsm = cid; } + /** + * @return a {@link CellSignalStrengthGsm} instance. + */ @Override - public CellSignalStrengthGsm getCellSignalStrength() { + public @NonNull CellSignalStrengthGsm getCellSignalStrength() { return mCellSignalStrengthGsm; } diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java index 01ee20a7fa1e..da7b7ab1488d 100644 --- a/telephony/java/android/telephony/CellInfoLte.java +++ b/telephony/java/android/telephony/CellInfoLte.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.NonNull; import android.annotation.UnsupportedAppUsage; import android.os.Build; import android.os.Parcel; @@ -79,11 +80,15 @@ public final class CellInfoLte extends CellInfo implements Parcelable { mCellConfig = new CellConfigLte(cil.cellConfig); } + /** + * @return a {@link CellIdentityLte} instance. + */ @Override - public CellIdentityLte getCellIdentity() { + public @NonNull CellIdentityLte getCellIdentity() { if (DBG) log("getCellIdentity: " + mCellIdentityLte); return mCellIdentityLte; } + /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public void setCellIdentity(CellIdentityLte cid) { @@ -91,8 +96,11 @@ public final class CellInfoLte extends CellInfo implements Parcelable { mCellIdentityLte = cid; } + /** + * @return a {@link CellSignalStrengthLte} instance. + */ @Override - public CellSignalStrengthLte getCellSignalStrength() { + public @NonNull CellSignalStrengthLte getCellSignalStrength() { if (DBG) log("getCellSignalStrength: " + mCellSignalStrengthLte); return mCellSignalStrengthLte; } diff --git a/telephony/java/android/telephony/CellInfoNr.java b/telephony/java/android/telephony/CellInfoNr.java index ba4a907fdce8..9775abd5075c 100644 --- a/telephony/java/android/telephony/CellInfoNr.java +++ b/telephony/java/android/telephony/CellInfoNr.java @@ -43,12 +43,18 @@ public final class CellInfoNr extends CellInfo { mCellSignalStrength = other.mCellSignalStrength; } + /** + * @return a {@link CellIdentityNr} instance. + */ @Override @NonNull public CellIdentity getCellIdentity() { return mCellIdentity; } + /** + * @return a {@link CellSignalStrengthNr} instance. + */ @Override @NonNull public CellSignalStrength getCellSignalStrength() { diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java index ccafda61a177..f1305f5ca768 100644 --- a/telephony/java/android/telephony/CellInfoTdscdma.java +++ b/telephony/java/android/telephony/CellInfoTdscdma.java @@ -75,6 +75,9 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable { mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma(cit.signalStrengthTdscdma); } + /** + * @return a {@link CellIdentityTdscdma} instance. + */ @Override public @NonNull CellIdentityTdscdma getCellIdentity() { return mCellIdentityTdscdma; @@ -85,6 +88,9 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable { mCellIdentityTdscdma = cid; } + /** + * @return a {@link CellSignalStrengthTdscdma} instance. + */ @Override public @NonNull CellSignalStrengthTdscdma getCellSignalStrength() { return mCellSignalStrengthTdscdma; diff --git a/telephony/java/android/telephony/CellInfoWcdma.java b/telephony/java/android/telephony/CellInfoWcdma.java index 1b32178db337..ee5fec838d2d 100644 --- a/telephony/java/android/telephony/CellInfoWcdma.java +++ b/telephony/java/android/telephony/CellInfoWcdma.java @@ -71,15 +71,22 @@ public final class CellInfoWcdma extends CellInfo implements Parcelable { mCellSignalStrengthWcdma = new CellSignalStrengthWcdma(ciw.signalStrengthWcdma); } + /** + * @return a {@link CellIdentityWcdma} instance. + */ @Override public CellIdentityWcdma getCellIdentity() { return mCellIdentityWcdma; } + /** @hide */ public void setCellIdentity(CellIdentityWcdma cid) { mCellIdentityWcdma = cid; } + /** + * @return a {@link CellSignalStrengthWcdma} instance. + */ @Override public CellSignalStrengthWcdma getCellSignalStrength() { return mCellSignalStrengthWcdma; diff --git a/telephony/java/android/telephony/CellSignalStrength.java b/telephony/java/android/telephony/CellSignalStrength.java index 740b970b8e7c..e65b048ec0a5 100644 --- a/telephony/java/android/telephony/CellSignalStrength.java +++ b/telephony/java/android/telephony/CellSignalStrength.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.IntRange; import android.os.PersistableBundle; /** @@ -57,23 +58,24 @@ public abstract class CellSignalStrength { public abstract void setDefaultValues(); /** - * Get signal level as an int from 0..4 - * <p> - * @see #SIGNAL_STRENGTH_NONE_OR_UNKNOWN - * @see #SIGNAL_STRENGTH_POOR - * @see #SIGNAL_STRENGTH_MODERATE - * @see #SIGNAL_STRENGTH_GOOD - * @see #SIGNAL_STRENGTH_GREAT + * Retrieve an abstract level value for the overall signal quality. + * + * @return a single integer from 0 to 4 representing the general signal quality. + * 0 represents very poor or unknown signal quality while 4 represents excellent + * signal quality. */ + @IntRange(from = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to = SIGNAL_STRENGTH_GREAT) public abstract int getLevel(); /** - * Get the signal level as an asu value between 0..31, 99 is unknown + * Get the technology-specific signal strength in Arbitrary Strength Units, calculated from the + * strength of the pilot signal or equivalent. */ public abstract int getAsuLevel(); /** - * Get the signal strength as dBm + * Get the technology-specific signal strength in dBm, which is the signal strength of the + * pilot signal or equivalent. */ public abstract int getDbm(); diff --git a/telephony/java/android/telephony/CellSignalStrengthCdma.java b/telephony/java/android/telephony/CellSignalStrengthCdma.java index 5b195999078c..199843905854 100644 --- a/telephony/java/android/telephony/CellSignalStrengthCdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthCdma.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.IntRange; import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; @@ -114,13 +115,9 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } - /** - * Retrieve an abstract level value for the overall signal strength. - * - * @return a single integer from 0 to 4 representing the general signal quality. - * 0 represents very poor signal strength while 4 represents a very strong signal strength. - */ + /** {@inheritDoc} */ @Override + @IntRange(from = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to = SIGNAL_STRENGTH_GREAT) public int getLevel() { return mLevel; } diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java index bd3bd1aade5e..14ae68981745 100644 --- a/telephony/java/android/telephony/CellSignalStrengthGsm.java +++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.IntRange; import android.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; @@ -101,13 +102,9 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } - /** - * Retrieve an abstract level value for the overall signal strength. - * - * @return a single integer from 0 to 4 representing the general signal quality. - * 0 represents very poor signal strength while 4 represents a very strong signal strength. - */ + /** {@inheritDoc} */ @Override + @IntRange(from = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to = SIGNAL_STRENGTH_GREAT) public int getLevel() { return mLevel; } @@ -155,7 +152,7 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P /** * Get the RSSI in ASU. * - * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69 + * Asu is calculated based on 3GPP RSSI. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69 * * @return RSSI in ASU 0..31, 99, or UNAVAILABLE */ diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java index 5687adaabed5..2272dc9071ea 100644 --- a/telephony/java/android/telephony/CellSignalStrengthLte.java +++ b/telephony/java/android/telephony/CellSignalStrengthLte.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.IntRange; import android.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; @@ -145,13 +146,9 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } - /** - * Retrieve an abstract level value for the overall signal strength. - * - * @return a single integer from 0 to 4 representing the general signal quality. - * 0 represents very poor signal strength while 4 represents a very strong signal strength. - */ + /** {@inheritDoc} */ @Override + @IntRange(from = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to = SIGNAL_STRENGTH_GREAT) public int getLevel() { return mLevel; } diff --git a/telephony/java/android/telephony/CellSignalStrengthNr.java b/telephony/java/android/telephony/CellSignalStrengthNr.java index fff3adf04f7b..1912c60ac122 100644 --- a/telephony/java/android/telephony/CellSignalStrengthNr.java +++ b/telephony/java/android/telephony/CellSignalStrengthNr.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.IntRange; import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; @@ -183,7 +184,9 @@ public final class CellSignalStrengthNr extends CellSignalStrength implements Pa mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } + /** {@inheritDoc} */ @Override + @IntRange(from = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to = SIGNAL_STRENGTH_GREAT) public int getLevel() { return mLevel; } @@ -227,6 +230,9 @@ public final class CellSignalStrengthNr extends CellSignalStrength implements Pa return asuLevel; } + /** + * Get the CSI-RSRP as dBm value -140..-44dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}. + */ @Override public int getDbm() { return mCsiRsrp; diff --git a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java index b562f3270fba..f4a3dbb37988 100644 --- a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.IntRange; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; @@ -121,13 +122,10 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } - /** - * Retrieve an abstract level value for the overall signal strength. - * - * @return a single integer from 0 to 4 representing the general signal quality. - * 0 represents very poor signal strength while 4 represents a very strong signal strength. - */ + + /** {@inheritDoc} */ @Override + @IntRange(from = 0, to = 4) public int getLevel() { return mLevel; } @@ -144,7 +142,7 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen } /** - * Get the signal strength as dBm + * Get the RSCP as dBm value -120..-24dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}. */ @Override public int getDbm() { diff --git a/telephony/java/android/telephony/CellSignalStrengthWcdma.java b/telephony/java/android/telephony/CellSignalStrengthWcdma.java index 8efc0f281543..169325276821 100644 --- a/telephony/java/android/telephony/CellSignalStrengthWcdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthWcdma.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.IntRange; import android.annotation.StringDef; import android.os.Parcel; import android.os.Parcelable; @@ -143,13 +144,9 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; } - /** - * Retrieve an abstract level value for the overall signal strength. - * - * @return a single integer from 0 to 4 representing the general signal quality. - * 0 represents very poor signal strength while 4 represents a very strong signal strength. - */ + /** {@inheritDoc} */ @Override + @IntRange(from = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to = SIGNAL_STRENGTH_GREAT) public int getLevel() { return mLevel; } @@ -202,7 +199,7 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements } /** - * Get the signal strength as dBm + * Get the RSCP as dBm value -120..-24dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}. */ @Override public int getDbm() { diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 8c92e84b45b6..1a160f4f57a6 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -339,6 +339,9 @@ public class ServiceState implements Parcelable { private List<NetworkRegistrationInfo> mNetworkRegistrationInfos = new ArrayList<>(); + private String mOperatorAlphaLongRaw; + private String mOperatorAlphaShortRaw; + /** * get String description of roaming type * @hide @@ -420,6 +423,8 @@ public class ServiceState implements Parcelable { mNetworkRegistrationInfos = s.mNetworkRegistrationInfos == null ? null : new ArrayList<>(s.mNetworkRegistrationInfos); mNrFrequencyRange = s.mNrFrequencyRange; + mOperatorAlphaLongRaw = s.mOperatorAlphaLongRaw; + mOperatorAlphaShortRaw = s.mOperatorAlphaShortRaw; } /** @@ -453,6 +458,8 @@ public class ServiceState implements Parcelable { mChannelNumber = in.readInt(); mCellBandwidths = in.createIntArray(); mNrFrequencyRange = in.readInt(); + mOperatorAlphaLongRaw = in.readString(); + mOperatorAlphaShortRaw = in.readString(); } public void writeToParcel(Parcel out, int flags) { @@ -478,6 +485,8 @@ public class ServiceState implements Parcelable { out.writeInt(mChannelNumber); out.writeIntArray(mCellBandwidths); out.writeInt(mNrFrequencyRange); + out.writeString(mOperatorAlphaLongRaw); + out.writeString(mOperatorAlphaShortRaw); } public int describeContents() { @@ -836,7 +845,9 @@ public class ServiceState implements Parcelable { mIsEmergencyOnly, mLteEarfcnRsrpBoost, mNetworkRegistrationInfos, - mNrFrequencyRange); + mNrFrequencyRange, + mOperatorAlphaLongRaw, + mOperatorAlphaShortRaw); } @Override @@ -862,6 +873,8 @@ public class ServiceState implements Parcelable { && equalsHandlesNulls(mCdmaDefaultRoamingIndicator, s.mCdmaDefaultRoamingIndicator) && mIsEmergencyOnly == s.mIsEmergencyOnly + && equalsHandlesNulls(mOperatorAlphaLongRaw, s.mOperatorAlphaLongRaw) + && equalsHandlesNulls(mOperatorAlphaShortRaw, s.mOperatorAlphaShortRaw) && (mNetworkRegistrationInfos == null ? s.mNetworkRegistrationInfos == null : s.mNetworkRegistrationInfos != null && mNetworkRegistrationInfos.containsAll(s.mNetworkRegistrationInfos)) @@ -1019,6 +1032,8 @@ public class ServiceState implements Parcelable { .append(", mLteEarfcnRsrpBoost=").append(mLteEarfcnRsrpBoost) .append(", mNetworkRegistrationInfos=").append(mNetworkRegistrationInfos) .append(", mNrFrequencyRange=").append(mNrFrequencyRange) + .append(", mOperatorAlphaLongRaw=").append(mOperatorAlphaLongRaw) + .append(", mOperatorAlphaShortRaw=").append(mOperatorAlphaShortRaw) .append("}").toString(); } @@ -1056,6 +1071,8 @@ public class ServiceState implements Parcelable { .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN) .build()); + mOperatorAlphaLongRaw = null; + mOperatorAlphaShortRaw = null; } public void setStateOutOfService() { @@ -1297,6 +1314,8 @@ public class ServiceState implements Parcelable { m.putInt("ChannelNumber", mChannelNumber); m.putIntArray("CellBandwidths", mCellBandwidths); m.putInt("mNrFrequencyRange", mNrFrequencyRange); + m.putString("operator-alpha-long-raw", mOperatorAlphaLongRaw); + m.putString("operator-alpha-short-raw", mOperatorAlphaShortRaw); } /** @hide */ @@ -1906,4 +1925,36 @@ public class ServiceState implements Parcelable { return state; } + + /** + * @hide + */ + public void setOperatorAlphaLongRaw(String operatorAlphaLong) { + mOperatorAlphaLongRaw = operatorAlphaLong; + } + + /** + * The current registered raw data network operator name in long alphanumeric format. + * + * @hide + */ + public String getOperatorAlphaLongRaw() { + return mOperatorAlphaLongRaw; + } + + /** + * @hide + */ + public void setOperatorAlphaShortRaw(String operatorAlphaShort) { + mOperatorAlphaShortRaw = operatorAlphaShort; + } + + /** + * The current registered raw data network operator name in short alphanumeric format. + * + * @hide + */ + public String getOperatorAlphaShortRaw() { + return mOperatorAlphaShortRaw; + } } diff --git a/tests/net/java/android/net/NetworkStackTest.java b/tests/net/java/android/net/NetworkStackTest.java new file mode 100644 index 000000000000..f7c6c99ba622 --- /dev/null +++ b/tests/net/java/android/net/NetworkStackTest.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.net; + +import static android.Manifest.permission.NETWORK_STACK; +import static android.content.pm.PackageManager.PERMISSION_DENIED; +import static android.content.pm.PackageManager.PERMISSION_GRANTED; +import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK; +import static android.net.NetworkStack.checkNetworkStackPermission; +import static android.net.NetworkStack.checkNetworkStackPermissionOr; + +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.when; + +import android.content.Context; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +@RunWith(AndroidJUnit4.class) +public class NetworkStackTest { + private static final String [] OTHER_PERMISSION = {"otherpermission1", "otherpermission2"}; + + @Mock Context mCtx; + + @Before public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCheckNetworkStackPermission() throws Exception { + when(mCtx.checkCallingOrSelfPermission(eq(NETWORK_STACK))).thenReturn(PERMISSION_GRANTED); + when(mCtx.checkCallingOrSelfPermission(eq(PERMISSION_MAINLINE_NETWORK_STACK))) + .thenReturn(PERMISSION_DENIED); + checkNetworkStackPermission(mCtx); + checkNetworkStackPermissionOr(mCtx, OTHER_PERMISSION); + + when(mCtx.checkCallingOrSelfPermission(eq(NETWORK_STACK))).thenReturn(PERMISSION_DENIED); + when(mCtx.checkCallingOrSelfPermission(eq(PERMISSION_MAINLINE_NETWORK_STACK))) + .thenReturn(PERMISSION_GRANTED); + checkNetworkStackPermission(mCtx); + checkNetworkStackPermissionOr(mCtx, OTHER_PERMISSION); + + when(mCtx.checkCallingOrSelfPermission(any())).thenReturn(PERMISSION_DENIED); + + try { + checkNetworkStackPermissionOr(mCtx, OTHER_PERMISSION); + } catch (SecurityException e) { + // Expect to get a SecurityException + return; + } + + fail("Expect fail but permission granted."); + } +} diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp index 4e6d07303b02..1aad4be5d66f 100644 --- a/tools/stats_log_api_gen/main.cpp +++ b/tools/stats_log_api_gen/main.cpp @@ -1177,7 +1177,7 @@ static int write_java_method_for_module( // Initialize the buffer with list data type. fprintf(out, " buff[pos] = LIST_TYPE;\n"); - fprintf(out, " buff[pos + 1] = %lu;\n", signature.size() + 2); + fprintf(out, " buff[pos + 1] = %zu;\n", signature.size() + 2); fprintf(out, " pos += LIST_TYPE_OVERHEAD;\n"); // Write timestamp. diff --git a/wifi/java/android/net/wifi/aware/ConfigRequest.java b/wifi/java/android/net/wifi/aware/ConfigRequest.java index 1e46d1b16feb..b07d8edde3d4 100644 --- a/wifi/java/android/net/wifi/aware/ConfigRequest.java +++ b/wifi/java/android/net/wifi/aware/ConfigRequest.java @@ -213,7 +213,7 @@ public final class ConfigRequest implements Parcelable { * Builder used to build {@link ConfigRequest} objects. */ public static final class Builder { - private boolean mSupport5gBand = false; + private boolean mSupport5gBand = true; private int mMasterPreference = 0; private int mClusterLow = CLUSTER_ID_MIN; private int mClusterHigh = CLUSTER_ID_MAX; diff --git a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java index 52bb28485c72..db8220b41910 100644 --- a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java +++ b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java @@ -576,7 +576,7 @@ public class WifiAwareManagerTest { equalTo(configRequest.mClusterLow)); collector.checkThat("mMasterPreference", 0, equalTo(configRequest.mMasterPreference)); - collector.checkThat("mSupport5gBand", false, equalTo(configRequest.mSupport5gBand)); + collector.checkThat("mSupport5gBand", true, equalTo(configRequest.mSupport5gBand)); collector.checkThat("mDiscoveryWindowInterval.length", 2, equalTo(configRequest.mDiscoveryWindowInterval.length)); collector.checkThat("mDiscoveryWindowInterval[2.4GHz]", ConfigRequest.DW_INTERVAL_NOT_INIT, |