diff options
36 files changed, 182 insertions, 132 deletions
diff --git a/api/current.txt b/api/current.txt index 9c90ee67cdf7..cd78602d9cd9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -9808,6 +9808,7 @@ package android.content { field public static final int BIND_IMPORTANT = 64; // 0x40 field public static final int BIND_INCLUDE_CAPABILITIES = 4096; // 0x1000 field public static final int BIND_NOT_FOREGROUND = 4; // 0x4 + field public static final int BIND_NOT_PERCEPTIBLE = 256; // 0x100 field public static final int BIND_WAIVE_PRIORITY = 32; // 0x20 field public static final String BIOMETRIC_SERVICE = "biometric"; field public static final String BLUETOOTH_SERVICE = "bluetooth"; diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 3a74f7dc2ea5..546f000159a0 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -2080,7 +2080,7 @@ public final class ActivityThread extends ClientTransactionHandler { @Override public final boolean queueIdle() { doGcIfNeeded(); - nPurgePendingResources(); + purgePendingResources(); return false; } } @@ -2088,9 +2088,7 @@ public final class ActivityThread extends ClientTransactionHandler { final class PurgeIdler implements MessageQueue.IdleHandler { @Override public boolean queueIdle() { - Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "purgePendingResources"); - nPurgePendingResources(); - Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); + purgePendingResources(); return false; } } @@ -2460,13 +2458,17 @@ public final class ActivityThread extends ClientTransactionHandler { } void doGcIfNeeded() { + doGcIfNeeded("bg"); + } + + void doGcIfNeeded(String reason) { mGcIdlerScheduled = false; final long now = SystemClock.uptimeMillis(); //Slog.i(TAG, "**** WE MIGHT WANT TO GC: then=" + Binder.getLastGcTime() // + "m now=" + now); if ((BinderInternal.getLastGcTime()+MIN_TIME_BETWEEN_GCS) < now) { //Slog.i(TAG, "**** WE DO, WE DO WANT TO GC!"); - BinderInternal.forceGc("bg"); + BinderInternal.forceGc(reason); } } @@ -6006,6 +6008,16 @@ public final class ActivityThread extends ClientTransactionHandler { WindowManagerGlobal.getInstance().trimMemory(level); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); + + if (SystemProperties.getInt("debug.am.run_gc_trim_level", Integer.MAX_VALUE) <= level) { + unscheduleGcIdler(); + doGcIfNeeded("tm"); + } + if (SystemProperties.getInt("debug.am.run_mallopt_trim_level", Integer.MAX_VALUE) + <= level) { + unschedulePurgeIdler(); + purgePendingResources(); + } } private void setupGraphicsSupport(Context context) { @@ -7346,6 +7358,12 @@ public final class ActivityThread extends ClientTransactionHandler { throw new RuntimeException("Main thread loop unexpectedly exited"); } + private void purgePendingResources() { + Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "purgePendingResources"); + nPurgePendingResources(); + Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); + } + // ------------------ Regular JNI ------------------------ private native void nPurgePendingResources(); private native void nDumpGraphicsInfo(FileDescriptor fd); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 529677aea653..c3dd82729d6d 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -234,7 +234,9 @@ public abstract class Context { BIND_ALLOW_OOM_MANAGEMENT, BIND_WAIVE_PRIORITY, BIND_IMPORTANT, - BIND_ADJUST_WITH_ACTIVITY + BIND_ADJUST_WITH_ACTIVITY, + BIND_NOT_PERCEPTIBLE, + BIND_INCLUDE_CAPABILITIES }) @Retention(RetentionPolicy.SOURCE) public @interface BindServiceFlags {} @@ -329,26 +331,25 @@ public abstract class Context { public static final int BIND_ADJUST_WITH_ACTIVITY = 0x0080; /** + * Flag for {@link #bindService}: If binding from an app that is visible or user-perceptible, + * lower the target service's importance to below the perceptible level. This allows + * the system to (temporarily) expunge the bound process from memory to make room for more + * important user-perceptible processes. + */ + public static final int BIND_NOT_PERCEPTIBLE = 0x00000100; + + /** * Flag for {@link #bindService}: If binding from an app that has specific capabilities * due to its foreground state such as an activity or foreground service, then this flag will * allow the bound app to get the same capabilities, as long as it has the required permissions * as well. */ - public static final int BIND_INCLUDE_CAPABILITIES = 0x00001000; + public static final int BIND_INCLUDE_CAPABILITIES = 0x000001000; /*********** Public flags above this line ***********/ /*********** Hidden flags below this line ***********/ /** - * Flag for {@link #bindService}: If binding from something better than perceptible, - * still set the adjust below perceptible. This would be used for bound services that can - * afford to be evicted when under extreme memory pressure, but should be restarted as soon - * as possible. - * @hide - */ - public static final int BIND_ADJUST_BELOW_PERCEPTIBLE = 0x00040000; - - /** * Flag for {@link #bindService}: This flag is intended to be used only by the system to adjust * the scheduling policy for IMEs (and any other out-of-process user-visible components that * work closely with the top app) so that UI hosted in such services can have the same @@ -473,7 +474,7 @@ public abstract class Context { */ public static final int BIND_REDUCTION_FLAGS = Context.BIND_ALLOW_OOM_MANAGEMENT | Context.BIND_WAIVE_PRIORITY - | Context.BIND_ADJUST_BELOW_PERCEPTIBLE | Context.BIND_NOT_VISIBLE; + | Context.BIND_NOT_PERCEPTIBLE | Context.BIND_NOT_VISIBLE; /** @hide */ @IntDef(flag = true, prefix = { "RECEIVER_VISIBLE_" }, value = { diff --git a/core/java/android/net/SocketKeepalive.java b/core/java/android/net/SocketKeepalive.java index 46eddde968a0..ec73866a647d 100644 --- a/core/java/android/net/SocketKeepalive.java +++ b/core/java/android/net/SocketKeepalive.java @@ -44,9 +44,11 @@ import java.util.concurrent.Executor; * {@link SocketKeepalive.Callback#onStopped} if the operation was successful or * {@link SocketKeepalive.Callback#onError} if an error occurred. * - * The device SHOULD support keepalive offload. If it does not, it MUST reply with + * For cellular, the device MUST support at least 1 keepalive slot. + * + * For WiFi, the device SHOULD support keepalive offload. If it does not, it MUST reply with * {@link SocketKeepalive.Callback#onError} with {@code ERROR_UNSUPPORTED} to any keepalive offload - * request. If it does, it MUST support at least 3 concurrent keepalive slots per transport. + * request. If it does, it MUST support at least 3 concurrent keepalive slots. */ public abstract class SocketKeepalive implements AutoCloseable { static final String TAG = "SocketKeepalive"; diff --git a/core/java/android/net/util/KeepaliveUtils.java b/core/java/android/net/util/KeepaliveUtils.java index 569fed1fc994..bfc4563fbf8f 100644 --- a/core/java/android/net/util/KeepaliveUtils.java +++ b/core/java/android/net/util/KeepaliveUtils.java @@ -34,9 +34,6 @@ public final class KeepaliveUtils { public static final String TAG = "KeepaliveUtils"; - // Minimum supported keepalive count per transport if the network supports keepalive. - public static final int MIN_SUPPORTED_KEEPALIVE_COUNT = 3; - public static class KeepaliveDeviceConfigurationException extends AndroidRuntimeException { public KeepaliveDeviceConfigurationException(final String msg) { super(msg); @@ -84,10 +81,7 @@ public final class KeepaliveUtils { throw new KeepaliveDeviceConfigurationException("Invalid transport " + transport); } - // Customized values should be either 0 to indicate the network doesn't support - // keepalive offload, or a positive value that is at least - // MIN_SUPPORTED_KEEPALIVE_COUNT if supported. - if (supported != 0 && supported < MIN_SUPPORTED_KEEPALIVE_COUNT) { + if (supported < 0) { throw new KeepaliveDeviceConfigurationException( "Invalid supported count " + supported + " for " + NetworkCapabilities.transportNameOf(transport)); diff --git a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java index 2ebf2fd820d8..aacf63a112b1 100644 --- a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java +++ b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java @@ -60,10 +60,16 @@ public abstract class AbstractSinglePendingRequestRemoteService<S @Override // from AbstractRemoteService protected void handleOnDestroy() { - if (mPendingRequest != null) { - mPendingRequest.cancel(); + handleCancelPendingRequest(); + } + + protected BasePendingRequest<S, I> handleCancelPendingRequest() { + BasePendingRequest<S, I> pendingRequest = mPendingRequest; + if (pendingRequest != null) { + pendingRequest.cancel(); mPendingRequest = null; } + return pendingRequest; } @Override // from AbstractRemoteService diff --git a/core/proto/android/server/activitymanagerservice.proto b/core/proto/android/server/activitymanagerservice.proto index a7d4734f43b9..7fb6f98ab662 100644 --- a/core/proto/android/server/activitymanagerservice.proto +++ b/core/proto/android/server/activitymanagerservice.proto @@ -591,6 +591,8 @@ message ConnectionRecordProto { SHOWING_UI = 13; NOT_VISIBLE = 14; DEAD = 15; + NOT_PERCEPTIBLE = 16; + INCLUDE_CAPABILITIES = 17; } repeated Flag flags = 3; optional string service_name = 4; diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index dd75c5604c60..d6604f42e637 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -364,7 +364,7 @@ overridden by the device to present the capability of creating socket keepalives. --> <!-- An Array of "[NetworkCapabilities.TRANSPORT_*],[supported keepalives] --> <string-array translatable="false" name="config_networkSupportedKeepaliveCount"> - <item>0,3</item> + <item>0,1</item> <item>1,3</item> </string-array> diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index 150b6f918685..8d420e2c5598 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -211,21 +211,22 @@ void JMediaCodec::registerSelf() { } void JMediaCodec::release() { - if (mCodec != NULL) { - mCodec->release(); - mCodec.clear(); - mInitStatus = NO_INIT; - } + std::call_once(mReleaseFlag, [this] { + if (mCodec != NULL) { + mCodec->release(); + mInitStatus = NO_INIT; + } - if (mLooper != NULL) { - mLooper->unregisterHandler(id()); - mLooper->stop(); - mLooper.clear(); - } + if (mLooper != NULL) { + mLooper->unregisterHandler(id()); + mLooper->stop(); + mLooper.clear(); + } + }); } JMediaCodec::~JMediaCodec() { - if (mCodec != NULL || mLooper != NULL) { + if (mLooper != NULL) { /* MediaCodec and looper should have been released explicitly already * in setMediaCodec() (see comments in setMediaCodec()). * diff --git a/media/jni/android_media_MediaCodec.h b/media/jni/android_media_MediaCodec.h index de08550fa3db..dfe30a3f5909 100644 --- a/media/jni/android_media_MediaCodec.h +++ b/media/jni/android_media_MediaCodec.h @@ -17,6 +17,8 @@ #ifndef _ANDROID_MEDIA_MEDIACODEC_H_ #define _ANDROID_MEDIA_MEDIACODEC_H_ +#include <mutex> + #include "jni.h" #include <media/MediaAnalyticsItem.h> @@ -156,6 +158,7 @@ private: sp<ALooper> mLooper; sp<MediaCodec> mCodec; AString mNameAtCreation; + std::once_flag mReleaseFlag; sp<AMessage> mCallbackNotification; sp<AMessage> mOnFrameRenderedNotification; diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml index da625facaa20..4200b43b6281 100644 --- a/packages/SystemUI/res/values-ca/strings.xml +++ b/packages/SystemUI/res/values-ca/strings.xml @@ -451,8 +451,8 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"S\'ha activat l\'estalvi de bateria"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"Redueix el rendiment i l\'ús de les dades en segon pla."</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desactiva l\'estalvi de bateria"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"Quan graves o emets contingut, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> pot capturar la informació sensible que es mostri a la pantalla o que reprodueixi el dispositiu, com ara àudio, contrasenyes, informació de pagament, fotos i missatges."</string> - <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"Quan graves o emets contingut, el servei que ofereix aquesta funció pot capturar informació sensible que es mostri a la pantalla o que reprodueixi el dispositiu, com ara àudio, contrasenyes, informació de pagament, fotos i missatges."</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"Quan graves o emets contingut, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> pot capturar la informació sensible que es mostri a la pantalla o que es reprodueixi al dispositiu, com ara àudio, contrasenyes, informació de pagament, fotos i missatges."</string> + <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"Quan graves o emets contingut, el servei que ofereix aquesta funció pot capturar informació sensible que es mostri a la pantalla o que es reprodueixi al dispositiu, com ara àudio, contrasenyes, informació de pagament, fotos i missatges."</string> <string name="media_projection_dialog_title" msgid="8124184308671641248">"Es mostra informació sensible durant l\'emissió o la gravació"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"No ho tornis a mostrar"</string> <string name="clear_all_notifications_text" msgid="814192889771462828">"Esborra-ho tot"</string> diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml index a6bd968ed65f..981e0cfb6fc9 100644 --- a/packages/SystemUI/res/values-es/strings.xml +++ b/packages/SystemUI/res/values-es/strings.xml @@ -451,9 +451,9 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"Ahorro de batería activado"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduce el rendimiento y los datos en segundo plano"</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desactivar Ahorro de batería"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"Mientras graba o envía contenido, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> puede obtener información sensible que se muestre en la pantalla o que se reproduzca en el dispositivo, como audio, contraseñas, información de pagos, fotos y mensajes."</string> - <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"Mientras graba o envía contenido, el servicio que ofrece esta función puede obtener información sensible que se muestre en la pantalla o que se reproduzca en el dispositivo, como audio, contraseñas, información de pagos, fotos y mensajes."</string> - <string name="media_projection_dialog_title" msgid="8124184308671641248">"Se muestra información sensible durante el envío y la grabación"</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"Mientras grabas o envías contenido, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> puede capturar información sensible que se muestre en la pantalla o que se reproduzca en el dispositivo, como audio, contraseñas, información de pagos, fotos y mensajes."</string> + <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"Mientras grabas o envías contenido, el servicio que ofrece esta función puede capturar información sensible que se muestre en la pantalla o que se reproduzca en el dispositivo, como audio, contraseñas, información de pagos, fotos y mensajes."</string> + <string name="media_projection_dialog_title" msgid="8124184308671641248">"Sobre información sensible durante el envío y la grabación"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"No volver a mostrar"</string> <string name="clear_all_notifications_text" msgid="814192889771462828">"Borrar todo"</string> <string name="manage_notifications_text" msgid="2386728145475108753">"Gestionar"</string> diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml index 0477057beee1..5c4d71ebfe08 100644 --- a/packages/SystemUI/res/values-fr/strings.xml +++ b/packages/SystemUI/res/values-fr/strings.xml @@ -451,9 +451,9 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"Économiseur de batterie activé"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"Limite les performances et les données en arrière-plan."</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Désactiver l\'économiseur de batterie"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"Pendant que vous enregistrez ou diffusez du contenu, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> peut capturer des informations sensibles affichées à l\'écran ou lues par votre appareil, y compris des contenus audio, des mots de passe, des informations de paiement, des photos et des messages."</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"Pendant que vous enregistrez ou diffusez du contenu, l\'appli <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> peut capturer des informations sensibles affichées à l\'écran ou lues par votre appareil, y compris des contenus audio, des mots de passe, des informations de paiement, des photos et des messages."</string> <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"Pendant que vous enregistrez ou diffusez du contenu, le service concerné peut capturer des informations sensibles affichées à l\'écran ou lues par votre appareil, y compris des contenus audio, des mots de passe, des informations de paiement, des photos et des messages."</string> - <string name="media_projection_dialog_title" msgid="8124184308671641248">"Exposition d\'informations sensibles lors de l\'enregistrement ou de la diffusion de contenu"</string> + <string name="media_projection_dialog_title" msgid="8124184308671641248">"Présence d\'informations sensibles lors de l\'enregistrement ou de la diffusion de contenu"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"Ne plus afficher"</string> <string name="clear_all_notifications_text" msgid="814192889771462828">"Tout effacer"</string> <string name="manage_notifications_text" msgid="2386728145475108753">"Gérer"</string> diff --git a/packages/SystemUI/res/values-km/strings.xml b/packages/SystemUI/res/values-km/strings.xml index 13a0f1f7b5b6..5b0a1ea3077d 100644 --- a/packages/SystemUI/res/values-km/strings.xml +++ b/packages/SystemUI/res/values-km/strings.xml @@ -451,9 +451,9 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"កម្មវិធីសន្សំថ្មបានបើក"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"ការបន្ថយការប្រតិបត្តិ និងទិន្នន័យផ្ទៃខាងក្រោយ"</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"បិទកម្មវិធីសន្សំថ្ម"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"នៅពេលកំពុងថត ឬបញ្ជូន <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> អាចថតព័ត៌មានរសើបទាំងឡាយដែលបង្ហាញនៅលើអេក្រង់របស់អ្នក ឬដែលចាក់ពីឧបករណ៍របស់អ្នក រួមទាំងព័ត៌មានរសើបដូចជា សំឡេង ពាក្យសម្ងាត់ ព័ត៌មានបង់ប្រាក់ រូបថត និងសារជាដើម។"</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"នៅពេលកំពុងថត ឬភ្ជាប់ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> អាចថតព័ត៌មានរសើបទាំងឡាយដែលបង្ហាញនៅលើអេក្រង់របស់អ្នក ឬដែលចាក់ពីឧបករណ៍របស់អ្នក រួមទាំងព័ត៌មានរសើបដូចជា សំឡេង ពាក្យសម្ងាត់ ព័ត៌មានបង់ប្រាក់ រូបថត និងសារជាដើម។"</string> <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"នៅពេលកំពុងថត ឬបញ្ជូន សេវាកម្មដែលផ្ដល់មុខងារនេះអាចថតព័ត៌មានរសើបទាំងឡាយដែលបង្ហាញនៅលើអេក្រង់របស់អ្នក ឬដែលចាក់ពីឧបករណ៍របស់អ្នក រួមទាំងព័ត៌មានរសើបដូចជា សំឡេង ពាក្យសម្ងាត់ ព័ត៌មានបង់ប្រាក់ រូបថត និងសារជាដើម។"</string> - <string name="media_projection_dialog_title" msgid="8124184308671641248">"បង្ហាញព័ត៌មានរសើប អំឡុងពេលបញ្ជូន/ថត"</string> + <string name="media_projection_dialog_title" msgid="8124184308671641248">"ការបង្ហាញព័ត៌មានរសើប អំឡុងពេលភ្ជាប់/ថត"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"កុំបង្ហាញម្ដងទៀត"</string> <string name="clear_all_notifications_text" msgid="814192889771462828">"សម្អាតទាំងអស់"</string> <string name="manage_notifications_text" msgid="2386728145475108753">"គ្រប់គ្រង"</string> diff --git a/packages/SystemUI/res/values-ml/strings.xml b/packages/SystemUI/res/values-ml/strings.xml index 7367fa545727..caa07faf92f0 100644 --- a/packages/SystemUI/res/values-ml/strings.xml +++ b/packages/SystemUI/res/values-ml/strings.xml @@ -451,7 +451,7 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"ബാറ്ററി ലാഭിക്കൽ ഓണാണ്"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"പ്രവർത്തനവും പശ്ചാത്തല ഡാറ്റയും കുറയ്ക്കുന്നു"</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ബാറ്ററി ലാഭിക്കൽ ഓഫാക്കുക"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"റെക്കോർഡ് അല്ലെങ്കിൽ കാസ്റ്റ് ചെയ്യുന്നതിനിടെ, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> നിങ്ങളുടെ സ്ക്രീനിൽ ദൃശ്യമാകുന്നതോ നിങ്ങളുടെ ഉപകരണത്തിൽ നിന്ന് പ്ലേ ചെയ്തതോ ആയ ഓഡിയോ, പാസ്വേഡുകൾ, പേയ്മെന്റ് വിവരം, ഫോട്ടോകൾ, സന്ദേശങ്ങൾ എന്നിവ ഉൾപ്പെടെയുള്ള തന്ത്രപ്രധാന വിവരങ്ങൾ ക്യാപ്ചർ ചെയ്യാനാവും."</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"റെക്കോർഡ് അല്ലെങ്കിൽ കാസ്റ്റ് ചെയ്യുന്നതിനിടെ, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> എന്നതിന് നിങ്ങളുടെ സ്ക്രീനിൽ ദൃശ്യമാകുന്നതോ നിങ്ങളുടെ ഉപകരണത്തിൽ നിന്ന് പ്ലേ ചെയ്തതോ ആയ ഓഡിയോ, പാസ്വേഡുകൾ, പേയ്മെന്റ് വിവരം, ഫോട്ടോകൾ, സന്ദേശങ്ങൾ എന്നിവ ഉൾപ്പെടെയുള്ള തന്ത്രപ്രധാന വിവരങ്ങൾ ക്യാപ്ചർ ചെയ്യാനാവും."</string> <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"റെക്കോർഡ് അല്ലെങ്കിൽ കാസ്റ്റ് ചെയ്യുന്നതിനിടെ, ഈ പ്രവർത്തനത്തിനാവശ്യമായ സേവനത്തിന്, നിങ്ങളുടെ സ്ക്രീനിൽ ദൃശ്യമാകുന്നതോ ഉപകരണത്തിൽ നിന്ന് പ്ലേ ചെയ്തതോ ആയ ഓഡിയോ, പാസ്വേഡുകൾ, പേയ്മെന്റ് വിവരം, ഫോട്ടോകൾ, സന്ദേശങ്ങൾ എന്നിവ ഉൾപ്പെടെയുള്ള തന്ത്രപ്രധാന വിവരങ്ങൾ ക്യാപ്ചർ ചെയ്യാനാവും."</string> <string name="media_projection_dialog_title" msgid="8124184308671641248">"കാസ്റ്റ്/റെക്കോർഡ് ചെയ്യുമ്പോൾ സൂക്ഷ്മമായി കൈകാര്യം ചെയ്യേണ്ട വിവരം വെളിപ്പെടുത്തുന്നു"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"വീണ്ടും കാണിക്കരുത്"</string> diff --git a/packages/SystemUI/res/values-my/strings.xml b/packages/SystemUI/res/values-my/strings.xml index 650f35e30353..adbbb6437166 100644 --- a/packages/SystemUI/res/values-my/strings.xml +++ b/packages/SystemUI/res/values-my/strings.xml @@ -451,7 +451,7 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"ဘက်ထရီ အားထိန်းကို ဖွင့်ထားခြင်း"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"လုပ်ကိုင်မှုကို လျှော့ချလျက် နောက်ခံ ဒေတာကို ကန့်သတ်သည်"</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ဘက်ထရီ အားထိန်းကို ပိတ်ရန်"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"အသံဖမ်းနေစဉ် (သို့) ကာစ်လုပ်နေစဉ် <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> သည် အသံ၊ စကားဝှက်၊ ငွေပေးချေမှုဆိုင်ရာ အချက်အလက်၊ ဓာတ်ပုံနှင့် မက်ဆေ့ဂျ်များကဲ့သို့ အရေးကြီးသည့် အချက်အလက်များအပါအဝင် သင့်မျက်နှာပြင်တွင် ပြသထားသော (သို့) သင့်စက်တွင် ဖွင့်ထားသော အရေးကြီးသည့် အချက်အလက်မှန်သမျှကို ဖမ်းယူနိုင်ပါသည်။"</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"အသံဖမ်းနေစဉ် (သို့) ကာစ်လုပ်နေစဉ် <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> သည် အသံ၊ စကားဝှက်၊ ငွေပေးချေမှုဆိုင်ရာ အချက်အလက်၊ ဓာတ်ပုံနှင့် မက်ဆေ့ဂျ်များကဲ့သို့ အရေးကြီးသည့် အချက်အလက်များအပါအဝင် ဖန်သားပြင်တွင် ပြသထားသော (သို့) သင့်စက်တွင် ဖွင့်ထားသော အရေးကြီးသည့် အချက်အလက်မှန်သမျှကို ဖမ်းယူနိုင်ပါသည်။"</string> <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"အသံဖမ်းနေစဉ် (သို့) ကာစ်လုပ်နေစဉ် ဤလုပ်ဆောင်ချက်ကို ပေးအပ်သည့် ဝန်ဆောင်မှုသည် အသံ၊ စကားဝှက်၊ ငွေပေးချေမှုဆိုင်ရာ အချက်အလက်၊ ဓာတ်ပုံနှင့် မက်ဆေ့ဂျ်များကဲ့သို့ အရေးကြီးသည့် အချက်အလက်များအပါအဝင် သင့်မျက်နှာပြင်တွင် ပြသထားသော (သို့) သင့်စက်တွင် ဖွင့်ထားသော အရေးကြီးသည့် အချက်အလက်မှန်သမျှကို ဖမ်းယူနိုင်ပါသည်။"</string> <string name="media_projection_dialog_title" msgid="8124184308671641248">"ကာစ်လုပ်နေစဉ်/အသံဖမ်းနေစဉ် အရေးကြီးသောအချက်အလက်များ ထုတ်ဖော်မိခြင်း"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"နောက်ထပ် မပြပါနှင့်"</string> diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml index 29c423af0cfb..df437b33a9eb 100644 --- a/packages/SystemUI/res/values-pl/strings.xml +++ b/packages/SystemUI/res/values-pl/strings.xml @@ -459,7 +459,7 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"Oszczędzanie baterii jest włączone"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"Zmniejsza wydajność i ogranicza dane w tle"</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Wyłącz Oszczędzanie baterii"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"Podczas nagrywania lub przesyłania aplikacja <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> może rejestrować wszelkie informacje poufne wyświetlane na ekranie lub odtwarzane na urządzeniu takie jak dźwięki czy podawane hasła, informacje o płatnościach, zdjęcia i wiadomości."</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"Podczas nagrywania lub przesyłania aplikacja <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> może rejestrować wszelkie informacje poufne wyświetlane na ekranie lub odtwarzane na urządzeniu, takie jak dźwięki czy podawane hasła, informacje o płatnościach, zdjęcia i wiadomości."</string> <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"Podczas nagrywania lub przesyłania usługa udostępniająca tę funkcję może rejestrować wszelkie informacje poufne wyświetlane na ekranie lub odtwarzane na urządzeniu takie jak dźwięki czy podawane hasła, informacje o płatnościach, zdjęcia i wiadomości."</string> <string name="media_projection_dialog_title" msgid="8124184308671641248">"Ujawnianie poufnych informacji podczas przesyłania/nagrywania"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"Nie pokazuj ponownie"</string> diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml index c03c108613f3..f5ed50f944b3 100644 --- a/packages/SystemUI/res/values-ru/strings.xml +++ b/packages/SystemUI/res/values-ru/strings.xml @@ -197,7 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Сменить сеть"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Сведения о расходе заряда батареи"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Заряд батареи в процентах: <xliff:g id="NUMBER">%d</xliff:g>."</string> - <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Заряд батареи – <xliff:g id="PERCENTAGE">%1$s</xliff:g> %. При текущем уровне расхода его хватит примерно на такое время: <xliff:g id="TIME">%2$s</xliff:g>."</string> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Заряд батареи в процентах: <xliff:g id="PERCENTAGE">%1$s</xliff:g>. Оценка оставшегося времени работы: <xliff:g id="TIME">%2$s</xliff:g>."</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Зарядка батареи. Текущий заряд: <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> %%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Настройки"</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Уведомления"</string> @@ -457,7 +457,7 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"Режим энергосбережения включен"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"Откл. фоновой передачи данных"</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Отключить режим энергосбережения"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"При записи сообщений или трансляции экрана приложение \"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>\" может получить доступ к конфиденциальной информации, которая отображается на экране или воспроизводится на устройстве, например к аудиозаписям, паролям, фото, сообщениям и платежным данным."</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"При записи сообщений или трансляции экрана приложение <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> может получить доступ к конфиденциальной информации, которая отображается на экране или воспроизводится на устройстве, например к аудиозаписям, паролям, фото, сообщениям и платежным данным."</string> <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"При записи сообщений или трансляции экрана сервис может получить доступ к конфиденциальной информации, которая отображается на экране или воспроизводится на устройстве, например к аудиозаписям, паролям, фото, сообщениям и платежным данным."</string> <string name="media_projection_dialog_title" msgid="8124184308671641248">"Раскрытие личной информации при записи или трансляции"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"Больше не показывать"</string> diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml index 6a9d3d3f902e..0366303f4a38 100644 --- a/packages/SystemUI/res/values-sv/strings.xml +++ b/packages/SystemUI/res/values-sv/strings.xml @@ -453,7 +453,7 @@ <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Inaktivera batterisparläget"</string> <string name="media_projection_dialog_text" msgid="8585357687598538511">"När du spelar in eller castar kan <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> registrera vilka känsliga uppgifter som helst som visas på skärmen eller spelas upp på enheten, inklusive ljud, lösenord, betalningsuppgifter, foton och meddelanden."</string> <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"När du spelar in eller castar kan tjänsten som tillhandahåller funktionen registrera vilka känsliga uppgifter som helst som visas på skärmen eller spelas upp på enheten, inklusive ljud, lösenord, betalningsuppgifter, foton och meddelanden."</string> - <string name="media_projection_dialog_title" msgid="8124184308671641248">"Avslöja känsliga uppgifter under inspelning och vid castning"</string> + <string name="media_projection_dialog_title" msgid="8124184308671641248">"Känsliga uppgifters synlighet under inspelning och vid castning"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"Visa inte igen"</string> <string name="clear_all_notifications_text" msgid="814192889771462828">"Rensa alla"</string> <string name="manage_notifications_text" msgid="2386728145475108753">"Hantera"</string> diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java index db13ef4821e8..7fbe5db99569 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java @@ -21,7 +21,9 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import android.annotation.IntDef; +import android.content.Context; import android.content.res.Resources; +import android.view.ViewConfiguration; import android.view.WindowManagerPolicyConstants; import com.android.internal.policy.ScreenDecorationsUtils; @@ -101,6 +103,18 @@ public class QuickStepContract { } /** + * Ratio of quickstep touch slop (when system takes over the touch) to view touch slop + */ + public static final float QUICKSTEP_TOUCH_SLOP_RATIO = 3; + + /** + * Touch slop for quickstep gesture + */ + public static final float getQuickStepTouchSlopPx(Context context) { + return QUICKSTEP_TOUCH_SLOP_RATIO * ViewConfiguration.get(context).getScaledTouchSlop(); + } + + /** * Touch slopes and thresholds for quick step operations. Drag slop is the point where the * home button press/long press over are ignored and will start to drag when exceeded and the * touch slop is when the respected operation will occur when exceeded. Touch slop must be diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java index 2f245fff1824..bfd17b9abc72 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java @@ -45,6 +45,7 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, private final NavigationBarView mNavigationBarView; private final LightBarTransitionsController mLightBarController; private int mNavBarMode = NAV_BAR_MODE_3BUTTON; + private boolean mWindowVisible; private final CompositionSamplingListener mSamplingListener; private final Runnable mUpdateSamplingListener = this::updateSamplingListener; @@ -148,7 +149,7 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, mSamplingListenerRegistered = false; CompositionSamplingListener.unregister(mSamplingListener); } - if (mSamplingEnabled && !mSamplingBounds.isEmpty() + if (mSamplingEnabled && mWindowVisible && !mSamplingBounds.isEmpty() && mNavigationBarView.isAttachedToWindow()) { if (!mNavigationBarView.getViewRootImpl().getSurfaceControl().isValid()) { // The view may still be attached, but the surface backing the window can be @@ -180,6 +181,11 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, } } + public void setWindowVisible(boolean visible) { + mWindowVisible = visible; + requestUpdateSamplingListener(); + } + public void onNavigationModeChanged(int mode) { mNavBarMode = mode; } @@ -194,6 +200,7 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, pw.println(" mSamplingBounds: " + mSamplingBounds); pw.println(" mLastMedianLuma: " + mLastMedianLuma); pw.println(" mCurrentMedianLuma: " + mCurrentMedianLuma); + pw.println(" mWindowVisible: " + mWindowVisible); } public static boolean isEnabled(Context context, int navBarMode) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java index b56abcdf9f17..e9731c521308 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java @@ -322,6 +322,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback mNavigationBarView.getLightTransitionsController().restoreState(savedInstanceState); } mNavigationBarView.setNavigationIconHints(mNavigationIconHints); + mNavigationBarView.setWindowVisible(isNavBarWindowVisible()); prepareNavigationBarView(); checkNavBarModes(); @@ -467,8 +468,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback if (DEBUG_WINDOW_STATE) Log.d(TAG, "Navigation bar " + windowStateToString(state)); updateSystemUiStateFlags(-1); - mNavigationBarView.getRotationButtonController().onNavigationBarWindowVisibilityChange( - isNavBarWindowVisible()); + mNavigationBarView.setWindowVisible(isNavBarWindowVisible()); } } 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 9919abd018df..776cd4d71c94 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -533,6 +533,11 @@ public class NavigationBarView extends FrameLayout implements return KeyButtonDrawable.create(mContext, icon, hasShadow); } + public void setWindowVisible(boolean visible) { + mTintController.setWindowVisible(visible); + mRotationButtonController.onNavigationBarWindowVisibilityChange(visible); + } + @Override public void setLayoutDirection(int layoutDirection) { reloadNavIcons(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java index 64b28424ae63..c2f246f3922f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java @@ -249,13 +249,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface { x = (int)ev.getRawX(); y = (int)ev.getRawY(); - boolean exceededTouchSlopX = Math.abs(x - mTouchDownX) > (mIsVertical - ? QuickStepContract.getQuickScrubTouchSlopPx() - : QuickStepContract.getQuickStepTouchSlopPx()); - boolean exceededTouchSlopY = Math.abs(y - mTouchDownY) > (mIsVertical - ? QuickStepContract.getQuickStepTouchSlopPx() - : QuickStepContract.getQuickScrubTouchSlopPx()); - if (exceededTouchSlopX || exceededTouchSlopY) { + float slop = QuickStepContract.getQuickStepTouchSlopPx(getContext()); + if (Math.abs(x - mTouchDownX) > slop || Math.abs(y - mTouchDownY) > slop) { // When quick step is enabled, prevent animating the ripple triggered by // setPressed and decide to run it on touch up setPressed(false); diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java index 0ce6c87f1f28..3143bcb23c3a 100644 --- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java +++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java @@ -41,6 +41,8 @@ import android.util.Slog; import com.android.internal.infra.AbstractSinglePendingRequestRemoteService; +import java.util.concurrent.CompletableFuture; + final class RemoteFillService extends AbstractSinglePendingRequestRemoteService<RemoteFillService, IAutoFillService> { @@ -103,26 +105,21 @@ final class RemoteFillService * <p>This can be used when the request is unnecessary or will be superceeded by a request that * will soon be queued. * - * @return the id of the canceled request, or {@link FillRequest#INVALID_REQUEST_ID} if no - * {@link PendingFillRequest} was canceled. + * @return the future id of the canceled request, or {@link FillRequest#INVALID_REQUEST_ID} if + * no {@link PendingFillRequest} was canceled. */ - // TODO(b/117779333): move this logic to super class (and make mPendingRequest private) - public int cancelCurrentRequest() { - if (isDestroyed()) { - return INVALID_REQUEST_ID; - } - - int requestId = INVALID_REQUEST_ID; - if (mPendingRequest != null) { - if (mPendingRequest instanceof PendingFillRequest) { - requestId = ((PendingFillRequest) mPendingRequest).mRequest.getId(); + public CompletableFuture<Integer> cancelCurrentRequest() { + return CompletableFuture.supplyAsync(() -> { + if (isDestroyed()) { + return INVALID_REQUEST_ID; } - mPendingRequest.cancel(); - mPendingRequest = null; - } - - return requestId; + BasePendingRequest<RemoteFillService, IAutoFillService> canceledRequest = + handleCancelPendingRequest(); + return canceledRequest instanceof PendingFillRequest + ? ((PendingFillRequest) canceledRequest).mRequest.getId() + : INVALID_REQUEST_ID; + }, mHandler::post); } public void onFillRequest(@NonNull FillRequest request) { diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 3764ca4b7906..895a2ae49758 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -546,21 +546,26 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState + "mForAugmentedAutofillOnly: %s", mForAugmentedAutofillOnly); return; } - final int canceledRequest = mRemoteFillService.cancelCurrentRequest(); + mRemoteFillService.cancelCurrentRequest().whenComplete((canceledRequest, err) -> { + if (err != null) { + Slog.e(TAG, "cancelCurrentRequest(): unexpected exception", err); + return; + } - // Remove the FillContext as there will never be a response for the service - if (canceledRequest != INVALID_REQUEST_ID && mContexts != null) { - final int numContexts = mContexts.size(); + // Remove the FillContext as there will never be a response for the service + if (canceledRequest != INVALID_REQUEST_ID && mContexts != null) { + final int numContexts = mContexts.size(); - // It is most likely the last context, hence search backwards - for (int i = numContexts - 1; i >= 0; i--) { - if (mContexts.get(i).getRequestId() == canceledRequest) { - if (sDebug) Slog.d(TAG, "cancelCurrentRequest(): id = " + canceledRequest); - mContexts.remove(i); - break; + // It is most likely the last context, hence search backwards + for (int i = numContexts - 1; i >= 0; i--) { + if (mContexts.get(i).getRequestId() == canceledRequest) { + if (sDebug) Slog.d(TAG, "cancelCurrentRequest(): id = " + canceledRequest); + mContexts.remove(i); + break; + } } } - } + }); } /** @@ -2090,8 +2095,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState updateValuesForSaveLocked(); // Remove pending fill requests as the session is finished. - cancelCurrentRequestLocked(); + cancelCurrentRequestLocked(); final ArrayList<FillContext> contexts = mergePreviousSessionLocked( /* forSave= */ true); final SaveRequest saveRequest = diff --git a/services/core/java/com/android/server/am/ConnectionRecord.java b/services/core/java/com/android/server/am/ConnectionRecord.java index fe9554255feb..459508486384 100644 --- a/services/core/java/com/android/server/am/ConnectionRecord.java +++ b/services/core/java/com/android/server/am/ConnectionRecord.java @@ -65,6 +65,8 @@ final class ConnectionRecord { Context.BIND_VISIBLE, Context.BIND_SHOWING_UI, Context.BIND_NOT_VISIBLE, + Context.BIND_NOT_PERCEPTIBLE, + Context.BIND_INCLUDE_CAPABILITIES, }; private static final int[] BIND_PROTO_ENUMS = new int[] { ConnectionRecordProto.AUTO_CREATE, @@ -82,6 +84,8 @@ final class ConnectionRecord { ConnectionRecordProto.VISIBLE, ConnectionRecordProto.SHOWING_UI, ConnectionRecordProto.NOT_VISIBLE, + ConnectionRecordProto.NOT_PERCEPTIBLE, + ConnectionRecordProto.INCLUDE_CAPABILITIES, }; void dump(PrintWriter pw, String prefix) { @@ -212,6 +216,12 @@ final class ConnectionRecord { if ((flags&Context.BIND_NOT_VISIBLE) != 0) { sb.append("!VIS "); } + if ((flags & Context.BIND_NOT_PERCEPTIBLE) != 0) { + sb.append("!PRCP "); + } + if ((flags & Context.BIND_INCLUDE_CAPABILITIES) != 0) { + sb.append("CAPS "); + } if (serviceDead) { sb.append("DEAD "); } diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java index 7abfcea306cc..5ade50a5f248 100644 --- a/services/core/java/com/android/server/am/OomAdjuster.java +++ b/services/core/java/com/android/server/am/OomAdjuster.java @@ -1264,7 +1264,7 @@ public final class OomAdjuster { cr.trackProcState(procState, mAdjSeq, now); trackedProcState = true; } - } else if ((cr.flags & Context.BIND_ADJUST_BELOW_PERCEPTIBLE) != 0 + } else if ((cr.flags & Context.BIND_NOT_PERCEPTIBLE) != 0 && clientAdj < ProcessList.PERCEPTIBLE_APP_ADJ && adj > ProcessList.PERCEPTIBLE_LOW_APP_ADJ) { newAdj = ProcessList.PERCEPTIBLE_LOW_APP_ADJ; diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index d64a2c210f27..b399971d1ad5 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -184,8 +184,8 @@ public final class ProcessList { // is not entirely fatal but is generally a bad idea. static final int BACKUP_APP_ADJ = 300; - // This is a process bound by the system that's more important than services but not so - // perceptible that it affects the user immediately if killed. + // This is a process bound by the system (or other app) that's more important than services but + // not so perceptible that it affects the user immediately if killed. static final int PERCEPTIBLE_LOW_APP_ADJ = 250; // This is a process only hosting components that are perceptible to the @@ -279,7 +279,7 @@ public final class ProcessList { // can't give it a different value for every possible kind of process. private final int[] mOomAdj = new int[] { FOREGROUND_APP_ADJ, VISIBLE_APP_ADJ, PERCEPTIBLE_APP_ADJ, - BACKUP_APP_ADJ, CACHED_APP_MIN_ADJ, CACHED_APP_LMK_FIRST_ADJ + PERCEPTIBLE_LOW_APP_ADJ, CACHED_APP_MIN_ADJ, CACHED_APP_LMK_FIRST_ADJ }; // These are the low-end OOM level limits. This is appropriate for an // HVGA or smaller phone with less than 512MB. Values are in KB. diff --git a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java index 4b2e21d943ce..cb6424540f71 100644 --- a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java +++ b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java @@ -564,7 +564,7 @@ public class KeepaliveTracker { if (KeepaliveInfo.STARTING == ki.mStartedState) { if (SUCCESS == reason) { // Keepalive successfully started. - if (DBG) Log.d(TAG, "Started keepalive " + slot + " on " + nai.name()); + Log.d(TAG, "Started keepalive " + slot + " on " + nai.name()); ki.mStartedState = KeepaliveInfo.STARTED; try { ki.mCallback.onStarted(slot); diff --git a/services/core/java/com/android/server/job/JobServiceContext.java b/services/core/java/com/android/server/job/JobServiceContext.java index 65dac8bf7cdd..7da128f9d3ec 100644 --- a/services/core/java/com/android/server/job/JobServiceContext.java +++ b/services/core/java/com/android/server/job/JobServiceContext.java @@ -251,7 +251,7 @@ public final class JobServiceContext implements ServiceConnection { try { binding = mContext.bindServiceAsUser(intent, this, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND - | Context.BIND_NOT_VISIBLE | Context.BIND_ADJUST_BELOW_PERCEPTIBLE, + | Context.BIND_NOT_PERCEPTIBLE, new UserHandle(job.getUserId())); } catch (SecurityException e) { // Some permission policy, for example INTERACT_ACROSS_USERS and diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 82b16dea5b49..495a2edf8057 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -42,10 +42,10 @@ import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR; -import static android.content.Context.BIND_ADJUST_BELOW_PERCEPTIBLE; import static android.content.Context.BIND_ALLOW_WHITELIST_MANAGEMENT; import static android.content.Context.BIND_AUTO_CREATE; import static android.content.Context.BIND_FOREGROUND_SERVICE; +import static android.content.Context.BIND_NOT_PERCEPTIBLE; import static android.content.pm.ActivityInfo.DOCUMENT_LAUNCH_ALWAYS; import static android.content.pm.PackageManager.FEATURE_LEANBACK; import static android.content.pm.PackageManager.FEATURE_TELEVISION; @@ -7786,12 +7786,12 @@ public class NotificationManagerService extends SystemService { @Override protected int getBindFlags() { - // Most of the same flags as the base, but also add BIND_ADJUST_BELOW_PERCEPTIBLE + // Most of the same flags as the base, but also add BIND_NOT_PERCEPTIBLE // because too many 3P apps could be kept in memory as notification listeners and // cause extreme memory pressure. // TODO: Change the binding lifecycle of NotificationListeners to avoid this situation. return BIND_AUTO_CREATE | BIND_FOREGROUND_SERVICE - | BIND_ADJUST_BELOW_PERCEPTIBLE | BIND_ALLOW_WHITELIST_MANAGEMENT; + | BIND_NOT_PERCEPTIBLE | BIND_ALLOW_WHITELIST_MANAGEMENT; } @Override diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index d2031b6c7e9c..9f5fc9269a7c 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -1505,7 +1505,8 @@ public class PackageManagerService extends IPackageManager.Stub final List<String> whitelistedRestrictedPermissions = ((args.installFlags & PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS) != 0 && parentRes.pkg != null) - ? parentRes.pkg.requestedPermissions : null; + ? parentRes.pkg.requestedPermissions + : args.whitelistedRestrictedPermissions; // Handle the parent package handlePackagePostInstall(parentRes, grantPermissions, diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java index 63439d538224..0e2d1dbf49c2 100644 --- a/services/core/java/com/android/server/stats/StatsCompanionService.java +++ b/services/core/java/com/android/server/stats/StatsCompanionService.java @@ -1983,10 +1983,9 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { e.writeString(permName); e.writeInt(pkg.applicationInfo.uid); e.writeString(pkg.packageName); - e.writeInt(permissionFlags); - e.writeBoolean((pkg.requestedPermissionsFlags[permNum] & REQUESTED_PERMISSION_GRANTED) != 0); + e.writeInt(permissionFlags); pulledData.add(e); } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b7b511e5eb4b..39ad0d0b85f4 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1605,7 +1605,7 @@ public class TelephonyManager { * higher, then a SecurityException is thrown.</li> * </ul> * - * @deprecated Use (@link getImei} which returns IMEI for GSM or (@link getMeid} which returns + * @deprecated Use {@link #getImei} which returns IMEI for GSM or {@link #getMeid} which returns * MEID for CDMA. */ @Deprecated @@ -1648,7 +1648,7 @@ public class TelephonyManager { * * @param slotIndex of which deviceID is returned * - * @deprecated Use (@link getImei} which returns IMEI for GSM or (@link getMeid} which returns + * @deprecated Use {@link #getImei} which returns IMEI for GSM or {@link #getMeid} which returns * MEID for CDMA. */ @Deprecated @@ -1672,23 +1672,8 @@ public class TelephonyManager { * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not * available. * - * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or - * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier - * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a - * managed profile on the device; for more details see <a - * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner - * access is deprecated and will be removed in a future release. - * - * <p>If the calling app does not meet one of these requirements then this method will behave - * as follows: - * - * <ul> - * <li>If the calling app's target SDK is API level 28 or lower and the app has the - * READ_PHONE_STATE permission then null is returned.</li> - * <li>If the calling app's target SDK is API level 28 or lower and the app does not have - * the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or - * higher, then a SecurityException is thrown.</li> - * </ul> + * See {@link #getImei(int)} for details on the required permissions and behavior + * when the caller does not hold sufficient permissions. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -1700,12 +1685,17 @@ public class TelephonyManager { * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not * available. * - * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or - * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier - * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a - * managed profile on the device; for more details see <a - * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner - * access is deprecated and will be removed in a future release. + * <p>This API requires one of the following: + * <ul> + * <li>The caller holds the READ_PRIVILEGED_PHONE_STATE permission.</li> + * <li>If the caller is the device or profile owner, the caller holds the + * {@link Manifest.permission#READ_PHONE_STATE} permission.</li> + * <li>The caller has carrier privileges (see {@link #hasCarrierPrivileges()}.</li> + * <li>The caller is the default SMS app for the device.</li> + * </ul> + * <p>The profile owner is an app that owns a managed profile on the device; for more details + * see <a href="https://developer.android.com/work/managed-profiles">Work profiles</a>. + * Access by profile owners is deprecated and will be removed in a future release. * * <p>If the calling app does not meet one of these requirements then this method will behave * as follows: diff --git a/tests/net/java/android/net/util/KeepaliveUtilsTest.kt b/tests/net/java/android/net/util/KeepaliveUtilsTest.kt index 814e06e311b3..8ea226db938e 100644 --- a/tests/net/java/android/net/util/KeepaliveUtilsTest.kt +++ b/tests/net/java/android/net/util/KeepaliveUtilsTest.kt @@ -78,7 +78,6 @@ class KeepaliveUtilsTest { assertRunWithException(arrayOf("5")) // Check resource with invalid slots value. - assertRunWithException(arrayOf("2,2")) assertRunWithException(arrayOf("3,-1")) // Check resource with invalid transport type. |